/* ---------- Tokens ---------- */
:root {
    --bg: #F5F3FF;
    --fg: #22213A;
    --muted: #5F5D7A;
    --surface: #FFFFFF;
    --line: #ECEAF8;
    --accent: #3D3BF3;
    --on-accent: #FFFFFF;
    --coral: #FF7A59;
    --chip-bg: #ECEBFF;
    --chip-fg: #2A28C9;
    --bubble-shadow: #DCD8F5;
    --note: #FFE27A;
    --note-fg: #22213A;
    --note-shadow: #E8C94F;
    --good: #15803D;
    --danger: #B83A1B;

    --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
    --font-body: 'Figtree', system-ui, sans-serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121826;
        --fg: #ECEBFA;
        --muted: #9AA4B8;
        --surface: #1D2536;
        --line: #2A3447;
        --accent: #5654F6;
        --on-accent: #FFFFFF;
        --coral: #FF8A6B;
        --chip-bg: #2E2B63;
        --chip-fg: #CFCEFF;
        --bubble-shadow: #0A0F19;
        --note: #F2D46B;
        --note-fg: #22213A;
        --note-shadow: #8A7020;
        --good: #4ADE80;
        --danger: #FF8A6B;

        color-scheme: dark;
    }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font: 18px/1.6 var(--font-body);
}

.section {
    max-width: 760px;
    margin: 0 auto;
    padding: 48px 18px 96px;
    display: flex;
    flex-direction: column;
    gap: 40px;
}

h1, h2 { font-family: var(--font-display); font-weight: 800; line-height: 1.1; }
h1 { font-size: clamp(40px, 9vw, 56px); margin: 0 0 14px; letter-spacing: -0.02em; line-height: 1; }
h2 { font-size: 28px; margin: 0 0 14px; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

/* ---------- Header ---------- */
.badge {
    display: inline-block;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 700;
    font-size: 15px;
    padding: 6px 14px;
    border-radius: 16px 16px 16px 4px;
    margin-bottom: 16px;
}
.subtitle { color: var(--muted); margin: 0 0 8px; }
.aim { font-size: 21px; margin: 0 0 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chips li {
    background: var(--surface);
    border: 2px solid var(--fg);
    border-radius: 999px;
    padding: 4px 14px;
    font-weight: 600;
    font-size: 15px;
}

/* ---------- Dialogue ---------- */
.dialogue { display: flex; flex-direction: column; gap: 10px; font-size: 19px; }
.line { display: flex; gap: 10px; align-items: flex-end; }
.line--right { flex-direction: row-reverse; }
.avatar {
    flex: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-weight: 700; font-size: 15px;
    background: var(--coral); color: #22213A;
}
.line--right .avatar { background: var(--accent); color: var(--on-accent); }
.bubble {
    background: var(--surface);
    border-radius: 20px 20px 20px 6px;
    padding: 10px 16px;
    box-shadow: 0 2px 0 var(--bubble-shadow);
    max-width: 85%;
}
.line--right .bubble {
    background: var(--accent);
    color: var(--on-accent);
    border-radius: 20px 20px 6px 20px;
    box-shadow: none;
}

/* ---------- Notes ---------- */
.note {
    background: var(--note);
    color: var(--note-fg);
    border-radius: 14px;
    padding: 18px 22px;
    box-shadow: 0 6px 0 var(--note-shadow);
    transform: rotate(-0.4deg);
}
.note:nth-of-type(even) { transform: rotate(0.3deg); }
.note__title { font-family: var(--font-display); font-weight: 800; font-size: 20px; margin-bottom: 4px; }

/* ---------- Tables ---------- */
.card { background: var(--surface); border-radius: 20px; padding: 6px 18px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 12px 12px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
th { font-size: 14px; font-weight: 700; color: var(--muted); }
td:first-child { font-weight: 600; }

/* ---------- Examples ---------- */
.examples { display: flex; flex-direction: column; gap: 14px; list-style: none; padding: 0; margin: 0; }
.examples .de {
    display: inline-block;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    font-size: 19px;
    border-radius: 20px 20px 20px 6px;
    padding: 10px 16px;
}
.examples .en { display: block; color: var(--muted); margin: 4px 0 0 6px; }
.small { color: var(--muted); font-size: 15px; margin-top: 12px; }

/* ---------- Checklist ---------- */
.checklist { background: var(--surface); border-radius: 20px; padding: 20px 22px; }
.checklist h2 { font-size: 24px; margin-bottom: 6px; }
.checklist ul { list-style: none; padding: 0; margin: 0; }
.checklist label { display: flex; gap: 12px; align-items: center; min-height: 44px; cursor: pointer; }
.checklist input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }

/* ---------- German highlight (inline) ---------- */
.chip {
    background: var(--chip-bg);
    color: var(--chip-fg);
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 10px;
}

/* ---------- Vocabulary ---------- */
.lexikon summary {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 22px;
    background: var(--fg);
    color: var(--bg);
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}
.lexikon summary::-webkit-details-marker { display: none; }
.lexikon[open] summary { margin-bottom: 16px; }
.lexikon .card td:first-child { color: var(--chip-fg); }

/* ---------- Accessibility ---------- */
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .note { transform: none; } }

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Index ---------- */
.section-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Navigation ---------- */
.back { color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--fg); }
.pager { display: flex; gap: 12px; flex-wrap: wrap; }
.pager a {
    flex: 1 1 200px;
    background: var(--surface); color: inherit; text-decoration: none;
    border-radius: 20px; padding: 14px 18px;
    font-family: var(--font-display); font-weight: 800;
}
.pager a small { display: block; font-family: var(--font-body); font-weight: 600; color: var(--muted); font-size: 14px; }
.pager__next { text-align: right; }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions form { margin: 0; }
.button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 0 24px;
    background: var(--accent); color: var(--on-accent);
    border: 0; border-radius: 999px;
    font: 700 17px var(--font-body);
    text-decoration: none; cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button--ghost { background: var(--surface); color: var(--fg); }

/* ---------- Quiz ---------- */
.quiz { display: flex; flex-direction: column; gap: 32px; }
.quiz-q { border: 0; padding: 0; margin: 0; min-width: 0; }
.quiz-q legend { display: flex; gap: 10px; align-items: center; padding: 0; margin-bottom: 6px; font-size: 20px; font-weight: 600; }
.quiz-q .bubble { display: inline-block; }
.quiz-q__num {
    flex: none; width: 32px; height: 32px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--coral); color: #22213A;
    font-size: 14px; font-weight: 700;
}
.quiz-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.quiz-option {
    display: flex; gap: 10px; align-items: center;
    min-height: 48px; padding: 10px 14px;
    background: var(--surface);
    border: 2px solid transparent; border-radius: 16px;
    cursor: pointer;
}
.quiz-option:has(input:checked) { border-color: var(--accent); background: var(--chip-bg); }
.quiz-option input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }

/* ---------- Results ---------- */
.score { font-size: clamp(56px, 14vw, 88px); }
.results { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.result { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border-radius: 16px; padding: 12px 16px; }
.result__mark {
    flex: none; width: 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; font-weight: 800;
}
.result--right .result__mark { background: var(--good); color: var(--bg); }
.result--wrong .result__mark { background: var(--coral); color: #22213A; }
.result__prompt { font-weight: 700; }
.result s { color: var(--muted); }

/* ---------- Mistakes ---------- */
.mistakes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.mistake { background: var(--surface); border-radius: 16px; padding: 12px 16px; }
.mistake__pair { display: flex; flex-direction: column; gap: 2px; font-size: 19px; }
.mistake__wrong { color: var(--muted); }
.mistake__wrong s { text-decoration: none; }
.mistake__wrong::before { content: "✗"; color: var(--coral); font-weight: 800; display: inline-block; width: 1.4em; }
.mistake__right { color: var(--good); font-weight: 700; }
.mistake__right::before { content: "✓"; display: inline-block; width: 1.4em; }
.mistake__why { margin: 6px 0 0 1.4em; color: var(--muted); font-size: 15px; }

/* ---------- Exercises ---------- */
.block-exercise { background: var(--surface); border-radius: 20px; padding: 20px 22px; }
.block-exercise h2 { font-size: 22px; margin-bottom: 10px; }
.exercise { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; font-size: 19px; }
.exercise__answers { margin-top: 14px; }
.exercise__answers summary {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
    background: var(--chip-bg); color: var(--chip-fg);
    border-radius: 999px; font-weight: 700; cursor: pointer; list-style: none;
}
.exercise__answers summary::-webkit-details-marker { display: none; }
.exercise__answers ol { margin: 12px 0 0; padding-left: 1.4em; color: var(--good); font-weight: 700; }

/* ---------- One-at-a-time test ---------- */
.progress { height: 8px; background: var(--surface); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bubble--prompt { display: inline-block; font-size: 26px; font-weight: 700; padding: 14px 20px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.choice {
    min-height: 56px; padding: 12px 16px;
    background: var(--surface); color: var(--fg);
    border: 2px solid transparent; border-radius: 16px;
    font: 600 18px var(--font-body); text-align: left; cursor: pointer;
}
button.choice:hover { border-color: var(--accent); }
.choice--right { border-color: var(--good); }
.choice--right::before { content: "✓ "; color: var(--good); }
.choice--wrong { border-color: var(--coral); color: var(--muted); }
.choice--wrong::before { content: "✗ "; color: var(--coral); }
.choice--idle { opacity: .5; }
.feedback { background: var(--surface); border-radius: 16px; padding: 16px 20px; border-left: 0; }
.feedback strong { font-family: var(--font-display); font-size: 22px; }
.feedback--right strong { color: var(--good); }
.feedback--wrong strong { color: var(--coral); }
.feedback p { margin: 8px 0 0; }
.choices--articles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choices--articles .choice { text-align: center; font-size: 22px; }

.weak__sentences { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.weak__sentences li {
    display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
    padding: 8px 0; border-bottom: 1px solid var(--line);
}
.weak__sentences li:last-child { border-bottom: none; }
.weak__sentences li span:first-child { font-weight: 600; }

/* ---------- Login ---------- */
.login { max-width: 420px; }
.login__form { display: flex; flex-direction: column; gap: 16px; }
.login__form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
.login__form input[type="email"], .login__form input[type="password"] {
    font: 18px var(--font-body); padding: 12px 14px;
    border: 2px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--fg);
}
.login__form input:focus { border-color: var(--accent); outline: none; }
.login__remember { flex-direction: row !important; align-items: center; font-weight: 500 !important; }
.login__remember input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Typed answers ---------- */
.typed { display: flex; gap: 10px; flex-wrap: wrap; }
.typed__input {
    flex: 1 1 240px; min-height: 56px; padding: 12px 16px;
    font: 600 20px var(--font-body);
    background: var(--surface); color: var(--fg);
    border: 2px solid var(--line); border-radius: 16px;
}
.typed__input:focus { border-color: var(--accent); outline: none; }
.typed__given {
    min-height: 56px; padding: 14px 16px; border-radius: 16px;
    font: 600 20px var(--font-body); background: var(--surface);
    border: 2px solid var(--line);
}
.typed__given--right { border-color: var(--good); }
.typed__given--right::before { content: "✓ "; color: var(--good); }
.typed__given--wrong { border-color: var(--coral); color: var(--muted); }
.typed__given--wrong::before { content: "✗ "; color: var(--coral); }
.practice__typed { flex-basis: 100%; display: flex; gap: 10px; align-items: center; font-weight: 600; }
.practice__typed input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- Profile ---------- */
.profile { gap: 22px; }
.profile__head { display: flex; align-items: center; gap: 14px; }
.profile__avatar {
    flex: none; width: 64px; height: 64px; border-radius: 22px 22px 22px 6px;
    background: var(--accent); color: var(--on-accent);
    display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 800; font-size: 28px;
}
.profile__who { min-width: 0; }
.profile__who h1 { font-size: 28px; margin: 0; }
.profile__email { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.profile__mastery { background: var(--surface); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ring {
    width: 168px; height: 168px; border-radius: 50%;
    background: conic-gradient(var(--accent) 0 var(--p), var(--chip-bg) var(--p) 100%);
    display: grid; place-items: center;
}
.ring__inner { width: 132px; height: 132px; border-radius: 50%; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring__value { font-family: var(--font-display); font-weight: 800; font-size: 40px; line-height: 1; }
.ring__label { font-size: 13px; color: var(--muted); font-weight: 600; }

.profile__counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.profile__counts > div, .profile__stats > div { background: var(--bg); border-radius: 16px; padding: 10px 12px; }
.profile__counts b, .profile__stats b { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.profile__counts span { color: var(--muted); font-size: 14px; }
.profile__counts small, .profile__stats small { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }

.profile__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; text-align: center; }
.profile__stats > div { background: var(--surface); }
.profile__streak { color: var(--coral); }

.card-block { background: var(--surface); border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.card-block h2 { font-size: 20px; margin: 0; }
.chapter-bar__label { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 6px; }
.chapter-bar__pct { color: var(--chip-fg); }
.bar { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.profile__next { display: flex; flex-direction: column; gap: 10px; }
.profile__next h2 { font-size: 20px; margin: 0; }
.next-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 18px; padding: 12px 14px; color: inherit; text-decoration: none; }
.next-card > span:first-child { flex: 1; }
.next-card__title { display: block; font-weight: 700; }
.next-card__meta { font-size: 13px; color: var(--coral); font-weight: 600; }
.next-card__arrow { color: var(--accent); font-weight: 800; }

a.topbar__user { text-decoration: none; }
a.topbar__user:hover { color: var(--fg); }

/* ---------- Home ---------- */
.home h1 { margin-bottom: 10px; }
.home__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.streak-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface); border: 2px solid var(--fg); border-radius: 999px;
    padding: 3px 12px; font-weight: 700; font-size: 14px;
}
.streak-chip svg { color: var(--coral); }
.mastery-chip {
    display: inline-flex; align-items: center;
    background: var(--chip-bg); color: var(--chip-fg);
    border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 14px; text-decoration: none;
}

.continue { background: var(--accent); color: var(--on-accent); border-radius: 24px; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.continue__label { font-size: 13px; font-weight: 700; }
.continue__num { font-size: 14px; }
.continue__title { font-family: var(--font-display); font-weight: 800; font-size: 24px; line-height: 1.1; }
.continue__progress { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.continue__bar { flex: 1; height: 10px; background: rgba(255, 255, 255, .25); border-radius: 999px; overflow: hidden; }
.continue__bar span { display: block; height: 100%; background: var(--on-accent); border-radius: 999px; }
.continue__button {
    align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px;
    background: var(--on-accent); color: var(--accent); border-radius: 999px; font-weight: 700; text-decoration: none;
}

.review-row { background: var(--surface); border-radius: 20px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.review-row > div { flex: 1; }
.review-row__title { font-family: var(--font-display); font-weight: 800; font-size: 18px; }
.review-row__meta { font-size: 14px; color: var(--muted); }
.review-row form { margin: 0; }
.review-row__button {
    min-height: 44px; padding: 0 18px; background: var(--fg); color: var(--bg);
    border: 0; border-radius: 999px; font: 700 15px var(--font-body); cursor: pointer;
}

.chapter { display: flex; flex-direction: column; gap: 10px; }
.chapter__head { display: flex; align-items: baseline; justify-content: space-between; }
.chapter__head h2 { margin: 0; font-size: 24px; }
.chapter__head span { font-size: 14px; color: var(--muted); font-weight: 600; }
.bar--thin { height: 8px; }

.section-row {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface); border-radius: 18px; padding: 12px 14px;
    color: inherit; text-decoration: none; box-shadow: 0 2px 0 var(--bubble-shadow);
}
.section-row:hover { box-shadow: 0 2px 0 var(--accent); }
.section-row__num {
    flex: none; width: 38px; height: 38px; border-radius: 13px 13px 13px 4px;
    display: grid; place-items: center; font-weight: 700;
    background: var(--accent); color: var(--on-accent);
}
.section-row--done .section-row__num { background: var(--good); color: var(--bg); }
.section-row--new .section-row__num { background: var(--chip-bg); color: var(--chip-fg); }
.section-row__body { flex: 1; min-width: 0; }
.section-row__title { display: block; font-weight: 700; }
.section-row__progress { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.section-row__bar { flex: 1; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.section-row__bar span { display: block; height: 100%; background: var(--accent); }
.section-row--done .section-row__bar span { background: var(--good); }
.section-row__pct { font-size: 13px; font-weight: 700; color: var(--chip-fg); }
.section-row--done .section-row__pct { color: var(--good); }
.section-row__weak { display: block; font-size: 13px; color: var(--coral); font-weight: 600; margin-top: 2px; }
.section-row__new {
    display: inline-block; margin-top: 4px; font-size: 12px; font-weight: 700;
    color: var(--muted); border: 1.5px solid var(--line); border-radius: 999px; padding: 1px 10px;
}

/* ---------- Settings ---------- */
.settings { gap: 22px; }
.settings h1 { margin: 0; }
.settings-card { background: var(--surface); border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.settings-card h2 { font-size: 20px; margin: 0; }
.settings-card p { margin: 0; }
.settings-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.settings-card input[type="email"], .settings-card input[type="password"] {
    font: 17px var(--font-body); padding: 11px 14px;
    border: 2px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--fg);
}
.settings-card input:focus { border-color: var(--accent); outline: none; }
.settings-card .button { align-self: flex-start; }
.settings-card--pause { background: var(--note); color: var(--note-fg); }
.settings-card--danger { border: 2px solid var(--coral); }
.settings-card--danger h2 { color: var(--danger); }
.button--dark { background: var(--fg); color: var(--bg); }
.button--danger { background: #B83A1B; color: #FFFFFF; }

.flash { margin: 0; padding: 12px 16px; border-radius: 14px; font-weight: 600; }
.flash--success { background: var(--chip-bg); color: var(--chip-fg); }
.flash--error { background: var(--surface); color: var(--danger); border: 2px solid var(--coral); }

.profile__nav { display: flex; justify-content: space-between; align-items: center; }
.profile__settings { color: var(--accent); font-weight: 700; text-decoration: none; }

/* ---------- Weak words ---------- */
.weak { background: var(--surface); border-radius: 20px; padding: 18px 22px; }
.weak h2 { font-size: 22px; margin-bottom: 10px; }
.weak__list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.weak__list li {
    display: inline-flex; gap: 8px; align-items: baseline;
    background: var(--chip-bg); color: var(--chip-fg);
    border-radius: 999px; padding: 4px 14px; font-weight: 700;
}
.weak__count { font-size: 13px; font-weight: 600; color: var(--coral); }
.weak__sentences { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.weak__sentences li {
    display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
    padding: 8px 0; border-bottom: 1px solid var(--line);
}
.weak__sentences li:last-child { border-bottom: none; }
.weak__sentences li span:first-child { font-weight: 600; }

.review-row__form { display: flex; align-items: center; gap: 12px; }
.review-row__typed { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.review-row__typed input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Vocabulary details ---------- */
.lex-word { display: block; font-weight: 700; color: var(--chip-fg); }
.lex-forms { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; font-size: 14px; font-weight: 400; color: var(--fg); }
.lex-forms i { color: var(--muted); font-style: normal; font-size: 12px; }
.lex-example { display: block; margin-top: 4px; font-size: 14px; font-weight: 400; font-style: italic; color: var(--muted); }
.lex-note { display: block; margin-top: 2px; font-size: 13px; color: var(--coral); }
.lexikon .card td:first-child { color: inherit; }

/* ---------- Pronunciation ---------- */
.speak {
    display: inline-grid; place-items: center; vertical-align: middle;
    width: 32px; height: 32px; margin: 0 6px 0 0; padding: 0;
    border: 0; border-radius: 50%;
    background: var(--chip-bg); color: var(--chip-fg); cursor: pointer;
}
.speak:hover { background: var(--accent); color: var(--on-accent); }
.speak svg { width: 16px; height: 16px; }
.line .speak, .examples .speak { margin: 0 0 0 6px; }
.no-speech .speak { display: none; }

/* ---------- App navigation ---------- */
body { padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); }
.appnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--line);
}
.appnav__brand { display: none; }
.appnav__item {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
    min-height: 56px; justify-content: center;
    color: var(--muted); font-size: 12px; font-weight: 700; text-decoration: none;
}
.appnav__item svg { padding: 4px 16px; border-radius: 999px; }
.appnav__item.is-active { color: var(--accent); }
.appnav__item.is-active svg { background: var(--chip-bg); }
.appnav__badge {
    position: absolute; top: 2px; left: calc(50% + 6px);
    min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
    border-radius: 999px; background: var(--coral); color: #22213A;
    font-size: 11px; line-height: 18px; text-align: center;
}

/* Wide screens: the same links as a top bar */
@media (min-width: 900px) {
    body { padding-bottom: 0; }
    .appnav {
        position: sticky; top: 0; bottom: auto; z-index: 10;
        display: flex; align-items: center; gap: 8px;
        max-width: none; margin: 0;
        padding: 12px max(18px, calc((100% - 1120px) / 2 + 18px));
        background: color-mix(in srgb, var(--bg) 88%, transparent);
        backdrop-filter: blur(10px);
        border-top: 0; border-bottom: 1px solid var(--line);
    }
    .appnav__brand { display: block; margin-right: auto; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: var(--fg); text-decoration: none; }
    .appnav__item { flex-direction: row; min-height: 44px; padding: 0 14px 0 10px; gap: 6px; border-radius: 999px; font-size: 15px; }
    .appnav__item svg { padding: 0; background: none !important; }
    .appnav__item.is-active { background: var(--chip-bg); }
    .appnav__badge { position: static; }
}

.review-start { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.appnav__item svg { box-sizing: content-box; }

/* ---------- Section page ---------- */
.section--wide { max-width: 760px; }
.sec-head h1 { margin: 4px 0 6px; }
.sec-head__top { display: flex; align-items: center; justify-content: space-between; }
.sec-head__count { font-size: 13px; font-weight: 700; color: var(--muted); }
.sec-head__progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.sec-head__progress .bar { flex: 1; }
.sec-head__pct { font-size: 14px; font-weight: 700; color: var(--chip-fg); }
.sec-head__fix { font-size: 13px; font-weight: 700; color: var(--coral); }

.tabs {
    position: sticky; top: 8px; z-index: 5;
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
    padding: 4px; border-radius: 999px; background: var(--line);
    box-shadow: 0 0 0 8px var(--bg);
    scroll-margin-top: 16px;
}
.tabs [role="tab"] {
    min-height: 40px; border: 0; border-radius: 999px; background: transparent;
    font: 700 15px var(--font-body); color: var(--muted); cursor: pointer;
}
.tabs [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 0 var(--bubble-shadow); }
.tabs__badge {
    display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 2px; border-radius: 999px;
    background: var(--coral); color: #22213A; font-size: 11px; line-height: 18px;
}

.sec-panel { display: flex; flex-direction: column; gap: 28px; }
.sec-panel > h2 { margin: 0; }

.sec-panel { display: flex; flex-direction: column; gap: 28px; }
.sec-panel[hidden] { display: none; }
.sec-panel > h2 { margin: 0; }

.practise-cta {
    position: sticky; bottom: calc(69px + env(safe-area-inset-bottom, 0px));
    padding: 12px 0;
    background: linear-gradient(transparent, var(--bg) 30%);
}
.practise-cta__button { width: 100%; min-height: 52px; font-size: 17px; }

/* Practise panel */
.practise { display: flex; flex-direction: column; gap: 18px; }
.fix-card { background: var(--fg); color: var(--bg); border-radius: 24px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.fix-card__head { display: flex; align-items: center; gap: 10px; }
.fix-card__head h2 { margin: 0; font-size: 20px; color: inherit; }
.fix-card__head p { margin: 0; font-size: 13px; opacity: .75; }
.fix-card__icon { flex: none; width: 40px; height: 40px; border-radius: 14px; background: var(--coral); color: #22213A; display: grid; place-items: center; }
.fix-card__items { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.fix-card__items li { background: color-mix(in srgb, var(--bg) 14%, transparent); border-radius: 999px; padding: 3px 12px; font-weight: 600; font-size: 14px; }
.fix-card__start {
    min-height: 48px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--bg); color: var(--fg); font: 700 16px var(--font-body);
}
.fix-card__start--ghost { background: transparent; color: var(--bg); border: 2px solid color-mix(in srgb, var(--bg) 40%, transparent); }

.practise__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.practise__head h2 { margin: 0; font-size: 22px; }
.segmented { border: 0; margin: 0; padding: 3px; display: flex; gap: 2px; background: var(--line); border-radius: 999px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: flex; align-items: center; min-height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); }
.segmented input:checked + span { background: var(--surface); color: var(--fg); box-shadow: 0 1px 0 var(--bubble-shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode {
    display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
    min-height: 112px; padding: 14px; border: 0; border-radius: 20px; text-align: left; cursor: pointer;
    background: var(--surface); color: var(--fg); box-shadow: 0 2px 0 var(--bubble-shadow);
    font: inherit;
}
.mode:hover { box-shadow: 0 2px 0 var(--accent); }
.mode__icon { width: 40px; height: 40px; border-radius: 14px; background: var(--chip-bg); color: var(--chip-fg); display: grid; place-items: center; }
.mode__title { font-weight: 700; font-size: 17px; line-height: 1.2; }
.mode__meta { font-size: 13px; color: var(--muted); line-height: 1.3; }

/* Desktop: lesson left, practise panel right; no tabs */
@media (min-width: 1100px) {
    .section--wide { max-width: 1120px; }
    .tabs, .practise-cta { display: none; }
    .sec-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
    .sec-main { display: flex; flex-direction: column; gap: 48px; }
    .sec-panel[hidden] { display: flex !important; }
    .sec-side { position: sticky; top: 84px; }
    .modes { grid-template-columns: minmax(0, 1fr); }
    .mode { min-height: 0; flex-direction: row; align-items: center; flex-wrap: wrap; }
    .mode__meta { flex-basis: 100%; padding-left: 48px; margin-top: -8px; }
}

/* ---------- Question screen ---------- */
.qscreen { max-width: 640px; margin: 0 auto; padding: 0 18px 40px; display: flex; flex-direction: column; }
.qscreen--answered { padding-bottom: 340px; } /* room for the feedback panel */

.qbar { display: flex; align-items: center; gap: 12px; padding-top: 14px; }
.qbar__close { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.qbar__close:hover { background: var(--surface); color: var(--fg); }
.qbar__progress { flex: 1; height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.qbar__progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.qbar__count { font-weight: 700; font-size: 14px; color: var(--muted); }

.qprompt { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 48px 0 36px; text-align: center; }
.qprompt__hint { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.qprompt__row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.qprompt__text { font-family: var(--font-display); font-weight: 800; font-size: clamp(30px, 8vw, 44px); line-height: 1.1; }
.qprompt__text--long { font-size: clamp(22px, 5.5vw, 30px); }
.qprompt .speak { width: 44px; height: 44px; }

.qoptions { display: flex; flex-direction: column; gap: 10px; }
.qoptions--short { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.qoption {
    display: flex; align-items: center; gap: 12px; width: 100%;
    min-height: 60px; padding: 10px 14px; box-sizing: border-box;
    background: var(--surface); color: var(--fg);
    border: 2px solid var(--line); border-radius: 18px; box-shadow: 0 3px 0 var(--bubble-shadow);
    font: 600 18px var(--font-body); text-align: left; cursor: pointer;
}
button.qoption:hover { border-color: var(--accent); }
button.qoption:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bubble-shadow); }
.qoptions--short .qoption { justify-content: center; font-size: 22px; }
.qoption__key {
    flex: none; width: 30px; height: 30px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--chip-bg); color: var(--chip-fg);
    font: 700 14px var(--font-body);
}
.qoption--right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); box-shadow: none; }
.qoption--right .qoption__key { background: var(--good); color: var(--bg); }
.qoption--wrong { border-color: var(--coral); background: color-mix(in srgb, var(--coral) 12%, var(--surface)); box-shadow: none; }
.qoption--wrong .qoption__key { background: var(--coral); color: #22213A; }
.qoption--idle { opacity: .5; box-shadow: none; }
.qtip { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 0; }
@media (hover: none) { .qtip { display: none; } } /* touch screens have no number keys */

/* Feedback panel */
.qfeedback {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 20px 18px calc(22px + env(safe-area-inset-bottom, 0px));
    border-radius: 26px 26px 0 0;
    animation: qfeedback-in .25s ease-out;
}
.qfeedback__inner { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.qfeedback--right { background: color-mix(in srgb, var(--good) 16%, var(--bg)); box-shadow: 0 -2px 0 color-mix(in srgb, var(--good) 35%, transparent); }
.qfeedback--wrong { background: color-mix(in srgb, var(--coral) 16%, var(--bg)); box-shadow: 0 -2px 0 color-mix(in srgb, var(--coral) 40%, transparent); }
.qfeedback__title { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 26px; }
.qfeedback--right .qfeedback__title { color: var(--good); }
.qfeedback--wrong .qfeedback__title { color: var(--danger); }
.qfeedback__icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: var(--bg); }
.qfeedback--right .qfeedback__icon { background: var(--good); }
.qfeedback--wrong .qfeedback__icon { background: var(--coral); color: #22213A; }
.qfeedback p { margin: 0; }
.qfeedback__line { display: flex; align-items: center; gap: 10px; }
.qfeedback__line .speak { margin: 0; }
.qfeedback__note { font-size: 14px; color: var(--muted); }
.qfeedback__continue {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 54px; margin-top: 6px; border-radius: 999px;
    font-weight: 700; font-size: 17px; text-decoration: none; color: #FFFFFF;
}
.qfeedback__continue small { font-size: 12px; font-weight: 600; opacity: .8; }
.qfeedback--right .qfeedback__continue { background: #15803D; box-shadow: 0 4px 0 #0E5A2A; }
.qfeedback--wrong .qfeedback__continue { background: #B83A1B; box-shadow: 0 4px 0 #8A2A12; }
@media (hover: none) { .qfeedback__continue small { display: none; } }

@keyframes qfeedback-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .qfeedback { animation: none; } }

/* ---------- Results ---------- */
.results-screen { position: relative; max-width: 640px; margin: 0 auto; padding: 0 18px 48px; display: flex; flex-direction: column; gap: 26px; }
.results-screen__top { display: flex; justify-content: flex-end; padding-top: 14px; }

.results-hero { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.results-hero__label { margin: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.results-hero__headline { margin: 0; font-size: 34px; }
.results-hero__score { margin: 0; font-family: var(--font-display); font-weight: 800; font-size: 84px; line-height: 1; letter-spacing: -0.03em; }
.results-hero__score span { color: var(--muted); }
.results-hero__chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }

.results-mistakes { display: flex; flex-direction: column; gap: 10px; }
.results-mistakes h2 { margin: 0; font-size: 20px; }
.mistake-card { background: var(--surface); border-radius: 18px; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.mistake-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 17px; }
.mistake-card__head .speak { margin: 0; }
.mistake-card__answers { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; font-size: 15px; }
.mistake-card__answers dt { color: var(--muted); }
.mistake-card__answers dd { margin: 0; }
.mistake-card__yours { color: var(--danger); font-weight: 600; }
.mistake-card__right { color: var(--good); font-weight: 700; }

.results-actions { display: flex; flex-direction: column; gap: 10px; }
.results-actions form { margin: 0; }
.results-actions .button { width: 100%; min-height: 52px; justify-content: center; text-align: center; box-sizing: border-box; }
.results-actions__main { font-size: 17px; }
.results-actions__link {
    width: 100%; min-height: 44px; border: 0; background: none; cursor: pointer;
    color: var(--accent); font: 700 15px var(--font-body);
}

.results-all { background: var(--surface); border-radius: 18px; padding: 12px 16px; }
.results-all summary { font-weight: 700; cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.results-all__list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; }
.results-all__list li { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.results-all__mark { font-weight: 800; }
.is-right .results-all__mark { color: var(--good); }
.is-wrong .results-all__mark { color: var(--danger); }
.results-all__prompt { font-weight: 600; }
.results-all__answer { color: var(--muted); text-align: right; }

/* Confetti, once, from the top */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti span {
    position: absolute; top: -20px; left: var(--x);
    width: 10px; height: 16px; border-radius: 3px; background: var(--c);
    animation: confetti-fall 1.8s ease-in var(--d) forwards; opacity: 0;
}
.confetti span:nth-child(odd) { width: 12px; height: 12px; border-radius: 50%; }
@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0); }
    100% { opacity: 0; transform: translateY(105vh) rotate(var(--r)); }
}
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }


/* ---------- Home: plan for today ---------- */
.home { gap: 24px; }
.home__head h1 { margin: 0 0 10px; }

.plan { background: var(--surface); border-radius: 24px; padding: 18px; box-shadow: 0 3px 0 var(--bubble-shadow); display: flex; flex-direction: column; gap: 10px; }
.plan__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plan__head h2 { margin: 0; font-size: 22px; }
.plan__count { font-size: 13px; font-weight: 700; color: var(--good); }
.plan__bar span { background: var(--good); transition: width .4s ease; }
.plan__done-text { margin: 4px 0 0; color: var(--muted); }
.plan--done { background: color-mix(in srgb, var(--good) 12%, var(--surface)); }

.plan__steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; }
.plan-step { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.plan-step:first-child { border-top: 0; }
.plan-step__mark {
    flex: none; width: 34px; height: 34px; border-radius: 50%; box-sizing: border-box;
    display: grid; place-items: center; font-weight: 700;
    border: 2px solid var(--line); color: var(--muted);
}
.plan-step--next .plan-step__mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.plan-step--done .plan-step__mark { background: var(--good); border-color: var(--good); color: var(--bg); }
.plan-step__body { flex: 1; min-width: 0; }
.plan-step__title { display: block; font-weight: 700; }
.plan-step--done .plan-step__title { color: var(--muted); text-decoration: line-through; }
.plan-step__meta { display: block; font-size: 13px; color: var(--muted); }
.plan-step form { margin: 0; }
.plan-step__go {
    display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px;
    border: 2px solid var(--line); border-radius: 999px; background: transparent; cursor: pointer;
    color: var(--fg); font: 700 14px var(--font-body); text-decoration: none;
}
.plan-step--next .plan-step__go { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* ---------- Home: course ---------- */
.course { display: flex; flex-direction: column; gap: 10px; }
.course__head { display: flex; align-items: baseline; justify-content: space-between; }
.course__head h2 { margin: 0; font-size: 22px; }
.course__head a { font-weight: 700; font-size: 14px; text-decoration: none; }
.course__all > summary {
    display: flex; align-items: center; justify-content: center; min-height: 44px;
    font-weight: 700; color: var(--accent); cursor: pointer; list-style: none;
}
.course__all > summary::-webkit-details-marker { display: none; }
.course__all[open] > summary { margin-bottom: 8px; }
.course__all .chapter { margin-bottom: 18px; }
.course__all h3 { margin: 0; font-size: 20px; }

/* ---------- Settings ---------- */
.settings { gap: 22px; }
.settings__head { display: flex; align-items: center; gap: 14px; }
.settings__head h1 { margin: 0; font-size: 28px; }

.settings-group h2 {
    margin: 0 0 8px 4px; font-family: var(--font-body);
    font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.settings-group__note { margin: 6px 4px 0; font-size: 13px; color: var(--muted); }
.settings-list { background: var(--surface); border-radius: 18px; overflow: hidden; }

.settings-row { border-top: 1px solid var(--line); }
.settings-row:first-child { border-top: 0; }
.settings-row > summary, .settings-row--link {
    display: flex; align-items: center; gap: 10px;
    min-height: 54px; padding: 0 16px;
    cursor: pointer; list-style: none; color: var(--fg); text-decoration: none;
}
.settings-row > summary::-webkit-details-marker { display: none; }
.settings-row > summary:hover, .settings-row--link:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.settings-row__label { flex: 1; font-weight: 600; }
.settings-row__value { color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.settings-row__chevron { flex: none; color: var(--muted); transition: transform .2s ease; }
.settings-row[open] .settings-row__chevron { transform: rotate(90deg); }
.settings-row--danger .settings-row__label { color: var(--danger); }

.settings-row__body { display: flex; flex-direction: column; gap: 12px; padding: 4px 16px 18px; }
.settings-row__body p { margin: 0; color: var(--muted); }
.settings-row__body label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.settings-row__body input[type="email"], .settings-row__body input[type="password"] {
    font: 17px var(--font-body); padding: 11px 14px;
    border: 2px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--fg);
}
.settings-row__body input:focus { border-color: var(--accent); outline: none; }
.settings-row__body .button { align-self: flex-start; }

.qprompt__cue {
    margin: 4px 0 0; padding: 4px 14px; border-radius: 999px;
    background: var(--chip-bg); color: var(--chip-fg);
    font-size: 15px; font-weight: 700;
}
/* ---------- Review page ---------- */
.review-page { gap: 22px; }
.review-page h1 { margin: 0; }

.review-hero {
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    padding: 22px; border-radius: 26px;
    background: var(--accent); color: var(--on-accent);
    box-shadow: 0 4px 0 #2421B8;
}
.review-hero--clear { background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--fg); box-shadow: 0 3px 0 var(--bubble-shadow); }
.review-hero__number { font-family: var(--font-display); font-weight: 800; font-size: 72px; line-height: .9; }
.review-hero__title { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.1; }
.review-hero__icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--good); color: var(--bg); margin-bottom: 6px; }
.review-hero__text { margin: 4px 0 8px; opacity: .9; max-width: 34ch; }
.review-hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; width: 100%; }
.review-hero .segmented { background: color-mix(in srgb, currentColor 18%, transparent); }
.review-hero .segmented span { color: inherit; opacity: .8; }
.review-hero .segmented input:checked + span { opacity: 1; color: var(--fg); }
.review-hero__start {
    flex: 1; min-height: 52px; min-width: 160px; border: 0; border-radius: 999px; cursor: pointer;
    background: var(--on-accent); color: var(--accent); font: 700 17px var(--font-body);
}
.review-hero--clear .review-hero__start { background: var(--fg); color: var(--bg); }

.review-block h2 { margin: 0 0 10px; font-size: 20px; }
.review-forecast { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.review-forecast > div { background: var(--surface); border-radius: 18px; padding: 12px; text-align: center; }
.review-forecast b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 28px; }
.review-forecast small { font-size: 13px; color: var(--muted); font-weight: 600; }

.memory-bar { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--line); }
.memory-bar span { display: block; height: 100%; }
.memory-bar__learning, .memory-dot--learning { background: var(--coral); }
.memory-bar__getting, .memory-dot--getting { background: var(--note); }
.memory-bar__strong, .memory-dot--strong { background: var(--good); }
.memory-legend { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.memory-legend li { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.memory-legend b { font-family: var(--font-display); font-weight: 800; font-size: 18px; min-width: 2ch; }
.memory-legend small { color: var(--muted); font-size: 13px; }
.memory-dot { width: 12px; height: 12px; border-radius: 50%; align-self: center; }

.review-how { background: var(--surface); border-radius: 18px; padding: 12px 16px; }
.review-how summary { font-weight: 700; cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.review-how p { margin: 10px 0 4px; color: var(--muted); }

.settings-row__body select {
    font: 17px var(--font-body); padding: 11px 14px;
    border: 2px solid var(--line); border-radius: 14px;
    background: var(--surface); color: var(--fg);
}
.tz-hint { margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--chip-bg); color: var(--chip-fg) !important; }
.link-button { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* ---------- Home on desktop: plan left, course right ---------- */
.section-row.is-current { box-shadow: 0 0 0 2px var(--accent); }
.section-row.is-current .section-row__num { background: var(--accent); color: var(--on-accent); }

@media (min-width: 1100px) {
    .section.home { max-width: 1120px; }
    .home__grid {
        display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
        gap: 40px; align-items: start;
    }
    .home__grid .plan { position: sticky; top: 84px; }

    /* The full list replaces the current/next cards and the toggle */
    .course > .section-row { display: none; }
    .course__all > summary { display: none; }
    .course__all .section-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

/* ---------- Home: desktop dashboard ---------- */
.desk-only { display: none !important; }

.home-card { background: var(--surface); border-radius: 24px; padding: 18px 20px; }
.home-card h2 { margin: 0 0 12px; font-size: 22px; }
.home-card__head { display: flex; justify-content: space-between; align-items: baseline; }
.home-card__head span { font-size: 13px; font-weight: 700; color: var(--muted); }

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--bg); border-radius: 16px; padding: 12px 14px; }
.stat b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 26px; }
.stat small { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat--accent { color: var(--chip-fg); }
.stat--coral { color: var(--coral); }

.week { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; }
.week__day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week__bar-wrap { height: 84px; width: 100%; display: flex; align-items: flex-end; }
.week__bar { width: 100%; border-radius: 8px; background: var(--chip-bg); }
.week__bar.is-empty { background: var(--line); }
.is-today .week__bar { background: var(--accent); }
.week__label { font-size: 12px; font-weight: 700; color: var(--muted); }
.is-today .week__label { color: var(--chip-fg); }

.continue-hero {
    background: var(--accent); color: var(--on-accent);
    border-radius: 28px; padding: 26px 28px;
    grid-template-columns: minmax(0, 1fr) auto; gap: 20px; align-items: end;
}
.continue-hero__label { font-size: 14px; font-weight: 700; opacity: .85; }
.continue-hero__title { margin: 4px 0 14px; font-size: 34px; line-height: 1.05; color: inherit; }
.continue-hero__progress { display: flex; align-items: center; gap: 12px; max-width: 420px; font-weight: 700; }
.continue-hero__bar { flex: 1; height: 10px; background: rgba(255, 255, 255, .25); border-radius: 999px; overflow: hidden; }
.continue-hero__bar span { display: block; height: 100%; background: var(--on-accent); border-radius: 999px; }
.continue-hero__meta { display: flex; gap: 16px; margin-top: 14px; font-size: 14px; font-weight: 600; opacity: .9; }
.continue-hero__actions { display: flex; flex-direction: column; gap: 8px; }
.continue-hero__main, .continue-hero__ghost {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 999px; font-weight: 700; text-decoration: none;
}
.continue-hero__main { min-height: 52px; padding: 0 28px; background: var(--on-accent); color: var(--accent); font-size: 17px; }
.continue-hero__ghost { min-height: 44px; padding: 0 20px; border: 2px solid rgba(255, 255, 255, .5); color: var(--on-accent); }

.course-compact { flex-direction: column; gap: 12px; }
.chapter-compact { background: var(--surface); border-radius: 20px; }
.chapter-compact[open] { background: transparent; }
.chapter-compact__head {
    display: flex; align-items: baseline; gap: 12px; padding: 14px 18px;
    cursor: pointer; list-style: none;
}
.chapter-compact__head::-webkit-details-marker { display: none; }
.chapter-compact[open] .chapter-compact__head { padding: 0 4px 8px; }
.chapter-compact__name { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.chapter-compact__range { flex: 1; color: var(--muted); font-weight: 600; font-size: 14px; }
.chapter-compact__pct { font-size: 14px; font-weight: 700; color: var(--chip-fg); }
.chapter-compact__chevron { align-self: center; color: var(--muted); transition: transform .2s ease; }
.chapter-compact[open] .chapter-compact__chevron { transform: rotate(90deg); }

.course-rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 24px; }
.course-row {
    display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px;
    border-radius: 14px; color: var(--fg); text-decoration: none;
}
.course-row:hover { background: var(--surface); }
.course-row__mark {
    flex: none; width: 30px; height: 30px; border-radius: 50%; box-sizing: border-box;
    display: grid; place-items: center; font-weight: 700; font-size: 13px;
    border: 2px solid var(--line); color: var(--muted);
}
.course-row__bar { width: 80px; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.course-row__bar span { display: block; height: 100%; background: var(--accent); }
.course-row--new { color: var(--muted); }
.course-row--started .course-row__mark { border-color: var(--accent); color: var(--chip-fg); }
.course-row--current { background: var(--surface); }
.course-row--current .course-row__mark { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--chip-bg); }
.course-row--done .course-row__mark { background: var(--good); border-color: var(--good); color: var(--bg); }
.course-row--done .course-row__bar span { background: var(--good); }

.course-row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.course-row__title { font-weight: 700; line-height: 1.25; }
.course-row__progress { display: flex; align-items: center; gap: 8px; }
.course-row__bar { flex: 1; max-width: 160px; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.course-row__bar span { display: block; height: 100%; background: var(--accent); }
.course-row__pct { font-size: 12px; font-weight: 700; color: var(--chip-fg); }

@media (min-width: 1100px) {
    .section.home { max-width: 1120px; }
    .home__grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 32px; align-items: start; }
    .home__left, .home__right { display: flex; flex-direction: column; gap: 20px; }
    .home__left { position: sticky; top: 84px; }
    .desk-only { display: block !important; }
    .continue-hero.desk-only { display: grid !important; }
    .course-compact.desk-only { display: flex !important; }
    .phone-only { display: none !important; }
}

/* ---------- Avatar menu (desktop only) ---------- */
.appnav__menu { display: none; position: relative; }
.appnav__avatar {
    list-style: none; cursor: pointer;
    width: 40px; height: 40px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--accent); color: var(--on-accent);
    font-weight: 800;
}
.appnav__avatar::-webkit-details-marker { display: none; }
.appnav__dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
    min-width: 220px; padding: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    display: flex; flex-direction: column;
}
.appnav__email { padding: 8px 12px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; }
.appnav__dropdown a { padding: 10px 12px; border-radius: 10px; color: var(--fg); font-weight: 600; text-decoration: none; }
.appnav__dropdown a:hover { background: var(--chip-bg); }
.appnav__dropdown .appnav__logout { color: var(--danger); }

@media (min-width: 900px) {
    .appnav__menu { display: block; margin-left: 8px; }
}
