/* Self-hosted fonts (latin subset, covers ä/ö/ü/ß) — served from fonts/, precached by the service worker */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/plexmono-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/newsreader-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Concept 3: type-led, flat color fields, hairlines. No cards, no shadows.
   Color roles (every palette defines the same five):
   --sage  progress, success, "das"   --slate "der"   --clay "die" and mistakes
   --sand  rewards only               --act   the one primary action           */
:root {
  --bg: #f3f3ef;
  --surface-2: #e6e7e1;
  --ink: #202426;
  --ink-2: #646a65;
  --ink-3: #9a9f99;
  --hair: rgba(32, 36, 38, .14);
  --sage: #5f8f8b;
  --slate: #6b7fa8;
  --clay: #c98473;
  --sand: #b98f3f;
  --act: #c46f5a;
  --on-accent: #ffffff;
  --sage-field: color-mix(in srgb, var(--sage) 18%, var(--bg));
  --clay-field: color-mix(in srgb, var(--clay) 18%, var(--bg));
  --slate-field: color-mix(in srgb, var(--slate) 18%, var(--bg));
  --scrim: rgba(20, 22, 23, .55);
  --font-display: "Archivo", "Arial Narrow", "Segoe UI", system-ui, sans-serif;
  --font-body: "Archivo", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", monospace;
  --font-italic: "Newsreader", Georgia, serif;

  /* Legacy names still used by inline styles in index.html */
  --text: var(--ink);
  --muted: var(--ink-2);
  --panel: var(--bg);
  --panel-strong: var(--surface-2);
  --bg-deep: var(--surface-2);
  --line: var(--hair);
  --line-strong: color-mix(in srgb, var(--ink) 32%, transparent);
  --accent: var(--act);
  --accent-ink: var(--on-accent);
  --approved: var(--sage);
  --redline: var(--clay);
  --font-hand: var(--font-display);

  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171918; --surface-2: #242726;
    --ink: #eceeea; --ink-2: #a0a6a0; --ink-3: #6c726c; --hair: rgba(236, 238, 234, .13);
    --sage: #7fb0ab; --slate: #8fa1c6; --clay: #e09d8c; --sand: #e0bd78; --act: #e0917c;
    --on-accent: #171918; --scrim: rgba(0, 0, 0, .65);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171918; --surface-2: #242726;
  --ink: #eceeea; --ink-2: #a0a6a0; --ink-3: #6c726c; --hair: rgba(236, 238, 234, .13);
  --sage: #7fb0ab; --slate: #8fa1c6; --clay: #e09d8c; --sand: #e0bd78; --act: #e0917c;
  --on-accent: #171918; --scrim: rgba(0, 0, 0, .65);
  color-scheme: dark;
}

/* Palettes (Fjord is the default above). Light values, then dark for OS setting and explicit choice. */
:root[data-palette="bernstein"] { --sage: #7d8a4e; --slate: #64798f; --clay: #a8687a; --sand: #b88a2e; --act: #a96c45; }
:root[data-palette="wald"]      { --sage: #4f7a62; --slate: #5f7d96; --clay: #b5735c; --sand: #a9842f; --act: #3f6650; }
:root[data-palette="salbei"]    { --sage: #6f8770; --slate: #6f7f95; --clay: #a87f6e; --sand: #a8935f; --act: #24282a; }
:root[data-palette="pflaume"]   { --sage: #7d6a8f; --slate: #66829a; --clay: #b67f76; --sand: #b48a4c; --act: #6e5a82; }
@media (prefers-color-scheme: dark) {
  :root[data-palette="bernstein"]:not([data-theme="light"]) { --sage: #a9b46f; --slate: #93a6bd; --clay: #c98898; --sand: #e2b866; --act: #d9946a; }
  :root[data-palette="wald"]:not([data-theme="light"])      { --sage: #79a88c; --slate: #8aa6bf; --clay: #d39379; --sand: #ddb968; --act: #79a88c; }
  :root[data-palette="salbei"]:not([data-theme="light"])    { --sage: #98ae98; --slate: #9aaac0; --clay: #cfa695; --sand: #d6c39b; --act: #eceeea; }
  :root[data-palette="pflaume"]:not([data-theme="light"])   { --sage: #a693b8; --slate: #93adc0; --clay: #dcaaa1; --sand: #e2bd85; --act: #a693b8; }
}
:root[data-theme="dark"][data-palette="bernstein"] { --sage: #a9b46f; --slate: #93a6bd; --clay: #c98898; --sand: #e2b866; --act: #d9946a; }
:root[data-theme="dark"][data-palette="wald"]      { --sage: #79a88c; --slate: #8aa6bf; --clay: #d39379; --sand: #ddb968; --act: #79a88c; }
:root[data-theme="dark"][data-palette="salbei"]    { --sage: #98ae98; --slate: #9aaac0; --clay: #cfa695; --sand: #d6c39b; --act: #eceeea; }
:root[data-theme="dark"][data-palette="pflaume"]   { --sage: #a693b8; --slate: #93adc0; --clay: #dcaaa1; --sand: #e2bd85; --act: #a693b8; }

* { box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior: none; touch-action: pan-y; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; height: 100dvh; overflow: hidden; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--act); outline-offset: 3px; }

/* Notebook decorations from the previous design are retired */
.margin-rule, .punch-hole, .coffee-stain, .torn-edge { display: none !important; }

html, body { overflow-x: hidden; }
.app-shell {
  position: relative; display: flex; flex-direction: column; height: 100dvh; width: min(100%, 760px); margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 0 0;
  background: var(--bg);
}

.site-header { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 20px 12px; }
.brand { order: 2; display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: var(--ink-2); font-family: var(--font-mono); font-size: .68rem; font-weight: 500; letter-spacing: .02em; text-transform: uppercase; }
.brand-mark { width: 7px; height: 7px; background: var(--act); display: inline-block; font-size: 0; }
.header-meta { order: 1; min-width: 0; color: var(--ink-2); font-family: var(--font-mono); font-size: .68rem; white-space: nowrap; }
body.session-open .site-header { display: none; }
.header-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.icon-button { display: flex; align-items: center; gap: 6px; height: 38px; min-width: 34px; padding: 0 10px; border: 1.5px solid var(--hair); border-radius: 0; background: transparent; color: var(--ink); font-weight: 700; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.icon-button span { font-size: 1rem; }
.icon-button small { font-size: .66rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.icon-button.speaker-btn { justify-content: center; min-width: 38px; height: 38px; padding: 0; gap: 0; background: var(--surface-2); border-color: transparent; }
.icon-button.speaker-btn.speaking { background: var(--act); color: var(--on-accent); }
.verb-row { display: flex; align-items: center; gap: 10px; }
.solution-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hidden { display: none !important; }
main { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; animation: screen-in .25s ease both; scrollbar-width: none; padding: 0 20px; display: flex; flex-direction: column; }
main > .screen { flex: 1 0 auto; }
body.session-open main { padding-top: 6px; }
main::-webkit-scrollbar { width: 0; height: 0; display: none; }
#app:focus { outline: none; }

/* Bottom tab bar */
.tabbar { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 8px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--hair); background: var(--bg); }
.tabbar button { position: relative; min-height: 50px; padding: 12px 0 4px; border: 0; background: transparent; color: var(--ink-3); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tabbar button.active { color: var(--ink); }
.tabbar button.active::before { content: ""; position: absolute; top: -1px; left: 24%; right: 24%; height: 2.5px; background: var(--ink); }
body.session-open .tabbar { display: none; }
body.session-open .app-shell { padding-bottom: env(safe-area-inset-bottom); }

.screen { position: relative; display: grid; gap: 16px; align-content: start; padding-bottom: 20px; }
.screen.bleed-bottom { padding-bottom: 0; }
.hero { display: grid; gap: 6px; padding: 4px 0 2px; }
.hero-tags { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hero-tag { border: 1px solid var(--hair); padding: 5px 10px; font-family: var(--font-mono); font-size: .66rem; color: var(--ink-2); }
.eyebrow, .kicker { color: var(--ink-2); font-family: var(--font-mono); font-size: .7rem; letter-spacing: .02em; font-weight: 500; text-transform: none; }
h1, h2, h3, p { margin: 0; }
h1 { margin: 2px 0 6px; color: var(--ink); font-family: var(--font-display); font-stretch: 68%; font-weight: 800; font-size: clamp(2.6rem, 9vw + 2vh, 4.6rem); line-height: .88; letter-spacing: -.005em; text-transform: uppercase; overflow-wrap: anywhere; }
h1 .line { display: block; }
.subtitle { max-width: 42ch; color: var(--ink-2); line-height: 1.55; font-size: .9rem; }

.panel, .stat-card, .question-card, .review-item, .achievement, .empty-state {
  position: relative; border: 0; border-radius: 0; background: transparent; box-shadow: none;
}
.panel { padding: 14px 0 0; border-top: 1.5px solid var(--ink); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-title > * { min-width: 0; overflow-wrap: anywhere; }
.section-title h2 { font-family: var(--font-display); font-stretch: 80%; color: var(--ink); font-size: 1.05rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.section-title span { color: var(--ink-2); font-family: var(--font-mono); font-size: .66rem; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.stat-card { min-height: 78px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; background: var(--bg); }
.stat-label { color: var(--ink-2); font-family: var(--font-mono); font-size: .64rem; text-transform: uppercase; letter-spacing: .02em; }
.stat-value { color: var(--ink); font-family: var(--font-display); font-stretch: 70%; font-weight: 800; font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-suffix { font-size: .9rem; color: var(--ink-2); margin-left: 2px; font-weight: 600; }
.action-grid { display: grid; gap: 10px; }

/* Lists of choices (modes, levels, chapters) read as rows, not cards */
.mode-card { width: 100%; text-align: left; cursor: pointer; display: grid; gap: 4px; padding: 14px 34px 14px 0; border-top: 1px solid var(--hair); font-family: var(--font-body); color: var(--ink); transition: background .15s ease, padding .15s ease; }
.mode-card.panel { border-top: 1px solid var(--hair); }
.mode-card::after { content: "→"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%); color: var(--ink-3); font-size: 1.1rem; transition: transform .15s ease, color .15s ease; }
.mode-card-title { font-family: var(--font-display); font-stretch: 72%; font-size: 1.9rem; line-height: .95; font-weight: 800; color: var(--ink); margin: 2px 0; text-transform: uppercase; }
.mode-card.glossary-card .mode-card-title { color: var(--ink-2); }
.mode-card.chapter-resume { background: var(--sage-field); padding-left: 14px; border-top-color: var(--sage); }
.resume-meter { width: 100%; height: 3px; margin-top: 10px; accent-color: var(--sage); }
.resume-action { display: block; margin-top: 6px; color: var(--sage); font-weight: 700; }
.mode-card:active { background: var(--surface-2); }
.mode-card:disabled, .mode-card[aria-busy="true"] { cursor: wait; opacity: .6; }
.done-tag { position: absolute; top: 14px; right: 34px; font-family: var(--font-mono); color: var(--sage); font-size: .66rem; pointer-events: none; }
.mode-card.dogear { clip-path: none; }
.mode-card.dogear::before { content: none; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.glossary-controls { display: grid; gap: 10px; }
.glossary-search-label { color: var(--ink-2); font-family: var(--font-mono); font-size: .7rem; }
.glossary-search { width: 100%; min-height: 46px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 0 2px; color: var(--ink); background: transparent; font-size: 1.05rem; font-weight: 500; }
.glossary-search::placeholder { color: var(--ink-3); }
.chapter-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: thin; }
.b1-chapter-tabs, .a1-chapter-tabs, .a2-chapter-tabs, .b1plus-chapter-tabs { flex-wrap: wrap; }
.chapter-tab { flex: 0 0 auto; min-height: 40px; padding: 0 12px; border: 1px solid var(--hair); border-radius: 0; background: transparent; color: var(--ink-2); font-family: var(--font-mono); font-size: .72rem; transition: background .15s ease, border-color .15s ease, color .15s ease; }
.chapter-tab.active, .chapter-tab[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chapter-tab:disabled, .chapter-tab[aria-busy="true"] { cursor: not-allowed; opacity: .5; }
.glossary-chapter-picker { display: none; }
.glossary-chapter-picker label { color: var(--ink-2); font-family: var(--font-mono); font-size: .7rem; }
.glossary-chapter-select { width: 100%; min-height: 44px; padding: 0 10px; border: 1.5px solid var(--ink); border-radius: 0; background: var(--bg); color: var(--ink); font: 600 .9rem var(--font-body); }
.glossary-result-count { color: var(--ink-2); font-family: var(--font-mono); font-size: .7rem; }
#b1-glossary-results, #a1-glossary-results, #a2-glossary-results, #b1plus-glossary-results { display: grid; gap: 22px; }
.glossary-chapter { display: grid; gap: 12px; }
.glossary-chapter > h2 { padding-bottom: 6px; border-bottom: 1.5px solid var(--ink); color: var(--ink); font-family: var(--font-display); font-stretch: 75%; font-weight: 800; font-size: 1.4rem; text-transform: uppercase; }
.glossary-section { display: grid; gap: 6px; }
.glossary-section h3 { color: var(--ink-2); font-family: var(--font-mono); font-weight: 500; font-size: .72rem; }
.glossary-table { width: 100%; table-layout: fixed; border-collapse: collapse; border-top: 1px solid var(--hair); background: transparent; }
.glossary-table .activity-column { width: 3.6rem; }
.glossary-table th, .glossary-table td { padding: 9px 8px 9px 0; border-bottom: 1px solid var(--hair); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.glossary-table th { color: var(--ink-3); font-family: var(--font-mono); font-weight: 500; font-size: .64rem; text-transform: uppercase; }
.glossary-table td { color: var(--ink); font-size: .86rem; line-height: 1.45; font-weight: 500; }
.glossary-table td[lang="en"] { color: var(--ink-2); font-family: var(--font-italic); font-style: italic; font-size: .92rem; }
.glossary-table .glossary-activity { color: var(--clay); font-family: var(--font-mono); font-size: .72rem; white-space: nowrap; }
.glossary-error { display: grid; gap: 10px; border-top-color: var(--clay); }
.glossary-error h2 { color: var(--clay); font-family: var(--font-display); font-stretch: 75%; font-weight: 800; font-size: 1.4rem; text-transform: uppercase; }
.glossary-error p { color: var(--ink); line-height: 1.5; font-size: .9rem; }
.glossary-error button { width: 100%; }

.primary-button, .secondary-button, .option-button, .text-button, .danger-button {
  min-height: 50px; border-radius: 0; border: 1.5px solid var(--ink); font-weight: 700; letter-spacing: .01em;
  transition: background .15s ease, border-color .15s ease, color .15s ease; font-size: .95rem;
}
.primary-button { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; min-height: 58px; background: var(--act); border-color: var(--act); color: var(--on-accent); text-align: left; }
.secondary-button { padding: 0 17px; background: transparent; color: var(--ink); }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.button-row > * { flex: 1 1 140px; }
.database-actions { margin-top: 12px; }

.icon-button.active { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.difficulty-option.active { border-color: var(--ink); background: var(--ink); color: var(--bg); }

.progress-meter, .bar-meter {
  width: 100%; height: 3px; overflow: hidden; border: 0; border-radius: 0; appearance: none; -webkit-appearance: none;
  background: var(--hair);
}
.progress-meter::-webkit-progress-bar, .bar-meter::-webkit-progress-bar { background: transparent; }
.progress-meter::-webkit-progress-value, .bar-meter::-webkit-progress-value { background: var(--sage); }
.progress-meter::-moz-progress-bar, .bar-meter::-moz-progress-bar { background: var(--sage); }
.bar-meter { height: 8px; }
.quiz-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink-2); font-family: var(--font-mono); font-size: .7rem; }
.quiz-meta span { min-width: 0; overflow-wrap: anywhere; }
.quiz-score { color: var(--sand); }
.question-card { padding: 6px 0 0; display: grid; gap: 14px; }
.verb-word { color: var(--ink); font-family: var(--font-display); font-stretch: 66%; font-weight: 800; font-size: clamp(2.8rem, 10vw + 2vh, 5rem); line-height: .9; overflow-wrap: anywhere; }
.meaning { color: var(--ink-2); font-family: var(--font-italic); font-style: italic; font-size: 1.05rem; }
.prompt { font-size: clamp(1.05rem, 4.2vw, 1.35rem); line-height: 1.5; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.blank { color: var(--act); border-bottom: 2px solid var(--act); padding: 0 .15em .08em; }
.options { display: grid; gap: 0; border-top: 1px solid var(--hair); }
.option-button { width: 100%; display: grid; grid-template-columns: 34px 1fr; align-items: center; text-align: left; padding: 0 12px 0 4px; border: 0; border-bottom: 1px solid var(--hair); background: transparent; color: var(--ink); font-weight: 500; font-size: 1rem; overflow-wrap: anywhere; }
.option-button > span:last-child { min-width: 0; }
.option-key { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border: 1px solid var(--hair); color: var(--ink-2); font-family: var(--font-mono); font-size: .66rem; }
.option-button:disabled { cursor: default; }
.option-button.correct { background: var(--sage-field); color: var(--ink); box-shadow: inset 3px 0 0 var(--sage); }
.option-button.correct .option-key { border-color: var(--sage); background: var(--sage); color: var(--on-accent); }
.option-button.wrong { background: var(--clay-field); color: var(--ink-2); box-shadow: inset 3px 0 0 var(--clay); text-decoration: line-through; text-decoration-color: var(--clay); }
.option-button.wrong .option-key { border-color: var(--clay); color: var(--clay); }
.option-button.muted-option { opacity: .4; }
.feedback { display: grid; gap: 8px; padding: 14px 16px; background: var(--sage-field); font-size: .9rem; line-height: 1.5; }
.feedback > * { min-width: 0; overflow-wrap: anywhere; }
.feedback.wrong-feedback { background: var(--clay-field); }
.feedback strong { display: block; font-family: var(--font-display); font-stretch: 75%; color: var(--sage); font-size: 1.35rem; font-weight: 800; text-transform: uppercase; line-height: 1; }
.feedback.wrong-feedback strong { color: var(--clay); }
[data-action="next-question"]:focus { outline: 2px solid var(--ink); outline-offset: 3px; }
.timer { color: var(--ink); font-family: var(--font-mono); }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin: 2px 0 6px; }
.page-heading h1 { margin: 0; overflow-wrap: break-word; }
.page-copy { color: var(--ink-2); line-height: 1.55; font-size: .9rem; overflow-wrap: anywhere; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.metric-grid .stat-card { background: var(--bg); }
.wide-card { grid-column: span 2; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, .75fr) 1.8fr auto; align-items: center; gap: 10px; color: var(--ink); font-size: .85rem; font-weight: 500; }
.bar-row span { min-width: 0; overflow-wrap: anywhere; }
.bar-row strong { font-family: var(--font-mono); font-weight: 500; font-size: .75rem; color: var(--ink-2); }
.bar-row.bad .bar-meter::-webkit-progress-value { background: var(--clay); }
.bar-row.bad .bar-meter::-moz-progress-bar { background: var(--clay); }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--hair); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; color: var(--ink); font-size: .95rem; font-weight: 700; }
.setting-row small { display: block; color: var(--ink-2); margin-top: 3px; font-size: .78rem; line-height: 1.4; }
.switch { position: relative; width: 46px; height: 26px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border: 1.5px solid var(--ink); background: transparent; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; background: var(--ink-3); transition: .2s; }
.switch input:checked + span { background: var(--act); border-color: var(--act); }
.switch input:checked + span::after { transform: translateX(20px); background: var(--on-accent); }
.switch input:focus-visible + span { outline: 2px solid var(--act); outline-offset: 3px; }
.file-input { width: 100%; border: 1px dashed var(--hair); padding: 11px; color: var(--ink-2); font-size: .8rem; background: transparent; }
.danger-button { padding: 0 15px; color: var(--clay); border-color: var(--clay); background: transparent; }

/* Appearance picker (settings) */
.appearance { display: grid; gap: 16px; }
.appearance-label { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-2); }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); border: 1.5px solid var(--ink); }
.theme-options button { min-height: 42px; border: 0; background: transparent; color: var(--ink-2); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.theme-options button + button { border-left: 1.5px solid var(--ink); }
.theme-options button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.palette-list { display: grid; border-top: 1px solid var(--hair); }
.palette-option { display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 14px; padding: 12px 0; border: 0; border-bottom: 1px solid var(--hair); background: transparent; color: var(--ink); text-align: left; }
.palette-swatch { display: flex; height: 30px; }
.palette-swatch i { flex: 1; }
.palette-option strong { display: block; font-size: .95rem; font-weight: 700; }
.palette-option small { display: block; color: var(--ink-2); font-size: .78rem; line-height: 1.4; margin-top: 2px; }
.palette-check { width: 22px; height: 22px; border: 1.5px solid var(--hair); display: grid; place-items: center; font-size: .8rem; color: transparent; }
.palette-option[aria-pressed="true"] .palette-check { background: var(--act); border-color: var(--act); color: var(--on-accent); }

.achievement-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); }
.achievement { padding: 14px 12px; min-height: 130px; display: grid; align-content: space-between; gap: 8px; background: var(--bg); }
.achievement.locked { opacity: .45; filter: grayscale(1); }
.achievement-icon { color: var(--sand); font-size: 1.5rem; }
.achievement strong { color: var(--ink); font-size: .9rem; font-weight: 700; }
.achievement small { color: var(--ink-2); line-height: 1.4; font-size: .74rem; }
.review-item { padding: 12px 0 12px 14px; display: grid; gap: 6px; border-bottom: 1px solid var(--hair); }
.review-item.correct-review { box-shadow: inset 3px 0 0 var(--sage); }
.review-item.wrong-review { box-shadow: inset 3px 0 0 var(--clay); }
.review-head { display: flex; justify-content: space-between; gap: 10px; color: var(--ink); font-weight: 700; }
.review-head > * { min-width: 0; overflow-wrap: anywhere; }
.review-head span { font-family: var(--font-mono); font-weight: 500; font-size: .7rem; color: var(--ink-2); }
.review-item p { color: var(--ink-2); font-size: .84rem; line-height: 1.5; }
.review-item code { color: var(--ink); font-family: inherit; font-weight: 700; }
.review-item .stamp { display: none; }
.smudge-word { text-decoration: line-through; text-decoration-color: var(--clay); text-decoration-thickness: 2px; }
.grade {
  display: block; width: fit-content; margin: 0; padding: 0; border: 0;
  color: var(--ink); font-family: var(--font-display); font-stretch: 66%; font-weight: 800; font-size: clamp(5rem, 22vw, 7.5rem); line-height: .85; font-variant-numeric: tabular-nums;
}
.empty-state { padding: 22px 0; color: var(--ink-2); line-height: 1.6; font-size: .9rem; }
.text-button { width: fit-content; justify-self: start; min-height: 40px; padding: 0; border: 0; background: transparent; color: var(--ink-2); font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; border-bottom: 1px solid currentColor; min-height: 0; padding-bottom: 2px; margin-top: 6px; }
.toast-region { position: fixed; z-index: 8; top: max(15px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(calc(100% - 32px), 500px); pointer-events: none; }
.toast { padding: 14px 16px; background: var(--ink); color: var(--bg); font-size: .88rem; font-weight: 600; animation: toast-in .25s ease both; box-shadow: inset 3px 0 0 var(--sand); }
.toast.error { box-shadow: inset 3px 0 0 var(--clay); }
.modal { position: fixed; z-index: 7; inset: 0; display: grid; align-items: end; justify-items: center; padding: 0; background: var(--scrim); }
.modal-card { width: min(100%, 520px); padding: 22px 20px max(22px, env(safe-area-inset-bottom)); border: 0; border-top: 3px solid var(--ink); border-radius: 0; background: var(--bg); }
.modal-card h2 { color: var(--ink); font-family: var(--font-display); font-stretch: 72%; font-size: 1.8rem; line-height: .95; text-transform: uppercase; margin-bottom: 10px; font-weight: 800; }
.modal-card p { color: var(--ink-2); line-height: 1.55; font-size: .9rem; margin-bottom: 18px; }

/* Home */
.today-figure { display: flex; align-items: flex-end; gap: 12px; }
.today-figure .n { font-family: var(--font-display); font-stretch: 64%; font-weight: 800; font-size: clamp(6rem, 30vw, 9rem); line-height: .82; color: var(--ink); font-variant-numeric: tabular-nums; }
.today-figure .lab { padding-bottom: 8px; display: grid; gap: 3px; }
.today-figure .lab b { font-family: var(--font-display); font-stretch: 80%; font-size: 1.3rem; font-weight: 700; line-height: 1; }
.today-figure .lab i { font-family: var(--font-italic); font-size: 1rem; color: var(--ink-2); }
.course-list { display: grid; }
.course-row { display: grid; grid-template-columns: 26px 1fr auto 16px; align-items: baseline; gap: 10px; width: 100%; padding: 13px 0; border: 0; border-top: 1px solid var(--hair); background: transparent; color: var(--ink); text-align: left; }
.course-row:last-child { border-bottom: 1px solid var(--hair); }
.course-row .k { font-family: var(--font-mono); font-size: .66rem; color: var(--ink-3); }
.course-row b { font-size: 1.05rem; font-weight: 600; }
.course-row .c { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.confetti-piece { position: absolute; top: -20px; width: 8px; height: 12px; opacity: .95; animation-name: confetti-fall; animation-timing-function: ease-in; animation-fill-mode: forwards; }
@keyframes confetti-fall { to { transform: translate(var(--drift), 112vh) rotate(var(--rot)); opacity: .3; } }
@keyframes screen-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); } 20%, 40%, 60%, 80% { transform: translateX(4px); } }
.shake { animation: shake 0.5s ease-in-out; }
@media (min-width: 620px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } .metric-grid { grid-template-columns: repeat(3, 1fr); } .wide-card { grid-column: span 3; } .achievement-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
/* Hover only for real pointers — prevents sticky flashes on touch */
@media (hover: hover) and (pointer: fine) {
  .icon-button:hover { border-color: var(--ink); }
  .mode-card:hover, .course-row:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
  .mode-card:hover::after { transform: translate(4px, -50%); color: var(--act); }
  .primary-button:hover { background: color-mix(in srgb, var(--act) 88%, var(--ink)); }
  .secondary-button:hover { background: var(--ink); color: var(--bg); }
  .option-button:not(:disabled):hover { background: var(--surface-2); }
  .text-button:hover, .tabbar button:hover { color: var(--ink); }
  .chapter-tab:not(.active):hover { border-color: var(--ink); color: var(--ink); }
  .palette-option:hover { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
}
@media (max-width: 620px) {
  .site-header { margin-bottom: 10px; padding-bottom: 8px; }
  .screen { gap: 12px; }
  .question-card { gap: 12px; }
  .option-button { min-height: 50px; }
  .glossary-table .activity-column { width: 3rem; }
  .glossary-table th, .glossary-table td { padding: 8px 6px 8px 0; }
  .glossary-table td { font-size: .8rem; line-height: 1.4; }
  .b1-chapter-tabs, .a1-chapter-tabs, .a2-chapter-tabs, .b1plus-chapter-tabs { display: none; }
  .glossary-chapter-picker { display: grid; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; } }
body.no-animations *, body.no-animations *::before, body.no-animations *::after { animation: none !important; transition: none !important; }

/* Previous "living notebook" pieces, kept working but flattened */
.punch-hole.filled { display: none; }
.ink-row { display: none; }

/* ---- Question screens ---- */
.quiz-top { display: flex; align-items: center; gap: 12px; }
.quiz-top .progress-meter { flex: 1; }
.quiz-top .timer, .quiz-top .quiz-score { font-family: var(--font-mono); font-size: .74rem; white-space: nowrap; }
.quiz-close { width: 32px; height: 32px; display: grid; place-items: center; margin-left: -6px; border: 0; background: transparent; color: var(--ink); }
.word-block { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.word-main { display: grid; gap: 6px; min-width: 0; }
.word-block[class*="field-"] { padding: 18px 16px 20px; }
.word-block.field-der { background: var(--slate-field); }
.word-block.field-die { background: var(--clay-field); }
.word-block.field-das { background: var(--sage-field); }
.article-tag { font-family: var(--font-display); font-stretch: 80%; font-weight: 700; font-size: 1.4rem; line-height: 1; margin-top: 4px; }
.a-der { color: var(--slate); } .a-die { color: var(--clay); } .a-das { color: var(--sage); } .a-blank { color: var(--ink-3); }
.plural { font-family: var(--font-mono); font-size: .7rem; color: var(--ink-2); }

/* der · die · das drill */
.artikel-screen { align-content: start; }
.artikel-word { display: grid; gap: 8px; padding: 10px 0 6px; }
.lanes { display: grid; grid-template-columns: repeat(3, 1fr); min-height: clamp(200px, 40vh, 340px); }
.lane { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 14px 12px 22px; border: 0; text-align: left; transition: opacity .15s ease, background .15s ease; }
.lane b { font-family: var(--font-display); font-stretch: 68%; font-weight: 800; font-size: clamp(2.4rem, 11vw, 3.6rem); line-height: 1; }
.lane-key { font-family: var(--font-mono); font-size: .66rem; opacity: .7; }
.lane-mark { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.lane-der { background: var(--slate-field); color: var(--slate); }
.lane-die { background: var(--clay-field); color: var(--clay); }
.lane-das { background: var(--sage-field); color: var(--sage); }
.lane.is-correct { color: var(--on-accent); }
.lane-der.is-correct { background: var(--slate); } .lane-die.is-correct { background: var(--clay); } .lane-das.is-correct { background: var(--sage); }
.lane.is-dim { opacity: .35; }
.lane.is-wrong { opacity: .6; text-decoration: line-through; }
.lane:disabled { cursor: default; }
@media (hover: hover) and (pointer: fine) { .lane:not(:disabled):hover { filter: brightness(.96); } }

/* ---- Results ---- */
.note-figure { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.note-figure .n { font-family: var(--font-display); font-stretch: 64%; font-weight: 800; font-size: clamp(5.5rem, 26vw, 8rem); line-height: .82; font-variant-numeric: tabular-nums; }
.note-figure .lab { display: grid; gap: 4px; text-align: right; padding-bottom: 8px; }
.note-figure .lab b { font-family: var(--font-display); font-stretch: 80%; font-size: 1.5rem; font-weight: 700; line-height: 1; }
.ruler { position: relative; height: 32px; margin: 0 6px; }
.ruler .bar { position: absolute; left: 0; right: 0; top: 8px; height: 1.5px; background: var(--ink); }
.ruler .tk { position: absolute; top: 4px; width: 1.5px; height: 10px; margin-left: -.75px; background: var(--ink); }
.ruler .lb { position: absolute; top: 17px; font-family: var(--font-mono); font-size: .64rem; color: var(--ink-2); transform: translateX(-50%); }
.ruler .mk { position: absolute; top: 2px; width: 12px; height: 12px; margin-left: -6px; background: var(--act); transform: rotate(45deg); }
.squares { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.squares i { aspect-ratio: 1; background: var(--sage); }
.squares i.w { background: var(--clay); }
.missed { display: grid; }
.missed .eyebrow { margin-bottom: 6px; }
.missed div { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--hair); font-size: .95rem; }
.missed .ar { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; }
.missed .en { font-family: var(--font-italic); font-style: italic; color: var(--ink-2); text-align: right; overflow-wrap: anywhere; }
.all-answers summary { cursor: pointer; padding: 12px 0; border-top: 1px solid var(--hair); font-family: var(--font-mono); font-size: .72rem; color: var(--ink-2); }

/* ---- Chapters as a transit line ---- */
.line { display: grid; }
.stop { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 54px; padding: 8px 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.stop::before { content: ""; position: absolute; left: 9px; width: 6px; top: 0; bottom: 0; background: var(--surface-2); }
.stop.done::before { background: var(--sage); }
.stop.cur::before { background: linear-gradient(var(--sage) 50%, var(--surface-2) 50%); }
.stop:first-child::before { top: 50%; }
.stop:last-child::before { bottom: 50%; }
.stop .o { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; background: var(--bg); border: 3px solid var(--surface-2); }
.stop.done .o { border-color: var(--sage); }
.stop.cur .o { border-color: var(--act); background: var(--act); }
.stop .t { display: grid; font-size: 1rem; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.stop.todo .t { color: var(--ink-2); font-weight: 500; }
.stop .t .n { font-family: var(--font-mono); font-size: .64rem; font-weight: 500; color: var(--ink-3); }
.stop .m { font-family: var(--font-mono); font-size: .68rem; color: var(--ink-2); white-space: nowrap; }
.stop .here { justify-self: start; margin-top: 4px; padding: 2px 6px; background: var(--act); color: var(--on-accent); font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.stop .resume-meter { grid-column: 2 / -1; margin-top: 2px; height: 3px; }
@media (hover: hover) and (pointer: fine) { .stop:hover .t { color: var(--act); } }

/* ---- Mockup parity: full-width action bar ---- */
.action-bar { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; margin: auto -20px 0; padding: 12px 22px; border: 0; background: var(--act); color: var(--on-accent); font-weight: 700; font-size: 1rem; text-align: left; }
.action-bar > span:not(.p):not([aria-hidden]) { display: grid; gap: 2px; }
.action-bar small { font-family: var(--font-mono); font-size: .66rem; font-weight: 500; opacity: .8; }
.action-bar .p { position: absolute; left: 0; top: 0; height: 3px; background: color-mix(in srgb, var(--on-accent) 55%, transparent); }
@media (hover: hover) and (pointer: fine) { .action-bar:hover { background: color-mix(in srgb, var(--act) 88%, var(--ink)); } }

/* ---- Heute ---- */
.home-screen { gap: 18px; }
.home-screen .today-figure .n { font-size: clamp(7rem, 36vw, 9.5rem); }
.week-block { display: grid; gap: 8px; }
.streak { display: flex; justify-content: space-between; align-items: baseline; }
.streak b { font-family: var(--font-mono); font-size: .72rem; font-weight: 500; color: var(--sand); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week div { display: grid; gap: 5px; }
.week i { position: relative; display: block; height: 32px; overflow: hidden; background: var(--surface-2); }
.week i::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: var(--fill, 0%); background: var(--sage); }
.week .t i { box-shadow: inset 0 0 0 1.5px var(--ink); }
.week span { font-family: var(--font-mono); font-size: .62rem; color: var(--ink-3); text-align: center; }
.week .t span { color: var(--ink); }
.course-row { grid-template-columns: 26px 1fr auto; }

/* ---- Konjugation table ---- */
.conj-screen { gap: 14px; }
.conj-screen .verb { display: grid; gap: 4px; }
.conj-screen .verb-word { font-size: clamp(3.4rem, 15vw, 4.6rem); }
.tags { display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--font-mono); font-size: .66rem; color: var(--ink-2); }
.ctable { display: grid; grid-template-columns: 96px minmax(0, 1fr); border-top: 1.5px solid var(--ink); }
.ctable > * { padding: 10px 0; border-bottom: 1px solid var(--hair); font-size: 1.05rem; }
.ctable .p { font-family: var(--font-mono); font-size: .72rem; color: var(--ink-2); padding-top: 13px; }
.ctable .f { font-weight: 500; }
.ctable .f.dim { color: var(--ink-3); }
.ctable .f.in { display: flex; align-items: center; gap: 8px; margin: 3px 0; padding: 0 10px; background: var(--surface-2); box-shadow: inset 0 -2.5px 0 var(--act); font-weight: 700; min-height: 40px; }
.ctable .f.in input { width: 100%; min-height: 40px; border: 0; background: transparent; color: var(--ink); font-size: 1.05rem; font-weight: 700; outline: none; }
.ctable .f.in.ok { background: var(--sage-field); box-shadow: inset 0 -2.5px 0 var(--sage); }
.ctable .f.in.bad { background: var(--clay-field); box-shadow: inset 0 -2.5px 0 var(--clay); }
.ctable .f.in s { color: var(--clay); font-weight: 500; }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 0 -20px; background: var(--hair); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.keys button { min-height: 48px; border: 0; background: var(--bg); color: var(--ink); font-size: 1.2rem; font-weight: 600; }
.keys button:active { background: var(--surface-2); }

/* ---- der · die · das (mockup) ---- */
.artikel-screen { gap: 14px; }
.artikel-word { padding: 18px 0 10px; }
.artikel-word .verb-word { font-size: clamp(3.2rem, 15vw, 4.4rem); }
.artikel-word .sup { display: inline-block; margin-right: 10px; font-stretch: 80%; font-weight: 700; font-size: .42em; vertical-align: top; transform: translateY(.35em); }
.artikel-screen .lanes { margin: auto -20px 0; min-height: clamp(240px, 42vh, 340px); }
.artikel-screen .lane { padding: 16px 14px 30px; }

/* ---- Karteikarte ---- */
.flash-screen { margin: -6px -20px 0; padding: 6px 20px 0; gap: 12px; }
.flash-screen.field-der { background: var(--slate-field); }
.flash-screen.field-die { background: var(--clay-field); }
.flash-screen.field-das { background: var(--sage-field); }
.flash-screen.field-none { background: var(--surface-2); }
.card-art { margin-top: 14px; font-family: var(--font-display); font-stretch: 80%; font-weight: 700; font-size: 1.5rem; line-height: 1; }
.card-word { font-family: var(--font-display); font-stretch: 64%; font-weight: 800; font-size: clamp(3.6rem, 18vw, 5rem); line-height: .88; overflow-wrap: anywhere; hyphens: auto; }
.listen { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; border: 0; background: transparent; color: var(--ink); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.flash-screen .parts { margin-top: auto; padding-top: 12px; border-top: 1.5px solid var(--ink); min-height: 64px; }
.flash-screen .parts .sum { font-family: var(--font-italic); font-style: italic; font-size: 1.2rem; }
.reveal { width: 100%; min-height: 48px; border: 1px dashed color-mix(in srgb, var(--ink) 35%, transparent); background: transparent; color: var(--ink-2); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.split { display: grid; grid-template-columns: 1fr 1fr; margin: 0 -20px; min-height: 86px; }
.split button { display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; padding: 16px 20px 22px; border: 0; font-weight: 700; font-size: 1rem; text-align: left; }
.split .l { background: var(--surface-2); color: var(--ink); }
.split .r { background: var(--act); color: var(--on-accent); }
.split small { font-family: var(--font-mono); font-size: .66rem; font-weight: 500; opacity: .8; }

/* ---- Note ---- */
.results-top { display: flex; justify-content: space-between; align-items: center; }
.results-top .quiz-close { margin-right: -6px; }
.results .note-figure .lab { gap: 6px; }

/* ---- Linie ---- */
.line-screen { gap: 14px; }
.course-head { display: grid; gap: 6px; padding-bottom: 14px; border-bottom: 1.5px solid var(--ink); }
.course-head h1 { margin: 0; }
.course-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--font-mono); font-size: .66rem; color: var(--ink-2); }
.stop { min-height: 48px; padding: 6px 0; }
.stop .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop .t .n { margin-right: 8px; }
.stop .here { position: absolute; left: 36px; top: -6px; margin: 0; z-index: 2; }
.stop.cur { margin-top: 8px; }
.screen:has(> .action-bar), .screen.bleed-bottom { display: flex; flex-direction: column; }
.screen:has(> .action-bar) > *, .screen.bleed-bottom > * { flex-shrink: 0; }
body.results-open .site-header, body.results-open .tabbar { display: none; }
body.results-open main { padding-top: 6px; }
body.results-open .app-shell { padding-bottom: env(safe-area-inset-bottom); }
/* Action bars sit flush on the tab bar (or the screen bottom during sessions) */
.screen:has(> .action-bar) { padding-bottom: 0; }
/* Full-bleed bottoms: the color reaches the screen edge, content clears the iPhone home indicator */
body.session-open .app-shell, body.results-open .app-shell { padding-bottom: 0; }
.artikel-screen .lane { padding-bottom: calc(30px + env(safe-area-inset-bottom, 0px)); }
.split button { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
body.session-open .action-bar, body.results-open .action-bar { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
body.session-open .screen:not(.bleed-bottom):not(:has(> .action-bar)) { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.umlaut-hint { margin: 0; padding: 10px 14px; background: var(--sand-field, color-mix(in srgb, var(--sand) 18%, var(--bg))); box-shadow: inset 3px 0 0 var(--sand); font-size: .9rem; }

/* ================= Native iOS feel ================= */

/* 1 · Never let Safari zoom into a field: every input is at least 16 px */
input, select, textarea, .glossary-chapter-select, .file-input { font-size: max(16px, 1rem); }

/* 3 · No grey tap flash, no text selection or callout on controls */
* { -webkit-tap-highlight-color: transparent; }
button, .tabbar, .site-header, .action-bar, .split, .lanes, .keys, .stop, .course-row, .mode-card, label {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}

/* 10 · Pressed states while the finger is down */
.mode-card:active, .course-row:active, .stop:active, .palette-option:active, .option-button:not(:disabled):active { background: var(--surface-2); }
.mode-card, .course-row, .stop { margin-inline: -20px; padding-inline: 20px; width: calc(100% + 40px); }
.mode-card { padding-right: 54px; }
.mode-card::after { right: 24px; }
.action-bar:active, .split button:active, .primary-button:active { filter: brightness(.9); }
.lane:not(:disabled):active { filter: brightness(.93); }
.tabbar button:active, .quiz-close:active, .text-button:active, .icon-button:active, .listen:active { opacity: .5; }
.keys button:active { background: var(--surface-2); }

/* 8 · 44 pt tap targets (icons keep their visual size) */
.quiz-close { width: 44px; height: 44px; margin-left: -12px; }
.results-top .quiz-close { margin-right: -12px; }
.icon-button.speaker-btn { min-width: 44px; height: 44px; }
.brand { min-height: 44px; }
.text-button { min-height: 44px; display: inline-flex; align-items: center; border-bottom: 0; text-decoration: underline; text-underline-offset: 4px; }

/* 2 · Size the app to the visible area so bars ride on top of the iOS keyboard */
.app-shell { height: var(--vvh, 100dvh); transform: translateY(var(--vvt, 0px)); }
body.keyboard-open .action-bar { padding-bottom: 12px; }

/* 13 · Compact title in the header once the large title scrolls away */
.site-header { display: grid; grid-template-columns: 1fr auto 1fr; padding-bottom: 6px; border-bottom: 1px solid transparent; transition: border-color .2s ease; }
.header-meta { justify-self: start; }
.header-title { order: 2; justify-self: center; max-width: 52vw; font-family: var(--font-display); font-stretch: 80%; font-weight: 700; font-size: .95rem; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: 0; transform: translateY(4px); transition: opacity .2s ease, transform .2s ease; }
.brand { order: 3; justify-self: end; }
body.scrolled .header-title { opacity: 1; transform: none; }
body.scrolled .site-header { border-bottom-color: var(--hair); }

/* 6 · Back links become an iOS-style back bar at the top of the screen */
.screen > .text-button[data-back] {
  order: -1; position: sticky; top: 0; z-index: 4; justify-self: stretch; width: auto; margin: 0 -20px 4px; padding: 0 20px;
  min-height: 44px; background: var(--bg); color: var(--act); font-size: 1rem; font-weight: 600; letter-spacing: 0; text-transform: none; text-decoration: none;
  border-bottom: 1px solid var(--hair);
}
.screen > .text-button[data-back]::first-letter { font-size: 1.15em; }
body.scrolled .site-header { border-bottom-color: transparent; }

/* 7 · Push / pop transitions between screens */
main { animation: none; }
main.push { animation: push-in .34s cubic-bezier(.2, .8, .2, 1) both; }
main.pop { animation: pop-in .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes push-in { from { transform: translateX(30%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes pop-in { from { transform: translateX(-24%); opacity: .5; } to { transform: none; opacity: 1; } }

/* 9 · Hidden iOS switch used for the system haptic tick */
#haptic-tick { position: fixed; left: -200px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* 15 · iOS-style round switches and grouped settings rows */
.switch { width: 51px; height: 31px; }
.switch span { border: 0; border-radius: 31px; background: color-mix(in srgb, var(--ink) 16%, var(--bg)); }
.switch span::after { top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 0 1px rgba(0, 0, 0, .2); }
.switch input:checked + span { background: var(--sage); }
.switch input:checked + span::after { transform: translateX(20px); background: #fff; }
.screen > .panel:has(> .setting-row) { padding: 0 16px; border-top: 0; border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 70%, var(--bg)); }
.setting-row { padding: 12px 0; min-height: 52px; }

/* 12 · Glossary as a list: one row per word, search fixed at the top */
.glossary-controls { position: sticky; top: 0; z-index: 3; margin: 0 -20px; padding: 8px 20px 10px; background: var(--bg); }
.glossary-table, .glossary-table tbody, .glossary-table tr, .glossary-table td { display: block; width: auto; }
.glossary-table colgroup, .glossary-table thead { display: none; }
.glossary-table { border-top: 0; }
.glossary-table tr { position: relative; padding: 11px 44px 11px 0; border-bottom: 1px solid var(--hair); }
.glossary-table td { padding: 0; border: 0; }
.glossary-table td[lang="de"] { font-size: 1rem; font-weight: 600; line-height: 1.35; }
.glossary-table td[lang="en"] { margin-top: 2px; font-size: .95rem; }
.glossary-table .glossary-activity { position: absolute; right: 0; top: 13px; width: auto; }
.gl-art { font-weight: 700; }
@media (max-width: 620px) { .glossary-table td { font-size: inherit; } .glossary-table td[lang="de"] { font-size: 1rem; } }

@media (prefers-reduced-motion: reduce) { main.push, main.pop { animation: none; } }
.screen:has(> .text-button[data-back]) .glossary-controls { top: 44px; }

/* ================= Intro: Wortkaskade ================= */
.intro { position: fixed; inset: 0; z-index: 100; overflow: hidden; background: #202426; color: #f3f3ef; cursor: pointer;
  transition: opacity .38s ease, transform .38s cubic-bezier(.2, .8, .2, 1); -webkit-user-select: none; user-select: none; }
.intro.is-leaving { opacity: 0; transform: scale(1.04); pointer-events: none; }
.intro::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(#202426 0%, rgba(32, 36, 38, 0) 30%, rgba(32, 36, 38, 0) 60%, #202426 100%); }
.intro-stack { position: absolute; left: max(24px, env(safe-area-inset-left)); right: 24px; bottom: 46%; display: grid; gap: .04em;
  font-family: var(--font-display); font-stretch: 64%; font-weight: 800; font-size: clamp(54px, 15.5vw, 96px); line-height: .92;
  text-transform: uppercase; color: rgba(243, 243, 239, .14); white-space: nowrap;
  animation: intro-roll 1.6s cubic-bezier(.7, 0, .15, 1) .1s both; }
.intro-hit { color: #f3f3ef; display: flex; align-items: flex-end; }
.intro-u { height: .99em; width: .6em; margin-bottom: .01em; flex: none; overflow: visible; }
.intro-dot { fill: #c46f5a; transform-box: fill-box; transform-origin: center; animation: intro-dot .42s cubic-bezier(.3, 1.7, .5, 1) 1.5s both; }
.intro-dot.d2 { animation-delay: 1.58s; }
.intro-tag { position: absolute; left: max(24px, env(safe-area-inset-left)); top: 57%; z-index: 2; margin: 0;
  font-family: var(--font-italic); font-style: italic; font-size: 1.2rem; color: #a0a6a0; animation: intro-tag .5s ease 1.65s both; }
@keyframes intro-roll { from { transform: translateY(100%); } to { transform: none; } }
@keyframes intro-dot { from { transform: translateY(-.4em) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes intro-tag { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .intro { display: none; } }

/* ================= Swipe back (iOS-style) ================= */
main#app { touch-action: pan-y; }
.swipe-under { position: fixed; left: 0; right: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--bg); }
.swipe-under-page { position: absolute; inset: 0; overflow: hidden; padding: 0 20px; background: var(--bg); }
.swipe-under-page > .screen { min-height: 100%; }
.swipe-under-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, .1); }
main#app { position: relative; z-index: 1; background: var(--bg); }
