/* ════════════════════════════════════════════════════════════
   AUSSEHEN des Quiz (früher <style> in index.html)
   ════════════════════════════════════════════════════════════ */

:root {
  /* Zauberschule: Pergament, Tinte, Gold, Kerzenschein */
  --pergament:      #f2e3c2;
  --pergament-hell: #faf1da;
  --pergament-dunkel: #e2cfa4;
  --tinte:       #2a1c10;
  --tinte-blass: #6b563c;
  --gold:        #c9a227;
  --gold-hell:   #e9cf7a;
  --dunkel:      #150f0c;
  --dunkel-warm: #241a13;
  --correct: #2f7d4f;
  --wrong:   #a32b2b;
  --bg: var(--dunkel);
  --text: var(--tinte);
  --muted: var(--tinte-blass);
  --radius: 10px;
  --c: #7b1f2b;
  --cl: #f0d9d2;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'EB Garamond', Georgia, serif;
  background: var(--dunkel);
  color: var(--pergament);
  min-height: 100vh;
  min-height: 100dvh;
  /* Kerzenschein aus zwei Ecken, dazu ein warmer Schimmer in der Mitte */
  background-image: radial-gradient(circle at 15% 8%,  rgba(201,162,39,0.22) 0%, transparent 42%),
                    radial-gradient(circle at 88% 92%, rgba(180,90,40,0.18) 0%, transparent 45%),
                    radial-gradient(circle at 50% 45%, rgba(90,60,30,0.35) 0%, transparent 65%);
  background-attachment: fixed;
  /* iOS: nichts unter der Home-Leiste verstecken */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           calc(env(safe-area-inset-bottom) + 30px) env(safe-area-inset-left);
}

/* Keine Tipp-Verzögerung, kein Doppeltipp-Zoom, kein graues Blitzen,
   kein Text-Markieren beim Langdruck (iOS) */
button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}

.wrap { max-width: 480px; margin: 0 auto; padding: 0 14px; }

/* ── KOPFZEILE ───────────────────────────── */
header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0 10px;
}
/* iPhone mit Notch/Dynamic Island: iOS verwischt unter der Statusleiste einen
   Streifen, der etwas weiter reicht als der Sicherheitsabstand. Die Kopfzeile
   rückt deshalb nur dort ein Stück tiefer. min(…, 1px) * 28 ergibt 28px, wenn
   es einen Abstand gibt, sonst 0 – Computer und ältere Handys bleiben gleich. */
@supports (padding-top: env(safe-area-inset-top)) {
  header { padding-top: calc(12px + min(env(safe-area-inset-top), 1px) * 28); }
}

.back-btn {
  width: 40px; height: 40px;
  flex-shrink: 0;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: var(--dunkel-warm);
  color: var(--gold-hell);
  box-shadow: 0 0 12px rgba(201,162,39,0.25);
  font-size: 1.25rem;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
}
.back-btn:active { transform: scale(0.92); }
body.quiz .back-btn, body.konto .back-btn { display: flex; }

header h1 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #e9cf7a, #c9a227 55%, #8c6b14);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 18px rgba(201,162,39,0.25);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── STARTMENÜ ───────────────────────────── */
body.quiz #menu, body.konto #menu, body.konto #quiz { display: none; }
body:not(.quiz) #quiz { display: none; }
body:not(.konto) #konto { display: none; }

#quiz { animation: reinRechts 0.25s ease; }
@keyframes reinRechts {
  from { opacity: 0; transform: translateX(14px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Weiter üben: zweitrangig neben «Heute fällig», darum schlank */
.resume {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 1px solid rgba(201,162,39,0.45);
  border-radius: var(--radius);
  padding: 9px 14px;
  margin-bottom: 8px;
  color: var(--gold-hell);
  background: rgba(36,26,19,0.75);
}
.resume:active { transform: scale(0.985); }
.resume:disabled { opacity: 0.6; }               /* Meine Fehler, solange es keine gibt */
.resume:disabled:active { transform: none; }
.resume .emoji { font-size: 1.15rem; }
.resume .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resume .t b {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold-hell);
}
.resume .t span { font-size: 0.84rem; font-weight: 500; color: #b9a37a; }
.resume .t span::before { content: ' · '; }
.resume .go { font-size: 1.05rem; color: var(--gold); }

/* ── WOCHENZIEL: im Menü an der Stelle des Titels, links neben den Flaggen ── */
body:not(.quiz):not(.konto) header h1 { display: none; }
body.quiz .woche, body.konto .woche { display: none; }
.woche {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  padding-left: 2px;
  font-size: 0.86rem;
  line-height: 1.3;
  color: #b9a37a;
}
.woche .w-sprachen { display: inline-flex; gap: 12px; white-space: nowrap; }
.woche .w-sp { display: inline-flex; align-items: baseline; gap: 4px; }
.woche .w-rauten { font-size: 0.8rem; letter-spacing: 3px; color: var(--gold); }
.woche .w-sp.fertig .w-rauten { color: var(--gold-hell); text-shadow: 0 0 6px rgba(233,207,122,0.6); }
.woche .w-txt { white-space: nowrap; }
.woche b { color: var(--gold-hell); font-weight: 600; }
/* «heute noch 4 Fragen» als zweite, leisere Zeile */
.woche .w-heute { flex-basis: 100%; font-size: 0.8rem; font-style: italic; }

/* ── SPRACHWAHL: zwei Flaggen rechts in der Kopfzeile ── */
.sprachwahl { display: flex; gap: 6px; flex-shrink: 0; }
.sprachwahl:empty, body.quiz .sprachwahl, body.konto .sprachwahl { display: none; }
.sprachwahl button {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid transparent;
  border-radius: 50%;
  background: none;
  font-size: 1.3rem;
  line-height: 1;
  opacity: 0.45;
  filter: saturate(0.5);
}
.sprachwahl button.aktiv {
  opacity: 1;
  filter: none;
  border-color: var(--gold);
  background: var(--dunkel-warm);
  box-shadow: 0 0 12px rgba(201,162,39,0.3);
}
.sprachwahl button:active { transform: scale(0.92); }
.sprachwahl button:focus-visible { outline: 2px solid var(--gold-hell); outline-offset: 2px; }

/* ── MENÜ-ABSCHNITTE: Jetzt üben · 5. Klasse · Grundlagen · Frühere Schuljahre ── */
.abschnitt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 24px 2px 8px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #8f7a55;
}
.abschnitt::after { content: ''; flex: 1; height: 1px; background: rgba(201,162,39,0.2); }
#jetzt-titel { margin-top: 6px; }

/* Ein früheres Schuljahr: Zeile wie «Weiter üben», mit den Sternen des Jahres */
.jahr-sterne { color: var(--gold); font-size: 0.92rem; letter-spacing: 1px; white-space: nowrap; }

/* Seite eines früheren Schuljahrs: «Jetzt üben» weg, oben zurück */
#menu.jahr #jetzt-titel,
#menu.jahr #heute-btn,
#menu.jahr #resume-btn,
#menu.jahr #jetzt-decks { display: none !important; }
.zurueck {
  min-height: 44px;
  padding: 8px 2px;
  border: none;
  background: none;
  color: var(--gold-hell);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 1px;
}
#menu.jahr .abschnitt { margin-top: 4px; }

/* ── HEUTE FÄLLIG: das eine goldene Stück im Menü ── */
.heute {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 1px solid #f3dc9a;
  border-radius: var(--radius);
  padding: 13px 16px;
  margin-bottom: 10px;
  color: #2a1c0c;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(255,246,214,0.75) 0%, transparent 55%),
    linear-gradient(160deg, #e6c668 0%, #c9a227 60%, #9d7a16 100%);
  box-shadow: inset 0 0 0 1px rgba(110,80,10,0.35), 0 4px 18px rgba(0,0,0,0.5), 0 0 24px rgba(201,162,39,0.22);
}
.heute:active { transform: scale(0.985); }
.heute .emoji { font-size: 1.7rem; }
.heute .t { flex: 1; min-width: 0; }
.heute .t b {
  display: block;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}
.heute .t span { font-size: 0.88rem; font-weight: 600; color: #4a3410; }
.heute .go { font-size: 1.2rem; }
/* Erledigt: tritt zurück, braucht keinen Platz mehr */
.heute.erledigt {
  padding: 8px 14px;
  color: #b9a37a;
  background: none;
  border: 1px dashed rgba(201,162,39,0.35);
  box-shadow: none;
}
.heute.erledigt .emoji { font-size: 1.15rem; }
.heute.erledigt .t b { display: inline; font-size: 0.82rem; color: var(--gold-hell); }
.heute.erledigt .t span { font-size: 0.84rem; font-weight: 500; font-style: italic; color: #b9a37a; }
.heute.erledigt .t span::before { content: ' · '; font-style: normal; }
.heute.erledigt:active { transform: none; }

/* Zugeklappte Gruppen rücken zusammen, offene behalten Luft */
.group { margin-bottom: 14px; }
.group.closed { margin-bottom: 0; }

.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  background: none;
  border: none;
  padding: 8px 4px;
  text-align: left;
}
.group-head .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.group-head .title {
  flex: 1;
  min-width: 0;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-head .chev { font-size: 0.7rem; color: #9c7f4e; transition: transform 0.2s ease; }

/* Sterne pro Unité in der Kopfzeile; antippen zeigt die Etappen */
.sterne {
  display: inline-flex;
  gap: 1px;
  padding: 4px 6px;
  margin: -4px 0;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}
.sterne i { font-style: normal; color: #6e5a37; }
.sterne i.voll { color: var(--gold); text-shadow: 0 0 6px rgba(201,162,39,0.45); }
.sterne.krone { font-size: 1.15rem; }
.sterne:focus-visible { outline: 2px solid var(--gold-hell); outline-offset: 1px; }
.etappen[hidden] { display: none; }
.etappen {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: var(--radius);
  background: rgba(36,26,19,0.75);
  font-size: 0.86rem;
  line-height: 1.35;
  color: #b9a37a;
}
.etappe { display: flex; gap: 8px; padding: 3px 0; }
.etappe .e-stern { width: 1.2em; flex-shrink: 0; text-align: center; color: #6e5a37; }
.etappe.ok .e-stern { color: var(--gold); }
.etappe b { color: var(--gold-hell); font-weight: 600; }
.etappe em { display: block; font-size: 0.8rem; color: #8f7a55; }
.etappe.krone-zeile { margin-top: 4px; padding-top: 7px; border-top: 1px solid rgba(201,162,39,0.2); }
.etappe.krone-zeile:not(.ok) { opacity: 0.6; }

.result-screen p.stern-zeile { color: var(--gold-hell); }
.result-screen p.krone-zeile { font-size: 1.1rem; color: var(--gold); }
.group.closed .chev { transform: rotate(-90deg); }
.group.closed .deck-list { display: none; }

.deck-list { display: flex; flex-direction: column; gap: 8px; }

/* Deck-Karte = Pergamentstreifen mit Wachssiegel */
.deck {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  text-align: left;
  color: var(--tinte);
  background:
    linear-gradient(115deg, rgba(255,255,255,0.35) 0%, transparent 35%),
    radial-gradient(ellipse at 80% 120%, rgba(120,80,30,0.14) 0%, transparent 60%),
    var(--pergament);
  border: 1px solid var(--pergament-dunkel);
  border-left: 5px solid var(--dc, #7b1f2b);
  border-radius: 4px;
  padding: 12px 14px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.45);
}
.deck:active { transform: scale(0.985); box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
@media (hover: hover) {
  .deck:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.55), 0 0 0 1px var(--gold); }
}
.deck.leer { opacity: 0.42; }
.deck.leer:active { transform: none; }

.deck .icon {
  width: 38px; height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--dc, #7b1f2b);
  border: 2px solid var(--gold);
  box-shadow: inset 0 1px 3px rgba(255,255,255,0.25), 0 1px 3px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
}
.deck .txt { flex: 1; min-width: 0; }
.deck .txt b {
  display: block;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--tinte);
}
.deck .txt span { font-size: 0.8rem; font-weight: 500; font-style: italic; color: var(--tinte-blass); }
.deck .ring {
  flex-shrink: 0;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  color: #7a5c1e;
  border-radius: 50%;
  /* Gold bis --p; der helle Bogen bis --q wird zurzeit nicht genutzt (--q = --p) */
  background: conic-gradient(
    #b8901c calc(var(--p, 0) * 1%),
    rgba(184,144,28,0.4) 0 calc(var(--q, 0) * 1%),
    rgba(120,90,40,0.18) 0);
  position: relative;
}
.deck .ring.zahl { font-size: 0.78rem; }
.deck .ring::before {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--pergament);
  border-radius: 50%;
}
.deck .ring i { position: relative; font-style: normal; }

.hinweis {
  margin-top: 22px;
  text-align: center;
  font-size: 0.76rem;
  font-style: italic;
  color: #7a6748;
}

/* Version ganz unten, kaum sichtbar */
.version {
  margin-top: 10px;
  text-align: center;
  font-size: 0.66rem;
  color: #5e4f37;
  letter-spacing: 0.3px;
}

/* ── SPIELER-LEISTE ──────────────────────── */
.player-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.level-badge {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--gold-hell);
  white-space: nowrap;
}
.xp-bar-wrap {
  flex: 1;
  background: rgba(120,90,40,0.25);
  border: 1px solid rgba(201,162,39,0.35);
  border-radius: 50px;
  height: 8px;
  overflow: hidden;
  min-width: 50px;
}
.xp-bar-fill {
  height: 100%;
  border-radius: 50px;
  background: linear-gradient(90deg, #8c6b14, #e9cf7a);
  box-shadow: 0 0 8px rgba(233,207,122,0.6);
  transition: width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.xp-label { font-size: 0.72rem; font-weight: 600; color: #9c7f4e; white-space: nowrap; }

/* ── MODUS-LEISTE ────────────────────────── */
.mode-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.modes {
  display: flex;
  border-radius: 50px;
  border: 1.5px solid rgba(201,162,39,0.45);
  background: rgba(36,26,19,0.8);
  overflow: hidden;
}
.mode-btn {
  min-height: 38px;
  padding: 6px 12px;
  border: none;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b9a37a;
  white-space: nowrap;
}
.mode-btn.active {
  background: linear-gradient(180deg, #e9cf7a, #c9a227);
  color: #2a1c10;
  font-weight: 700;
  border-radius: 50px;
}

.toggle-wrap { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.toggle-wrap input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(120,90,40,0.45);
  border: 1px solid rgba(201,162,39,0.35);
  border-radius: 50px;
  transition: background 0.25s;
  cursor: pointer;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: var(--pergament-hell);
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-wrap input:checked + .toggle-slider { background: linear-gradient(180deg, #e9cf7a, #c9a227); }
.toggle-wrap input:checked + .toggle-slider::before { transform: translateX(20px); }
.autoread-icon { font-size: 0.95rem; }

/* ── FORTSCHRITT ─────────────────────────── */
.progress-bar-wrap {
  background: rgba(120,90,40,0.25);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 50px;
  height: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 50px;
  transition: width 0.4s ease;
  background: linear-gradient(90deg, #8c6b14, #e9cf7a);
}
.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  color: #9c7f4e;
  font-weight: 600;
  margin-bottom: 18px;
}

/* ── KARTE ───────────────────────────────── */
/* Quiz-Karte = aufgeschlagenes Pergament */
.card {
  color: var(--tinte);
  background:
    linear-gradient(125deg, rgba(255,255,255,0.4) 0%, transparent 30%),
    radial-gradient(ellipse at 15% 100%, rgba(120,80,30,0.13) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 0%, rgba(120,80,30,0.1) 0%, transparent 50%),
    var(--pergament);
  border: 1px solid var(--pergament-dunkel);
  border-top: 4px solid var(--c);
  border-radius: var(--radius);
  padding: 30px 22px 26px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0,0,0,0.55), inset 0 0 40px rgba(180,140,80,0.15);
  animation: slideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card-label {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #8a6d3f;
  margin-bottom: 10px;
}

.card-word-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
}
.card-word {
  /* Nicht Cinzel: die kennt nur Grossbuchstaben, hier zählt Gross-/Kleinschreibung */
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--tinte);
}

.speak-btn {
  background: rgba(255,255,255,0.35);
  border: 1.5px solid var(--pergament-dunkel);
  border-radius: 50%;
  width: 40px; height: 40px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
  color: var(--tinte-blass);
}
.speak-btn:active { border-color: var(--c); background: var(--cl); color: var(--c); }
.speak-btn.speaking {
  border-color: var(--c);
  background: var(--cl);
  color: var(--c);
  animation: speakPulse 0.6s ease-in-out infinite alternate;
}
@keyframes speakPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.15); }
}

/* ── ANTWORTEN ───────────────────────────── */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.ans-btn {
  min-height: 54px;
  padding: 13px 10px;
  border-radius: 6px;
  border: 1.5px solid var(--pergament-dunkel);
  background: linear-gradient(180deg, var(--pergament-hell), #f0e0be);
  color: var(--tinte);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  transition: all 0.15s ease;
  line-height: 1.3;
  box-shadow: 0 1px 2px rgba(90,60,20,0.18);
}
.ans-btn:active:not(:disabled) { border-color: var(--gold); background: var(--cl); }
@media (hover: hover) {
  .ans-btn:hover:not(:disabled) { border-color: var(--gold); background: var(--cl); }
}
.ans-btn.correct {
  background: #d8e8cf;
  border-color: var(--correct);
  color: #1e5233;
  box-shadow: 0 0 12px rgba(47,125,79,0.35);
}
.ans-btn.wrong {
  background: #eed6d1;
  border-color: var(--wrong);
  color: #7d1f1f;
}
.ans-btn:disabled { cursor: default; }

/* ── RECHTSCHREIBUNG: Buchstaben ordnen ──── */
.ordnen { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.luecken {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 16px;          /* Abstand zwischen Wörtern */
}
.l-wort { display: flex; gap: 3px; align-items: flex-end; }
.luecke {
  width: 26px; height: 36px;
  padding: 0;
  border: none;
  border-bottom: 2px solid var(--tinte-blass);
  background: rgba(255,255,255,0.35);
  border-radius: 4px 4px 0 0;
  color: var(--tinte);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1;
}
.luecke.voll { background: var(--pergament-hell); }
.luecke.gut { border-bottom-color: var(--correct); color: #1e5233; }
.luecke.schlecht { border-bottom-color: var(--wrong); color: #7d1f1f; background: #eed6d1; }
.fest { font-size: 1.35rem; font-weight: 700; color: var(--tinte-blass); padding: 0 1px 4px; }
.steine { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.stein {
  width: 42px; height: 46px;
  border: 1.5px solid var(--pergament-dunkel);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--pergament-hell), #f0e0be);
  color: var(--tinte);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 2px 0 #c9b48a;
}
.stein:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.stein:disabled { opacity: 0.2; box-shadow: none; }
.stein.weg { display: none; }
/* Wortweise: das Wort, an dem sie gerade ist */
.l-wort.aktiv .luecke { border-bottom-color: var(--gold); background: rgba(201,162,39,0.18); }
/* Ausgewählte Lücke: hier landet der nächste Stein */
.luecke.cursor {
  border-bottom: 3px solid #a8831c;
  background: rgba(201,162,39,0.38);
  box-shadow: inset 0 0 0 1.5px #c9a227;
}
.zurueck-btn {
  min-width: 64px; min-height: 40px;
  border: 1px solid var(--pergament-dunkel);
  border-radius: 20px;
  background: transparent;
  color: var(--tinte-blass);
  font-size: 1.1rem;
}
.zurueck-btn:disabled { opacity: 0.3; }

/* ── RECHTSCHREIBUNG: selbst schreiben ───── */
.schreiben { display: flex; flex-direction: column; gap: 12px; }
.schreiben input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--pergament-dunkel);
  border-radius: 8px;
  background: var(--pergament-hell);
  color: var(--tinte);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.3rem;      /* ab 16px zoomt iOS beim Antippen nicht hinein */
  font-weight: 600;
  text-align: center;
}
.schreiben input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,0.25); }
.schreiben input.gut { border-color: var(--correct); background: #d8e8cf; }
.schreiben input.fast { border-color: #c27c2c; background: #f3e2c7; }
.schreiben input.schlecht { border-color: var(--wrong); background: #eed6d1; }
.akzente { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.akzent {
  min-width: 38px; height: 40px;
  border: 1px solid var(--pergament-dunkel);
  border-radius: 6px;
  background: var(--pergament-hell);
  color: var(--tinte);
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
}
.akzent:disabled { opacity: 0.35; }
.pruefen-btn {
  min-height: 48px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, #e9cf7a, #c9a227);
  color: #2a1c10;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
  font-weight: 700;
}
.pruefen-btn:disabled { opacity: 0.4; }
.loesung:empty { display: none; }
.loesung { text-align: center; }
.loesung span { display: block; font-size: 0.82rem; font-style: italic; color: var(--tinte-blass); }
.loesung b { font-size: 1.35rem; letter-spacing: 0.02em; color: #1e5233; }
.loesung mark { background: #f6d58a; color: #7d1f1f; border-radius: 2px; padding: 0 1px; }
.feedback.fast { color: #a0601d; }

/* ── RÜCKMELDUNG ─────────────────────────── */
.feedback {
  margin-top: 18px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  min-height: 34px;
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}
.feedback.correct { color: #2f7d4f; }
/* Stufe des Wortes nach der Antwort */
.stufe { min-height: 1.3em; margin-top: 2px; text-align: center; font-size: 0.82rem; font-weight: 600; color: var(--tinte-blass); }
.stufe .rauten { letter-spacing: 3px; color: #a8831c; }
.stufe.sitzt { color: #2f7d4f; }
.result-screen p.aufstieg { margin-bottom: 8px; font-style: normal; font-weight: 600; color: var(--gold-hell); }
.feedback.wrong   { color: #a32b2b; }

.next-btn-wrap { display: flex; justify-content: center; margin: 14px auto 0; }
.next-btn {
  position: relative;
  min-height: 46px;
  padding: 11px 28px;
  border-radius: 50px;
  border: 1.5px solid var(--gold);
  background: linear-gradient(180deg, #3a2418, #241a13);
  color: var(--gold-hell);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
  box-shadow: 0 3px 12px rgba(0,0,0,0.4), 0 0 14px rgba(201,162,39,0.2);
  overflow: hidden;
}
.next-btn:active { transform: translateY(1px); }
.next-btn.hidden { display: none; }
.next-btn .countdown-fill {
  position: absolute;
  top: 0; right: 0;
  height: 100%; width: 100%;
  background: rgba(201,162,39,0.3);
  transform-origin: right center;
  border-radius: 50px;
}
.next-btn.counting .countdown-fill {
  animation: drainLeft var(--countdown-dur, 2s) linear forwards;
}
@keyframes drainLeft {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
.next-btn span { position: relative; z-index: 1; }

/* ── ERGEBNIS ────────────────────────────── */
.result-screen { text-align: center; padding: 30px 10px; position: relative; animation: slideIn 0.4s ease; }
.result-screen h2 {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-hell);
  margin-bottom: 10px;
  animation: fadeSlideUp 0.5s ease 0.2s both;
}
.result-score {
  font-family: 'Cinzel', Georgia, serif;
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--gold);
  margin: 8px 0 18px;
  text-shadow: 0 0 20px rgba(201,162,39,0.35);
  animation: fadeSlideUp 0.5s ease 0.35s both;
}
.result-screen p { color: #b9a37a; font-size: 1rem; font-style: italic; margin-bottom: 22px; }
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(15px); }
  to   { opacity: 1; transform: translateY(0); }
}
.stars {
  font-size: 1.5rem;
  margin-bottom: 6px;
  letter-spacing: 6px;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(201,162,39,0.6);
}

.result-btns { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.restart-btn {
  min-height: 52px;
  padding: 14px 38px;
  border-radius: 50px;
  border: 1.5px solid var(--gold);
  background: linear-gradient(180deg, #e9cf7a, #c9a227);
  color: #2a1c10;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.98rem;
  font-weight: 700;
  box-shadow: 0 4px 22px rgba(201,162,39,0.35);
}
.restart-btn:active { transform: translateY(1px); }
.menu-btn {
  min-height: 44px;
  padding: 10px 26px;
  border-radius: 50px;
  border: 1.5px solid rgba(201,162,39,0.4);
  background: transparent;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #b9a37a;
}

/* ── PRÜFUNG ─────────────────────────────── */
/* Menükarte: steht unter den Listen, etwas abgesetzt */
.deck.pruefung { margin-top: 6px; border-left-style: double; border-left-width: 6px; }
.deck.pruefung .icon { background: #3a2418; }
.modus-fest {
  display: inline-flex; align-items: center;
  min-height: 38px; padding: 6px 14px;
  border-radius: 50px;
  background: linear-gradient(180deg, #e9cf7a, #c9a227);
  color: #2a1c10; font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}
/* Gewählt, aber ohne zu verraten, ob es stimmt */
.ans-btn.gewaehlt { border-color: var(--gold); background: #f5e4b0; box-shadow: 0 0 0 2px var(--gold); }
.weiss-nicht {
  align-self: center;
  min-height: 40px; padding: 6px 16px;
  border: none; background: transparent;
  color: var(--tinte-blass); font-size: 0.9rem; font-style: italic;
  text-decoration: underline; text-underline-offset: 3px;
}
.weiss-nicht:disabled { opacity: 0.4; }

.pruefung-start .p-icon { font-size: 3rem; line-height: 1; margin-bottom: 12px; }
.p-regeln {
  list-style: none;
  max-width: 330px; margin: 6px auto 22px; padding: 0;
  text-align: left; color: var(--pergament); font-size: 1.02rem; line-height: 1.35;
}
.p-regeln li { display: flex; gap: 10px; padding: 6px 0; }
.p-regeln li span { width: 1.4em; flex-shrink: 0; text-align: center; }

.result-screen p.p-zahlen { margin-bottom: 14px; }
.p-fehler {
  margin: 22px auto 26px; max-width: 420px;
  text-align: left;
  color: var(--tinte);
  background: var(--pergament);
  border: 1px solid var(--pergament-dunkel);
  border-radius: 4px;
  padding: 14px 14px 10px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.45);
}
.p-fehler h3 { font-family: 'Cinzel', Georgia, serif; font-size: 1rem; margin-bottom: 6px; color: #5a3a1a; }
.p-fehler ul { list-style: none; padding: 0; margin: 0; }
.pf { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; padding: 8px 0; border-top: 1px solid rgba(107,86,60,0.22); }
.pf:first-child { border-top: none; }
.pf-de { grid-column: 1 / -1; font-size: 0.82rem; color: var(--tinte-blass); }
.pf-du { color: #7d1f1f; overflow-wrap: anywhere; }
.pf-du i { color: var(--tinte-blass); font-size: 0.9rem; }
.pf-du em { display: block; font-style: normal; font-size: 0.75rem; color: #a0601d; }
.pf.pf-akzent .pf-du { color: #a0601d; }
.pf-ok { color: #1e5233; font-weight: 700; overflow-wrap: anywhere; }
.pf-ok mark { background: #f6d58a; color: #7d1f1f; border-radius: 2px; padding: 0 1px; }
.result-screen .p-fehler p.p-hinweis { margin: 8px 0 0; font-size: 0.82rem; color: var(--tinte-blass); }

/* ── STERN-ZAUBER ─────────────────────────── */
/* Grundregel: Der Grundzustand ist das Ende jeder Animation. Wer «weniger
   Bewegung» eingestellt hat, sieht so direkt das fertige Bild. */
.zauber {
  position: fixed; inset: 0;
  z-index: 990;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 40%, rgba(52,33,22,0.985), rgba(12,8,5,0.985) 72%);
  text-align: center;
  overflow: hidden;
  animation: zEin 0.35s ease both;
}
.zauber.zu { animation: zAus 0.25s ease forwards; }
@keyframes zEin { from { opacity: 0; } }
@keyframes zAus { to { opacity: 0; } }
.z-himmel {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    radial-gradient(1.6px 1.6px at 12% 18%, #fff3c4 50%, transparent),
    radial-gradient(1.2px 1.2px at 78% 11%, #fff3c4 50%, transparent),
    radial-gradient(1.4px 1.4px at 88% 36%, #fff3c4 50%, transparent),
    radial-gradient(1.1px 1.1px at 22% 52%, #fff3c4 50%, transparent),
    radial-gradient(1.6px 1.6px at 64% 74%, #fff3c4 50%, transparent),
    radial-gradient(1.2px 1.2px at 9% 83%, #fff3c4 50%, transparent),
    radial-gradient(1.3px 1.3px at 44% 7%, #fff3c4 50%, transparent),
    radial-gradient(1.1px 1.1px at 93% 90%, #fff3c4 50%, transparent);
  animation: zFunkeln 2.2s ease-in-out infinite alternate;
}
@keyframes zFunkeln { from { opacity: 0.3; } to { opacity: 0.95; } }
.z-buehne { position: relative; width: 260px; height: 260px; flex-shrink: 0; }
.z-stern {
  position: absolute; left: 50%; top: 50%;
  width: 110px; height: 110px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 0 18px rgba(233,207,122,0.75));
}
.z-stern svg, .flug-stern svg { display: block; width: 100%; height: 100%; }
.z-titel { font-family: 'Cinzel', Georgia, serif; font-size: 0.9rem; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.z-name {
  font-family: 'Cinzel', Georgia, serif; font-size: 2rem; font-weight: 700; line-height: 1.2;
  color: var(--gold-hell); text-shadow: 0 0 18px rgba(201,162,39,0.6);
}
.z-was { max-width: 300px; margin: 6px auto 0; font-style: italic; font-size: 1.05rem; line-height: 1.35; color: var(--pergament); }
.z-buehne { z-index: 1; }
.z-text, .z-weiter { position: relative; z-index: 2; transition: opacity 0.4s ease, transform 0.4s ease; }
.z-weiter { margin-top: 22px; }
.zauber:not(.offen) .z-text, .zauber:not(.bereit) .z-weiter { opacity: 0; transform: translateY(10px); pointer-events: none; }

/* Entdeckt: eine Lupe gleitet über eine alte Karte */
.z-karte {
  position: absolute; left: 10px; top: 45px; width: 240px; height: 170px;
  border-radius: 6px;
  background: linear-gradient(135deg, #f1e2bd, #d9c08e);
  box-shadow: 0 6px 24px rgba(0,0,0,0.6), inset 0 0 30px rgba(120,80,30,0.35);
  transform: rotate(-3deg);
}
.z-karte svg { width: 100%; height: 100%; display: block; }
.z-karte .pfad { fill: none; stroke: #7a4e22; stroke-width: 2.2; stroke-dasharray: 2 7; stroke-linecap: round; }
.z-karte .bild { fill: none; stroke: #8a6a40; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.8; }
.z-karte .kreuz { stroke: #9b2a1e; stroke-width: 4; stroke-linecap: round; }
.zauber-entdeckt .z-stern { width: 100px; height: 100px; transform: translate(-50%, -50%) scale(1) rotate(0deg); animation: zAuftauchen 0.8s cubic-bezier(.2,1.5,.4,1) 1.5s both; }
@keyframes zAuftauchen { from { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(-120deg); } }
.z-lupe { position: absolute; left: 92px; top: 92px; width: 90px; height: 90px; opacity: 0; animation: zLupe 2.1s ease-in-out both; }
@keyframes zLupe {
  0%   { opacity: 0; transform: translate(-110px, 60px) rotate(-10deg); }
  10%  { opacity: 1; }
  45%  { transform: translate(55px, -38px) rotate(8deg); }
  72%  { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translate(0, 0) rotate(0deg) scale(1.5); }
}

/* Erkannt: der Nebel in der Kristallkugel lichtet sich */
.z-kugel {
  position: absolute; left: 40px; top: 18px; width: 180px; height: 180px;
  border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle at 50% 55%, #7d5aa6, #3b2660 60%, #1f1236);
  box-shadow: 0 0 40px rgba(160,120,230,0.45), inset 0 -10px 30px rgba(0,0,0,0.5);
}
.z-kugel::after {
  content: ''; position: absolute; left: 30px; top: 22px; width: 55px; height: 30px;
  border-radius: 50%; background: rgba(255,255,255,0.35); filter: blur(3px); transform: rotate(-30deg);
}
.z-nebel {
  position: absolute; inset: -25%; border-radius: 50%; opacity: 0;
  background: conic-gradient(rgba(240,232,255,0.95), rgba(170,150,215,0.35), rgba(240,232,255,0.9), rgba(190,170,230,0.4), rgba(240,232,255,0.95));
  filter: blur(12px);
  animation: zNebel 2.3s ease-in both;
}
.z-nebel.zwei { animation-name: zNebel2; }
@keyframes zNebel  { 0% { opacity: 0.95; transform: rotate(0deg); } 55% { opacity: 0.9; } 100% { opacity: 0; transform: rotate(300deg) scale(1.3); } }
@keyframes zNebel2 { 0% { opacity: 0.8; transform: rotate(40deg) scale(0.8); } 60% { opacity: 0.7; } 100% { opacity: 0; transform: rotate(-260deg) scale(1.2); } }
.z-sockel {
  position: absolute; left: 75px; top: 186px; width: 110px; height: 40px;
  background: linear-gradient(180deg, #c9a227, #6b4a12);
  clip-path: polygon(18% 0, 82% 0, 100% 100%, 0 100%);
}
.zauber-erkannt .z-stern { top: 108px; width: 96px; height: 96px; transform: translate(-50%, -50%) scale(1); animation: zKlaeren 2.3s ease both; }
@keyframes zKlaeren { 0%, 45% { opacity: 0; transform: translate(-50%, -50%) scale(0.3); } 80% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } }

/* Gewusst: eine Eule bringt einen versiegelten Brief */
.z-eule { position: absolute; left: 100px; top: 0; font-size: 58px; line-height: 1; opacity: 0; animation: zEule 2.4s ease-in-out both; }
.z-eule .fluegel { display: inline-block; animation: zFlattern 0.22s ease-in-out infinite alternate; }
.z-eule .mini { position: absolute; left: 17px; top: 44px; font-size: 22px; opacity: 0; animation: zMini 2.4s linear both; }
@keyframes zEule {
  0%   { opacity: 1; transform: translate(240px, 30px); }
  40%  { transform: translate(0, 0); }
  52%  { transform: translate(-6px, -4px); }
  99%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-260px, -70px); }
}
@keyframes zFlattern { from { transform: scaleY(1); } to { transform: scaleY(0.86) translateY(3px); } }
@keyframes zMini { 0%, 41% { opacity: 1; } 42%, 100% { opacity: 0; } }
.z-brief { position: absolute; left: 35px; top: 105px; width: 190px; height: 124px; perspective: 600px; animation: zFallen 0.9s cubic-bezier(.4,0,.6,1) 0.95s both; }
@keyframes zFallen {
  0%  { opacity: 0; transform: translate(0, -125px) scale(0.25) rotate(-18deg); }
  1%  { opacity: 1; }
  65% { transform: translate(-6px, 6px) scale(1) rotate(6deg); }
}
.z-umschlag {
  position: absolute; inset: 0; border-radius: 5px;
  background:
    linear-gradient(to top right, transparent calc(50% - 1px), rgba(122,90,50,0.35) 50%, transparent calc(50% + 1px)) left / 50% 100% no-repeat,
    linear-gradient(to top left, transparent calc(50% - 1px), rgba(122,90,50,0.35) 50%, transparent calc(50% + 1px)) right / 50% 100% no-repeat,
    linear-gradient(160deg, #f3e6c4, #dcc495);
  box-shadow: 0 8px 26px rgba(0,0,0,0.6);
}
.z-klappe {
  position: absolute; left: 0; top: 0; width: 100%; height: 78px; z-index: 2;
  background: linear-gradient(180deg, #e8d5a8, #d2b57c);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 0.45s ease;
}
.zauber-gewusst.offen .z-klappe { transform: rotateX(180deg); z-index: 0; }
.zauber-gewusst .z-stern { top: 40px; width: 92px; height: 92px; z-index: 1; opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
.zauber-gewusst.offen .z-stern {
  z-index: 3; opacity: 1;
  transform: translate(-50%, -50%) translateY(-112px) scale(1) rotate(0deg);
  animation: zSpringen 0.9s cubic-bezier(.2,1.4,.4,1) 0.15s both;
}
@keyframes zSpringen { from { opacity: 0; transform: translate(-50%, -50%) translateY(0) scale(0.2) rotate(-360deg); } }
.z-siegel {
  position: absolute; left: 50%; top: 46px; z-index: 4;
  width: 50px; height: 50px; margin-left: -25px; padding: 0;
  border: none; border-radius: 50%; background: none;
  cursor: pointer;
}
.z-siegel span {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #d9473a, #8f1d14 70%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), inset 0 0 0 4px rgba(0,0,0,0.12);
  transition: transform 0.6s ease-in, opacity 0.5s ease-in 0.2s;
}
.z-siegel span.l { clip-path: inset(0 50% 0 0); }
.z-siegel span.r { clip-path: inset(0 0 0 50%); }
.z-siegel::after { content: '✦'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255,214,196,0.75); font-size: 20px; }
.zauber-gewusst:not(.offen) .z-siegel { animation: zPochen 1.1s ease-in-out 2.1s infinite; }
@keyframes zPochen { 50% { transform: scale(1.14); } }
.zauber-gewusst.offen .z-siegel { pointer-events: none; }
.zauber-gewusst.offen .z-siegel::after { opacity: 0; }
.zauber-gewusst.offen .z-siegel span.l { transform: translate(-30px, 60px) rotate(-60deg); opacity: 0; }
.zauber-gewusst.offen .z-siegel span.r { transform: translate(30px, 60px) rotate(60deg); opacity: 0; }
.z-tipp {
  position: absolute; left: 0; right: 0; top: 236px;
  font-style: italic; font-size: 1.05rem; color: var(--gold-hell);
  animation: zEin 0.5s ease 2.1s both;
}
.zauber-gewusst.offen .z-tipp { opacity: 0; }

/* Gelegt: Buchstaben wirbeln und ordnen sich zum Stern */
.z-form { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 14px rgba(233,207,122,0.7)); }
/* Goldfüllung (fill: url(#zGold)) von .z-form polygon und .z-tinte: siehe <style> in index.html */
.z-form polygon {
  stroke: #e9cf7a; stroke-width: 3; stroke-linejoin: round;
  stroke-dasharray: var(--l); stroke-dashoffset: 0;
  animation: zZeichnen 0.5s ease-out 1.85s both, zFuellen 0.5s ease 2.3s both;
}
@keyframes zZeichnen { from { stroke-dashoffset: var(--l); } }
@keyframes zFuellen { from { fill-opacity: 0; } }
.z-stein {
  position: absolute; z-index: 2;
  width: 30px; height: 36px;
  display: grid; place-items: center;
  background: var(--pergament);
  border: 1.5px solid var(--gold); border-radius: 7px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
  font-size: 1.3rem; font-weight: 700; color: var(--tinte);
  transform: translate(-50%, -50%) translate(0px, 0px) rotate(0deg);
  animation: zWirbel 1.8s cubic-bezier(.5,0,.3,1) both;
}
@keyframes zWirbel {
  0%   { opacity: 0; transform: translate(-50%, -50%) translate(var(--x1), var(--y1)) rotate(var(--r1)); }
  10%  { opacity: 1; }
  55%  { transform: translate(-50%, -50%) translate(var(--x2), var(--y2)) rotate(var(--r2)); }
  100% { opacity: 1; transform: translate(-50%, -50%) translate(0px, 0px) rotate(0deg); }
}

/* Geschrieben: eine Feder zeichnet den Stern in einem Zug */
.z-schrift { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 12px rgba(233,207,122,0.55)); }
.z-tinte { fill-opacity: 0; stroke: #e9cf7a; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; transition: fill-opacity 0.6s ease; }
.zauber-geschrieben.offen .z-tinte { fill-opacity: 1; }
.z-feder { position: absolute; left: 0; top: 0; font-size: 46px; line-height: 1; opacity: 0; pointer-events: none; }

/* Krone: liegt unter Goldfolie und wird freigerubbelt; danach Lichtstrahlen */
.z-strahlen {
  position: absolute; left: 50%; top: 50%; width: 380px; height: 380px; margin: -190px 0 0 -190px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,230,150,0.22) 0 9deg, transparent 9deg 22deg);
  -webkit-mask-image: radial-gradient(circle, #000 20%, transparent 70%);
          mask-image: radial-gradient(circle, #000 20%, transparent 70%);
  opacity: 0;
}
.zauber-krone.offen .z-strahlen { opacity: 1; animation: zEin 0.8s ease both, zDrehen 14s linear infinite; }
@keyframes zDrehen { to { transform: rotate(360deg); } }
.z-krone {
  position: absolute; left: 50%; top: 50%; font-size: 110px; line-height: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  filter: drop-shadow(0 0 22px rgba(233,207,122,0.8));
}
.zauber-krone.offen .z-krone { animation: zKroneAuf 0.9s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes zKroneAuf {
  0%  { transform: translate(-50%, -50%) rotate(0deg) scale(0.7); }
  45% { transform: translate(-50%, -50%) rotate(-8deg) scale(1.3); }
}
.z-folie {
  position: absolute; left: 25px; top: 25px; width: 210px; height: 210px;
  border-radius: 18px;
  touch-action: none;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0,0,0,0.6), 0 0 0 2px rgba(255,236,170,0.5);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.z-folie.weg { opacity: 0; transform: scale(1.15); pointer-events: none; }
.zauber-krone .z-tipp { top: 240px; animation: zEin 0.5s ease 0.6s both; }
.zauber-krone.offen .z-tipp { opacity: 0; }
.z-aufdecken {
  position: absolute; left: 50%; top: 268px; z-index: 2;
  transform: translateX(-50%);
  min-height: 36px; padding: 4px 12px;
  border: none; background: none;
  color: #9a8660; font-size: 0.85rem; font-style: italic;
  text-decoration: underline; text-underline-offset: 3px;
  animation: zSpaet 0.5s ease 6s both;
}
@keyframes zSpaet { from { opacity: 0; visibility: hidden; } to { opacity: 1; visibility: visible; } }
.zauber-krone.offen .z-aufdecken { display: none; }

/* Seltene Überraschung: Drache, Regenbogen oder Sternschnuppen – ohne Ankündigung */
.zauber:not(.u-los) .u-buehne { display: none; }
.u-buehne { position: absolute; inset: 0; pointer-events: none; }
.u-drache { position: absolute; left: 100%; top: 16%; z-index: 5; font-size: 74px; line-height: 1; opacity: 0; animation: uDrache 3s linear both; }
.u-drache span { display: inline-block; animation: uSchweben 0.45s ease-in-out infinite alternate; }
@keyframes uDrache { 0% { opacity: 1; transform: translateX(20px); } 99% { opacity: 1; } 100% { opacity: 0; transform: translateX(calc(-100vw - 140px)); } }
@keyframes uSchweben { to { transform: translateY(14px) rotate(4deg); } }
.u-funke { position: fixed; z-index: 996; color: #ffe9a8; font-size: 15px; line-height: 1; pointer-events: none; text-shadow: 0 0 8px #e9cf7a; animation: uFunke 1.1s ease-out forwards; }
@keyframes uFunke { to { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.3) rotate(160deg); } }
.u-bogen {
  position: absolute; left: 50%; top: calc(40% - 205px); z-index: 0;
  width: 360px; height: 180px; margin-left: -180px;
  border-radius: 180px 180px 0 0;
  background: radial-gradient(circle at 50% 100%, transparent 54%,
    #ff7b7b 54% 59%, #ffb35c 59% 64%, #ffe36d 64% 69%, #7fd38f 69% 74%, #67b3ff 74% 79%, #b58cff 79% 84%, transparent 84%);
  filter: drop-shadow(0 0 14px rgba(255,236,170,0.55));
  opacity: 0.9;
  animation: uBogen 1.3s ease-out both;
}
@keyframes uBogen { from { clip-path: inset(0 100% 0 0); opacity: 0.4; } to { clip-path: inset(0 0 0 0); } }
.u-schnuppe {
  position: absolute; z-index: 0;
  left: var(--x); top: var(--y);
  width: 150px; height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, #fff8e0, rgba(255,236,170,0));
  box-shadow: 0 0 8px #fff3c4;
  opacity: 0;
  transform: rotate(-32deg);
  animation: uSchnuppe 1.1s ease-in var(--d) both;
}
@keyframes uSchnuppe {
  0%   { opacity: 0; transform: rotate(-32deg) translateX(240px); }
  20%  { opacity: 1; }
  100% { opacity: 0; transform: rotate(-32deg) translateX(-160px); }
}

/* Zurück in der Übersicht: der Stern fliegt an seinen Platz */
.flug-stern {
  position: fixed; left: 0; top: 0; z-index: 995;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(233,207,122,0.9));
}
.flug-stern.emoji { display: grid; place-items: center; line-height: 1; }
.flug-spur {
  position: fixed; z-index: 994;
  width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff3c4 30%, rgba(233,207,122,0));
  pointer-events: none;
  animation: zSpur 0.7s ease-out forwards;
}
@keyframes zSpur { to { opacity: 0; transform: scale(0.2) translateY(10px); } }
.sterne i { display: inline-block; position: relative; }
.sterne i.landet { animation: zLanden 0.7s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes zLanden { from { transform: scale(2.4); text-shadow: 0 0 18px #fff3c4; } }
.sterne i.landet::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border: 2px solid #f3dc9b; border-radius: 50%;
  opacity: 0;
  animation: zRing 0.7s ease-out;
}
@keyframes zRing { from { transform: scale(1); opacity: 1; } to { transform: scale(7); opacity: 0; } }
.sterne.verschmelzen i { transform: translateX(var(--dx)) scale(0.4); opacity: 0; transition: transform 0.5s ease-in, opacity 0.5s ease-in; }
.sterne.kroenung { animation: zLanden 0.8s cubic-bezier(.2,1.6,.4,1) both; }
/* Mindestens eine Krone in dieser Sprache: das Profil-Icon trägt sie */
#konto-icon.gekroent .konto-icon::before {
  content: '👑';
  position: absolute; top: -12px; left: -9px;
  font-size: 18px; line-height: 1;
  transform: rotate(-24deg);
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
  pointer-events: none;
}
#konto-icon.kroenung .konto-icon { animation: zLanden 0.8s cubic-bezier(.2,1.6,.4,1) both; }

@media (prefers-reduced-motion: reduce) {
  .u-drache, .u-schnuppe, .u-funke { display: none; }
  .zauber, .zauber *, .zauber *::after, .flug-stern, .sterne i.landet, .sterne.kroenung, #konto-icon.kroenung .konto-icon {
    animation: none !important; transition: none !important;
  }
  .sterne i.landet::after { display: none; }
}

/* ── ANIMATIONEN ERGEBNIS ────────────────── */
#anim-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999;
}

/* Zauberstab mit leuchtender Spitze (ab 70%) */
.stab-wrap { position: relative; width: 150px; height: 120px; margin: 0 auto 14px; }
.stab {
  position: absolute;
  left: 14px; bottom: 26px;
  width: 100px; height: 9px;
  border-radius: 5px;
  background: linear-gradient(90deg, #2f1d12, #6b4a2a 55%, #8a6a3a);
  transform: rotate(-30deg);
  transform-origin: left bottom;
  box-shadow: 0 3px 8px rgba(0,0,0,0.55);
}
.stab-licht {
  position: absolute;
  left: 88px; top: 14px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe8 0%, #e9cf7a 40%, rgba(233,207,122,0.35) 62%, transparent 72%);
  animation: stabPuls 1.7s ease-in-out infinite;
}
@keyframes stabPuls {
  0%, 100% { transform: scale(1);    opacity: 0.85; }
  50%      { transform: scale(1.35); opacity: 1; }
}
.funke {
  position: absolute;
  left: 102px; top: 28px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #f3dc9b;
  box-shadow: 0 0 8px #e9cf7a;
  animation: funkeFliegt 1.9s ease-out infinite;
}
@keyframes funkeFliegt {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}

/* Brennende Kerze (ab 40%) */
.kerze-wrap { width: 120px; height: 118px; margin: 0 auto 14px; position: relative; }
.kerze-koerper {
  position: absolute;
  left: 50%; bottom: 6px;
  transform: translateX(-50%);
  width: 26px; height: 58px;
  border-radius: 4px 4px 3px 3px;
  background: linear-gradient(90deg, #d9c69c, #f7eed6 42%, #dccaa2);
  box-shadow: 0 3px 10px rgba(0,0,0,0.5);
}
.kerze-docht {
  position: absolute;
  left: 50%; bottom: 64px;
  transform: translateX(-50%);
  width: 2px; height: 9px;
  background: #2f1d12;
}
.kerze-flamme {
  position: absolute;
  left: 50%; bottom: 71px;
  width: 17px; height: 28px;
  border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 72%, #fffbe8 0%, #ffe9a8 22%, #f5b53c 48%, rgba(240,120,20,0.55) 76%, transparent 88%);
  box-shadow: 0 0 30px rgba(245,181,60,0.55);
  animation: flackern 1.15s ease-in-out infinite;
}
@keyframes flackern {
  0%, 100% { transform: translateX(-50%) scale(1) rotate(-1.5deg); }
  50%      { transform: translateX(-50%) scale(1.07, 1.13) rotate(1.5deg); }
}

/* Nebelschwaden (unter 40%) */
.nebel-wrap { position: relative; height: 96px; margin-bottom: 10px; overflow: hidden; }
.nebel {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(198,206,214,0.45), rgba(160,170,180,0.15) 55%, transparent 72%);
  filter: blur(7px);
  animation: ziehen linear infinite;
}
@keyframes ziehen {
  0%   { transform: translateX(-130px); opacity: 0; }
  25%  { opacity: 0.9; }
  75%  { opacity: 0.9; }
  100% { transform: translateX(130px); opacity: 0; }
}
.kessel { display: block; margin: 0 auto; animation: kesselWackelt 3s ease-in-out infinite; }
@keyframes kesselWackelt {
  0%, 100% { transform: rotate(-1.5deg); }
  50%      { transform: rotate(1.5deg); }
}

/* ── KONTO ───────────────────────────────── */
/* Profil-Icon in der Kopfzeile: Anfangsbuchstabe des Kindes */
#konto-icon { flex-shrink: 0; }
#konto-icon:empty, body.quiz #konto-icon, body.konto #konto-icon { display: none; }
.konto-icon {
  position: relative;
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--gold);
  border-radius: 50%;
  background: var(--pergament);
  color: var(--tinte);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 1px 6px rgba(0,0,0,0.45);
}
.konto-icon:active { transform: scale(0.92); }
.konto-icon:focus-visible { outline: 2px solid var(--gold-hell); outline-offset: 2px; }
/* Noch kein Profil gewählt: zurückhaltend */
.konto-icon.ohne { background: var(--dunkel-warm); color: var(--gold-hell); border-style: dashed; }
.konto-icon.emoji { font-size: 1.05rem; }
.konto-icon.laedt { opacity: 0.7; }
/* Offline oder abgemeldet: kleiner oranger Punkt */
.konto-icon.warnung::after {
  content: '';
  position: absolute;
  top: -1px; right: -1px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: #e08a2c;
  border: 2px solid var(--dunkel);
}

#konto { animation: reinRechts 0.25s ease; }
.konto-karte {
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: var(--tinte);
  background:
    linear-gradient(125deg, rgba(255,255,255,0.4) 0%, transparent 30%),
    var(--pergament);
  border: 1px solid var(--pergament-dunkel);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 22px 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.55);
}
.konto-karte h2 { font-family: 'Cinzel', Georgia, serif; font-size: 1.1rem; text-align: center; }
.konto-karte p { font-size: 0.95rem; line-height: 1.4; }
.konto-karte label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; color: var(--tinte-blass); }
.konto-karte input[type=email], .konto-karte input[type=password], .konto-karte input[type=text] {
  font: inherit;
  font-size: 1rem;
  color: var(--tinte);
  padding: 10px 12px;
  border: 1px solid #b89d68;
  border-radius: 8px;
  background: var(--pergament-hell);
}
.konto-karte label.haken { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.konto-karte .restart-btn, .konto-karte .menu-btn { width: 100%; }
.konto-karte .menu-btn { color: var(--tinte); border-color: #b89d68; }
.konto-meldung { padding: 8px 10px; border-radius: 6px; background: rgba(47,125,79,0.15); color: #1f5a37; }
.konto-meldung.fehler { background: rgba(163,43,43,0.12); color: var(--wrong); }
.link-btn {
  background: none;
  border: none;
  color: #b9a37a;
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 10px 4px;
  min-height: 40px;
}
.konto-karte .link-btn { color: var(--tinte-blass); }
#konto > .link-btn { display: block; margin: 14px auto 0; }
.profil-liste { display: flex; flex-direction: column; gap: 8px; }
.profil-zeile { display: flex; gap: 8px; }
.profil {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  text-align: left;
  background: var(--pergament-hell);
  border: 1px solid var(--pergament-dunkel);
  border-left: 5px solid var(--gold);
  border-radius: 6px;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1rem;
}
.profil.aktiv { box-shadow: 0 0 0 2px var(--gold); }
.profil .emoji { font-size: 1.4rem; }
.profil-weg { width: 48px; border: 1px solid var(--wrong); border-radius: 6px; background: transparent; color: var(--wrong); font-size: 1.1rem; }
.profil-neu { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--pergament-dunkel); }
.konto-fuss { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; margin-top: 12px; font-size: 0.85rem; color: #b9a37a; }

/* ── XP-POPUP & LEVEL-UP ─────────────────── */
.xp-popup {
  position: fixed;
  font-family: 'Cinzel', Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--gold-hell);
  text-shadow: 0 0 10px rgba(201,162,39,0.7);
  pointer-events: none;
  z-index: 1001;
  transform: translateX(-50%);
  animation: xpFloat 1.1s ease forwards;
}
@keyframes xpFloat {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-55px); }
}

.level-up-toast {
  position: fixed;
  top: 50%; left: 50%;
  background: linear-gradient(160deg, #3a2418, #241a13);
  border: 2px solid var(--gold);
  color: var(--gold-hell);
  font-family: 'Cinzel', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 20px 34px;
  border-radius: 12px;
  text-align: center;
  line-height: 1.6;
  box-shadow: 0 8px 50px rgba(201,162,39,0.4), inset 0 0 40px rgba(201,162,39,0.1);
  z-index: 1002;
  pointer-events: none;
  animation: levelUpPop 2.6s ease forwards;
}
@keyframes levelUpPop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  12%  { opacity: 1; transform: translate(-50%, -50%) scale(1.08); }
  20%  { transform: translate(-50%, -50%) scale(1); }
  75%  { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.95); }
}

/* ════════════════════════════════════════════════════════════
   TABLET (iPad) UND COMPUTER
   Ab 700px Breite und 600px Höhe. Handys bleiben genau wie bisher,
   auch quer gehalten (dort fehlt die Höhe). Was in rem angegeben ist,
   wächst mit der grösseren Grundschrift mit. Das Menü nutzt die
   Breite, das Quiz bleibt eine ruhige Spalte in der Mitte.
   ════════════════════════════════════════════════════════════ */
@media (min-width: 700px) and (min-height: 600px) {
  html { font-size: 118.75%; }              /* 19px statt 16px */

  .wrap { max-width: 1100px; padding: 0 28px; }
  body.quiz .wrap { max-width: 760px; }
  body.konto .wrap { max-width: 620px; }

  /* Menü: die Listen einer Unité als Kacheln nebeneinander –
     hochkant 2, quer 3 Spalten */
  .deck-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 12px;
  }
  .deck.pruefung { margin-top: 0; }
  .group { margin-bottom: 22px; }
  .group.closed { margin-bottom: 0; }

  /* Quiz: mehr Luft und grössere Antwortfelder */
  .back-btn { width: 48px; height: 48px; }
  .card { padding: 40px 36px 34px; }
  .answers { gap: 14px; }
  .ans-btn { min-height: 68px; }
}
