/* ============================================================================
   FitSpiel — App-CSS (v4)
   ACHTUNG — bewusste Abweichung vom zentralen Dashboard-Styleguide
   (apps/appstore-style-guide/STYLEGUIDE.md): Diese Ansicht ist ein Holz-/Sport-
   Brettspiel-Redesign nach Kundenvorlage, kein Terracotta-Akzent, keine
   monochromen Icons. Siehe apps/fitspiel/CLAUDE.md, Abschnitt "Design-Abweichung
   v4". Alles unten ist trotzdem token-basiert (keine verstreuten Hex-Werte im
   Markup) und deckt Hell-/Dunkelmodus ab — nur die Tokens selbst sind neu.
   ============================================================================ */

:root {
  /* Flächen (neutral, für Setup-Karte/Modal/Toast — bewusst nah am Dashboard-Grau,
     damit Nicht-Holz-UI wie Modals/Toasts lesbar bleiben) */
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --text: #1c1e21;
  --muted: #6b7280;
  --border: #e4e7eb;
  --accent: #c15f3c;
  --accent-fg: #ffffff;
  --accent-bg: #f6e6df;
  --chip: #eef1f4;
  --chip-text: #40474f;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --good: #197a3d;  --good-bg: #e6f4ea;
  --warn: #8a6d00;  --warn-bg: #fbf3d9;
  --bad:  #b0342a;  --bad-bg:  #f6e0dd;
  --done: #5b636b;  --done-bg: #eceef1;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  color-scheme: light;

  /* Spielsteine-Kartenakzent (unabhängig von der Bahn-Optik, wie im Referenzbild) —
     bis zu 10 Spieler, 10 unterscheidbare Farben. */
  --p1: #c15f3c;
  --p2: #2f6fb0;
  --p3: #1f8a5c;
  --p4: #8a4fbf;
  --p5: #1c8c8c;
  --p6: #b0447a;
  --p7: #9c8a1f;
  --p8: #5b5fc7;
  --p9: #b03a3a;
  --p10: #6b5b4d;

  /* ---- Holzthema (neu in v4) ---- */
  --holz-hell: #d8a35f;
  --holz-mittel: #c48a45;
  --holz-dunkel: #a06a30;
  --holz-text: #4a2c10;

  /* Neutraler Hintergrund für Start-/Zellen-Sonderfälle ohne eigene Bahnfarbe */
  --cell-chip-bg: rgba(255,255,255,.86);
  --cell-chip-text: #33291f;

  /* Bahn-Themen: je 2 Farbtöne (hell/dunkel) — Grundlage für die abwechselnd gefärbten Felder.
     Bewusst fest (nicht je Theme neu definiert) wie die Holzfarben und der weiße Würfel: die
     Feldfarben eines physischen Spielbretts ändern sich nicht mit Hell-/Dunkelmodus. Kräftig
     genug gewählt, damit weißer Zahlentext darauf gut lesbar bleibt. */
  --bahn-lauf-1: #b6392f;       --bahn-lauf-2: #7e2620;       /* Rot/Dunkelrot */
  --bahn-schwimmen-1: #2f6fa8;  --bahn-schwimmen-2: #1f4d78;  /* Blau/Dunkelblau */
  --bahn-fussball-1: #2f7d3f;   --bahn-fussball-2: #1f5429;   /* Grün/Dunkelgrün */
  --bahn-basketball-1: #8a5a2b; --bahn-basketball-2: #5e3c1a; /* Braun/Dunkelbraun */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17191c;
    --panel: #202327;
    --panel-2: #23272c;
    --text: #e7e9ec;
    --muted: #9aa1a9;
    --border: #31363c;
    --accent: #d97a52;
    --accent-fg: #1a1205;
    --accent-bg: #3a281f;
    --chip: #2b3037;
    --chip-text: #c3c9d0;
    --shadow: none;
    --good: #6fd68f;  --good-bg: #163422;
    --warn: #e6c65a;  --warn-bg: #3a3110;
    --bad:  #e6857a;  --bad-bg:  #3a1c18;
    --done: #aab1b9;  --done-bg: #2a2e33;
    color-scheme: dark;

    --p1: #d97a52;
    --p2: #6fa3dd;
    --p3: #5ecb96;
    --p4: #b590e6;
    --p5: #4fd1c5;
    --p6: #e28ab8;
    --p7: #d4c34f;
    --p8: #9a9df0;
    --p9: #e08080;
    --p10: #b8a692;

    --holz-hell: #5c4326;
    --holz-mittel: #4a3620;
    --holz-dunkel: #382a1a;
    --holz-text: #f0e0c8;

    --cell-chip-bg: rgba(28,30,33,.82);
    --cell-chip-text: #e7e9ec;
  }
}
:root[data-theme="dark"] {
  --bg: #17191c;
  --panel: #202327;
  --panel-2: #23272c;
  --text: #e7e9ec;
  --muted: #9aa1a9;
  --border: #31363c;
  --accent: #d97a52;
  --accent-fg: #1a1205;
  --accent-bg: #3a281f;
  --chip: #2b3037;
  --chip-text: #c3c9d0;
  --shadow: none;
  --good: #6fd68f;  --good-bg: #163422;
  --warn: #e6c65a;  --warn-bg: #3a3110;
  --bad:  #e6857a;  --bad-bg:  #3a1c18;
  --done: #aab1b9;  --done-bg: #2a2e33;
  color-scheme: dark;

  --p1: #d97a52;
  --p2: #6fa3dd;
  --p3: #5ecb96;
  --p4: #b590e6;
  --p5: #4fd1c5;
  --p6: #e28ab8;
  --p7: #d4c34f;
  --p8: #9a9df0;
  --p9: #e08080;
  --p10: #b8a692;

  --holz-hell: #5c4326;
  --holz-mittel: #4a3620;
  --holz-dunkel: #382a1a;
  --holz-text: #f0e0c8;

  --cell-chip-bg: rgba(28,30,33,.82);
  --cell-chip-text: #e7e9ec;
}

/* ---- Reset & Basis ---- */
* { box-sizing: border-box; }

/* ---- Startbildschirm: die Fensterhöhe ist immer zu 100% ausgefüllt (Bild auf
   Fensterhöhe skaliert, Breite ergibt sich aus dem Seitenverhältnis) — Klick/Enter
   öffnet das Setup. Überschüssige Breite wird mittig abgeschnitten statt gestaucht.
   Über allem anderen (auch über den Modal-Overlays, z-index 50), weil beim ersten
   Laden ohnehin nichts anderes offen sein kann. ---- */
#startScreen {
  position: fixed; inset: 0; z-index: 200;
  cursor: pointer;
  background: var(--holz-dunkel);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
#startScreen img { height: 100%; width: auto; max-width: none; display: block; }
#startScreen.ausgeblendet { display: none; }
body {
  margin: 0;
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--holz-mittel);
  position: relative;
}
/* Wiese als echte Grafik, aus der Bild-Vorlage ausgeschnitten und zu einer
   kachelbaren Textur aufbereitet (assets/gras-hintergrund.jpg) — kein CSS-Verlauf mehr.
   Eigene fixierte Ebene hinter dem Inhalt, damit der Dunkelmodus die Textur per Filter
   abdunkeln kann, ohne Text/Icons mit einzufärben. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background-image: url("assets/gras-hintergrund.jpg");
  background-repeat: repeat;
  background-size: 280px auto;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before { filter: brightness(.5) saturate(.85); }
}
:root[data-theme="dark"] body::before { filter: brightness(.5) saturate(.85); }
a { color: var(--accent); }
h1 { font-size: 19px; margin: 0; font-weight: 650; letter-spacing: -.2px; }
h2 { font-size: 16px; margin: 18px 0 10px; }

/* ---- Steuerelemente ---- */
input, select, textarea, button { font: inherit; }
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  background: var(--panel-2);
  color: var(--text);
  width: 100%;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.field { width: auto; }

button {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.2;
  min-height: 36px;
  padding: 0 14px;
  transition: .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.05); }
button:disabled { opacity: .55; cursor: default; filter: none; }
.icon-btn { min-width: 36px; padding: 0 8px; }
.linklike { border: none; background: none; color: var(--accent); padding: 0; font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline; min-height: 0; }

.ic { width: 15px; height: 15px; flex-shrink: 0; display: block; }

/* ---- Holz-Button (Würfeln) — Mechanik unverändert, nur Look. Gilt jetzt für ALLE
   Buttons in modalen Dialogen (Regeln, Gesamtstand, Sieg, Übung, …): groß und im
   selben Holz-Look, damit sie auch aus einigen Metern Entfernung (z. B. TV-Gerät) gut
   erkennbar sind — nicht nur die Hauptaktion, jeder Button in einem Dialog. */
button.btn-holz,
.overlay .modal button {
  background: linear-gradient(180deg, var(--holz-hell), var(--holz-mittel));
  border: 1px solid var(--holz-dunkel);
  color: var(--holz-text);
  font-weight: 700;
  font-size: 20px;
  min-height: 58px; padding: 0 30px;
  box-shadow: 0 2px 0 var(--holz-dunkel), 0 3px 6px rgba(0,0,0,.25);
}
button.btn-holz:hover,
.overlay .modal button:hover { filter: brightness(1.06); }
button.btn-holz:disabled,
.overlay .modal button:disabled { filter: grayscale(.3); }

.spacer { flex: 1; }

/* ---- Karten / Panels (neutral, für Setup/Rundenstand/Übungen/Legende) ---- */
.card, .panel {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 17px;
}
.panel-2 { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* ---- Chips & Badges ---- */
.chip { background: var(--chip); color: var(--chip-text); border-radius: 6px; padding: 2px 8px; font-size: 13px; }
.badge { white-space: nowrap; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--chip); color: var(--chip-text); }

/* ---- Segment-Umschalter ---- */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: none; border-radius: 0; background: var(--panel); padding: 5px 12px; font-size: 13px; color: var(--muted); min-height: 32px; }
.seg button.active { background: var(--accent); color: var(--accent-fg); font-weight: 600; }

/* ---- Meldungen ---- */
.flash { margin: 14px 0; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; }
.flash.ok  { background: var(--good-bg); color: var(--good); }
/* Toast im selben Holz-Look wie Buttons/Dialoge (siehe button.btn-holz), statt dem
   neutralen Dashboard-Grau — passt zum Sport-/Holzthema dieser App-Version. */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, var(--holz-hell), var(--holz-mittel));
  border: 1px solid var(--holz-dunkel);
  color: var(--holz-text); font-weight: 700;
  padding: 14px 26px; border-radius: var(--radius-pill);
  font-size: 18px;
  box-shadow: 0 2px 0 var(--holz-dunkel), 0 4px 16px rgba(0,0,0,.35);
  opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 100; max-width: 90vw;
}
.toast.show { opacity: 1; }
.toast.runde { border-left: 6px solid var(--accent); padding-left: 22px; }

/* ---- Konfetti-Explosion bei Zieleinlauf: pro Feier ein Layer mit vielen großen
   Schnipseln in den App-eigenen Farben (Spielerfarben --p1..--p10 + Akzent), die aus
   der Bildschirmmitte herausschießen (Burst) und danach nach unten wegfallen
   (Schwerkraft) — per JS zufällig positioniert/gefärbt (loesKonfettiRegen()),
   danach wieder aus dem DOM entfernt. ---- */
.confetti-layer { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 300; }
.confetti-stueck {
  position: absolute; left: 50%; top: 42%;
  animation-name: confetti-explode; animation-timing-function: cubic-bezier(.16,.68,.32,1); animation-fill-mode: forwards;
}
@keyframes confetti-explode {
  0%   { transform: translate(-50%, -50%) translate(0, 0) rotate(0deg); opacity: 1; }
  32%  { transform: translate(-50%, -50%) translate(var(--bx), var(--by)) rotate(var(--dreh1)); opacity: 1; }
  100% { transform: translate(-50%, -50%) translate(var(--fx), var(--fy)) rotate(var(--dreh2)); opacity: 0; }
}

/* ---- Modal / Overlay ---- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.overlay.open { display: flex; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: 100%; max-width: 460px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal.wide { max-width: 620px; }
.modal:has(.modal-body) { padding: 0; display: flex; flex-direction: column; overflow: hidden; max-height: calc(100vh - 80px); }
.modal-header { padding: 18px 22px 0; }
.modal-header h2 { margin: 0; }
.modal-body { padding: 16px 22px; overflow-y: auto; min-height: 0; }
.modal-footer { padding: 12px 22px; border-top: 1px solid var(--border); }
.modal-actions, .modal-footer { display: flex; justify-content: flex-end; gap: 10px; }
.modal-actions { margin-top: 20px; }

.empty-state { text-align: center; color: var(--muted); padding: 48px 20px; }

/* ---- Modale Dialoge groß/gut lesbar aus einigen Metern Entfernung (z. B. TV-Gerät) ----
   Überschreibt die schlanken Dashboard-Maße der Basis-Modals nur für FitSpiel-Dialoge.
   Der Würfel-Dialog (.wuerfel-overlay) hat sein eigenes, bewusst rahmenloses Layout und
   wird hier ausdrücklich ausgenommen, sonst überschreibt diese generische Regel dessen
   transparente/randlose Gestaltung. */
.overlay:not(.wuerfel-overlay) .modal { max-width: 620px; padding: 32px; }
.overlay:not(.wuerfel-overlay) .modal.wide { max-width: 820px; }
.overlay:not(.wuerfel-overlay) .modal h2 { font-size: 30px; }
.overlay:not(.wuerfel-overlay) .modal p { font-size: 19px; line-height: 1.5; }
.overlay:not(.wuerfel-overlay) .modal-header { padding: 28px 32px 0; }
.overlay:not(.wuerfel-overlay) .modal-body { padding: 20px 32px; font-size: 19px; }
.overlay:not(.wuerfel-overlay) .modal-footer { padding: 18px 32px; }
.overlay:not(.wuerfel-overlay) .modal-actions { gap: 16px; margin-top: 26px; }
.overlay:not(.wuerfel-overlay) .modal-footer { gap: 16px; }
.overlay #regelnListe { font-size: 19px; line-height: 1.5; gap: 14px !important; }
.overlay .standing-row { font-size: 19px; gap: 14px; padding: 11px 0; }
.overlay .standing-row .maskottchen-mini { width: 34px; height: 34px; }
.overlay .standing-row .rank { width: 34px; font-size: 20px; font-weight: 700; }
.overlay .podium-maskottchen { width: 76px; height: 76px; }
.overlay .podium-name { font-size: 18px; }
.overlay .podium-punkte { font-size: 15px; }
.overlay .podium-sockel { font-size: 28px; }

/* ---- Sieg-Dialog ("Durchgang beendet!") — nochmal deutlich größer als die übrigen
   Dialoge, das ist der wichtigste Moment eines Durchgangs. Podest statt Liste, mit
   Maskottchen-Icons genau in der Größe der Spielfiguren auf dem Brett (.token: 116px). */
#winOverlay .modal { max-width: 900px; }
#winOverlay h2 { font-size: 40px; }
#winOverlay #winRunde { font-size: 22px !important; }
#winOverlay .podium { gap: 28px; margin-top: 10px; }
#winOverlay .podium-saeule { width: 160px; }
#winOverlay .podium-maskottchen { width: 116px; height: 116px; }
#winOverlay .podium-name { font-size: 22px; }
#winOverlay .podium-sockel { font-size: 34px; }
/* ---- Setup-Karte ("Neues Spiel"): dieselbe Großformat-Gestaltung wie die übrigen
   Dialoge (siehe .overlay:not(.wuerfel-overlay) .modal oben) — kein Overlay, aber
   optisch gleich behandelt, weil es der erste Dialog ist, den man sieht. ---- */
#setupCard { padding: 32px; }
#setupCard h2 { font-size: 30px; margin: 0 0 6px; }
#setupCard p { font-size: 19px; line-height: 1.5; }
#setupCard label { font-size: 16px !important; }
#setupCard select { font-size: 19px; min-height: 52px; padding: 0 14px; }
#setupCard .player-setup-row input[type="text"] { font-size: 19px; min-height: 52px; padding: 0 16px; }
#setupCard .player-setup-row .maskottchen-mini { width: 34px; height: 34px; }
#setupCard .modal-actions { margin-top: 26px; }

#winOverlay .podium-hoch { height: 150px; }
#winOverlay .podium-mittel { height: 110px; }
#winOverlay .podium-niedrig { height: 78px; }

/* ============================================================================
   App-spezifisch: FitSpiel v4 — Holz-/Sport-Brettspiel
   ============================================================================ */

.wrap { max-width: 1500px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }

/* ---- Setup-Karte ---- */
.setup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.player-setup-row { display: flex; align-items: center; gap: 10px; }
.player-setup-row .maskottchen-mini { width: 22px; height: 22px; flex-shrink: 0; }
.player-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

/* ---- Übungen bearbeiten (Setup-Karte + eigenes Overlay während des Spiels) ---- */
.uebungen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.uebungen-feld label { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--muted); margin-bottom: 6px; }
.uebungen-feld .sonderfeld-icon-mini { width: 22px; height: 22px; flex-shrink: 0; }

/* ---- Steuerleiste ---- */
/* Volle Bildschirmbreite wie eine Kopfzeile (gleicher Full-Bleed-Trick wie .board-wrap),
   fix oben (position: sticky) und ohne abgerundete Ecken — bewusster Bruch mit .card,
   von dem sie sonst Rahmen/Schatten/Innenabstand erbt. */
.game-toolbar {
  position: sticky; top: 0; z-index: 20;
  width: 100vw; margin-left: calc(50% - 50vw); margin-top: -24px;
  border-radius: 0;
  padding: 6px 100px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
/* Alternative zum Zufallswurf: Zahl von Hand eingeben (z. B. zum Testen/Vorführen) —
   bleibt leer standardmäßig, dann wird wie gewohnt zufällig gewürfelt. */
.wuerfel-manuell { width: 66px; text-align: center; flex-shrink: 0; }
.current-turn { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 22px; }
.current-turn .maskottchen-mini { width: 64px; height: 64px; }
.runde-chip { font-weight: 600; font-size: 16px; padding: 6px 12px; }
.durchgang-chip { font-weight: 600; font-size: 16px; padding: 6px 12px; }

/* ---- Würfel-Pips: gemeinsame Basis (großer Modal-Würfel + kleiner Ergebnis-Würfel) ---- */
.dice {
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  background: #ffffff; border: 1px solid rgba(0,0,0,.1);
  flex-shrink: 0;
}
.dice .pip { border-radius: 50%; background: transparent; align-self: center; justify-self: center; }
.dice .pip.on { background: #1c1e21; }

/* ---- Kleiner Würfel im Kopfbereich (oben rechts) — zeigt die zuletzt gewürfelte Zahl
   als echten Mini-Würfel statt als Text. Erscheint erst nach dem ersten Wurf. ---- */
.dice.klein {
  display: none;
  width: 30px; height: 30px; border-radius: 7px;
  padding: 4px; gap: 2px;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.dice.klein.zeigen { display: grid; }
.dice.klein .pip { width: 4px; height: 4px; }

/* ---- Großer Würfel im modalen Dialog, auf einer runden Fläche (Wurftablett) ---- */
.wuerfel-overlay .modal {
  background: transparent; box-shadow: none; border: none; padding: 0;
  width: auto; max-width: none;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.wuerfel-flaeche {
  width: 340px; height: 340px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 38% 32%, var(--holz-hell), var(--holz-mittel) 62%, var(--holz-dunkel) 100%);
  box-shadow: 0 20px 55px rgba(0,0,0,.5), inset 0 0 0 7px rgba(0,0,0,.16), inset 0 2px 10px rgba(0,0,0,.25);
  cursor: default;
}
/* Erst wenn das Ergebnis feststeht (Klasse "bereit"), ist die Fläche klickbar — vorher
   (beim Rollen) reagiert ein Klick bewusst nicht. */
.wuerfel-flaeche.bereit { cursor: pointer; animation: wuerfel-bereit-puls 1.1s ease-in-out infinite; }
@keyframes wuerfel-bereit-puls {
  0%, 100% { box-shadow: 0 20px 55px rgba(0,0,0,.5), inset 0 0 0 7px rgba(0,0,0,.16), inset 0 2px 10px rgba(0,0,0,.25), 0 0 0 0 rgba(255,255,255,0); }
  50% { box-shadow: 0 20px 55px rgba(0,0,0,.5), inset 0 0 0 7px rgba(0,0,0,.16), inset 0 2px 10px rgba(0,0,0,.25), 0 0 0 8px rgba(255,255,255,.25); }
}
.dice.gross {
  width: 220px; height: 220px; border-radius: 34px;
  padding: 26px; gap: 10px;
  box-shadow: 0 14px 40px rgba(0,0,0,.55);
}
.dice.gross .pip { width: 28px; height: 28px; }
.dice.gross.rolling { animation: dice-shake .35s ease-in-out infinite; }
@keyframes dice-shake {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(-8deg) scale(1.03); }
  75% { transform: rotate(8deg) scale(1.03); }
}
/* ---- Bahnen (ersetzt schlichtes lane-label aus v1–v3) ----
   Keine eigene Spielerkarten-Spalte mehr — der Name jeder Person steht direkt unter
   ihrer Figur auf dem Feld (.token-name), das Feld ist die einzige Informationsquelle.
   Bahnen nutzen die volle Bildschirmbreite (nicht die max-width:1500px von .wrap) —
   klassisches "Full-Bleed": 100vw breit, per left:50%/margin-left:-50vw aus dem zentrierten
   .wrap herausgelöst, mit exakt 100px Abstand links/rechts über padding + border-box. */
.board-wrap {
  width: 100vw; position: relative; left: 50%; margin-left: -50vw;
  padding: 0 100px; box-sizing: border-box;
}

/* Kein eigener Rahmen/Hintergrund fürs Spielfeld — es sitzt direkt auf der
   Holzmaserung der Seite (body::before), nur overflow-x fürs gemeinsame Scrollen. */
.board-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--bahn-fussball-1) transparent;
}
.board-scroll::-webkit-scrollbar { height: 10px; }
.board-scroll::-webkit-scrollbar-track { background: transparent; }
.board-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--bahn-fussball-1), var(--bahn-fussball-2));
  border-radius: var(--radius-pill);
  box-shadow: 0 0 0 1px rgba(0,0,0,.15);
}
.board-scroll::-webkit-scrollbar-thumb:hover { filter: brightness(1.08); }

.board { display: flex; flex-direction: column; gap: 14px; padding: 20px 16px; width: max-content; min-width: 100%; }

/* ---- Bahnen: 4 feste Sport-Themen (Reihenfolge nach Spielerplatz, unabhängig von Kartenfarbe) ----
   Kein Bahn-Hintergrundbild mehr — die Felder kleben direkt aneinander (gap:0) und tragen
   selbst die Farbe, abwechselnd hell/dunkel je Bahn-Thema (Grün/Braun/Rot/Blau), getrennt nur
   durch den weißen Feldrand. Felder/Figuren bewusst groß dimensioniert, damit das Spielfeld
   auch aus einigen Metern Entfernung lesbar bleibt (z. B. auf einem großen Bildschirm während
   des Trainings). */
/* overflow: hidden schneidet die Bahn links/rechts hart an ihrer eigenen Kante ab, damit
   Maskottchen nie seitlich hinauslaufen. Die min-height sorgt für genug Luft, damit
   Maskottchen oben/unten über ihr Feld hinausragen UND der Name darunter noch Platz hat.
   Der weiße Rahmen um die ganze Bahn passt zum weißen Rand der einzelnen Felder. */
.lane-track {
  position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 0;
  border-radius: var(--radius-sm); padding: 0; min-height: 195px;
  border: 3px solid #ffffff;
  overflow: hidden;
}

/* Grundfarbe der Bahn (dunklerer Ton) füllt die gesamte Bahnfläche — auch den Bereich
   ober-/unterhalb der Feldreihe, in dem Maskottchen/Name über die Felder hinausragen. */
.bahn-lauf { background: var(--bahn-lauf-2); }
.bahn-schwimmen { background: var(--bahn-schwimmen-2); }
.bahn-fussball { background: var(--bahn-fussball-2); }
.bahn-basketball { background: var(--bahn-basketball-2); }

/* Abwechselnd helle/dunkle Feldfarbe je Bahn-Thema — Start/Ziel bleiben davon ausgenommen
   (eigene Optik, siehe unten). */
.bahn-lauf .cell:not(.start):not(.ziel):nth-child(odd)  { background: var(--bahn-lauf-1); }
.bahn-lauf .cell:not(.start):not(.ziel):nth-child(even) { background: var(--bahn-lauf-2); }
.bahn-schwimmen .cell:not(.start):not(.ziel):nth-child(odd)  { background: var(--bahn-schwimmen-1); }
.bahn-schwimmen .cell:not(.start):not(.ziel):nth-child(even) { background: var(--bahn-schwimmen-2); }
.bahn-fussball .cell:not(.start):not(.ziel):nth-child(odd)  { background: var(--bahn-fussball-1); }
.bahn-fussball .cell:not(.start):not(.ziel):nth-child(even) { background: var(--bahn-fussball-2); }
.bahn-basketball .cell:not(.start):not(.ziel):nth-child(odd)  { background: var(--bahn-basketball-1); }
.bahn-basketball .cell:not(.start):not(.ziel):nth-child(even) { background: var(--bahn-basketball-2); }

/* Felder kleben aneinander (kein Abstand) — die Trennung entsteht allein durch den weißen
   Rand jeder Zelle. Bewusst festes Weiß statt Token (wie beim Würfel): die Feldfarben sind
   selbst schon kräftig und sollen in beiden Themes gleich aussehen. */
.cell {
  position: relative; flex: 0 0 80px; width: 80px; height: 110px;
  border-radius: 0; background: var(--cell-chip-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #ffffff; text-shadow: 0 1px 3px rgba(0,0,0,.5);
  font-variant-numeric: tabular-nums;
  border: 3px solid #ffffff;
  font-weight: 700;
}
/* Zielfeld: schwarz-weiß kariert wie eine Zielflagge — bewusst fest (kein Theme-Token),
   das ist eine feste Spielbrett-Markierung wie der weiße Feldrand oder der Würfel. */
.cell.ziel {
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #000 25%, transparent 25%, transparent 75%, #000 75%, #000),
    linear-gradient(45deg, #000 25%, #fff 25%, #fff 75%, #000 75%, #000);
  background-size: 42px 42px;
  background-position: 0 0, 21px 21px;
  color: #000;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
  box-shadow: none;
  font-weight: 800;
}
.cell.start {
  flex: 0 0 120px; width: 120px; font-weight: 700; text-transform: uppercase; font-size: 18px;
  background: var(--cell-chip-bg); color: var(--cell-chip-text); text-shadow: none;
}
/* Sonderfeld: noch ohne Funktion (Platzhalter für später) — behält die normale
   Feldfarbe der Bahn, nur das Icon (automatisch passend zum Bahn-Thema) markiert es. */
.cell.sonderfeld { padding: 10px; }
.sonderfeld-icon { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
/* Zelle, die gerade eine Spielfigur trägt, muss über die Nachbarzellen gemalt werden,
   sonst schneiden die danach im DOM folgenden Zellen den überstehenden Token ab. */
.cell:has(.token) { z-index: 5; }

/* Maskottchen deutlich größer als das Feld und bewusst darüber hinausragend (wie ein
   physischer Spielstein, der größer als sein Feld ist) — bewusst groß für gute
   Lesbarkeit auch aus einigen Metern Entfernung. */
.token {
  position: absolute; left: 50%; top: 50%; width: 116px; height: 116px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  z-index: 4; background: rgba(255,255,255,.92); box-shadow: 0 4px 12px rgba(0,0,0,.4);
  padding: 8px;
}
.token img { width: 100%; height: 100%; object-fit: contain; }
.token.pop { animation: token-pop .22s ease-out; }
@keyframes token-pop {
  0% { transform: translate(-50%, -50%) scale(.5); }
  70% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
/* Zuletzt bewegtes Männchen: dezentes, dauerhaftes Pulsieren (groß/klein) zur
   Orientierung, bis das nächste Männchen zieht. Startet leicht verzögert, damit es
   sich nicht mit der kurzen Lande-Animation (token-pop) überschneidet. */
.token.puls { animation: token-puls 1.2s ease-in-out .25s infinite; }
@keyframes token-puls {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.16); }
}

/* Name direkt unter der Figur statt einer eigenen Spielerkarte — weiß mit leichtem
   Schatten, damit er auf jeder der vier Bahnfarben lesbar bleibt. Position relativ zur
   Zelle (nicht zum Token), 50% + Token-Radius (58px) + Abstand darunter. */
.token-name {
  position: absolute; left: 50%; top: calc(50% + 66px);
  transform: translateX(-50%);
  color: #ffffff; font-weight: 700; font-size: 17px;
  text-shadow: 0 1px 4px rgba(0,0,0,.65);
  white-space: nowrap; pointer-events: none;
  z-index: 4;
}

/* ---- Gesamtstand: Siegerpodest (Plätze 1–3) + einfache Liste für Platz 4+ ---- */
.podium {
  display: flex; align-items: flex-end; justify-content: center; gap: 14px;
  margin: 0 0 20px;
}
.podium-saeule { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 120px; }
/* Bei geteiltem Platz stehen mehrere Personen übereinander in derselben Säule. */
.podium-mitglied { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.podium-mitglied + .podium-mitglied { margin-top: 10px; }
.podium-maskottchen { width: 56px; height: 56px; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--border); padding: 6px; }
.podium-name { font-weight: 700; font-size: 14px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.podium-punkte { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
/* Feste Medaillenfarben (Gold/Silber/Bronze) — wie Würfel/Feldrahmen bewusst unabhängig
   vom Theme, weil es sich um physische Auszeichnungsfarben handelt. */
.podium-sockel {
  width: 100%; border-radius: 6px 6px 0 0;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 8px; font-size: 22px; font-weight: 800; color: #ffffff;
  text-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.podium-hoch { height: 110px; }
.podium-mittel { height: 80px; }
.podium-niedrig { height: 56px; }
.podium-sockel.platz-1 { background: linear-gradient(180deg, #f0cf6b, #c9a233); }
.podium-sockel.platz-2 { background: linear-gradient(180deg, #d8d8d8, #a6a6a6); }
.podium-sockel.platz-3 { background: linear-gradient(180deg, #d99a5c, #a86a34); }

.standing-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px;
}
.standing-row:first-child { border-top: none; }
.standing-row .maskottchen-mini { width: 20px; height: 20px; flex-shrink: 0; }
.standing-row .rank { width: 24px; flex-shrink: 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.standing-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standing-row .pos { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }

@media (max-width: 640px) {
  .game-toolbar { gap: 10px; padding: 12px 16px; }
  .board-wrap { padding: 0 16px; }
  .podium-saeule { width: 90px; }
}
