/* ==========================================================
   BVV-Trainer — Designsystem
   Farbwelt: BVV-Blau (Vereinsfarbe) + Volleyball-Gelb (einziger Akzent)
   Motiv: Spielfeldlinie als Trenner statt Karten-mit-Schatten überall
   Typografie: Space Grotesk (Zahlen/Headlines) + IBM Plex Sans (Text)
   ========================================================== */

:root {
  --blau-dunkel: #16345A;
  --blau: #1B3A63;
  --blau-hell: #E8EEF4;
  --gelb: #F2A93B;
  --bg: #F7F8F6;
  --card-bg: #FFFFFF;
  --text: #14181C;
  --text-muted: #5B6570;
  --linie: #D8DEE3;
  --gut: #2F8F5B;
  --gut-bg: #E3F3EA;
  --warn: #C98A2E;
  --warn-bg: #FBF0DE;
  --schlecht: #C1503E;
  --schlecht-bg: #FBE7E3;
  --radius: 16px;
  --schatten: 0 4px 16px rgba(20,24,28,0.08);
  --font-head: 'Space Grotesk', 'IBM Plex Sans', sans-serif;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10141A;
    --card-bg: #1A2029;
    --text: #EEF1F4;
    --text-muted: #8B95A1;
    --linie: #2B333D;
    --blau-hell: #1D2E42;
    --schatten: 0 4px 20px rgba(0,0,0,0.4);
  }
}
:root[data-theme="dark"] {
  --bg: #10141A; --card-bg: #1A2029; --text: #EEF1F4; --text-muted: #8B95A1;
  --linie: #2B333D; --blau-hell: #1D2E42;
}

* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 640px; margin: 0 auto; min-height: 100%; }

/* Scoreboard-Zahlen: für jeden Score, Streak, Prozentwert */
.zahl {
  font-family: var(--font-head);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ---- Kopfzeile ---- */
.app-header {
  padding: 30px 20px 22px;
  background: var(--blau);
  color: white;
}
.app-header h1 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 1.5rem; letter-spacing: -0.01em; }
.app-header .subtitle { margin: 6px 0 0; opacity: 0.8; font-size: 0.88rem; }

.app-header-sub {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
}
.app-header-sub h1 { font-size: 1.15rem; }
.back-link { color: white; text-decoration: none; font-size: 0.92rem; opacity: 0.85; white-space: nowrap; }

/* ---- Spielfeldlinie: der durchgängige Trenner-Motiv ---- */
.feldlinie {
  border: none;
  border-top: 2px solid var(--blau);
  margin: 0;
  position: relative;
}
.feldlinie::after {
  content: ''; display: block; height: 1px; background: var(--linie); margin-top: 3px;
}
.abschnitt-titel {
  font-family: var(--font-head); font-size: 0.82rem; font-weight: 600;
  color: var(--text-muted); margin: 22px 18px 4px; letter-spacing: 0.01em;
}

/* ---- Startseite: Menüliste statt Karten-Stapel ---- */
.heute-status {
  margin: 18px 16px 6px; padding: 16px 18px;
  background: var(--blau); color: white; border-radius: var(--radius);
}
.heute-status .zahl { font-size: 1.6rem; color: var(--gelb); }
.heute-status p { margin: 4px 0 0; font-size: 0.85rem; opacity: 0.85; }

.menu-liste { margin: 8px 0 0; }
.menu-zeile {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--linie);
}
.menu-zeile:first-child { border-top: 1px solid var(--linie); }
.menu-zeile .icon { font-size: 1.5rem; width: 34px; text-align: center; flex-shrink: 0; }
.menu-zeile .info { flex: 1; min-width: 0; }
.menu-zeile .info h2 { margin: 0 0 2px; font-family: var(--font-head); font-size: 1rem; font-weight: 600; }
.menu-zeile .info p { margin: 0; font-size: 0.82rem; color: var(--text-muted); }
.menu-zeile .pfeil { font-size: 1.3rem; color: var(--text-muted); flex-shrink: 0; }

.app-footer { padding: 24px 20px; text-align: center; font-size: 0.76rem; color: var(--text-muted); }
.app-footer a { color: var(--text-muted); }

/* ---- PWA-Installationsbanner ---- */
.install-banner {
  display: none; align-items: center; gap: 12px;
  margin: 16px; padding: 14px 16px;
  background: var(--gelb); color: #201400; border-radius: var(--radius);
}
.install-banner.sichtbar { display: flex; }
.install-banner .info { flex: 1; font-size: 0.85rem; }
.install-banner button { background: #201400; color: white; border: none; border-radius: 8px; padding: 8px 14px; font-weight: 600; font-size: 0.85rem; }
.install-banner .schliessen { background: none; color: #201400; opacity: 0.6; padding: 4px; }

/* ---- Karten (bewusst nur für EIN aktives Objekt je Screen) ---- */
.karte {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 22px; margin: 16px;
}
.karte-kategorie {
  display: inline-block; background: var(--blau-hell); color: var(--blau);
  font-size: 0.74rem; font-weight: 600; padding: 4px 11px; border-radius: 20px; margin-bottom: 12px;
}
.karte-frage { font-size: 1.12rem; line-height: 1.45; margin-bottom: 4px; }

/* ---- Buttons ---- */
.btn {
  border: none; border-radius: 12px; padding: 15px 18px;
  font-family: var(--font-body); font-size: 1rem; font-weight: 600; cursor: pointer;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--blau); color: white; }
.btn-secondary { background: var(--blau-hell); color: var(--blau); margin-top: 10px; }
.btn-akzent { background: var(--gelb); color: #201400; }
.hidden { display: none !important; }

/* ---- Multiple-Choice-Optionen ---- */
.optionen-liste { margin: 18px 0; display: flex; flex-direction: column; gap: 10px; }
.option-zeile {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 2px solid var(--linie); border-radius: 12px;
  cursor: pointer; transition: border-color 0.15s;
}
.option-zeile:active { border-color: var(--blau); }
.option-zeile.ausgewaehlt { border-color: var(--blau); background: var(--blau-hell); }
.option-zeile input { width: 20px; height: 20px; accent-color: var(--blau); flex-shrink: 0; }
.option-zeile .option-text { flex: 1; font-size: 0.98rem; }

.option-zeile.ergebnis-richtig { border-color: var(--gut); background: var(--gut-bg); }
.option-zeile.ergebnis-fehlend { border-color: var(--gut); background: var(--gut-bg); opacity: 0.7; border-style: dashed; }
.option-zeile.ergebnis-falsch { border-color: var(--schlecht); background: var(--schlecht-bg); }

.typ-hinweis { font-size: 0.78rem; color: var(--text-muted); margin: -6px 0 14px; }

/* ---- Ergebnis-Banner nach Auswertung ---- */
.ergebnis-banner { border-radius: 12px; padding: 14px 16px; margin: 14px 0; font-weight: 600; }
.ergebnis-banner.richtig { background: var(--gut-bg); color: var(--gut); }
.ergebnis-banner.teilweise { background: var(--warn-bg); color: var(--warn); }
.ergebnis-banner.falsch { background: var(--schlecht-bg); color: var(--schlecht); }

.antwort-bereich { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--linie); }
.antwort-block { margin-bottom: 16px; }
.antwort-label { font-family: var(--font-head); font-size: 0.76rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.antwort-text { font-size: 1rem; line-height: 1.55; }
.antwort-text.editable { background: var(--bg); border-radius: 10px; padding: 12px; min-height: 60px; }
.quelle { font-size: 0.74rem; color: var(--text-muted); margin-bottom: 4px; }

/* ---- Listenzeilen (Training-Übersicht, Statistik) — Trenner statt Karten ---- */
.liste { margin: 4px 0 0; }
.listen-zeile {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  text-decoration: none; color: var(--text);
  border-bottom: 1px solid var(--linie);
}
.listen-zeile .titel { flex: 1; font-size: 0.94rem; }
.listen-zeile .score { font-family: var(--font-head); font-weight: 700; font-size: 1rem; min-width: 34px; text-align: center; }
.score-hoch { color: var(--gut); }
.score-mittel { color: var(--warn); }
.score-niedrig { color: var(--schlecht); }
.score-leer { color: var(--text-muted); font-weight: 400; font-size: 0.78rem; }
.trend-pfeil { font-size: 1rem; }
.hinweis-text { padding: 24px 20px; color: var(--text-muted); text-align: center; font-size: 0.9rem; }

/* ---- Statistik-Seite ---- */
.stat-kachel-reihe { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px; }
.stat-kachel { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; text-align: center; }
.stat-kachel .zahl { font-size: 1.7rem; display: block; color: var(--blau); }
.stat-kachel .label { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.balken-reihe { display: flex; align-items: center; gap: 10px; padding: 10px 18px; }
.balken-label { width: 92px; font-size: 0.82rem; color: var(--text-muted); flex-shrink: 0; }
.balken-spur { flex: 1; height: 10px; background: var(--linie); border-radius: 6px; overflow: hidden; }
.balken-fuellung { height: 100%; background: var(--blau); border-radius: 6px; }
.balken-wert { width: 34px; text-align: right; font-family: var(--font-head); font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }

/* ---- Progress (Wissen) ---- */
.progress-bar-wrap { padding: 16px 18px 0; }
.progress-text { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.progress-bar { height: 8px; background: var(--linie); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gut); width: 0%; transition: width .3s; }

/* ---- Hörbuch ---- */
.player-bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--blau); color: white;
  padding: 16px 16px 14px; display: none;
}
.player-bar.aktiv { display: block; }
.player-bar .titel {
  font-family: var(--font-head); font-size: 0.88rem; opacity: 0.9;
  margin-bottom: 12px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.player-transport { display: flex; align-items: center; justify-content: center; gap: 18px; margin-bottom: 12px; }
.transport-btn {
  background: rgba(255,255,255,0.14); color: white; border: none; border-radius: 50%;
  width: 44px; height: 44px; font-size: 1.1rem; cursor: pointer;
}
.transport-btn-gross { width: 58px; height: 58px; font-size: 1.5rem; background: var(--gelb); color: #201400; }

.player-optionen { display: flex; gap: 8px; justify-content: center; }
.option-btn {
  background: rgba(255,255,255,0.12); color: white; border: none; border-radius: 20px;
  padding: 9px 14px; font-size: 0.8rem; cursor: pointer; flex: 1; max-width: 200px;
}
.option-btn.aktiv-toggle { background: rgba(255,255,255,0.28); font-weight: 600; }

.sleep-menu { display: none; gap: 6px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.sleep-menu.offen { display: flex; }
.sleep-menu button { background: rgba(255,255,255,0.12); color: white; border: none; border-radius: 8px; padding: 7px 11px; font-size: 0.78rem; }
.sleep-menu button.gewaehlt { background: var(--gelb); color: #201400; font-weight: 600; }

.kapitel-zeile {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--linie);
}
.kapitel-zeile.spielt-gerade { background: var(--blau-hell); }
.kapitel-nr { font-family: var(--font-head); font-weight: 700; color: var(--gelb); min-width: 22px; -webkit-text-stroke: 0.6px var(--blau); }
.kapitel-titel-text { flex: 1; font-size: 0.92rem; }
.kapitel-status { font-size: 1rem; width: 20px; text-align: center; }
.play-btn { background: var(--blau); color: white; border: none; border-radius: 50%; width: 38px; height: 38px; font-size: 1rem; cursor: pointer; flex-shrink: 0; }
.play-btn.spielt { background: var(--schlecht); }

/* ---- Aufnahme (Training-Detail) ---- */
.frage-view { padding-bottom: 40px; }
.aufnahme-bereich { text-align: center; margin: 26px 16px; }
.btn-aufnahme {
  display: inline-flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--blau); color: white; border: none; border-radius: 50%;
  width: 112px; height: 112px; font-size: 1rem; cursor: pointer;
}
.btn-aufnahme.aufnahme-aktiv { background: var(--schlecht); animation: puls 1.4s infinite; }
#aufnahmeIcon { font-size: 2rem; }
#aufnahmeLabel { font-size: 0.7rem; padding: 0 10px; }
.aufnahme-status { margin-top: 12px; font-size: 0.9rem; color: var(--text-muted); }

@keyframes puls {
  0% { box-shadow: 0 0 0 0 rgba(193,80,62,0.5); }
  70% { box-shadow: 0 0 0 18px rgba(193,80,62,0); }
  100% { box-shadow: 0 0 0 0 rgba(193,80,62,0); }
}

.score-anzeige { text-align: center; margin-bottom: 18px; }
.score-zahl { font-family: var(--font-head); font-size: 2.8rem; font-weight: 700; color: var(--blau); }
.score-label { font-size: 0.85rem; color: var(--text-muted); }

.check-liste { margin: 0; padding-left: 20px; }
.check-liste li { margin-bottom: 4px; }

.tipp-block { background: var(--warn-bg); border-radius: 10px; padding: 12px; }

.verlauf-bereich { padding: 8px 0 16px; }
.verlauf-bereich h3 { font-family: var(--font-head); font-size: 0.95rem; margin: 0 0 6px; padding: 0 18px; }

/* Sichtbarer Fokus für Tastaturbedienung */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gelb); outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Untere Navigationsleiste (auf allen Unterseiten) ---- */
body.mit-bottom-nav .app { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }

.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: var(--card-bg); border-top: 1px solid var(--linie);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom, 0px));
  max-width: 640px; margin: 0 auto;
}
.bottom-nav-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--text-muted); flex: 1;
  padding: 4px 0; border-radius: 10px; font-size: 0.68rem;
}
.bottom-nav-icon { font-size: 1.25rem; }
.bottom-nav-tab.aktiv { color: var(--blau); }
.bottom-nav-tab.aktiv .bottom-nav-icon { transform: scale(1.08); }
