/* Rätsel-App – fürs Handy gebaut. Markenfarben kommen aus farben.php (--brand, --accent, …). */
:root {
  --brand: #1f4e79; --on-brand: #ffffff; --head-light: #1f4e79; --accent: #f0a500; --on-accent: #1a1a1a;
  --bg: color-mix(in srgb, var(--brand) 6%, #ffffff); --surface: #ffffff; --ink: #1c2630; --muted: #55606b;
  --line: color-mix(in srgb, var(--brand) 16%, #ffffff);
  --head: var(--head-light); --accent-hover: color-mix(in srgb, var(--accent) 82%, #ffffff); --bar-sub: color-mix(in srgb, var(--on-brand) 72%, transparent);
  --ok: #1f7a4a; --ok-bg: #e3f4ea; --bad: #a3341f; --bad-bg: #fdecea;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .35);
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: color-mix(in srgb, var(--brand) 18%, #0d1114); --surface: color-mix(in srgb, var(--brand) 14%, #161b20); --ink: #e6ebef; --muted: #a7b2bc;
    --line: color-mix(in srgb, var(--brand) 30%, #2a3138); --head: color-mix(in srgb, var(--brand) 35%, #ffffff);
    --ok: #6fd39a; --ok-bg: #143a28; --bad: #ff9b85; --bad-bg: #3d1d17;
    --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: color-mix(in srgb, var(--brand) 18%, #0d1114); --surface: color-mix(in srgb, var(--brand) 14%, #161b20); --ink: #e6ebef; --muted: #a7b2bc;
  --line: color-mix(in srgb, var(--brand) 30%, #2a3138); --head: color-mix(in srgb, var(--brand) 35%, #ffffff);
  --ok: #6fd39a; --ok-bg: #143a28; --bad: #ff9b85; --bad-bg: #3d1d17;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .8);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--ink);
  font: 400 1.0625rem/1.55 "Barlow", system-ui, sans-serif; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3 { font-family: "Barlow Condensed", "Barlow", sans-serif; font-weight: 700; line-height: 1.08; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 9vw, 3rem); text-transform: uppercase; letter-spacing: .01em; color: var(--head); }
h2 { font-size: 1.75rem; color: var(--head); }
h3 { font-size: 1.15rem; text-transform: uppercase; letter-spacing: .05em; }
h1:focus, h2:focus { outline: none; }
p { margin: 0 0 .9em; }
[hidden] { display: none !important; }

/* Kopfleiste */
.bar { background: var(--brand); color: var(--on-brand); padding-top: env(safe-area-inset-top); position: sticky; top: 0; z-index: 5; }
.bar-in { max-width: 640px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.bar img { border-radius: 8px; background: #fff; }
.bar-title { display: flex; flex-direction: column; line-height: 1; font-family: "Barlow Condensed", "Barlow", sans-serif; text-transform: uppercase; }
.bar-title strong { font-size: 1.35rem; letter-spacing: .03em; }
.bar-title span { font-size: .85rem; letter-spacing: .12em; color: var(--bar-sub); margin-top: 3px; }
.bar-score { margin-left: auto; background: var(--accent); color: var(--on-accent); font-family: "Barlow Condensed", sans-serif; font-weight: 700;
  font-size: 1.05rem; padding: 6px 12px; border-radius: 99px; font-variant-numeric: tabular-nums; white-space: nowrap; }

.main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 16px 24px; display: grid; gap: 16px; align-content: start; }
.loading { color: var(--muted); text-align: center; padding: 48px 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 20px; box-shadow: var(--shadow); }
.hero { border-top: 5px solid var(--accent); }
.kicker { font-family: "Barlow Condensed", sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-size: .95rem; margin-bottom: .4em; }
.lead { font-size: 1.1rem; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }

.facts { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.facts li { background: var(--bg); border-radius: 8px; padding: 10px 6px; text-align: center; font-size: .88rem; color: var(--muted); line-height: 1.25; }
.facts strong { display: block; font-family: "Barlow Condensed", sans-serif; font-size: 1.6rem; color: var(--ink); line-height: 1.1; }

/* Buttons */
.btn { display: flex; width: 100%; align-items: center; justify-content: center; min-height: 52px; padding: 12px 20px; margin-top: 10px;
  font: 600 1.15rem/1 "Barlow Condensed", "Barlow", sans-serif; text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent); color: var(--on-accent); border: 2px solid var(--accent); border-radius: var(--radius); cursor: pointer; transition: background .15s, transform .1s; }
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--head); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--head); }
.link { background: none; border: 0; padding: 6px 0; color: var(--head); font: 600 1rem "Barlow", sans-serif; text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }

/* Frage */
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.q-n { font-family: "Barlow Condensed", sans-serif; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.q-text { font-size: 1.6rem; line-height: 1.15; color: var(--ink); margin-bottom: 18px; }
.opts { display: grid; gap: 10px; margin-bottom: 14px; }
.opt { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; min-height: 60px; padding: 12px 14px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); font: 500 1.05rem/1.35 "Barlow", sans-serif; transition: border-color .15s, background .15s; }
.opt:hover:not(:disabled) { border-color: var(--head); }
.opt-l { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--head);
  font: 700 1.1rem "Barlow Condensed", sans-serif; }
.opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.opt.sel .opt-l { background: var(--accent); color: var(--on-accent); }
.opt:disabled { cursor: default; opacity: .7; }
.opt.right { border-color: var(--ok); background: var(--ok-bg); opacity: 1; }
.opt.right .opt-l { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); opacity: 1; }
.opt.wrong .opt-l { background: var(--bad); color: #fff; }

.verdict { font: 700 1.5rem/1.2 "Barlow Condensed", sans-serif; padding: 12px 14px; border-radius: var(--radius); margin: 4px 0 14px; }
.verdict span { display: block; font: 500 1rem/1.4 "Barlow", sans-serif; margin-top: 4px; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.bad { background: var(--bad-bg); color: var(--bad); }
.verdict:focus { outline: none; }
.info { background: var(--bg); border-radius: var(--radius); padding: 14px 16px 4px; margin-bottom: 8px; }
.info h3 { color: var(--head); }
.actions { display: grid; gap: 0; }

/* Übersicht */
.grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 4px; }
.tile { position: relative; aspect-ratio: 1; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  font: 700 1.4rem "Barlow Condensed", sans-serif; display: grid; place-items: center; padding: 0; }
.tile:hover { border-color: var(--head); }
.tile-s { position: absolute; top: 3px; right: 6px; font-size: .95rem; }
.tile.ok { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.tile.bad { background: var(--bad-bg); border-color: var(--bad); color: var(--bad); }
.progress { display: flex; height: 12px; border-radius: 99px; background: var(--bg); overflow: hidden; margin: 10px 0 14px; border: 1px solid var(--line); }
.p-ok { background: var(--ok); }
.p-bad { background: var(--bad); }
.done h1 { font-variant-numeric: tabular-nums; }

.hint { background: transparent; box-shadow: none; border-style: dashed; }
.hint h3 { color: var(--head); }
.hint p { color: var(--muted); }

.foot { max-width: 640px; width: 100%; margin: 0 auto; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; color: var(--muted); }
.foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Auswahl der Runde */
.pick { font-size: 1.4rem; margin: 18px 0 10px; color: var(--ink); }
.choices { display: grid; gap: 10px; margin-bottom: 14px; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px; cursor: pointer;
  background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: var(--radius); font: inherit; transition: border-color .15s, transform .1s; }
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:active:not(:disabled) { transform: scale(.98); }
.choice:disabled { opacity: .5; cursor: not-allowed; }
.choice-i { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.7rem; background: var(--bg); }
.choice.kinder .choice-i { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.choice-t { display: flex; flex-direction: column; line-height: 1.3; }
.choice-t strong { font: 700 1.35rem/1.1 "Barlow Condensed", sans-serif; text-transform: uppercase; letter-spacing: .02em; color: var(--head); }
.choice-t span { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.choice-t em { font-style: normal; font-weight: 600; font-size: .9rem; margin-top: 4px; }

.modebar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.chip { font-weight: 600; font-size: .9rem; padding: 4px 12px; border-radius: 99px; background: var(--bg); color: var(--ink); }

/* Mehrfachauswahl: eckige Buchstaben als Hinweis aufs Ankreuzen */
.multi-hint { display: inline-block; font-weight: 600; font-size: .95rem; color: var(--on-accent); background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  padding: 4px 10px; border-radius: 6px; margin: -8px 0 14px; }
.opt.multi .opt-l { border-radius: 8px; }

/* Belohnung bei allen Fragen richtig */
.reward { display: flex; gap: 14px; align-items: flex-start; margin-top: 8px; padding: 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 2px solid var(--accent); }
.reward-i { font-size: 2.2rem; line-height: 1; }
.reward strong { display: block; font: 700 1.35rem/1.15 "Barlow Condensed", sans-serif; color: var(--ink); margin-bottom: 4px; }
.reward p { margin: 0 0 6px; }
.reward-stamp { font-size: .88rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 8px !important; }
.foot-links { display: flex; gap: 14px; }

/* Handy: alles etwa 12 % größer (alle Schriftgrößen hängen an rem), dafür etwas weniger Rand */
@media (max-width: 600px) {
  html { font-size: 112.5%; }
  .main { padding: 12px 10px 20px; gap: 12px; }
  .card { padding: 20px 16px; }
  .opt { min-height: 64px; padding: 12px; gap: 12px; }
  .opt-l { width: 38px; height: 38px; }
  .bar-in { padding: 10px 12px; }
}

/* Noch einmal spielen / neuer Fragenstand */
.again { margin-top: 14px; padding-top: 4px; border-top: 1px solid var(--line); }
.again .btn { margin-top: 12px; }
.again .small { margin: 8px 0 0; text-align: center; }
.fresh-note { margin: 12px 0 0; font-weight: 600; }
.fresh { border: 2px solid var(--accent); }
.fresh .btn { margin-top: 4px; }

/* Liste der Rätsel */
.list { display: grid; gap: 10px; margin-top: 8px; }
.list-item { display: block; text-decoration: none; color: var(--ink); padding: 16px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.list-item:hover { border-color: var(--accent); }
.list-item strong { display: block; font: 700 1.35rem/1.15 "Barlow Condensed", sans-serif; text-transform: uppercase; color: var(--head); }
.list-item span { display: block; color: var(--muted); font-size: .95rem; margin-top: 3px; }
a.btn { text-decoration: none; }

/* Kontrollpunkte */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.kp-list { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 6px; }
.kp-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); }
.kp-list li.ok { background: var(--ok-bg); border-color: var(--ok); }
.kp-i { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px dashed var(--line); display: grid; place-items: center; font-weight: 700; color: var(--ok); }
.kp-list li.ok .kp-i { border: 2px solid var(--ok); }
.kp-missing { margin-top: 8px; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); border: 1px solid var(--accent); }
.kp-missing p { margin: 4px 0 0; }
.scan-box { position: relative; margin: 8px 0 4px; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 1; max-height: 60vh; }
.scan-video { display: block; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .25); pointer-events: none; }
.scan-status { margin: 8px 0; padding: 8px 10px; border-radius: var(--radius); }
.scan-status.bad { background: var(--bad-bg); color: var(--bad); }
.code-form { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.code-form label { display: block; font-weight: 600; margin-bottom: 6px; }
.code-row { display: flex; gap: 8px; align-items: stretch; }
.code-in { flex: 1; width: 0; min-width: 0; min-height: 52px; padding: 10px 12px; font: 600 1.3rem "Barlow", sans-serif; letter-spacing: .15em; text-transform: uppercase; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.code-row .btn { width: auto; margin-top: 0; }
.found h1 { color: var(--ok); }

/* Sprachauswahl im Kopf: sichtbar nur das Kürzel, die Auswahlliste liegt unsichtbar darüber */
.lang { position: relative; margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 4px 10px;
  border: 1px solid color-mix(in srgb, var(--on-brand) 40%, transparent); border-radius: 99px;
  font: 700 1rem "Barlow Condensed", sans-serif; letter-spacing: .06em; color: var(--on-brand); }
.bar-score:not([hidden]) + .lang { margin-left: 0; }
.lang select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.lang:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.bar-title { min-width: 0; }
.bar-title strong, .bar-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 480px) {
  .bar-in { gap: 8px; }
  .bar-score { font-size: .95rem; padding: 5px 9px; }
  .lang { padding: 4px 8px; }
  .lang-i { display: none; }
}

/* Fragen, die erst ein Kontrollpunkt freischaltet */
.tile.lock { background: var(--bg); border-style: dashed; color: var(--muted); }
.tile.lock .tile-s { top: 2px; right: 3px; font-size: .7rem; line-height: 1; }
.gate { border: 2px solid var(--accent); }
.gate .btn { margin-top: 4px; }
.unlocked { font-weight: 600; color: var(--ok); }

/* Bilder zu Frage und Erläuterung */
.q-img, .info-img { display: block; width: 100%; height: auto; max-height: 60vh; object-fit: contain; border-radius: var(--radius); margin: 4px 0 14px; background: var(--bg); }
.info-img { margin: 4px 0 10px; }

/* Prüfcode der Belohnung */
.reward-code { margin: 10px 0 6px; padding: 10px 12px; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface); text-align: center; }
.reward-code span { display: block; font-size: .9rem; color: var(--muted); }
.reward .reward-code strong { font-size: 2.1rem; letter-spacing: .14em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.reward-code small { display: block; color: var(--muted); }

/* Vorlesen */
.q-tools { display: inline-flex; align-items: center; gap: 14px; }
.speak { white-space: nowrap; }
