/* ═════════════════════════════════════════════════════════════════
   Kernly Kursbibliothek — course layer
   Same editorial voice as the landing (near-black, amber surgical
   accent, Fraunces for emphasis) pushed into "premium German
   textbook as a website": chapter rail, reading progress, vocab
   cards, exercise blocks. Self-contained — does not import the
   landing stylesheet.
   ═════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #08080B;
    --bg-2: #0B0B0F;
    --surface: #0E0E13;
    --surface-2: #131319;
    --surface-3: #191921;
    --border: #1D1D26;
    --border-strong: #2A2A36;
    --hairline: rgba(255, 255, 255, 0.055);
    --hairline-strong: rgba(255, 255, 255, 0.09);

    --text: #F4F4F5;
    --text-muted: #9A9AA6;
    --text-dim: #565662;

    --accent: #E8B45F;
    --accent-soft: rgba(232, 180, 95, 0.10);
    --accent-border: rgba(232, 180, 95, 0.28);

    --weak: #E57A74;
    --weak-soft: rgba(229, 122, 116, 0.12);
    --ok: #9AD68A;
    --ok-soft: rgba(154, 214, 138, 0.10);

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 22px;

    --f-display: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
    --f-body: "Inter", system-ui, -apple-system, sans-serif;
    --f-serif: "Fraunces", "Iowan Old Style", Georgia, serif;
    --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    --container: 1200px;
    --reading: 760px;
}

html {
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

section[id], article[id], div[id] { scroll-margin-top: 86px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--f-body);
    font-size: 16.5px;
    line-height: 1.65;
    letter-spacing: -0.005em;
    min-height: 100vh;
    overflow-x: hidden;
}

::selection { background: var(--accent-soft); color: var(--accent); }

a { color: inherit; text-decoration: none; }

/* ─── Reading progress bar ─── */
.progress-track {
    position: fixed; top: 0; left: 0; right: 0; height: 2px;
    background: transparent; z-index: 60;
}
.progress-fill {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, var(--accent), #f0cd8d);
    transition: width 80ms linear;
}

/* ─── Topbar ─── */
.topbar {
    position: sticky; top: 0; z-index: 50;
    background: rgba(8, 8, 11, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hairline);
}
.topbar-inner {
    max-width: var(--container); margin: 0 auto;
    padding: 14px 24px;
    display: flex; align-items: center; gap: 16px;
}
.brand {
    font-family: var(--f-display); font-weight: 700; font-size: 17px;
    letter-spacing: -0.02em;
}
.brand .dot { color: var(--accent); }
.crumb {
    font-family: var(--f-mono); font-size: 11.5px; color: var(--text-dim);
    letter-spacing: 0.06em; text-transform: uppercase;
}
.crumb a { color: var(--text-muted); transition: color .15s; }
.crumb a:hover { color: var(--accent); }
.topbar-spacer { flex: 1; }
.topbar-cta {
    font-size: 13.5px; font-weight: 600;
    padding: 8px 16px; border-radius: 999px;
    border: 1px solid var(--accent-border);
    color: var(--accent); background: var(--accent-soft);
    transition: background .15s, transform .15s;
    white-space: nowrap;
}
.topbar-cta:hover { background: rgba(232, 180, 95, 0.16); transform: translateY(-1px); }

/* ─── Catalog hero ─── */
.lib-hero {
    max-width: var(--container); margin: 0 auto;
    padding: 96px 24px 56px;
}
.eyebrow {
    font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--accent);
    display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before {
    content: ""; width: 22px; height: 1px; background: var(--accent-border);
}
.lib-hero h1 {
    font-family: var(--f-display); font-weight: 800;
    font-size: clamp(40px, 6vw, 68px); line-height: 1.04;
    letter-spacing: -0.035em; margin-top: 18px;
}
.lib-hero h1 em {
    font-family: var(--f-serif); font-weight: 400; font-style: italic;
    color: var(--accent); letter-spacing: -0.01em;
}
.lib-sub {
    max-width: 640px; margin-top: 20px;
    color: var(--text-muted); font-size: 17.5px; line-height: 1.7;
}

/* ─── Catalog grid ─── */
.lib-grid {
    max-width: var(--container); margin: 0 auto;
    padding: 8px 24px 120px;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
}
.course-card {
    position: relative; display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 28px 28px 24px;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
    overflow: hidden;
}
.course-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-border);
    box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.8);
}
.course-card .unit-no {
    position: absolute; right: 18px; top: 6px;
    font-family: var(--f-serif); font-style: italic; font-weight: 300;
    font-size: 96px; line-height: 1; color: var(--surface-3);
    user-select: none; pointer-events: none;
}
.course-card:hover .unit-no { color: rgba(232, 180, 95, 0.12); }
.card-meta { display: flex; align-items: center; gap: 10px; }
.level-badge {
    font-family: var(--f-mono); font-size: 11px; font-weight: 500;
    letter-spacing: 0.1em; padding: 4px 10px; border-radius: 999px;
    color: var(--accent); background: var(--accent-soft);
    border: 1px solid var(--accent-border);
}
.card-series {
    font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-dim);
}
.course-card h2 {
    font-family: var(--f-serif); font-weight: 400;
    font-size: 30px; line-height: 1.15; letter-spacing: -0.01em;
    margin-top: 16px; position: relative; z-index: 1;
}
.course-card .card-sub {
    color: var(--text-muted); font-size: 14.5px; line-height: 1.6;
    margin-top: 10px; flex: 1; position: relative; z-index: 1;
}
.skill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.skill-tag {
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em;
    color: var(--text-muted); border: 1px solid var(--border);
    padding: 3px 9px; border-radius: 999px;
}
.card-foot {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--hairline);
}
.card-duration { font-size: 13px; color: var(--text-dim); }
.card-open {
    font-size: 13.5px; font-weight: 600; color: var(--accent);
    display: inline-flex; align-items: center; gap: 6px;
}
.card-open .arr { transition: transform .2s; }
.course-card:hover .card-open .arr { transform: translateX(3px); }

.lib-soon {
    border: 1px dashed var(--border-strong);
    background: transparent;
    display: flex; flex-direction: column; align-items: flex-start;
    justify-content: center; gap: 10px;
    border-radius: var(--r-xl); padding: 28px;
    color: var(--text-dim); font-size: 14.5px; line-height: 1.6;
}
.lib-soon .soon-label {
    font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--text-dim);
}

/* ─── Unit page layout ─── */
.unit-hero {
    max-width: var(--container); margin: 0 auto;
    padding: 88px 24px 36px;
    border-bottom: 1px solid var(--hairline);
}
.unit-hero h1 {
    font-family: var(--f-serif); font-weight: 400;
    font-size: clamp(42px, 6.2vw, 76px); line-height: 1.04;
    letter-spacing: -0.015em; margin-top: 18px;
}
.unit-hero .unit-sub {
    font-family: var(--f-display); font-weight: 500;
    color: var(--text-muted); font-size: 19px; margin-top: 14px;
}
.unit-lede {
    max-width: 680px; color: var(--text-muted); font-size: 16.5px;
    line-height: 1.7; margin-top: 18px;
}
.unit-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.meta-chip {
    font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.07em;
    color: var(--text-muted); border: 1px solid var(--border);
    background: var(--surface); padding: 6px 12px; border-radius: 999px;
}
.unit-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 14.5px; font-weight: 600;
    padding: 11px 20px; border-radius: 999px;
    border: 1px solid var(--border-strong);
    color: var(--text); background: var(--surface-2);
    transition: transform .15s, border-color .15s, background .15s;
    cursor: pointer; font-family: var(--f-body);
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent-border); }
.btn-accent {
    background: var(--accent); border-color: var(--accent);
    color: #1a1408;
}
.btn-accent:hover { background: #f0c476; }

/* layout: rail + content */
.unit-body {
    max-width: var(--container); margin: 0 auto;
    padding: 0 24px 140px;
    display: grid; grid-template-columns: 250px minmax(0, 1fr);
    gap: 56px;
}
.rail {
    position: sticky; top: 86px; align-self: start;
    max-height: calc(100vh - 110px); overflow-y: auto;
    padding: 28px 0 28px;
    scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.rail-label {
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--text-dim);
    margin-bottom: 14px;
}
.rail a {
    display: flex; align-items: baseline; gap: 10px;
    padding: 7px 10px; margin-left: -10px;
    border-radius: var(--r-sm);
    color: var(--text-muted); font-size: 13.5px; line-height: 1.4;
    border-left: 2px solid transparent;
    transition: color .15s, background .15s;
}
.rail a .no {
    font-family: var(--f-mono); font-size: 10.5px; color: var(--text-dim);
    min-width: 18px;
}
.rail a:hover { color: var(--text); background: var(--surface); }
.rail a.active { color: var(--accent); }
.rail a.active .no { color: var(--accent); }

.unit-content { padding-top: 36px; min-width: 0; }

/* ─── Section primitives ─── */
.sec { margin-bottom: 88px; }
.sec-eyebrow {
    font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--accent);
    display: inline-flex; align-items: center; gap: 10px;
}
.sec-eyebrow::before { content: ""; width: 20px; height: 1px; background: var(--accent-border); }
.sec h2 {
    font-family: var(--f-display); font-weight: 700;
    font-size: clamp(26px, 3.2vw, 34px); letter-spacing: -0.025em;
    line-height: 1.15; margin-top: 12px;
}
.sec .sec-intro {
    max-width: var(--reading); color: var(--text-muted);
    font-size: 15.5px; line-height: 1.7; margin-top: 12px;
}

/* goals */
.goal-list { margin-top: 26px; display: grid; gap: 10px; }
.goal {
    display: grid; grid-template-columns: 52px 1fr; align-items: stretch;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); overflow: hidden;
}
.goal .g-no {
    display: flex; align-items: center; justify-content: center;
    font-family: var(--f-serif); font-size: 22px; color: var(--accent);
    background: var(--surface-2); border-right: 1px solid var(--border);
}
.goal .g-body { padding: 14px 18px; }
.goal .g-skill {
    font-family: var(--f-display); font-weight: 600; font-size: 15.5px;
}
.goal .g-text { color: var(--text-muted); font-size: 14px; margin-top: 3px; line-height: 1.6; }

/* generic card grid */
.card-grid { display: grid; gap: 14px; margin-top: 26px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kcard {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 20px 22px;
}
.kcard h3 {
    font-family: var(--f-serif); font-weight: 400; font-size: 19px;
    letter-spacing: -0.005em;
}
.kcard p { color: var(--text-muted); font-size: 14px; line-height: 1.65; margin-top: 8px; }
.kcard p strong, .kcard p b { color: var(--text); font-weight: 600; }
.kcard p em { color: var(--text); font-style: italic; font-family: var(--f-serif); }

/* vocab */
.vocab-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.vcard {
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--accent-border);
    border-radius: var(--r-md); padding: 18px 20px;
    transition: border-color .2s, transform .2s;
}
.vcard:hover { border-left-color: var(--accent); transform: translateX(2px); }
.vcard .v-word {
    font-family: var(--f-serif); font-size: 18.5px; letter-spacing: -0.005em;
}
.vcard .v-def { color: var(--text-muted); font-size: 14px; line-height: 1.65; margin-top: 8px; }
.vcard .v-def em { color: var(--text); font-family: var(--f-serif); font-style: italic; }
.vcard .v-def strong { color: var(--text); font-weight: 600; }

/* reading text */
.lesetext {
    margin-top: 26px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    padding: 34px 38px;
    position: relative;
}
.lesetext::before {
    content: "\201E"; position: absolute; top: -6px; left: 18px;
    font-family: var(--f-serif); font-size: 84px; line-height: 1;
    color: var(--accent); opacity: 0.5;
}
.lesetext p {
    font-family: var(--f-serif); font-weight: 400;
    font-size: 18.5px; line-height: 1.85; letter-spacing: 0.002em;
    color: var(--text);
}
.lesetext p + p { margin-top: 14px; }

/* glossary under text */
.gloss-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.gloss {
    background: var(--bg-2); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: 16px 18px;
    font-size: 13.5px; line-height: 1.65; color: var(--text-muted);
}
.gloss .g-term { color: var(--text); font-weight: 600; }
.gloss h4 {
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px;
}
.pair-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pair {
    font-size: 13px; color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 5px 12px;
}
.pair b { color: var(--accent); font-weight: 600; }

/* numbered questions */
.q-list { margin-top: 26px; display: grid; gap: 10px; }
.q {
    display: grid; grid-template-columns: 44px 1fr;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); overflow: hidden;
}
.q .q-no {
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 16px;
    font-family: var(--f-serif); font-size: 19px; color: var(--accent);
    background: var(--surface-2); border-right: 1px solid var(--border);
}
.q .q-body { padding: 15px 18px; }
.q .q-title { font-weight: 600; font-size: 15.5px; }
.q .q-hint { color: var(--text-muted); font-size: 13.5px; line-height: 1.65; margin-top: 4px; }

/* tip / callout */
.callout {
    margin-top: 22px;
    display: flex; gap: 14px; align-items: flex-start;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    border-radius: var(--r-md);
    padding: 16px 20px;
    font-size: 14px; line-height: 1.65; color: var(--text);
    max-width: 100%;
}
.callout .c-label {
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--accent);
    white-space: nowrap; padding-top: 3px;
}
.callout-neutral { background: var(--surface); border-color: var(--border-strong); }
.callout-neutral .c-label { color: var(--text-dim); }

/* comparison table */
.cmp-wrap { margin-top: 26px; overflow-x: auto; border: 1px solid var(--border-strong); border-radius: var(--r-lg); }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.cmp th {
    font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.1em;
    text-transform: uppercase; text-align: left;
    color: var(--text-dim); background: var(--surface-2);
    padding: 14px 18px; border-bottom: 1px solid var(--border-strong);
}
table.cmp th:nth-child(2) { color: var(--ok); }
table.cmp th:nth-child(3) { color: var(--weak); }
table.cmp td {
    padding: 14px 18px; vertical-align: top; line-height: 1.6;
    color: var(--text-muted); border-bottom: 1px solid var(--hairline);
    background: var(--surface);
}
table.cmp td:first-child { color: var(--text); font-weight: 600; white-space: nowrap; }
table.cmp tr:last-child td { border-bottom: none; }

/* redemittel */
.rm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 26px; }
.rm {
    background: var(--surface); border: 1px solid var(--border);
    border-top: 3px solid var(--accent-border);
    border-radius: var(--r-md); padding: 20px 22px;
}
.rm h3 {
    font-family: var(--f-display); font-weight: 700; font-size: 15px;
    letter-spacing: -0.01em;
}
.rm p { margin-top: 10px; color: var(--text-muted); font-size: 13.5px; line-height: 1.7; }
.rm p em { color: var(--text); font-style: normal; font-weight: 500; }

/* interactive: sort game / ultimatum */
.game {
    margin-top: 26px;
    background: linear-gradient(180deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    padding: 28px 30px;
}
.game .game-label {
    font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--accent);
}
.game .statement {
    font-family: var(--f-serif); font-size: 19px; line-height: 1.5;
    margin-top: 14px;
}
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.choice {
    font-size: 13.5px; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border-strong); border-radius: 999px;
    background: var(--surface); color: var(--text-muted);
    padding: 8px 16px; font-family: var(--f-body);
    transition: border-color .15s, color .15s, background .15s;
}
.choice:hover { border-color: var(--accent-border); color: var(--text); }
.choice.is-right { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.choice.is-also { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
.choice.is-wrong { background: var(--weak-soft); border-color: var(--weak); color: var(--weak); }
.game-feedback {
    margin-top: 14px; font-size: 14px; line-height: 1.6;
    color: var(--text-muted); min-height: 22px;
}
.game-feedback strong { color: var(--text); }
.game-nav { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.game-step { font-family: var(--f-mono); font-size: 11.5px; color: var(--text-dim); letter-spacing: 0.08em; }

/* ultimatum slider */
.ulti-amount {
    font-family: var(--f-serif); font-size: clamp(40px, 6vw, 60px);
    line-height: 1; margin-top: 18px;
}
.ulti-amount small { font-size: 0.45em; color: var(--text-muted); font-family: var(--f-body); }
input[type="range"].ulti {
    width: 100%; margin-top: 20px; accent-color: var(--accent);
    cursor: pointer;
}
.ulti-split {
    display: flex; justify-content: space-between; margin-top: 10px;
    font-family: var(--f-mono); font-size: 12px; color: var(--text-dim);
}
.ulti-actions { display: flex; gap: 10px; margin-top: 20px; }

/* final quote */
.unit-quote {
    margin: 60px 0 0;
    border-left: 3px solid var(--accent);
    padding: 6px 0 6px 28px;
}
.unit-quote p {
    font-family: var(--f-serif); font-style: italic;
    font-size: clamp(22px, 3vw, 28px); line-height: 1.5; letter-spacing: -0.005em;
}
.unit-quote cite {
    display: block; margin-top: 12px; font-style: normal;
    font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-dim);
}

/* end CTA */
.unit-next {
    margin-top: 70px;
    background: linear-gradient(135deg, rgba(232, 180, 95, 0.08), transparent 55%), var(--surface);
    border: 1px solid var(--accent-border);
    border-radius: var(--r-xl);
    padding: 40px 42px;
}
.unit-next h2 {
    font-family: var(--f-serif); font-weight: 400;
    font-size: clamp(26px, 3.4vw, 34px); letter-spacing: -0.01em;
}
.unit-next p { color: var(--text-muted); max-width: 560px; margin-top: 12px; font-size: 15.5px; line-height: 1.7; }

/* footer */
.foot {
    border-top: 1px solid var(--hairline);
    padding: 36px 24px 48px;
}
.foot-inner {
    max-width: var(--container); margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
    color: var(--text-dim); font-size: 13px;
}
.foot-inner a { color: var(--text-muted); transition: color .15s; }
.foot-inner a:hover { color: var(--accent); }
.foot-spacer { flex: 1; }

/* back-to-top */
.to-top {
    position: fixed; right: 22px; bottom: 22px; z-index: 40;
    width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--border-strong); background: var(--surface-2);
    color: var(--text-muted); font-size: 17px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
    transform: translateY(8px);
}
.to-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }
.to-top:hover { color: var(--accent); border-color: var(--accent-border); }

/* reveal on scroll */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    .rv { opacity: 1; transform: none; transition: none; }
    html { scroll-behavior: auto; }
}

/* ─── Responsive ─── */
@media (max-width: 980px) {
    .unit-body { grid-template-columns: 1fr; gap: 0; }
    .rail {
        position: sticky; top: 57px; z-index: 45;
        max-height: none; overflow-x: auto; overflow-y: hidden;
        display: flex; gap: 4px; padding: 10px 0;
        background: rgba(8, 8, 11, 0.9);
        backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--hairline);
        margin: 0 -24px; padding-left: 24px; padding-right: 24px;
        scrollbar-width: none;
    }
    .rail::-webkit-scrollbar { display: none; }
    .rail-label { display: none; }
    .rail a { white-space: nowrap; border-left: none; padding: 6px 12px; margin-left: 0; border: 1px solid transparent; }
    .rail a.active { border-color: var(--accent-border); background: var(--accent-soft); border-radius: 999px; }
    .rm-grid, .cols-3 { grid-template-columns: 1fr; }
    .vocab-grid, .cols-2, .gloss-grid { grid-template-columns: 1fr; }
    .lesetext { padding: 26px 24px; }
    .lesetext p { font-size: 17px; }
    .unit-next { padding: 30px 26px; }
}
@media (max-width: 640px) {
    .lib-hero { padding-top: 72px; }
    .unit-hero { padding-top: 64px; }
    .topbar-cta { display: none; }
}

/* ─── Interactive engine widgets ─── */
.rail a .tick {
    margin-left: auto; color: var(--ok); font-size: 11px;
    font-family: var(--f-mono);
}

.flash { margin-top: 18px; min-height: 110px; }
.flash-word {
    font-family: var(--f-serif); font-size: clamp(22px, 3vw, 28px);
    line-height: 1.3; letter-spacing: -0.005em;
}
.flash-def { margin-top: 12px; color: var(--text-muted); font-size: 15px; line-height: 1.7; }

.cloze-list { margin-top: 16px; display: grid; gap: 16px; }
.cloze-sentence { font-size: 15.5px; line-height: 2; }
.cloze-input {
    display: inline-block; min-width: 150px; margin: 0 6px;
    padding: 4px 10px; border-radius: var(--r-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-2); color: var(--text);
    font-family: var(--f-body); font-size: 15px;
    outline: none; transition: border-color .15s;
}
.cloze-input:focus { border-color: var(--accent-border); }
.cloze-input.cz-right { border-color: var(--ok); color: var(--ok); }
.cloze-input.cz-wrong { border-color: var(--weak); color: var(--weak); }
.cloze-hint { font-family: var(--f-mono); font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.cloze-fb { font-size: 13.5px; color: var(--text-muted); min-height: 18px; margin-top: 2px; }
.cloze-fb strong { color: var(--ok); }

.widget-mc { margin-top: 26px; }
.mc-q + .mc-q { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--hairline); }
.mc-question { font-size: 16.5px; }
.mc-choice { text-align: left; }

.writing-area, .note-area {
    width: 100%; margin-top: 14px;
    padding: 14px 16px; border-radius: var(--r-md);
    border: 1px solid var(--border-strong);
    background: var(--bg-2); color: var(--text);
    font-family: var(--f-body); font-size: 15px; line-height: 1.7;
    resize: vertical; outline: none; transition: border-color .15s;
}
.writing-area:focus, .note-area:focus { border-color: var(--accent-border); }
.w-state { min-height: auto; }

.note-toggle {
    margin-top: 10px; cursor: pointer;
    font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-dim);
    background: none; border: 1px solid var(--border);
    border-radius: 999px; padding: 4px 12px;
    transition: color .15s, border-color .15s;
}
.note-toggle:hover { color: var(--accent); border-color: var(--accent-border); }
.note-toggle.has-note { color: var(--ok); border-color: rgba(154, 214, 138, 0.4); }
.note-area { font-size: 14px; }
