/* ============================================================================
   Hide + Seek — transit-ticket interface.

   One committed look, taken from the design comp: navy ground, cream ticket
   stock, red for anything urgent, amber for anything the hider owns. Blocks are
   notched like a punched ticket and sit on hard offset shadows — no blur, no
   gradients on surfaces. Display type is Archivo Black, labels are JetBrains
   Mono in caps, body is Nunito Sans.

   Hand-written, no framework, no build step. Tokens first, semantic classes
   after; nothing in here needs a class the markup does not already carry.
   ========================================================================== */

:root {
  color-scheme: dark;

  --navy:      #12224b;
  --navy-deep: #0b1631;
  --navy-lift: #1b3168;
  --paper:     #eee7d7;
  --paper-2:   #f7f2e6;
  --paper-3:   #dfd6bf;
  --red:       #e0402f;
  --amber:     #f2b830;
  --green:     #5ad19b;
  --slate:     #6a7ba3;
  --slate-2:   #7f8fb5;
  --pale:      #a9b6d6;

  /* semantic roles */
  --bg:        var(--navy);
  --panel:     var(--paper);
  --panel-2:   var(--paper-2);
  --line:      var(--navy);
  --line-soft: rgba(18, 34, 75, .16);
  --text:      var(--navy);
  --muted:     var(--slate);
  --accent:    var(--red);
  --curse:     var(--red);
  --powerup:   var(--green);
  --time:      var(--amber);
  --warn:      var(--amber);
  --danger:    var(--red);
  --ok:        var(--green);

  --gap:  .6rem;
  --tap:  44px;                        /* minimum comfortable thumb target */
  --shadow: 5px 5px 0 var(--navy);     /* the only elevation in the system */
  --shadow-red: 5px 5px 0 var(--red);

  --display: "Archivo Black", "Arial Black", system-ui, sans-serif;
  --font:    "Nunito Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* A notched corner, cut top-right and bottom-left like a punched ticket. */
@supports (clip-path: polygon(0 0)) {
  .notch    { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px)); }
  .notch-sm { clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 9px 100%, 0 calc(100% - 9px)); }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  margin: 0;
  color: var(--paper);
  font: 400 15px/1.45 var(--font);
  overscroll-behavior-y: contain;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.035) 0 2px, transparent 2px 13px),
    radial-gradient(120% 80% at 12% 0%, var(--navy-lift) 0%, var(--navy) 60%, #0d1935 100%);
  background-attachment: fixed;
}

::selection { background: var(--amber); color: var(--navy); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

h1, h2, h3 {
  margin: 0 0 .5rem;
  font-family: var(--display);
  font-weight: 400;
  line-height: .95;
  text-transform: uppercase;
  letter-spacing: -.01em;
}
h1 { font-size: 2.1rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1rem; }
p  { margin: 0 0 .6rem; }
a  { color: var(--red); border-bottom: 2px solid var(--red); text-decoration: none; }
@media (hover: hover) { a:hover { color: var(--navy); background: var(--amber); border-bottom-color: var(--navy); } }
strong, b { font-weight: 800; }
code { font: 700 .85em/1 var(--mono); }

/* A mono caps label — the system's small print, used all over. */
.kicker, label, .phase-label, .qgroup, .card-type {
  font: 700 9px/1 var(--mono);
  letter-spacing: .2em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------- controls */

button, .btn {
  font: 700 11px/1 var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--navy);
  border: 0;
  padding: .85rem 1rem;
  min-height: var(--tap);
  cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
  transition: background .1s linear, color .1s linear, box-shadow .1s linear, transform .1s linear;
  touch-action: manipulation;          /* no double-tap zoom, so no tap delay */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
/* a finger has no hover, so the press is the feedback */
@media (hover: none) { button:active:not(:disabled) { background: var(--red); color: var(--paper-2); } }
a, summary, input, select, textarea, label { touch-action: manipulation; }
@media (hover: hover) { button:hover:not(:disabled) { background: var(--red); color: var(--paper-2); } }
button:disabled { opacity: .4; cursor: not-allowed; }

button.primary {
  background: var(--red);
  color: var(--paper-2);
  font: 400 1.15rem/1 var(--display);
  letter-spacing: .01em;
  padding: 1.05rem 1.1rem;
  box-shadow: var(--shadow);
}
@media (hover: hover) { button.primary:hover:not(:disabled) { background: var(--navy); color: var(--amber); } }
button.primary:active:not(:disabled) { box-shadow: 2px 2px 0 var(--navy); transform: translate(3px, 3px); }

button.danger { background: transparent; color: var(--red); border: 3px dashed var(--red); }
@media (hover: hover) { button.danger:hover:not(:disabled) { background: var(--red); color: var(--paper-2); } }
button.ghost  { background: transparent; color: var(--navy); border: 3px solid var(--navy); }
@media (hover: hover) { button.ghost:hover:not(:disabled) { background: var(--navy); color: var(--amber); } }
button.small  { padding: .5rem .7rem; min-height: 36px; font-size: 10px; letter-spacing: .12em; }

input, select, textarea {
  font: 600 16px/1.3 var(--font);      /* 16px stops iOS zooming on focus */
  color: var(--navy);
  background: var(--paper-2);
  border: 3px solid var(--navy);
  border-radius: 0;
  padding: .6rem .65rem;
  min-height: var(--tap);
  width: 100%;
}
input:focus, textarea:focus, select:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 3px var(--amber); }
input[type="number"] { max-width: 6rem; }

label { display: block; color: var(--red); margin-bottom: .35rem; }

/* --------------------------------------------------------------- layout */

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 .9rem calc(4rem + env(safe-area-inset-bottom)); }

/* The departures board: phase, clock and status, always on screen. */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--navy-deep);
  border-bottom: 3px solid var(--paper);
  /* the inset goes on top: under a translucent status bar this is what clears the notch */
  padding: calc(.7rem + env(safe-area-inset-top)) calc(.9rem + env(safe-area-inset-right)) .7rem calc(.9rem + env(safe-area-inset-left));
}
.topbar-inner { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.phase-label { color: var(--amber); margin-bottom: .45rem; }
.clock {
  font: 700 3.2rem/.86 var(--mono);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
}
.clock.is-frozen { color: var(--amber); animation: blink 1.4s steps(2, end) infinite; }
.clock.is-over   { color: var(--red); }
@keyframes blink { 50% { opacity: .45; } }

.chips { display: flex; gap: .35rem; flex-wrap: wrap; margin-left: auto; }
.chip {
  font: 700 9px/1 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--paper);
  color: var(--navy);
  padding: .4rem .55rem;
  white-space: nowrap;
}
.chip.role-hider  { background: var(--red);   color: var(--paper-2); }
.chip.role-seeker { background: var(--navy);  color: var(--paper); box-shadow: inset 0 0 0 2px var(--paper); }
.chip.live::before, .chip.offline::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: .4rem; vertical-align: -1px;
}
.chip.live::before    { background: var(--green); box-shadow: 0 0 0 3px rgba(90,209,155,.25); }
.chip.offline::before { background: var(--red);   box-shadow: 0 0 0 3px rgba(224,64,47,.25); }

/* Tabs are destination tiles on the board. */
.tabbar {
  display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none;
  padding: .7rem .9rem; position: sticky; top: 0; z-index: 29;
  background: var(--navy-deep);
  border-bottom: 3px solid var(--paper);
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button {
  background: var(--paper); color: var(--navy);
  padding: .55rem .8rem; min-height: 0; white-space: nowrap;
  font-size: 10px; letter-spacing: .12em;
  clip-path: none;
}
@media (hover: hover) { .tabbar button:hover:not(:disabled) { background: var(--amber); color: var(--navy); } }
.tabbar button[aria-selected="true"] { background: var(--red); color: var(--paper-2); box-shadow: 3px 3px 0 var(--paper); }
.tabbar .badge { margin-left: .35rem; }

/* Panels are ticket stock: cream, hard shadow, one notched corner. */
.panel {
  background: var(--panel);
  color: var(--navy);
  padding: 1rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}
.panel > :last-child { margin-bottom: 0; }
.panel h2 { color: var(--navy); }
.panel h2 + .muted { margin-top: -.2rem; }

.muted { color: var(--slate); font: 400 11px/1.5 var(--mono); }
.row   { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.stack { display: grid; gap: var(--gap); }
.grid-2 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-3 { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* -------------------------------------------------------------- notices */

.notice {
  padding: .8rem .9rem;
  font: 800 13px/1.35 var(--font);
  color: var(--navy);
  background: var(--paper-3);
  box-shadow: 4px 4px 0 var(--navy);
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}
.notice strong { display: block; font: 700 9px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--red); margin-bottom: .5rem; }
.notice.warn   { background: var(--amber); }
.notice.danger { background: var(--red); color: var(--paper-2); box-shadow: 4px 4px 0 var(--navy); }
.notice.danger strong { color: var(--amber); }
.notice.accent { background: var(--navy); color: var(--paper); box-shadow: 4px 4px 0 var(--red); }
.notice.accent strong { color: var(--amber); }
.notice.accent button { background: var(--red); color: var(--paper-2); }   /* a navy button vanishes on navy */

#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 1.2rem; z-index: 60; display: grid; gap: .5rem; width: min(28rem, 92vw); }
.toast {
  background: var(--amber); color: var(--navy);
  padding: .7rem .8rem; font: 800 13px/1.3 var(--font);
  box-shadow: 4px 4px 0 var(--navy);
}

/* ------------------------------------------------------------ questions */

.qcat { background: var(--paper-2); border: 3px solid var(--navy); margin: .6rem 0; }
.qcat > summary {
  cursor: pointer; padding: .75rem .8rem; list-style: none;
  display: flex; gap: .5rem; align-items: center; min-height: var(--tap);
  font: 400 1.05rem/1 var(--display); text-transform: uppercase; color: var(--navy);
}
.qcat > summary::-webkit-details-marker { display: none; }
.qcat > summary::after { content: "▾"; margin-left: auto; color: var(--red); font-family: var(--font); }
.qcat[open] > summary { background: var(--navy); color: var(--paper); }
.qcat[open] > summary::after { content: "▴"; color: var(--amber); }
.qcat .qbody { padding: .5rem .6rem .7rem; display: grid; gap: .45rem; }

.qmeta {
  font: 700 9px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--red); white-space: nowrap;
}
.qgroup { color: var(--slate-2); margin-top: .5rem; }

.qbtn {
  display: flex; gap: .6rem; align-items: center; width: 100%; text-align: left;
  background: var(--paper); color: var(--navy);
  font: 800 14px/1.3 var(--font); letter-spacing: 0; text-transform: none;
  padding: .7rem .75rem;
  clip-path: none;
  box-shadow: 3px 3px 0 var(--navy);
}
@media (hover: hover) { .qbtn:hover:not(:disabled) { background: var(--amber); color: var(--navy); } }
.qbtn .qmeta { margin-left: auto; }

/* What each answer would leave: the seekers' crib, under the question it is about */
.qlabel { display: grid; gap: .25rem; }
.qsplit { font: 700 11px/1.3 var(--mono); letter-spacing: .02em; color: #31456f; }
.qsplit:empty { display: none; }
.qsplit.is-best { color: var(--navy); font-weight: 800; }
.qsplit.is-useless { text-decoration: line-through; }
.qsplit.is-unknown { font-weight: 400; font-style: italic; }
.qbtn.is-asked { opacity: .55; box-shadow: none; outline: 2px dashed var(--slate); }

/* ---------------------------------------------------------------- cards */

.card-face {
  padding: .8rem .85rem;
  background: var(--paper-2);
  color: var(--navy);
  box-shadow: 4px 4px 0 var(--navy);
}
.card-face .card-type { color: var(--red); }
.card-face .card-name { font: 400 1.25rem/1 var(--display); text-transform: uppercase; margin: .55rem 0 .4rem; }
.card-face .card-cost { font: 700 10px/1.3 var(--mono); letter-spacing: .1em; color: var(--navy); background: var(--amber); display: inline-block; padding: .3rem .45rem; margin-bottom: .5rem; }
.card-face .card-effect { font: 600 13px/1.4 var(--font); color: #31456f; }
.card-face.type-curse   { background: var(--red);  color: var(--paper-2); box-shadow: 4px 4px 0 var(--navy); }
.card-face.type-curse .card-type, .card-face.type-curse .card-effect { color: var(--paper); }
.card-face.type-curse .card-cost { background: var(--navy); color: var(--amber); }
.card-face.type-powerup { background: var(--navy); color: var(--paper); box-shadow: 4px 4px 0 var(--green); }
.card-face.type-powerup .card-type { color: var(--green); }
.card-face.type-powerup .card-effect { color: var(--pale); }
.card-face.type-time    { background: var(--amber); box-shadow: 4px 4px 0 var(--navy); }
.card-face.type-time .card-type { color: var(--navy); }
.card-face.type-time .card-effect { color: #4a3a12; }
.card-face.is-selected { outline: 4px solid var(--navy); outline-offset: 3px; }
.card-face.selectable  { cursor: pointer; }

/* ---------------------------------------------------------------- rules */

.rule { border-left: 4px solid var(--red); padding-left: .8rem; margin: .8rem 0; }
.rule b { display: block; font: 800 15px/1.25 var(--font); margin-bottom: .25rem; color: var(--navy); }
.rule span { color: #31456f; font: 600 13px/1.45 var(--font); }

/* --------------------------------------------------------------- tables */

table { width: 100%; border-collapse: collapse; font: 600 13px/1.4 var(--font); color: var(--navy); }
th, td { text-align: left; padding: .55rem .4rem; vertical-align: top; }
thead tr { background: var(--navy); }
th { color: var(--amber); font: 700 9px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
tbody tr { border-bottom: 2px solid var(--line-soft); }
tbody tr:last-child { border-bottom: 0; }
tr.is-late td { color: var(--red); }

/* The log and the investigation book share the dotted-line timeline. */
.logline {
  display: flex; gap: .8rem; padding: .55rem 0 .55rem 1.1rem;
  border-bottom: 2px solid var(--line-soft);
  font: 600 13px/1.4 var(--font); color: var(--navy);
  position: relative;
}
.logline::before {
  content: ""; position: absolute; left: 0; top: .95rem;
  width: 11px; height: 11px; background: var(--navy); border: 3px solid var(--paper); border-radius: 50%;
}
.logline:last-child { border-bottom: 0; }
.logline time { color: var(--slate); font: 400 10px/1.6 var(--mono); min-width: 4.2rem; }
.logline.kind-phase::before   { background: var(--amber); }
.logline.kind-curse::before   { background: var(--red); }
.logline.kind-powerup::before { background: var(--green); }
.logline.kind-warn::before    { background: var(--red); }
.logline.kind-curse   { color: var(--red); }
.logline.kind-powerup { color: #1f6b45; }

/* ------------------------------------------------------------- learn */

.step { display: flex; gap: .8rem; padding: .75rem 0; border-bottom: 2px solid var(--line-soft); }
.step:last-child { border-bottom: 0; }
.step .num {
  flex: none; width: 2rem; height: 2rem;
  display: grid; place-items: center;
  font: 700 .8rem/1 var(--mono);
  background: var(--red); color: var(--paper-2);
}
.step .num.seeker { background: var(--navy); color: var(--amber); }
.step b { display: block; font: 800 15px/1.25 var(--font); color: var(--navy); margin-bottom: .2rem; }
.step p { margin: 0; color: #31456f; font: 600 13px/1.45 var(--font); }

/* ------------------------------------------------------------------ map */

#map {
  height: min(62vh, 480px);
  border: 3px solid var(--navy);
  background: var(--paper-3);
  box-shadow: 4px 4px 0 var(--navy);
}
.leaflet-container { font: 700 11px/1.4 var(--mono); background: #e7dfcd; }
/* A light warm wash so tiles sit next to the ticket stock instead of glaring
   white. No hue rotation: the streets have to stay the colour of streets. */
.leaflet-tile-pane { filter: saturate(.82) contrast(.94) brightness(1.02) sepia(.10); }
.leaflet-control-attribution { font-size: 8px; background: rgba(238,231,215,.86); color: var(--navy); }
.leaflet-control-attribution a { color: var(--navy); border: 0; }
.leaflet-bar a { background: var(--paper); color: var(--navy); font-weight: 700; }
@media (hover: hover) { .leaflet-bar a:hover { background: var(--red); color: var(--paper-2); } }
.map-pin {
  font: 700 9px/1 var(--mono); letter-spacing: .06em; color: var(--paper);
  background: var(--navy); padding: .3rem .4rem; white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 5px 100%, 0 calc(100% - 5px));
  box-shadow: 2px 2px 0 var(--red);
}
.map-pin.red { background: var(--red); box-shadow: 2px 2px 0 var(--navy); }

/* You are here: the one mark on the map that is about you, so it is the one that moves */
.me-dot {
  width: 18px; height: 18px; border-radius: 50%; position: relative;
  background: var(--amber); border: 3px solid var(--navy); box-shadow: 0 0 0 2px var(--paper);
}
.me-dot::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%;
  border: 3px solid var(--amber); animation: me-pulse 1.8s ease-out infinite;
}
@keyframes me-pulse { from { transform: scale(.45); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

/* ------------------------------------------------------- answer sheet */

/* The hider's pending question follows them across tabs; on a phone it is the
   bottom sheet from the comp, on a desktop it sits in the same corner. */
#sheet {
  position: fixed; inset: auto 0 0 0; z-index: 55;
  background: var(--paper-2); color: var(--navy);
  border-top: 4px solid var(--navy);
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 0 rgba(11,22,49,.35);
}
#sheet .sheet-q { font: 800 17px/1.3 var(--font); margin: .6rem 0 .8rem; }
#sheet .sheet-meta { font: 400 10px/1.4 var(--mono); color: var(--slate); }
#sheet .row { gap: .5rem; }
#sheet .row button { flex: 1 1 7rem; }

/* ---------------------------------------------------------------- lobby */

.lobby { min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; }
.lobby .panel { width: min(30rem, 100%); }
.lobby h1 { font-size: 3.4rem; line-height: .86; }
.lobby h1 .plus { color: var(--red); }

.code-display {
  font: 700 2.1rem/1 var(--mono);
  letter-spacing: .28em;
  text-align: center;
  color: var(--navy);
  background: var(--paper-2);
  border: 3px dashed var(--navy);
  padding: .8rem .4rem;
  margin: .5rem 0 .7rem;
}

footer.site { color: var(--slate-2); font: 400 10px/1.6 var(--mono); letter-spacing: .1em; text-align: center; text-transform: uppercase; padding: 1.6rem .9rem 2.6rem; }
footer.site a { color: var(--pale); border-bottom-color: var(--pale); }

/* -------------------------------------------------- mobile ergonomics */

@media (max-width: 720px) {
  /* the board stays pinned, so it has to stay short: one line of chips, swiped sideways */
  .topbar { padding: calc(.5rem + env(safe-area-inset-top)) .75rem .5rem; }
  .topbar-inner { gap: .45rem; }
  .phase-label { margin-bottom: .3rem; }
  .clock { font-size: 2.2rem; }
  .chips {
    width: calc(100% + 1.5rem); margin: 0 -.75rem; padding: 0 .75rem;
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  }
  .chips::-webkit-scrollbar { display: none; }
  .panel { padding: .85rem .8rem; margin: .8rem 0; box-shadow: 4px 4px 0 var(--navy); }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.2rem; }
  .lobby h1 { font-size: 2.8rem; }
  #map { height: min(60dvh, 560px); }

  /* thumb-sized zoom buttons */
  .leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Stat tiles — the four numbers the comp puts on the round screen. */
.stat { padding: .8rem .85rem; background: var(--paper-2); box-shadow: 4px 4px 0 var(--navy); }
.stat .kicker { color: var(--red); }
.stat .stat-num { font: 400 2rem/1 var(--display); color: var(--navy); margin-top: .5rem; }
.stat:nth-child(even) { background: var(--navy); box-shadow: 4px 4px 0 var(--red); }
.stat:nth-child(even) .kicker { color: var(--amber); }
.stat:nth-child(even) .stat-num { color: var(--paper); }

/* ------------------------------------------------------------------ nav */

/* The dock, drawer and scrim only exist on a phone; the desktop board is the
   same <nav>, laid out across the top. */
.dock, .nav-scrim { display: none; }

@media (max-width: 720px) {
  :root { --dock: 62px; }              /* the dock's height, before the home-indicator inset */

  /* a native-style tab bar along the bottom edge, where thumbs are */
  .dock {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .3rem;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 47;
    height: calc(var(--dock) + env(safe-area-inset-bottom));
    padding: .4rem calc(.4rem + env(safe-area-inset-right)) calc(.4rem + env(safe-area-inset-bottom)) calc(.4rem + env(safe-area-inset-left));
    background: var(--navy-deep);
    border-top: 3px solid var(--paper);
  }
  .dock-tabs { display: contents; }
  .dock button {
    clip-path: none; min-height: 0; padding: 0 .15rem;
    background: transparent; color: var(--pale);
    font: 700 11px/1.1 var(--mono); letter-spacing: .04em;
    display: flex; align-items: center; justify-content: center; gap: .25rem;
    overflow: hidden; white-space: nowrap;
  }
  .dock button[aria-selected="true"], .dock .nav-toggle.is-current { background: var(--red); color: var(--paper-2); }
  body.nav-open .dock .nav-toggle { background: var(--amber); color: var(--navy); }
  .dock .badge { background: var(--amber); color: var(--navy); padding: .15rem .3rem; font-size: 11px; }
  /* a 320px phone leaves ~58px a tab: "ACTIVE" and its badge fit only without the spacing */
  @media (max-width: 360px) {
    .dock { gap: .15rem; }
    .dock button { letter-spacing: 0; padding: 0; gap: .15rem; }
    .dock .badge { padding: .1rem .2rem; }
  }

  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 44;
    background: rgba(11, 22, 49, .72);
  }
  .nav-scrim[hidden] { display: none; }

  /* the drawer itself: full-height, right-hand side, one tile per screen */
  .tabbar {
    position: fixed; inset: 0 0 0 auto; top: 0; bottom: 0;
    width: min(17rem, 82vw);
    flex-direction: column; gap: .45rem;
    overflow-y: auto; overflow-x: hidden;
    padding: calc(1rem + env(safe-area-inset-top)) .8rem calc(var(--dock) + 1rem + env(safe-area-inset-bottom));
    background: var(--navy-deep);
    border: 0; border-left: 3px solid var(--paper);
    transform: translateX(101%);
    transition: transform .18s ease-out;
    z-index: 46;
  }
  body.nav-open .tabbar { transform: translateX(0); }
  .tabbar button { width: 100%; text-align: left; padding: .9rem .85rem; font-size: 12px; min-height: var(--tap); }
  .tabbar button[aria-selected="true"] { box-shadow: 4px 4px 0 var(--paper); }

  /* everything else pinned to the bottom stands on the dock */
  .wrap { padding-bottom: 1rem; }      /* the footer after it clears the dock */
  footer.site { padding-bottom: calc(var(--dock) + 1.5rem + env(safe-area-inset-bottom)); }
  #toasts { bottom: calc(var(--dock) + .8rem + env(safe-area-inset-bottom)); }
  #sheet {
    bottom: calc(var(--dock) + env(safe-area-inset-bottom)); padding-bottom: 1rem;
    max-height: calc(100dvh - var(--dock) - env(safe-area-inset-bottom) - 6rem); overflow-y: auto;
  }
}

/* ------------------------------------------------------- zone warning */

.zone-banner {
  position: fixed; left: 0; right: 0; top: 0; z-index: 50;
  padding: calc(.6rem + env(safe-area-inset-top)) .9rem .6rem;
  background: var(--green); color: var(--navy);
  font: 800 13px/1.3 var(--font);
  text-align: center;
}
.zone-banner strong {
  display: block; font: 700 9px/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; margin-bottom: .3rem;
}
.zone-banner.is-out { background: var(--red); color: var(--paper-2); animation: blink 1.2s steps(2, end) infinite; }

#areaMap { height: min(46vh, 360px); border: 3px solid var(--navy); background: var(--paper-3); box-shadow: 4px 4px 0 var(--navy); }

/* One-shot place picker, used when an answer names somewhere else. */
.picker-back { position: fixed; inset: 0; z-index: 70; background: rgba(11,22,49,.78); display: grid; place-items: center; padding: 1rem; }
.picker { width: min(34rem, 100%); background: var(--paper); padding: .9rem; box-shadow: var(--shadow); }
#pickerMap { height: min(52vh, 380px); margin-top: .5rem; border: 3px solid var(--navy); background: var(--paper-3); }

/* A curse the host has taken out of the deck. */
.card-face.is-out { opacity: .45; filter: saturate(.4); }
.corner-tip { background: var(--navy); color: var(--paper); border: 0; font: 700 10px/1 var(--mono); }

/* Stop list: dense, scrollable, one row per stop. */
.stop-list { max-height: 16rem; overflow-y: auto; border: 3px solid var(--navy); background: var(--paper-2); margin-top: .3rem; }
.stop-row { display: flex; gap: .5rem; align-items: center; padding: .35rem .5rem; border-bottom: 2px solid var(--line-soft); font: 600 13px/1.3 var(--font); color: var(--navy); }
.stop-row:last-child { border-bottom: 0; }

/* Legend under the area map. */
.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 .2rem;
          font: 700 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--navy); }
.legend span { display: flex; align-items: center; gap: .4rem; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--navy); display: inline-block; }

/* A stop kept in the list but taken out of play. */
.stop-row.is-off { opacity: .5; }
.stop-row.is-off span { text-decoration: line-through; }
.stop-row .dot { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--navy); flex: none; }
