:root {
    color-scheme: dark;
    --background: #101219;
    --surface: #181b25;
    --raised: #202432;
    --line: #303447;
    --text: #f2f1fa;
    --muted: #b4b8cc;
    --accent: #b9a7ff;
    --green: #8be0bb;
    --pink: #ffacae;
    font: 16px/1.6 "Segoe UI Variable Text", system-ui, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; min-width: 280px; }
a { color: var(--accent); text-underline-offset: .22em; }
a:hover { color: #ded4ff; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
h1, h2, p { margin-top: 0; }
h2 { margin-bottom: .25rem; line-height: 1.25; font-size: 1.35rem; }
.skip-link { position: absolute; top: -10rem; left: 1rem; background: var(--surface); padding: .75rem; z-index: 2; }
.skip-link:focus { top: .5rem; }

.topbar { border-bottom: 1px solid var(--line); background: #141620; }
.topbar-inner, .shell { width: min(1192px, calc(100% - 3rem)); margin-inline: auto; }
.topbar-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand, .account { display: flex; align-items: center; gap: .8rem; }
.brand { color: var(--text); text-decoration: none; font-weight: 750; line-height: 1.2; }
.brand small { display: block; color: var(--muted); font-weight: 450; margin-top: .18rem; }
.brand-icon, .step-num {
    display: inline-grid;
    place-items: center;
    flex: none;
    font: 700 .85rem/1 Consolas, monospace;
    border: 1px solid #615488;
    background: #29213b;
    color: #d5c5ff;
    border-radius: 9px;
}
.brand-icon { width: 42px; height: 42px; font-size: 1.1rem; }
.account-name { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.account form, .welcome-copy form { margin: 0; }
.tag {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .27rem .7rem;
    color: var(--muted);
    font-size: .8rem;
}
.positive { color: var(--green); }
.negative { color: var(--pink); }

.welcome {
    display: grid;
    grid-template-columns: 1fr minmax(320px, .82fr);
    gap: clamp(2rem, 8vw, 7rem);
    align-items: center;
    min-height: min(690px, calc(100vh - 76px));
    padding: 4.25rem 0;
}
.eyebrow {
    margin-bottom: 1rem;
    color: var(--accent);
    font: 700 .77rem/1.4 Consolas, monospace;
    letter-spacing: .1em;
}
.dot { display: inline-block; width: .5rem; height: .5rem; margin-right: .35rem; border-radius: 50%; background: var(--green); }
h1 { margin-bottom: 1rem; font-size: clamp(2.35rem, 6.8vw, 5rem); letter-spacing: -.04em; line-height: 1.1; }
.intro { max-width: 34rem; margin-bottom: 1.5rem; color: var(--muted); font-size: 1.075rem; }
.button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: .58rem 1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font-weight: 680;
    text-decoration: none;
    line-height: 1.3;
}
.primary { background: #b9a7ff; color: #161021; }
.primary:hover { background: #d0c2ff; color: #161021; }
.quiet { background: var(--raised); color: var(--text); border-color: var(--line); }
.quiet:hover { border-color: #8a76be; color: var(--text); }
.preview-card { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); overflow: hidden; }
.preview-art {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 208px;
    overflow: hidden;
    isolation: isolate;
    background: radial-gradient(ellipse at center, #403258 0, #221b34 52%, #181926 100%);
}
.preview-art::before, .empty-player::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(#9282c11b 1px, transparent 1px), linear-gradient(90deg, #9282c11b 1px, transparent 1px);
    background-size: 26px 26px;
    mask-image: radial-gradient(ellipse, #000, transparent 77%);
    z-index: -1;
}
.orbit { position: absolute; border: 1px solid #b9a7ff4d; border-radius: 50%; pointer-events: none; }
.orbit-large { width: 220px; height: 142px; transform: rotate(-18deg); }
.orbit-small { width: 200px; height: 116px; transform: rotate(25deg); }
.art-mark { font: 700 clamp(2.1rem, 5vw, 3rem)/1 Consolas, monospace; color: #ece1ff; }
.preview-info { padding: 1.5rem; }
.preview-info p:not(.eyebrow) { color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: .5rem; }

.catalog-header, .module-list { max-width: 760px; margin-inline: auto; }
.catalog-header { padding-top: clamp(1.6rem, 5vw, 2.5rem); }
.catalog-header h1 { font-size: clamp(2rem, 5vw, 3.3rem); }
.module-list { display: grid; gap: .65rem; padding-bottom: 2.5rem; }
.module-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.module-card[open] { border-color: #53476f; }
.module-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    min-height: 76px;
    padding: .8rem 1.15rem;
    cursor: pointer;
    list-style: none;
}
.module-trigger::-webkit-details-marker { display: none; }
.module-trigger:hover { background: var(--raised); }
.module-trigger:focus-visible { outline-offset: -4px; }
.module-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #fff;
}
.module-icon img { display: block; object-fit: contain; }
.module-heading { flex: 1; min-width: 0; }
.module-title { display: block; font-size: 1.2rem; font-weight: 650; letter-spacing: -.015em; line-height: 1.25; }
.module-status { display: flex; align-items: center; gap: .55rem; margin-top: .3rem; color: var(--muted); font-size: .78rem; }
.module-progress { width: min(8rem, 35%); height: .36rem; accent-color: var(--green); }
.module-trigger::after, .lesson-entry::after {
    content: "";
    width: .45rem;
    height: .45rem;
    flex: none;
    border: solid currentColor;
    border-width: 0 1.5px 1.5px 0;
}
.module-trigger::after { margin-right: .2rem; color: var(--accent); transform: translateY(-.1rem) rotate(45deg); }
.module-card[open] > .module-trigger::after { transform: translateY(.1rem) rotate(225deg); }
.module-lessons { list-style: none; margin: 0 .55rem .55rem; padding: .25rem 0 0; border-top: 1px solid var(--line); }
.lesson-entry {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-height: 48px;
    padding: .55rem .65rem;
    border-radius: 8px;
    color: var(--text);
    text-decoration: none;
    font-size: .975rem;
    font-weight: 500;
    line-height: 1.45;
}
.lesson-entry:hover, .lesson-entry:focus-visible { background: var(--raised); color: var(--text); }
.lesson-entry:focus-visible { outline-offset: -2px; }
.lesson-entry::after { margin-right: .25rem; color: var(--muted); transform: rotate(-45deg); }
.lesson-content { display: flex; flex: 1; min-width: 0; align-items: center; gap: .65rem; }
.lesson-title { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lesson-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .3rem; }
.lesson-tag { flex: none; padding: .15rem .55rem; border: 0; font-size: .75rem; font-weight: 600; }
.quiz-tag { background: #312743; color: #e0d0ff; }
.video-tag { background: #222f42; color: #bedbff; }
.video-watched-tag { background: #1e3732; color: var(--green); }
.practice-tag { background: #362d22; color: #f1d6a8; }
.result-tag { background: #1e3732; color: var(--green); }

.workspace { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: clamp(1.5rem, 4vw, 3.75rem); padding: 2.5rem 0 4rem; }
.rail { position: sticky; top: 1.25rem; border-right: 1px solid var(--line); padding-right: 1.15rem; }
.back { width: 100%; min-height: 48px; justify-content: flex-start; margin-bottom: 1.4rem; font-size: .94rem; }
.back-arrow { color: var(--accent); font-size: 1.15rem; line-height: 1; }
.rail .eyebrow { margin-bottom: .65rem; }
.active-lesson { display: flex; align-items: center; gap: .65rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .65rem; font-size: .91rem; font-weight: 650; line-height: 1.35; }
.step-num { width: 35px; height: 35px; }
.lesson-nav { display: grid; gap: .3rem; padding-top: .65rem; font-size: .9rem; }
.lesson-nav a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: .35rem .65rem;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 550;
}
.lesson-nav a:hover, .lesson-nav a:focus-visible { background: var(--raised); color: var(--text); }
.lesson-header { margin-bottom: 1.65rem; }
.lesson-header h1 { font-size: clamp(2.1rem, 5vw, 3.7rem); }
.lesson-header .intro { margin-bottom: 0; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: clamp(1rem, 3.2vw, 1.65rem); margin-bottom: 1.15rem; }
.section-heading { display: flex; align-items: start; gap: .85rem; margin-bottom: 1rem; }
.section-heading p { color: var(--muted); margin: 0; font-size: .93rem; }
.resource-links { display: flex; flex-wrap: wrap; gap: .65rem; list-style: none; margin: 0; padding: 0; }
.resource-links .button { white-space: normal; }
.video-list { display: grid; gap: .6rem; list-style: none; margin: 0; padding: 0; }
.video-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .65rem; }
.video-progress { margin: 0; }
.video-progress-button { min-height: 44px; font-size: .88rem; }
.video-is-watched, .video-is-watched:hover { background: #1e3732; border-color: #38564f; color: var(--green); }
.player { width: 100%; aspect-ratio: 16 / 9; border: 1px solid var(--line); border-radius: 10px; display: block; }
.player + .video-progress, .video-progress + .video-list { margin-top: .65rem; }
.empty-player {
    min-height: 174px;
    max-height: 340px;
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: #141521;
    color: var(--muted);
}
.empty-player p { margin: .5rem 0 .15rem; }
.empty-player a { font-size: .9rem; }
.play-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border: 1px solid #63548b;
    border-radius: 50%;
    background: #2b223d;
    color: var(--accent);
    font-size: .94rem;
}
.quiz-form { display: grid; gap: 1rem; }
.quiz-form > button { justify-self: start; }
.question { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: .85rem; }
.question legend { max-width: 100%; padding-inline: .35rem; font-weight: 640; overflow-wrap: anywhere; }
.option { display: flex; align-items: start; gap: .62rem; padding: .58rem; color: #d8d8e7; border-radius: 6px; cursor: pointer; }
.option:hover, .option:has(input:checked) { background: var(--raised); }
.option input { margin: .33rem 0 0; accent-color: var(--accent); flex: none; }
.notice { padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); }
.error { border-color: #835961; color: var(--pink); }
.score { display: flex; align-items: center; gap: 1.25rem; background: #1b2c2b; border: 1px solid #38564f; padding: .9rem 1rem; border-radius: 10px; }
.score strong { white-space: nowrap; font: 700 2.05rem/1 Consolas, monospace; color: var(--green); }
.score strong span { font-size: 1.1rem; }
.score p { margin: 0; color: #c0d6d0; }
.result-list { display: grid; gap: .5rem; margin: 1rem 0; }
.answer-review { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; }
.answer-review summary { display: flex; align-items: start; gap: .65rem; cursor: pointer; font-weight: 580; list-style: none; }
.answer-review summary::-webkit-details-marker { display: none; }
.answer-review summary::after { content: "+"; color: var(--accent); margin-left: auto; }
.answer-review[open] summary::after { content: "−"; }
.answer-state { flex: none; font-weight: 800; }
.review-copy { padding: .55rem 0 0 1.2rem; color: var(--muted); }
.review-copy p { margin-bottom: .35rem; }
.review-copy b { color: var(--text); }

@media (max-width: 760px) {
    .topbar-inner, .shell { width: calc(100% - 2rem); }
    .welcome { grid-template-columns: 1fr; gap: 2rem; padding-block: 2.8rem; min-height: 0; }
    .welcome h1 { font-size: clamp(2.35rem, 10vw, 4rem); }
    .workspace { display: block; padding-top: 1rem; }
    .rail { position: static; border: 0; padding: 0; margin-bottom: 1rem; }
    .rail .back { width: auto; margin-bottom: .65rem; }
    .rail .active-lesson, .rail .eyebrow { display: none; }
    .lesson-nav { display: flex; flex-wrap: wrap; padding: 0; }
    .lesson-nav a { min-height: 44px; background: var(--surface); }
    .wide-only { display: none; }
}

@media (max-width: 520px) {
    .lesson-content { flex-direction: column; align-items: flex-start; gap: .35rem; }
    .lesson-tags { justify-content: flex-start; }
}

@media (max-width: 450px) {
    .brand { gap: .55rem; }
    .brand small { font-size: .72rem; }
    .account-name { display: none; }
    .topbar > .topbar-inner > .tag { display: none; }
    .rail .back { width: 100%; }
    .question { padding-inline: .5rem; }
}
