/* CISA Mastery — Oberflächen-Design
   Mobile-first. Alle Farben als Tokens, damit Hell/Dunkel/System identisch
   funktionieren. Touch-Ziele mindestens 44px. */

/* ================================================================ Tokens */

:root {
  /* Kontraste gegen --bg geprueft; alle Textfarben ueber 6:1, also deutlich
     ueber der WCAG-AA-Schwelle von 4.5:1. Vorher lag --text-muted bei 3.5:1
     und war auf dem Handy im Hellen kaum lesbar. */
  --bg:            #fafaf9;
  --bg-card:       #ffffff;
  --bg-surface:    #f0efec;
  --bg-hover:      #e7e5e1;
  --bg-sunken:     #e4e1dd;

  --text:          #0d0b0a;   /* ~19:1 */
  --text-2:        #3a352f;   /* ~10:1 */
  --text-muted:    #5c554e;   /* ~6.6:1 */

  --border:        #d8d4ce;
  --border-strong: #b5afa7;

  --accent:        #1d4ed8;
  --accent-soft:   #e8eeff;
  --accent-text:   #1a3fae;   /* ~7:1 */
  --on-accent:     #ffffff;   /* Schrift auf --accent-Flaechen */

  --ok:            #126631;
  --ok-soft:       #e6f7ec;
  --warn:          #7d4a05;
  --warn-soft:     #fdf4de;
  --bad:           #a51818;
  --bad-soft:      #fdeded;

  --radius:     12px;
  --radius-lg:  18px;
  --radius-sm:  8px;

  --shadow:     0 1px 2px rgba(24,20,16,.05), 0 2px 8px rgba(24,20,16,.04);
  --shadow-up:  0 -2px 12px rgba(24,20,16,.07);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-scale: 1;

  --nav-h: 58px;
  --act-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Dunkel: über System-Einstellung … */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #121211;
    --bg-card:       #1c1c1b;
    --bg-surface:    #272726;
    --bg-hover:      #333332;
    --bg-sunken:     #0c0c0b;

    --text:          #faf8f6;   /* ~17:1 */
    --text-2:        #d2ccc5;   /* ~11:1 */
    --text-muted:    #aaa39b;   /* ~7:1 */

    --border:        #3d3d3a;
    --border-strong: #5a5a55;

    --accent:        #7ba3ff;
    --accent-soft:   #1b2947;
    --accent-text:   #b3c9ff;
    --on-accent:     #10182c;   /* dunkel, weil --accent im Dunkelmodus hell ist */

    --ok:            #7ff0ad;
    --ok-soft:       #133523;
    --warn:          #fdcb74;
    --warn-soft:     #382a0d;
    --bad:           #ffa8a8;
    --bad-soft:      #3f1919;

    --shadow:    0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.25);
    --shadow-up: 0 -2px 12px rgba(0,0,0,.35);
  }
}

/* … und über die manuelle Auswahl, die in beide Richtungen gewinnen muss. */
:root[data-theme="dark"] {
  --bg:            #121211;
  --bg-card:       #1c1c1b;
  --bg-surface:    #272726;
  --bg-hover:      #333332;
  --bg-sunken:     #0c0c0b;

  --text:          #faf8f6;   /* ~17:1 */
  --text-2:        #d2ccc5;   /* ~11:1 */
  --text-muted:    #aaa39b;   /* ~7:1 */

  --border:        #3d3d3a;
  --border-strong: #5a5a55;

  --accent:        #7ba3ff;
  --accent-soft:   #1b2947;
  --accent-text:   #b3c9ff;
  --on-accent:     #10182c;   /* dunkel, weil --accent im Dunkelmodus hell ist */

  --ok:            #7ff0ad;
  --ok-soft:       #133523;
  --warn:          #fdcb74;
  --warn-soft:     #382a0d;
  --bad:           #ffa8a8;
  --bad-soft:      #3f1919;

  --shadow:    0 1px 2px rgba(0,0,0,.3), 0 2px 8px rgba(0,0,0,.25);
  --shadow-up: 0 -2px 12px rgba(0,0,0,.35);
}

/* ================================================================= Basis */

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

html {
  font-size: calc(16px * var(--font-scale));
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input { font: inherit; color: inherit; }
button { touch-action: manipulation; }
button { cursor: pointer; background: none; border: none; text-align: left; }
button:disabled { cursor: default; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================ Layout */

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 24px);
}

/* Kopfzeile bleibt stehen: Fortschritt und Timer müssen immer sichtbar sein. */
.apphead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.headtext { flex: 1; min-width: 0; }
.h-title {
  font-size: 1.0rem; font-weight: 650; letter-spacing: -.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.h-sub { font-size: .78rem; color: var(--text-muted); }
.dim { color: var(--text-muted); font-weight: 400; }
.logo { font-size: 1.4rem; line-height: 1; }

.iconbtn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border-radius: 10px; font-size: 1.15rem; color: var(--text-2);
  transition: background .15s;
}
.iconbtn:active { background: var(--bg-hover); }
@media (hover: hover) { .iconbtn:hover { background: var(--bg-hover); } }
.iconbtn.flag-on { color: var(--warn); }

/* Synchronisationsanzeige — klein, aber sichtbar, weil der Fortschritt
   jetzt auf dem Server liegt und ein stiller Ausfall teuer wäre. */
.syncdot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-muted); }
.syncdot.ok   { background: var(--ok); }
.syncdot.busy { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.syncdot.bad  { background: var(--bad); }
@keyframes pulse { 50% { opacity: .3 } }

/* ---------------------------------------------------------- Tab-Leiste */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex;
  background: color-mix(in srgb, var(--bg-card) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-b);
  box-shadow: var(--shadow-up);
}
.tabbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
  height: var(--nav-h); color: var(--text-muted);
  transition: color .15s;
}
.tabbtn.active { color: var(--accent); }
.tabicon { font-size: 1.15rem; line-height: 1; }
.tablabel { font-size: .68rem; font-weight: 600; letter-spacing: .01em; }

/* Aktionsleiste unten — der Weiter-Button ist immer erreichbar, ohne zu scrollen. */
.stickyact {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  margin: 20px -16px 0;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.stickyact .btn-primary { margin-left: auto; }
.stickyact .btn-wide { margin-left: 0; }

/* ============================================================ Bausteine */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card.list { padding: 6px; }

.sec {
  font-size: .76rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  margin: 26px 2px 10px;
}
.sec-dom {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  text-transform: none; font-size: .9rem; letter-spacing: 0;
  color: var(--text); border-left: 3px solid; padding-left: 10px;
}
.sec-badge { font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; }

/* -------------------------------------------------------------- Listen */

.row {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 13px 12px; min-height: 56px;
  border-radius: var(--radius);
  transition: background .12s;
}
.row:active { background: var(--bg-hover); }
@media (hover: hover) { .row:hover { background: var(--bg-hover); } }
.row.static { cursor: default; }
.row.static:hover { background: none; }
.row + .row { border-top: 1px solid var(--border); border-radius: 0; }

.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-title { font-size: .93rem; font-weight: 600; line-height: 1.35; }
.row-title.small { font-size: .85rem; font-weight: 500; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-sub { font-size: .78rem; color: var(--text-muted); }
.row-arrow { color: var(--text-muted); font-size: 1.3rem; flex: none; }

.row-num, .row-chip {
  display: flex; align-items: center; justify-content: center;
  min-width: 42px; height: 34px; padding: 0 8px; flex: none;
  border-radius: 9px; font-size: .78rem; font-weight: 700;
  background: var(--bg-surface); color: var(--text-2);
}
.row-num.done { background: var(--ok-soft); color: var(--ok); }
.row-num.bad  { background: var(--bad-soft); color: var(--bad); }
.chip-ok   { background: var(--ok-soft)   !important; color: var(--ok)   !important; }
.chip-warn { background: var(--warn-soft) !important; color: var(--warn) !important; }
.chip-bad  { background: var(--bad-soft)  !important; color: var(--bad)  !important; }

.badge {
  font-size: .72rem; font-weight: 700; padding: 4px 9px;
  border-radius: 20px; flex: none; white-space: nowrap;
}
.badge-ok    { background: var(--ok-soft);   color: var(--ok); }
.badge-warn  { background: var(--warn-soft); color: var(--warn); }
.badge-bad   { background: var(--bad-soft);  color: var(--bad); }
.badge-muted { background: var(--bg-surface); color: var(--text-muted); }

/* ------------------------------------------------------ Fortschritt */

.pbar {
  height: 6px; border-radius: 4px; background: var(--bg-sunken);
  overflow: hidden; margin-top: 6px;
}
.pfill { height: 100%; border-radius: 4px; transition: width .35s ease; }

/* ------------------------------------------------------------- Hero */

.hero { padding: 20px; }
.hero-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.hero-right { text-align: right; }
.hero-num { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.hero-den { font-size: 1.1rem; font-weight: 500; color: var(--text-muted); }
.hero-lbl { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }
.hero-meta { font-size: .78rem; color: var(--text-muted); margin-top: 10px; }

/* ---------------------------------------------------- Handlungskarten */

.cta-grid { display: grid; gap: 10px; margin-bottom: 4px; }
.cta {
  display: flex; flex-direction: column; gap: 3px;
  padding: 15px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.cta:active { border-color: var(--border-strong); transform: scale(.99); }
@media (hover: hover) { .cta:hover { border-color: var(--border-strong); transform: translateY(-1px); } }
.cta-k { font-size: .72rem; font-weight: 700; text-transform: uppercase;
         letter-spacing: .05em; color: var(--text-muted); }
.cta-v { font-size: .95rem; font-weight: 600; }
.cta-primary { background: var(--accent-soft); border-color: transparent; }
.cta-primary .cta-k { color: var(--accent-text); }
.cta-warn { background: var(--warn-soft); border-color: transparent; }
.cta-warn .cta-k { color: var(--warn); }

.modes { display: grid; gap: 10px; }
.mode {
  display: flex; flex-direction: column; gap: 3px;
  padding: 15px 16px; border-radius: var(--radius);
  background: var(--bg-card); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.mode:hover:not(.disabled) { border-color: var(--accent); }
.mode.disabled { opacity: .45; box-shadow: none; }
.mode-title { font-size: .95rem; font-weight: 650; }
.mode-sub { font-size: .8rem; color: var(--text-muted); }

/* ---------------------------------------------------------- Schalter */

.segmented {
  display: flex; gap: 3px; padding: 3px; margin-bottom: 16px;
  background: var(--bg-surface); border-radius: 11px;
}
.segmented.small { margin: 0; }
.seg {
  flex: 1; text-align: center; padding: 9px 10px; min-height: 40px;
  border-radius: 8px; font-size: .84rem; font-weight: 600;
  color: var(--text-2); transition: background .15s, color .15s;
}
.seg.active { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 18px; min-height: 46px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-card); font-size: .9rem; font-weight: 600;
  transition: background .15s, border-color .15s;
}
.btn:active:not(:disabled) { transform: scale(.985); }
@media (hover: hover) { .btn:hover:not(:disabled) { background: var(--bg-hover); } }
.btn:disabled { opacity: .4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-text); color: var(--on-accent); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.btn-quiet { border-color: transparent; background: none; color: var(--text-muted); font-weight: 500; }
.btn-wide { width: 100%; }

/* ============================================================== Fragen */

.qbar {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: .8rem; color: var(--text-muted); font-weight: 600; margin-bottom: 4px;
}
.qscore { color: var(--text-2); }
.qsrc { font-size: .74rem; color: var(--text-muted); margin: 14px 0 0; font-weight: 600; }

.qtext {
  overflow-wrap: break-word;
  font-size: 1.05rem; font-weight: 550; line-height: 1.5;
  margin: 16px 0 18px; letter-spacing: -.01em;
}

.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  padding: 14px; min-height: 52px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: var(--radius); line-height: 1.45; font-size: .92rem;
  transition: border-color .12s, background .12s;
}
.opt:active:not(.locked) { border-color: var(--accent); background: var(--accent-soft); }
@media (hover: hover) {
  .opt:hover:not(.locked) { border-color: var(--accent); background: var(--accent-soft); }
}
.opt-mark {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  background: var(--bg-surface); color: var(--text-2);
  font-size: .78rem; font-weight: 700;
}
.opt-text { flex: 1; padding-top: 1px; overflow-wrap: break-word; min-width: 0; }
.opt.chosen { border-color: var(--accent); background: var(--accent-soft); }
.opt.chosen .opt-mark { background: var(--accent); color: var(--on-accent); }
.opt.locked { cursor: default; }
.opt.correct { border-color: var(--ok); background: var(--ok-soft); }
.opt.correct .opt-mark { background: var(--ok); color: var(--bg-card); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .opt-mark { background: var(--bad); color: var(--bg-card); }

.exp {
  margin-top: 16px; padding: 15px;
  border-radius: var(--radius); border-left: 3px solid;
  font-size: .89rem; line-height: 1.6;
}
.exp-ok  { background: var(--ok-soft);  border-color: var(--ok); }
.exp-bad { background: var(--bad-soft); border-color: var(--bad); }
.exp-tag { font-weight: 700; font-size: .8rem; margin-bottom: 6px; }
.exp-ok .exp-tag  { color: var(--ok); }
.exp-bad .exp-tag { color: var(--bad); }

/* ------------------------------------------------------------ Ergebnis */

.result { text-align: center; padding: 28px 20px; }
.result-score { font-size: 2.6rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.exam-den { font-size: 1.3rem; color: var(--text-muted); font-weight: 500; }
.result-pct { font-size: 1.1rem; font-weight: 650; color: var(--accent); margin-top: 4px; }
.result-msg { font-size: .89rem; color: var(--text-2); margin: 12px 0 18px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.result-actions .btn { flex: 1 1 auto; min-width: 130px; }

.examcard { display: flex; align-items: center; gap: 16px; width: 100%; }
.exam-score { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }

/* ============================================================= Prüfung */

.examhead .timer {
  font-variant-numeric: tabular-nums; font-size: .95rem; font-weight: 700;
  padding: 7px 11px; border-radius: 9px;
  background: var(--bg-surface); color: var(--text-2); flex: none;
}
.examhead .timer.low { background: var(--bad-soft); color: var(--bad); }

.navgrid { display: flex; flex-wrap: wrap; gap: 7px; }
.nq {
  width: 40px; height: 40px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: .76rem; font-weight: 650;
  background: var(--bg-surface); color: var(--text-2);
  border: 1.5px solid transparent;
}
.nq.done { background: var(--accent-soft); color: var(--accent-text); }
.nq.flag { background: var(--warn-soft); color: var(--warn); }
.nq.cur  { border-color: var(--accent); }
.navlegend {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  width: 100%; margin: 10px 0; font-size: .74rem; color: var(--text-muted);
}
.navlegend .nq { width: 16px; height: 16px; }

.wtable { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .85rem; }
.wtable th, .wtable td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.wtable th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }

.resume { border-color: var(--warn); background: var(--warn-soft); }

/* ============================================================ Lerntext */

.readmeta { font-size: .78rem; color: var(--text-muted); margin-bottom: 10px; }

.learn {
  font-size: 1rem; line-height: 1.72;
  overflow-wrap: break-word;      /* lange Fachbegriffe sprengen sonst die Zeile */
  hyphens: auto;
}
.learn h2 {
  font-size: 1.12rem; font-weight: 680; letter-spacing: -.015em;
  margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.learn h2:first-child { margin-top: 0; }
.learn h3 { font-size: 1rem; font-weight: 650; margin: 22px 0 8px; }
.learn p { margin-bottom: 14px; }
.learn ul, .learn ol { margin: 0 0 14px 20px; }
.learn li { margin-bottom: 7px; }
.learn strong { font-weight: 650; color: var(--text); }
.learn em { color: var(--text-2); }

/* Der Lerntext bringt 87 Tabellen mit — auf dem Handy müssen sie für sich
   scrollen, nicht die ganze Seite breit machen. Der Wrapper kommt aus ui.js. */
.tablewrap { overflow-x: auto; margin: 0 0 16px; -webkit-overflow-scrolling: touch; }
.learn table { border-collapse: collapse; width: 100%; min-width: 420px; font-size: .86rem; }
.learn th, .learn td {
  padding: 9px 11px; text-align: left; vertical-align: top;
  border: 1px solid var(--border);
}
.learn th { background: var(--bg-surface); font-weight: 650; font-size: .8rem; }

.learn .callout, .callout {
  background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: 14px 15px; border-radius: var(--radius-sm);
  margin: 16px 0; font-size: .9rem; line-height: 1.6;
}
.learn .warn, .warn {
  background: var(--warn-soft); border-left: 3px solid var(--warn);
  padding: 14px 15px; border-radius: var(--radius-sm);
  margin: 16px 0; font-size: .9rem; line-height: 1.6;
}

/* --------------------------------------------------------- Fallstudie */

.tag {
  display: inline-block; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--accent-text);
  background: var(--accent-soft); padding: 4px 9px; border-radius: 6px; margin-bottom: 12px;
}
.cp-scenario {
  background: var(--bg-surface); border-radius: var(--radius);
  padding: 15px; font-size: .93rem; line-height: 1.65; margin-bottom: 14px;
}
.cp-q { font-size: .96rem; font-weight: 600; line-height: 1.55; }
.reveal { display: flex; flex-direction: column; gap: 12px; }
.rev-pt { display: flex; gap: 12px; font-size: .9rem; line-height: 1.6; }
.rev-num {
  display: flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-text);
  font-size: .76rem; font-weight: 700;
}

/* ============================================================ Sonstiges */

.searchbox { margin-bottom: 6px; }
.searchbox input {
  width: 100%; padding: 12px 15px; min-height: 48px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;   /* NICHT kleiner: iOS zoomt sonst beim Fokus hinein */
}
.searchbox input::placeholder { color: var(--text-muted); }

.setting {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 10px 0; font-size: .92rem; font-weight: 550;
}
.setting + .setting { border-top: 1px solid var(--border); }
.setting .segmented { flex: 0 1 260px; }

.kv { display: flex; flex-direction: column; }
.kv > div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 9px 0; font-size: .89rem;
}
.kv > div + div { border-top: 1px solid var(--border); }
.kv dt { color: var(--text-2); }
.kv dd { font-weight: 650; font-variant-numeric: tabular-nums; }

.lead { font-size: .95rem; line-height: 1.65; margin-bottom: 6px; }
.hint { font-size: .82rem; color: var(--text-muted); line-height: 1.55; margin: 10px 0; }
.hint-inline { margin: 0 0 0 auto; }
.center { text-align: center; margin-top: 14px; }
.empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted); font-size: .9rem;
}
.notice {
  background: var(--bg-surface); border-radius: var(--radius);
  padding: 14px 15px; font-size: .84rem; line-height: 1.6;
  color: var(--text-2); margin-bottom: 16px;
}
.disclaimer {
  font-size: .78rem; color: var(--text-muted); line-height: 1.6;
  margin: 26px 2px 0; padding-top: 16px; border-top: 1px solid var(--border);
}

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + var(--safe-b) + 16px); z-index: 60;
  max-width: min(90vw, 420px);
  padding: 12px 18px; border-radius: 24px;
  background: var(--text); color: var(--bg);
  font-size: .86rem; font-weight: 550; text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  animation: rise .25s ease;
}
.toast-warn { background: var(--warn); color: #1a1817; }
.toast-bad  { background: var(--bad);  color: var(--bg-card); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ============================================================== Desktop */

@media (min-width: 800px) {
  :root { --nav-h: 64px; }
  .wrap { padding: 28px 24px calc(var(--nav-h) + 40px); }
  .apphead { padding: 16px 24px; }
  .h-title { font-size: 1.1rem; }
  .cta-grid, .modes { grid-template-columns: 1fr 1fr; }
  .hero-num { font-size: 2.3rem; }
  .tabbar {
    max-width: 760px; margin: 0 auto 16px; border-radius: var(--radius-lg);
    border: 1px solid var(--border); left: 16px; right: 16px;
  }
  .stickyact { border-radius: var(--radius) var(--radius) 0 0; }
}

@media (min-width: 1100px) {
  .wrap { max-width: 860px; }
  .tabbar { max-width: 860px; }
}

@media print {
  .tabbar, .stickyact, .apphead, .toast { display: none !important; }
  .card { box-shadow: none; border-color: #ccc; }
}

/* ============================================================== Anmelden */

.loginwrap {
  min-height: 100vh; min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.logincard {
  width: 100%; max-width: 380px; margin: 0;
  padding: 32px 28px; text-align: center;
}
.loginlogo { font-size: 2.6rem; line-height: 1; margin-bottom: 12px; }
.logintitle { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
.loginsub { font-size: .84rem; color: var(--text-muted); margin-bottom: 26px; }

.loginlabel {
  display: block; text-align: left; font-size: .78rem; font-weight: 650;
  color: var(--text-2); margin-bottom: 6px;
}
.logininput {
  width: 100%; padding: 13px 15px; min-height: 48px; margin-bottom: 16px;
  background: var(--bg-surface); color: var(--text);
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 16px;   /* NICHT kleiner: iOS zoomt sonst beim Fokus hinein */
}
.logininput:focus { border-color: var(--accent); outline: none; }

.loginerror {
  margin-top: 14px; padding: 10px 12px;
  background: var(--bad-soft); color: var(--bad);
  border-radius: var(--radius-sm); font-size: .85rem; font-weight: 550;
}


/* ========================================================== Ladeanzeige */

.booting {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; min-height: 70vh; min-height: 70dvh;
  color: var(--text-muted); font-size: .9rem;
}
.booting-dot {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .booting-dot { animation: none; border-top-color: var(--border-strong); }
}

img.loginlogo { display: block; margin: 0 auto 12px; border-radius: 14px; }

/* ==================================================== Uebungsstrecke */

.runstat {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  margin: 14px 0 4px; padding: 10px 14px;
  background: var(--bg-surface); border-radius: var(--radius);
  font-size: .84rem; color: var(--text-2);
}
.hint-lead { margin: 0 2px 12px; }
