/* One dark "signal room" column: the canvas is the hero, controls sit below like a
   dispatcher's console. A single dark look by choice: the game is a black screen. */
:root {
  --bg: #050607;
  --panel: #0c0f11;
  --line: #1c2226;
  --line-2: #2a3338;
  --ink: #e9e7e0;
  --muted: #8b9196;
  --faint: #3c454b;
  --bus: #ffb347;
  --metro: #5fd4ff;
  --rail: #c792ff;
  --boat: #4fe0a8;
  --bad: #ff6b5e;
  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--bg); color: var(--ink); margin: 0; }
body { font-family: var(--body); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
a { color: var(--ink); }
.wrap {
  max-width: 980px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 18px 36px;
  display: flex; flex-direction: column; gap: 14px;
}
header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
h1 { font-family: var(--display); font-weight: 900; font-size: clamp(32px, 6vw, 52px); letter-spacing: 0.02em; line-height: 0.95; margin: 0; text-transform: uppercase; }
h1 span { color: var(--muted); font-weight: 700; }
h2 { font-family: var(--display); font-weight: 900; text-transform: uppercase; letter-spacing: 0.03em; margin: 0 0 12px; font-size: 28px; }
.prompt { font-size: 16px; margin: 0; max-width: 60ch; text-wrap: balance; }

.modes { display: flex; gap: 6px; }
.tab { font: 500 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; cursor: pointer; }
.tab.on { color: var(--ink); border-color: var(--line-2); background: var(--panel); }
.tab.icon { min-width: 34px; }

.stage { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #000; }
canvas#c { display: block; width: 100%; aspect-ratio: 16 / 10; touch-action: manipulation; }
@media (max-width: 560px) { canvas#c { aspect-ratio: 4 / 3; } }
.clock { position: absolute; left: 12px; top: 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.05em; pointer-events: none; font-variant-numeric: tabular-nums; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; color: var(--muted); pointer-events: none; transition: opacity 0.4s; }
.loading.gone { opacity: 0; }
.reveal { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; opacity: 0; transition: opacity 1.4s ease; text-align: center; padding: 0 12px; }
.reveal.on { opacity: 1; }
.reveal div { font-family: var(--display); font-weight: 900; font-size: clamp(38px, 11vw, 110px); letter-spacing: 0.08em; line-height: 1; color: rgba(233, 231, 224, 0.94); text-shadow: 0 0 30px #000, 0 0 60px #000; text-transform: uppercase; overflow-wrap: anywhere; }
.reveal p { margin: 8px 0 0; font-family: var(--mono); font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); text-shadow: 0 0 12px #000; }

.layers { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-family: var(--mono); font-size: 12px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--panel); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: 0.35; }
.chip em { font-style: normal; }
.chip.on em { display: none; }
.chip.on { color: var(--ink); border-color: #2c353b; }
.chip.on i { opacity: 1; box-shadow: 0 0 8px currentColor; }
.chip.na { color: var(--faint); text-decoration: line-through; text-decoration-color: var(--faint); }
.chip.na i { opacity: 0.2; }
.chip.na em { text-decoration: none; display: inline; }
.chip[data-k="bus"].on i { background: var(--bus); color: var(--bus); }
.chip[data-k="metro"].on i { background: var(--metro); color: var(--metro); }
.chip[data-k="rail"].on i { background: var(--rail); color: var(--rail); }
.chip[data-k="boat"].on i { background: var(--boat); color: var(--boat); }

.console { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
@media (max-width: 680px) { .console { grid-template-columns: minmax(0, 1fr); } }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
form#f { display: flex; gap: 8px; }
.combo { position: relative; flex: 1; min-width: 0; }
input[type=text] { width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 1px solid var(--line-2); border-radius: 4px; padding: 10px 11px; }
input[type=text]:disabled { opacity: 0.5; }
input[type=text]:focus-visible, button:focus-visible, .suggest li:focus-visible { outline: 2px solid var(--metro); outline-offset: 2px; }
.suggest { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: #0f1316; border: 1px solid var(--line-2); border-radius: 4px; max-height: min(46vh, 300px); overflow-y: auto; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6); }
.suggest li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 10px; border-radius: 3px; cursor: pointer; }
.suggest li small { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest li[aria-selected="true"], .suggest li:hover { background: #1a2126; }
.suggest li.none { color: var(--muted); cursor: default; background: none; }
button { font: 600 14px var(--body); color: #0b0b0b; background: var(--ink); border: 0; border-radius: 4px; padding: 10px 14px; cursor: pointer; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
button.link { align-self: flex-start; background: none; color: var(--muted); padding: 0; font-weight: 500; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: 0.4; cursor: default; }
.msg { min-height: 1.5em; font-size: 13px; color: var(--muted); margin: 0; }
.globe { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.globe canvas { width: 240px; height: 240px; touch-action: none; cursor: grab; }
.globe canvas:active { cursor: grabbing; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
ol.guesses { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 13px; }
ol.guesses li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 4px; background: var(--bg); font-variant-numeric: tabular-nums; }
ol.guesses li span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.guesses li.empty { color: var(--faint); }
.meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; vertical-align: middle; }
.meter i { width: 3px; background: var(--line-2); border-radius: 1px; }
.meter i:nth-child(1) { height: 5px; } .meter i:nth-child(2) { height: 7px; }
.meter i:nth-child(3) { height: 10px; } .meter i:nth-child(4) { height: 13px; }
.meter i.on { background: var(--ink); }
.meter.hit i.on { background: var(--boat); box-shadow: 0 0 6px rgba(79, 224, 168, 0.5); }
ol.guesses .km { color: var(--muted); }
pre.share { margin: 0; font-family: var(--mono); font-size: 13px; white-space: pre-wrap; background: var(--bg); border-radius: 4px; padding: 10px; color: var(--ink); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.attribution { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }
.attribution b { color: var(--ink); font-weight: 500; }
.attribution ul { margin: 4px 0 0; padding-left: 16px; }
.heat canvas { width: 100%; height: auto; display: block; background: var(--bg); border-radius: 4px; margin-top: 6px; }
footer { font-size: 12px; color: var(--muted); max-width: 75ch; }
footer p { margin: 0 0 6px; }
footer b { font-weight: 500; }
.c-bus { color: var(--bus); } .c-metro { color: var(--metro); } .c-rail { color: var(--rail); } .c-boat { color: var(--boat); }

dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); border-radius: 8px; padding: 20px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.7); }
dialog p { margin: 0 0 10px; color: var(--ink); }
dialog form > button { margin-top: 12px; }
.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; text-align: center; }
.statgrid b { display: block; font: 900 30px var(--display); }
.statgrid span { font-size: 11px; color: var(--muted); }
.bars { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-family: var(--mono); font-size: 12px; }
.bars div { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: center; }
.bars i { display: block; height: 16px; background: #26313a; border-radius: 2px; min-width: 18px; font-style: normal; text-align: right; padding-right: 4px; line-height: 16px; }
.bars i.now { background: var(--metro); color: #000; }
