/* Vokabeltrainer – Gestaltung (hell und dunkel, Handy zuerst) */
:root {
  --bg: #f4f6fb;
  --karte: #ffffff;
  --text: #1c2333;
  --leise: #5d667a;
  --linie: #e2e6ef;
  --flaeche: #eef2f8;
  --primaer: #0e8a8c;
  --primaer-druck: #0b7375;
  --primaer-hell: #e1f3f3;
  --primaer-text: #ffffff;
  --ok: #17824a;
  --ok-bg: #e6f6ec;
  --fast: #8a5f00;
  --fast-bg: #fff3d1;
  --falsch: #a9471a;
  --falsch-bg: #fdede4;
  --serie: #e8711f;
  --f0: #c3cad8; --f1: #f0a25a; --f2: #f2c443; --f3: #8bc96a; --f4: #36ad97; --f5: #6b7cf0;
  --schatten: 0 1px 2px rgba(20, 30, 50, .05), 0 8px 24px rgba(20, 30, 50, .06);
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c;
    --karte: #1a2029;
    --text: #e7ebf3;
    --leise: #9ba5b9;
    --linie: #2b3341;
    --flaeche: #232b37;
    --primaer: #2bb5b7;
    --primaer-druck: #24a0a2;
    --primaer-hell: #173b3d;
    --primaer-text: #06191a;
    --ok: #63d692;
    --ok-bg: #15301f;
    --fast: #f2c550;
    --fast-bg: #33290d;
    --falsch: #f39b6c;
    --falsch-bg: #3a2216;
    --serie: #ff9a4d;
    --f0: #4a5466;
    --schatten: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}
h2, h3 { margin: 0 0 .4em; line-height: 1.2; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.02rem; }
p { margin: .35em 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.klein { font-size: .86rem; color: var(--leise); }
.mitte { text-align: center; }

/* Kopfzeile */
.kopf {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--linie);
}
.marke { background: none; border: 0; padding: 4px 0; font-weight: 700; font-size: 1.02rem; }
.kopf-rechts { display: flex; align-items: center; gap: 12px; }
.serie { font-weight: 700; color: var(--serie); white-space: nowrap; }
.serie.aus { color: var(--leise); opacity: .6; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; color: var(--leise); white-space: nowrap; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--f0); display: inline-block; }
.sync[data-z="ok"] i { background: var(--ok); }
.sync[data-z="offline"] i { background: var(--fast); }
.sync[data-z="wartet"] i, .sync[data-z="speichert"] i { background: var(--primaer); animation: puls 1s ease-in-out infinite; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
}
.laden { text-align: center; color: var(--leise); padding: 40px 0; }

/* Karten und Knöpfe */
.karte {
  background: var(--karte);
  border: 1px solid var(--linie);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--schatten);
  margin-bottom: 14px;
}
button.primaer, button.leise, .segment button, .chip-knopf {
  border-radius: 12px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid transparent;
  transition: transform .06s ease, background-color .15s ease;
}
button.primaer { background: var(--primaer); color: var(--primaer-text); font-weight: 650; }
button.primaer:hover { background: var(--primaer-druck); }
button.leise { background: var(--flaeche); color: var(--text); }
button.leise:hover { border-color: var(--linie); }
button:active { transform: scale(.98); }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--primaer) 55%, transparent); outline-offset: 2px; }
button:disabled { opacity: .6; cursor: default; }
.icon {
  width: 40px; height: 40px; flex: none;
  border-radius: 12px; border: 1px solid var(--linie);
  background: var(--karte); font-size: 1.05rem;
}
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.knoepfe > button { flex: 1 1 auto; }
.knoepfe > button.primaer { flex: 1 1 100%; }
@media (min-width: 440px) {
  .knoepfe > button.primaer { flex: 1.4 1 0; }
  .knoepfe > button.leise { flex: 1 1 0; }
}
.knoepfe.einzeln > button { flex: 1 1 100%; }
.knoepfe.zwei > button { flex: 1 1 0; }
.pille {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: var(--primaer-hell); color: var(--text); font-size: .9rem; font-weight: 600;
}
.pille.test { display: block; text-align: center; margin-bottom: 14px; }
.klein-pille { padding: 2px 8px; font-size: .72rem; vertical-align: middle; margin-left: 4px; background: var(--fast-bg); color: var(--fast); }

/* Startseite */
.hallo { display: flex; align-items: center; gap: 16px; }
.ring { width: 84px; height: 84px; flex: none; }
.ring-bg { fill: none; stroke: var(--flaeche); stroke-width: 8; }
.ring-fg { fill: none; stroke: var(--primaer); stroke-width: 8; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 40px 40px; transition: stroke-dashoffset .6s ease; }
.ring text { fill: var(--text); font-size: 15px; font-weight: 700; }
.riesig {
  width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 18px 16px !important;
  font-size: 1.3rem !important;
  border-radius: var(--radius) !important;
  margin-bottom: 14px;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primaer) 30%, transparent);
}
.riesig small { font-size: .86rem; font-weight: 500; opacity: .92; }
.kasten { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; align-items: end; margin-top: 8px; }
.fach { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fach .zahl { font-weight: 700; font-size: .95rem; }
.fach .name { font-size: .78rem; color: var(--leise); }
.saeule { width: 100%; height: 84px; background: var(--flaeche); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.saeule i { display: block; width: 100%; border-radius: 8px; transition: height .5s ease; }
.f0 i { background: var(--f0); } .f1 i { background: var(--f1); } .f2 i { background: var(--f2); }
.f3 i { background: var(--f3); } .f4 i { background: var(--f4); } .f5 i { background: var(--f5); }
.kasten + .klein { margin-top: 10px; }
.unten { display: flex; gap: 10px; }
.unten > button { flex: 1 1 0; }

/* Abfrage */
.quiz-kopf { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.balken { flex: 1; height: 10px; background: var(--flaeche); border-radius: 999px; overflow: hidden; }
.balken i { display: block; height: 100%; background: var(--primaer); border-radius: 999px; transition: width .3s ease; }
.zaehler { font-size: .85rem; color: var(--leise); min-width: 3.2em; text-align: right; }
.richtung {
  text-align: center; font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--leise); margin-bottom: 10px;
}
.richtung.neu { color: var(--primaer); }
.wort {
  text-align: center; font-weight: 750;
  font-size: clamp(1.6rem, 7vw, 2.2rem); line-height: 1.2;
  overflow-wrap: anywhere; margin: 6px 0 4px;
}
.sprechen {
  border: 0; background: var(--flaeche); border-radius: 50%;
  width: 40px; height: 40px; font-size: 1.05rem;
  vertical-align: middle; margin-left: 8px;
}
.notiz { text-align: center; color: var(--leise); font-size: .9rem; font-style: italic; }
.pfeil { text-align: center; color: var(--leise); font-size: 1.2rem; margin: 6px 0; }
.uebersetzung { text-align: center; font-size: 1.3rem; font-weight: 650; overflow-wrap: anywhere; margin: 4px 0 8px; }
.beispiel {
  margin: 10px 0 0; padding: 10px 12px;
  background: var(--flaeche); border-radius: 12px;
  font-style: italic; color: var(--leise); font-size: .95rem;
}
.eingabe {
  width: 100%; margin-top: 14px;
  font-size: 1.25rem; padding: 14px 16px;
  border-radius: 14px; border: 2px solid var(--linie);
  background: var(--karte); color: var(--text);
  outline: none; transition: border-color .15s ease;
}
.eingabe:focus { border-color: var(--primaer); }
.eingabe.ok { border-color: var(--ok); background: var(--ok-bg); }
.eingabe.falsch { border-color: var(--falsch); background: var(--falsch-bg); }
.eingabe.wackeln { animation: wackeln .35s ease; }
.hinweis { margin-top: 10px; padding: 10px 12px; border-radius: 12px; font-weight: 600; }
.hinweis.fast { background: var(--fast-bg); color: var(--fast); }
.tipp { margin-top: 12px; padding: 12px; border: 2px dashed var(--linie); border-radius: 14px; text-align: center; }
.tipp .beispiel { text-align: left; }
.tipp .klein { margin-top: 8px; }
.muster { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 1.25rem; letter-spacing: .14em; font-weight: 700; }
.rueck { margin-top: 14px; padding: 14px; border-radius: 14px; }
.rueck.ok { background: var(--ok-bg); }
.rueck.falsch { background: var(--falsch-bg); }
.rueck-kopf { font-weight: 700; margin-bottom: 6px; }
.rueck.ok .rueck-kopf { color: var(--ok); }
.rueck.falsch .rueck-kopf { color: var(--falsch); }
.loesung { font-size: 1.05rem; overflow-wrap: anywhere; }
.gross-loesung { font-size: 1.35rem; font-weight: 700; margin: 4px 0 8px; }
.rueck .beispiel { background: color-mix(in srgb, var(--karte) 65%, transparent); }
.dran { margin-top: 6px; }

/* Ende einer Runde */
.gross-emoji { font-size: 3rem; text-align: center; line-height: 1; margin: 4px 0 8px; animation: hupf .6s ease; }
.kacheln { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.kachel { background: var(--flaeche); border-radius: 14px; padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 2px; }
.kachel b { font-size: 1.6rem; line-height: 1.1; }
.kachel span { font-size: .78rem; color: var(--leise); line-height: 1.25; }
.kachel.ok { background: var(--ok-bg); }
.kachel.ok b { color: var(--ok); }
.kachel.offen b { color: var(--falsch); }
.liste { margin: 12px 0; }
.chip { display: inline-block; padding: 4px 10px; margin: 3px 3px 0 0; border-radius: 999px; background: var(--flaeche); font-size: .9rem; }
.ziel-zeile { display: flex; align-items: center; gap: 14px; margin: 14px 0 4px; }
.ziel-zeile .ring { width: 64px; height: 64px; }

/* Unterseiten */
.seiten-kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.seiten-kopf h2 { margin: 0; }
.segment { display: flex; gap: 6px; margin-top: 8px; }
.segment button { flex: 1 1 0; background: var(--flaeche); min-height: 44px; padding: 8px; }
.segment button.aktiv, .chip-knopf.aktiv { background: var(--primaer); color: var(--primaer-text); font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-knopf { background: var(--flaeche); min-height: 40px; padding: 6px 14px; border-radius: 999px; }
.zeile { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
input[type="date"] {
  padding: 10px 12px; border-radius: 12px; border: 2px solid var(--linie);
  background: var(--karte); min-height: 48px; font-size: 1rem;
}
.liste-zeilen { list-style: none; margin: 0; padding: 0; }
.liste-zeilen li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--linie);
}
.liste-zeilen li:last-child { border-bottom: 0; }
.liste-zeilen li > span:last-child { text-align: right; flex: none; max-width: 55%; }
.link { color: var(--primaer); font-weight: 600; text-decoration: none; }
.link:hover { text-decoration: underline; }
.fehler h2 { color: var(--falsch); }

/* Meldungen und Feier */
.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 20; pointer-events: none; width: max-content; max-width: calc(100% - 32px);
}
.toast {
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-weight: 650; font-size: .95rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  animation: rein .25s ease;
  transition: opacity .4s ease, transform .4s ease;
  text-align: center;
}
.toast.weg { opacity: 0; transform: translateY(8px); }
.toast.stern { background: var(--f5); color: #fff; }
.toast.serie { background: var(--serie); color: #fff; }
.toast.ziel { background: var(--primaer); color: var(--primaer-text); }
.konfetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.konfetti span { position: absolute; top: -40px; animation: fallen 2.4s ease-in forwards; }

@keyframes fallen { to { transform: translateY(110vh) rotate(540deg); opacity: .9; } }
@keyframes rein { from { opacity: 0; transform: translateY(10px); } }
@keyframes puls { 50% { opacity: .35; } }
@keyframes hupf { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes wackeln { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

@media (max-width: 360px) {
  body { font-size: 16px; }
  .sync span { display: none; }
  .kachel b { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .konfetti { display: none; }
}
