:root {
  /* Neue Farbpalette (dieselbe Vorgabe wie Portal + Artikel-Fresser):
     Petrol = Struktur, Gold = Highlight, Koralle = CTA/wichtige Aktionen,
     Mint = Erfolg (richtige Antwort), 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;
  --gruen: #2ec4b6;
}

* { 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;
}
/* Einheitliche Größe in allen Spielen (vorher unterschiedlich groß je
   nach Spiel, auf Nutzer-Feedback hin jetzt überall gleich), ohne
   Umrandung - der Hintergrund + Schatten reicht als Abgrenzung. */
.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;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.kopf h1::before { content: "🚦 "; }
.dreid-abzeichen {
  font-size: clamp(13px, 2.4vw, 16px); font-weight: 800; letter-spacing: .5px;
  background: var(--rot); color: #fff; padding: 3px 10px; border-radius: 999px;
  vertical-align: middle;
}
.untertitel { margin: 0; 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) ". "; }

.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; }

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; }
/* Koralle statt Gold: der auslösende Haupt-Knopf ist die "wichtige
   Aktion", Gold bleibt für Highlights (aktive Auswahl etc.) reserviert. */
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 b { color: var(--hell); font-size: 19px; }
.hud-rechts { margin-left: auto; display: flex; gap: 8px; }
.hud-rechts button { padding: 7px 13px; font-size: 14px; }

.ansage-box {
  background: var(--karte); border: 2px solid var(--gold); border-radius: 16px;
  padding: 18px 20px; margin: 6px 0 18px; text-align: center;
}
.ansage-text { margin: 0; font-size: clamp(19px, 4vw, 27px); font-weight: 700; line-height: 1.5; }

/* -------------------------------------------------------------- Straße --
   Ein <canvas>, in das Three.js die 3D-Szene rendert (Straße, Auto,
   Umgebung, echte Vorwärtsfahrt - siehe game.js). NUR EINE Fahrspur, kein
   Lenken mehr nötig. Das Wahrzeichen-Bild (#zielReihe, immer genau ein
   Symbol) bleibt ein flaches HTML/SVG-Overlay obendrauf. */
.strasse {
  position: relative; overflow: hidden;
  height: clamp(320px, 52vh, 480px);
  border-radius: 20px; margin-bottom: 4px;
  background: #8fcbe8;
  border: 2px solid var(--rand);
}
#szene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.ziel-reihe {
  position: absolute; top: 14px; left: 0; right: 0;
  display: flex; justify-content: center; align-items: flex-start;
  z-index: 2; pointer-events: none;
}
.ziel-symbol {
  padding: 8px; border: 3px solid var(--rand); border-radius: 14px;
  background: var(--karte); box-shadow: 0 3px 8px #00000020;
}
.ziel-symbol svg { width: clamp(56px, 14vw, 78px); height: auto; display: block; }

/* Straßensperre: zwei ganze Satz-Optionen - die einzige Aufgabe im Spiel. */
.schranken-optionen { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.schranken-satz {
  text-align: left; padding: 14px 18px; font-size: clamp(15px, 3.4vw, 18px); font-weight: 700;
  border-radius: 14px;
}
.schranken-satz.richtig { border-color: var(--gruen); background: #eefbf0; }
.schranken-satz.falsch { border-color: var(--rot); background: #fbe6e8; animation: schrankeSchuetteln .35s ease-in-out; }
@keyframes schrankeSchuetteln {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.meldung {
  text-align: center; font-size: 18px; font-weight: 700; min-height: 30px;
  opacity: 0; transition: opacity .15s; margin: 8px 0;
}
.meldung.zeigen { opacity: 1; }
.meldung.gut { color: #1f8a37; }
.meldung.schlecht { color: var(--rot); }

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

.ergebnis { font-size: 17px; line-height: 1.7; }
.ergebnis .zahl { font-size: 40px; font-weight: 800; color: var(--gold); }

.wackelig-titel { font-weight: 700; margin: 16px 0 6px; }
.wackelig-liste { margin: 0; padding-left: 20px; color: var(--gedaempft); }

@media (max-width: 560px) {
  .schranken-satz { padding: 12px 14px; }
}

/* ---- Knöpfe mindestens 48 px (Durchlauf 19.11.) ------------------------ */
.knopfreihe button, .knopfreihe-klein button, .startzeile button { min-height: 48px; min-width: 48px; }
.hud-rechts button { min-height: 48px; min-width: 48px; }

/* Rundenende: Es gibt dort einen eigenen Knopf „💬 Feedback“. Der schwebende
   Feedback-Knopf lag auf dem Handy genau darüber und wird hier ausgeblendet. */
body[data-schirm="ende"] .feedback-knopf { display: none; }

/* ---- Spielschirm ohne Scrollen (Durchlauf 19.11.) -----------------------
   Vorher war der Spielschirm auf fast allen Geräten höher als der Bildschirm
   (Straße fest 320–480 px), die Sätze lagen unter dem Rand. Jetzt füllt die
   Straße nur den freien Platz; im Spiel gibt es keine Sprachleiste (die
   Sprache wählt man auf dem Startschirm). */
body[data-schirm="spiel"] { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
body[data-schirm="spiel"] .oben-leiste { flex: none; width: 100%; }
body[data-schirm="spiel"] #sprachAuswahl { display: none; }
body[data-schirm="spiel"] #spiel.sichtbar {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; flex-direction: column;
  padding-top: 6px; padding-bottom: 68px; /* unten Platz für den Feedback-Knopf (48 px + Abstand) */
}
/* Feedback-Knopf im Spiel mindestens 48 px hoch (20.11.2026). */
body[data-schirm="spiel"] .feedback-knopf { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; }
body[data-schirm="spiel"] .hud { flex: none; padding: 2px 4px 8px; }
body[data-schirm="spiel"] .ansage-box { flex: none; margin: 0 0 10px; padding: 10px 16px; }
body[data-schirm="spiel"] .strasse { flex: 1 1 auto; height: auto; min-height: 140px; max-height: 480px; }
body[data-schirm="spiel"] .schranken-optionen { flex: none; margin: 8px 0 0; }
body[data-schirm="spiel"] .meldung { flex: none; margin: 6px 0 0; min-height: 27px; }
body[data-schirm="spiel"] .fusszeile { flex: none; margin: 4px 0 0; }

/* Handy hoch (schmal) und Handy quer (niedrig): kompakter Kopf, Feedback-
   Knopf rund neben dem Hausknopf (wie im Adjektiv-Dieb). */
@media (max-width: 560px), (max-height: 500px) and (orientation: landscape) {
  body[data-schirm="spiel"] .oben-leiste { padding: 6px 12px 0; }
  body[data-schirm="spiel"] .home-knopf { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }
  body[data-schirm="spiel"] #spiel.sichtbar { padding: 6px 12px 10px; }
  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; }
  body[data-schirm="spiel"] .hud { padding: 0 2px 6px; gap: 4px 12px; }
  body[data-schirm="spiel"] .hud-rechts button { padding: 4px 14px; font-size: 15px; }
  body[data-schirm="spiel"] .ansage-box { padding: 6px 10px; margin-bottom: 8px; border-radius: 12px; }
  body[data-schirm="spiel"] .ansage-text { font-size: 18px; line-height: 1.35; }
  body[data-schirm="spiel"] .ziel-reihe { top: 8px; }
  body[data-schirm="spiel"] .ziel-symbol { padding: 5px; }
  body[data-schirm="spiel"] .ziel-symbol svg { width: 54px; }
  body[data-schirm="spiel"] .schranken-satz { min-height: 48px; padding: 10px 14px; }
  body[data-schirm="spiel"] .fusszeile { display: none; }
}

/* Handy quer: zwei Spalten – links die Straße, rechts Punkte, Ansage, Sätze
   und Meldung.
   20.11.2026: Bei 667 × 375 passten lange Sätze („Ich fahre aus der
   Tiefgarage heraus.“) nicht ohne Scrollen. Deshalb sitzen 🏠, „←“ und 💬 jetzt
   nur über der Straße (links), die rechte Spalte beginnt ganz oben und ist
   breiter (3 : 2), sodass jeder Satz in eine Zeile passt. */
@media (max-height: 500px) and (orientation: landscape) {
  body[data-schirm="spiel"] .oben-leiste { position: absolute; top: 0; left: 0; width: auto; max-width: none; }
  body[data-schirm="spiel"] #spiel.sichtbar {
    display: grid; column-gap: 14px;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas: "strasse hud" "strasse ansage" "strasse optionen" "strasse meldung";
  }
  body[data-schirm="spiel"] .hud { grid-area: hud; flex-wrap: nowrap; gap: 4px 10px; }
  body[data-schirm="spiel"] .hud-feld { white-space: nowrap; }
  body[data-schirm="spiel"] .hud-rechts { gap: 6px; }
  body[data-schirm="spiel"] .hud-rechts button { padding: 4px 10px; }
  body[data-schirm="spiel"] .ansage-box { grid-area: ansage; }
  body[data-schirm="spiel"] .strasse { grid-area: strasse; min-height: 0; max-height: none; margin: 54px 0 0; }
  body[data-schirm="spiel"] .schranken-optionen { grid-area: optionen; margin: 0; gap: 8px; }
  body[data-schirm="spiel"] .schranken-satz { padding: 8px 12px; font-size: 17px; line-height: 1.25; }
  body[data-schirm="spiel"] .meldung { grid-area: meldung; align-self: start; font-size: 16px; line-height: 1.3; }
  body[data-schirm="spiel"] .ansage-text { font-size: 17px; }
}

/* Rundenende auf kleinen Bildschirmen etwas kompakter, damit alles ohne
   Scrollen sichtbar ist. */
@media (max-width: 560px), (max-height: 500px) and (orientation: landscape) {
  #ende.sichtbar { padding-top: 6px; padding-bottom: 12px; }
  #ende h2 { margin: 6px 0 4px; }
  #ende .ergebnis p { margin: 6px 0; }
  #ende .ergebnis .zahl { font-size: 34px; }
  #ende .startzeile { margin-top: 12px; }
}

:root { color-scheme: light dark; }

/* ---- Eigener Dunkelmodus (Durchlauf 11/2026, Muster Tanzroboter) -------
   Samsung Internet färbt trotz „only light“ selbst um. Seiten, die selbst
   „light dark“ anbieten, werden nicht umgefärbt und zeigen dieses Design.
   Gleiche Farbwelt (Petrol, Gold, Koralle, Mint), Texte ≥ 4,5 : 1. Die
   3D-Szene (WebGL) bleibt unverändert hell (Tag), ebenso das Bild des Ortes
   über der Szene. Hellmodus: alles oberhalb unverändert. */
@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; }
  .sprach-knopf.aktiv, button.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: var(--karte); border-color: var(--rand); }
  @media (hover: hover) {
    button:hover:not(:disabled) { background: #22424e; border-color: var(--gold); }
  }
  button.gross, button.gross:hover:not(:disabled) { background: var(--rot); border-color: var(--rot-dunkel); color: #fff; }
  @media (hover: hover) { button.gross:hover:not(:disabled) { background: var(--rot-hell); } }
  button.flach, button.flach:hover:not(:disabled) { background: transparent; }
  @media (hover: hover) { button.flach:hover:not(:disabled) { background: #22424e; } }
  button.gefahr, button.gefahr:hover:not(:disabled) { border-color: var(--rot); color: var(--rot-hell); background: transparent; }
  @media (hover: hover) { button.gefahr:hover:not(:disabled) { background: #3a1f24; } }
  .start-hinweis { background: #143847; border-color: #3f8fa8; color: var(--hell); }

  /* Szene: Rahmen etwas heller; das Ortsbild bleibt auf hellem Grund. */
  .strasse { border-color: #3f8fa8; }
  .ziel-symbol { background: #fffdf8; border-color: #9cc7d4; box-shadow: 0 3px 8px #00000050; }

  /* Satzknöpfe: richtig / falsch */
  .schranken-satz.richtig, .schranken-satz.richtig:hover:not(:disabled) { background: #0f3f3a; border-color: var(--gruen); color: #d9fbf6; }
  .schranken-satz.falsch, .schranken-satz.falsch:hover:not(:disabled) { background: #4a1d23; border-color: var(--rot); color: #ffd9dc; }
  .meldung.gut { color: #6ee08f; }
  .meldung.schlecht { color: #ff8f85; }
  .ergebnis .zahl { color: var(--gold); }

  /* 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;
     Eingabefeld und Knöpfe darin ausdrücklich 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; }
  @media (hover: hover) {
    .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; }
  }
}
