/* ============================================================================
   ExamWing — „Glass Cockpit bei Tag"
   ----------------------------------------------------------------------------
   Die Bühne ist das Instrumentenbrett im Steigflug: helles, kühles Blaugrau wie
   Dunst über dem Horizont, Teal wie die Anzeigen im Glascockpit, Bernstein für
   das, was man sich merken muss, Rot für das, was schiefgeht.
   Markenanker aus der App (app/lib/theme.dart): Cyan, Amber, Rot, Navy — hier
   als Akzente auf hellem Grund. Das dunkle Cockpit liegt eine Schalterstellung
   daneben.
   ========================================================================= */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/Fraunces.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'Plex';
  src: url('../fonts/IBMPlexSans.ttf') format('truetype-variations');
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: 'PlexMono';
  src: url('../fonts/IBMPlexMono.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

:root {
  /* Marke, aus der App übernommen */
  --teal: #0C8285;
  --teal-tief: #0A6E70;
  --teal-hell: #34D6D6;
  --amber: #B5780A;
  --amber-hell: #FFB020;
  --rot: #C4342A;
  --gruen: #0E9D58;
  --navy: #122033;

  /* Tag: heller Dunst. Standard, weil die Seite offen wirken soll. */
  --grund: #EEF2F7;
  --grund-tief: #E3EAF3;
  --panel: #FFFFFF;
  --panel-hoch: #FFFFFF;
  --linie: rgba(18, 32, 51, .13);
  --linie-stark: rgba(12, 130, 133, .34);
  --text: #122033;
  --text-leise: #55688A;

  --spalte: 1200px;
  --radius: 18px;
  --radius-klein: 12px;
  --mono: 'PlexMono', ui-monospace, SFMono-Regular, Menlo, monospace;

  color-scheme: light;
}

/* Cockpit bei Nacht: über den Schalter oben, oder wenn das System es wünscht. */
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --grund: #0F1828;
    --grund-tief: #0A1220;
    --panel: #1A2840;
    --panel-hoch: #21324C;
    --linie: rgba(120, 158, 210, .18);
    --linie-stark: rgba(52, 214, 214, .34);
    --text: #EAF1FB;
    --text-leise: #8DA2C0;
    --teal: #34D6D6;
    --teal-tief: #0E8F92;
    --amber: #FFB020;
    --rot: #FF6B62;
    --gruen: #16C172;
    color-scheme: dark;
  }
}
:root[data-thema="dunkel"] {
  --grund: #0F1828; --grund-tief: #0A1220; --panel: #1A2840; --panel-hoch: #21324C;
  --linie: rgba(120, 158, 210, .18); --linie-stark: rgba(52, 214, 214, .34);
  --text: #EAF1FB; --text-leise: #8DA2C0;
  --teal: #34D6D6; --teal-tief: #0E8F92; --amber: #FFB020; --rot: #FF6B62; --gruen: #16C172;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: 'Plex', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Fraunces', Georgia, 'Times New Roman', serif;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.015em;
  margin: 0 0 .55em;
  font-variation-settings: 'SOFT' 0, 'WONK' 0, 'opsz' 40;
}
h1 { font-size: clamp(2.4rem, 5.6vw, 4rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: 1.2rem; font-weight: 700; letter-spacing: -.005em; }

p { margin: 0 0 1.1em; }

a { color: var(--teal); text-decoration-color: color-mix(in srgb, var(--teal) 34%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

code, .mono { font-family: var(--mono); font-size: .92em; }

.huelle { max-width: var(--spalte); margin: 0 auto; padding: 0 clamp(18px, 4vw, 30px); }
.schmal { max-width: 840px; }

/* ---------------------------------------------------------------- Kopfzeile */
header.kopf {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--grund) 84%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--linie);
}
.kopf .reihe { display: flex; align-items: center; gap: 20px; height: 68px; }
.marke {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  font-family: 'Fraunces', Georgia, serif; font-weight: 900; font-size: 1.3rem; letter-spacing: -.025em;
}
.marke svg { width: 27px; height: 27px; flex: none; color: var(--teal); }
nav.menue { display: flex; gap: 3px; margin-left: auto; align-items: center; }
nav.menue a { padding: 8px 13px; border-radius: 999px; color: var(--text-leise); text-decoration: none; font-size: .95rem; font-weight: 500; }
nav.menue a:hover { background: var(--panel); color: var(--text); }
nav.menue a[aria-current="page"] { color: var(--text); background: var(--panel); }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: .85rem 1.5rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--teal); color: #fff;
  font-family: inherit; font-weight: 600; font-size: .96rem;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .14s cubic-bezier(.22,1,.36,1), box-shadow .14s ease, background .14s ease;
}
.knopf:hover { background: var(--teal-tief); transform: translateY(-2px); box-shadow: 0 10px 26px color-mix(in srgb, var(--teal) 34%, transparent); }
.knopf.zweit { background: var(--panel); color: var(--text); border-color: var(--linie); }
.knopf.zweit:hover { background: var(--panel-hoch); box-shadow: 0 8px 20px rgba(18,32,51,.1); }
.knopf.klein { padding: .55rem 1.1rem; font-size: .9rem; }
/* Der Handlungsknopf sitzt IM Menü und erbt sonst dessen Textfarbe. */
nav.menue a.knopf, nav.menue a.knopf:hover { color: #fff; }
:root[data-thema="dunkel"] .knopf, :root[data-thema="dunkel"] nav.menue a.knopf { color: #04121A; }
@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) .knopf,
  :root:not([data-thema="hell"]) nav.menue a.knopf { color: #04121A; }
  :root:not([data-thema="hell"]) .knopf.zweit { color: var(--text); }
}

#thema {
  width: 38px; height: 38px; padding: 0; border-radius: 999px; flex: none;
  background: transparent; border: 1px solid var(--linie); color: var(--text-leise);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
#thema:hover { background: var(--panel); color: var(--text); }
#thema svg { width: 17px; height: 17px; }

/* ---------------------------------------------------------------- Aufmacher */
.aufmacher { padding: clamp(3rem, 6vw, 5.5rem) 0 clamp(2.5rem, 5vw, 4.5rem); position: relative; overflow: hidden; }
.aufmacher::before {
  /* Der Dunst über dem Horizont, von oben gesehen. */
  content: ''; position: absolute; left: 50%; top: -62vw; width: 150vw; height: 130vw;
  transform: translateX(-50%); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--teal) 20%, transparent),
                              color-mix(in srgb, var(--navy) 8%, transparent) 55%, transparent 72%);
}
.aufmacher::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(700px 300px at 10% 6%, color-mix(in srgb, var(--teal) 13%, transparent), transparent 70%),
    radial-gradient(520px 280px at 90% 20%, color-mix(in srgb, var(--amber) 12%, transparent), transparent 70%);
}
.aufmacher > * { position: relative; z-index: 1; }

.aufmacher-raster {
  display: grid; grid-template-columns: 1.02fr .98fr; gap: clamp(2rem, 5vw, 4.2rem); align-items: center;
}
@media (max-width: 960px) { .aufmacher-raster { grid-template-columns: 1fr; } }

.kicker {
  display: inline-flex; align-items: center; gap: .55rem; margin-bottom: 1.5rem;
  font-family: var(--mono); font-size: .74rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--teal); border: 1px solid var(--linie-stark); border-radius: 999px;
  padding: .4rem .95rem; background: color-mix(in srgb, var(--teal) 7%, transparent);
}
.kicker .punkt {
  width: 7px; height: 7px; border-radius: 50%; background: var(--gruen);
  animation: puls 2.4s infinite;
}
@keyframes puls {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--gruen) 55%, transparent); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

h1 .zeile { display: block; }
h1 .hervor {
  background: linear-gradient(180deg, var(--teal-hell), var(--teal));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.vorspann { font-size: clamp(1.05rem, 1.5vw, 1.2rem); color: var(--text-leise); max-width: 52ch; }
.knopfreihe { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; align-items: center; }
.kleingedruckt { font-size: .88rem; color: var(--text-leise); margin-top: 1.3rem; }

.js .stufe { opacity: 0; transform: translateY(22px); animation: rein .9s cubic-bezier(.22,1,.36,1) forwards; }
.js .stufe:nth-child(1) { animation-delay: .05s; }
.js .stufe:nth-child(2) { animation-delay: .14s; }
.js .stufe:nth-child(3) { animation-delay: .23s; }
.js .stufe:nth-child(4) { animation-delay: .32s; }
.js .stufe:nth-child(5) { animation-delay: .41s; }
@keyframes rein { to { opacity: 1; transform: none; } }

/* ------------------------------------- Prüfungsbogen (Kern des Aufmachers) */
.bogen {
  background: linear-gradient(168deg, var(--panel-hoch), var(--panel));
  border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: 0 2px 0 rgba(255,255,255,.7) inset, 0 24px 52px rgba(18,32,51,.13);
  overflow: hidden;
}
:root[data-thema="dunkel"] .bogen { box-shadow: 0 2px 0 rgba(255,255,255,.05) inset, 0 30px 70px rgba(0,0,0,.5); }

.bogen-kopf {
  display: flex; align-items: center; gap: .8rem; padding: .8rem 1.15rem;
  border-bottom: 1px solid var(--linie); background: color-mix(in srgb, var(--text) 4%, transparent);
}
.bogen-kopf .fach { font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--text-leise); }
.bogen-kopf .nr { font-family: var(--mono); font-size: 1.05rem; color: var(--teal); letter-spacing: .04em; margin-left: auto; }

.bogen-frage { padding: 1.15rem 1.15rem .4rem; font-weight: 500; font-size: .99rem; }

.bogen-optionen { list-style: none; margin: 0; padding: .3rem .9rem 1rem; }
.bogen-optionen li { margin-bottom: .5rem; }
.bogen-optionen button {
  width: 100%; text-align: left; display: grid; grid-template-columns: 26px 1fr; gap: .8rem;
  align-items: start; padding: .75rem .9rem; border-radius: var(--radius-klein);
  border: 1px solid var(--linie); background: transparent; color: var(--text);
  font-family: inherit; font-size: .93rem; line-height: 1.5; cursor: pointer;
  transition: border-color .18s, background .18s;
}
.bogen-optionen button:hover { border-color: var(--linie-stark); background: color-mix(in srgb, var(--teal) 4%, transparent); }
.bogen-optionen .buchstabe {
  width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text-leise); display: grid; place-items: center;
  font-family: var(--mono); font-size: .76rem; font-weight: 600;
}
.bogen-optionen .warum { display: none; margin-top: .4rem; font-size: .86rem; color: var(--text-leise); }
.bogen-optionen li.gezeigt .warum { display: block; }
.bogen-optionen li.gezeigt.richtig button { border-color: color-mix(in srgb, var(--gruen) 55%, var(--linie)); background: color-mix(in srgb, var(--gruen) 9%, transparent); }
.bogen-optionen li.gezeigt.richtig .buchstabe { background: var(--gruen); color: #fff; }
.bogen-optionen li.gezeigt.falsch button { border-color: color-mix(in srgb, var(--rot) 45%, var(--linie)); background: color-mix(in srgb, var(--rot) 7%, transparent); }
.bogen-optionen li.gezeigt.falsch .buchstabe { background: var(--rot); color: #fff; }

.bogen-fuss {
  display: flex; align-items: center; gap: .8rem; padding: .8rem 1.15rem;
  border-top: 1px solid var(--linie); font-size: .82rem; color: var(--text-leise);
}
.bogen-fuss .quelle { font-family: var(--mono); font-size: .74rem; margin-left: auto; text-align: right; opacity: .85; }

/* -------------------------------------------------------------- Zahlenband */
.zahlenband {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  background: var(--panel); border: 1px solid var(--linie); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 14px 34px rgba(18,32,51,.07);
}
.zahlenband .zahl { padding: 1.5rem 1.2rem; text-align: center; border-right: 1px solid var(--linie); }
.zahlenband .zahl:last-child { border-right: 0; }
.zahlenband b {
  display: block; font-family: 'Fraunces', Georgia, serif; font-weight: 800;
  font-size: clamp(1.9rem, 3vw, 2.5rem); line-height: 1; color: var(--teal); letter-spacing: -.02em;
}
.zahlenband span { display: block; margin-top: .5rem; font-size: .84rem; color: var(--text-leise); line-height: 1.45; }
@media (max-width: 620px) { .zahlenband .zahl { border-right: 0; border-bottom: 1px solid var(--linie); } }

/* -------------------------------------------------------------- Abschnitte */
.abschnitt { padding: clamp(3.2rem, 6.5vw, 6rem) 0; position: relative; }
.abschnitt.panelgrund { background: var(--grund-tief); border-block: 1px solid var(--linie); }
.abschnitt-kopf { max-width: 62ch; margin-bottom: clamp(1.9rem, 4vw, 3.2rem); }
.abschnitt-kopf h2 { margin-top: 0; }
.abschnitt-kopf p { color: var(--text-leise); font-size: 1.08rem; margin-bottom: 0; }

.marke-zeile {
  font-family: var(--mono); font-size: .73rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--teal); margin-bottom: .85rem; display: flex; align-items: center; gap: .7rem;
}
.marke-zeile::after { content: ''; flex: 1; height: 1px; background: var(--linie); max-width: 190px; }

/* ------------------------------------------------------------------ Karten */
.raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 1.1rem; }
.karte {
  position: relative; background: var(--panel); border: 1px solid var(--linie);
  border-radius: var(--radius); padding: 1.5rem 1.5rem 1.35rem;
  text-decoration: none; color: inherit; display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(18,32,51,.04);
  transition: transform .16s cubic-bezier(.22,1,.36,1), box-shadow .16s ease, border-color .16s ease;
}
a.karte:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(18,32,51,.12); border-color: var(--linie-stark); }
.karte .nr {
  position: absolute; top: 1.25rem; right: 1.35rem;
  font-family: var(--mono); font-size: .72rem; color: var(--text-leise); opacity: .6;
}
.karte .zeichen {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--teal) 12%, transparent); color: var(--teal);
  margin-bottom: .95rem;
}
.karte .zeichen svg { width: 19px; height: 19px; }
.karte h3 { margin: 0 0 .5rem; }
.karte p { margin: 0; color: var(--text-leise); font-size: .93rem; }
.karte .weiter { margin-top: auto; padding-top: 1rem; color: var(--teal); font-size: .88rem; font-weight: 600; }
.karte .fuss { margin-top: auto; padding-top: .9rem; font-family: var(--mono); font-size: .74rem; color: var(--text-leise); }

/* -------------------------------------------------------------- Textblöcke */
.block { background: var(--panel); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.4rem 1.6rem; margin: 1.4rem 0; }
.block > :last-child { margin-bottom: 0; }
.block.merke { border-left: 3px solid var(--amber); background: color-mix(in srgb, var(--amber) 8%, var(--panel)); }
.block.falle { border-left: 3px solid var(--rot); background: color-mix(in srgb, var(--rot) 6%, var(--panel)); }
.block.tipp { border-left: 3px solid var(--teal); background: color-mix(in srgb, var(--teal) 7%, var(--panel)); }
.block .titel { font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-leise); margin-bottom: .8rem; }
.block.merke .titel { color: var(--amber); }
.block.falle .titel { color: var(--rot); }
.block.tipp .titel { color: var(--teal); }

ul.punkte { list-style: none; padding: 0; margin: 0; }
ul.punkte li { position: relative; padding-left: 26px; margin-bottom: .7rem; }
ul.punkte li::before {
  content: ""; position: absolute; left: 4px; top: .62em;
  width: 7px; height: 7px; border-radius: 2px; background: var(--teal); transform: rotate(45deg);
}
ul.punkte.rot li::before { background: var(--rot); }
ul.punkte li .warum { display: block; font-size: .87rem; color: var(--text-leise); }

/* ------------------------------------------------- Beispielfrage (statisch) */
.frage { background: var(--panel); border: 1px solid var(--linie); border-radius: var(--radius); padding: 1.5rem 1.6rem; margin: 1.4rem 0; }
.frage .stamm { font-weight: 500; margin-bottom: 1.1rem; }
.frage ol { list-style: none; counter-reset: opt; padding: 0; margin: 0 0 1.1rem; }
.frage ol li { counter-increment: opt; position: relative; padding: .8rem .9rem .8rem 3.1rem; border: 1px solid var(--linie); border-radius: var(--radius-klein); margin-bottom: .55rem; font-size: .94rem; }
.frage ol li::before {
  content: counter(opt, upper-alpha); position: absolute; left: .85rem; top: .8rem;
  width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text-leise); display: grid; place-items: center;
  font-family: var(--mono); font-size: .76rem; font-weight: 600;
}
.frage ol li.richtig { border-color: color-mix(in srgb, var(--gruen) 52%, var(--linie)); background: color-mix(in srgb, var(--gruen) 8%, transparent); }
.frage ol li.richtig::before { background: var(--gruen); color: #fff; }
.frage ol li .warum { display: block; margin-top: .35rem; font-size: .86rem; color: var(--text-leise); }
.frage .quelle { font-family: var(--mono); font-size: .76rem; color: var(--text-leise); border-top: 1px solid var(--linie); padding-top: .9rem; margin: 0; }
/* Fallen-Liste: dieselbe Optik, aber KEINE Buchstaben. Die sähen aus wie
   Antwortmöglichkeiten, und genau das sind sie nicht. */
.frage ol.fallen { counter-reset: none; }
.frage ol.fallen li::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--rot); transform: rotate(45deg); top: 1.15rem; left: 1.25rem; }
.frage ol.fallen li { padding-left: 2.8rem; }

/* -------------------------------------------------------------------- Film */
.film { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--linie); box-shadow: 0 18px 44px rgba(18,32,51,.14); background: #000; aspect-ratio: 16 / 9; margin: 1.4rem 0; }
.film video { display: block; width: 100%; height: 100%; object-fit: contain; }

/* ---------------------------------------------------------------- Gerät */
.geraet-raster { display: grid; grid-template-columns: 1fr .82fr; gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 900px) { .geraet-raster { grid-template-columns: 1fr; } }
.geraet {
  margin: 0 auto; width: min(300px, 78vw); aspect-ratio: 9 / 19.5;
  border-radius: 40px; padding: 11px; background: linear-gradient(160deg, #2A3852, #121C2E);
  box-shadow: 0 30px 70px rgba(18,32,51,.3), 0 2px 0 rgba(255,255,255,.14) inset;
}
.geraet img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 30px; background: var(--panel); }

/* ----------------------------------------------------------------- Krümel */
.kruemel { font-size: .84rem; color: var(--text-leise); padding: 1.3rem 0 0; margin: 0; }
.kruemel a { color: var(--text-leise); text-decoration: none; }
.kruemel a:hover { color: var(--teal); }

/* ---------------------------------------------------------------- Fußzeile */
footer.fuss { border-top: 1px solid var(--linie); background: var(--grund-tief); margin-top: 4rem; padding: 3rem 0 2rem; }
footer.fuss .spalten { display: grid; grid-template-columns: 1.6fr repeat(auto-fit, minmax(148px, 1fr)); gap: 2.2rem; }
footer.fuss h4 { font-family: var(--mono); font-size: .73rem; letter-spacing: .18em; text-transform: uppercase; color: var(--text-leise); margin-bottom: .85rem; font-weight: 400; }
footer.fuss a { display: block; color: var(--text-leise); text-decoration: none; font-size: .92rem; margin-bottom: .5rem; }
footer.fuss a:hover { color: var(--teal); }
footer.fuss .klein { font-size: .85rem; color: var(--text-leise); margin-top: 2.2rem; padding-top: 1.3rem; border-top: 1px solid var(--linie); }

/* ----------------------------------------------------------------- Tabelle */
table.tab { width: 100%; border-collapse: collapse; margin: 1.3rem 0; font-size: .94rem; }
table.tab th, table.tab td { text-align: left; padding: .7rem .8rem; border-bottom: 1px solid var(--linie); }
table.tab th { font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text-leise); font-weight: 400; }

/* ------------------------------------------------------------------- Klein */
@media (max-width: 860px) {
  nav.menue .nur-gross { display: none; }
  .kopf .reihe { height: 62px; gap: 10px; }
  body { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, .js .stufe { animation: none !important; transition: none !important; opacity: 1 !important; transform: none !important; }
}
