/* Token-Set aus Claritydesk/Kompass übernommen. Farben, Schrift und Maße nur aus diesen Tokens. */
:root {
  --bg: #F6F7F9; --surface: #FFFFFF; --ink: #1A1D21; --muted: #5F6B76;
  --line: #DEE2E6; --line-soft: #EEF1F4;
  --accent: #1F4E79; --accent-soft: #E8F0F8; --on-accent: #FFFFFF;
  --ok: #1E6F45; --warn: #8A5A00; --danger: #A8201A; --track: #ECEFF2;

  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --text-xl: 22px; --text-md: 14px; --text-sm: 13px; --text-xs: 12px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px;
  --radius: 3px; --radius-sm: 2px; --sidebar: 240px; --control: 32px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121417; --surface: #1A1D21; --ink: #E8EAED; --muted: #9AA3AD;
    --line: #2C3137; --line-soft: #23282E;
    --accent: #7FB3E6; --accent-soft: #1E2D3C; --on-accent: #121417;
    --ok: #6CC28F; --warn: #E2B04A; --danger: #E07A72; --track: #262B31;
  }
}
:root[data-theme="dark"] {
  --bg: #121417; --surface: #1A1D21; --ink: #E8EAED; --muted: #9AA3AD;
  --line: #2C3137; --line-soft: #23282E;
  --accent: #7FB3E6; --accent-soft: #1E2D3C; --on-accent: #121417;
  --ok: #6CC28F; --warn: #E2B04A; --danger: #E07A72; --track: #262B31;
}
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 var(--text-md)/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
h1 { margin: 0; font-size: var(--text-xl); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h2 { margin: 0 0 var(--space-3); font-size: var(--text-md); font-weight: 600; }
h3 { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-md); font-weight: 600; }
p { margin: 0 0 var(--space-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted, .meta { color: var(--muted); }
.meta { font-size: var(--text-sm); }
.small { font-size: var(--text-sm); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--text-xs); }
.right { text-align: right; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.warn { color: var(--warn); }
.ok { color: var(--ok); }
.bad { color: var(--danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprung:focus { position: static; width: auto; height: auto; clip: auto; }

/* Gerüst: Kopfzeile mit Navigation, schmale Mitte */
.kopf { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; padding: calc(var(--space-3) + env(safe-area-inset-top)) var(--space-4) var(--space-3); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; letter-spacing: -0.01em; color: var(--ink); }
.nav { list-style: none; margin: 0; padding: 0; display: flex; gap: 2px; flex-wrap: wrap; }
.nav a { display: block; padding: 6px var(--space-3); border-radius: var(--radius); color: var(--ink); }
.nav a:hover { background: var(--line-soft); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.main { width: 100%; max-width: 760px; margin: 0 auto; padding: var(--space-5) var(--space-4) var(--space-6); display: flex; flex-direction: column; gap: var(--space-5); flex: 1; }
.fuss { display: flex; justify-content: center; gap: var(--space-2); padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom)); }
.page-head { border-bottom: 1px solid var(--line); padding-bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }

/* Flächen und Tabellen */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px var(--space-5); overflow-x: auto; }
table { border-collapse: collapse; width: 100%; margin-bottom: var(--space-3); }
th { text-align: left; font-size: var(--text-xs); font-weight: 500; color: var(--muted); padding: 0 var(--space-2) var(--space-2) 0; border-bottom: 1px solid var(--line); }
td { padding: 9px var(--space-2) 9px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.notice { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-3) var(--space-4); background: var(--surface); }
.notice-ok { color: var(--ok); border-color: var(--ok); }
.notice-fehler { color: var(--danger); border-color: var(--danger); }
ul.plain { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }

/* Bedienelemente */
.btn { font: 500 var(--text-md)/1 var(--font); height: var(--control); padding: 0 var(--space-4); border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); text-decoration: none; }
.btn:hover { border-color: var(--ink); text-decoration: none; }
.btn:disabled { opacity: .4; cursor: default; border-color: var(--line); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); border-color: transparent; background: var(--line-soft); }
.btn-small { height: 26px; padding: 0 var(--space-2); font-size: var(--text-sm); }
.field { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--text-xs); color: var(--muted); }
.field input, .field select { font: 400 var(--text-md)/1 var(--font); height: var(--control); padding: 0 var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.field input:focus-visible { border-color: var(--accent); }
.field.inline { flex-direction: row; align-items: center; gap: var(--space-2); }
input[type="text"], input[type="number"], input[type="time"], input[type="password"] { font: 400 var(--text-md)/1 var(--font); height: var(--control); padding: 0 var(--space-2); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); max-width: 100%; }
.check { display: inline-flex; align-items: center; gap: var(--space-2); cursor: pointer; font-size: var(--text-sm); color: var(--muted); }
.row { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); max-width: 360px; }
.inline-form { display: inline; margin: 0; }
.status { min-height: 1.5em; color: var(--muted); font-size: var(--text-sm); margin: var(--space-3) 0 0; }
.status-bad { color: var(--danger); }
.kbd, kbd { font: 400 var(--text-xs)/1 var(--font-mono); color: inherit; opacity: .7; border: 1px solid currentColor; border-radius: var(--radius-sm); padding: 1px 4px; }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: var(--radius-sm); background: var(--track); overflow: hidden; vertical-align: middle; }
progress::-webkit-progress-bar { background: var(--track); border-radius: var(--radius-sm); }
progress::-webkit-progress-value { background: var(--accent); border-radius: var(--radius-sm); }
progress::-moz-progress-bar { background: var(--accent); border-radius: var(--radius-sm); }

/* Anmeldung, Einrichtung, Fehler */
body.bare { display: grid; place-items: center; padding: var(--space-4); }
.bare-box { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-6); }
.bare-box h1 { margin-bottom: var(--space-2); }

/* Üben */
.modi { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; }
.modi button { flex: 1; border: 0; background: transparent; color: var(--ink); padding: 10px 6px; border-radius: var(--radius-sm); font: 500 var(--text-sm)/1.2 var(--font); cursor: pointer; }
.modi button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.modi .zahl-klein { display: block; font-weight: 400; opacity: .8; font-size: var(--text-xs); }
.lernkarte { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: var(--space-6) var(--space-5); min-height: 300px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.lernkarte:hover { border-color: var(--accent); }
.lernkarte .zahl { font-size: clamp(72px, 22vw, 112px); font-weight: 700; letter-spacing: .04em; line-height: 1; font-variant-numeric: tabular-nums; }
.lernkarte .hinweis { color: var(--muted); margin-top: var(--space-4); font-size: var(--text-sm); }
.lernkarte .antwort { margin-top: var(--space-4); }
.lernkarte .wort { font-size: 32px; font-weight: 600; color: var(--accent); overflow-wrap: anywhere; }
.lernkarte .merkhilfe { margin-top: var(--space-1); color: var(--muted); font-style: italic; }
.laute { margin-top: var(--space-2); color: var(--muted); font-size: var(--text-sm); }
.laute b { color: var(--ink); }
.marke { position: absolute; top: var(--space-3); left: var(--space-3); font-size: var(--text-xs); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); }
.marke-wieder { background: var(--track); color: var(--warn); }
.bewerten { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.bewerten .btn { height: 52px; font-size: 16px; border-radius: 10px; }
.btn-gewusst { color: var(--ok); border-color: var(--ok); }
.btn-gewusst:hover { border-color: var(--ok); background: var(--line-soft); }
.btn-nicht { color: var(--danger); border-color: var(--danger); }
.btn-nicht:hover { border-color: var(--danger); background: var(--line-soft); }
.zeile-stat { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-1) var(--space-4); color: var(--muted); font-size: var(--text-sm); }
.zeile-stat b { color: var(--ink); font-variant-numeric: tabular-nums; }
.optionen { display: flex; gap: var(--space-2) var(--space-4); flex-wrap: wrap; }
.fertig { text-align: center; }
.fertig .gross { font-size: 40px; line-height: 1; margin-bottom: var(--space-3); }
.sync { font-size: var(--text-sm); color: var(--warn); }

/* Wörter */
.woerter td { padding-top: 5px; padding-bottom: 5px; }
.woerter td.nr { width: 3em; font: 600 var(--text-md)/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.woerter input[type="text"] { width: 100%; min-width: 8em; }
.woerter .laut { color: var(--muted); font-size: var(--text-sm); white-space: nowrap; }
.stufe { display: inline-block; font-size: var(--text-xs); padding: 1px 6px; border-radius: var(--radius-sm); background: var(--track); color: var(--muted); white-space: nowrap; }
.stufe-lernen { color: var(--warn); }
.stufe-festigen { color: var(--accent); background: var(--accent-soft); }
.stufe-sicher { color: var(--ok); }
.speichern-leiste { position: sticky; bottom: 0; background: var(--bg); padding: var(--space-3) 0; border-top: 1px solid var(--line); display: flex; gap: var(--space-3); align-items: center; }

/* Fortschritt */
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--space-3); }
.kachel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-4); }
.kachel .wert { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kachel .text { color: var(--muted); font-size: var(--text-sm); }
.balken { display: grid; grid-template-columns: 7.5em 1fr 5.5em; gap: var(--space-2) var(--space-3); align-items: center; font-size: var(--text-sm); }
.balken .zahl { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

@media (max-width: 560px) {
  .kopf { gap: var(--space-2); }
  .nav a { padding: 6px var(--space-2); }
  .panel { padding: var(--space-4); }
  .lernkarte { min-height: 260px; padding: var(--space-5) var(--space-3); }
  .woerter .laut-spalte { display: none; }
  .woerter .hilfe-spalte input { min-width: 6em; }
  .balken { grid-template-columns: 6em 1fr 4.5em; }
}

@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-group(root) { animation-duration: 0.12s; }
}
.stack-voll { display: flex; flex-direction: column; gap: var(--space-5); }
