/* PB59 / Daily59 — Masterdesign colour world.
   Deep navy, slate, neon-teal route, warm amber light, pizza red, light cream text.
   Mobile-first landscape, arcade pixel UI, large touch targets. */

:root {
  --navy:        #0b1a2e;
  --navy-2:      #112844;
  --slate:       #1c3a5e;
  --slate-2:     #25496f;
  --teal:        #2ee6c9;
  --teal-dim:    #1aa890;
  --amber:       #ffb347;
  --amber-warm:  #ffcd6b;
  --red:         #ff5a4d;
  --cream:       #f4ecd8;
  --cream-dim:   #c9c2b2;
  --ink:         #07121f;
  --good:        #6ee27a;
  --warn:        #ffd23f;

  --panel-border: 3px solid var(--teal);
  --shadow: 0 6px 0 #04101c, 0 10px 24px rgba(0,0,0,.45);
  --font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font);
  -webkit-font-smoothing: none;
  overflow: hidden;
  touch-action: manipulation;
}

#app {
  position: fixed; inset: 0;
  height: 100vh; height: 100dvh;            /* dynamic viewport (iOS Safari bars) */
  max-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;                          /* main screens never scroll (hard fit) */
  background-color: var(--navy);
  background-image:
    radial-gradient(120% 90% at 50% -10%, var(--slate) 0%, var(--navy-2) 45%, var(--navy) 100%);
  background-size: cover;
  background-position: center center;
  /* iOS safe-area: notch sits left/right in landscape, home-bar bottom */
  padding:
    max(10px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  transition: background-image .25s ease;
}

/* Legibility for brand/headings sitting over photographic backgrounds. */
.brand, .claim, .subline, .score-big, .timer { text-shadow: 0 2px 6px rgba(0,0,0,.6); }

/* ---- Rotate overlay ---- */
#rotate-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center; text-align: center;
}
#rotate-overlay[hidden] { display: none; }
.rotate-icon { font-size: 56px; margin-bottom: 12px; }
.rotate-inner h2 { color: var(--teal); letter-spacing: 1px; }
.rotate-inner p { color: var(--cream-dim); margin-top: 8px; }

/* ---- Screen shell ---- */
.screen {
  width: 100%; max-width: 920px;
  height: 100%; min-height: 0;
  display: flex; flex-direction: column; justify-content: center;
  gap: 12px; overflow: hidden;              /* hard fit: compress, never scroll */
}
.screen.center { align-items: center; text-align: center; }
.center-col { min-height: 0; max-height: 100%; }
.panel { min-height: 0; }

/* ---- Brand / titles ---- */
.brand {
  font-weight: 800; letter-spacing: 3px; text-transform: uppercase;
  color: var(--cream); line-height: 1;
}
.brand .num { color: var(--red); }
.brand-lg { font-size: clamp(34px, 7vw, 64px); }
.brand-md { font-size: clamp(22px, 4vw, 34px); }
.subline { color: var(--teal); letter-spacing: 2px; text-transform: uppercase; font-size: 13px; }
.claim { color: var(--amber-warm); letter-spacing: 4px; text-transform: uppercase; font-size: 14px; font-weight: 700; }

/* ---- Panels ---- */
.panel {
  background: var(--navy-2);
  border: var(--panel-border);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.panel.warm { border-color: var(--amber); }
.panel.red { border-color: var(--red); }
.panel-title { color: var(--teal); text-transform: uppercase; letter-spacing: 2px; font-size: 12px; margin-bottom: 8px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  border: none; border-radius: 4px; cursor: pointer;
  padding: 16px 22px; font-size: 17px;
  background: var(--cream); color: var(--ink);
  box-shadow: 0 5px 0 #998f73;
  transition: transform .05s ease;
  min-height: 56px; width: 100%;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #998f73; }
.btn.primary { background: var(--teal); color: var(--ink); box-shadow: 0 5px 0 var(--teal-dim); }
.btn.primary:active { box-shadow: 0 2px 0 var(--teal-dim); }
.btn.warm { background: var(--amber); color: var(--ink); box-shadow: 0 5px 0 #c47f1e; }
.btn.danger { background: var(--red); color: var(--cream); box-shadow: 0 5px 0 #b3382e; }
.btn.ghost { background: transparent; color: var(--cream); border: 2px solid var(--slate-2); box-shadow: none; }
.btn.sm { padding: 10px 14px; font-size: 14px; min-height: 0; width: auto; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* ---- HUD (timer / heat) ---- */
.hud {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.timer {
  font-size: clamp(28px, 6vw, 44px); font-weight: 800; letter-spacing: 2px;
  color: var(--cream); font-variant-numeric: tabular-nums;
}
.timer.warn { color: var(--warn); }
.timer.crit { color: var(--red); animation: pulse .5s infinite alternate; }
@keyframes pulse { to { opacity: .55; } }

.heat-wrap { flex: 1; max-width: 240px; }
.heat-label { font-size: 11px; color: var(--cream-dim); text-transform: uppercase; letter-spacing: 1px; }
.heat-bar { height: 14px; background: var(--ink); border: 2px solid var(--slate-2); border-radius: 3px; overflow: hidden; }
.heat-fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--amber), var(--good)); transition: width .3s ease; }

/* ---- 59-Watch hint ---- */
.watch {
  display: flex; align-items: center; gap: 10px;
  background: var(--slate); border-left: 4px solid var(--teal);
  border-radius: 4px; padding: 10px 14px; color: var(--cream);
  font-size: 15px; min-height: 44px;
}
.watch .watch-ic { font-size: 18px; }
.watch.empty { opacity: .35; }

/* ---- Option cards (route / door) ---- */
.options { display: flex; gap: 12px; flex-wrap: wrap; }
.opt {
  flex: 1 1 0; min-width: 150px;
  background: var(--navy-2); border: 2px solid var(--slate-2); border-radius: 6px;
  padding: 14px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .1s, transform .05s;
  color: var(--cream);
}
.opt:hover { border-color: var(--teal); }
.opt:active { transform: translateY(2px); }
.opt .opt-name { font-weight: 800; font-size: 17px; letter-spacing: .5px; }
.opt .opt-cue { color: var(--amber-warm); font-size: 14px; }
.opt .opt-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--cream-dim); margin-top: 2px; }
.tag { padding: 2px 8px; border-radius: 3px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.tag.sicher { background: #15422f; color: var(--good); }
.tag.schnell { background: #173a52; color: var(--teal); }
.tag.riskant { background: #5a2c14; color: var(--amber); }
.tag.heiss { background: #5a1f18; color: var(--red); }
.tag.time { background: var(--slate); color: var(--cream); }

/* ---- Bon ---- */
.bon {
  background: var(--cream); color: var(--ink);
  border-radius: 4px; padding: 18px 20px; max-width: 420px; width: 100%;
  box-shadow: var(--shadow);
  border-top: 6px solid var(--red);
}
.bon h3 { text-transform: uppercase; letter-spacing: 1px; margin-bottom: 10px; color: var(--ink); }
.bon-row { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px dashed #b9b09a; font-size: 15px; }
.bon-row .k { font-weight: 800; min-width: 92px; text-transform: uppercase; font-size: 12px; color: #6b6453; padding-top: 2px; }
.bon-row .v { flex: 1; }
.bon .hint { color: #a8431f; font-weight: 700; }

/* ---- Daily/Training Intro: clipboard bon (orderbon asset) + side controls ---- */
.intro-wrap { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; height: 100%; min-height: 0; justify-content: center; }
.intro-cols { display: flex; gap: 16px; align-items: center; justify-content: center; width: 100%; flex: 1 1 auto; min-height: 0; flex-wrap: wrap; }
.intro-side { display: flex; flex-direction: column; gap: 10px; align-items: stretch; flex: 1 1 220px; min-width: 0; max-width: 360px; }
.bon-clip {
  position: relative; flex: 0 0 auto;
  height: 100%; max-height: 360px; aspect-ratio: 1122 / 1402;
  background: url('assets/ui/orderbon.png') center / 100% 100% no-repeat;
  container-type: size;
}
.bon-clip-inner {
  position: absolute; inset: 0; padding: 17.5% 14.5% 13% 14.5%;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 3.4%;
  text-align: left; color: #463524; overflow: hidden;
}
.bci-row { line-height: 1.14; min-height: 0; }
.bci-row .bk { display: block; font-size: 10px; font-size: 2.7cqh; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: #9a8260; }
.bci-row .bv { display: block; font-size: 13px; font-size: 4.7cqh; font-weight: 700; color: #463524; overflow: hidden; margin-top: 0.5cqh; }
.bci-row .bv.hint { color: #b23f17; font-weight: 800; }
.bci-row.order .bv { font-size: 12px; font-size: 4.1cqh; }

/* ---- Result / breakdown ---- */
.score-big { font-size: clamp(40px, 9vw, 72px); font-weight: 800; color: var(--teal); font-variant-numeric: tabular-nums; line-height: 1; }
.score-big.fail { color: var(--red); }
.breakdown { display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.breakdown .ln { display: flex; justify-content: space-between; }
.breakdown .ln.plus .amt { color: var(--good); }
.breakdown .ln.minus .amt { color: var(--red); }
.breakdown .ln.zero .amt { color: var(--cream-dim); }   /* neutral "· 0" — never a red "-0" */
.status-pill { display: inline-block; padding: 6px 14px; border-radius: 20px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; font-size: 13px; }
.status-pill.top59 { background: var(--teal); color: var(--ink); }
.status-pill.close { background: var(--amber); color: var(--ink); }
.status-pill.done { background: var(--slate-2); color: var(--cream); }
.status-pill.fail { background: var(--red); color: var(--cream); }

/* ---- Leaderboard ---- */
/* Leaderboard: the ONLY screen whose inner list scrolls; the app/stage stays fixed. */
.lb-wrap { display: flex; flex-direction: column; gap: 10px; align-items: center; width: 100%; height: 100%; min-height: 0; }
.lb-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; width: 100%; max-width: 520px; }
.lb { width: 100%; max-width: 520px; border-collapse: collapse; }
.lb th, .lb td { text-align: left; padding: 8px 10px; font-size: 15px; }
.lb th { color: var(--teal); text-transform: uppercase; font-size: 11px; letter-spacing: 1px; }
.lb tr { border-bottom: 1px solid var(--slate); }
.lb tr.me { background: var(--slate); color: var(--cream); font-weight: 800; }
.lb td.rank { color: var(--amber-warm); font-weight: 800; width: 48px; }
.lb td.score { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- misc ---- */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--cream-dim); }
.code-chip { background: var(--ink); color: var(--teal); padding: 4px 10px; border-radius: 4px; font-weight: 800; letter-spacing: 1px; }
.warnbox { background: #3a2410; border: 2px solid var(--amber); border-radius: 4px; padding: 10px 14px; color: var(--amber-warm); font-size: 14px; }
.recovery { font-size: clamp(18px, 4vw, 26px); color: var(--amber); font-weight: 800; letter-spacing: 1px; word-break: break-all; }
.center-col { display: flex; flex-direction: column; gap: 14px; align-items: center; max-width: 560px; }
.spacer { flex: 1; }
small.foot { color: var(--cream-dim); font-size: 12px; }
a.legal { color: var(--teal); text-decoration: underline; font-size: 12px; margin: 0 6px; }
.scene {
  height: 96px; border-radius: 6px; border: 2px solid var(--slate-2);
  background:
    linear-gradient(180deg, #0e2238, #0a1828),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255,179,71,.06) 26px 30px);
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center;
  color: var(--cream-dim); font-size: 13px; letter-spacing: 1px; text-transform: uppercase;
}
.scene .route-line { position: absolute; bottom: 14px; left: 8%; right: 8%; height: 4px; background: var(--teal); box-shadow: 0 0 8px var(--teal); border-radius: 2px; }

/* ---- Topdown route map (ROUTE phase) ---- */
.run-screen { justify-content: flex-start; gap: 8px; }
.routemap {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--slate-2); border-radius: 8px; overflow: hidden;
  background:
    linear-gradient(rgba(8,16,28,.30), rgba(8,16,28,.42)),
    linear-gradient(180deg, #0e2238, #0a1828),
    repeating-linear-gradient(90deg, transparent 0 30px, rgba(255,179,71,.05) 30px 33px);
}
.routemap-svg { width: 100%; height: 100%; max-height: 100%; display: block; }
.rm-edge-future { stroke: #25496f; stroke-width: 4; stroke-dasharray: 7 9; fill: none; }
.rm-edge-done { stroke: var(--teal); stroke-width: 10; opacity: .97; filter: drop-shadow(0 0 6px var(--teal)) drop-shadow(0 0 14px rgba(46,230,201,.35)); }
.rm-edge-opt { fill: none; stroke-width: 7; opacity: .95; }
.rm-hit { fill: none; stroke: transparent; stroke-width: 44; cursor: pointer; }
.rm-node { fill: #1c3a5e; stroke: var(--teal); stroke-width: 3; }
.rm-node.shop { fill: var(--amber); stroke: #c47f1e; }
.rm-node.target { fill: var(--red); stroke: #b3382e; }
.rm-node.cur { fill: var(--teal); stroke: #fff; }
.rm-node.done { fill: rgba(46,230,201,.2); stroke: var(--teal); stroke-width: 2; opacity: .7; }
@keyframes rm-ring-pulse { 0%, 100% { opacity: .35; } 50% { opacity: .88; } }
.rm-node-ring { fill: none; stroke: var(--teal); stroke-width: 4; animation: rm-ring-pulse 1.8s ease-in-out infinite; }
.rm-target-ring { fill: none; stroke: var(--amber); stroke-width: 3.5; opacity: .65; }
.rm-node-frame { fill: none; stroke: var(--slate-2); stroke-width: 2.5; }
.rm-node-frame.cur { stroke: var(--teal); stroke-width: 5; filter: drop-shadow(0 0 10px var(--teal)) drop-shadow(0 0 20px rgba(46,230,201,.4)); }
.rm-node-frame.done { stroke: var(--teal); stroke-width: 2.5; opacity: .5; }
.rm-node-label { fill: var(--cream); font: 800 22px var(--font); text-shadow: 0 1px 4px #000, 0 0 8px rgba(0,0,0,.8); }
.rm-node-label.cur { fill: var(--teal); }
.rm-badge { cursor: pointer; }
.rm-badge-bg { fill: #0b1a2e; stroke-width: 2; opacity: .96; }
.rm-badge-tx { fill: var(--cream); font: 800 21px var(--font); }
.rm-obst-bg { fill: #3a2410; stroke: var(--amber); stroke-width: 2; }
.rm-obst-ic { font: 700 20px var(--font); fill: var(--amber-warm); }
.rm-obst-frame { fill: none; stroke: var(--amber); stroke-width: 2.5; filter: drop-shadow(0 0 3px rgba(0,0,0,.6)); }

/* ---- Tile-path-planning map (RouteMap V2) ---- */
.tile-outer {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 4px; width: 100%;
  background: rgba(5,12,20,.94); border-radius: 6px; padding: 2px;
}
.tile-grid-wrap {
  flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: center;
}
.tile-grid {
  --tcols: 8; --trows: 5;
  display: grid;
  grid-template-columns: repeat(var(--tcols), 1fr);
  grid-template-rows: repeat(var(--trows), 1fr);
  aspect-ratio: var(--tcols) / var(--trows);
  width: 100%; max-height: 100%;
  gap: 3px;
  border: 2px solid rgba(46,230,201,.45); border-radius: 4px; overflow: hidden;
  background: #050c14;
  box-shadow: 0 0 0 1px #0a1624, 0 0 18px rgba(46,230,201,.12);
}
.tile-cell {
  position: relative; overflow: hidden; cursor: default;
  background: #0d1c2e; border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: background .08s;
}
.tile-cell.tile-empty {
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    #07111e;
  background-size: 11px 11px, 11px 11px, auto;
  pointer-events: none;
}
.tile-cell.tile-blocked {
  background: #050a12; opacity: .55; pointer-events: none;
}
.tile-cell.tile-blocked::after {
  content: ''; position: absolute; inset: 0; z-index: 4;
  background: repeating-linear-gradient(-45deg, transparent, transparent 3px,
    rgba(0,0,0,.35) 3px, rgba(0,0,0,.35) 4px);
}

/* tile type base colors — visible only if image fails to load */
.tile-cell.tt-road        { background: #122338; }
.tile-cell.tt-shop        { background: #2b1c08; }
.tile-cell.tt-target      { background: #0d2210; }
.tile-cell.tt-traffic     { background: #2a1606; }
.tile-cell.tt-construction{ background: #211308; }
.tile-cell.tt-park        { background: #0a2012; }

/* Road tiles are dark night-asphalt art — boost brightness so markings are legible at small cell sizes */
.tile-cell.tt-road .tile-base-img { filter: brightness(1.55) saturate(1.1); }
/* City-block tiles (empty cells) vary in darkness — slight boost keeps darker blocks readable */
.tile-cell.tile-empty .tile-base-img { filter: brightness(1.18); }

/* ── Tile image layers ─────────────────────────────────────────────────────
   z-index stack inside each cell:
   0  tile-base-img   (road / landmark / city-block, fills cell)
   1  tile-route-img  (neon route overlay, shown when tile is in path)
   2  tile-obst-icon  (emoji corner label)
   3  ::before        (state frame/glow overlay – path / cur / next / obst)
   4  ::after         (blocked stripe pattern)
   ─────────────────────────────────────────────────────────────────────── */
.tile-base-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: fill;
  pointer-events: none; image-rendering: pixelated; z-index: 0;
}
.tile-route-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none; image-rendering: pixelated;
  z-index: 1; opacity: 0.88;
}
.tile-obst-icon {
  position: absolute; top: 2px; right: 3px;
  font-size: 13px; line-height: 1; pointer-events: none;
  filter: drop-shadow(0 1px 2px #000);
  z-index: 2;
}

/* State overlays via ::before — sit above images, below blocked pattern */
.tile-cell.tile-path::before,
.tile-cell.tile-cur::before,
.tile-cell.tile-next::before,
.tile-cell.tile-has-obst::before,
.tile-cell.tile-target::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3;
}

/* In-path: teal border frame */
.tile-cell.tile-path::before {
  box-shadow: inset 0 0 0 2px var(--teal), inset 0 0 6px rgba(46,230,201,.22);
}

/* Current position: split into outer glow (on cell, not clipped by overflow:hidden)
   and inset frame (on ::before, above images). Both run in sync at 1.4s. */
@keyframes tile-pulse-glow {
  0%,100% { box-shadow: 0 0 10px var(--teal); }
  50%     { box-shadow: 0 0 26px var(--teal); }
}
@keyframes tile-pulse {
  0%,100% { box-shadow: inset 0 0 0 3px var(--teal), inset 0 0 6px rgba(46,230,201,.3); }
  50%     { box-shadow: inset 0 0 0 3px var(--teal), inset 0 0 16px rgba(46,230,201,.45); }
}
.tile-cell.tile-cur { z-index: 2; animation: tile-pulse-glow 1.4s ease-in-out infinite; }
.tile-cell.tile-cur::before { animation: tile-pulse 1.4s ease-in-out infinite; }

/* Goal tile: amber border */
.tile-cell.tile-target::before {
  box-shadow: inset 0 0 0 2px var(--amber), inset 0 0 8px rgba(255,179,71,.3);
}

/* Selectable next: pulsing teal invitation border */
@keyframes tile-next-pulse {
  0%,100% { box-shadow: inset 0 0 0 1px rgba(46,230,201,.5); }
  50%     { box-shadow: inset 0 0 0 2px var(--teal), inset 0 0 8px rgba(46,230,201,.28); }
}
.tile-cell.tile-next { cursor: pointer; }
.tile-cell.tile-next::before { animation: tile-next-pulse 1.8s ease-in-out infinite; }
.tile-cell.tile-next:active::before {
  animation: none;
  box-shadow: inset 0 0 0 2px var(--teal), inset 0 0 6px rgba(46,230,201,.35);
}

/* Obstacle: red border */
.tile-cell.tile-has-obst::before {
  box-shadow: inset 0 0 0 2px rgba(255,90,77,.7);
}

/* Flash on invalid tap */
@keyframes tile-flash { 0%,100%{opacity:1} 50%{opacity:.22} }
.tile-cell.tile-flash { animation: tile-flash .28s ease; }

/* status + controls */
.tile-status {
  text-align: center; font-size: 11px; font-weight: 800;
  color: var(--cream-dim); letter-spacing: 1px; line-height: 1;
  text-transform: uppercase; padding: 0 4px;
}
.tile-status.s-ok { color: var(--teal); text-shadow: 0 0 8px rgba(46,230,201,.45); }
.tile-ctrl-row { display: flex; gap: 6px; justify-content: center; width: 100%; }
/* confirm: compact sizing — overrides .btn base */
.tile-confirm { flex: 1 1 auto; max-width: 280px; min-height: 44px; padding: 8px 14px; font-size: 14px; }
.tile-undo, .tile-reset { min-width: 54px; min-height: 44px; }

/* Start / Ziel / Du text markers — always visible, instantly readable on any map. */
.tile-badge {
  position: absolute; left: 50%; transform: translateX(-50%);
  z-index: 6; pointer-events: none; white-space: nowrap;
  font: 800 8px/1 var(--font); letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 5px; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.badge-start  { top: 2px; background: var(--teal);  color: var(--ink); }
.badge-target { top: 2px; background: var(--amber); color: var(--ink); }
.badge-cur    { bottom: 2px; background: var(--cream); color: var(--ink); border: 1px solid var(--teal); }

/* Legend under the grid */
.tile-legend {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap;
  font-size: 10px; color: var(--cream-dim); letter-spacing: .5px; line-height: 1;
}
.tile-leg { display: inline-flex; align-items: center; gap: 4px; }
.tile-leg::before { content: ''; width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.leg-start::before  { background: var(--teal); }
.leg-target::before { background: var(--amber); }

/* ---- Template-background map mode (.tile-grid.tmpl-map) ---- */
/* Cells sit transparently over a background image; gap removed so image shows seamlessly. */
.tile-grid.tmpl-map {
  gap: 0;
  background-color: #050c14;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  transition: opacity .35s ease;
}
/* Map still decoding — hold the grid hidden, then fade in (see tmpl-loading toggle). */
.tile-grid.tmpl-map.tmpl-loading { opacity: 0; }
.tile-grid.tmpl-map .tile-cell {
  background: transparent;
  border-radius: 0;
}
.tile-grid.tmpl-map .tile-cell.tile-blocked {
  background: rgba(0,0,0,.52);
  opacity: 1;
  pointer-events: none;
}
.tile-grid.tmpl-map .tile-cell.tile-path::before,
.tile-grid.tmpl-map .tile-cell.tile-cur::before {
  background: rgba(46,230,201,.08);
}
.tile-grid.tmpl-map .tile-cell.tile-target::before {
  background: rgba(255,179,71,.08);
}

/* Start/Goal badges — instantly recognizable on the template map, not dominant.
   ::after is free here (only .tile-blocked uses it, and start/goal are never blocked). */
.tile-grid.tmpl-map .tile-cell.tile-start::after,
.tile-grid.tmpl-map .tile-cell.tile-target::after {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  font: 800 8px/1 var(--font); letter-spacing: .5px; text-transform: uppercase;
  padding: 2px 5px; border-radius: 3px; z-index: 6; pointer-events: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.55);
}
.tile-grid.tmpl-map .tile-cell.tile-start::after  { content: 'Start'; background: var(--teal);  color: var(--ink); }
.tile-grid.tmpl-map .tile-cell.tile-target::after { content: 'Ziel';  background: var(--amber); color: var(--ink); }
.tile-grid.tmpl-map.tmpl-fine .tile-cell.tile-start::after,
.tile-grid.tmpl-map.tmpl-fine .tile-cell.tile-target::after {
  font-size: 6px; padding: 1px 3px; top: 1px; letter-spacing: 0;
}

/* Fine-grid (16×10+): thinner borders, subtler overlays for smaller cells */
.tile-grid.tmpl-map.tmpl-fine .tile-cell.tile-path::before {
  box-shadow: inset 0 0 0 1px var(--teal), inset 0 0 3px rgba(46,230,201,.15);
}
.tile-grid.tmpl-map.tmpl-fine .tile-cell.tile-cur::before {
  box-shadow: inset 0 0 0 1px var(--teal), inset 0 0 6px rgba(46,230,201,.3);
}
.tile-grid.tmpl-map.tmpl-fine .tile-cell.tile-target::before {
  box-shadow: inset 0 0 0 1px var(--amber), inset 0 0 4px rgba(255,179,71,.22);
}
.tile-grid.tmpl-map.tmpl-fine .tile-cell.tile-blocked {
  background: rgba(0,0,0,.42);
}
.tile-grid.tmpl-map.tmpl-fine .tile-obst-icon {
  font-size: 9px;
  top: 1px; right: 1px;
}

@media (max-height: 400px) {
  .tile-outer { gap: 3px; }
  .tile-status { font-size: 10px; }
  .tile-ctrl-row { gap: 5px; }
  .tile-confirm { min-height: 44px; padding: 8px 12px; font-size: 13px; }
  .tile-undo, .tile-reset { min-height: 44px; }
}
@media (max-height: 360px) {
  .tile-status { display: none; }
  .tile-legend { display: none; }
  .tile-outer { gap: 2px; }
}

/* compact tappable route option chips (guaranteed touch targets) */
.route-chips { display: flex; gap: 10px; width: 100%; justify-content: center; flex-wrap: wrap; }
.route-chip {
  flex: 1 1 0; min-width: 130px; min-height: 50px;
  background: var(--navy-2); border: 2px solid var(--slate-2); border-radius: 8px;
  padding: 7px 12px; cursor: pointer; color: var(--cream);
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
}
.route-chip:active { transform: translateY(2px); }
.route-chip .rc-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.route-chip .rc-meta { display: flex; gap: 8px; font-size: 12px; }
.route-chip.fast { border-color: var(--teal); background: rgba(46,230,201,.09); }
.route-chip.fast .rc-name { color: var(--teal); }
.route-chip.safe { border-color: var(--good); background: rgba(110,226,122,.08); }
.route-chip.safe .rc-name { color: var(--good); }
.route-chip.risky { border-color: var(--amber); background: rgba(255,179,71,.1); }
.route-chip.risky .rc-name { color: var(--amber); }
@media (max-height: 400px) { .rm-node-label { display: none; } .route-chip { min-height: 44px; } }
@media (max-height: 360px) { .route-chip { min-height: 44px; padding: 6px 10px; } .route-chip .rc-name { font-size: 13px; } }

/* ---- Result layout: card preview (4:5) beside score ---- */
.result-wrap { display: flex; gap: 20px; align-items: center; justify-content: center; flex-wrap: wrap; width: 100%; }
.card-preview {
  flex: 0 0 auto; width: 200px; max-width: 32vw; aspect-ratio: 4 / 5;
  border-radius: 8px; overflow: hidden; border: 2px solid var(--teal); box-shadow: var(--shadow);
}
.card-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-preview.clickable { cursor: pointer; transition: transform .08s, border-color .1s; }
.card-preview.clickable:hover { transform: translateY(-2px); border-color: var(--amber); }
.result-wrap .center-col { flex: 1 1 320px; }

/* ---- Share-card fullscreen lightbox ---- */
.share-card-modal {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(4, 9, 16, .9);
  display: flex; align-items: center; justify-content: center;
  gap: 22px; flex-wrap: wrap;
  padding:
    max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.scm-card { display: flex; align-items: center; justify-content: center; }
.scm-card img {
  max-width: min(86vw, 400px);
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  aspect-ratio: 4 / 5; object-fit: contain;
  border-radius: 8px; box-shadow: 0 10px 36px rgba(0, 0, 0, .6);
}
.scm-actions { display: flex; flex-direction: column; gap: 12px; }
.scm-actions .btn { width: auto; min-width: 170px; }

/* ---- Empfang (reception / rating / tip) ---- */
.reception-panel { text-align: center; }
.reception-line { font-size: clamp(20px, 4.2vw, 28px); font-weight: 800; color: var(--cream); letter-spacing: .5px; }
.stars { letter-spacing: 6px; margin: 12px 0 8px; font-size: clamp(26px, 6vw, 40px); line-height: 1; }
.stars .star { color: var(--slate-2); }
.stars .star.on { color: var(--amber); text-shadow: 0 0 10px rgba(255,205,107,.5); }
.tip { color: var(--teal); font-weight: 800; letter-spacing: 1px; font-size: clamp(16px, 3.6vw, 20px); }

/* ---- Handover card (content-driven, additive; shown only when mission.content resolves) ---- */
.handover-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: 460px; margin: 0 auto;
  background: var(--navy-2); border: 2px solid var(--slate-2); border-radius: 8px;
  padding: 12px 14px; text-align: left;
}
.handover-character {
  flex: 0 0 auto; width: 72px; height: 90px;
  object-fit: cover; object-position: top center;
  border-radius: 6px; border: 2px solid var(--teal);
  background: var(--ink); image-rendering: auto;
}
.handover-meta { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.handover-name { font-weight: 800; font-size: 17px; color: var(--teal); letter-spacing: .5px; }
.handover-shop { font-size: 12px; color: var(--cream-dim); text-transform: uppercase; letter-spacing: 1px; }
.handover-order { font-size: 14px; color: var(--cream); }
.handover-note { font-size: 13px; color: var(--amber-warm); font-style: italic; }
.handover-line { font-size: 14px; color: var(--cream); margin-top: 2px; }
.handover-tip { font-size: 13px; font-weight: 800; color: var(--good); margin-top: 4px; }

@media (max-height: 470px) {
  .handover-card { padding: 8px 10px; gap: 10px; max-width: 420px; }
  .handover-character { width: 54px; height: 68px; }
  .handover-name { font-size: 15px; }
  .handover-order { font-size: 13px; }
  .handover-note, .handover-line { font-size: 12px; }
}
@media (max-height: 400px) {
  .handover-character { display: none; }
  .handover-card { padding: 7px 10px; }
}

/* ---- Door dialog (imported bon-door-sequence; EMPFANG upgrade) ---- */
.dialog-screen { justify-content: center; }
.dialog-stage {
  position: relative; flex: 1 1 auto; min-height: 0; width: 100%;
  display: flex; align-items: center; justify-content: flex-end;
}
.dialog-customer {
  position: absolute; left: 2%; bottom: 0;
  height: 94%; max-height: 100%; width: auto; object-fit: contain; object-position: bottom;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.55)); pointer-events: none; z-index: 1;
}
.dialog-panel {
  position: relative; z-index: 2;
  width: 52%; max-width: 460px; margin-right: 2%;
  display: flex; flex-direction: column; gap: 10px;
  background: var(--navy-2); border: 2px solid var(--slate-2); border-radius: 10px;
  padding: 16px 18px; box-shadow: var(--shadow);
}
.dialog-name { font-weight: 800; font-size: 18px; color: var(--teal); letter-spacing: .5px; }
.dialog-intro { font-size: 16px; color: var(--cream); line-height: 1.3; }
.door-event-badge {
  align-self: flex-start; font-size: 12px; font-weight: 800; letter-spacing: .5px;
  background: #3a2410; color: var(--amber-warm); border: 1px solid var(--amber);
  border-radius: 4px; padding: 3px 8px;
}
.dialog-options { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.door-action-row { display: flex; flex-direction: row; gap: 10px; margin-top: 4px; }
.dialog-opt { width: 100%; min-height: 48px; padding: 12px 16px; font-size: 15px; }
.door-action-row .dialog-opt { flex: 1; }
.result-cust-fb { font-size: 14px; color: var(--amber-warm); font-weight: 700; }
.result-feedback { display: flex; flex-direction: column; gap: 2px; align-items: center; text-align: center; }

/* ---- Hotspot stations (imported bon-door-sequence; ENTRANCE/FLOOR/DOOR) ---- */
.play-wrap { display: flex; flex-direction: column; gap: 6px; flex: 1 1 auto; min-height: 0; width: 100%; align-items: center; }
.play-wrap .panel-title { align-self: center; }
.play-scene {
  position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 100%;
  background-color: #050c14; background-size: 100% 100%; background-position: center; background-repeat: no-repeat;
  border: 2px solid var(--slate-2); border-radius: 8px; overflow: hidden;
}
.hotspot-layer { position: absolute; inset: 0; z-index: 1; }
.hotspot {
  position: absolute; min-width: 48px; min-height: 48px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,16,28,.16); border: 2px solid transparent; border-radius: 6px;
  cursor: pointer; color: var(--cream); transition: border-color .1s, background .1s;
}
.hotspot:hover, .hotspot:active { border-color: var(--teal); background: rgba(46,230,201,.18); }
.hotspot-label {
  font-size: 12px; font-weight: 800; line-height: 1.05; text-align: center;
  background: rgba(8,16,28,.82); color: var(--cream); border-radius: 4px; padding: 3px 6px;
  max-width: 94%; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
}
.hs-floor .hotspot-label { font-size: 11px; }
.hs-dev { border-color: var(--amber) !important; border-style: dashed; }
.hotspot-devid { position: absolute; top: 1px; left: 2px; font-size: 8px; color: var(--amber); pointer-events: none; }
@media (max-height: 470px) { .hotspot-label { font-size: 11px; padding: 2px 5px; } .play-wrap { gap: 4px; } }
@media (max-height: 400px) { .hotspot-label { font-size: 10px; } }

/* ---- BON_SELECT order card (cream clipboard, flip preview) ---- */
.bon-wrap { display: flex; flex-direction: column; gap: 8px; align-items: center; width: 100%; max-width: 460px; }
.bon-card {
  position: relative; height: 56vh; width: auto; aspect-ratio: 1122 / 1402; max-width: 92vw; max-height: 430px;
  background: var(--cream) center / 100% 100% no-repeat; color: #463524;
  border-radius: 6px; box-shadow: var(--shadow); padding: 12% 13% 9% 13%; overflow: hidden; text-align: left;
}
.bon-face { display: flex; flex-direction: column; gap: 3%; height: 100%; min-height: 0; }
.bon-card .bon-back { display: none; }
.bon-card.flipped .bon-front { display: none; }
.bon-card.flipped .bon-back { display: flex; }
.bon-title { font-weight: 800; font-size: clamp(13px, 3.2vh, 18px); color: #5a2c14; line-height: 1.05; }
.bon-main { font-weight: 800; font-size: clamp(12px, 2.9vh, 16px); color: #463524; }
.bon-sub { font-size: clamp(10px, 2.3vh, 13px); color: #8a7350; }
.bon-rows { display: flex; flex-direction: column; gap: 2.5%; margin-top: 2%; width: 100%; }
.bon-row { display: flex; justify-content: space-between; gap: 6px; align-items: baseline;
  font-size: clamp(10px, 2.3vh, 13px); border-bottom: 1px dashed #c8bda0; padding-bottom: 2%; }
.bon-k { font-weight: 800; text-transform: uppercase; font-size: clamp(8px, 1.9vh, 11px); color: #8a7350; flex: 0 0 auto; }
.bon-v { text-align: right; color: #463524; font-weight: 700; overflow: hidden; }
.bon-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; }
.bon-chip { background: #5a2c14; color: var(--cream); border-radius: 4px; padding: 2px 7px; font-size: 11px; font-weight: 800; }
.bon-actions { display: flex; gap: 10px; width: 100%; max-width: 360px; }
.bon-actions .btn.primary { flex: 1; }

/* CSS-rendered order ticket — real cream paper + frame + clip tab, drawn entirely in CSS
   so there is no PNG transparency/checkerboard. Reads cleanly on the dark intro scene. */
.bon-card.bon-paper {
  overflow: visible;   /* let the clip tab sit above the top edge */
  background: linear-gradient(180deg, #faf3e0 0%, #f1e7cd 100%);
  border: 2px solid #d9c79a;
  box-shadow:
    0 14px 34px rgba(0,0,0,.5),
    inset 0 0 0 5px #f6eed6,
    inset 0 0 0 7px rgba(224,123,57,.5);
}
.bon-card.bon-paper::before {                 /* clip tab */
  content: ''; position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  width: 46px; height: 15px; border-radius: 8px;
  background: linear-gradient(180deg, #ff8a3d, #e0641a);
  box-shadow: 0 3px 7px rgba(0,0,0,.4); z-index: 3;
}
.bon-card.bon-paper .bon-face { position: relative; z-index: 1; }   /* text above the frame */
@media (max-height: 470px) { .bon-card { height: 52vh; max-height: 320px; padding: 11% 12% 7% 12%; } .bon-wrap { gap: 5px; } }
/* E2: short landscape (≈844×390 down to 740×360) — the bon-card padding is a % of the wide
   parent while its height is vh-capped, so the 470px reduction starves/clips the content.
   Compact padding (smaller % AND a fixed cap), gaps and fonts so no core row is clipped.
   This block follows the 470 rule above, so it wins for the overlapping bon-card props. */
@media (max-height: 470px) {
  .bon-wrap { gap: 4px; max-width: 520px; }
  .bon-card { height: 64vh; max-height: 270px; padding: 14px clamp(14px, 9%, 40px) 12px clamp(14px, 9%, 40px); }
  .bon-face { gap: 1.5%; }
  .bon-title { font-size: clamp(11px, 4vh, 15px); line-height: 1.02; }
  .bon-main { font-size: clamp(10px, 3.4vh, 14px); }
  .bon-sub { font-size: clamp(9px, 2.6vh, 12px); }
  .bon-rows { gap: 1.5%; margin-top: 1.5%; }
  .bon-row { font-size: clamp(9px, 2.7vh, 12px); padding-bottom: 1.5%; }
  .bon-k { font-size: clamp(8px, 2.2vh, 10px); }
  .bon-actions .btn, .bon-wrap .btn { min-height: 38px; padding: 6px 12px; font-size: 13px; }
  .bon-actions .btn.primary, .bon-wrap .btn.primary { min-height: 44px; }   /* main action ≥44px */
}
@media (max-height: 360px) {
  .bon-card { height: 66vh; max-height: 240px; padding: 10px clamp(12px, 7%, 32px) 9px clamp(12px, 7%, 32px); }
  .bon-actions .btn, .bon-wrap .btn { min-height: 34px; }
  .bon-actions .btn.primary, .bon-wrap .btn.primary { min-height: 44px; }
}

@media (max-height: 470px) {
  .dialog-panel { padding: 11px 13px; gap: 7px; width: 56%; }
  .dialog-name { font-size: 16px; } .dialog-intro { font-size: 14px; }
  .dialog-opt { min-height: 44px; padding: 9px 13px; font-size: 14px; }
}
@media (max-height: 400px) {
  .dialog-opt { min-height: 44px; padding: 8px 11px; font-size: 13px; }
  .dialog-customer { left: 0; height: 90%; }
}

/* ---- Hard-fit compaction: shrink content on short landscape, never scroll ---- */
.clamp1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (max-height: 470px) {
  .screen { gap: 9px; }
  .center-col { gap: 9px; max-width: 660px; }
  .btn { min-height: 46px; padding: 9px 16px; font-size: 15px; }
  .btn.sm { min-height: 0; padding: 6px 12px; }
  .btn-row { gap: 9px; }
  .panel { padding: 9px 12px; }
  .panel-title { margin-bottom: 4px; font-size: 11px; }
  .brand-lg { font-size: 30px; } .brand-md { font-size: 22px; }
  .claim { font-size: 11px; letter-spacing: 3px; }
  .subline { font-size: 11px; }
  .recovery { font-size: 17px; }
  .bon { padding: 9px 12px; border-top-width: 4px; }
  .bon-row { padding: 3px 0; font-size: 12px; }
  .bon-row .k { font-size: 10px; min-width: 80px; }
  .bon h3 { margin-bottom: 5px; font-size: 15px; }
  .score-big { font-size: clamp(28px, 7vh, 50px); }
  .warnbox { padding: 6px 10px; font-size: 12px; }
  .breakdown { font-size: 12px; gap: 2px; }
  .reception-line { font-size: clamp(17px, 4.5vh, 24px); }
  .stars { font-size: clamp(22px, 6vh, 34px); margin: 6px 0 4px; }
  .tip { font-size: 15px; }
  .card-preview { width: 150px; }
  .scene { height: 64px; }
  .watch { min-height: 38px; padding: 7px 12px; font-size: 14px; }
  .timer { font-size: clamp(24px, 7vh, 40px); }
}
@media (max-height: 400px) {
  .screen { gap: 7px; }
  .center-col { gap: 7px; }
  .btn { min-height: 44px; padding: 8px 14px; font-size: 14px; }   /* iOS tap-target floor */
  .panel { padding: 7px 10px; }
  .bon-row { padding: 2px 0; font-size: 11px; }
  .bon-row .k { min-width: 72px; }
  .brand-lg { font-size: 26px; } .brand-md { font-size: 20px; }
  .recovery { font-size: 15px; }
  .score-big { font-size: clamp(24px, 6.5vh, 42px); }
  .breakdown { font-size: 11px; }
  .card-preview { width: 126px; }
  .warnbox { font-size: 11px; }
  .scene { height: 52px; }
}
@media (max-height: 360px) {
  .center-col { gap: 5px; }
  /* Extreme-short fit: keep secondary buttons compact but never below the 44px tap floor
     for the PRIMARY action (Daily/Lieferung starten, Weiter …). */
  .btn { min-height: 40px; padding: 6px 12px; font-size: 13px; }
  .btn.primary { min-height: 44px; }
  .panel { padding: 5px 9px; }
  .bon-row { font-size: 10px; padding: 1px 0; }
  .card-preview { width: 108px; }
  .score-big { font-size: clamp(22px, 6vh, 34px); }
  .breakdown { font-size: 10px; gap: 1px; }
  .scene { display: none; }
}

/* ---- Tap-target floor for in-run map controls (P0 mobile fix) ----
   These buttons carry `.btn`/`.btn.sm`, whose short-landscape media overrides above
   (min-height 40 / 0) would otherwise shrink them below 44px. Higher-specificity selectors
   here keep the in-run controls tappable (≥44px) at every viewport height. Placed last. */
.btn.tile-confirm { min-height: 44px; }
.btn.sm.tile-undo, .btn.sm.tile-reset { min-height: 44px; }

/* ---- EXPERIMENT: tap-to-rotate route puzzle (street tiles + neon trace) ----
   Combined tile: city-road pixel-art as the base (map look) with the neon route-trace drawn
   on top (dim by default, bright teal when connected). START = pizzeria, ZIEL = delivery house.
   Board sized in JS (tile=min(availW,availH)/5, clamp 44..120); full viewport width so the
   complete 5x5 always fits (no desktop cutoff). */
.rp-screen { gap: 8px; max-width: none; }
.rp-wrap { display: flex; flex-direction: row; gap: 16px; flex: 1 1 auto; min-height: 0;
  width: 100%; align-items: center; justify-content: center; }
.rp-board { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr);
  gap: 3px; background: var(--ink); padding: 5px; border-radius: 10px; flex: 0 0 auto;
  box-shadow: inset 0 0 0 2px var(--navy-2); }
.rp-cell { position: relative; border-radius: 5px; overflow: hidden; background: var(--ink);
  border: 2px solid transparent; padding: 0; min-width: 44px; min-height: 44px; aspect-ratio: 1 / 1;
  color: rgba(150, 170, 190, .5); }                  /* default (dim) neon colour */
.rp-base { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  display: block; image-rendering: pixelated; }
.rp-base.rp-dim { filter: brightness(.34) saturate(.5); }   /* empty city blocks recede */
.rp-neon { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .42; transition: opacity .12s ease; }
button.rp-cell { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.rp-cell:active { transform: scale(.93); }
.rp-cell.rp-road { border-color: rgba(46,230,201,.12); }
.rp-cell.lit { color: var(--teal); border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal), 0 0 13px rgba(46,230,201,.5); }
.rp-cell.lit .rp-neon { opacity: 1; filter: drop-shadow(0 0 4px var(--teal)); }
.rp-cell.rp-empty { border-color: rgba(255,255,255,.04); }
.rp-cell.rp-obstacle { border-color: #5a3a22; }
.rp-cell.rp-start { border-color: var(--good); box-shadow: 0 0 11px rgba(110,226,122,.4); }
.rp-cell.rp-goal  { border-color: var(--amber); box-shadow: 0 0 11px rgba(255,179,71,.4); }
.rp-cell.rp-start { color: var(--good); }                   /* START neon = green (always on) */
.rp-cell.rp-goal.rp-win { border-color: var(--teal); animation: rp-win .5s ease 2; }
@keyframes rp-win { 0%,100% { box-shadow: 0 0 8px rgba(46,230,201,.3); } 50% { box-shadow: 0 0 22px rgba(46,230,201,.85); } }
.rp-label { position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; z-index: 2;
  font-size: clamp(8px, 1.5vh, 11px); font-weight: 800; letter-spacing: .5px; color: var(--cream);
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 2px rgba(0,0,0,.95); pointer-events: none; }
.rp-cell.rp-start .rp-label { color: var(--good); }
.rp-cell.rp-goal .rp-label { color: var(--amber); }
.rp-side { display: flex; flex-direction: column; gap: 10px; width: clamp(200px, 26vw, 320px); flex: 0 0 auto; }
.rp-hint { font-size: 13px; color: var(--cream-dim); line-height: 1.2; }
.rp-status { font-size: 15px; font-weight: 800; color: var(--cream);
  background: var(--slate); border-left: 4px solid var(--slate-2); border-radius: 4px; padding: 8px 12px; }
.rp-status.ok { color: var(--teal); border-left-color: var(--teal); }
.rp-accept { width: 100%; min-height: 48px; }
.rp-accept:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 700px), (max-height: 470px) {
  .rp-status { font-size: 14px; padding: 6px 10px; } .rp-accept { min-height: 44px; }
  .rp-side { width: clamp(150px, 34vw, 240px); } .rp-hint { font-size: 12px; }
}

/* ---- VehicleSelect (carousel — one vehicle standing on the garage floor) ----
   One cut-out vehicle centered on the garage backdrop; arrows / swipe / dots cycle. Hints live
   on the bon (screen before), so this screen is a clean choice. */
.vehicle-screen { width: 100%; }
.vs-wrap { display: flex; flex-direction: column; gap: 8px; width: 100%; height: 100%;
  min-height: 0; max-width: 760px; margin: 0 auto;
  padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
.vs-head { text-align: center; flex: 0 0 auto; }
.vs-title { font-weight: 800; font-size: clamp(18px, 4.4vh, 26px); color: var(--cream); line-height: 1.05;
  text-shadow: 0 2px 8px rgba(0,0,0,.8); }
.vs-carousel { display: flex; align-items: center; justify-content: center; gap: 10px;
  flex: 1 1 auto; min-height: 0; width: 100%; }
.vs-arrow { flex: 0 0 auto; width: 52px; height: 52px; min-width: 48px; border-radius: 50%;
  background: rgba(8,16,28,.55); border: 2px solid var(--slate-2); color: var(--cream);
  font-size: 30px; font-weight: 800; line-height: 1; display: flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .08s, border-color .12s, background .12s; }
.vs-arrow:hover { border-color: var(--teal); }
.vs-arrow:active { transform: scale(.9); }
/* vehicle stands on the floor → bottom-aligned, with a teal floor-glow at its base */
.vs-stage { flex: 1 1 auto; min-width: 0; height: 100%; position: relative;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6%; }
.vs-stage::after { content: ""; position: absolute; bottom: 4%; left: 50%; transform: translateX(-50%);
  width: 62%; height: 12%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(46,230,201,.55), transparent); }
.vs-img { max-width: 100%; max-height: 100%; object-fit: contain; object-position: bottom; display: block;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.55)) drop-shadow(0 0 14px rgba(46,230,201,.4));
  animation: vs-pop .22s ease; }
@keyframes vs-pop { 0% { opacity: .3; transform: translateY(6px) scale(.96); } 100% { opacity: 1; transform: none; } }
.vs-img-missing { display: none; }
.vs-stage:has(.vs-img-missing)::before { content: "🛵"; font-size: 44px; opacity: .5; }
.vs-meta { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.vs-name { font-weight: 800; font-size: clamp(16px, 2.6vh, 20px); letter-spacing: .5px; color: var(--teal);
  text-shadow: 0 2px 6px rgba(0,0,0,.85); }
.vs-lines { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.vs-line { font-size: clamp(11px, 1.6vh, 13px); color: var(--cream-dim); line-height: 1.2; text-shadow: 0 1px 4px rgba(0,0,0,.9); }
.vs-dots { display: flex; gap: 6px; justify-content: center; margin-top: 2px; }
.vs-dot { width: 10px; height: 10px; padding: 7px; box-sizing: content-box; background-clip: content-box;
  border: none; border-radius: 50%; background-color: rgba(255,255,255,.28); cursor: pointer; }
.vs-dot.on { background-color: var(--teal); box-shadow: 0 0 8px var(--teal); }
.vs-actions { flex: 0 0 auto; display: flex; justify-content: center; }
.vs-go { max-width: 360px; width: 100%; }

@media (max-height: 470px) {
  .vs-wrap { gap: 5px; } .vs-name { font-size: 15px; } .vs-line { font-size: 11px; }
  .vs-arrow { width: 46px; height: 46px; font-size: 26px; }
}
@media (max-height: 360px) {
  .vs-title { font-size: 16px; } .vs-go { min-height: 44px; }
}
