/* =========================================================================
   styles.css — dunkel, Vodafone-Rot als Akzent, mobil zuerst (390 px).
   Keine externen Fonts, keine CDN. Systemschrift.
   ========================================================================= */

:root {
  --bg:        #0B0C0E;
  --bg-2:      #131519;
  --karte:     #191C21;
  --karte-2:   #21252B;
  --linie:     #2A2F36;
  --text:      #F2F3F5;
  --text-2:    #9AA1AA;
  --rot:       #E60000;
  --rot-dunkel:#8E0000;
  --gruen:     #22B573;
  --gelb:      #E8A33D;
  --blau:      #3D8BE8;
  --radius:    14px;

  /* Sichere Bereiche des Geräts. Wir setzen viewport-fit=cover und
     apple-mobile-web-app-status-bar-style=black-translucent, damit der dunkle
     Hintergrund bis unter die Dynamic Island durchläuft. Dann MUSS der Inhalt
     selbst eingerückt werden — sonst liegt die oberste Zeile hinter Uhrzeit
     und Akku und ist nicht antippbar. Genau das war auf dem iPhone 16 Pro der
     Fall.                                                                   */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
  --tab-h:       env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body { padding-bottom: calc(72px + var(--safe-bottom)); }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; font-weight: 700; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p  { margin: 0 0 10px; }
small { color: var(--text-2); }

.zahl { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* ------------------------------- Layout -------------------------------- */
/* Oben um die Statusleiste/Dynamic Island herum einrücken, seitlich um die
   abgerundeten Ecken. Ohne das erste Zeile = unter der Uhr = nicht tippbar. */
#app {
  padding-top: calc(12px + var(--safe-top));
  padding-right: calc(14px + var(--safe-right));
  padding-bottom: 20px;
  padding-left: calc(14px + var(--safe-left));
  max-width: 640px;
  margin: 0 auto;
}
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.kopf .titel { font-size: 20px; font-weight: 700; }

.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.karte.eng { padding: 10px 12px; }
.reihe { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.spalten-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stapel > * + * { margin-top: 10px; }

/* ------------------------------- Buttons ------------------------------- */
button, .btn {
  font: inherit; font-weight: 600;
  min-height: 48px;
  border-radius: 12px;
  border: 1px solid var(--linie);
  background: var(--karte-2);
  color: var(--text);
  padding: 12px 16px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  text-decoration: none;
}
button:active, .btn:active { transform: scale(0.985); }
button.primaer { background: var(--rot); border-color: var(--rot); color: #fff; }
button.gruen   { background: var(--gruen); border-color: var(--gruen); color: #04170F; }
button.geist   { background: transparent; }
button.klein   { min-height: 38px; padding: 8px 12px; font-size: 14px; width: auto; }
button:disabled { opacity: .45; }
.btn-reihe { display: flex; gap: 8px; }
.btn-reihe > * { flex: 1; }

/* ------------------------------- Tabbar -------------------------------- */
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(13,14,17,.94);
  backdrop-filter: saturate(160%) blur(12px);
  border-top: 1px solid var(--linie);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
#tabs button {
  border: 0; background: none; border-radius: 0;
  min-height: 60px; padding: 8px 2px;
  flex-direction: column; gap: 3px;
  font-size: 10.5px; font-weight: 600; color: var(--text-2);
}
#tabs button .ic { font-size: 19px; line-height: 1; }
#tabs button.aktiv { color: var(--rot); }

/* ------------------------------- Ring ---------------------------------- */
.ring-block { display: flex; align-items: center; gap: 16px; }
.ring { position: relative; width: 108px; height: 108px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .mitte {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring .mitte .gross { font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.ring .mitte .klein { font-size: 10px; color: var(--text-2); text-transform: uppercase; letter-spacing: .5px; }

/* ------------------------------- Balken -------------------------------- */
.balken-zeile { display: grid; grid-template-columns: 88px 1fr 44px; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 13px; }
.balken { height: 8px; background: var(--karte-2); border-radius: 5px; overflow: hidden; }
.balken > i { display: block; height: 100%; background: var(--rot); border-radius: 5px; }
.balken-zeile .wert { text-align: right; color: var(--text-2); font-size: 12.5px; }

/* ------------------------------- Ampel --------------------------------- */
.ampel { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--linie); }
.ampel .punkt { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.ampel.rot   { background: rgba(230,0,0,.10);   border-color: rgba(230,0,0,.45); }
.ampel.gelb  { background: rgba(232,163,61,.10);border-color: rgba(232,163,61,.45); }
.ampel.gruen { background: rgba(34,181,115,.10);border-color: rgba(34,181,115,.45); }
.ampel.rot   .punkt { background: var(--rot); }
.ampel.gelb  .punkt { background: var(--gelb); }
.ampel.gruen .punkt { background: var(--gruen); }

/* ------------------------------- Badges -------------------------------- */
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--karte-2); color: var(--text-2); }
.badge.rot { background: var(--rot); color: #fff; }
.badge.gelb { background: var(--gelb); color: #241701; }
.badge.gruen { background: var(--gruen); color: #04170F; }
.warnung { background: rgba(230,0,0,.12); border: 1px solid rgba(230,0,0,.5); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.hinweis { background: rgba(61,139,232,.10); border: 1px solid rgba(61,139,232,.35); border-radius: var(--radius); padding: 12px 14px; font-size: 13.5px; }

/* ------------------------------- Statistik ----------------------------- */
.stat-gitter { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.stat { background: var(--karte-2); border-radius: 12px; padding: 10px 8px; text-align: center; }
.stat .v { font-size: 21px; font-weight: 800; }
.stat .l { font-size: 10.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: .4px; }

/* ------------------------------- Listen -------------------------------- */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li {
  padding: 11px 12px; border-radius: 11px; background: var(--karte-2);
  margin-bottom: 7px; font-size: 14px; display: flex; gap: 10px;
  align-items: center; justify-content: space-between; cursor: pointer;
}
.liste li .txt { flex: 1; min-width: 0; }
.liste li .pfeil { color: var(--text-2); flex: none; }

/* ------------------------------- Drill --------------------------------- */
#drill { min-height: 60vh; display: flex; flex-direction: column; }
.drill-kopf { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; }
.fortschritt { height: 4px; background: var(--karte-2); border-radius: 3px; overflow: hidden; margin-bottom: 14px; }
.fortschritt > i { display: block; height: 100%; background: var(--rot); }
.frage {
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 22px 18px; font-size: 20px; font-weight: 600; line-height: 1.32; margin-bottom: 14px;
}
.frage .meta { font-size: 11.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 10px; }

input[type=text], input[type=date], input[type=time], input[type=number], textarea, select {
  font: inherit; width: 100%;
  background: var(--karte-2); color: var(--text);
  border: 1px solid var(--linie); border-radius: 12px;
  padding: 14px; min-height: 52px;
  font-variant-numeric: tabular-nums;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--rot); outline-offset: 1px; }
.eingabe-gross { font-size: 26px !important; font-weight: 700; text-align: center; }

.aufloesung { border-radius: var(--radius); padding: 14px; margin-top: 12px; font-size: 15px; }
.aufloesung.ok    { background: rgba(34,181,115,.12); border: 1px solid rgba(34,181,115,.5); }
.aufloesung.falsch{ background: rgba(230,0,0,.12);    border: 1px solid rgba(230,0,0,.5); }
.aufloesung .loesung { font-size: 24px; font-weight: 800; margin: 6px 0; }
.aufloesung .merke { font-size: 13px; color: var(--text-2); margin-top: 8px; }

/* ------------------------------- Tabellen ------------------------------ */
.tabelle-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -14px; padding: 0 14px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-2); font-weight: 600; font-size: 12px; }

/* ------------------------------- Text ---------------------------------- */
.lektion h3 { margin-top: 14px; }
.lektion p { font-size: 15px; line-height: 1.5; }
.zitat { border-left: 3px solid var(--rot); padding: 4px 0 4px 12px; margin: 10px 0; font-size: 14.5px; color: var(--text); }
.klein-text { font-size: 13px; color: var(--text-2); }
details { background: var(--karte-2); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
details > summary { cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: " ▾"; color: var(--text-2); }
details[open] > summary::after { content: " ▴"; }
details .inhalt { margin-top: 10px; font-size: 14px; }

.trenner { height: 1px; background: var(--linie); margin: 16px 0; }
.zentriert { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.versteckt { display: none !important; }

/* Selbstbewertung 1–5 */
.skala { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.skala button { min-height: 46px; font-size: 16px; font-weight: 700; }
