:root {
    /* ── 라이트 모드 (기본) ── */
    --bg-primary:    #f6f8fa;
    --bg-secondary:  #ffffff;
    --bg-sidebar:    #ffffff;
    --bg-card:       #ffffff;
    --text-primary:  #1a1a2e;
    --text-secondary:#57606a;
    --accent:        #2563eb;
    --accent-hover:  #1d4ed8;
    --accent-soft:   #eff6ff;
    --border-color:  #e5e7eb;
    --header-bg:     #ffffff;
    --status-bar-bg: #2563eb;
    --status-bar-text:#ffffff;
    --card-shadow:   0 2px 8px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 8px 24px rgba(37,99,235,0.12);
    --tag-bg:        #eff6ff;
    --tag-color:     #2563eb;
    --nav-hover-bg:  #f0f4ff;
}

/* 다크 모드 — 시스템 설정 */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary:    #0e1117;
        --bg-secondary:  #0d1117;
        --bg-sidebar:    #0e1117;
        --bg-card:       #161b22;
        --text-primary:  #e6edf3;
        --text-secondary:#8b949e;
        --accent:        #58a6ff;
        --accent-hover:  #388bfd;
        --accent-soft:   #1c2d3e;
        --border-color:  #30363d;
        --header-bg:     #161b22;
        --status-bar-bg: #388bfd;
        --status-bar-text:#ffffff;
        --card-shadow:   0 2px 8px rgba(0,0,0,0.3);
        --card-shadow-hover: 0 8px 24px rgba(88,166,255,0.15);
        --tag-bg:        #1c2d3e;
        --tag-color:     #58a6ff;
        --nav-hover-bg:  #21262d;
    }
}

/* JS 토글 — data-theme */
[data-theme="dark"] {
    --bg-primary:    #0e1117;
    --bg-secondary:  #0d1117;
    --bg-sidebar:    #0e1117;
    --bg-card:       #161b22;
    --text-primary:  #e6edf3;
    --text-secondary:#8b949e;
    --accent:        #58a6ff;
    --accent-hover:  #388bfd;
    --accent-soft:   #1c2d3e;
    --border-color:  #30363d;
    --header-bg:     #161b22;
    --status-bar-bg: #388bfd;
    --status-bar-text:#ffffff;
    --card-shadow:   0 2px 8px rgba(0,0,0,0.3);
    --card-shadow-hover: 0 8px 24px rgba(88,166,255,0.15);
    --tag-bg:        #1c2d3e;
    --tag-color:     #58a6ff;
    --nav-hover-bg:  #21262d;
}

[data-theme="light"] {
    --bg-primary:    #f6f8fa;
    --bg-secondary:  #ffffff;
    --bg-sidebar:    #ffffff;
    --bg-card:       #ffffff;
    --text-primary:  #1a1a2e;
    --text-secondary:#57606a;
    --accent:        #2563eb;
    --accent-hover:  #1d4ed8;
    --accent-soft:   #eff6ff;
    --border-color:  #e5e7eb;
    --header-bg:     #ffffff;
    --status-bar-bg: #2563eb;
    --status-bar-text:#ffffff;
    --card-shadow:   0 2px 8px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 8px 24px rgba(37,99,235,0.12);
    --tag-bg:        #eff6ff;
    --tag-color:     #2563eb;
    --nav-hover-bg:  #f0f4ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.65;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

code, .mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
a { color: inherit; }

#container { display: flex; min-height: calc(100vh - 26px); }

/* ═══ LEFT SIDEBAR ═══ */
#explorer {
    width: 260px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: background-color 0.3s;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.explorer-header {
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    padding: 12px 16px;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1.5px;
    font-family: 'JetBrains Mono', monospace;
}

.profile-section {
    padding: 24px 16px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--accent-soft) 0%, transparent 100%);
}

.profile-img {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 3px solid var(--accent);
    margin-bottom: 12px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(37,99,235,0.2);
    transition: transform 0.3s;
}

.profile-img:hover { transform: scale(1.05); }

.blog-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
    line-height: 1.4;
    word-break: keep-all;
}

.blog-desc {
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-top: 6px;
    line-height: 1.5;
    word-break: keep-all;
}

.nav-title {
    padding: 16px 16px 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.category-list ul,
.tt_category,
.tt_category .category_list { list-style: none; }

.tt_category > li > a.link_tit {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    color: var(--accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    border-bottom: 1px solid var(--border-color);
}

.category_list li a.link_item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px 9px 24px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    transition: background 0.18s, color 0.18s, padding-left 0.18s;
    border-radius: 0 6px 6px 0;
    margin: 1px 8px 1px 0;
    position: relative;
}

.category_list li a.link_item::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 5px;
    height: 5px;
    background: var(--border-color);
    border-radius: 50%;
    transition: background 0.18s;
}

.category_list li a.link_item:hover {
    background-color: var(--nav-hover-bg);
    color: var(--accent);
    padding-left: 28px;
}

.category_list li a.link_item:hover::before { background: var(--accent); }
.category_list li a.link_item img,
.tt_category > li > a.link_tit img { width: 14px; height: 14px; vertical-align: middle; }

/* ═══ MAIN ═══ */
#main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }

#header {
    background-color: var(--header-bg);
    padding: 8px 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(8px);
}

.breadcrumb {
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.breadcrumb .root { color: var(--accent); font-weight: 700; }

#dark-toggle {
    background: var(--accent-soft);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 5px 14px;
    cursor: pointer;
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    font-family: 'Pretendard', sans-serif;
}

#dark-toggle:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.content-wrapper {
    padding: 32px 28px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

/* ═══ 카드형 글 목록 ═══ */
.post-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
    position: relative;
}

.post-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--accent), var(--accent-hover));
    border-radius: 14px 0 0 14px;
    opacity: 0;
    transition: opacity 0.22s;
}

.post-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--accent);
}

.post-item:hover::before { opacity: 1; }
.post-item > * { padding-left: 24px; padding-right: 24px; }

.post-item img.thumb,
.post-item .post-thumb {
    width: 100%; height: 200px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
    margin: 0; padding: 0;
}

.post-meta {
    padding-top: 18px;
    padding-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-meta .line-num {
    color: var(--border-color);
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.post-meta .comment {
    color: var(--text-secondary);
    font-size: 12px;
    font-style: normal;
    font-family: 'JetBrains Mono', monospace;
}

.post-title {
    font-size: 19px;
    font-weight: 700;
    margin: 8px 0 10px;
    line-height: 1.45;
}

.post-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.post-title a:hover { color: var(--accent); }

.post-summary {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.75;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-tags {
    padding-top: 14px;
    padding-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.post-tags a, .post-tags span {
    background: var(--tag-bg);
    color: var(--tag-color);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    text-decoration: none;
    transition: background 0.18s, color 0.18s;
}

.post-tags a:hover { background: var(--accent); color: #fff; }

/* 글 상세 */
.post-content {
    font-size: 17px;
    line-height: 1.85;
    color: var(--text-primary);
    padding-bottom: 40px;
}

.post-content h1, .post-content h2, .post-content h3 {
    margin: 40px 0 16px;
    color: var(--accent);
    font-weight: 700;
}

.post-content h2 { font-size: 22px; }
.post-content h3 { font-size: 18px; }
.post-content p { margin-bottom: 22px; }

.post-content img {
    max-width: 100% !important;
    height: auto !important;
    border-radius: 10px;
    margin: 24px 0;
    box-shadow: var(--card-shadow);
}

.post-content blockquote {
    border-left: 4px solid var(--accent);
    margin: 24px 0;
    padding: 12px 20px;
    background: var(--accent-soft);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-content code {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.post-content pre {
    background: #0d1117;
    color: #e6edf3;
    padding: 20px;
    border-radius: 10px;
    overflow-x: auto;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

.tt-link-card {
    border: 1px solid var(--border-color) !important;
    background-color: var(--bg-card) !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    display: flex !important;
    margin: 24px 0 !important;
    text-decoration: none !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
    box-shadow: var(--card-shadow) !important;
}

.tt-link-card:hover {
    border-color: var(--accent) !important;
    box-shadow: var(--card-shadow-hover) !important;
}

.tt-link-card .tt-title {
    color: var(--accent) !important;
    font-weight: 700 !important;
    padding: 14px 18px 4px !important;
    font-size: 15px !important;
}

.tt-link-card .tt-desc {
    color: var(--text-secondary) !important;
    padding: 0 18px 14px !important;
    font-size: 13px !important;
}

/* ═══ RIGHT SIDEBAR ═══ */
#sidebar {
    width: 300px;
    padding: 24px 20px;
    border-left: 1px solid var(--border-color);
    background-color: var(--bg-sidebar);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    transition: background-color 0.3s;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.widget {
    margin-bottom: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 18px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.widget:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(37,99,235,0.08);
}

.widget-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 14px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 6px;
}

.widget-title::before {
    content: '';
    display: block;
    width: 3px; height: 12px;
    background: var(--accent);
    border-radius: 2px;
}

.visitor-stats .total-num {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    line-height: 1;
    margin-bottom: 8px;
}

.visitor-stats .daily-stat {
    font-size: 12px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
}

.widget ul { list-style: none; }

.widget li {
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.widget li:last-child { border-bottom: none; margin-bottom: 0; }

.widget li a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
    transition: color 0.18s;
    display: block;
}

.widget li a:hover { color: var(--accent); }

.widget input[type="text"] {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'Pretendard', sans-serif;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.widget input[type="text"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

.tag-cloud .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    line-height: 1;
}

.tag-cloud .tags a {
    text-decoration: none;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 12px;
    transition: all 0.18s;
    display: inline-block;
    line-height: 1.4;
}

.tag-cloud .tags a:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.tag-cloud .tags .cloud1 { font-size: 11px; }
.tag-cloud .tags .cloud2 { font-size: 12px; }
.tag-cloud .tags .cloud3 { font-size: 13px; color: var(--accent); border-color: var(--accent); }
.tag-cloud .tags .cloud4 { font-size: 14px; color: var(--accent); border-color: var(--accent); font-weight: 700; }

/* ═══ STATUS BAR ═══ */
#status-bar {
    height: 26px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: var(--status-bar-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

#status-bar .left, #status-bar .right { display: flex; gap: 16px; align-items: center; }

/* ═══ 페이지네이션 ═══ */
.pagination {
    text-align: center;
    margin: 40px 0 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    transition: all 0.18s;
}

.pagination a:hover,
.pagination a .selected { background: var(--accent); color: #fff; border-color: var(--accent); }

.pagination a.prev, .pagination a.next {
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    padding: 0 12px;
}

.pagination a.no-more-prev, .pagination a.no-more-next { opacity: 0.3; cursor: default; }

/* ═══ AI 마스코트 ═══ */
#screen-pet {
    position: fixed;
    width: 72px; height: 72px;
    z-index: 10000;
    pointer-events: none;
    transition: transform 0.5s ease;
}

.pet-speech {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--accent);
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 12px;
    white-space: nowrap;
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
    font-family: 'JetBrains Mono', monospace;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

/* ═══ 반응형 ═══ */
@media screen and (max-width: 1280px) {
    #sidebar { width: 260px; padding: 20px 16px; }
    .content-wrapper { padding: 24px 20px; }
}

@media screen and (max-width: 1024px) {
    #sidebar { display: none; }
    .content-wrapper { max-width: 100%; }
}

@media screen and (max-width: 768px) {
    #explorer { display: none; }
    .content-wrapper { padding: 20px 16px; }
    .post-title { font-size: 17px; }
    .post-item { border-radius: 10px; margin-bottom: 16px; }
}

@media screen and (max-width: 480px) {
    .content-wrapper { padding: 16px 12px; }
    .post-title { font-size: 16px; }
    .post-summary { font-size: 13px; }
}