:root {
  --bg: #f4f5f7;
  --karte: #ffffff;
  --text: #1c2230;
  --leise: #6b7385;
  --linie: #e1e4ea;
  --akzent: #0b5fff;
  --akzent-hell: #e8efff;
  --gruen: #12a150;
  --gruen-hell: #e3f6ea;
  --rot: #d33a2c;
  --rot-hell: #fbe9e7;
  --gelb-hell: #fff6dc;
  --radius: 14px;
  --schatten: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151c; --karte: #1b1f29; --text: #e8eaf0; --leise: #9aa2b4; --linie: #2c3240;
    --akzent: #5b8cff; --akzent-hell: #1f2a45; --gruen: #3ccf7c; --gruen-hell: #173323;
    --rot: #ff6b5e; --rot-hell: #3a1d1b; --gelb-hell: #3a321a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45; font-size: 16px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--akzent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
.leise { color: var(--leise); }
.klein { font-size: .875rem; }
.versteckt { display: none !important; }

.karte {
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: var(--schatten); padding: 20px;
}

button, .knopf {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--linie);
  background: var(--karte); color: var(--text); padding: 10px 16px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none; justify-content: center;
}
button:hover, .knopf:hover { border-color: var(--leise); }
button.primaer, .knopf.primaer { background: var(--akzent); color: #fff; border-color: var(--akzent); }
button.primaer:hover { filter: brightness(1.08); }
button.gefahr { color: var(--rot); }
button.klein, .knopf.klein { padding: 6px 10px; font-size: .875rem; border-radius: 8px; }
button:disabled { opacity: .5; cursor: default; }

input[type=text], input[type=password], input[type=number], textarea, select {
  font: inherit; width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--karte); color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }
label { font-weight: 600; display: block; margin-bottom: 6px; }
.feld { margin-bottom: 16px; }
.zeile { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.wachse { flex: 1; }
.fehler { color: var(--rot); margin-top: 8px; }

/* ── Teilnehmer ─────────────────────────────── */
.quiz-seite { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; min-height: 100vh; display: flex; flex-direction: column; }
.quiz-kopf { margin-bottom: 20px; }
.quiz-kopf h1 { font-size: 1.5rem; }
.fortschritt { height: 6px; background: var(--linie); border-radius: 3px; overflow: hidden; margin: 12px 0 20px; }
.fortschritt > div { height: 100%; background: var(--akzent); transition: width .25s; }
.frage-nr { color: var(--leise); font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
.frage-text { font-size: 1.25rem; font-weight: 700; margin-bottom: 18px; white-space: pre-wrap; }
.optionen { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 2px solid var(--linie);
  border-radius: 12px; cursor: pointer; font-weight: 500; background: var(--karte); text-align: left; width: 100%;
  justify-content: flex-start; touch-action: manipulation;
}
.navi button { touch-action: manipulation; }
.option .buchstabe {
  flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--bg);
  display: grid; place-items: center; font-weight: 700; font-size: .9rem;
}
.option.gewaehlt { border-color: var(--akzent); background: var(--akzent-hell); }
.option.gewaehlt .buchstabe { background: var(--akzent); color: #fff; }
.navi { display: flex; gap: 10px; margin-top: 22px; }
.navi button { flex: 1; padding: 14px; }
.mitte { text-align: center; }
.gross-emoji { font-size: 3rem; margin-bottom: 8px; }
.ergebnis-zahl { font-size: 2.5rem; font-weight: 800; color: var(--akzent); }

/* ── Admin ──────────────────────────────────── */
.admin-kopf {
  background: var(--karte); border-bottom: 1px solid var(--linie); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 5;
}
.admin-kopf .marke { font-weight: 800; font-size: 1.1rem; }
.admin-inhalt { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.raster { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.quiz-kachel { cursor: pointer; transition: border-color .15s; }
.quiz-kachel:hover { border-color: var(--akzent); }
.marke-chip {
  display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--bg); color: var(--leise);
}
.marke-chip.an { background: var(--gruen-hell); color: var(--gruen); }
.reiter { display: flex; gap: 4px; border-bottom: 1px solid var(--linie); margin: 16px 0 18px; overflow-x: auto; }
.reiter button { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; color: var(--leise); padding: 10px 14px; white-space: nowrap; }
.reiter button.aktiv { color: var(--text); border-bottom-color: var(--akzent); }

.frage-liste { display: grid; gap: 10px; }
.frage-eintrag { display: flex; gap: 12px; align-items: flex-start; }
.frage-eintrag .nr { flex: none; font-weight: 800; color: var(--leise); width: 28px; padding-top: 2px; }
.frage-eintrag .wachse { min-width: 0; }
.frage-eintrag .aktionen { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.opt-zeile { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.opt-zeile input[type=radio] { width: 20px; height: 20px; flex: none; accent-color: var(--gruen); }
.richtig-text { color: var(--gruen); font-weight: 600; }

.qr-box { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.qr-box img { width: 260px; height: 260px; border-radius: 12px; background: #fff; border: 1px solid var(--linie); }
.link-feld { font-family: ui-monospace, Menlo, monospace; font-size: .9rem; word-break: break-all; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--linie); vertical-align: top; }
th { font-size: .8rem; color: var(--leise); text-transform: uppercase; letter-spacing: .03em; }
.tabelle-scroll { overflow-x: auto; }
.rang { font-weight: 800; width: 40px; }
.platz-1 .rang { color: #d4a000; } .platz-2 .rang { color: #8a94a6; } .platz-3 .rang { color: #b26a2e; }
.zeile-klick { cursor: pointer; }
.zeile-klick:hover td { background: var(--bg); }

.antwort-zeile { padding: 12px; border-radius: 10px; margin-bottom: 8px; border: 1px solid var(--linie); }
.antwort-zeile.ok { background: var(--gruen-hell); border-color: transparent; }
.antwort-zeile.falsch { background: var(--rot-hell); border-color: transparent; }
.antwort-zeile.unklar { background: var(--gelb-hell); border-color: transparent; }
.bewertung button { padding: 4px 10px; font-size: .85rem; }
.bewertung button.an { background: var(--text); color: var(--karte); border-color: var(--text); }

.balken { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: .9rem; }
.balken .label { width: 40%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.balken .spur { flex: 1; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.balken .spur > div { height: 100%; background: var(--leise); }
.balken.richtig .spur > div { background: var(--gruen); }
.balken .zahl { width: 32px; text-align: right; color: var(--leise); }

dialog { border: none; border-radius: var(--radius); padding: 0; width: min(640px, calc(100vw - 32px)); background: var(--karte); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10,14,22,.5); }
dialog .dlg-inhalt { padding: 20px; max-height: 80vh; overflow-y: auto; }
dialog .dlg-fuss { padding: 14px 20px; border-top: 1px solid var(--linie); display: flex; gap: 10px; justify-content: flex-end; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--karte); padding: 10px 18px; border-radius: 10px; font-weight: 600; z-index: 100; }

/* Druckansicht für QR-Aushang */
.druck-aushang { display: none; }
@media print {
  body * { visibility: hidden; }
  .druck-aushang, .druck-aushang * { visibility: visible; }
  .druck-aushang { display: block; position: absolute; inset: 0; text-align: center; padding-top: 60px; color: #000; }
  .druck-aushang h1 { font-size: 36pt; }
  .druck-aushang img { width: 12cm; height: 12cm; }
  .druck-aushang p { font-size: 16pt; }
}
