/* Urzeittiere im Wasser — Tiefsee-Thema, mobil zuerst. Kein Framework, kein Build. */
:root {
  --tief: #04212f;
  --tief-2: #072c3e;
  --karte: #0d3a4f;
  --karte-hell: #12475f;
  --rand: #1c5c78;
  --text: #eaf6fb;
  --text-leise: #9fc2d2;
  --ja: #3ddc97;
  --ja-dunkel: #12634a;
  --weg: #ff7a6b;
  --weg-dunkel: #6d2b26;
  --gold: #e0b23c;
  --schatten: 0 6px 18px rgba(0, 0, 0, .35);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 80% at 50% -10%, #0b4a63 0%, transparent 60%),
    linear-gradient(180deg, #04212f 0%, #021521 100%);
  background-attachment: fixed;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 20;
  padding: calc(10px + env(safe-area-inset-top)) 14px 0;
  background: rgba(4, 33, 47, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rand);
}
.kopf-zeile { display: flex; align-items: center; gap: 10px; }
.titel { margin: 0; font-size: 19px; letter-spacing: .2px; flex: 1; }
.kopf-knoepfe { display: flex; gap: 8px; }
.sprachknopf {
  background: var(--karte); border: 1px solid var(--rand); color: var(--text);
  border-radius: 999px; padding: 5px 12px; font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.sprachknopf:active { background: var(--karte-hell); }

.fortschritt { display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; }
.balken { flex: 1; height: 6px; background: #062736; border-radius: 999px; overflow: hidden; border: 1px solid var(--rand); }
.balken i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ja), #7ef0c0); transition: width .3s; }
.fortschritt-text { font-size: 12px; color: var(--text-leise); white-space: nowrap; }

.reiter { display: flex; gap: 4px; margin-top: 8px; }
.reiter-knopf {
  flex: 1; background: none; border: 0; border-bottom: 3px solid transparent;
  color: var(--text-leise); padding: 9px 4px; font-size: 14px; font-weight: 600;
}
.reiter-knopf.ist-aktiv { color: var(--text); border-bottom-color: var(--gold); }

/* ---------- Ansichten ---------- */
main { padding: 12px 14px 40px; max-width: 1200px; margin: 0 auto; }
.ansicht { display: none; }
.ansicht.ist-aktiv { display: block; }

.werkzeuge { display: flex; gap: 8px; margin-bottom: 10px; }
.suche {
  flex: 1; min-width: 0; background: var(--karte); border: 1px solid var(--rand);
  border-radius: 999px; padding: 9px 14px; color: var(--text);
}
.suche::placeholder { color: var(--text-leise); }
.filter-schalter {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 999px;
  padding: 9px 14px; white-space: nowrap;
}
.filter-schalter[aria-expanded="true"] { background: var(--karte-hell); border-color: var(--gold); }

.filter {
  background: var(--tief-2); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 12px; margin-bottom: 12px;
}
.filter-gruppe + .filter-gruppe { margin-top: 12px; }
.filter-titel { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-leise); margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: var(--karte); border: 1px solid var(--rand); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; color: var(--text-leise);
}
.chip.ist-aktiv { background: var(--karte-hell); border-color: var(--gold); color: var(--text); font-weight: 600; }
.chip .punkt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.filter-fuss { margin-top: 12px; }
.knopf-leise {
  background: none; border: 1px solid var(--rand); color: var(--text-leise);
  border-radius: 999px; padding: 6px 14px; font-size: 13px;
}

.zaehler { margin: 0 0 10px; font-size: 13px; color: var(--text-leise); }
.leer { color: var(--text-leise); text-align: center; padding: 40px 20px; line-height: 1.6; }

/* ---------- Gitter & Karten ---------- */
.gitter { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 640px) { .gitter { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .gitter { grid-template-columns: repeat(4, 1fr); } }

.aera-titel {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 8px;
  margin: 10px 0 0; font-size: 14px; font-weight: 700; letter-spacing: .3px;
}
.aera-titel:first-child { margin-top: 0; }
.aera-titel .strich { flex: 1; height: 1px; background: var(--rand); }
.aera-titel .spanne { font-size: 12px; font-weight: 400; color: var(--text-leise); }

.karte {
  position: relative; background: var(--karte); border: 1px solid var(--rand);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten);
  display: flex; flex-direction: column; text-align: left; padding: 0; color: inherit;
  border-width: 1px; width: 100%;
}
.karte.ist-gelernt { border-color: var(--ja); }
.karte.ist-gelernt::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(61, 220, 151, .35); border-radius: var(--radius);
}
.karte-bild { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #062736; overflow: hidden; }
.karte-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Ersatzbild, wenn ein Foto nicht kommt — gilt für Karte, Lernkarte UND Detail
   (alle drei Kästen sind position: relative) */
.platzhalter {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 34px; color: var(--text-leise); background: linear-gradient(160deg, #0b3346, #062230);
  pointer-events: none;   /* nur Deko — darf den Schließen-Knopf nicht abfangen */
}
.detail-bild .platzhalter { font-size: 54px; }
.aera-marke {
  position: absolute; left: 8px; top: 8px; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; color: #04212f; letter-spacing: .3px;
}
.karte-text { padding: 9px 10px 10px; flex: 1; }
.karte-name { font-size: 14px; font-weight: 700; line-height: 1.25; }
.karte-wiss { font-size: 11px; font-style: italic; color: var(--text-leise); margin-top: 2px; }
.karte-mass { font-size: 12px; color: var(--gold); margin-top: 5px; }

.karte-knoepfe { display: flex; border-top: 1px solid var(--rand); }
.kknopf {
  flex: 1; background: none; border: 0; padding: 10px 0; font-size: 17px; line-height: 1;
  color: var(--text-leise);
}
.kknopf + .kknopf { border-left: 1px solid var(--rand); }
.kknopf--ja:active, .kknopf--ja.ist-an { background: var(--ja-dunkel); color: var(--ja); }
.kknopf--weg:active { background: var(--weg-dunkel); color: var(--weg); }
.kknopf--zurueck { color: var(--ja); }

/* ---------- Detail ---------- */
.detail {
  position: fixed; inset: 0; z-index: 40; background: rgba(2, 15, 22, .82);
  overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0;
}
.detail-blatt {
  background: var(--tief-2); min-height: 100%;
  max-width: 720px; margin: 0 auto; border-left: 1px solid var(--rand); border-right: 1px solid var(--rand);
}
.detail-bild { position: relative; background: #051d29; min-height: 60px; }
.detail-bild img { width: 100%; display: block; max-height: 52vh; object-fit: contain; }
.detail-zu {
  position: absolute; right: 10px; top: calc(10px + env(safe-area-inset-top));
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--rand);
  background: rgba(4, 33, 47, .85); color: var(--text); font-size: 20px; line-height: 1;
  z-index: 2;             /* liegt über Bild und Platzhalter */
}
.detail-inhalt { padding: 14px 16px 30px; }
.detail-name { font-size: 24px; font-weight: 800; margin: 0; }
.detail-wiss { font-style: italic; color: var(--text-leise); margin: 2px 0 12px; }
.detail-text { margin: 0 0 14px; }

.steckbrief { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: 14px; }
.steckbrief dt { color: var(--text-leise); }
.steckbrief dd { margin: 0; }

.zeitstrahl { display: flex; height: 10px; border-radius: 999px; overflow: hidden; border: 1px solid var(--rand); margin: 4px 0 16px; }
.zeitstrahl i { flex: 1; opacity: .28; }
.zeitstrahl i.ist-an { opacity: 1; }

.fakt {
  background: linear-gradient(160deg, #0f4a37, #0b3a2c); border: 1px solid #1e7a5c;
  border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px;
}
.fakt-titel { font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--ja); margin-bottom: 4px; }

.detail-knoepfe { display: flex; gap: 10px; margin-bottom: 18px; }
.gknopf {
  flex: 1; border-radius: 999px; padding: 12px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--rand); background: var(--karte); color: var(--text);
}
.gknopf--ja.ist-an { background: var(--ja-dunkel); border-color: var(--ja); color: var(--ja); }
.gknopf--weg { color: var(--weg); }

.nachweis { font-size: 12px; color: var(--text-leise); line-height: 1.6; border-top: 1px solid var(--rand); padding-top: 12px; }
.nachweis a, .fuss a { color: var(--text-leise); }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.links a {
  border: 1px solid var(--rand); border-radius: 999px; padding: 6px 12px;
  font-size: 13px; text-decoration: none; color: var(--text-leise); background: var(--karte);
}

/* ---------- Lernen ---------- */
.lern-buehne { max-width: 520px; margin: 0 auto; }
.lern-karte { background: var(--karte); border: 1px solid var(--rand); border-radius: var(--radius); overflow: hidden; box-shadow: var(--schatten); }
.lern-bild { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #062736; overflow: hidden; }
.lern-bild img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lern-frage { padding: 16px; text-align: center; }
.lern-frage h2 { margin: 0 0 4px; font-size: 20px; }
.lern-hinweis { color: var(--text-leise); font-size: 14px; margin: 0 0 14px; }
.lern-loesung { font-size: 22px; font-weight: 800; margin: 0 0 2px; }
.lern-wiss { font-style: italic; color: var(--text-leise); margin: 0 0 12px; }
.lern-knoepfe { display: flex; gap: 10px; padding: 0 16px 16px; }
.lern-zaehler { text-align: center; color: var(--text-leise); font-size: 13px; margin: 14px 0 0; }
.lern-fertig { text-align: center; padding: 40px 20px; }

/* ---------- Papierkorb ---------- */
.papierkorb-kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.papierkorb-kopf p { margin: 0; flex: 1; color: var(--text-leise); font-size: 14px; }
.gitter--klein .karte-bild { aspect-ratio: 3 / 2; }

/* ---------- Fuß ---------- */
.fuss { padding: 20px 16px 40px; text-align: center; color: var(--text-leise); font-size: 12px; line-height: 1.7; }

/* Solange das Foto lädt: ruhiges Schimmern statt leerem Kasten
   (die Fotos hängen am Netz — auf dem Handy dauert das manchmal) */
.karte-bild.ist-ladend, .lern-bild.ist-ladend, .detail-bild.ist-ladend {
  background-image: linear-gradient(100deg, #062736 30%, #0f4460 50%, #062736 70%);
  background-size: 220% 100%;
  animation: schimmern 1.6s linear infinite;
}
@keyframes schimmern { from { background-position: 120% 0; } to { background-position: -120% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .karte-bild.ist-ladend, .lern-bild.ist-ladend, .detail-bild.ist-ladend { animation: none; }
}

/* Karten-Öffner: Button ohne Button-Aussehen (ganze Kartenfläche klickbar) */
.karte-oeffner {
  display: block; width: 100%; padding: 0; margin: 0;
  background: none; border: 0; text-align: left; color: inherit; font: inherit;
}

/* Auf breiten Schirmen läuft der Kopf mit dem Gitter auf gleicher Breite */
@media (min-width: 760px) {
  .kopf > .kopf-zeile, .kopf > .fortschritt, .kopf > .reiter { max-width: 1200px; margin-left: auto; margin-right: auto; }
  .reiter { justify-content: flex-start; }
  .reiter-knopf { flex: 0 0 auto; padding-left: 18px; padding-right: 18px; }
  .titel { font-size: 22px; }
}

/* ---------- Zeiten: Erdzeitalter-Kunde ---------- */
.abschnitt-titel { font-size: 17px; margin: 22px 0 8px; scroll-margin-top: 150px; }
.abschnitt-titel:first-child { margin-top: 4px; }
.einleitung { color: var(--text-leise); margin: 0 0 16px; }

/* Zeitleiste — maßstäblich: Balkenlänge = Dauer der Ära */
.zeitleiste {
  background: var(--tief-2); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 6px 8px; overflow: hidden;
  max-width: 440px;   /* so breit wie die Zeichnung — sonst wird die Leiste am großen Schirm aufgeblasen */
}
.zeitleiste svg { display: block; width: 100%; }
.zl-aera { cursor: pointer; }
.zl-aera rect { transition: opacity .15s; }
.zl-aera:hover rect, .zl-aera:focus-visible rect { opacity: .82; }
.zl-aera:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Beschriftung trägt Text-Farben, nie die Ära-Farbe — die Farbe steht daneben im Band */
.zl-name { fill: var(--text); font-size: 13px; font-weight: 700; }
.zl-unter { fill: var(--text-leise); font-size: 11px; }
.zl-sterben line { stroke: var(--weg); stroke-width: 2; stroke-dasharray: 3 3; }
.zl-sterben circle { fill: var(--weg-dunkel); stroke: var(--weg); stroke-width: 1.5; }
.zl-nr { fill: var(--weg); font-size: 11px; font-weight: 700; text-anchor: middle; }

/* Die fünf Massensterben */
.sterben-liste { display: grid; gap: 10px; }
.sterben {
  display: flex; gap: 10px; background: var(--tief-2);
  border: 1px solid var(--rand); border-left: 3px solid var(--weg);
  border-radius: var(--radius); padding: 10px 12px;
}
.sterben-nr {
  flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--weg-dunkel);
  color: var(--weg); font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.sterben-text { flex: 1; min-width: 0; }
.sterben-kopf { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-bottom: 4px; }
.sterben-zeit { font-size: 12px; color: var(--text-leise); }
.sterben-text p { margin: 0; font-size: 14px; }

/* Karte je Ära */
.aera-karten { display: grid; gap: 12px; margin-top: 22px; }
.aera-karte {
  background: var(--karte); border: 1px solid var(--rand); border-left: 4px solid var(--rand);
  border-radius: var(--radius); padding: 12px 14px; scroll-margin-top: 150px;
  transition: box-shadow .3s, border-color .3s;
}
.aera-karte.ist-hervor { box-shadow: 0 0 0 2px var(--gold); }
.aera-kopf { display: flex; align-items: center; gap: 8px; }
.aera-kopf h3 { margin: 0; font-size: 17px; }
.aera-punkt { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.aera-zeit { margin: 2px 0 8px; font-size: 12px; color: var(--text-leise); }
.aera-was { margin: 0 0 10px; font-size: 14px; }
.aera-meilenstein, .aera-ende { margin: 0 0 10px; font-size: 14px; }
.etikett {
  display: inline-block; font-size: 10px; letter-spacing: .8px; text-transform: uppercase;
  color: var(--ja); border: 1px solid var(--ja-dunkel); background: var(--ja-dunkel);
  border-radius: 999px; padding: 2px 8px; margin-right: 8px; vertical-align: 1px;
}
.etikett--rot { color: var(--weg); background: var(--weg-dunkel); border-color: var(--weg-dunkel); }
.aera-leer { margin: 0; font-size: 13px; color: var(--text-leise); }
.gknopf--klein { flex: 0 0 auto; padding: 9px 16px; font-size: 14px; width: 100%; }

@media (min-width: 760px) {
  .aera-karten { grid-template-columns: repeat(2, 1fr); }
  .sterben-liste { grid-template-columns: repeat(2, 1fr); }
}
