/* Quickfire – Kategorie-Standard der Lern-Apps, sauber gemacht.
   Maßstab: Duolingo, Brilliant, Quizlet. Eine Aufgabe pro Bildschirm, große Bedienflächen. */

@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-latin-wght.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
  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: "Nunito";
  src: url("../fonts/nunito-latin-ext-wght.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --font: "Nunito", ui-rounded, system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --bg: #ffffff;
  --surface: #f2f4f7;
  --surface-2: #e6eaf0;
  --line: #dde2e9;
  --edge: #c9d0da;
  --text: #1b2232;
  --muted: #586274;

  --go: #168a41;
  --go-edge: #0f6a31;
  --go-tint: #e2f5e8;
  --go-text: #0e5c2a;
  --bad: #d9363e;
  --bad-edge: #a8262d;
  --bad-tint: #fdeaea;
  --bad-text: #9b1f26;
  --streak: #e67700;
  --xp: #2563d9;
  --gold: #b7791f;
  --on-color: #ffffff;

  --t-blue: #2563d9;   --t-blue-tint: #e7effd;
  --t-violet: #7048d6; --t-violet-tint: #efeafc;
  --t-amber: #c46a00;  --t-amber-tint: #fdf1e1;
  --t-teal: #0d8478;   --t-teal-tint: #e0f4f1;
  --t-pink: #c92a72;   --t-pink-tint: #fbe8f1;
  --t-green: #2b8a3e;  --t-green-tint: #e5f4e8;

  --tier-1: #a0613a; --tier-2: #6b7685; --tier-3: #b7791f; --tier-4: #1c8fb8;

  --t-red: #d0342c;    --t-red-tint: #fdeceb;
  --t-cyan: #0b7fa8;   --t-cyan-tint: #e2f3f9;
  --t-indigo: #4a50c9; --t-indigo-tint: #ebecfb;
  --t-orange: #c75a12; --t-orange-tint: #fdeee3;
  --t-brown: #8a5a2b;  --t-brown-tint: #f5ede4;
  --t-olive: #5b7a12;  --t-olive-tint: #eef4e0;

  --sea: #e3eef8;
  --land: #c9d3df;
  --land-edge: #ffffff;

  --code-bg: #f4f6fa;
  --code-text: #1b2232;
  --code-key: #7a2fb8;
  --code-type: #0b6e8a;
  --code-str: #1d7a34;
  --code-num: #b14a00;
  --code-com: #6b7485;

  --r-s: 12px;
  --r-m: 16px;
  --r-l: 22px;
  --depth: 4px;
  --shadow-sheet: 0 -6px 24px rgb(16 24 40 / 0.10);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --page-w: 560px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #11161f;
    --surface: #1a212d;
    --surface-2: #232c3a;
    --line: #2a3443;
    --edge: #0b0f15;
    --text: #e8ecf2;
    --muted: #9ba5b5;

    --go: #23a455;
    --go-edge: #157538;
    --go-tint: #14301f;
    --go-text: #7fe0a2;
    --bad: #e5484d;
    --bad-edge: #a82a30;
    --bad-tint: #3a1a1d;
    --bad-text: #ff9da1;
    --streak: #ff922b;
    --xp: #5b8def;
    --gold: #e0a43a;

    --t-blue: #5b8def;   --t-blue-tint: #1a2740;
    --t-violet: #9a7af0; --t-violet-tint: #241d3d;
    --t-amber: #f0a030;  --t-amber-tint: #33260f;
    --t-teal: #2fb8a8;   --t-teal-tint: #102d2a;
    --t-pink: #ec5f9c;   --t-pink-tint: #36172a;
    --t-green: #4cc160;  --t-green-tint: #15301b;

    --tier-1: #d08a5c; --tier-2: #a9b3c2; --tier-3: #e0a43a; --tier-4: #4fc3ea;

    --t-red: #f0605a;    --t-red-tint: #3a1a1a;
    --t-cyan: #3cb8e0;   --t-cyan-tint: #0f2a35;
    --t-indigo: #8a8ff5; --t-indigo-tint: #1e2040;
    --t-orange: #f08a3c; --t-orange-tint: #352010;
    --t-brown: #c8975f;  --t-brown-tint: #2e2216;
    --t-olive: #a3c55a;  --t-olive-tint: #222c12;

    --sea: #0e1724;
    --land: #3a4558;
    --land-edge: #11161f;

    --code-bg: #0b0f16;
    --code-text: #e3e8f0;
    --code-key: #c792ea;
    --code-type: #6cc6e8;
    --code-str: #9ad97e;
    --code-num: #f5a35c;
    --code-com: #7d889a;
    --shadow-sheet: 0 -6px 24px rgb(0 0 0 / 0.45);
  }
}

/* ---------- Basis ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
body[data-view="feed"] { overflow: hidden; overscroll-behavior: none; }
h1, h2, p, dl, dd, ul { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--xp) 28%, transparent); }
:focus-visible { outline: 3px solid var(--xp); outline-offset: 2px; transition: none; }
.ic { width: 1.25em; height: 1.25em; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
kbd { font-family: var(--font); }
noscript { display: block; padding: 24px; }

/* ---------- Knöpfe: runde Fläche mit dickerer Unterkante als Tiefe ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border: 2px solid var(--line);
  border-bottom-width: calc(2px + var(--depth));
  border-radius: var(--r-m);
  background: var(--bg);
  color: var(--text);
  font-weight: 800;
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: transform 90ms var(--ease-out), border-bottom-width 90ms var(--ease-out), background-color 120ms;
}
.btn:hover { background: var(--surface); }
.btn:active { transform: translateY(var(--depth)); border-bottom-width: 2px; }
.btn:disabled { cursor: default; }
.btn-go { background: var(--go); border-color: var(--go-edge); color: var(--on-color); }
.btn-go:hover { background: color-mix(in srgb, var(--go) 90%, white); }
.btn-bad { background: var(--bad); border-color: var(--bad-edge); color: var(--on-color); }
.btn-bad:hover { background: color-mix(in srgb, var(--bad) 90%, white); }
.btn-plain { background: var(--bg); }
.btn-big { width: 100%; min-height: 58px; font-size: 18px; }
.btn-danger-plain { border-color: var(--line); color: var(--bad-text); background: var(--bg); }

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--r-s);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn .ic { width: 26px; height: 26px; }

/* ---------- Seiten (Start, Erfolge) ---------- */

.page { min-height: 100dvh; display: flex; flex-direction: column; }
.page-body {
  flex: 1;
  width: 100%;
  max-width: var(--page-w);
  margin: 0 auto;
  padding: 8px 16px 112px;
  display: grid;
  gap: 32px;
  align-content: start;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 18px;
  max-width: var(--page-w);
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px;
  background: var(--bg);
}
.wordmark { font-weight: 900; font-size: 22px; letter-spacing: -0.02em; margin-right: auto; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; }
.stat .ic { width: 24px; height: 24px; }
.stat.streak { color: var(--streak); }
.stat.streak.is-off { color: var(--muted); }
.stat.xp { color: var(--xp); }

.today { display: grid; gap: 12px; padding-top: 8px; }
.today h1 { font-size: 26px; line-height: 1.2; font-weight: 900; letter-spacing: -0.015em; text-wrap: balance; }
.today-bar { height: 16px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.today-fill, .goal-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--go);
  transform-origin: left;
  transition: transform 260ms var(--ease-out);
}
.today-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.today .btn-plain .ic { color: var(--xp); }

.section-head { display: grid; gap: 2px; margin-bottom: 12px; }
.section-head h2, .settings h2 { font-size: 21px; font-weight: 900; letter-spacing: -0.01em; }
.section-head p { color: var(--muted); font-size: 15px; }
h1#stats-h { font-size: 28px; font-weight: 900; letter-spacing: -0.015em; margin-bottom: 14px; }

.tile {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--r-s);
  background: var(--tc-tint, var(--surface));
  color: var(--tc, var(--text));
  flex: none;
}
.tile .ic { width: 26px; height: 26px; }

.topic-list { display: grid; gap: 10px; }
.topic {
  display: flex;
  align-items: center;
  border: 2px solid var(--line);
  border-bottom-width: calc(2px + var(--depth));
  border-radius: var(--r-l);
  background: var(--bg);
}
.topic-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 6px 12px 12px;
  text-decoration: none;
  border-radius: var(--r-l) 0 0 var(--r-l);
}
.topic-main:hover { background: var(--surface); }
.topic-text { display: grid; min-width: 0; }
.topic-name { font-weight: 800; font-size: 18px; }
.topic-sub { color: var(--muted); font-size: 14px; line-height: 1.3; }
.topic-side { margin-left: auto; display: grid; justify-items: end; gap: 2px; }
.topic-best { color: var(--muted); font-size: 14px; font-weight: 700; }
.topic-toggle { padding: 0 14px 0 6px; }

.tier { font-size: 13px; font-weight: 800; color: var(--tier-1); }
.tier-0 { color: var(--muted); }
.tier-2 { color: var(--tier-2); }
.tier-3 { color: var(--tier-3); }
.tier-4 { color: var(--tier-4); }

/* Schalter */
.switch { position: relative; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  width: 48px;
  height: 30px;
  border-radius: 99px;
  background: var(--surface-2);
  flex: none;
  transition: background-color 140ms;
}
.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 1px 3px rgb(16 24 40 / 0.25);
  transition: transform 160ms var(--ease-out);
}
.switch input:checked + .switch-track { background: var(--go); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--xp); outline-offset: 2px; }

/* Tab-Leiste */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 2px solid var(--line);
}
.tab {
  flex: 1;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0;
  border-radius: var(--r-s);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}
.tab .ic { width: 26px; height: 26px; }
.tab:hover { background: var(--surface); }
.tab.is-active { color: var(--xp); background: color-mix(in srgb, var(--xp) 10%, transparent); }

/* Erfolge */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stats div { padding: 14px 16px; border: 2px solid var(--line); border-radius: var(--r-m); }
.stats dt { color: var(--muted); font-size: 14px; font-weight: 700; }
.stats dd { font-size: 24px; font-weight: 900; }

.badges { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.badge {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  color: var(--muted);
}
.badge-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
}
.badge-name { font-weight: 800; font-size: 15px; color: var(--text); }
.badge-desc { font-size: 13px; line-height: 1.3; }
.badge:not(.is-earned) .badge-name { color: var(--muted); }
.badge.is-earned { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.badge.is-earned .badge-icon { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }

.mastery { display: grid; gap: 10px; }
.mastery li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 14px;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
}
.m-name { font-weight: 800; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.m-cells { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font-weight: 800; }
.m-cells small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }

.ranking .rank-tabs { margin-bottom: 12px; width: 100%; }
.ranking .rank-tabs button { flex: 1; font-size: 14px; }
.ranking .rank-tabs button[aria-selected="true"] { background: var(--xp); color: var(--on-color); }
.ranking-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.ranking-list li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px 0 8px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  font-weight: 800;
}
.ranking-list li.is-me { border-color: var(--xp); background: color-mix(in srgb, var(--xp) 10%, var(--bg)); }
.ranking-list .rank { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--surface); font-size: 15px; }
.ranking-list li:nth-child(1) .rank { background: color-mix(in srgb, var(--gold) 25%, var(--bg)); color: var(--gold); }
.ranking-list .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking-list .val { color: var(--muted); font-size: 15px; }
.ranking-list .ranking-empty { display: block; padding: 14px; color: var(--muted); font-weight: 700; }
.login-links { display: grid; gap: 10px; }

.page-toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 20;
  max-width: min(92vw, 480px);
  padding: 12px 18px;
  border-radius: var(--r-m);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  transform: translateX(-50%);
  box-shadow: 0 6px 20px rgb(16 24 40 / 0.25);
  animation: toast-in 200ms var(--ease-out);
  transition: opacity 300ms;
}
.page-toast.is-bad { background: var(--bad); color: var(--on-color); }
.page-toast.is-out { opacity: 0; }

.settings { display: grid; gap: 14px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 700; }
.segmented { display: flex; border: 2px solid var(--line); border-radius: var(--r-s); overflow: hidden; }
.segmented button {
  min-width: 44px;
  min-height: 40px;
  border: 0;
  border-right: 2px solid var(--line);
  background: var(--bg);
  font-weight: 800;
  cursor: pointer;
}
.segmented button:last-child { border-right: 0; }
.segmented button[aria-checked="true"] { background: var(--xp); color: var(--on-color); }
.settings .reset { justify-self: start; }

/* Sprint-Auswahl */
.sheet-dialog {
  width: min(520px, 100%);
  max-height: 88dvh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: var(--r-l) var(--r-l) 0 0;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sheet);
}
@media (min-width: 640px) { .sheet-dialog { margin: auto; border-radius: var(--r-l); } }
.sheet-dialog::backdrop { background: rgb(10 14 20 / 0.45); }
.sheet-dialog form { display: grid; gap: 14px; padding: 22px 16px calc(18px + env(safe-area-inset-bottom)); }
.sheet-dialog h2 { font-size: 22px; font-weight: 900; }
.sheet-dialog p { color: var(--muted); }
.sprint-options { display: grid; gap: 8px; }
.sprint-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 8px 8px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  background: var(--bg);
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.sprint-opt:hover { background: var(--surface); }
.sprint-opt .tile { width: 40px; height: 40px; }
.sprint-opt .best { margin-left: auto; color: var(--muted); font-size: 14px; }

/* ---------- Feed ---------- */

.feed {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  max-width: var(--page-w);
  margin: 0 auto;
  background: var(--bg);
}
.feed-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 12px 6px 8px;
}
.goal { flex: 1; height: 16px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.goal.is-low .goal-fill { background: var(--bad); }
.is-sprint .goal-fill { background: var(--xp); transition: none; }
.bar-stat { display: flex; align-items: center; gap: 12px; font-weight: 900; font-size: 18px; min-width: 56px; justify-content: flex-end; }
.combo { display: inline-flex; align-items: center; gap: 4px; color: var(--streak); }
.combo.is-zero { color: var(--muted); }
.combo small { font-size: 14px; font-weight: 900; color: var(--streak); }
.combo .ic { width: 24px; height: 24px; }
.combo.bump { animation: bump 220ms var(--ease-out); }
@keyframes bump { 40% { transform: scale(1.25); } }
.sprint-time { min-width: 2ch; text-align: right; color: var(--text); }
.sprint-score { display: inline-flex; align-items: center; gap: 4px; color: var(--go); }

.stage { position: relative; flex: 1; overflow: hidden; touch-action: none; }

.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg);
  transform: translateY(100%);
  transition: transform 280ms var(--ease-out);
  user-select: none;
  -webkit-user-select: none;
}
.card.is-current { transform: none; }
.card.is-nudged { animation: nudge 320ms var(--ease-out); }
@keyframes nudge { 30% { transform: translateY(-18px); } 60% { transform: translateY(4px); } }

.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 34px; }
.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px 4px 8px;
  border-radius: 99px;
  background: var(--tc-tint);
  color: var(--tc);
  font-weight: 800;
  font-size: 15px;
}
.topic-chip .ic { width: 20px; height: 20px; }
.meta-text { color: var(--muted); font-size: 14px; font-weight: 700; }
.retry-tag { font-size: 13px; font-weight: 800; color: var(--bad-text); background: var(--bad-tint); padding: 2px 10px; border-radius: 99px; }

.card-q { margin-top: 18px; font-size: 20px; font-weight: 800; color: var(--muted); }
.card-prompt {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 16px;
}
.ptext { font-weight: 900; letter-spacing: -0.02em; line-height: 1.05; text-align: center; overflow-wrap: anywhere; min-width: 0; }
.ptext.size-xl { font-size: clamp(88px, 26vw, 128px); }
.ptext.size-l { font-size: clamp(48px, 14vw, 76px); }
.ptext.size-m { font-size: clamp(30px, 8.5vw, 46px); text-wrap: balance; }
.ptext.size-s { font-size: clamp(22px, 6.2vw, 30px); line-height: 1.25; text-wrap: balance; letter-spacing: -0.01em; }
.choices.layout-code .choice { justify-content: flex-start; text-align: left; min-height: 56px; padding: 10px 14px 10px 40px; }
.choices.layout-code .opt-code { font-size: 15px; }
.choices.layout-compare .opt-label { font-size: clamp(17px, 4.8vw, 22px); line-height: 1.25; text-wrap: balance; }
.sheet-solution.is-code { font: 700 18px/1.4 var(--mono); white-space: pre-wrap; }
.ptext.mono { font-family: var(--mono); font-weight: 700; letter-spacing: 0; }
.psub { font-size: 26px; font-weight: 800; color: var(--muted); }

.clock { width: min(68vw, 34dvh, 280px); height: auto; }
.clock .face { fill: var(--bg); stroke: var(--text); stroke-width: 4; }
.clock .tick-b { stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
.clock .tick-s { stroke: var(--muted); stroke-width: 1.6; stroke-linecap: round; }
.clock .num { fill: var(--text); font: 800 19px var(--font); text-anchor: middle; dominant-baseline: central; }
.clock .hand-h { stroke: var(--text); stroke-width: 8; stroke-linecap: round; }
.clock .hand-m { stroke: var(--tc); stroke-width: 5; stroke-linecap: round; }
.clock .pin { fill: var(--tc); }

.swatch {
  width: min(56vw, 30dvh, 240px);
  aspect-ratio: 1;
  border-radius: var(--r-l);
  background: var(--sw);
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / 0.08);
}

.morse { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 26px; }
.mgroup { display: inline-flex; align-items: center; gap: 10px; }
.morse i { display: block; height: 18px; border-radius: 9px; background: var(--text); }
.morse .dot { width: 18px; }
.morse .dash { width: 54px; }
.morse.small { gap: 6px 12px; }
.morse.small .mgroup { gap: 6px; }
.morse.small i { height: 10px; border-radius: 5px; background: currentColor; }
.morse.small .dot { width: 10px; }
.morse.small .dash { width: 28px; }

/* Flaggen, Code, Vergleich */
.flag { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; box-shadow: 0 0 0 1.5px var(--line); }
.flag-big { width: min(72vw, 36dvh * 4 / 3, 320px); border-radius: var(--r-s); }
.choice.has-flag { padding: 10px; min-height: 0; }
.choices.layout-flags { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.code {
  align-self: stretch;
  margin: 0;
  padding: 14px 16px;
  max-height: 100%;
  overflow: auto;
  border-radius: var(--r-m);
  background: var(--code-bg);
  color: var(--code-text);
  font: 500 clamp(13px, 3.6vw, 15.5px) / 1.5 var(--mono);
  tab-size: 2;
  white-space: pre;
  user-select: text;
}
.tk-k { color: var(--code-key); font-weight: 700; }
.tk-t { color: var(--code-type); }
.tk-s { color: var(--code-str); }
.tk-n { color: var(--code-num); }
.tk-c { color: var(--code-com); font-style: italic; }
.opt-code { font: 600 16px/1.35 var(--mono); white-space: pre-wrap; text-align: left; }
.card.has-code .card-prompt { justify-content: flex-start; padding-top: 4px; }
.card.has-code .card-q { margin-top: 10px; }

.versus { display: grid; gap: 4px; text-align: center; font-weight: 900; font-size: clamp(28px, 8vw, 40px); line-height: 1.15; }
.versus em { font-style: normal; font-size: 18px; font-weight: 800; color: var(--muted); }

.opt-label { display: block; }
.opt-sub, .opt-reveal { display: block; font-size: 14px; font-weight: 700; color: var(--muted); }
.opt-reveal { display: none; }
.is-done .opt-reveal { display: block; }
.choice.is-right .opt-reveal, .choice.is-wrong .opt-reveal { color: inherit; }
.choices.layout-compare .choice { min-height: 96px; flex-direction: column; gap: 2px; font-size: 24px; }

.order-hint { font-size: 15px; font-weight: 700; color: var(--muted); text-align: center; }
.choices.layout-order .choice { justify-content: flex-start; text-align: left; gap: 12px; min-height: 58px; font-size: 17px; padding: 8px 14px; }
.choices.layout-order .opt-label { flex: 1; }
.choices.layout-order .opt-reveal { margin-left: auto; font-size: 15px; }
.order-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--line);
  font-size: 15px;
  font-weight: 900;
}
.order-item.is-picked { border-color: var(--xp); }
.order-item.is-picked .order-badge { background: var(--xp); border-color: var(--xp); color: var(--on-color); }
.order-item.is-right .order-badge { background: var(--go); border-color: var(--go); color: var(--on-color); }
.order-item.is-wrong .order-badge { background: var(--bad); border-color: var(--bad); color: var(--on-color); }

/* Umrisse und Karten */
.shape { display: block; width: 100%; height: 100%; }
.shape path { fill: var(--tc); stroke: var(--tc); stroke-width: 1px; stroke-linejoin: round; }
.shape-big { width: min(78vw, 340px); height: min(34dvh, 280px); }
.shape-opt { height: 84px; }
.choice.is-right .shape path { fill: var(--go); stroke: var(--go); }
.choice.is-wrong .shape path { fill: var(--bad); stroke: var(--bad); }

.map { display: block; width: 100%; height: 100%; border-radius: var(--r-m); }
.map .sea { fill: var(--sea); }
.map .land { fill: var(--land); stroke: var(--land-edge); stroke-width: 0.6px; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map .marker { fill: var(--land); stroke: var(--land-edge); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.map .is-target { fill: var(--tc); stroke: var(--bg); stroke-width: 1px; }
.map .ring { fill: none; stroke: var(--tc); stroke-width: 2.5px; vector-effect: non-scaling-stroke; }
.map .is-right { fill: var(--go); }
.map .is-wrong { fill: var(--bad); }
.map.is-interactive [data-c] { cursor: pointer; }
@media (hover: hover) { .map.is-interactive [data-c]:hover { fill: color-mix(in srgb, var(--tc) 45%, var(--land)); } }
.card.has-map-prompt .card-prompt { padding: 4px 0 12px; }
.card.has-map-prompt .card-prompt .map { max-height: 46dvh; }
.card.has-map .card-prompt { flex: none; padding: 6px 0 10px; }
.card.has-map .card-answer { flex: 1; min-height: 0; }
.map-wrap { height: 100%; min-height: 0; }
/* Bei Karten oben einblenden, damit die Lösung auf der Karte sichtbar bleibt */
.card.has-map .sheet { top: 0; bottom: auto; border-radius: 0 0 var(--r-l) var(--r-l); padding-top: 14px; padding-bottom: 14px; animation-name: sheet-in-top; }
@keyframes sheet-in-top { from { transform: translateY(-100%); } }
.card.has-map .sheet-note { display: none; }

.at-map .border { fill: none; stroke: var(--text); stroke-width: 1.4px; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; opacity: 0.55; }
.at-map .land { stroke-width: 0.8px; }

/* Verkehrszeichen */
.sign { display: block; object-fit: contain; }
.sign-big { width: min(56vw, 32dvh, 240px); height: min(56vw, 32dvh, 240px); }
.sign-opt { width: 100%; height: 84px; }

/* Österreichisches Kennzeichen: weiß, rote Streifen oben und unten */
.plate {
  display: grid;
  grid-template-columns: auto auto auto;
  grid-template-rows: 9px auto 9px;
  align-items: center;
  column-gap: 14px;
  padding: 0 22px;
  border: 3px solid #1a1a1a;
  border-radius: 10px;
  background: #ffffff;
  color: #111111;
  font: 900 clamp(44px, 13vw, 64px) / 1.15 var(--font);
  letter-spacing: 0.02em;
  box-shadow: 0 2px 0 rgb(0 0 0 / 0.25);
}
.plate-band { grid-column: 1 / -1; height: 9px; margin: 0 -22px; background: #c8102e; }
.plate-band:first-child { border-radius: 6px 6px 0 0; }
.plate-band:last-child { border-radius: 0 0 6px 6px; }
.plate-sep { width: 22px; height: 30px; border-radius: 3px 3px 11px 11px; background: linear-gradient(#c8102e 0 33%, #ffffff 33% 66%, #c8102e 66%); box-shadow: 0 0 0 1px #999; }

/* Texteingabe */
.text-entry { display: grid; gap: 10px; }
.text-input {
  width: 100%;
  min-height: 64px;
  padding: 0 16px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  color: var(--text);
  font: 800 26px var(--font);
  text-align: center;
}
.text-input::placeholder { color: var(--muted); opacity: 0.6; }
.text-input:focus-visible { outline: 3px solid var(--xp); outline-offset: 2px; }
.text-input.is-right { border-color: var(--go); background: var(--go-tint); color: var(--go-text); }
.text-input.is-wrong { border-color: var(--bad); background: var(--bad-tint); color: var(--bad-text); }

/* Antwortbereich */
.card-answer { display: grid; gap: 10px; }

.choices { display: grid; gap: 10px; }
.choices.layout-grid, .choices.layout-swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices.layout-week { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.choice {
  position: relative;
  min-height: 60px;
  padding: 0 14px;
  font-size: 20px;
  border-radius: var(--r-m);
}
.choices.layout-grid .choice { min-height: 72px; font-size: 24px; }
.choices.layout-week .choice { min-height: 72px; padding: 0; font-size: 18px; }
.choices.layout-swatches .choice { min-height: 96px; padding: 10px; }
.choice kbd {
  position: absolute;
  left: 10px;
  top: 50%;
  translate: 0 -50%;
  display: none;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  min-width: 22px;
  height: 22px;
  place-items: center;
}
@media (hover: hover) and (pointer: fine) { .choice kbd { display: grid; } }
.choices.layout-week kbd { display: none; }
.choice.is-right { background: var(--go-tint); border-color: var(--go); color: var(--go-text); }
.choice.is-wrong { background: var(--bad-tint); border-color: var(--bad); color: var(--bad-text); }
.choice:disabled:not(.is-right):not(.is-wrong) { opacity: 0.55; }
.chip-swatch { display: block; width: 100%; height: 100%; min-height: 70px; border-radius: 10px; background: var(--sw); }
.sheet-solution { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.sheet-solution .morse { justify-content: flex-start; color: var(--text); }
.sheet-flag { width: 44px; order: -1; }
.sheet .chip-swatch { display: inline-block; width: 30px; height: 30px; min-height: 0; vertical-align: -7px; margin-right: 10px; border-radius: 8px; }

.entry {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  min-height: 72px;
  padding: 8px 16px;
  border: 2px solid var(--line);
  border-radius: var(--r-m);
  background: var(--surface);
  font-size: 40px;
  font-weight: 900;
}
.entry.is-empty .entry-val::before { content: attr(data-placeholder); color: var(--muted); opacity: 0.6; }
.entry.is-empty .entry-val:empty::before { content: "?"; }
.entry.is-time.is-empty .entry-val:empty::before { content: "h:mm"; }
.entry-unit { font-size: 22px; color: var(--muted); }
.entry.is-right { border-color: var(--go); background: var(--go-tint); color: var(--go-text); }
.entry.is-wrong { border-color: var(--bad); background: var(--bad-tint); color: var(--bad-text); }

.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.key {
  min-height: clamp(50px, 7.2dvh, 64px);
  border: 2px solid var(--line);
  border-bottom-width: calc(2px + var(--depth));
  border-radius: var(--r-s);
  background: var(--bg);
  font-size: 26px;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 70ms var(--ease-out), border-bottom-width 70ms var(--ease-out);
}
.key .ic { width: 28px; height: 28px; }
.key-ghost { color: var(--muted); }
.key.is-down, .key:active { transform: translateY(var(--depth)); border-bottom-width: 2px; background: var(--surface); }
.submit { width: 100%; }

/* Rückmeldung */
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: var(--r-l) var(--r-l) 0 0;
  box-shadow: var(--shadow-sheet);
  animation: sheet-in 200ms var(--ease-out);
}
.sheet[hidden] { display: none; }
@keyframes sheet-in { from { transform: translateY(100%); } }
.sheet.is-right { background: var(--go-tint); color: var(--go-text); }
.sheet.is-wrong { background: var(--bad-tint); color: var(--bad-text); }
.sheet-head { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 900; }
.sheet-icon { width: 34px; height: 34px; padding: 5px; border-radius: 50%; background: currentColor; }
.sheet.is-right .sheet-icon { stroke: var(--go-tint); background: var(--go); }
.sheet.is-wrong .sheet-icon { stroke: var(--bad-tint); background: var(--bad); }
.sheet-time { margin-left: auto; font-size: 22px; }
.sheet-line { display: flex; flex-wrap: wrap; gap: 8px 16px; font-weight: 800; font-size: 17px; }
.sheet-line span { display: inline-flex; align-items: center; gap: 4px; }
.sheet-line .ic { width: 20px; height: 20px; }
.sheet-solution { font-size: 28px; font-weight: 900; color: var(--text); }
.sheet-explain { font-size: 16px; font-weight: 700; color: var(--text); white-space: pre-line; }
.sheet-note { font-size: 15px; font-weight: 700; }
.sheet-level { display: flex; align-items: center; gap: 6px; font-weight: 800; color: var(--xp); }
.sheet-level.is-down { color: var(--muted); }
.sheet .btn { width: 100%; margin-top: 4px; }
.sheet.is-compact { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }

.card.flash-right .card-prompt { animation: flash-right 160ms; }
@keyframes flash-right { 50% { transform: scale(1.04); color: var(--go); } }

/* Toasts */
.toasts {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top)) + 54px);
  left: 16px;
  right: 16px;
  z-index: 4;
  display: grid;
  justify-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 16px;
  border-radius: var(--r-m);
  background: var(--text);
  color: var(--bg);
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 6px 20px rgb(16 24 40 / 0.25);
  animation: toast-in 200ms var(--ease-out);
  transition: opacity 250ms, transform 250ms var(--ease-out);
}
.toast .ic { color: var(--gold); width: 22px; height: 22px; }
.toast.locked .ic { color: var(--bg); }
.toast.is-out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }

/* Sprint-Ergebnis */
.sprint-result {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 16px;
  text-align: center;
}
.result-icon { width: 56px; height: 56px; color: var(--xp); margin-bottom: 8px; }
.result-label { color: var(--muted); font-weight: 800; }
.result-score { font-size: 112px; font-weight: 900; line-height: 1; letter-spacing: -0.03em; }
.result-sub { font-size: 18px; font-weight: 700; }
.result-best { margin-top: 8px; color: var(--gold); font-weight: 800; }
.result-actions { display: grid; gap: 10px; width: 100%; max-width: 360px; margin-top: 28px; }

/* Breitere Bildschirme: Feed bleibt eine Handy-Spalte, mittig */
@media (min-width: 700px) {
  .feed { border-left: 2px solid var(--line); border-right: 2px solid var(--line); }
  .badges { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
