:root {
  --bg: #f4f1ea;
  --flaeche: #fffdf8;
  --text: #1b1f2a;
  --leise: #6f6a60;
  --akzent: #e07a2f;
  --akzent-text: #ffffff;
  --dunkel: #14213d;
  --dunkel-text: #f4f1ea;
  --mark: #ffdca8;
  --rand: #e3ddd0;
  --schatten: 0 6px 20px rgba(20, 33, 61, .14);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141d;
    --flaeche: #1a202c;
    --text: #eeeae2;
    --leise: #a19b90;
    --akzent: #f0924a;
    --akzent-text: #1a0e04;
    --dunkel: #232b3d;
    --dunkel-text: #eeeae2;
    --mark: #6b4519;
    --rand: #2c3445;
    --schatten: 0 6px 20px rgba(0, 0, 0, .45);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 18px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button, label { font: inherit; color: inherit; cursor: pointer; user-select: none; -webkit-user-select: none; }
button { appearance: none; border: 0; background: none; padding: 0; }
.leise { color: var(--leise); font-size: 15px; }

/* ---------- Start ---------- */
.start {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px 24px calc(24px + env(safe-area-inset-bottom));
}
.start-logo { font-size: 64px; }
.start h1 { margin: 8px 0 4px; font-size: 32px; letter-spacing: -.01em; }
.start p { max-width: 320px; color: var(--leise); }
.riesen-knopf {
  margin-top: 20px; display: inline-flex; align-items: center; justify-content: center;
  min-width: 240px; min-height: 76px; padding: 0 32px; border-radius: 38px;
  background: var(--akzent); color: var(--akzent-text); font-size: 24px; font-weight: 700;
  box-shadow: var(--schatten);
}
.riesen-knopf:active { transform: scale(.97); }

/* ---------- Kopf ---------- */
.kopf {
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: var(--flaeche); border-bottom: 1px solid var(--rand);
}
.kopf-knopf {
  flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  background: var(--bg); font-size: 22px;
}
.kopf-titel { flex: 1; min-width: 0; }
.titel { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stand { font-size: 14px; color: var(--leise); }

/* ---------- Lesen ---------- */
.leser { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.grafik-karte {
  flex: none; margin: 12px 12px 0; padding: 0; background: var(--flaeche);
  border-radius: 18px; box-shadow: var(--schatten); overflow: hidden;
}
.grafik-bild { display: block; width: 100%; background: #fff; position: relative; }
.grafik-bild canvas { display: block; margin: 0 auto; max-width: 100%; max-height: 42vh; }
.grafik-bild::after {
  content: "🔍 groß"; position: absolute; right: 8px; top: 8px;
  background: rgba(20, 33, 61, .82); color: #fff; font-size: 14px; padding: 5px 10px; border-radius: 12px;
}
.grafik-karte figcaption { padding: 8px 14px 10px; font-size: 15px; color: var(--leise); }

.text {
  flex: 1; overflow-y: auto; padding: 8px 20px 32px; font-size: 21px; line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}
.seite-kopf { margin: 26px 0 6px; font-size: 13px; color: var(--leise); text-transform: uppercase; letter-spacing: .06em; }
.absatz { margin: 0 0 14px; }
.satz { border-radius: 6px; padding: 1px 0; transition: background .2s; }
.satz.aktuell { background: var(--mark); box-shadow: 0 0 0 3px var(--mark); }
.satz.legende { font-style: italic; color: var(--leise); }
.satz.info { font-style: italic; color: var(--leise); }

/* ---------- Steuerung ---------- */
.steuerung {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  background: var(--dunkel); color: var(--dunkel-text);
  border-radius: 28px 28px 0 0;
}
.sprung {
  height: 84px; border-radius: 24px; background: rgba(255, 255, 255, .1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.05;
}
.sprung:active { background: rgba(255, 255, 255, .22); transform: scale(.96); }
.sprung-zahl { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sprung-einheit { font-size: 15px; opacity: .8; }
.play {
  width: 112px; height: 112px; border-radius: 50%; background: var(--akzent); color: var(--akzent-text);
  display: grid; place-items: center; box-shadow: 0 8px 24px rgba(224, 122, 47, .45);
}
.play:active { transform: scale(.95); }
.play svg { width: 56px; height: 56px; fill: currentColor; }

.toast {
  position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(20, 33, 61, .92); color: #fff; font-size: 44px; font-weight: 800;
  padding: 18px 34px; border-radius: 26px; pointer-events: none; z-index: 10;
  font-variant-numeric: tabular-nums; box-shadow: var(--schatten); white-space: nowrap;
}

/* ---------- Grafik-Betrachter ---------- */
.betrachter {
  width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0;
  background: #0d1017; color: #fff;
}
.betrachter[open] { display: flex; flex-direction: column; }
.betrachter-kopf { padding: calc(10px + env(safe-area-inset-top)) 16px 6px; font-size: 15px; opacity: .8; text-align: center; }
.betrachter-flaeche { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center; justify-content: center; padding: 6px; }
.betrachter-flaeche canvas { max-width: 100%; max-height: 100%; background: #fff; border-radius: 6px; }
.betrachter-legende { padding: 6px 18px; font-size: 15px; opacity: .85; text-align: center; }
.betrachter-tasten { display: flex; gap: 10px; padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); }
.b-knopf {
  flex: 1; min-height: 68px; border-radius: 20px; background: rgba(255, 255, 255, .13);
  font-size: 19px; font-weight: 600;
}
.b-knopf.hell { background: var(--akzent); color: var(--akzent-text); }
.b-knopf:active { transform: scale(.97); }

/* ---------- Menü ---------- */
.menue {
  width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0;
  background: var(--flaeche); color: var(--text);
}
.menue[open] { display: flex; flex-direction: column; }
.menue-kopf { display: flex; align-items: center; gap: 6px; padding: calc(8px + env(safe-area-inset-top)) 10px 0; border-bottom: 1px solid var(--rand); }
.menue-tabs { flex: 1; display: flex; overflow-x: auto; }
.menue-tabs button { flex: 1; padding: 14px 6px; font-size: 16px; color: var(--leise); border-bottom: 3px solid transparent; white-space: nowrap; }
.menue-tabs button.aktiv { color: var(--text); font-weight: 700; border-bottom-color: var(--akzent); }
.menue-liste { flex: 1; overflow-y: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.eintrag {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: 60px; padding: 10px 18px; border-bottom: 1px solid var(--rand); font-size: 18px;
}
.eintrag:active { background: var(--bg); }
.eintrag .nr { margin-left: auto; color: var(--leise); font-size: 15px; white-space: nowrap; }
.eintrag img { width: 84px; height: 60px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--rand); flex: none; }
.tiefe-1 { padding-left: 36px; } .tiefe-2 { padding-left: 54px; } .tiefe-3 { padding-left: 72px; }
.hinweis-text { padding: 14px 18px; color: var(--leise); font-size: 16px; }
.einstellung { padding: 14px 18px; border-bottom: 1px solid var(--rand); }
.einstellung h3 { margin: 0 0 10px; font-size: 16px; }
.wahl { display: flex; flex-wrap: wrap; gap: 8px; }
.wahl button { min-height: 52px; min-width: 64px; padding: 0 14px; border-radius: 14px; background: var(--bg); border: 2px solid var(--rand); font-size: 17px; }
.wahl button.aktiv { border-color: var(--akzent); font-weight: 700; }
.stimmen button { width: 100%; text-align: left; }
