:root {
  /* Gleiche Farbvorgabe wie Portal + alle anderen Spiele: Petrol =
     Struktur, Gold = Highlight, Koralle = CTA/wichtige Aktionen,
     Creme = Hintergrund. */
  --grund: #fffdf8;
  --karte: #ffffff;
  --hell: #003a4d;
  --gedaempft: #4c6b74;
  --rand: #cde9ef;
  --gold: #fdcb52;
  --gold-hell: #fedd82;
  --gold-dunkel: #8a6a18;
  --rot: #ff6b6b;
  --rot-hell: #ff8f8f;
  --rot-dunkel: #d94b4b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--grund);
  color: var(--hell);
  -webkit-tap-highlight-color: transparent;
}

.schirm { display: none; padding: 20px 16px 28px; max-width: 1100px; margin: 0 auto; }
.schirm.sichtbar { display: block; }

.oben-leiste {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: 10px 16px 0;
}
.home-knopf {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 16px; font-size: 30px;
  text-decoration: none; background: var(--karte); border: none;
  box-shadow: 0 2px 8px #00000022; flex-shrink: 0;
}
.home-knopf:hover { background: #fbf5e8; }
.sprach-auswahl { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sprach-knopf { padding: 5px 12px; font-size: 13px; }
.sprach-knopf.aktiv { background: var(--hell); border-color: var(--hell); color: #fff; font-weight: 700; }

/* ------------------------------------------------------------ Startseite */
.kopf { text-align: center; margin-bottom: 22px; }
.kopf h1 { margin: 8px 0 4px; font-size: clamp(28px, 6vw, 46px); letter-spacing: -0.5px; }
.kopf h1::before { content: "🙋 "; }
.untertitel { margin: 0 auto; max-width: 620px; color: var(--gedaempft); font-size: 16px; }
.kopf::after {
  content: ""; display: block; height: 3px; width: 160px; margin: 14px auto 0;
  border-radius: 2px; opacity: .85;
  background: linear-gradient(90deg, var(--hell) 0 33.3%, var(--rot) 33.3% 66.6%, var(--gold) 66.6% 100%);
}

.wahl { margin-bottom: 22px; }
.wahl h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--gedaempft); margin: 0 0 10px;
}

/* Nummerierte Auswahl-Schritte (1. Niveau, 2. ..., 3. ...) - Nutzer-
   Feedback: mehrere Auswahlpunkte hintereinander wirken unübersichtlich,
   eine Nummerierung schafft eine klare Reihenfolge. Zählt automatisch nur
   ".wahl"-Blöcke mit einer ECHTEN Überschrift - Kippschalter ohne eigene
   Überschrift (z.B. "Nur aktuelle Stufe") werden dadurch NICHT mitgezählt.
   Reine CSS-Lösung (counter-reset/-increment + ::before) - der über
   data-i18n übersetzte Text selbst bleibt unangetastet. */
#start { counter-reset: schrittzahl; }
#start .wahl h2 { counter-increment: schrittzahl; }
#start .wahl h2::before { content: counter(schrittzahl) ". "; }

.umschalter { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.umschalter input { width: 20px; height: 20px; accent-color: var(--hell); cursor: pointer; flex-shrink: 0; }

.start-hinweis {
  margin: 4px 0 0; padding: 10px 14px; border-radius: 10px;
  background: #eaf6fa; border: 1px solid #7cc9e0; color: var(--hell);
  font-size: 14px; font-weight: 600;
}

.knopfreihe { display: flex; gap: 8px; flex-wrap: wrap; }
.knopfreihe-klein { display: flex; gap: 8px; flex-wrap: wrap; }
.knopfreihe-klein button { padding: 9px 16px; font-size: 14px; }
.dauer-hinweis { margin: 8px 0 0; color: var(--gedaempft); font-size: 13px; }

.themengitter {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.themengitter button { text-align: left; padding: 11px 13px; font-size: 14px; }
.themengitter button.alles-zusammen {
  grid-column: 1 / -1; border-color: var(--gold-hell); font-weight: 700;
}

.tempo-regler { max-width: 360px; }
.tempo-regler input[type="range"] {
  width: 100%; accent-color: var(--gold); height: 26px; cursor: pointer;
}
.tempo-marken {
  display: flex; justify-content: space-between; font-size: 13px;
  color: var(--gedaempft); margin-top: 2px;
}
.tempo-marken span { transition: color .12s, font-weight .12s; }
.tempo-marken span.aktiv { color: var(--gold-dunkel); font-weight: 700; }

button {
  background: #fff; color: var(--hell);
  border: 2px solid var(--rand); border-radius: 12px;
  padding: 10px 16px; font-size: 15px; font-family: inherit;
  cursor: pointer; transition: background .12s, border-color .12s, transform .08s;
  box-shadow: 0 1px 2px #00000010;
}
button:hover:not(:disabled) { background: #fbf5e8; border-color: var(--gold); }
button:active:not(:disabled) { transform: translateY(1px); }
button.aktiv { background: var(--hell); border-color: var(--hell); color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.gross { padding: 15px 30px; font-size: 18px; font-weight: 700; background: var(--rot); border-color: var(--rot-dunkel); color: #fff; }
button.gross:hover:not(:disabled) { background: var(--rot-hell); }
button.flach { background: transparent; box-shadow: none; }
button.gefahr { border-color: var(--rot); color: var(--rot); }
button.gefahr:hover:not(:disabled) { background: #fdeef0; }

.startzeile { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 22px; }

/* ------------------------------------------------------------- Spielfeld */
.hud {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 8px 4px 12px; font-size: 15px; color: var(--gedaempft);
}
.hud-feld { font-weight: 600; }
.hud-rechts { margin-left: auto; display: flex; gap: 8px; }
.hud-rechts button { padding: 7px 13px; font-size: 14px; }

/* Countdown-Balken über der Wortbühne - zeigt im Automatik-Modus, wie
   lange noch Zeit bleibt, bis das nächste Wort kommt. */
.wort-balken {
  height: 6px; border-radius: 3px; background: var(--rand); overflow: hidden; margin-bottom: 14px;
}
.wort-balken-fuellung {
  height: 100%; width: 100%; background: var(--gold);
  transform-origin: left center; transform: scaleX(0);
}
/* animation-play-state lässt sich nativ pausieren/fortsetzen (anders als
   eine CSS-transition, die man nicht mitten im Lauf anhalten kann, ohne
   den aktuellen Wert erst auszulesen) - genau das braucht der Pause-Knopf. */
@keyframes stehAufBalkenAblauf {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.wort-buehne {
  display: flex; justify-content: center; align-items: center;
  min-height: clamp(220px, 40vh, 340px); padding: 10px 0;
}
.wort-karte {
  width: 100%; max-width: 560px; min-height: clamp(160px, 30vh, 240px);
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--karte); border: 3px solid var(--rand); border-radius: 22px;
  box-shadow: 0 6px 18px #00000018; padding: 24px;
}
.wort-karte.eingeblendet { animation: wortEinblenden .35s ease-out; }
@keyframes wortEinblenden {
  0% { opacity: 0; transform: scale(.9); }
  100% { opacity: 1; transform: scale(1); }
}
.wort-anzeige {
  font-size: clamp(32px, 7vw, 56px); font-weight: 800; line-height: 1.15;
  word-break: break-word;
}
/* Wort + Übersetzung untereinander in der Karte */
.wort-inhalt { display: flex; flex-direction: column; align-items: center; gap: 8px; max-width: 100%; }
/* Übersetzung unter dem Wort (Schalter „🌐 Übersetzung“) - deutlich kleiner
   und kursiv, damit sie erkennbar zum Wort gehört und nicht mit ihm
   verwechselt wird (wie im Artikel-Fresser). */
.wort-uebersetzung {
  display: block; font-size: clamp(18px, 3.6vw, 26px); font-weight: 500; font-style: italic;
  color: var(--gedaempft); line-height: 1.3;
}
.wort-uebersetzung.hinweis { font-size: 16px; font-style: normal; }
.wort-uebersetzung[hidden] { display: none; }
/* „(Plural)“ hinter Nomen, die es nur im Plural gibt (wie Artikel-Fresser) */
.plural-etikett { font-size: .5em; font-weight: 500; color: var(--gedaempft); white-space: nowrap; }

/* Große Schalter für Übersetzung und Ton über der Wortkarte - gleiche
   Gestaltung wie im Artikel-Fresser: mindestens 48 px hoch, Schrift 18 px,
   aus = Umriss, an = gefüllt (Petrol). */
.schalter-zeile { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-start; margin: 0 0 10px; }
button.schalter {
  min-height: 48px; min-width: 48px; padding: 8px 18px; font-size: 18px; font-weight: 700;
  background: var(--karte); color: var(--hell); border: 2px solid var(--hell); border-radius: 12px;
}
button.schalter.aktiv { background: var(--hell); border-color: var(--hell); color: #fff; }
button.schalter[hidden] { display: none; }

.spiel-knoepfe { justify-content: center; }

/* Knöpfe mindestens 48 px hoch (Handy-Regel). */
.hud-rechts button, .knopfreihe button, .knopfreihe-klein button, .themengitter button,
.startzeile button, body .startzeile .hell-knopf { min-height: 48px; }

.fusszeile { text-align: center; color: var(--gedaempft); font-size: 14px; margin: 16px 0 0; }

.ergebnis { font-size: 17px; line-height: 1.7; }

@media (max-width: 560px) {
  .wort-karte { padding: 18px; border-radius: 18px; }
}

/* ---- Handy (hoch) und niedrige Bildschirme (quer), während des Spiels:
   alles ohne Scrollen. Kompakte Kopfzeile wie im Tanzroboter:
   Sprachauswahl als ein Knopf „🌐 Deutsch“, Feedback-Knopf klein oben,
   Wortkarte füllt den restlichen Platz. ---- */
@media (max-width: 560px), (max-height: 500px) and (orientation: landscape) {
  #sprachAuswahl { --sprach-einklappen: 1; }
  body[data-schirm="spiel"] .oben-leiste { padding: 6px 12px 0; align-items: flex-start; }
  body[data-schirm="spiel"] .home-knopf { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }

  body[data-schirm="spiel"] #sprachAuswahl { flex-wrap: nowrap; }
  body[data-schirm="spiel"] #sprachAuswahl .sprach-knopf { min-height: 48px; }
  body[data-schirm="spiel"] #sprachAuswahl .sprach-knopf:not(.aktiv) { display: none; }
  body[data-schirm="spiel"] #sprachAuswahl .sprach-knopf.aktiv::before { content: "🌐 "; }
  body[data-schirm="spiel"] #sprachAuswahl.offen {
    position: absolute; top: 6px; right: 12px; z-index: 9999;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
    width: calc(100vw - 24px); max-width: 520px; padding: 8px; background: #fff;
    border: 2px solid var(--rand); border-radius: 16px; box-shadow: 0 6px 20px #00000030;
  }
  body[data-schirm="spiel"] #sprachAuswahl.offen .sprach-knopf { display: block; padding: 4px 6px; }

  /* Feedback-Knopf im Spiel klein neben dem Haus-Knopf, damit er unten
     keinen Knopf verdeckt; „Als App installieren“ im Spiel ausblenden. */
  body[data-schirm="spiel"] .feedback-knopf {
    position: absolute; top: 6px; bottom: auto; left: 70px; right: auto;
    width: 48px; height: 48px; padding: 0; font-size: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center; border-radius: 50%;
  }
  body[data-schirm="spiel"] .feedback-knopf::before { content: "💬"; font-size: 20px; }
  body[data-schirm="spiel"] .pwa-knopf { display: none; }
  body[data-schirm="spiel"] .feedback-panel { top: 60px; bottom: auto; }

  /* Spielschirm als Spalte über die ganze restliche Höhe */
  body[data-schirm="spiel"] #spiel.schirm.sichtbar {
    display: flex; flex-direction: column;
    height: calc(100vh - 54px); height: calc(100dvh - 54px);
    padding: 6px 12px 10px;
  }
  body[data-schirm="spiel"] .hud { padding: 0 2px 6px; gap: 10px; font-size: 14px; flex: none; }
  body[data-schirm="spiel"] .schalter-zeile { margin-bottom: 8px; flex: none; }
  body[data-schirm="spiel"] .wort-balken { margin-bottom: 8px; flex: none; }
  body[data-schirm="spiel"] .wort-buehne { flex: 1 1 auto; min-height: 0; padding: 0; }
  body[data-schirm="spiel"] .wort-karte { min-height: 0; height: 100%; max-height: 320px; padding: 10px 14px; }
  body[data-schirm="spiel"] .spiel-knoepfe { margin-top: 8px; gap: 8px; flex: none; }
  body[data-schirm="spiel"] .spiel-knoepfe button { padding: 8px 14px; font-size: 16px; }
  body[data-schirm="spiel"] .fusszeile { margin-top: 8px; flex: none; }
}
/* Schmale Handys: Schalter etwas kleiner, damit beide in eine Zeile passen */
@media (max-width: 380px) {
  button.schalter { padding: 8px 10px; font-size: 16px; }
}
/* Niedrige Bildschirme: kleinere Schrift, Fußzeile ausblenden (der Hinweis
   steht schon im Untertitel der Startseite). */
@media (max-height: 600px) {
  body[data-schirm="spiel"] .fusszeile { display: none; }
  body[data-schirm="spiel"] .wort-anzeige { font-size: clamp(28px, min(7vw, 11vh), 52px); }
  body[data-schirm="spiel"] .wort-uebersetzung { font-size: clamp(16px, 5vh, 22px); }
}

/* ------------------------------------------------------------ Dunkelmodus
   Eigener Dunkelmodus (Muster Tanzroboter, 19.11.): Seiten mit eigenem
   Dunkeldesign werden von Android-Browsern (Samsung Internet, Chrome)
   nicht mehr selbst umgefärbt. Hellmodus bleibt unverändert - alles
   Dunkle steht nur in diesem Block. */
:root { color-scheme: light dark; }

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #0e1d23;
    --karte: #17303a;
    --hell: #e8f3f6;      /* Haupttext (im Hellmodus: Petrol) */
    --gedaempft: #a7c3cb;
    --rand: #2f5664;
    --gold-hell: #5a4613;
    --gold-dunkel: #fedd82;
  }
  .home-knopf:hover { background: #22424e; }
  /* --hell ist hier hell: aktive Knöpfe eigens auf Petrol mit weißer Schrift */
  .sprach-knopf.aktiv, button.aktiv, button.schalter.aktiv { background: #0d6b80; border-color: #7cc9e0; color: #fff; }
  button { background: var(--karte); color: var(--hell); box-shadow: 0 1px 2px #00000040; }
  button:hover:not(:disabled) { background: #22424e; border-color: var(--gold); }
  button.gross { background: var(--rot); border-color: var(--rot-dunkel); color: #fff; }
  button.gross:hover:not(:disabled) { background: var(--rot-hell); }
  button.flach { background: transparent; }
  button.gefahr { border-color: var(--rot); color: var(--rot-hell); }
  button.gefahr:hover:not(:disabled) { background: #3a1f24; }
  .start-hinweis { background: #143847; border-color: #3f8fa8; color: var(--hell); }
  .wort-karte { box-shadow: 0 6px 18px #00000060; }
  .home-knopf { box-shadow: 0 2px 8px #00000060; }

  /* Sprachauswahl aufgeklappt (Handy, im Spiel) */
  body[data-schirm="spiel"] #sprachAuswahl.offen { background: var(--karte); box-shadow: 0 6px 20px #00000080; }

  /* Gemeinsame Knöpfe (feedback.css, memo-knopf.css) – nur auf dieser Seite.
     „body“ davor, weil die gemeinsamen Dateien nach style.css geladen werden. */
  body .feedback-knopf, body .hell-knopf, body .memo-knopf {
    background: #143847; color: #d8eef4; border-color: #3f8fa8; box-shadow: 0 1px 5px #00000060;
  }
  /* Feedback-Fenster und „Als App installieren“-Fenster bleiben hell. */
  .feedback-panel, .pwa-fenster { color-scheme: light; }
  .feedback-panel textarea { background: #fff; color: #2a231c; }
  .feedback-panel button { background: #fff; color: #2a231c; }
  .feedback-panel .fb-senden { background: #0d2b52; color: #fff; }
  .pwa-fenster button { background: #fdcb52; color: #003a4d; }
  .feedback-panel button:hover:not(:disabled) { background: #f4efe6; border-color: #ddd4c2; }
  .feedback-panel .fb-senden:hover:not(:disabled) { background: #16407a; border-color: #16407a; }
  .pwa-fenster button:hover:not(:disabled) { background: #fedd82; border-color: #e0ac2b; }
}
