/* Seiten außerhalb des Spiels: Verwaltung, Datenschutz, Impressum, Sicherheitsprüfung, Fehler.
   Strenge CSP (style-src 'self'): kein Inline-Stil — alles steht hier. */

@font-face {
  font-family: "Andika";
  src: url("/static/fonts/andika/andika-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Andika";
  src: url("/static/fonts/andika/andika-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-muted: #f6f8fb;
  --border: #dde3ec;
  --text: #0f172a;
  --muted: #3d4a5f;
  --primary: #243b63;
  --on-primary: #ffffff;
  --primary-soft: rgba(36, 59, 99, 0.08);
  --focus: #2563eb;
  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.1);
  --warn: #a16207;
  --warn-soft: rgba(202, 138, 4, 0.12);
  --danger: #b91c1c;
  --danger-soft: rgba(220, 38, 38, 0.08);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --surface: #111a2e;
    --surface-muted: #0f1729;
    --border: #26344d;
    --text: #e5ebf4;
    --muted: #b7c3d4;
    --primary: #8fa8d8;
    --on-primary: #0b111b;
    --primary-soft: rgba(143, 168, 216, 0.12);
    --focus: #93c5fd;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, 0.12);
    --warn: #facc15;
    --warn-soft: rgba(250, 204, 21, 0.12);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, 0.12);
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--primary); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 0.35rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
p { margin: 0 0 0.75rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.gedaempft { color: var(--muted); }
.klein { font-size: 0.875rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem 1rem; z-index: 10; }
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- Grundgerüst ---------- */
.kopf {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.kopf-innen {
  max-width: 72rem; margin: 0 auto; padding: 0.7rem 1rem;
  display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; justify-content: space-between;
}
.marke { display: flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none; font-weight: 700; }
.marke img { width: 28px; height: 28px; border-radius: 7px; }
.navi { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.navi a {
  display: inline-block; padding: 0.4rem 0.65rem; border-radius: var(--radius-sm); color: var(--muted);
  text-decoration: none; font-size: 0.92rem;
}
.navi a:hover { background: var(--primary-soft); color: var(--text); }
.navi a[aria-current="page"] { color: var(--text); font-weight: 600; background: var(--primary-soft); }
.navi .zahl {
  display: inline-block; min-width: 1.3rem; padding: 0 0.35rem; margin-left: 0.25rem; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 0.75rem; text-align: center;
}
.wer { display: flex; gap: 0.5rem; align-items: center; font-size: 0.9rem; color: var(--muted); }
.wer form { margin: 0; }
main { max-width: 72rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
main.schmal { max-width: 34rem; }
main.mittel { max-width: 52rem; }
.fuss { max-width: 72rem; margin: 0 auto; padding: 1rem; font-size: 0.85rem; color: var(--muted); }
.fuss a { color: var(--muted); margin-right: 1rem; }

/* ---------- Karten, Raster ---------- */
.karte {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 1.25rem; box-shadow: var(--shadow); margin-bottom: 1rem;
}
.karte > :last-child { margin-bottom: 0; }
.titel { margin-bottom: 1rem; }
.titel p { color: var(--muted); max-width: 48rem; }
.raster { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.kennzahl { background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem 1rem; }
.kennzahl .wert { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.kennzahl .name { color: var(--muted); font-size: 0.88rem; }
.zeile { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.zeile > * { min-width: 0; }
.trenner { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

/* ---------- Hinweise ---------- */
.hinweis {
  border-radius: var(--radius); padding: 0.75rem 0.9rem; margin: 0 0 1rem; border: 1px solid var(--border);
  background: var(--surface-muted);
}
.hinweis--ok { background: var(--ok-soft); border-color: transparent; }
.hinweis--warn { background: var(--warn-soft); border-color: transparent; }
.hinweis--fehler { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.hinweis ul { margin: 0; padding-left: 1.2rem; }
.chip {
  display: inline-block; padding: 0.05rem 0.55rem; border-radius: 999px; font-size: 0.8rem;
  background: var(--surface-muted); border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.chip--ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip--fehler { background: var(--danger-soft); color: var(--danger); border-color: transparent; }

/* ---------- Formulare ---------- */
label { display: block; font-size: 0.9rem; font-weight: 600; margin: 0 0 0.3rem; }
.feld { margin-bottom: 0.9rem; }
.feld small, .hilfe { display: block; color: var(--muted); font-size: 0.83rem; font-weight: 400; margin-top: 0.25rem; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="email"],
input[type="file"], select, textarea {
  width: 100%; max-width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0.55rem 0.7rem;
}
input[type="file"] { padding: 0.45rem; }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.schalter { display: flex; gap: 0.6rem; align-items: flex-start; font-weight: 400; margin-bottom: 0.7rem; }
.schalter input { width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; flex: 0 0 auto; }
.schalter strong { display: block; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 0.35rem; }
.zwei { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }

.knopf, button {
  font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.5rem; padding: 0.5rem 1rem; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border); background: transparent; color: var(--text); text-decoration: none;
  font-weight: 600; font-size: 0.95rem;
}
.knopf:hover, button:hover { background: var(--primary-soft); }
.knopf--haupt, button.knopf--haupt { background: var(--primary); color: var(--on-primary); border-color: transparent; }
.knopf--haupt:hover { filter: brightness(1.08); background: var(--primary); }
.knopf--gefahr { color: var(--danger); }
.knopf--gefahr:hover { background: var(--danger-soft); }
.knopf--klein { min-height: 2rem; padding: 0.25rem 0.7rem; font-size: 0.85rem; }
.knopf--text { border-color: transparent; padding-left: 0.4rem; padding-right: 0.4rem; }
form.inline { display: inline; margin: 0; }
@media (pointer: coarse) { .knopf, button { min-height: 2.75rem; } }

/* ---------- Tabellen ---------- */
.tabelle-huelle { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-weight: 600; color: var(--muted); background: var(--surface-muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  table.stapel thead { display: none; }
  table.stapel tr { display: block; padding: 0.5rem 0.65rem; border-bottom: 1px solid var(--border); }
  table.stapel td { display: block; border: 0; padding: 0.1rem 0; }
  table.stapel td[data-titel]::before { content: attr(data-titel) ": "; color: var(--muted); font-weight: 600; }
}

/* ---------- Gemeldete Fragen ---------- */
.frage { border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1rem; margin-bottom: 0.8rem; }
.frage-kopf { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-bottom: 0.4rem; }
.frage-text { font-weight: 600; margin: 0.3rem 0; }
.antworten { margin: 0.4rem 0; padding-left: 1.2rem; }
.antworten .richtig { color: var(--ok); font-weight: 600; }

/* ---------- Codebogen ---------- */
.kc-bogen { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.5rem; background: #fff;
            color: #111; padding: 0.5rem; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.kc-zettel { border: 1px dashed #999; border-radius: 0.5rem; padding: 0.9rem 0.75rem; text-align: center; break-inside: avoid; }
.kc-zettel--qr { display: flex; align-items: center; gap: 0.6rem; text-align: left; }
.kc-qr { width: 2.6cm; height: 2.6cm; display: block; flex: 0 0 auto; }
.kc-ueber, .kc-fuss { font-size: 0.78rem; color: #444; }
.kc-code { font-family: ui-monospace, monospace; font-size: 1.15rem; font-weight: 700; margin: 0.35rem 0; overflow-wrap: anywhere; }
.kc-text { flex: 1 1 auto; min-width: 0; }

/* ---------- Zwei-Faktor ---------- */
.qr-totp { width: 12rem; height: 12rem; display: block; background: #fff; border-radius: var(--radius-sm); }
.geheimnis { word-break: break-all; }

/* ---------- Galerie (Modulkacheln zeichnet fr-galerie.js) ---------- */
.frg-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 8px; }
.frg-raster--teile { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.frg-kachel { margin: 0; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: #1d2442; }
.frg-kachel--breit { grid-column: 1 / -1; }
.frg-kachel img { display: block; width: 100%; height: 150px; object-fit: contain; }
.frg-kachel--breit img { height: auto; max-height: 420px; }
.frg-kachel figcaption { margin-top: 6px; font-size: 0.85rem; color: #e2e8f0; overflow-wrap: anywhere; }
.frg-gruppe { margin: 18px 0 4px; font-size: 1rem; font-weight: 600; color: var(--text); }
.frg-text { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.frg-schau { position: relative; width: 100%; aspect-ratio: 1024 / 500; overflow: hidden; border-radius: var(--radius); }
.frg-schicht { position: absolute; display: block; }
.frg-raster--stimmung { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.frg-kachel--stimmung .frg-schau { border-radius: calc(var(--radius) - 4px); }
.frg-hell { mix-blend-mode: screen; }
.frg-schild-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 12px; margin: 10px 0; }
.frg-schild-kachel { margin: 0; padding: 10px; border-radius: var(--radius); }
.frg-schild-kachel img { display: block; width: 100%; height: auto; }
.frg-schild-kachel figcaption { margin-top: 6px; font-size: 0.85rem; color: #e2e8f0; }
.schild-vorschau { background: #1d2442; border-radius: var(--radius); padding: 1rem; display: inline-block; max-width: 100%; }
.schild-vorschau img { display: block; max-width: 100%; height: auto; }

/* ---------- Öffentliche Seiten ---------- */
body.oeffentlich main { max-width: 46rem; }
body.oeffentlich .karte h2 { margin-top: 1.25rem; }
body.oeffentlich .karte h2:first-child { margin-top: 0; }
.datenschutz ul { padding-left: 1.2rem; }
.datenschutz li { margin-bottom: 0.35rem; }
.vorformatiert { white-space: pre-line; }
.mitte { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.mitte .karte { max-width: 30rem; width: 100%; }
.sdp-ds-fuss { margin: 1rem 0 0; text-align: center; font-size: 0.85rem; color: var(--muted); }
.sdp-ds-link { color: inherit; }

/* Sicherheitsprüfung (geo-challenge.js) */
.pruef-abschnitt { border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.pruef-abschnitt h2 { font-size: 0.95rem; }
progress { width: 100%; height: 0.5rem; }
.geo-pow-done .status { color: var(--ok); }
.captcha-equation { display: flex; align-items: center; gap: 0.6rem; margin: 0.5rem 0 0.75rem; }
.captcha-number img { width: 72px; height: 48px; display: block; border-radius: var(--radius-sm); }
.captcha-number-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .captcha-number-light { display: none; }
  .captcha-number-dark { display: block; }
}
.captcha-operator { font-size: 1.4rem; font-weight: 700; }
#geo-submit { width: 100%; margin-top: 0.5rem; background: var(--primary); color: var(--on-primary); border-color: transparent; }
#geo-submit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- Druck ---------- */
@media print {
  body { background: #fff; color: #000; }
  .kopf, .fuss, .nicht-drucken, .hinweis { display: none !important; }
  main { padding: 0; max-width: none; }
  .karte { border: 0; box-shadow: none; padding: 0; }
  .kc-bogen { border: 0; padding: 0; }
}
