[hidden] { display: none !important; }

:root {
  --teal: #7c3aed;        /* Primärfarbe LearnIt (Violett), zugleich theme-color */
  --teal-dark: #6d28d9;
  --teal-light: #ede9fe;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --ink: #1f2937;
  --muted: #6b7280;
  --bg: #f5f3ff;
  --card: #ffffff;
  --line: #e5e7eb;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100dvh;
}
button, a, select, input { -webkit-tap-highlight-color: transparent; font: inherit; }

#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; }
.view {
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(96px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }
.hello { color: var(--teal-dark); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.hint { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--red); font-size: 0.9rem; }
.banner { background: var(--teal-light); border-radius: var(--radius); padding: 12px; }
.version { text-align: center; font-size: 0.8rem; }
.loading { text-align: center; color: var(--muted); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row:first-child { border-top: 0; }
.grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.avatar { font-size: 1.6rem; }
/* flex-basis: 100% erzwingt eine eigene Zeile unter dem Titel (.grow) — sonst kann .grow bei
   wenigen, aber langen Knöpfen (z. B. nur „Bearbeiten" + „Spitzname zurücksetzen" beim eigenen
   Konto) auf wenige Pixel zusammengedrückt werden (Buchstabe für Buchstabe untereinander), weil
   overflow-wrap: anywhere seine Mindestbreite auf ein einzelnes Zeichen senkt. Gleiches Muster wie
   .gs-actions (1.1.1) — Fund beim Browser-Check von Task 10, 1.7.0. */
.actions { display: flex; gap: 6px; flex-wrap: wrap; flex-basis: 100%; }

/* Admin „🌍 Segmente" (1.1.1, Spec §4.2): Knöpfe in eigener Zeile unter dem Titel, Titel nie zusammengedrückt */
.gs-row .grow { flex: 1 1 12rem; }
.gs-row .gs-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; }
.gs-row .gs-actions .btn { flex: 0 0 auto; }
.card > .hint:first-child { margin-top: 0; }

label { display: block; font-size: 0.9rem; color: var(--muted); margin: 12px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
input:not([type="checkbox"]), select {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
select.small { width: auto; padding: 6px 8px; margin: 0; }

.btn {
  display: block;
  width: 100%;
  padding: 14px;
  margin-top: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--teal-light);
  color: var(--teal-dark);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary { background: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.ghost { background: transparent; color: var(--teal-dark); }
.btn.danger { background: #fee2e2; color: var(--red); }
.btn.small { display: inline-block; width: auto; padding: 6px 10px; margin: 0; font-size: 0.85rem; }
.subtle-link { color: var(--muted); font-size: 0.9rem; }

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1;
  border: 0;
  background: none;
  padding: 8px 0 10px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  cursor: pointer;
  min-width: 0; /* 1.4.0: fünf Tabs (Admin) passen auch bei 360 px ohne Querscrollen */
}
.tab > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab.active { color: var(--teal); font-weight: 600; }
.tab-icon { font-size: 1.4rem; }

.login-page {
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.12);
}
.login-card h1 { text-align: center; margin: 0; color: var(--teal-dark); }
.logo { font-size: 3rem; text-align: center; }
.subtitle { text-align: center; color: var(--muted); margin: 4px 0 8px; }

@media (min-width: 640px) { #app, .login-card { zoom: 1.3; } :root { --app-zoom: 1.3; } }
@media (min-width: 900px) { #app, .login-card { zoom: 1.5; } :root { --app-zoom: 1.5; } }

/* Honeypot-Feld der Registrierung (1.3.0, L5): nicht `hidden` (sonst füllen Bots es nie aus),
   aber für Menschen aus dem Bild — position:absolute nimmt es aus dem Fluss, wirkt sich also
   nie auf 360-px-Layouts oder horizontales Scrollen aus. */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Segmente und Editor (0.2.0) ---------- */
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.topbar h1 { margin: 0; font-size: 1.25rem; min-width: 0; overflow-wrap: anywhere; }
.chev { color: var(--muted); font-size: 1.4rem; }
.kid-row, .seg-row, .asg-row { cursor: pointer; }
.btn[disabled] { opacity: 0.45; cursor: default; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  color: var(--teal-dark);
  cursor: pointer;
}
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }

/* Sprechtempo (Task 8, 1.4.0): Dreier-Schalter + Probehören je Sprache, immer im Fluss (chips
   umbricht schon von Haus aus) — bleibt auch bei 360 px ohne horizontales Scrollen. */
.speech-row { margin-bottom: 16px; }
.speech-row:last-child { margin-bottom: 0; }
.speech-lang { display: block; font-weight: 600; margin-bottom: 6px; }

/* Rangliste (Task 9, 1.7.0, Spec §4.1): Umschalter „Meine Erfolge | 🏆 Rangliste" und
   „Diese Woche | Letzte Woche" wie die übrigen Zweier-/Dreier-Schalter (.chip.on/.time-btn.on) —
   .btn.small ist von Haus aus schon eine helle Pille, „on" füllt sie teal wie überall sonst. */
.seg-switch { display: flex; gap: 8px; margin: 0 0 12px; }
.seg-switch .btn.on { background: var(--teal); color: #fff; }
.rank-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.rank-row.me { background: var(--teal-light); border-radius: 8px; padding: 4px 8px; font-weight: 600; }
.rank-place { min-width: 1.6em; text-align: right; color: var(--muted); }

/* Bücher (1.4.0, M11/M12): Buchwahl je Reihe als umbrechende Chips (.chips bricht schon um) —
   bei 360 px nie Querscrollen; lange Kurznamen dürfen im Chip umbrechen. */
.book-group { margin-bottom: 4px; }
.book-series { margin: 0 0 6px; }
.book-chip { max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.book-draft { font-size: 0.75rem; font-weight: 400; opacity: 0.85; }
.book-sub { margin: -8px 0 16px; }
.card .book-sub { margin: 0 0 8px; }
.user-book { margin: 8px 0; }
/* Varietät (M7): kleines „AE"/„BE" hinter dem Wort, nur Anzeige */
/* Eltern lernen mit (1.4.0, M18): Tab „🎓 Üben" */
.learn-sub { margin: -8px 0 8px; }
.learn-book .book-now { margin: 0 0 8px; }
.learn-actions .btn + .btn { margin-top: 8px; }
.user-learn { margin-top: 2px; }
.variety { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: var(--teal-light); color: var(--teal-dark); vertical-align: middle; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.page-img { display: block; width: 100%; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }

.words { list-style: none; margin: 0; padding: 0; }
.word {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 8px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.word:first-child { border-top: 0; }
.word .de { color: var(--muted); text-align: right; }
.word.in { background: var(--teal-light); }
.word.start, .word.end { background: var(--teal); color: #fff; border-radius: 8px; }
.word.start .de, .word.end .de { color: #fff; }
.word.excluded { background: var(--teal-light); text-decoration: line-through; opacity: 0.5; }

.ed-bar {
  position: sticky;
  bottom: calc(64px + env(safe-area-inset-bottom));
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
  padding: 12px;
}
.ed-bar input { margin-top: 0; }
.ed-bar .error { margin: 0 0 8px; }
.ed-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }

/* 1.4.2: Wortliste nach Seiten statt Seitenbild (Eltern/Kind) */
.ed-disclaimer { margin: -4px 0 8px; }
.ed-page + .ed-page { margin-top: 12px; }
.ed-page-h { font-size: 1rem; margin: 0; padding: 8px 8px 4px; border-bottom: 2px solid var(--line); overflow-wrap: anywhere; }
.ed-ctx { font-weight: 400; }
.ed-unit-h { margin: 10px 0 0; padding: 4px 8px; font-weight: 700; color: var(--teal-dark); overflow-wrap: anywhere; }
.ed-part-h { margin: 6px 0 0; padding: 2px 8px; font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.ed-page .word { overflow-wrap: anywhere; }

/* 1.4.2: Buchwahl — Orientierungsfrage und Hinweis über den Buch-Knöpfen */
.book-q { font-size: 1rem; margin: 0 0 4px; }
p.book-q { font-weight: 600; }
.book-orient { margin: 0 0 10px; }

.zoom { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.9); overflow: auto; cursor: zoom-out; }
.zoom img { display: block; width: 200%; max-width: none; }

/* ---------- Tests (0.3.0) ---------- */
.stars-mini { color: #f59e0b; letter-spacing: 1px; }
.mode-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mode-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  font-weight: 600;
  color: var(--teal-dark);
  cursor: pointer;
}
.mode-tile.off { opacity: 0.45; cursor: default; }
.mode-icon { font-size: 1.6rem; }
.size-btn, .time-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  color: var(--teal-dark);
  cursor: pointer;
}
.size-btn.on, .time-btn.on { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- Auf Zeit (1.2.2) ---------- */
.q-clock { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.q-clock-warn { color: var(--amber); }

.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.q-bar { flex: 1; height: 10px; background: var(--teal-light); border-radius: 999px; overflow: hidden; }
.q-fill { height: 100%; background: var(--teal); transition: width 0.3s; }
.q-card { text-align: center; }
.q-label { color: var(--muted); margin: 0 0 6px; }
.q-prompt { font-size: 1.6rem; font-weight: 700; margin: 8px 0 16px; word-break: break-word; }
.q-back { font-size: 1.4rem; margin: 12px 0; }
.q-row { display: flex; gap: 8px; }
.q-row .btn { flex: 1; }
.q-opt {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-size: 1.05rem;
  cursor: pointer;
}
.q-speak { font-size: 1.2rem; }
.q-retry { color: var(--amber); font-weight: 600; }
.q-hintword { font-family: ui-monospace, Menlo, monospace; font-size: 1.3rem; letter-spacing: 1px; }
.q-feedback { text-align: center; border: 2px solid var(--line); }
.q-feedback.ok { border-color: var(--green); background: #f0fdf4; }
.q-feedback.almost { border-color: var(--amber); background: #fffbeb; }
.q-feedback.wrong { border-color: var(--teal-light); background: #faf5ff; }
.q-title { font-size: 1.3rem; font-weight: 700; margin: 0 0 8px; }
.q-solution { font-size: 1.15rem; }
#q-input { text-align: center; font-size: 1.2rem; }

.result { text-align: center; }
.stars { font-size: 2.6rem; letter-spacing: 4px; margin: 8px 0; }
.star { color: var(--line); display: inline-block; transform: scale(0.6); animation: star-in 0.4s forwards; }
.star.on { color: #f59e0b; }
.star:nth-child(2) { animation-delay: 0.15s; }
.star:nth-child(3) { animation-delay: 0.3s; }
.star:nth-child(4) { animation-delay: 0.45s; }
.star:nth-child(5) { animation-delay: 0.6s; }
@keyframes star-in { to { transform: scale(1); } }
.praise { font-size: 1.15rem; font-weight: 600; color: var(--teal-dark); }

/* ---------- Belohnung (0.4.0) ---------- */
.level-card .level-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.level-bar, .badge-bar { height: 10px; background: var(--teal-light); border-radius: 999px; overflow: hidden; margin: 8px 0 4px; align-self: stretch; width: 100%; }
.level-fill, .badge-fill { height: 100%; background: var(--teal); }
.streak { font-weight: 700; color: var(--amber); margin: 6px 0 0; }
.badge-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.badge-tile { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 12px 8px; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); overflow-wrap: anywhere; }
.badge-medal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 50%; font-size: 1.8rem;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}
.bronze .badge-medal { background: radial-gradient(circle at 35% 30%, #f1c08b, #cd7f32); }
.silver .badge-medal { background: radial-gradient(circle at 35% 30%, #ffffff, #b8bcc4); }
.gold .badge-medal { background: radial-gradient(circle at 35% 30%, #fff3b0, #f5b400); }
.badge-tile.locked { opacity: 0.55; }
.badge-tile.locked .badge-medal { filter: grayscale(1); }
.w-status.learned { color: var(--green); font-weight: 700; }
.w-status.hard { color: var(--amber); }
.r-praise { font-size: 1.1rem; font-weight: 600; color: var(--teal-dark); margin: 6px 0; }
.r-total { font-size: 1.4rem; font-weight: 800; color: var(--teal); margin: 0 0 4px; text-align: center; }
.r-badge, .r-levelup { text-align: center; }
.r-badge .badge-medal { margin: 6px auto; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 30; }
.confetti span {
  position: absolute; top: -12px; width: 10px; height: 14px; border-radius: 2px;
  animation: confetti-fall 2.4s ease-in forwards;
}
.confetti span:nth-child(3n) { background: #f59e0b; }
.confetti span:nth-child(3n + 1) { background: var(--teal); }
.confetti span:nth-child(3n + 2) { background: #10b981; }
.confetti span:nth-child(1) { left: 5%; animation-delay: 0s; }
.confetti span:nth-child(2) { left: 12%; animation-delay: 0.2s; }
.confetti span:nth-child(3) { left: 19%; animation-delay: 0.4s; }
.confetti span:nth-child(4) { left: 27%; animation-delay: 0.1s; }
.confetti span:nth-child(5) { left: 34%; animation-delay: 0.5s; }
.confetti span:nth-child(6) { left: 41%; animation-delay: 0.3s; }
.confetti span:nth-child(7) { left: 49%; animation-delay: 0.6s; }
.confetti span:nth-child(8) { left: 56%; animation-delay: 0.15s; }
.confetti span:nth-child(9) { left: 63%; animation-delay: 0.45s; }
.confetti span:nth-child(10) { left: 70%; animation-delay: 0.25s; }
.confetti span:nth-child(11) { left: 77%; animation-delay: 0.55s; }
.confetti span:nth-child(12) { left: 84%; animation-delay: 0.05s; }
.confetti span:nth-child(13) { left: 90%; animation-delay: 0.35s; }
.confetti span:nth-child(14) { left: 96%; animation-delay: 0.65s; }
@keyframes confetti-fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0.2; } }
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .star { animation: none; transform: none; }
}

.cert-page {
  background: #fff;
  padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
.cert {
  max-width: 900px; margin: 0 auto; padding: 40px 32px; text-align: center;
  border: 10px double #f5b400; border-radius: 12px; background: #fffdf5;
}
.cert-top { letter-spacing: 6px; text-transform: uppercase; color: var(--muted); }
.cert-medal { font-size: 4rem; }
.cert-name { font-size: 2.4rem; color: var(--teal-dark); margin: 8px 0; }
.cert-title { font-size: 1.8rem; margin: 8px 0; }
.cert-date, .cert-sign { color: var(--muted); }
.cert-actions { max-width: 900px; margin: 16px auto; display: flex; gap: 8px; }
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  .cert-actions { display: none; }
  .cert { border-color: #d4a200; }
}

/* ---------- Zusatzübungen (0.5.0) ---------- */
.q-sentence { font-size: 1.2rem; line-height: 1.5; margin: 8px 0 12px; }
.q-gap { display: inline-block; min-width: 3.5em; border-bottom: 3px solid var(--teal); color: transparent; }
.scr-slots, .scr-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0 12px; max-width: 100%; }
.scr-slots { column-gap: 16px; row-gap: 8px; }
/* F1: ein einzelnes langes Wort (z. B. 20 Buchstaben ohne Leerzeichen) darf in sich umbrechen,
   statt die Karte zu sprengen — min-width: 0 verhindert, dass der Flex-Container sich am
   Inhalt "min-content" aufbläht und dadurch horizontal scrollt. */
.scr-word { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 3px; row-gap: 6px; max-width: 100%; min-width: 0; }
.scr-slot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 38px; border-bottom: 3px solid var(--line);
  font-size: 1.3rem; font-weight: 700; color: var(--teal-dark);
}
.scr-slot.filled { border-color: var(--green); }
.scr-slot.fixed { width: auto; min-width: 8px; border-color: transparent; }
/* F2: Platz für den Fehltipp-Hinweis fest reservieren — die Zeile ist immer im DOM, wird aber
   nur bei einem Fehltipp sichtbar, damit "Lösung zeigen" darunter nicht springt. */
.scr-oops { min-height: 1.4em; }
.scr-oops.invisible { visibility: hidden; }
.scr-tile, .pair-tile {
  min-width: 48px; min-height: 48px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 1.3rem; font-weight: 700; color: var(--teal-dark); cursor: pointer;
  touch-action: manipulation;
}
.scr-tile.used { visibility: hidden; }
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.pair-col { display: flex; flex-direction: column; gap: 8px; }
/* F3: lange deutsche Beschriftungen ("Klassenkamerad, Klassenkameradin") sauber trennen statt
   mitten im Wort umzubrechen — lang="de" bzw. lang="en" am Element steuert die Trennregeln. */
.pair-tile { font-size: 1rem; font-weight: 600; overflow-wrap: break-word; hyphens: auto; }
.pair-tile.sel { border-color: var(--teal); background: var(--teal-light); }
.pair-tile.done { opacity: 0.55; border-color: var(--green); cursor: default; }
.shake { animation: shake 0.35s; border-color: var(--amber); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.pair-list .row { justify-content: space-between; }
@media (prefers-reduced-motion: reduce) {
  .shake { animation: none; }
}
/* ---------- Spielarten (1.2.3) ---------- */
/* Satzbau-Puzzle: Satzzeile oben, Vorrat darunter; Kacheln wie beim Buchstabensalat, lange
   Wörter brechen in sich um statt die Karte zu sprengen (360 px ohne Querscrollen). */
.bld-line, .bld-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; max-width: 100%; }
.bld-line { min-height: 60px; padding: 6px; margin: 8px 0 12px; border-bottom: 3px dashed var(--line); align-items: center; }
.bld-tiles { margin: 0 0 12px; }
.bld-tile, .bld-placed {
  min-width: 44px; min-height: 48px; max-width: 100%; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-size: 1.1rem; font-weight: 700; color: var(--teal-dark); cursor: pointer;
  overflow-wrap: anywhere; touch-action: manipulation;
}
.bld-placed { border-color: var(--teal); background: var(--teal-light); }
.bld-tile.used { visibility: hidden; }
/* Satz-Diktat: markiertes Wort im zweiten Versuch — Hervorhebung, kein Rot */
.dict-yours { font-size: 1.1rem; line-height: 1.6; overflow-wrap: anywhere; }
.dict-diff { background: #fef3c7; color: var(--ink); border-radius: 4px; padding: 0 3px; box-shadow: inset 0 -2px 0 var(--amber); }
/* Galgenmännchen: 6 Luftballons statt Galgen, Striche je Buchstabe, Tastatur A–Z 7 je Zeile */
.hm-balloons { display: flex; justify-content: center; gap: 4px; font-size: 1.8rem; margin: 4px 0 8px; }
.hm-balloon { display: inline-block; transition: opacity 0.3s; }
.hm-balloon.gone { opacity: 0; }
.hm-balloon.fly { animation: balloon-fly 0.9s ease-in; }
@keyframes balloon-fly {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-60px) rotate(12deg); opacity: 0; }
}
.hm-slots { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 16px; row-gap: 8px; margin: 8px 0 12px; max-width: 100%; }
.hm-word { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 3px; max-width: 100%; min-width: 0; }
.hm-slot {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 36px; border-bottom: 3px solid var(--line);
  font-size: 1.3rem; font-weight: 700; color: var(--teal-dark);
}
.hm-slot.filled { border-color: var(--green); }
.hm-slot.fixed { width: auto; min-width: 8px; border-color: transparent; }
.hm-keys { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin: 0 0 10px; }
.hm-key {
  min-width: 0; min-height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  font-size: 1.1rem; font-weight: 700; color: var(--teal-dark); cursor: pointer; touch-action: manipulation;
}
.hm-key.hit { border-color: var(--green); background: #f0fdf4; color: var(--green); cursor: default; }
.hm-key.miss { opacity: 0.4; cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .hm-balloon.fly { animation: none; }
}

/* F6: #q-quit optisch klein, aber mit voller Tippfläche ≥ 44×44 px */
#q-quit { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Eltern-Ansicht und Aufträge (0.6.0) ---------- */
.kid-line { display: block; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.asg-status { display: block; color: var(--muted); margin-top: 2px; }
.asg-status.overdue { color: var(--amber); }
.asg-item.done strong { color: var(--muted); }
.asg-item strong { overflow-wrap: anywhere; }
.asg-del, #kid-tests-all { min-height: 44px; }
.asg-form { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.asg-form h3 { font-size: 1rem; margin: 0 0 8px; }

/* ---------- Admin: Vokabeln und Konto bearbeiten (0.6.0) ---------- */
textarea {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.voc-row { cursor: pointer; min-height: 44px; }
/* 1.2.1 (Spec §2): 🔊 neben dem Eingabefeld statt darunter */
.voc-field { display: flex; align-items: center; gap: 8px; }
.voc-field input, .voc-field textarea { flex: 1 1 auto; }
.voc-say { flex: 0 0 auto; min-height: 44px; min-width: 44px; }
.voc-tag { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--teal-light); color: var(--teal-dark); }
.voc-tag.hidden-tag { background: #fee2e2; color: var(--red); }
.voc-orig { display: block; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.user-row .actions .btn.small, .user-edit .btn.small, .chip { min-height: 44px; }
.user-edit { flex-basis: 100%; border-top: 1px dashed var(--line); padding-top: 8px; }
.user-edit form { margin-bottom: 8px; }
.seg-few { color: var(--amber); }
.asg-form label.check { min-height: 44px; margin: 0; }
/* Testart im Auftrag (1.5.0): Häkchen zweispaltig, schmal einspaltig; gesperrte (mit Zeit) blass */
.asg-modes-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 12px; }
.asg-mode-opt.off { opacity: 0.45; }
.asg-modes { display: block; }

/* ---------- PWA-Feinschliff (1.0.0) ---------- */
.offline-bar {
  position: sticky; top: 0; z-index: 10; margin: 0;
  padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
  background: #fef3c7; color: #92400e; font-size: 0.9rem; text-align: center;
}
.offline-bar:not([hidden]) ~ .view,
.maint-bar:not([hidden]) ~ .view {
  padding-top: 16px;
}
.install h2 { margin-bottom: 4px; }

/* ---------- Wartungsmodus (1.2.0) ---------- */
.maint-bar {
  position: sticky; top: 0; z-index: 10; margin: 0;
  padding: calc(8px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
  background: var(--teal-light); color: var(--teal-dark); font-size: 0.9rem; text-align: center;
}
.maint-mask { text-align: center; margin-top: 15vh; }
.maint-mask .maint-icon { font-size: 2.5rem; margin: 0 0 8px; }

/* ---------- Wortregen (1.2.3, K9) — kein Rot, kein Game over ---------- */
/* Die Position des Worts nur per transform (rainSync), damit nichts neu gezeichnet werden muss.
   1.4.1 (iPhone-Tastatur): solange Wortregen läuft, setzt app.js (rainFit) html.rain-lock — kein
   Dokument-Scrollen, #app liegt fix genau auf dem sichtbaren Ausschnitt (--rain-top/--rain-h aus
   visualViewport), die Fallfläche füllt den freien Platz, die Eingabe sitzt direkt darunter. */
html.rain-lock, html.rain-lock body { overflow: hidden; overscroll-behavior: none; }
html.rain-lock body { min-height: 0; }
html.rain-lock #app {
  position: fixed;
  left: 0;
  right: 0;
  /* zoom (breite Bildschirme, auch iPhone quer) vergrößert auch top/height — hier herausrechnen */
  top: calc(var(--rain-top, 0px) / var(--app-zoom, 1));
  height: calc(var(--rain-h, 100dvh) / var(--app-zoom, 1));
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto; /* nur bei winzigem Ausschnitt (quer + Tastatur): innen statt der Seite */
  overscroll-behavior: contain;
}
html.rain-lock .view {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
html.rain-lock.rain-kb .view { padding-bottom: 8px; } /* Tastatur offen: kein Home-Balken-Abstand */
/* wenig Höhe (Tastatur offen oder quer): nur Kopf, Fläche, Meldung, Eingabe */
html.rain-compact .view { padding-top: calc(6px + env(safe-area-inset-top)); }
html.rain-compact .q-head { margin-bottom: 6px; }
html.rain-compact .rain-card { padding-top: 8px; padding-bottom: 8px; }
html.rain-compact .rain-card > .q-label, html.rain-compact .rain-filled { display: none; }
html.rain-compact .rain-msg { margin: 2px 0 4px; }
html.rain-lock .q-head { flex: none; }
html.rain-lock .rain-card { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin-bottom: 0; }
html.rain-lock .rain-card > :not(.rain-field) { flex: none; }
html.rain-lock .rain-field { flex: 1 1 auto; height: auto; min-height: 140px; max-height: 420px; }
html.rain-compact .rain-field { min-height: 96px; margin-top: 0; }
.rain-card { padding-bottom: 12px; }
.rain-filled { margin: 0 0 8px; }
.rain-field {
  position: relative;
  height: 260px;
  margin: 4px 0 6px;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(180deg, #ede9fe 0%, #f5f3ff 70%, #ecfeff 100%);
  touch-action: manipulation;
}
.rain-word {
  position: absolute;
  top: 4px;
  left: 50%;
  max-width: calc(100% - 16px);
  transform: translate(-50%, 0);
  padding: 6px 12px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(76, 29, 149, 0.15);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  white-space: normal;
  will-change: transform;
}
.rain-word::before { content: '💧 '; }
.rain-word.caught { background: #f0fdf4; color: var(--green); box-shadow: 0 0 0 2px var(--green); animation: rain-pop 0.35s; }
.rain-word.caught::before { content: '☂️ '; }
.rain-word.landed { background: var(--teal-light); color: var(--teal-dark); }
.rain-word.landed::before { content: '🌂 '; }
.rain-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--teal-light); }
.rain-pause {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(245, 243, 255, 0.94);
  font-weight: 600;
  color: var(--teal-dark);
}
.rain-pause p { margin: 0; }
.rain-msg { min-height: 1.4em; margin: 2px 0 6px; font-weight: 600; color: var(--teal-dark); overflow-wrap: anywhere; }
.rain-form input { width: 100%; font-size: 1.2rem; text-align: center; }
/* eigene scale-Eigenschaft: setzt sich auf das inline gesetzte transform drauf, statt es zu ersetzen */
@keyframes rain-pop { 50% { scale: 1.08; } }
@media (prefers-reduced-motion: reduce) {
  .rain-word.caught { animation: none; }
  .rain-word { will-change: auto; }
}

/* ---------- Registrierung (1.3.0): Kind anlegen, Kind-Konto, Codes, Sperren ---------- */
#kid-new { margin-top: 12px; }
.notice { color: var(--green); font-size: 0.9rem; font-weight: 600; }
.kid-account form { margin-bottom: 8px; }
.kid-account .btn.small, .code-row .btn.small, .inline-confirm .btn.small { min-height: 44px; }
.reg-hint { color: var(--amber); margin: 4px 0 0; }
.code-row { align-items: flex-start; }
.code-row .grow { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.code-row.fresh { background: var(--teal-light); border-radius: 12px; padding: 10px; border-top: 0; }
.code-fresh { margin: 0; font-weight: 700; color: var(--teal-dark); }
.code-head { overflow-wrap: anywhere; }
.code-status { display: inline-block; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.code-status.open { background: #dcfce7; color: var(--green); }
.code-status.expired { background: #fef3c7; color: #92400e; }
.code-status.used { background: var(--line); color: var(--muted); }
.code-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 100%; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.25rem; font-weight: 700; letter-spacing: 0.08em;
  background: #fff; border: 2px solid var(--teal); color: var(--ink);
  border-radius: 8px; padding: 4px 10px; white-space: nowrap; user-select: all; -webkit-user-select: all;
}
.code-msg {
  margin: 0; max-width: 100%; padding: 6px 8px; border: 1px dashed var(--line); border-radius: 8px;
  background: #fff; overflow-wrap: anywhere; user-select: all; -webkit-user-select: all;
}
.inline-confirm { flex-basis: 100%; max-width: 100%; background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 8px 10px; }
.inline-confirm p { margin: 0 0 8px; color: var(--ink); overflow-wrap: anywhere; }
.user-lock { color: var(--red); font-weight: 600; }
/* Admin „🏫 Klassen" (Task 10, 1.7.0) */
.class-row.archived { opacity: 0.6; }
.class-row .actions .btn.small, .class-row .limit-form .btn.small, .class-extra .btn.small { min-height: 44px; }
.limit-form { flex-basis: 100%; max-width: 100%; align-items: flex-end; gap: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.class-extra { border-top: 0; padding-top: 0; }
.promote-form, .class-detail { flex-basis: 100%; max-width: 100%; background: var(--teal-light); border-radius: 12px; padding: 10px; }
.class-detail .rank-card { background: #fff; margin-top: 8px; }
.user-origin { overflow-wrap: anywhere; }

/* Nachrichten (1.7.1) */
.tab-icon { position: relative; }
.tab-dot { position: absolute; top: 0; right: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.tab-count { position: absolute; top: -4px; right: -16px; min-width: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: 0.7rem; line-height: 18px; font-weight: 600; box-sizing: border-box; }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0; }
.msg-count.over { color: var(--red); font-weight: 600; }
.msg-new { color: var(--red); font-weight: 600; }
.msg-sent { color: var(--green); font-weight: 600; }
.msg-reply { border-left: 3px solid var(--teal-light); padding-left: 10px; margin: 8px 0; }
.msg-item, .am-item { padding: 10px 0; border-top: 1px solid var(--line); }
.msg-item.done, .am-item.done { opacity: 0.75; }
#msg-text, .am-reply textarea { width: 100%; box-sizing: border-box; }
.am-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.am-context { margin: 6px 0; }

/* Einführung (1.7.1) */
#tour-layer { position: fixed; inset: 0; z-index: 50; }
.tour-backdrop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(31, 41, 55, 0.55); box-sizing: border-box; }
.tour-card { width: 100%; max-width: 420px; text-align: center; margin: 0; }
.tour-emoji { font-size: 3rem; line-height: 1.2; }
.tour-steps { display: flex; gap: 6px; justify-content: center; margin: 12px 0; }
.tour-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tour-dot.on { background: var(--teal); }
.tour-actions { display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.tour-actions .btn.primary { width: auto; margin: 0; }
