:root {
  --bg: #f6f3ee;
  --bg2: #ffffff;
  --fg: #1c1b19;
  --fg2: #5c5852;
  --linie: #e2ddd4;
  --akzent: #b4231f;
  --akzent-fg: #ffffff;
  --gruen: #2a7d46;
  --gelb: #b7791f;
  --grau: #8a857d;
  --radius: 14px;
  --schatten: 0 1px 2px rgba(0,0,0,.06), 0 6px 20px rgba(0,0,0,.05);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14151a; --bg2: #1f2027; --fg: #f1efe9; --fg2: #a9a59c; --linie: #2e3039;
    --akzent: #d93b36; --gruen: #4caf6e; --gelb: #d9a441; --grau: #7c7872;
    --schatten: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #14151a; --bg2: #1f2027; --fg: #f1efe9; --fg2: #a9a59c; --linie: #2e3039;
  --akzent: #d93b36; --gruen: #4caf6e; --gelb: #d9a441; --grau: #7c7872;
  --schatten: 0 1px 2px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  min-height: 100vh; padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
button { font: inherit; }
h1 { font-size: 1.45rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .3rem; color: var(--fg2); font-weight: 600; }
p { margin: .4rem 0; }
small, .klein { font-size: .85rem; color: var(--fg2); }
hr { border: 0; border-top: 1px solid var(--linie); margin: 1rem 0; }

.kopf {
  position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--linie);
  padding: calc(.5rem + env(safe-area-inset-top)) 16px .4rem;
  display: flex; flex-wrap: wrap; gap: .3rem 1rem; align-items: center; justify-content: space-between;
}
.marke { font-weight: 700; text-decoration: none; display: flex; align-items: center; gap: .5rem; }
.kreis { width: 18px; height: 18px; border: 3px solid var(--akzent); border-radius: 50%; border-right-color: transparent; transform: rotate(35deg); display: inline-block; }
.nav { display: flex; gap: .15rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { text-decoration: none; padding: .35rem .65rem; border-radius: 999px; color: var(--fg2); white-space: nowrap; font-size: .95rem; }
.nav a.aktiv { background: var(--akzent); color: var(--akzent-fg); }

.inhalt { max-width: 720px; margin: 0 auto; padding: 1rem 16px 3rem; }
.laden { color: var(--fg2); }

.karte {
  background: var(--bg2); border: 1px solid var(--linie); border-radius: var(--radius);
  padding: 1rem; box-shadow: var(--schatten); margin: .8rem 0;
}
.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .6rem; margin: .6rem 0; }
.kachel { background: var(--bg2); border: 1px solid var(--linie); border-radius: var(--radius); padding: .7rem .8rem; }
.kachel .zahl { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kachel .label { font-size: .8rem; color: var(--fg2); }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 1px solid var(--linie); background: var(--bg2); color: var(--fg); border-radius: 12px;
  padding: .7rem 1.1rem; cursor: pointer; min-height: 48px; text-decoration: none;
}
.knopf:active { transform: translateY(1px); }
.knopf.primaer { background: var(--akzent); color: var(--akzent-fg); border-color: var(--akzent); font-weight: 600; }
.knopf.gross { font-size: 1.15rem; padding: 1rem 1.4rem; width: 100%; }
.knopf.gruen { background: var(--gruen); color: #fff; border-color: var(--gruen); }
.knopf.rot { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.knopf.leise { background: transparent; }
.knopf[disabled] { opacity: .5; cursor: default; }
.reihe { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin: .6rem 0; }
.reihe > .knopf { flex: 1 1 140px; }

.stufe { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .45rem; border-radius: 6px; color: #fff; background: var(--grau); vertical-align: middle; }
.stufe-1 { background: var(--akzent); }
.stufe-2 { background: var(--gelb); }
.stufe-3 { background: var(--grau); }
.punkt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--linie); margin-right: 3px; }
.punkt.lernen { background: var(--gelb); }
.punkt.gelernt { background: var(--gruen); }

/* Sitzung */
.sitzung { text-align: center; }
.sitzung .fortschritt { height: 6px; background: var(--linie); border-radius: 3px; overflow: hidden; margin: 0 0 1rem; }
.sitzung .fortschritt > div { height: 100%; background: var(--akzent); transition: width .3s; }
.sitzung .phase { color: var(--fg2); font-size: .95rem; min-height: 1.4rem; }
.sitzung .gross-text { font-size: 2rem; font-weight: 700; line-height: 1.2; margin: .6rem 0 .2rem; word-break: break-word; }
.sitzung .mittel-text { font-size: 1.35rem; margin: .2rem 0; }
.sitzung .kana { font-size: 1.3rem; color: var(--fg2); }
.sitzung .zaehler { font-size: 3rem; font-weight: 700; color: var(--akzent); line-height: 1; margin: .4rem 0; }
.sitzung .bereich { min-height: 190px; display: flex; flex-direction: column; justify-content: center; }
.sitzung .richtung { font-size: .85rem; color: var(--fg2); margin-bottom: .4rem; }
.ohr { font-size: 2.6rem; line-height: 1; margin: .3rem 0; }
.bewertung .knopf { min-height: 64px; font-size: 1.15rem; }
.auto-leiste { height: 4px; background: var(--linie); border-radius: 2px; overflow: hidden; margin: .5rem 0; }
.auto-leiste > div { height: 100%; background: var(--gruen); transition: width 1s linear; }

/* Liste */
.suche { width: 100%; padding: .7rem .9rem; border: 1px solid var(--linie); border-radius: 12px; background: var(--bg2); color: var(--fg); font: inherit; }
.filter { display: flex; gap: .4rem; flex-wrap: wrap; margin: .6rem 0; }
.chip { border: 1px solid var(--linie); background: var(--bg2); color: var(--fg2); border-radius: 999px; padding: .3rem .7rem; cursor: pointer; font-size: .9rem; }
.chip.aktiv { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.eintrag { display: grid; grid-template-columns: 1fr auto; gap: .2rem .6rem; padding: .6rem 0; border-top: 1px solid var(--linie); align-items: center; }
.eintrag:first-of-type { border-top: 0; }
.eintrag .ja { font-weight: 600; }
.eintrag .de { color: var(--fg2); }
.eintrag .status { font-size: .75rem; color: var(--fg2); white-space: nowrap; }
.eintrag .hoer { border: 0; background: transparent; cursor: pointer; font-size: 1.4rem; padding: .3rem; color: var(--akzent); }

/* Einstellungen */
.feld { display: grid; grid-template-columns: 1fr auto; gap: .3rem .8rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--linie); }
.feld:first-child { border-top: 0; }
.feld label { font-weight: 500; }
.feld .erkl { grid-column: 1 / -1; font-size: .85rem; color: var(--fg2); margin-top: -.2rem; }
.feld select, .feld input[type=number] { font: inherit; padding: .45rem .6rem; border: 1px solid var(--linie); border-radius: 10px; background: var(--bg2); color: var(--fg); max-width: 220px; }
.feld input[type=number] { width: 90px; text-align: right; }
.feld input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--akzent); }
.feld .gruppe { display: flex; gap: .4rem; flex-wrap: wrap; }

.hinweis {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 9;
  background: var(--fg); color: var(--bg); padding: .8rem 1rem; border-radius: 12px; box-shadow: var(--schatten); font-size: .95rem;
}
.warnung { border-left: 4px solid var(--gelb); }
.statistik-tabelle { width: 100%; border-collapse: collapse; font-size: .95rem; }
.statistik-tabelle td, .statistik-tabelle th { text-align: left; padding: .35rem .3rem; border-top: 1px solid var(--linie); }
.statistik-tabelle th { color: var(--fg2); font-weight: 600; font-size: .85rem; }
.balken { height: 8px; background: var(--linie); border-radius: 4px; overflow: hidden; }
.balken > div { height: 100%; background: var(--gruen); }
.tastatur { font-size: .8rem; color: var(--fg2); }
kbd { font: .8rem ui-monospace, Menlo, monospace; border: 1px solid var(--linie); border-radius: 5px; padding: 0 .3rem; }
@media (max-width: 420px) { .kopf { padding-left: 12px; padding-right: 12px; } .sitzung .gross-text { font-size: 1.7rem; } }
