:root {
    color-scheme: light;
    --page-bg: #fbf7f8;
    --surface: #fffdfd;
    --text: #352f35;
    --muted: #81747e;
    --border: #eee3e8;
    --accent: #bd8297;
    --accent-dark: #966176;
    --accent-light: #f7eaf0;
    --code-bg: #342d35;
    --sidebar-width: 270px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 24px;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
}

a {
    color: inherit;
}

.topbar {
    position: sticky;
    z-index: 10;
    top: 0;
    display: flex;
    height: 66px;
    align-items: center;
    justify-content: space-between;
    padding: 0 34px;
    border-bottom: 1px solid var(--border);
    background: rgb(255 253 253 / 95%);
    backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    font-size: 16px;
    font-weight: 750;
    text-decoration: none;
}

.brand-icon {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 10px;
    background: var(--accent);
    color: white;
    font-family: Consolas, monospace;
    font-size: 14px;
}

.topbar-label {
    color: var(--muted);
    font-size: 13px;
}

.page-layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    gap: 38px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 36px 64px;
}

.sidebar {
    position: sticky;
    top: 98px;
    align-self: start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    padding: 20px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 6px 24px rgb(75 52 65 / 5%);
}

.sidebar-heading {
    padding: 0 7px;
}

.sidebar-kicker,
.eyebrow {
    margin: 0;
    color: #a76e85;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
}

.sidebar-heading h2 {
    margin: 5px 0 18px;
    font-size: 21px;
}

.search-label {
    display: block;
    margin: 0 7px 7px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.search-input {
    width: 100%;
    margin-bottom: 16px;
    padding: 10px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    background: #fffafa;
    color: var(--text);
    font: inherit;
    font-size: 13px;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(189 130 151 / 15%);
}

.lesson-nav {
    display: grid;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: baseline;
    gap: 9px;
    padding: 10px 9px;
    border-radius: 8px;
    color: #746772;
    font-size: 13px;
    line-height: 1.4;
    text-decoration: none;
    transition: background .15s ease, color .15s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--accent-light);
    color: var(--accent-dark);
}

.nav-link.active {
    font-weight: 700;
}

.nav-number {
    flex: 0 0 auto;
    color: #a76e85;
    font-size: 11px;
    font-weight: 750;
}

.sidebar-note {
    margin-top: 20px;
    padding: 13px;
    border-radius: 9px;
    background: #fbf3f6;
    color: #695b64;
    font-size: 12px;
    line-height: 1.55;
}

.sidebar-note strong {
    color: var(--accent-dark);
}

.sidebar-note p {
    margin: 5px 0 0;
}

.content {
    min-width: 0;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.welcome-card {
    display: flex;
    min-height: 230px;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 34px 38px;
    overflow: hidden;
    border: 1px solid #f0e2e8;
    border-radius: 16px;
    background:
        radial-gradient(circle at 95% 15%, rgb(213 180 197 / 22%), transparent 32%),
        linear-gradient(120deg, #fffdfd 20%, #fcf4f7 100%);
}

.welcome-text {
    max-width: 610px;
}

.welcome-card h1 {
    margin: 9px 0 10px;
    font-size: clamp(27px, 4vw, 39px);
    letter-spacing: -.04em;
    line-height: 1.15;
}

.welcome-card p:not(.eyebrow) {
    max-width: 580px;
    margin: 0 0 21px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.7;
}

.primary-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 0 17px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: background .15s ease, transform .15s ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    background: #a76e85;
}

.welcome-count {
    display: flex;
    width: 106px;
    height: 106px;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid #efdee6;
    border-radius: 50%;
    background: rgb(255 253 253 / 86%);
    color: #a76e85;
}

.welcome-count strong {
    font-size: 34px;
    line-height: 1;
}

.welcome-count span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.content-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin: 34px 2px 16px;
}

.content-heading h2 {
    margin: 4px 0 0;
    font-size: 24px;
    letter-spacing: -.03em;
}

.lesson-count {
    margin: 0 0 2px;
    color: var(--muted);
    font-size: 13px;
}

.lesson-card {
    margin-bottom: 18px;
    padding: 25px 27px;
    scroll-margin-top: 88px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: 0 4px 18px rgb(75 52 65 / 4%);
}

.lesson-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lesson-title-row h2 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -.025em;
}

.lesson-badge {
    display: inline-flex;
    min-width: 46px;
    height: 29px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: 7px;
    background: var(--accent-light);
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 800;
}

.lesson-intro {
    margin: 14px 0 21px;
    color: #746772;
    font-size: 14px;
    line-height: 1.75;
}

.key-points {
    margin: 0 0 22px;
    padding: 17px 19px;
    border: 1px solid #f0e5ea;
    border-radius: 9px;
    background: #fdf8fa;
}

.key-points h3,
.examples > h3 {
    margin: 0 0 10px;
    font-size: 14px;
}

.key-points ul {
    display: grid;
    gap: 7px;
    margin: 0;
    padding-left: 20px;
    color: #746772;
    font-size: 13px;
    line-height: 1.6;
}

.key-points li::marker {
    color: var(--accent);
}

.examples {
    margin-bottom: 20px;
}

.example + .example {
    margin-top: 16px;
}

.example h4 {
    margin: 0 0 8px;
    color: #5f535d;
    font-size: 13px;
    font-weight: 700;
}

pre {
    max-width: 100%;
    margin: 0;
    padding: 17px 19px;
    overflow-x: auto;
    border: 1px solid #4a3e48;
    border-radius: 9px;
    background: var(--code-bg);
    color: #fbf3f6;
    tab-size: 4;
}

pre code {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12.5px;
    line-height: 1.75;
    white-space: pre;
}

.review-question {
    overflow: hidden;
    border: 1px solid #efdee6;
    border-radius: 9px;
    background: #fdf8fa;
}

.review-question > summary,
.show-answer > summary {
    cursor: pointer;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
    list-style-position: inside;
}

.review-question > summary {
    padding: 13px 15px;
}

.answer-content {
    padding: 0 15px 14px;
    color: #746772;
    font-size: 13px;
    line-height: 1.6;
}

.answer-content > p {
    margin: 0 0 10px;
}

.show-answer {
    padding-top: 9px;
    border-top: 1px solid #efdee6;
}

.show-answer > summary {
    padding: 7px 0;
}

.show-answer p {
    margin: 5px 0 0;
}

.no-results {
    margin-bottom: 18px;
    padding: 20px;
    border: 1px dashed #e2cbd5;
    border-radius: 10px;
    background: var(--surface);
    color: var(--muted);
    text-align: center;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 4px;
    color: var(--muted);
    font-size: 12px;
}

.footer p {
    margin: 0;
}

.footer a {
    color: var(--accent-dark);
    font-weight: 650;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

[hidden] {
    display: none !important;
}

@media (max-width: 850px) {
    .page-layout {
        grid-template-columns: 220px minmax(0, 1fr);
        gap: 20px;
        padding: 24px 20px 48px;
    }

    .welcome-card {
        padding: 27px;
    }
}

@media (max-width: 650px) {
    .topbar {
        height: 58px;
        padding: 0 17px;
    }

    .topbar-label {
        font-size: 11px;
    }

    .page-layout {
        display: block;
        padding: 16px 14px 36px;
    }

    .sidebar {
        position: static;
        max-height: none;
        margin-bottom: 18px;
        padding: 15px 12px;
    }

    .sidebar-heading h2 {
        margin-bottom: 12px;
    }

    .lesson-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nav-link {
        align-items: flex-start;
        gap: 6px;
        padding: 9px 7px;
        font-size: 12px;
    }

    .nav-number {
        padding-top: 1px;
        font-size: 10px;
    }

    .sidebar-note {
        margin-top: 13px;
    }

    .welcome-card {
        min-height: 0;
        padding: 23px 20px;
    }

    .welcome-count {
        width: 70px;
        height: 70px;
    }

    .welcome-count strong {
        font-size: 25px;
    }

    .welcome-count span {
        font-size: 10px;
    }

    .content-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 5px;
        margin-top: 27px;
    }

    .lesson-card {
        padding: 20px 17px;
    }

    .lesson-title-row {
        align-items: flex-start;
    }

    .lesson-title-row h2 {
        padding-top: 3px;
        font-size: 19px;
    }

    pre {
        padding: 14px;
    }

    pre code {
        font-size: 11.5px;
    }
}

@media (max-width: 390px) {
    .welcome-count {
        display: none;
    }

    .lesson-nav {
        grid-template-columns: 1fr;
    }

    .footer {
        flex-direction: column;
    }
}