/* Gruftlicht — dunkler Dungeon-Look */

:root {
  --bg: #0d0b09;
  --panel: #1a1613;
  --panel-2: #241e19;
  --border: #3a2f26;
  --text: #d8cbb8;
  --text-dim: #8a7c6a;
  --accent: #c9a227;
  --danger: #c0392b;
  --ground: #4a3c2e;
  --ground-2: #52432f;
  --wall: #23201c;
  --water: #274b5e;
  --radius: 8px;
  /* Board-Raster: muss zu CELL/GAP in js/ui/anim.js passen */
  --cell: 52px;
  --gap: 2px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg) url('../assets/screens/app-background.png?a=0f04782900') repeat;
  background-size: 480px;
  color: var(--text);
  font-family: Georgia, 'Times New Roman', serif;
  min-height: 100vh;
}

button {
  font-family: inherit;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 14px;
}
button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: var(--accent); color: #1a1408; font-weight: bold; }
button.primary:hover { color: #000; }
button.danger { border-color: var(--danger); }

h1, h2, h3 { font-weight: normal; letter-spacing: 0.06em; }

.screen { max-width: 1560px; margin: 0 auto; padding: 20px; }

/* ── Setup ─────────────────────────────────── */
.setup-screen { max-width: 1150px; text-align: center; }
.setup-screen h1 { font-size: 34px; color: var(--accent); margin-bottom: 4px; }
.setup-screen .subtitle { color: var(--text-dim); margin-bottom: 28px; }
.setup-section { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.setup-section h3 { margin: 0 0 12px; color: var(--text-dim); font-size: 14px; text-transform: uppercase; letter-spacing: 0.15em; }
.choice-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.choice-row button.selected { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }

.char-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.char-card {
  background: var(--panel-2); border: 2px solid var(--border); border-radius: var(--radius);
  padding: 12px; cursor: pointer; text-align: left; position: relative;
}
.char-card.selected { border-color: var(--accent); }
.char-card h4 { margin: 0 0 2px; font-size: 18px; }
.char-card .class { color: var(--text-dim); font-style: italic; margin-bottom: 8px; }
.char-card .stats { font-size: 13px; color: var(--text-dim); display: flex; gap: 10px; }
.char-card .dot { width: 14px; height: 14px; border-radius: 3px; position: absolute; top: 12px; right: 12px; }
.char-card .mini-actions { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.char-card .mini-action { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; padding: 2px 0; }
.char-card .mini-action .name { color: var(--text); }
.char-card .mini-action .meta { color: var(--text-dim); white-space: nowrap; }

.fan-note { color: var(--text-dim); font-size: 12px; margin-top: 24px; }

/* Anleitung auf der Startseite */
.setup-guide { padding: 0; }
.setup-guide summary {
  cursor: pointer; padding: 14px 16px; color: var(--text-dim); font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.15em; list-style: none;
}
.setup-guide summary::-webkit-details-marker { display: none; }
.setup-guide summary::before { content: '▸ '; }
.setup-guide details[open] summary::before { content: '▾ '; }
.setup-guide summary:hover { color: var(--accent); }
.guide-body { text-align: left; padding: 0 18px 18px; line-height: 1.6; font-size: 14px; }
.guide-body h3 { color: var(--accent); font-size: 15px; margin: 20px 0 8px; }
.guide-body p { margin: 0 0 10px; }
.legend-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.legend-list dt { color: var(--accent); white-space: nowrap; }
.legend-list dd { margin: 0; color: var(--text); }

/* ── Intro / Ende ──────────────────────────── */
.story-card {
  max-width: 560px; margin: 60px auto; background: var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; text-align: center;
}
.story-card h2 { color: var(--accent); }
.story-card p { line-height: 1.6; }

/* ── Board ─────────────────────────────────── */
/* Breite/Höhe/Perspektive setzt board.js (layoutStage) */
.board-stage { position: relative; flex: none; }
.board { display: grid; gap: var(--gap); width: max-content; }

.cell {
  width: var(--cell); height: var(--cell); border-radius: 4px; position: relative;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: var(--ground);
}
.cell.alt { background: var(--ground-2); }
.cell.hidden-tile {
  background: #14100d url('../assets/tiles/tile-back.png?a=0f04782900') center / cover no-repeat;
  border: 1px solid #241c15;
}
.cell.wall {
  background: var(--wall) url('../assets/tiles/wall.png?a=0f04782900') center / cover no-repeat;
  outline: 2px solid rgba(10, 8, 6, 0.65); outline-offset: -2px;
}
.cell.obstacle::after {
  content: ''; position: absolute; inset: 2px;
  background: url('../assets/tiles/obstacle-pot.png?a=0f04782900') center / contain no-repeat;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7));
}
.board.stage-2 .cell.obstacle::after {
  background-image: url('../assets/tiles/obstacle-sarcophagus.png?a=0f04782900');
}
.cell.water { background: var(--water) url('../assets/tiles/water.png?a=0f04782900') center / cover no-repeat; }
.cell.gate {
  background: #3d2e1a url('../assets/tiles/gate-closed.png?a=0f04782900') center / cover no-repeat;
  outline: 2px solid rgba(10, 8, 6, 0.6); outline-offset: -2px;
}
.cell.gate.open { background-image: url('../assets/tiles/gate-open.png?a=0f04782900'); }
.cell.void { background: transparent; }

/* Bodentextur je Stage; Größe/Position setzt ui.js pro Zelle, damit sich die
   Textur über das ganze 7×7-Tile spannt statt sich in jeder Zelle zu wiederholen. */
.board.stage-1 .cell { background-image: url('../assets/tiles/ground-stage1.png?a=0f04782900'); }
.board.stage-2 .cell { background-image: url('../assets/tiles/ground-stage2.png?a=0f04782900'); }
.board.stage-3 .cell { background-image: url('../assets/tiles/ground-stage3.png?a=0f04782900'); }
/* Kammern IV–VI: bis eigene Böden existieren, Boden von Stage III.
   Vorgesehen (erst eintragen, wenn die Datei im Repo liegt — sonst 404 je Zelle):
     .board.stage-4 .cell { background-image: url('../assets/tiles/ground-stage4.png?a=0f04782900'); }
     .board.stage-5 .cell { background-image: url('../assets/tiles/ground-stage5.png?a=0f04782900'); }
     .board.stage-6 .cell { background-image: url('../assets/tiles/ground-stage6.png?a=0f04782900'); }
   Die Zeilen gehören direkt unter diese Regel (gleiche Spezifität, später gewinnt). */
.board.stage-4 .cell { background-image: url('../assets/tiles/ground-stage4.png?a=0f04782900'); }
.board.stage-5 .cell { background-image: url('../assets/tiles/ground-stage5.png?a=0f04782900'); }
.board.stage-6 .cell { background-image: url('../assets/tiles/ground-stage6.png?a=0f04782900'); }
.board .cell.wall { background-image: url('../assets/tiles/wall.png?a=0f04782900'); }
.board .cell.water { background-image: url('../assets/tiles/water.png?a=0f04782900'); }
/* Lava (Kammer V): dunkler Basalt mit glühenden Adern. CSS-Fallback — board.js
   spannt die Fläche wie jede Textur über das 7×7-Tile (700 %), die Adern laufen
   also über Zellgrenzen weiter. Eigene Textur vorgesehen unter
   assets/tiles/lava.png (erst eintragen, wenn vorhanden):
     .board .cell.lava { background-image: url('../assets/tiles/lava.png?a=0f04782900'); } */
.cell.lava, .board .cell.lava {
  background-color: #1d1210;
  background-image:
    radial-gradient(circle at 18% 26%, rgba(255, 170, 60, 0.55), rgba(255, 90, 20, 0) 7%),
    radial-gradient(circle at 64% 58%, rgba(255, 120, 30, 0.5), rgba(255, 70, 10, 0) 9%),
    radial-gradient(circle at 40% 86%, rgba(255, 190, 80, 0.45), rgba(255, 90, 20, 0) 6%),
    radial-gradient(circle at 86% 14%, rgba(255, 110, 30, 0.45), rgba(255, 70, 10, 0) 8%),
    repeating-linear-gradient(118deg, rgba(0, 0, 0, 0) 0 5%, rgba(255, 105, 25, 0.6) 5% 5.7%, rgba(0, 0, 0, 0) 5.7% 10.5%),
    repeating-linear-gradient(32deg, rgba(0, 0, 0, 0) 0 6.5%, rgba(214, 58, 18, 0.5) 6.5% 7.1%, rgba(0, 0, 0, 0) 7.1% 12.5%),
    linear-gradient(160deg, #2a1814, #140c0a);
  outline: 1px solid rgba(255, 110, 30, 0.25); outline-offset: -1px;
}
/* Glüh-Puls statt Wasser-Schimmer (nur opacity → Compositor) */
.board .cell.lava::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 140, 40, 0.38), rgba(255, 80, 20, 0.08) 70%, rgba(255, 80, 20, 0));
  opacity: 0.45; animation: lava-pulse 3.2s ease-in-out infinite;
}
.board .cell.lava:nth-child(3n+1)::after { animation-delay: -1.1s; }
.board .cell.lava:nth-child(3n+2)::after { animation-delay: -2.2s; }
@keyframes lava-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
/* Versteinerter Baum (Kammer IV), Draufsicht im 2D-Modus: graugrüne Steinkrone
   statt Topf (2.5D: aufrechtes Standee im Prop-Layer, s. .tree-sprite) */
.cell.obstacle.tree::after, .board.stage-2 .cell.obstacle.tree::after {
  inset: 3px; filter: none;
  background: radial-gradient(circle at 44% 40%, #9a9384 0 14%, #6f685b 15% 36%, #4a443a 37% 56%,
    rgba(28, 24, 20, 0.85) 57% 64%, rgba(0, 0, 0, 0) 66%);
}
.board .cell.hidden-tile { background-image: url('../assets/tiles/tile-back.png?a=0f04782900'); }
.board .cell.gate { background-image: url('../assets/tiles/gate-closed.png?a=0f04782900'); background-size: cover; background-position: center; }
.board .cell.gate.open { background-image: url('../assets/tiles/gate-open.png?a=0f04782900'); }
.board .cell.void { background: transparent; }

/* Farbe des aktiven Charakters (Fallback: Akzent-Gold), gesetzt von ui.js.
   Zielfelder: helle Umrandung + leichte Füllung (::before, über der Textur) */
.cell.reachable {
  outline: 2px solid color-mix(in srgb, var(--char-color, var(--accent)) 55%, #fff);
  outline-offset: -2px; cursor: pointer;
  --hl: color-mix(in srgb, var(--char-color, var(--accent)) 24%, transparent);
}
.cell.reachable:hover { outline-color: #fff; --hl: color-mix(in srgb, var(--char-color, var(--accent)) 40%, transparent); }
.cell.targetable {
  outline: 2px solid #ff6a5a; outline-offset: -2px; cursor: crosshair;
  --hl: rgba(220, 50, 40, 0.3);
}
.cell.heal-target {
  outline: 2px solid #6fdc95; outline-offset: -2px; cursor: pointer;
  --hl: rgba(63, 157, 99, 0.32);
}
.cell.reachable::before, .cell.targetable::before, .cell.heal-target::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: var(--hl);
}

/* Schrittzahlen: eigene Ebene in der ungekippten .board-overlay (board.js,
   placeHint). .hint ist ein 0×0-Anker auf der projizierten Zellmitte, das
   Badge zentriert sich darauf; Größe in Bildschirm-Pixeln (nicht gezoomt).
   Ohne Layout (vor dem Einhängen) liegt der Anker an der Zellecke. */
.hint-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; transition: opacity 0.15s; }
.hint-layer.settling { opacity: 0; transition: none; }
.hint { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; }
.hint-layer:not(.placed) .hint { width: var(--cell); height: var(--cell); }
.move-cost {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); box-sizing: border-box;
  min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px; pointer-events: none;
  display: flex; align-items: center; justify-content: center; white-space: nowrap;
  font-size: 14px; font-weight: bold; line-height: 1; color: #fff;
  background: #1b130d; border: 2px solid var(--char-color, var(--accent));
  box-shadow: 0 0 7px 1px rgba(255, 140, 50, 0.65), 0 1px 3px rgba(0, 0, 0, 0.9);
  text-shadow: 0 1px 2px #000;
}
.hint-layer.small .move-cost { min-width: 20px; height: 20px; border-radius: 10px; padding: 0 4px; font-size: 12px; }
.move-cost.pass { color: #c9bca8; border-style: dashed; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); } /* nur Durchgang */
.move-cost.blocked { color: #9a7a72; border-color: #6b4a44; text-decoration: line-through; box-shadow: none; } /* kein Halt */

.item-cube {
  width: 40px; height: 40px; border: none;
  background: url('../assets/props/chest.png?a=0f04782900') center / contain no-repeat;
  position: absolute; bottom: 2px; right: 2px;
  filter: drop-shadow(0 0 4px rgba(201, 162, 39, 0.7));
}
/* Goldschein, der beim Öffnen aufflammt */
.item-cube::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px;
  border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle closest-side, rgba(255, 220, 120, 0.95), rgba(255, 180, 60, 0.4) 55%, rgba(255, 160, 40, 0));
}
.cell.shift-target { background: rgba(201, 162, 39, 0.15); cursor: pointer; }
.dropped-marker { position: absolute; bottom: 3px; left: 3px; font-size: 11px; }

.pawn {
  position: relative;
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: bold; font-size: 15px; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8); border: 2px solid rgba(255,255,255,0.35);
  cursor: default; z-index: 2;
  transition: rotate 0.4s ease; /* Aufrichten beim Wechsel flach ↔ 2.5D */
}
.pawn.current { box-shadow: 0 0 10px 2px rgba(201,162,39,0.8); }
.pawn.monster { background: #1e1e1e; border-color: var(--danger); color: var(--danger); border-radius: 6px; }
.pawn.stealthed { opacity: 0.55; }

.reveal-badge {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(201,162,39,0.12); border: 2px solid var(--accent); border-radius: 4px;
  color: var(--accent); font-size: 18px; cursor: pointer; z-index: 3;
}

/* HP-Zahl am Monster-Pöppel auf dem Brett */
.pawn-hp {
  position: absolute; bottom: -3px; right: -4px; min-width: 14px; height: 14px;
  border-radius: 7px; background: #1a1613; border: 1px solid var(--danger);
  color: #f0c9c4; font-size: 9px; line-height: 12px; text-align: center; padding: 0 2px;
}

.item-card-text { font-size: 14px; line-height: 1.5; margin-bottom: 10px; }
.item-card-stats { width: 100%; font-size: 13px; border-collapse: collapse; }
.item-card-stats th { text-align: left; font-weight: normal; color: var(--text-dim); padding: 3px 8px 3px 0; }

/* ── Würfel-Overlay ────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex;
  align-items: center; justify-content: center; z-index: 50;
}
.dice-box {
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  padding: 28px 36px; text-align: center; min-width: 300px;
}
.dice-box .label { color: var(--text-dim); margin-bottom: 14px; }
.die {
  width: 84px; height: 84px; margin: 0 auto 14px; display: flex; align-items: center;
  justify-content: center; font-size: 38px; font-weight: bold; color: #f5eeda;
  background: linear-gradient(145deg, #2b2117, #17110c);
  border: 2px solid var(--accent); border-radius: 18px;
}
.die.rolling { animation: shake 0.09s infinite; }
@keyframes shake {
  0% { transform: rotate(-6deg) translateX(-2px); }
  50% { transform: rotate(5deg) translateX(2px); }
  100% { transform: rotate(-4deg); }
}
.dice-box input {
  width: 90px; font-size: 26px; text-align: center; background: var(--panel-2);
  border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 6px;
}

/* ── Modal (Ziel-/Item-Auswahl) ────────────── */
.modal-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ── Datenübersicht (data.html) ────────────── */
.dv { max-width: 1180px; }
.dv h1 { font-size: 28px; color: var(--accent); margin: 0; }
.dv h2 { font-size: 15px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.15em; margin: 0 0 12px; }
.dv h3 { margin: 0; font-size: 17px; }

.dv-top { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; padding-bottom: 12px; }
.dv-top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.dv-top-actions button.selected { border-color: var(--accent); color: var(--accent); }
.dv-sub { color: var(--text-dim); margin-top: 4px; }
.dv-link { color: var(--accent); text-decoration: none; font-size: 14px; }
.dv-link:hover { text-decoration: underline; }

.dv-nav { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 0 4px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.dv-nav a { color: var(--text-dim); text-decoration: none; font-size: 13px; text-transform: uppercase; letter-spacing: 0.1em; }
.dv-nav a:hover { color: var(--accent); }

.dv-section {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 12px; scroll-margin-top: 12px;
}
.dv-section > summary {
  cursor: pointer; padding: 12px 14px; display: flex; align-items: baseline; gap: 12px;
  list-style: none; flex-wrap: wrap;
}
.dv-section > summary::-webkit-details-marker { display: none; }
.dv-section > summary::before { content: '▸'; color: var(--text-dim); font-size: 12px; }
.dv-section[open] > summary::before { content: '▾'; }
.dv-section > summary:hover .dv-sec-title { color: var(--accent); }
.dv-sec-title { margin: 0; font-size: 15px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.15em; font-weight: normal; }
.dv-sec-meta { margin-left: auto; font-size: 12px; color: var(--text-dim); }
.dv-sec-body { padding: 0 14px 16px; }
.dv-sec-body > .dv-card:last-child { margin-bottom: 0; }
.dv-note { color: var(--text-dim); font-size: 13px; margin: 0 0 12px; }
.dv-dim { color: var(--text-dim); }
.dv-ok { color: #5fa66f; }
.dv-warn { color: var(--accent); }
.dv-bad { color: var(--danger); }

.dv-card { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.dv-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.dv-swatch { width: 14px; height: 14px; border-radius: 3px; }
.dv-badge { font-size: 11px; color: var(--text-dim); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; }
.dv-badge.accent { color: var(--accent); border-color: var(--accent); }
.dv-badge.danger { color: var(--danger); border-color: var(--danger); }
.dv-badge.warn { color: var(--accent); border-color: #5a4a1e; }
.dv-statline { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; margin-bottom: 10px; }
.dv-statline b { color: var(--text-dim); font-weight: normal; }

.dv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dv-table th { text-align: left; font-weight: normal; color: var(--text-dim); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--border); padding: 5px 8px; }
.dv-table td { padding: 5px 8px; border-bottom: 1px dotted #2c241d; vertical-align: top; }
.dv-table tr:last-child td { border-bottom: none; }
.dv-symbol { font-size: 18px; }

.dv-chamber { display: flex; gap: 18px; flex-wrap: wrap; }
.dv-chamber-text { flex: 1 1 380px; font-size: 13px; line-height: 1.55; }
.dv-chamber-text p { margin: 0 0 8px; }
.dv-layout { display: grid; gap: 3px; }
.dv-slot { width: 34px; height: 34px; border-radius: 3px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; color: var(--text-dim); background: #14100d; border: 1px dashed #2c241d; }
.dv-slot.start { background: var(--ground); border: 1px solid var(--accent); color: var(--accent); }
.dv-slot.empty { background: transparent; border: none; }

.dv-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.dv-controls button { padding: 5px 10px; font-size: 13px; }
.dv-controls button.selected { border-color: var(--accent); color: var(--accent); }
.dv-stage-head { margin: 22px 0 6px; color: var(--text); font-size: 15px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dv-stage-head .dv-dim { font-size: 12px; }
.dv-sec-body > .dv-stage-head:first-of-type { margin-top: 0; }
.dv-tiles { display: flex; gap: 14px; flex-wrap: wrap; }
.dv-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.dv-tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.dv-tile-head button { padding: 2px 8px; font-size: 12px; margin-left: auto; }
.dv-counts { font-size: 11px; margin-top: 8px; max-width: 168px; line-height: 1.4; }

/* Datenübersicht: Standees & Requisiten (Sichtkontrolle) */
.dv-art-head { margin: 14px 0 6px; font-size: 14px; color: var(--text-dim); }
.dv-art-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.dv-art { margin: 0; width: 120px; text-align: center; font-size: 11px; color: var(--text-dim); }
.dv-art img, .dv-art-none {
  display: block; width: 120px; height: 150px; object-fit: contain; object-position: 50% 100%;
  border-radius: 4px; border: 1px solid var(--border);
  background: repeating-conic-gradient(#2a2420 0% 25%, #1c1815 0% 50%) 0 0 / 16px 16px;
}
.dv-art.wide img, .dv-art.wall img { height: 96px; }
.dv-art.boss { width: 150px; } .dv-art.boss img { width: 150px; height: 190px; }
.dv-art.screen { width: 200px; } .dv-art.screen img { width: 200px; height: 134px; object-fit: cover; }
.dv-art-none { display: flex; align-items: center; justify-content: center; font-size: 22px; }
.dv-art.missing figcaption { color: var(--danger); }

.dv-grid { display: grid; gap: 1px; }
.dv-cell { width: 22px; height: 22px; border-radius: 2px; background: var(--ground);
  display: inline-flex; align-items: center; justify-content: center; position: relative; }
.dv-cell.alt { background: var(--ground-2); }
.dv-cell.wall { background: var(--wall); box-shadow: inset 0 0 0 1px #171411; }
.dv-cell.water { background: var(--water); }
.dv-cell.lava { background: repeating-linear-gradient(118deg, #2a1410 0 4px, #d4561a 4px 6px, #2a1410 6px 10px); }
.dv-cell.gate { background: #3d2e1a; box-shadow: inset 0 0 0 2px #6a4e22; }
.dv-cell.obstacle::after { content: ''; width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #6a5a45, #2d251c); position: absolute; }

.dv-mark { font-size: 9px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.dv-mark.item { width: 13px; height: 13px; background: #efe6d5; border-radius: 2px;
  box-shadow: 0 0 0 1px #8a7c6a, 0 0 5px 1px rgba(201,162,39,0.55); }
.dv-mark.spawn { width: 15px; height: 15px; background: #1e1e1e; border: 1px solid var(--danger);
  color: var(--danger); border-radius: 3px; font-weight: bold; }
.dv-mark.start { width: 16px; height: 16px; border-radius: 50%; color: #fff; font-weight: bold;
  border: 1px solid rgba(255,255,255,0.35); font-size: 10px; }

.dv-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px;
  color: var(--text-dim); margin-bottom: 16px; }
.dv-legend-item { display: inline-flex; align-items: center; gap: 5px; }

/* ── Generierte Assets: Rahmen, Icons, Illustrationen ── */

/* Panel-Rahmen (9-Slice aus frame-panel.png?a=0f04782900) */
.setup-section, .story-card, .dice-box {
  border: 12px solid transparent;
  border-image: url('../assets/ui/frame-panel.png?a=0f04782900') 107 / 12px stretch;
  background-clip: padding-box;
  border-radius: 0;
}

/* Button-Rahmen nur für die großen Schaltflächen */
button.primary {
  border: 7px solid transparent;
  border-image: url('../assets/ui/frame-button.png?a=0f04782900') 46 / 7px stretch;
  background-clip: padding-box;
  border-radius: 0;
}

/* Setup-Hero mit Menü-Hintergrund und Titel-Logo */
.setup-hero {
  position: relative; overflow: hidden; margin-bottom: 18px; padding: 26px 20px 20px;
  border: 12px solid transparent;
  border-image: url('../assets/ui/frame-panel.png?a=0f04782900') 107 / 12px stretch;
  background: url('../assets/screens/menu-background.png?a=0f04782900') center 30% / cover no-repeat;
}
.setup-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(rgba(13, 11, 9, 0.15), rgba(13, 11, 9, 0.72));
}
.setup-hero > * { position: relative; z-index: 1; }
.title-logo { display: block; margin: 0 auto; width: 200px; max-width: 55%; max-height: 200px; object-fit: contain; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.9)); }
.setup-hero h1 { margin: 6px 0 2px; text-shadow: 0 2px 10px #000, 0 0 20px #000; }
.setup-hero .subtitle { margin-bottom: 0; color: var(--text); text-shadow: 0 1px 6px #000; }
.setup-hero .tagline { color: var(--text-dim); font-size: 0.9em; text-shadow: 0 1px 6px #000; }

/* Zier-Trennlinie */
.divider {
  display: block; width: min(360px, 75%); margin: 8px auto 2px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
}

/* Stage-/End-Illustrationen in den Story-Karten */
.story-img { display: block; width: 100%; border-radius: 4px; margin-bottom: 16px; }
.story-card { max-width: 640px; }

/* Kleine UI-Icons statt Emoji */
.ui-icon { width: 2.5em; height: 2.5em; vertical-align: -0.8em; }

/* Item-Icons */
.item-icon { width: 48px; height: 48px; vertical-align: -16px; margin-right: 7px; }
.item-card-img {
  display: block; width: 120px; margin: 0 auto 12px;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.8));
}

/* Spielfiguren: Charakter-Tokens und Monster-Cubes */
.pawn.token { border: none; background-size: cover; background-position: center; }
.pawn.monster { background-size: cover; background-position: center; }

/* Charakter-Porträts: Auswahlkarten (Setup) und aktives Charakter-Panel */
.char-card .char-portrait {
  width: 100%; height: 210px; object-fit: cover; object-position: 50% 12%;
  border-radius: 5px; border: 3px solid var(--border); margin-bottom: 8px; display: block;
}

/* Setup: Sprache und Würfel als getrennte Gruppen mit Trennsteg */
.option-split {
  display: flex; justify-content: center; align-items: stretch;
  gap: 24px; flex-wrap: wrap;
}
.option-group { flex: 0 1 auto; }
.option-group h3 { margin: 0 0 10px; color: var(--text-dim); font-size: 14px;
  text-transform: uppercase; letter-spacing: 0.15em; }

/* Symbol-Legende (Modal) */
.lg-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 13px; line-height: 1.4; }
.lg-ico { display: inline-flex; gap: 3px; flex: none; }
.lg-swatch {
  width: 30px; height: 30px; border-radius: 4px; display: inline-flex;
  align-items: center; justify-content: center;
  background: var(--ground) center / cover no-repeat;
  border: 1px solid var(--border);
}
.lg-swatch.contain { background-size: 78%; background-position: center; background-repeat: no-repeat; }
.lg-swatch.round { border-radius: 50%; }
.lg-emoji { font-size: 15px; }
.lg-cost { color: var(--accent); font-weight: bold; font-size: 12px; text-shadow: 0 1px 3px #000; }
.lg-swatch.lg-target { outline: 2px solid var(--danger); outline-offset: -2px; }
.lg-swatch.lg-heal { outline: 2px solid #3f9d63; outline-offset: -2px; }
.lg-swatch.lg-lava {
  background: radial-gradient(circle at 30% 35%, rgba(255, 170, 60, 0.8), rgba(255, 90, 20, 0) 30%),
    repeating-linear-gradient(118deg, #1d1210 0 5px, #e0641c 5px 7px, #1d1210 7px 12px);
}
.lg-swatch.lg-tree {
  background: radial-gradient(circle at 44% 40%, #9a9384 0 14%, #6f685b 15% 36%, #4a443a 37% 56%, rgba(0, 0, 0, 0) 60%), var(--ground);
}

/* ── Touch ────────────────────────────────── */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
@media (pointer: coarse) {
  button { padding: 11px 16px; font-size: 15px; }
}

/* ── 3D-Würfel ─────────────────────────────── */
/* Portierung aus dnd-char2 (js/dice3d). Cinzel nur für die Würfelziffern und Einblendungen; Fallback Georgia. */
@font-face { font-family: 'Cinzel'; font-weight: 700; font-display: swap; src: url('../fonts/dice-cinzel.woff2?a=0f04782900') format('woff2'); }

/* 3D-Würfelwurf: liegt als eigener Dialog über allem, auch über offenen Popups */
dialog.dice3d { --dim: .5; position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; border-radius: 0; box-shadow: none; overflow: hidden; outline: none; cursor: pointer; touch-action: none;
  background: radial-gradient(ellipse at center, rgba(8, 6, 4, calc(var(--dim) * .35)), rgba(8, 6, 4, var(--dim))); opacity: 0; transition: opacity .2s ease; }
dialog.dice3d.on { opacity: 1; }
dialog.dice3d::backdrop { background: transparent; }
dialog.dice3d { padding: 0; border: 0; color: var(--text); } /* Browser-Standard für dialog zurücksetzen */
dialog.dice3d canvas { display: block; width: 100%; height: 100%; }
.dice3d-sum { position: absolute; left: 50%; bottom: 9%; transform: translate(-50%, 12px) scale(.8); min-width: 84px; padding: 4px 22px; border-radius: 999px; background: rgba(20, 16, 12, .82); border: 1px solid var(--border); color: var(--accent); font-family: Cinzel, Georgia, serif; font-size: 44px; font-weight: 800; line-height: 1.25; text-align: center; font-variant-numeric: tabular-nums; opacity: 0; transition: opacity .18s ease, transform .22s cubic-bezier(.2, 1.4, .4, 1); pointer-events: none; }
.dice3d-sum.on:not(:empty) { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Effekte bei natürlicher 20 (Glut-Flash) und 1 (roter Stoß + Shake) */
dialog.dice3d.crit { animation: dice3d-flash-crit .9s ease-out; }
dialog.dice3d.fumble { animation: dice3d-flash-fumble .9s ease-out; }
dialog.dice3d.fumble canvas { animation: dice3d-shake .45s linear; }
@keyframes dice3d-flash-crit { 0% { box-shadow: inset 0 0 0 0 rgba(255, 130, 40, 0); } 25% { box-shadow: inset 0 0 160px 30px rgba(255, 130, 40, .55); } 100% { box-shadow: inset 0 0 120px 0 rgba(255, 130, 40, 0); } }
@keyframes dice3d-flash-fumble { 0% { box-shadow: inset 0 0 0 0 rgba(170, 20, 20, 0); } 25% { box-shadow: inset 0 0 180px 40px rgba(170, 20, 20, .6); } 100% { box-shadow: inset 0 0 140px 10px rgba(170, 20, 20, .25); } }
@keyframes dice3d-shake { 0%, 100% { transform: translate(0, 0); } 15% { transform: translate(-9px, 4px); } 30% { transform: translate(8px, -5px); } 45% { transform: translate(-6px, -3px); } 60% { transform: translate(5px, 4px); } 80% { transform: translate(-2px, 1px); } }
.dice3d-fx { position: absolute; width: 0; height: 0; pointer-events: none; --fx: #ff8a2a; }
.dice3d-fx.fumble { --fx: #d42a2a; }
.dice3d-fx b { position: absolute; left: -90px; top: -90px; width: 180px; height: 180px; border-radius: 50%; border: 5px solid var(--fx); box-shadow: 0 0 34px 8px var(--fx), inset 0 0 26px 4px var(--fx); opacity: 0; animation: dice3d-ring .8s cubic-bezier(.2, .7, .3, 1) forwards; }
.dice3d-fx b + b { animation-delay: .16s; }
.dice3d-fx.fumble b { animation-name: dice3d-ring-in; }
@keyframes dice3d-ring { 0% { transform: scale(.3); opacity: .95; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes dice3d-ring-in { 0% { transform: scale(2.1); opacity: 0; } 60% { opacity: .9; } 100% { transform: scale(.45); opacity: 0; } }
.dice3d-fx i { position: absolute; left: -3px; top: -8px; width: 6px; height: 16px; border-radius: 3px; background: linear-gradient(#fff, var(--fx)); box-shadow: 0 0 10px 2px var(--fx); opacity: 0; transform: rotate(var(--a)) translateY(-50px); animation: dice3d-spark .85s cubic-bezier(.15, .7, .3, 1) forwards; }
.dice3d-fx.fumble i { background: linear-gradient(#5a0d0d, #1c0606); box-shadow: none; width: 9px; height: 9px; border-radius: 50%; animation-name: dice3d-debris; }
@keyframes dice3d-spark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(-46px) scaleY(.4); } 70% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-46px - var(--d))) scaleY(1.3); } }
@keyframes dice3d-debris { 0% { opacity: .9; transform: rotate(var(--a)) translateY(-40px); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(calc(-40px - var(--d) * .6)) scale(.4); } }
.dice3d-fx span { position: absolute; left: 0; top: -112px; transform: translateX(-50%); white-space: nowrap; font-family: Cinzel, Georgia, serif; font-size: 30px; font-weight: 700; color: #fff; text-shadow: 0 0 14px var(--fx), 0 0 4px var(--fx), 0 2px 3px rgba(0, 0, 0, .6); opacity: 0; animation: dice3d-tag 1.5s ease-out forwards; }
@keyframes dice3d-tag { 0% { opacity: 0; transform: translate(-50%, 16px) scale(.7); } 18% { opacity: 1; transform: translate(-50%, 0) scale(1.08); } 30% { transform: translate(-50%, 0) scale(1); } 100% { opacity: 1; transform: translate(-50%, -6px) scale(1); } }
.dice3d-label { position: absolute; left: 50%; top: 7%; transform: translateX(-50%); max-width: calc(100vw - 32px); padding: 4px 16px; border-radius: 999px; background: rgba(20, 16, 12, .75); border: 1px solid var(--border); color: var(--text); font-size: 16px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }

/* ── Lebendiges Board (Phase C) ────────────── */
/* Figuren-Layer: liegt deckungsgleich über dem Grid; Positionen per
   transform: translate(x·(cell+gap), y·(cell+gap)) aus js/ui/anim.js.
   Nicht klickbar — Klicks gehen an die Zellen darunter. */
.pawn-layer {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  pointer-events: none; z-index: 1;
}
.pawn-slot {
  position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell);
  display: flex; align-items: center; justify-content: center;
  /* will-change setzt anim.js nur während einer Bewegung */
}
.pawn-slot.marker { z-index: 1; }
.pawn-slot.figure { z-index: 2; }
.pawn-slot.is-current { z-index: 3; }
/* HP-Zahl sitzt wie früher an der Zellecke (Pawn 40px mittig, Rand 2px) */
.pawn-layer .pawn-hp { bottom: -11px; right: -12px; }

/* Aktiver Charakter: pulsierender Ring (am Slot — liegt im 2.5D-Modus flach am Boden) */
.pawn-slot.is-current::before {
  content: ''; position: absolute; inset: -1px; border-radius: 50%;
  border: 2px solid var(--accent); pointer-events: none;
  animation: pawn-ring 1.6s ease-out infinite;
}
@keyframes pawn-ring {
  0% { transform: scale(0.88); opacity: 0.95; }
  100% { transform: scale(1.32); opacity: 0; }
}

/* Treffer: Ziel blitzt weiß; Heilung: grüner Puls */
.pawn::after {
  content: ''; position: absolute; inset: -2px; border-radius: inherit;
  background: #fff; opacity: 0; pointer-events: none;
}
.pawn.hit::after { animation: pawn-flash 320ms ease-out; }
@keyframes pawn-flash { 0% { opacity: 0; } 25% { opacity: 0.9; } 100% { opacity: 0; } }
.pawn.healed::after { background: #4fd18b; border-radius: 50%; animation: pawn-heal 650ms ease-out; }
@keyframes pawn-heal {
  0% { opacity: 0; transform: scale(0.8); }
  30% { opacity: 0.75; }
  100% { opacity: 0; transform: scale(1.6); }
}

/* Angriff: kurzer Ausfallschritt Richtung Ziel (--lx/--ly setzt board.js) */
.pawn.lunge { animation: pawn-lunge 280ms ease-in-out; }
@keyframes pawn-lunge {
  0%, 100% { transform: translate(0, 0); }
  40% { transform: translate(var(--lx, 0), var(--ly, 0)) scale(1.08); }
}

/* Tod: Figur schrumpft und verblasst; Neuauftritt: kurzes Aufploppen */
.pawn-slot.dying { animation: slot-out 480ms ease-in forwards; }
.pawn-slot.dying > .pawn { animation: pawn-shrink 480ms ease-in forwards; }
@keyframes slot-out { 0%, 40% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pawn-shrink {
  0% { transform: scale(1) rotate(0); }
  100% { transform: scale(0.2) rotate(-25deg); }
}
.pawn-slot.entering { animation: slot-in 380ms ease-out backwards; }
.pawn-slot.entering > * { animation: pop-in 380ms cubic-bezier(.2, 1.5, .4, 1) backwards; animation-delay: inherit; }
@keyframes slot-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { transform: scale(0.3); } to { transform: scale(1); } }

/* Truhe öffnen: kurzes Wackeln, Goldschein flammt auf, Truhe hebt ab und verschwindet */
.pawn-slot.picked > .item-cube { animation: chest-open 620ms ease-in forwards; }
.pawn-slot.picked > .item-cube::before { animation: chest-glow 620ms ease-out forwards; }
@keyframes chest-open {
  0% { transform: none; opacity: 1; }
  15% { transform: rotate(-6deg) scale(1.05); }
  30% { transform: rotate(6deg) scale(1.1); }
  45% { transform: rotate(0) scale(1.15); opacity: 1; }
  100% { transform: translateY(-34px) scale(1.4); opacity: 0; }
}
@keyframes chest-glow {
  0%, 30% { opacity: 0; transform: scale(0.4); }
  50% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.8); }
}

/* Aufsteigende Zahlen und Hinweise („−2", „+1", „Daneben") */
.float-text {
  position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell);
  display: flex; align-items: flex-start; justify-content: center;
  pointer-events: none; z-index: 5;
}
.float-text > span {
  margin-top: -6px; font-weight: bold; font-size: 20px; white-space: nowrap;
  color: #ff6b5b; text-shadow: 0 1px 3px #000, 0 0 6px #000;
  animation: float-up 950ms ease-out forwards;
}
.float-text.heal > span { color: #5fe39a; }
.float-text.miss > span { color: var(--text); font-size: 13px; font-weight: normal; }
@keyframes float-up {
  0% { transform: translateY(6px) scale(0.7); opacity: 0; }
  15% { transform: translateY(0) scale(1.1); opacity: 1; }
  70% { opacity: 1; }
  100% { transform: translateY(-26px) scale(1); opacity: 0; }
}

/* Tile aufdecken: Zellen klappen mit Diagonal-Welle um (Verzögerung inline) */
.cell.flip-in { animation: tile-flip 340ms ease-out backwards; backface-visibility: hidden; }
@keyframes tile-flip {
  0% { transform: perspective(320px) rotateY(90deg); opacity: 0.4; }
  100% { transform: perspective(320px) rotateY(0); opacity: 1; }
}

/* Tor öffnet: geschlossenes Bild blendet über dem offenen aus */
.gate-fade {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: url('../assets/tiles/gate-closed.png?a=0f04782900') center / cover no-repeat;
}
.gate-fade.fading { animation: fade-out 520ms ease-in forwards; }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* Beben: Board wackelt */
.board-stage.quake { animation: board-quake 420ms linear; }
@keyframes board-quake {
  0%, 100% { transform: translate(0, 0); }
  12% { transform: translate(-6px, 2px); }
  25% { transform: translate(5px, -3px); }
  38% { transform: translate(-4px, -2px); }
  52% { transform: translate(4px, 3px); }
  66% { transform: translate(-3px, 1px); }
  80% { transform: translate(2px, -1px); }
}

/* Weniger Bewegung: alle Board-Animationen ohne Dauer (JS animiert dann gar nicht) */
@media (prefers-reduced-motion: reduce) {
  .board-wrap, .board-wrap *, .board-wrap *::before, .board-wrap *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
  }
  .pawn-slot.is-current::before { animation: none; opacity: 0.8; transform: scale(1.1); }
}

/* ══ Spielfläche (Phase C2) ═══════════════════════════════════════════
   Board = Bühne: füllt den Viewport unter dem HUD. HUD oben (44 px),
   Heldenleiste unten (≈ 120 px), Aktionsleiste schwebt darüber, Log als
   Drawer von rechts. Gleiches Layout für Desktop und iPad quer. */
:root {
  --hud-h: 44px;
  /* Tischmodus (Home-Bildschirm, Statusleiste black-translucent): das HUD
     wächst um die obere Safe-Area; alles, was unter dem HUD hängt, nutzt --hud-top */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --hud-top: calc(var(--hud-h) + var(--safe-top));
  --drawer-w: 360px;
  --glow: #ff8a2a;           /* Glut-Rahmen des aktiven Helden */
  --bar-bg: rgba(16, 13, 10, 0.9);
}

body.in-game { overflow: hidden; overscroll-behavior: none; }

.game-root {
  position: fixed; inset: 0; display: flex; flex-direction: column;
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
}
.game-main {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  transition: margin-right 0.22s ease;
}
.game-root.log-pinned .game-main { margin-right: var(--drawer-w); }

/* ── HUD ───────────────────────────────────── */
.hud {
  flex: none; height: var(--hud-top); display: flex; align-items: center; gap: 10px;
  padding: var(--safe-top) 8px 0 12px; position: relative; z-index: 20;
  background: linear-gradient(rgba(20, 16, 12, 0.97), rgba(14, 11, 9, 0.92));
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.hud-left { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; flex: none; }
.hud-title { color: var(--accent); font-size: 16px; letter-spacing: 0.08em; font-variant: small-caps; }
.hud-chamber { font-size: 13px; color: var(--text); }
.hud-round { font-size: 13px; color: var(--text-dim); }
.hud-log {
  flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 12px; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: rgba(0, 0, 0, 0.28); border: 1px solid transparent; border-radius: 8px;
  color: var(--text-dim); font-size: 13px;
}
.hud-log:hover:not(:disabled) { color: var(--text); border-color: var(--border); }
.hud-right { display: flex; align-items: center; gap: 4px; flex: none; }
.icon-btn {
  min-width: 44px; height: 40px; padding: 0 8px; font-size: 19px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
}
.icon-btn:hover:not(:disabled) { border-color: var(--border); background: var(--panel-2); }
.hud-icon { width: 30px; height: 30px; }
.hud-spacer { flex: 1; }
.hud-text-btn {
  font-size: 13px; padding: 6px 10px; min-height: 36px; background: transparent;
  border: 1px solid transparent; border-radius: 8px; color: var(--text-dim);
  text-decoration: none; display: inline-flex; align-items: center;
}
.hud-text-btn:hover { color: var(--accent); border-color: var(--border); }
@media (pointer: coarse) {
  .icon-btn { padding: 0 8px; font-size: 20px; }
  .hud-text-btn { padding: 8px 12px; font-size: 14px; }
}

/* ── Board-Bühne ───────────────────────────── */
.board-area {
  position: relative; flex: 1 1 auto; min-height: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.45));
}
.board-wrap {
  position: absolute; inset: 0; overflow: auto; display: flex;
  /* unten Platz für die schwebende Aktionsleiste; im Spiel setzt board.js
     (fitPadding) ≈ die halbe Sichtfläche, damit jede Zelle in die Mitte passt */
  padding: 28px 28px 132px;
  overscroll-behavior: contain;
  contain: layout paint;
  /* Verschieben per Ziehen (pan.js) — der Browser soll selbst weder scrollen
     noch zoomen; Scroll bleibt programmatisch, Balken ausgeblendet */
  touch-action: none; cursor: grab;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  scrollbar-width: none;
}
.board-wrap::-webkit-scrollbar { display: none; }
.board-wrap.panning, .board-wrap.panning * { cursor: grabbing !important; }
/* margin:auto zentriert und bleibt bei Überlauf scrollbar (kein Abschneiden) */
.board-wrap > .board-stage { margin: auto; flex: none; }
.cell.inspectable { cursor: help; }


/* ── Aktionsleiste ─────────────────────────── */
.action-bar {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 5;
  max-width: calc(100% - 150px); display: flex; flex-direction: column; align-items: center;
  gap: 6px; pointer-events: none;
}
.action-bar > * { pointer-events: auto; }
.action-bar.idle { display: none; }
.bar-hint {
  background: rgba(20, 16, 12, 0.94); color: var(--accent); font-size: 14px;
  padding: 5px 16px; border-radius: 999px; border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5); text-align: center; max-width: 100%;
}
.bar-row {
  display: flex; align-items: stretch; gap: 8px; padding: 6px; max-width: 100%;
  overflow-x: auto; background: var(--bar-bg); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.bar-group { display: flex; gap: 6px; align-items: stretch; }
.bar-group + .bar-group { border-left: 1px solid var(--border); padding-left: 8px; }
.bar-group:empty { display: none; }
.bar-btn {
  min-height: 56px; min-width: 56px; padding: 4px 9px; border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  font-size: 12px; line-height: 1.15; white-space: nowrap; position: relative;
}
.bar-icon { width: 28px; height: 28px; }
.bar-emoji { font-size: 22px; line-height: 28px; }
.skill-label { font-size: 12px; }
.skill-meta { font-size: 10.5px; color: var(--text-dim); }
.skill-meta .ui-icon, .ability-name .ui-icon { width: 1.7em; height: 1.7em; vertical-align: -0.55em; }
.skill-btn.last { border-color: var(--accent); }
.skill-btn.last::after {
  content: ''; position: absolute; top: 4px; right: 4px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent);
}
.skill-btn.burned::after { content: '✖'; position: absolute; top: 2px; right: 5px; color: var(--danger); font-size: 11px; }
.skill-btn:disabled { filter: grayscale(0.6); }
.bar-move {
  display: flex; align-items: center; gap: 2px; padding: 0 6px 0 2px;
  color: var(--char-color, var(--accent)); font-size: 22px; font-weight: bold;
}
.bar-move small { font-size: 12px; color: var(--text-dim); font-weight: normal; }
.bar-btn.end-btn { min-width: 110px; font-size: 14px; }
.bar-btn.cancel-btn { border-color: var(--danger); min-width: 120px; font-size: 14px; }
.action-bar.targeting .bar-row { border-color: var(--danger); }

/* ── Heldenleiste ──────────────────────────── */
.party-bar {
  flex: none; min-height: 120px; display: flex; gap: 10px; justify-content: center;
  align-items: stretch; overflow-x: auto;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(16, 13, 10, 0.88), rgba(10, 8, 6, 0.97));
  border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.45);
}
.hero-card {
  flex: 0 1 270px; min-width: 200px; display: flex; gap: 10px; align-items: center;
  padding: 8px 10px 8px 8px; text-align: left; border-radius: 12px;
  background: var(--panel); border: 2px solid var(--border); color: var(--text);
}
.hero-card:hover:not(:disabled) { border-color: var(--char-color); color: var(--text); }
.hero-card.current {
  border-color: var(--glow);
  box-shadow: 0 0 0 1px var(--glow), 0 0 18px 2px rgba(255, 138, 42, 0.5),
    inset 0 0 16px rgba(255, 138, 42, 0.18);
}
.hero-card.dead { filter: grayscale(1) brightness(0.55); }
.hero-card.dead .hero-name { text-decoration: line-through; }
.hero-portrait {
  width: 84px; height: 84px; flex: none; border-radius: 10px; object-fit: cover;
  object-position: 50% 12%; border: 2px solid var(--char-color, var(--border));
}
.hero-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.hero-name { font-size: 16px; color: var(--char-color, var(--text)); filter: brightness(1.35); }
.hero-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.hero-armor { display: inline-flex; align-items: center; gap: 2px; color: var(--text); }
.mini-icon { width: 20px; height: 20px; vertical-align: -5px; }
.status-icon { width: 22px; height: 22px; vertical-align: -6px; filter: drop-shadow(0 0 4px rgba(201, 162, 39, 0.8)); }
.hero-items { display: flex; gap: 3px; flex-wrap: wrap; }
.mini-item { width: 24px; height: 24px; filter: drop-shadow(0 1px 2px #000); }

.hp-track { display: flex; gap: 3px; flex-wrap: wrap; margin: 2px 0; }
.hp-pip { width: 14px; height: 14px; border-radius: 3px; background: #35291f; border: 1px solid var(--border); }
.hp-pip.full { background: var(--danger); border-color: #e74c3c; }
.hero-hp .hp-pip { width: 11px; height: 11px; border-radius: 2px; }
.hp-bar { height: 5px; background: #35291f; border-radius: 3px; overflow: hidden; margin: 4px 0 5px; }
.hp-bar span { display: block; height: 100%; background: var(--danger); }

/* ── Log-Drawer ────────────────────────────── */
.log-drawer {
  position: fixed; top: var(--hud-top); right: 0; bottom: 0; width: min(var(--drawer-w), 92vw);
  z-index: 30; display: flex; flex-direction: column;
  background: rgba(18, 15, 12, 0.97); border-left: 1px solid var(--border);
  box-shadow: -10px 0 28px rgba(0, 0, 0, 0.55);
  transform: translateX(100%); visibility: hidden;
  transition: transform 0.22s ease, visibility 0s linear 0.22s;
  padding-bottom: env(safe-area-inset-bottom);
}
.log-drawer.open { transform: none; visibility: visible; transition: transform 0.22s ease; }
.log-drawer.pinned { box-shadow: none; z-index: 15; }
.log-drawer-head {
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px;
  border-bottom: 1px solid var(--border);
}
.log-drawer-head h3 {
  margin: 0; flex: 1; font-size: 13px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.15em;
}
.pin-btn { display: none; font-size: 13px; padding: 8px 10px; min-height: 40px; }
.pin-btn.selected { border-color: var(--accent); color: var(--accent); }
@media (min-width: 1400px) { .pin-btn { display: inline-flex; align-items: center; } }
.log-drawer .log { flex: 1; overflow-y: auto; padding: 6px 14px 14px; font-size: 13px; line-height: 1.5; }
.log-drawer .log div { border-bottom: 1px dotted #2c241d; padding: 4px 0; }
.log-drawer .log div:first-child { color: var(--accent); }
.log-empty { color: var(--text-dim); }
.log-backdrop { position: fixed; top: var(--hud-top); left: 0; right: 0; bottom: 0; z-index: 29; display: none; background: rgba(0, 0, 0, 0.25); }
.log-backdrop.open { display: block; }

/* ── Toasts & Banner ───────────────────────── */
.toast-stack {
  position: fixed; top: calc(var(--hud-top) + 10px); left: 50%; transform: translateX(-50%);
  z-index: 45; width: min(640px, calc(100vw - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.toast {
  pointer-events: auto; cursor: pointer; max-width: 100%;
  background: rgba(20, 16, 12, 0.96); color: var(--text); font-size: 14px; line-height: 1.4;
  padding: 8px 14px; border: 1px solid var(--border); border-left: 4px solid var(--text-dim);
  border-radius: 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  animation: toast-in 0.2s ease-out; transition: opacity 0.18s ease;
}
.toast b { color: var(--accent); font-weight: bold; }
.toast.hit { border-left-color: var(--glow); }
.toast.miss { border-left-color: var(--text-dim); }
.toast.strip { border-left-color: var(--accent); color: var(--accent); }
.toast.more { font-style: italic; color: var(--text-dim); }
.toast.leaving { opacity: 0; }
.toast.at-cell {
  position: fixed; z-index: 45; transform: translate(-50%, -100%);
  width: max-content; max-width: min(520px, 90vw);
}
@keyframes toast-in { from { opacity: 0; } to { opacity: 1; } }
.spinner { display: inline-block; animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.turn-banner {
  position: fixed; inset: 0; z-index: 55; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8, 6, 4, 0.45), rgba(8, 6, 4, 0.78));
  animation: toast-in 0.25s ease-out;
}
.turn-banner-text {
  display: flex; align-items: center; gap: 20px; padding: 18px 40px;
  font-family: Cinzel, Georgia, serif; font-size: 40px; letter-spacing: 0.06em;
  text-shadow: 0 2px 14px #000; background: rgba(14, 11, 9, 0.85);
  border-top: 1px solid var(--accent); border-bottom: 1px solid var(--accent);
}
.banner-portrait {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover; object-position: 50% 12%;
  border: 3px solid var(--accent);
}

/* ── Modals / Popover ──────────────────────── */
.modal-box { position: relative; max-height: 88vh; overflow-y: auto; }
.modal-close {
  position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; padding: 0;
  background: transparent; border: none; font-size: 20px; color: var(--text-dim);
}
.modal-title { margin: 0 0 12px; color: var(--accent); padding-right: 40px; }
.text-overlay .modal-box { max-width: 640px; width: calc(100vw - 32px); text-align: left; }
.modal-text { line-height: 1.6; font-size: 14px; }
.modal-text h3 { color: var(--accent); font-size: 15px; margin: 18px 0 6px; }
.modal-text p { margin: 0 0 10px; }

.popover-backdrop { position: fixed; inset: 0; z-index: 40; }
.menu-pop {
  position: absolute; top: calc(var(--hud-top) + 2px); right: calc(8px + env(safe-area-inset-right, 0px)); min-width: 250px;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: rgba(20, 16, 12, 0.98); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.65);
}
.menu-item {
  min-height: 44px; padding: 10px 12px; text-align: left; font-size: 15px;
  display: flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
}
.menu-item:hover:not(:disabled) { background: var(--panel-2); border-color: var(--border); }
.menu-item.info:disabled { opacity: 0.65; font-size: 13px; }
.menu-item.danger { color: #e0796d; }

/* Charakterbogen */
.char-sheet { width: min(740px, calc(100vw - 32px)); text-align: left; padding: 22px 26px; }
.sheet-head { display: flex; gap: 16px; align-items: center; padding-right: 36px; }
.sheet-portrait {
  width: 110px; height: 110px; border-radius: 12px; object-fit: cover; object-position: 50% 12%;
  border: 3px solid var(--border); flex: none;
}
.sheet-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.15em; color: var(--text-dim); }
.sheet-id h2 { margin: 2px 0; filter: brightness(1.35); }
.sheet-class { font-style: italic; color: var(--text-dim); }
.sheet-desc { margin: 12px 0 0; line-height: 1.55; font-size: 14px; }
.sheet-section { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 14px; }
.sheet-section h4 {
  margin: 0 0 8px; font-size: 12px; font-weight: normal; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.15em;
}
.sheet-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; margin-top: 4px; }
.sheet-stats .ui-icon { width: 1.9em; height: 1.9em; vertical-align: -0.6em; }
.sheet-status div { font-size: 13px; color: var(--accent); margin-top: 6px; }
.sheet-ability, .sheet-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 7px 0;
  border-bottom: 1px dotted #2c241d;
}
.sheet-ability:last-child, .sheet-item:last-child { border-bottom: none; }
.ability-icon { width: 40px; height: 40px; flex: none; }
.ability-name { font-size: 15px; }
.ability-name .meta { font-size: 12px; color: var(--text-dim); margin-left: 6px; }
.ability-text { font-size: 13px; color: var(--text-dim); line-height: 1.45; }
.ability-flags { font-size: 12px; margin-top: 2px; }
.sheet-item { flex-wrap: wrap; justify-content: space-between; align-items: center; }
.sheet-item-info { display: flex; gap: 8px; align-items: center; flex: 1 1 300px; min-width: 0; }
.sheet-item-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.sheet-item-btns button { min-height: 44px; }
.panel-note { color: var(--text-dim); font-size: 12px; margin-top: 8px; }

/* Monster-Info am Monster (hängt im Figuren-Layer, zoomt/scrollt mit) */
.monster-pop-slot {
  position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell);
  z-index: 8; pointer-events: none;
}
.monster-pop {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  width: 260px; pointer-events: auto; cursor: pointer; text-align: left;
  background: rgba(20, 16, 12, 0.97); border: 1px solid var(--danger); border-radius: 10px;
  padding: 10px 12px; font-size: 13px; line-height: 1.4; color: var(--text);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.65); animation: toast-in 0.15s ease-out;
}
.monster-pop-slot.below .monster-pop { bottom: auto; top: calc(100% + 8px); }
.monster-pop-slot.floating { position: fixed; top: calc(var(--hud-top) + 70px); left: 50%; z-index: 44; }
.mp-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.mp-head > div { flex: 1; min-width: 0; }
.mp-thumb { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); flex: none; }
.mp-name { color: #e0a9a2; font-size: 15px; }
.mp-hp { font-size: 12px; }
.mp-row { margin-top: 3px; }
.mp-row b { color: var(--text-dim); font-weight: normal; margin-right: 4px; }

/* ── Setup, Story, Datenübersicht im gleichen Stil ── */
.setup-page .hud, .dv .dv-top { position: sticky; top: 0; }
.setup-page { min-height: 100vh; }
.setup-screen { padding-top: 16px; }
.story-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.story-screen .story-card { margin: 20px auto; }

.dv .dv-top {
  z-index: 10; margin: -20px -20px 0; padding: 8px 20px; align-items: center;
  background: linear-gradient(rgba(20, 16, 12, 0.97), rgba(14, 11, 9, 0.93));
  border-bottom: 1px solid var(--border); box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}
.dv .dv-top h1 { font-size: 18px; letter-spacing: 0.08em; font-variant: small-caps; }
.dv .dv-top .dv-sub { font-size: 12px; margin-top: 0; }
.dv-nav { margin-top: 12px; }

/* ── Unter 1024 px (kein Zielgerät): nur kleiner skalieren ── */
@media (max-width: 1023px) {
  .hud, .party-bar, .action-bar, .log-drawer, .toast-stack { zoom: 0.85; }
  .hud-round { display: none; }
}
@media (max-width: 700px) {
  .hud, .party-bar, .action-bar, .log-drawer, .toast-stack { zoom: 0.7; }
  .hud-chamber { display: none; }
  .action-bar { max-width: calc(100% - 80px); }
  .hero-card { min-width: 170px; }
  .turn-banner-text { font-size: 26px; padding: 14px 20px; }
  .banner-portrait { width: 64px; height: 64px; }
  .screen { padding: 10px; }
  .char-pick { grid-template-columns: 1fr 1fr; gap: 10px; }
  .char-card .char-portrait { height: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  .toast, .turn-banner, .log-drawer, .monster-pop, .game-main, .spinner {
    animation: none !important; transition: none !important;
  }
}

/* ══ 2.5D-Look (Phase D): geneigter Tisch mit Standees ═══════════════
   Hierarchie (siehe js/ui/board.js):
   .board-stage (perspective, Größe per JS, --rot animiert)
     .board-tilt (scale3d(--zoom) rotateX(--tilt) rotateZ(--rot), preserve-3d)
       .board — flache Zellen, eine Ebene
       .board-ambient — Nebel + Heldenlicht, flach
       .prop-layer — Wände (Quader), Töpfe/Särge, Tore
       .pawn-layer — Figuren/Monster/Marker als Standees
     .board-overlay — nicht gekippt (Monster-Info)
   Aufrechte Elemente: rotate: x (−tilt), transform-origin unten Mitte;
   ihre Slots drehen per rotate(−1 · --rot) gegen die Kartendrehung zurück.
   .tilted fehlt bei 0° → alles wie bisher (Top-Down, Prop-Layer aus).
   Animiert wird nur transform/opacity; keine box-shadow/filter auf Zellen. */
:root { --wall-h: 22px; }

/* HUD: Ansicht 2.5D/2D */
.icon-btn.hud-tilt { font-size: 13px; font-weight: bold; font-family: inherit; letter-spacing: 0.02em; color: var(--text-dim); }
.icon-btn.hud-tilt.active { color: var(--accent); }
/* HUD: Kompass (Karte gedreht → Akzentfarbe, Tipp = Norden) */
.icon-btn.hud-compass { color: var(--text-dim); }
.icon-btn.hud-compass.active { color: var(--accent); }
.icon-btn.hud-compass svg { transition: transform 0.4s ease; }

/* Kartendrehung: als <angle> registriert, damit der Übergang auf
   .board-stage auch alle Gegenrotationen (var(--rot)) mitnimmt.
   Ohne @property-Unterstützung springt die Drehung nur. */
@property --rot { syntax: '<angle>'; inherits: true; initial-value: 0deg; }
.board-stage { transition: --rot 0.4s ease; }
.board-stage.instant { transition: none; }

.board-tilt {
  position: absolute; left: 0; top: 0;
  transform-origin: 50% 50%; /* Drehpunkt Board-Mitte (Neigung und Drehung) */
  transform: scale3d(var(--zoom, 1), var(--zoom, 1), var(--zoom, 1)) rotateX(var(--tilt, 0deg)) rotateZ(var(--rot, 0deg));
  transition: transform 0.4s ease, top 0.4s ease, left 0.4s ease;
}
.board-tilt.moving { will-change: transform; }
.board-tilt.instant { transition: none; } /* Rad-/Pinch-Zoom folgt dem Finger direkt */
.board-stage.tilted .board-tilt { transform-style: preserve-3d; }
.board-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

/* Licht & Nebel: flach auf dem Boden, über den Zellen, unter Figuren */
.board-ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.board-stage.tilted .board-ambient { transform: translateZ(1px); }
/* Nebel ferner Reihen: bleibt bei gedrehter Karte bildschirmfest (hinten =
   oben). Quadrat mit der Board-Diagonale (--diag), um die Board-Mitte gegen
   die Drehung zurückgedreht und vom Ambient auf das Board beschnitten.
   Stopps relativ zur Board-Höhe (--fh = H / diag): 0 %, 35 %, 65 %. */
.board-stage.tilted .board-ambient::before {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: var(--diag, 100%); height: var(--diag, 100%); margin: calc(var(--diag, 0px) / -2);
  transform: rotate(calc(-1 * var(--rot, 0deg)));
  background: linear-gradient(to bottom,
    rgba(6, 4, 3, 0.62) calc(50% - var(--fh, 1) * 50%),
    rgba(6, 4, 3, 0.26) calc(50% - var(--fh, 1) * 15%),
    rgba(6, 4, 3, 0) calc(50% + var(--fh, 1) * 15%));
}
.hero-light {
  position: absolute; left: calc(var(--cell) * -2.5); top: calc(var(--cell) * -2.5);
  width: calc(var(--cell) * 6); height: calc(var(--cell) * 6); border-radius: 50%;
  background: radial-gradient(circle closest-side, rgba(255, 178, 96, 0.2), rgba(255, 150, 70, 0.08) 55%, rgba(255, 140, 60, 0));
  transition: transform 0.5s ease-out;
  animation: light-pulse 3s ease-in-out infinite;
}
@keyframes light-pulse { 0%, 100% { opacity: 0.75; } 50% { opacity: 1; } }

/* Wasser: leiser Schimmer */
.board .cell.water::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(120deg, rgba(190, 225, 255, 0) 25%, rgba(190, 225, 255, 0.18) 45%, rgba(190, 225, 255, 0) 65%);
  opacity: 0; animation: water-shimmer 4.5s ease-in-out infinite;
}
.board .cell.water:nth-child(3n+1)::after { animation-delay: -1.5s; }
.board .cell.water:nth-child(3n+2)::after { animation-delay: -3s; }
@keyframes water-shimmer { 0%, 100% { opacity: 0; } 50% { opacity: 1; } }

/* Zellen im 2.5D-Modus: Böden unter Wänden/Toren dunkel, Topf/Sarg kommt als Standee */
.board-stage.tilted .board .cell.wall { background-image: none; background-color: #0b0908; outline: none; }
.board-stage.tilted .board .cell.gate { background-image: none; background-color: #17120d; outline: none; }
.board-stage.tilted .cell.obstacle::after { display: none; }
/* Aufdecken: die Karte klappt um die X-Achse */
.board-stage.tilted .cell.flip-in { animation-name: tile-flip-x; }
@keyframes tile-flip-x {
  0% { transform: perspective(320px) rotateX(-90deg); opacity: 0.4; }
  100% { transform: perspective(320px) rotateX(0); opacity: 1; }
}

/* ── Requisiten ── */
.prop-layer { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; display: none; }
.board-stage.tilted .prop-layer { display: block; transform-style: preserve-3d; transform: translateZ(1.5px); }
.prop { position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell); transform-style: preserve-3d; }
.board-stage.tilted .prop > .wall-lid,
.board-stage.tilted .prop > .wall-face,
.board-stage.tilted .prop > .standee { pointer-events: auto; }
.prop.entering > * { animation: slot-in 380ms ease-out backwards; animation-delay: inherit; }

/* Wand = Quader: Deckel auf Wandhöhe, Vorderseite + offene Seiten senkrecht.
   54 px statt 52 → keine Fuge zwischen Nachbarwänden. --fog setzt board.js je Reihe.
   Texturen je Kammer: Front/Seiten wall-stageN.png (horizontal kachelbar, Fuß
   unten), Deckel abgedunkelter Boden der Kammer. Kammern ohne eigene Datei
   (IV+) fallen über die Kaskade auf Stage III zurück. */
.board-tilt {
  --wall-tex: url('../assets/tiles/wall-stage3.png?a=0f04782900');
  --lid-tex: url('../assets/tiles/ground-stage3.png?a=0f04782900');
}
.board-tilt.stage-1 {
  --wall-tex: url('../assets/tiles/wall-stage1.png?a=0f04782900');
  --lid-tex: url('../assets/tiles/ground-stage1.png?a=0f04782900');
}
.board-tilt.stage-2 {
  --wall-tex: url('../assets/tiles/wall-stage2.png?a=0f04782900');
  --lid-tex: url('../assets/tiles/ground-stage2.png?a=0f04782900');
}
.board-tilt.stage-4 { --wall-tex: url('../assets/tiles/wall-stage4.png?a=0f04782900'); --lid-tex: url('../assets/tiles/ground-stage4.png?a=0f04782900'); }
.board-tilt.stage-5 { --wall-tex: url('../assets/tiles/wall-stage5.png?a=0f04782900'); --lid-tex: url('../assets/tiles/ground-stage5.png?a=0f04782900'); }
.board-tilt.stage-6 { --wall-tex: url('../assets/tiles/wall-stage6.png?a=0f04782900'); --lid-tex: url('../assets/tiles/ground-stage6.png?a=0f04782900'); }
.wall-lid, .wall-face { position: absolute; }
.wall-lid {
  left: -1px; top: -1px;
  width: calc(var(--cell) + var(--gap)); height: calc(var(--cell) + var(--gap));
  transform: translateZ(var(--wall-h));
  background:
    linear-gradient(rgba(6, 4, 3, var(--fog, 0)), rgba(6, 4, 3, var(--fog, 0))),
    linear-gradient(to top, rgba(255, 226, 180, 0.32), rgba(255, 226, 180, 0) 3px),
    linear-gradient(rgba(10, 8, 6, 0.55), rgba(10, 8, 6, 0.55)),
    #1f1b17 var(--lid-tex) center / 162px;
}
.wall-face.s {
  left: -1px; bottom: -1px; width: calc(var(--cell) + var(--gap)); height: var(--wall-h);
  transform-origin: 50% 100%; transform: rotateX(-90deg);
  background:
    linear-gradient(rgba(6, 4, 3, var(--fog, 0)), rgba(6, 4, 3, var(--fog, 0))),
    linear-gradient(rgba(255, 226, 180, 0.22), rgba(255, 226, 180, 0) 3px),
    linear-gradient(rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.3)),
    #1d1a16 var(--wall-tex) center bottom / 54px auto repeat-x;
}
.wall-face.e, .wall-face.w {
  top: -1px; width: var(--wall-h); height: calc(var(--cell) + var(--gap));
  background:
    linear-gradient(rgba(6, 4, 3, var(--fog, 0)), rgba(6, 4, 3, var(--fog, 0))),
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.45)),
    #141210 var(--wall-tex) center / auto 54px;
}
/* Nordseite (nur bei gedrehter Karte zu sehen): wie die Südseite, ohne
   Fackel; Fuß der Textur unten am Boden, steht an der Oberkante der Zelle */
.wall-face.n {
  left: -1px; top: calc(-1px - var(--wall-h)); width: calc(var(--cell) + var(--gap)); height: var(--wall-h);
  transform-origin: 50% 100%; transform: rotateX(-90deg);
  background:
    linear-gradient(rgba(6, 4, 3, var(--fog, 0)), rgba(6, 4, 3, var(--fog, 0))),
    linear-gradient(rgba(255, 226, 180, 0.22), rgba(255, 226, 180, 0) 3px),
    linear-gradient(rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.3)),
    #1d1a16 var(--wall-tex) center bottom / 54px auto repeat-x;
}
.wall-face.e { left: calc(100% + 1px); transform-origin: 0 50%; transform: rotateY(-90deg); }
.wall-face.w { right: calc(100% + 1px); transform-origin: 100% 50%; transform: rotateY(90deg); }

/* Fackel an der Wand + flackernder Lichtfleck davor auf dem Boden */
.torch {
  position: absolute; left: 50%; bottom: 0; width: 18px; height: 28px; margin-left: -9px;
  background: url('../assets/props/torch.png?a=0f04782900') center bottom / contain no-repeat;
}
.torch::after {
  content: ''; position: absolute; left: 50%; top: -10px; width: 30px; height: 30px; margin-left: -15px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle closest-side, rgba(255, 196, 100, 0.6), rgba(255, 140, 40, 0));
  animation: torch-flicker 1.4s ease-in-out infinite alternate;
}
.torch-glow {
  position: absolute; left: calc(var(--cell) * -1); top: 8px;
  width: calc(var(--cell) * 3); height: calc(var(--cell) * 2); border-radius: 50%;
  pointer-events: none; transform: translateZ(0.5px);
  background: radial-gradient(ellipse closest-side, rgba(255, 160, 70, 0.28), rgba(255, 140, 50, 0));
  animation: torch-glow 1.4s ease-in-out infinite alternate;
}
@keyframes torch-flicker {
  0% { opacity: 0.65; transform: scale(0.9); }
  30% { opacity: 1; transform: scale(1.06); }
  55% { opacity: 0.75; transform: scale(0.95); }
  80% { opacity: 0.95; transform: scale(1.02); }
  100% { opacity: 0.7; transform: scale(0.92); }
}
@keyframes torch-glow { 0% { opacity: 0.7; } 40% { opacity: 1; } 70% { opacity: 0.8; } 100% { opacity: 0.95; } }

/* Aufgerichtete Sprites (Topf/Sarg, Tor) mit flachem Bodenschatten */
.standee {
  position: absolute; transform-origin: 50% 100%;
  rotate: x calc(-1 * var(--tilt, 0deg)); transition: rotate 0.4s ease;
}
.prop-shadow {
  position: absolute; left: 6px; bottom: 1px; width: 40px; height: 14px; border-radius: 50%;
  pointer-events: none; transform: translateZ(0.5px);
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
}
.prop-shadow.wide { left: -2px; bottom: 6px; width: 56px; }
/* Requisiten-Standees (assets/props, transparent, Bodenkontakt unten);
   Nebel ferner Reihen als Helligkeitsfilter statt Farbfläche */
.obstacle-sprite, .gate-sprite { filter: brightness(calc(1 - var(--fog, 0))); }
.obstacle-sprite {
  left: 6px; bottom: 8px; width: 40px; height: 40px;
  background: url('../assets/props/pot.png?a=0f04782900') center bottom / contain no-repeat;
}
.board-tilt.stage-2 .obstacle-sprite {
  left: -1px; width: calc(var(--cell) + var(--gap)); height: 40px;
  background-image: url('../assets/props/sarcophagus.png?a=0f04782900');
}
/* Versteinerter Baum (Kammer IV): aufrechtes Standee. Bis es ein eigenes
   Bild gibt, das Topf-Sprite höher und versteinert-dunkel. Vorgesehen
   (erst eintragen, wenn die Datei existiert):
     .tree-sprite { background-image: url('../assets/props/tree.png?a=0f04782900'); filter: brightness(calc(1 - var(--fog, 0))); } */
.obstacle-sprite.tree-sprite,
.board-tilt.stage-2 .obstacle-sprite.tree-sprite {
  left: 4px; width: 44px; height: 54px;
  background: url('../assets/props/pot.png?a=0f04782900') center bottom / contain no-repeat;
  filter: grayscale(0.85) sepia(0.25) brightness(calc(0.5 - var(--fog, 0) * 0.5));
}
.gate-sprite {
  left: -2px; bottom: 8px; width: 56px; height: 42px;
  background: url('../assets/props/gate-closed.png?a=0f04782900') center bottom / contain no-repeat;
}
.prop-gate.open .gate-sprite { background-image: url('../assets/props/gate-open.png?a=0f04782900'); }
.prop-gate.open .gate-sprite.gate-fade {
  inset: auto; left: -2px; bottom: 8px; border-radius: 0;
  background: url('../assets/props/gate-closed.png?a=0f04782900') center bottom / contain no-repeat;
}

/* ── Figuren als Standees ── */
.board-stage.tilted .pawn-layer { transform-style: preserve-3d; transform: translateZ(2px); }
.board-stage.tilted .pawn-slot { transform-style: preserve-3d; align-items: flex-end; padding-bottom: 10px; }
.board-stage.tilted .pawn {
  flex: none; width: 46px; height: 56px; border-radius: 23px 23px 5px 5px;
  rotate: x calc(-1 * var(--tilt)); transform-origin: 50% 100%;
  pointer-events: auto; cursor: pointer;
}
/* Token oben rund, darunter ein Sockel in Heldenfarbe (Hintergrundfarbe) */
.board-stage.tilted .pawn.token { background-size: 46px 46px; background-position: 50% 0; background-repeat: no-repeat; }
.board-stage.tilted .pawn.monster { border-radius: 6px; }
.board-stage.tilted .pawn.current { box-shadow: 0 0 12px 2px rgba(201, 162, 39, 0.75); }
.board-stage.tilted .pawn-layer .pawn-hp { top: -6px; right: -8px; bottom: auto; }
/* Ring und Bodenschatten flach am Fußpunkt (Zelle y ≈ 42 px) */
.board-stage.tilted .pawn-slot.is-current::before { inset: auto; left: 3px; top: 20px; width: 46px; height: 44px; }
.board-stage.tilted .pawn-slot::after {
  content: ''; position: absolute; left: 7px; top: 34px; width: 38px; height: 16px; border-radius: 50%;
  pointer-events: none; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
}
.board-stage.tilted .pawn-slot.marker::after { left: 13px; top: 36px; width: 30px; height: 12px; }

/* Standee-Bilder (Phase E3): Pawn zeigt statt Token/Cube das freigestellte
   Standee (Kind .pawn-figure, unten verankert); Sockel flach am Fußpunkt.
   Ohne .has-standee (keine Datei, s. STANDEE_IDS) bleibt das Token-Standee. */
.pawn-figure, .pawn-base { display: none; }
.board-stage.tilted .pawn.has-standee {
  width: 52px; height: 64px; border: none; border-radius: 0; box-shadow: none;
  background: none !important; color: transparent; text-shadow: none;
}
.board-stage.tilted .pawn.has-standee.standee-wide { width: 64px; height: 52px; }
.board-stage.tilted .pawn.has-standee.standee-boss { width: 72px; height: 90px; }
.board-stage.tilted .pawn.has-standee > .pawn-figure {
  display: block; position: absolute; inset: 0; pointer-events: none;
  background-position: 50% 100%; background-size: contain; background-repeat: no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7));
}
.board-stage.tilted .pawn.has-standee::after { display: none; } /* Blitz als Filter am Bild */
.board-stage.tilted .pawn.has-standee.hit > .pawn-figure { animation: standee-flash 320ms ease-out; }
.board-stage.tilted .pawn.has-standee.healed > .pawn-figure { animation: standee-heal 650ms ease-out; }
@keyframes standee-flash {
  0%, 100% { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)); }
  25% { filter: brightness(2.6) drop-shadow(0 0 6px #fff); }
}
@keyframes standee-heal {
  0%, 100% { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)); }
  30% { filter: drop-shadow(0 0 7px #4fd18b) drop-shadow(0 0 3px #4fd18b); }
}
.board-stage.tilted .pawn.has-standee .pawn-hp { top: 0; right: -4px; z-index: 1; }
.board-stage.tilted .pawn.has-standee.standee-boss .pawn-hp { top: 6px; right: 2px; }
/* Sockel: flaches Oval in Heldenfarbe (inline), Monster dunkel mit rotem Rand */
.board-stage.tilted .pawn-slot > .pawn-base {
  display: block; position: absolute; left: 50%; top: 34px; width: 40px; height: 15px; margin-left: -20px;
  border-radius: 50%; pointer-events: none; transform: translateZ(0.4px);
  background-image: radial-gradient(closest-side, rgba(255, 255, 255, 0.18), rgba(0, 0, 0, 0.35));
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.5);
}
.board-stage.tilted .pawn-slot > .pawn-base.monster-base { background-color: #2a1c19; box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(196, 60, 50, 0.7); }
.board-stage.tilted .pawn-slot.boss > .pawn-base { width: 56px; height: 20px; margin-left: -28px; top: 32px; }
/* Aktiver Held: Glut-Rand am Sockel */
.board-stage.tilted .pawn-slot.is-current > .pawn-base {
  box-shadow: inset 0 -2px 3px rgba(0, 0, 0, 0.5), 0 0 0 2px #ffb347, 0 0 10px 3px rgba(255, 130, 40, 0.75);
}
/* Marker: Truhe als kleines Standee */
.board-stage.tilted .item-cube {
  width: 38px; height: 38px; right: 7px; bottom: 10px;
  background-image: url('../assets/props/chest.png?a=0f04782900'); background-position: 50% 100%;
  filter: drop-shadow(0 0 4px rgba(201, 162, 39, 0.55));
  rotate: x calc(-1 * var(--tilt)); transform-origin: 50% 100%; pointer-events: auto; cursor: pointer;
}
.board-stage.tilted .dropped-marker {
  left: 6px; bottom: 10px; font-size: 16px;
  rotate: x calc(-1 * var(--tilt)); transform-origin: 50% 100%;
}
/* Aufsteigende Zahlen aufrecht über dem Kopf (Drehpunkt = Fußpunkt) */
.board-stage.tilted .float-text { transform-style: preserve-3d; align-items: flex-end; padding-bottom: 10px; }
.board-stage.tilted .float-text > span {
  margin: 0 0 64px; transform-origin: 50% calc(100% + 64px);
  rotate: x calc(-1 * var(--tilt));
}
/* Ein-/Ausblenden nur an den Blättern (opacity am Slot würde die 3D-Ebene flach drücken) */
.board-stage.tilted .pawn-slot.entering { animation: none; }
.board-stage.tilted .pawn-slot.entering > * { animation-name: pop-in-fade; }
@keyframes pop-in-fade { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.board-stage.tilted .pawn-slot.dying { animation: none; }
.board-stage.tilted .pawn-slot.dying > * { animation: pawn-die 480ms ease-in forwards; }
@keyframes pawn-die {
  0%, 30% { transform: scale(1) rotate(0); opacity: 1; }
  100% { transform: scale(0.2) rotate(-25deg); opacity: 0; }
}

/* Idle: Figuren wippen (nur 2.5D); :where hält die Spezifität niedrig,
   damit Ausfallschritt/Tod/Auftauchen die Animation übernehmen */
:where(.board-stage.tilted) .pawn { animation: pawn-bob 2s ease-in-out infinite; }
:where(.board-stage.tilted .pawn-slot:nth-child(2n)) .pawn { animation-delay: -0.7s; }
:where(.board-stage.tilted .pawn-slot:nth-child(3n)) .pawn { animation-delay: -1.3s; }
@keyframes pawn-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }

/* Boss: pulsierende Aura am Boden */
.boss-aura {
  position: absolute; left: -26px; top: -26px; width: 104px; height: 104px; border-radius: 50%;
  z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(220, 40, 30, 0.45), rgba(160, 20, 20, 0.15) 60%, rgba(0, 0, 0, 0));
  animation: boss-aura 2.4s ease-in-out infinite;
}
.board-stage.tilted .boss-aura { top: -10px; }
@keyframes boss-aura {
  0%, 100% { transform: scale(0.85); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* Vignette über der Board-Fläche (steht still, scrollt nicht mit) */
.board-area::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.5) 100%);
}

/* Monster-Info im Overlay: Größe/Position setzt board.js */
.board-overlay > .monster-pop-slot { left: 0; top: 0; }

@media (prefers-reduced-motion: reduce) {
  .hero-light, .boss-aura, .torch::after, .torch-glow, .pawn,
  .board .cell.water::after { animation: none !important; }
  .board-tilt, .standee, .pawn, .hero-light, .hint-layer,
  .board-stage, .icon-btn.hud-compass svg { transition: none !important; }
}
/* Flacher Tor-Crossfade auf der Zelle nur in der Draufsicht (2.5D: am Tor-Standee) */
.board-stage.tilted .cell > .gate-fade { display: none; }

/* ══ Phase G: iPad-Feinschliff ══════════════════════════════════════
   Zielgeräte quer: 1024×768 (iPad/mini), 1180×820 (iPad Air), 1366×1024
   (iPad Pro 12,9″ — nutzt das Desktop-Layout). Hochformat bleibt bedienbar
   (Hinweis „Bitte Gerät drehen“ blendet sich aus). Keine Infos nur per Hover:
   title ist Zusatz, alles Wesentliche steht in Charakterbogen, Legende,
   Monster-Info und Item-Karte. */

/* Touch-Grundlagen: kein grauer Tipp-Blitz, kein Doppeltipp-Zoom auf Buttons */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button, a, summary, .hero-card, .toast, .turn-banner, .menu-item { touch-action: manipulation; }
/* Board: der Browser darf weder scrollen noch zoomen (pan.js übernimmt) —
   auch auf allen Kindern, damit kein Kind den Default wieder einschaltet */
.board-wrap, .board-wrap * { touch-action: none; }

/* Spielbildschirm: feste Shell ohne Safari-Gummiband und ohne Textauswahl */
html:has(body.in-game) { height: 100%; overflow: hidden; overscroll-behavior: none; }
body.in-game {
  position: fixed; inset: 0; width: 100%; height: 100vh; height: 100dvh;
  overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body.in-game input, body.in-game textarea { -webkit-user-select: text; user-select: text; }

/* Heldenleiste: bei Überlauf links nicht abschneiden */
.party-bar { justify-content: safe center; }

/* Tap-Ziele ≥ 44 px auf Touch-Geräten */
@media (pointer: coarse) {
  :root { --hud-h: 50px; }
  button, .menu-item, .hud-text-btn { min-height: 44px; }
  .icon-btn { height: 44px; min-width: 44px; }
  .hud-log { height: 44px; }
  .pin-btn { min-height: 44px; }
  .log-drawer-head .close-btn { width: 44px; height: 44px; }
  .modal-close { width: 48px; height: 48px; }
  .toast { padding: 11px 14px; }
}

/* Übergabe-Banner: auf Touch bleibt er bis zum Tipp stehen */
.turn-banner { flex-direction: column; gap: 16px; }
.turn-banner-tap {
  font-size: 15px; color: var(--text-dim); letter-spacing: 0.12em; text-transform: uppercase;
  animation: tap-blink 1.8s ease-in-out infinite;
}
@keyframes tap-blink { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
/* Ergebnisse des Monsterzugs bleiben über dem stehenden Banner sichtbar */
body:has(.turn-banner.persist) .toast-stack,
body:has(.turn-banner.persist) > .toast.at-cell { z-index: 56; }

/* ── ≤ 1180 px (iPad Air quer, iPad 1024): kompakt ── */
@media (max-width: 1180px) {
  .hud { gap: 8px; }
  .hud-title { display: none; }
  .hud-left { gap: 8px; }
  .hud-chamber { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

  /* Heldenkarten: Portrait 48 px, nur Name + HP-Pips + Rüstung */
  .party-bar { min-height: 0; gap: 8px; padding: 6px 10px calc(6px + var(--safe-bottom)); }
  .hero-card { flex: 0 1 220px; min-width: 150px; min-height: 60px; gap: 8px; padding: 5px 8px 5px 5px; }
  .hero-portrait { width: 48px; height: 48px; border-radius: 8px; }
  .hero-body { gap: 2px; }
  .hero-name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hero-hpnum, .hero-line .status-icon, .hero-items { display: none; }

  /* Aktionsleiste: Icon + Kurzlabel, Kurzwerte im Charakterbogen */
  .action-bar { max-width: calc(100% - 24px); bottom: 8px; }
  .bar-row { gap: 6px; padding: 5px; }
  .bar-group { gap: 4px; }
  .bar-group + .bar-group { padding-left: 6px; }
  .bar-btn { min-height: 52px; min-width: 52px; padding: 3px 6px; }
  .skill-meta { display: none; }
  .skill-label { max-width: 78px; overflow: hidden; text-overflow: ellipsis; font-size: 11.5px; }
  .bar-btn.has-short { font-size: 0; min-width: 60px; gap: 2px; }
  .bar-btn.has-short::before { content: attr(data-icon); font-size: 20px; line-height: 26px; }
  .bar-btn.has-short::after { content: attr(data-short); font-size: 11.5px; }
  .bar-btn.end-btn { min-width: 76px; }
  .bar-btn.cancel-btn { min-width: 100px; font-size: 13px; }
  .bar-move { font-size: 19px; }

  /* Toasts schmaler */
  .toast-stack { width: min(440px, calc(100vw - 32px)); }
  .toast { font-size: 13px; }
  .toast.at-cell { max-width: min(360px, 80vw); }
  .turn-banner-text { font-size: 32px; padding: 14px 28px; gap: 16px; }
  .banner-portrait { width: 80px; height: 80px; }
}

/* ── Lite (body.lite, ≤ 1180 px; setzt ui.js): Dauer-Animationen aus,
   board.js setzt nur eine Fackel je Tile ── */
body.lite .board .cell.water::after { animation: none; opacity: 0.5; }
body.lite .board .cell.lava::after { animation: none; opacity: 0.7; }
body.lite .torch::after, body.lite .torch-glow { animation: none; }
body.lite .hero-light { animation: none; opacity: 0.9; }

@media (prefers-reduced-motion: reduce) {
  .board .cell.lava::after, .turn-banner-tap { animation: none !important; }
  .board .cell.lava::after { opacity: 0.7; }
}

/* ── Hochformat: bedienbar, Hinweis blendet sich nach ein paar Sekunden aus ── */
@media (orientation: portrait) and (max-width: 1100px) {
  .action-bar { max-width: calc(100% - 16px); }
  .bar-row { flex-wrap: wrap; justify-content: center; }
  .hero-card { min-width: 140px; }
}
@media (orientation: portrait) and (pointer: coarse) {
  body.in-game::after {
    content: '⟳  Bitte Gerät drehen — Gruftlicht ist fürs Querformat gebaut';
    position: fixed; left: 50%; top: calc(var(--hud-top) + 10px); transform: translateX(-50%);
    z-index: 60; pointer-events: none; white-space: nowrap;
    padding: 10px 18px; border-radius: 999px; font-size: 14px; color: var(--accent);
    background: rgba(14, 11, 9, 0.94); border: 1px solid var(--accent);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
    animation: rotate-hint 7s ease forwards;
  }
}
@keyframes rotate-hint { 0%, 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* ── Phase H: Sprechblasen (Barks), Ereignis-Toasts, Nebel-Hinweis ── */
/* .bark-slot hängt wie die Monster-Info an der Zelle (board.js showBark):
   im Overlay mit Größe/Position aus board.js, ohne Layout im Figuren-Layer. */
.bark-slot {
  position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell);
  z-index: 7; pointer-events: none;
}
.board-overlay > .bark-slot { left: 0; top: 0; }
.bark {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 200px; padding: 5px 10px;
  background: rgba(244, 234, 214, 0.96); color: #2a2018; border-radius: 12px;
  font-size: 13px; line-height: 1.3; font-style: italic; text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
  animation: bark-in 0.18s ease-out, bark-out 0.3s ease-in 1.7s forwards;
}
.bark::after {
  content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: rgba(244, 234, 214, 0.96);
}
.bark.noise { background: rgba(40, 30, 24, 0.94); color: #e6d6b8; }
.bark.noise::after { border-top-color: rgba(40, 30, 24, 0.94); }
.bark-slot.below .bark { bottom: auto; top: calc(100% + 6px); }
.bark-slot.below .bark::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: rgba(244, 234, 214, 0.96); }
.bark-slot.below .bark.noise::after { border-bottom-color: rgba(40, 30, 24, 0.94); }
@keyframes bark-in { from { opacity: 0; transform: translate(-50%, 6px) scale(0.9); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes bark-out { to { opacity: 0; } }

.toast.event { border-left-color: #9b7fd1; font-size: 15px; }
.toast.event-fog { border-left-color: #9fb3bf; }
.toast.event-portcullis { border-left-color: #b08d57; }
.hud-fog {
  font-size: 12px; color: #c9d6dd; background: rgba(120, 140, 150, 0.22);
  border: 1px solid rgba(160, 180, 190, 0.4); border-radius: 10px; padding: 1px 8px; white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .bark { animation: none; }
}

/* Lava-Textur (Kammer V) — ersetzt den Gradient-Fallback oben, sobald die Datei
   existiert (liegt seit 2026-10-08 im Repo). */
.board .cell.lava { background-image: url('../assets/tiles/lava.png?a=0f04782900'); }

/* ── Phase H2: Spielstände, Endlose Gruft, Statistik, Tutorial ───────── */
.mode-row { margin-bottom: 12px; }
.mode-row .endless-btn { font-weight: 600; }
.endless-options { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.endless-hint { color: var(--text-dim); font-size: 13px; text-align: center; }
.endless-seed label { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.seed-input {
  width: 8ch; min-height: 44px; padding: 6px 10px; font: inherit; font-size: 16px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
}
.seed-input:focus { outline: none; border-color: var(--accent); }
.slot-list { display: flex; flex-direction: column; gap: 8px; }
.slot-row { display: flex; gap: 8px; align-items: stretch; }
.slot-card { min-height: 44px; text-align: left; line-height: 1.35; flex: 1; }
.slot-delete { flex: none; min-width: 44px; font-size: 18px; padding: 0 10px; color: var(--text-dim); }
.slot-delete:hover { color: #e06a5a; border-color: #e06a5a; }
.slot-card:hover { border-color: var(--accent); }
.story-sub { color: var(--text-dim); font-size: 14px; margin-top: -6px; }
.end-stats { margin: 10px 0 4px; color: var(--accent); font-weight: 600; }
.end-stats.record { text-shadow: 0 0 10px rgba(201, 162, 39, 0.6); }
.link-btn { background: none; border: none; color: var(--text-dim); text-decoration: underline; min-height: 44px; }
.stats-facts, .stats-table { width: 100%; border-collapse: collapse; margin: 6px 0 14px; font-size: 14px; }
.stats-facts th { text-align: left; color: var(--text-dim); font-weight: normal; padding: 4px 10px 4px 0; width: 45%; }
.stats-facts td { padding: 4px 0; }
.stats-table th, .stats-table td { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: right; }
.stats-table th:first-child, .stats-table td:first-child,
.stats-table th:nth-child(2), .stats-table td:nth-child(2) { text-align: left; }
.stats-table th { color: var(--text-dim); font-weight: normal; font-size: 12px; }
.stats-empty { color: var(--text-dim); }
.stats-reset { min-height: 44px; }

.tut-layer { position: fixed; inset: 0; z-index: 200; }
.tut-layer.no-target { background: rgba(0, 0, 0, 0.62); }
.tut-spot {
  position: fixed; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62), 0 0 0 2px var(--accent), 0 0 18px 4px rgba(201, 162, 39, 0.45);
  transition: left 0.25s ease, top 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.tut-bubble {
  position: fixed; max-width: calc(100vw - 24px); background: var(--panel); color: var(--text);
  border: 1px solid var(--accent); border-radius: 12px; padding: 14px 16px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.tut-count { color: var(--text-dim); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.tut-title { margin: 4px 0 6px; color: var(--accent); font-size: 17px; }
.tut-text { margin: 0 0 12px; line-height: 1.5; font-size: 15px; }
.tut-buttons { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.tut-buttons button { min-height: 44px; min-width: 44px; }
.tut-buttons .tut-skip { margin-right: auto; background: none; color: var(--text-dim); }
@media (prefers-reduced-motion: reduce) { .tut-spot { transition: none; } }

/* ── Hauptmenü als drei Seiten ohne Scrollen ─────────────── */
.setup-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; }
.setup-page .hud { flex: none; }
.setup-page .setup-screen {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
  width: 100%; max-width: 1150px; margin: 0 auto; padding: 12px 20px 16px; box-sizing: border-box;
}
.setup-start .setup-hero { flex: none; margin-bottom: 14px; }
.setup-start .title-logo { width: 170px; max-height: 170px; }
.start-row { gap: 14px; margin: 4px 0 6px; }
.big-btn { min-height: 52px; padding: 0 26px; font-size: 17px; display: inline-flex; align-items: center; gap: 10px; }
.big-btn .bi { width: 1.1em; height: 1.1em; }
.setup-start .slot-section { flex: 0 1 auto; min-height: 0; overflow: auto; margin-top: 10px; }
.setup-section .slot-list { max-width: 820px; margin: 0 auto; }

.setup-head {
  flex: none; display: flex; align-items: center; gap: 14px; padding: 4px 6px 10px; text-align: left;
}
.setup-head-logo { width: 56px; height: 56px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.9)); }
.setup-head-title { display: flex; flex-direction: column; line-height: 1.2; }
.setup-head-title strong { color: var(--accent); font-size: 22px; font-weight: normal; letter-spacing: 0.06em; }
.setup-head-title span { color: var(--text-dim); font-size: 13px; }
.setup-steps { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.setup-step { display: inline-flex; align-items: center; gap: 7px; opacity: 0.55; }
.setup-step.active { opacity: 1; color: var(--accent); }
.setup-step b {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid currentColor; font-weight: normal; font-size: 12px;
}
.setup-step-sep { width: 26px; height: 1px; background: var(--border); }
.setup-body { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; justify-content: center; gap: 0; }
.setup-body .setup-section { margin: 7px 0; }
.setup-nav { flex: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 10px; }
.setup-nav button { min-height: 46px; padding: 0 22px; font-size: 16px; display: inline-flex; align-items: center; gap: 8px; }
.setup-nav .bi { width: 1em; height: 1em; }
.stage-row button { min-width: 180px; }

/* Heldenwahl: vier Karten nebeneinander, Porträt an die Höhe angepasst */
.setup-heroes .char-pick { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.setup-heroes .char-card .char-portrait { height: clamp(100px, 19vh, 210px); }
.setup-heroes .char-card h4 { font-size: 17px; }
.setup-heroes .char-card .mini-actions { margin-top: 6px; padding-top: 6px; }
.setup-heroes .char-card .mini-action { padding: 1px 0; }
@media (max-width: 760px) {
  .setup-heroes .char-pick { grid-template-columns: 1fr 1fr; }
  .setup-steps { display: none; }
}

/* Bootstrap-Icons inline: in Knöpfen mit der Schrift mitlaufen */
.bi { width: 1em; height: 1em; vertical-align: -0.15em; flex: none; }
.hud-text-btn .bi { margin-right: 6px; color: var(--accent); }
.menu-item { display: flex; align-items: center; gap: 8px; }
.menu-item .mi-ico { order: -1; display: inline-flex; color: var(--accent); }
.menu-item .bi { width: 1.05em; height: 1.05em; }
/* Musik-Lautstärkeregler im Menü */
.menu-slider { display: flex; align-items: center; gap: 10px; padding: 6px 12px; font-size: 13px; color: var(--text-dim); }
.menu-slider input { flex: 1; accent-color: var(--accent); }
.icon-btn .bi { width: 20px; height: 20px; }
.icon-btn.hud-sound.muted .bi { color: var(--text-dim); }
.slot-delete .bi { width: 18px; height: 18px; }
.lock-ico { margin-left: 6px; opacity: 0.8; }
.lock-ico .bi { vertical-align: -0.12em; }

/* ── Online-Multiplayer ─────────────────────── */
.online-section { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.online-intro { color: var(--text-dim); margin: 0; }
.online-field { display: flex; flex-direction: column; gap: 6px; color: var(--text-dim); }
.name-input, .code-input {
  min-height: 48px; padding: 6px 12px; font: inherit; font-size: 18px;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius);
}
.name-input:focus, .code-input:focus { outline: none; border-color: var(--accent); }
.online-create { justify-content: flex-start; }
.online-join { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; }
.code-input { width: 9ch; text-transform: uppercase; letter-spacing: 0.25em; font-weight: bold; text-align: center; }

.lobby-head { flex: none; display: flex; align-items: center; gap: 20px; padding: 4px 6px 10px; flex-wrap: wrap; }
.lobby-code { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.lobby-code-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.room-code {
  font-size: 34px; font-weight: bold; letter-spacing: 0.22em; padding: 4px 14px; min-height: 52px;
  color: var(--accent); background: var(--panel-2); border: 1px dashed var(--accent); border-radius: var(--radius);
}
.lobby-players { display: flex; flex-wrap: wrap; gap: 8px; }
.lobby-player {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 14px;
  background: var(--panel-2); border: 1px solid var(--border); font-size: 15px;
}
.lobby-player.me { border-color: var(--accent); }
.lobby-player .dot, .hud-room .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #5fbf6a; flex: none; display: inline-block;
}
.lobby-player.offline .dot, .hud-room.offline .dot { background: #e06a5a; }
.lobby-player.offline .pname { color: var(--text-dim); }
.host-mark { font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 8px; padding: 0 6px; }
.lobby-pick .char-card.taken { opacity: 0.7; cursor: default; }
.owner-badge {
  position: absolute; top: 8px; right: 8px; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-weight: bold; color: #111; padding: 2px 8px; border-radius: 10px;
}
.owner-badge.free { color: var(--text-dim); background: transparent; border: 1px dashed var(--border); font-weight: normal; }
.lobby-settings-text { color: var(--text); }
.online-wait { color: var(--text-dim); font-style: italic; align-self: center; margin: 8px 0; }
.story-card .leave-room { margin-left: 8px; }

.hud-room {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: 0.08em; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; color: var(--text);
}
.hud-room.offline { color: #e06a5a; border-color: #e06a5a; }
.action-bar.online-waiting .bar-hint { color: var(--char-color, var(--text)); font-weight: bold; }
.rejoin-room {
  align-self: center; display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 0 18px; margin: 2px auto 4px; border-style: dashed;
}
.rejoin-room .rejoin-when { color: var(--text-dim); font-size: 13px; }
.owner-tag {
  display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; line-height: 1.3; padding: 0 6px; border-radius: 8px; margin: 1px 0 2px;
  color: #111; background: var(--char-color, var(--accent));
}
.owner-tag.offline { opacity: 0.45; filter: grayscale(0.7); }
.toast.online-note { font-style: italic; }

/* Boss-Phase 2: kurzes Aufglühen beim Bildwechsel des Standees */
.board-stage.tilted .pawn.has-standee > .pawn-figure.phase-shift { animation: phase-shift 650ms ease-out; }
@keyframes phase-shift {
  0% { filter: brightness(3) drop-shadow(0 0 14px #ff6a1a); transform: scale(1.08); }
  100% { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.7)); transform: none; }
}
