:root {
    --bg: #0d0f14;
    --sidebar-bg: #111318;
    --card-bg: #161820;
    --border: #232630;
    --accent: #f0b429;
    --accent2: #4ecdc4;
    --text: #ddd9d0;
    --muted: #888;
    --code-bg: #13151c;
    --green: #6fbf6f;
    --blue: #5b9bd5;
    --orange: #ce9178;
    --num: #b5cea8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Source Serif 4', Georgia, serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* TOP HEADER */
.top-header {
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    font-size: 26px;
}

.logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.header-spacer {
    flex: 1;
}

.topic-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.topic-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    padding: 0;
}

.topic-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}

.topic-dot:hover {
    background: #666;
}

.sidebar-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, border-color 0.2s;
}

.sidebar-toggle:hover {
    color: var(--text);
    border-color: #555;
}

/* BODY LAYOUT */
.body-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.3s, min-width 0.3s;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
}

.sidebar-section {
    padding: 20px 14px 10px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 18px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    cursor: pointer;
    text-align: left;
    color: #999;
    font-size: 13.5px;
    font-family: 'Source Serif 4', serif;
    transition: all 0.15s;
    white-space: nowrap;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.03);
}

.nav-item.active {
    color: var(--accent);
    background: rgba(240, 180, 41, 0.07);
    border-left-color: var(--accent);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-label {
    flex: 1;
}

.nav-num {
    font-size: 10px;
    color: #444;
    font-family: 'JetBrains Mono', monospace;
}

/* MAIN CONTENT */
.main {
    flex: 1;
    overflow-y: auto;
    padding: 36px 44px 60px;
    scroll-behavior: smooth;
}

.topic-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.topic-icon {
    font-size: 36px;
}

.topic-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.topic-badge {
    margin-left: auto;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    background: rgba(240, 180, 41, 0.1);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(240, 180, 41, 0.25);
}

/* SECTION CARD */
.section-card {
    margin-bottom: 36px;
    animation: fadeUp 0.35s ease both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--accent2);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-heading::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--accent2);
    border-radius: 2px;
}

.section-desc {
    font-size: 14.5px;
    line-height: 1.8;
    color: #b0aaa0;
    margin-bottom: 18px;
    max-width: 700px;
}

/* CODE BLOCK */
.code-block {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    margin-bottom: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.code-header {
    background: #1a1d28;
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.code-dots {
    display: flex;
    gap: 5px;
}

.code-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.code-dot.red {
    background: #ff5f56;
}

.code-dot.yellow {
    background: #ffbd2e;
}

.code-dot.green {
    background: #27c93f;
}

.code-lang {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-left: 4px;
}

.copy-btn {
    margin-left: auto;
    background: #1e2235;
    border: 1px solid #333;
    color: #888;
    border-radius: 5px;
    padding: 3px 12px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    transition: all 0.2s;
}

.copy-btn:hover {
    color: var(--text);
    border-color: #555;
}

.copy-btn.copied {
    background: #1a2e1a;
    border-color: #3a5a3a;
    color: var(--green);
}

pre {
    background: var(--code-bg);
    margin: 0;
    padding: 22px 24px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.75;
    color: #c8cce0;
}

/* Syntax colors */
.kw {
    color: var(--blue);
}

.str {
    color: var(--orange);
}

.cmt {
    color: var(--green);
    font-style: italic;
}

.num {
    color: var(--num);
}

.cls {
    color: #4ec9b0;
}

.fn {
    color: #dcdcaa;
}

/* NAV BUTTONS */
.nav-btns {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: #aaa;
    border-radius: 8px;
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Source Serif 4', serif;
    font-size: 13.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.nav-btn.next {
    background: rgba(240, 180, 41, 0.06);
    border-color: rgba(240, 180, 41, 0.3);
    color: var(--accent);
}

.nav-btn.next:hover {
    background: rgba(240, 180, 41, 0.12);
}

/* PROGRESS BAR */
.progress-bar-wrap {
    height: 3px;
    background: var(--border);
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width 0.4s ease;
}

/* SCROLLBAR */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #2a2d38;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3d4a;
}

/* RESPONSIVE */
@media (max-width: 700px) {
    .sidebar {
        width: 0;
        min-width: 0;
    }

    .main {
        padding: 20px 18px 50px;
    }

    .topic-title {
        font-size: 22px;
    }

    .topic-badge {
        display: none;
    }
}