:root {
  --bg: #1a120b;
  --panel: #261c14;
  --panel-2: #32261b;
  --line: #4a3a2e;
  --ink: #e8ddd0;
  --ink-2: #a8947d;
  --accent: #d98a45;
  --accent-2: #f0a860;
  --sky: #4a2c18;
  --storm-wash: rgba(225, 225, 235, .18);
  /* The storm's front coming down the current (drift.mjs), and the specks of the drift behind every view. */
  --front: rgba(14, 10, 16, .78);
  --front-storm: rgba(150, 142, 170, .42);
  --front-edge: rgba(200, 196, 214, .35);
  --drift-far: #c8b4a0;
  --drift-mid: #d9a878;
  --drift-near: #f0d2b0;
  --stage: min(1920px, 96vw);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, Consolas, monospace;
}
/* The nav's theme toggle sets data-theme on <html>. Panels and text follow it; --sky and --storm feed the canvases
   and stay as drawn. */
:root[data-theme="light"] {
  --bg: #f3eadd;
  --panel: #fbf6ee;
  --panel-2: #eadfce;
  --line: #cdbca5;
  --ink: #2a1f15;
  --ink-2: #66533f;
  --accent: #a4551a;
  --accent-2: #8a4210;
  --front: rgba(24, 16, 22, .7);
  --front-storm: rgba(120, 112, 140, .45);
  --front-edge: rgba(240, 232, 244, .4);
  --drift-far: #b9a48e;
  --drift-mid: #e0b080;
  --drift-near: #f6dcbc;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.landing {
  margin: 0; min-height: 100vh; overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; }

.skip-link {
  position: absolute; top: -40px; left: 0;
  background: var(--accent); color: #1a0f00; padding: 8px 16px;
  font-family: var(--mono); font-weight: 800; font-size: .7rem;
  text-transform: uppercase; letter-spacing: .1em; z-index: 100; transition: top .15s;
}
.skip-link:focus { top: 0; text-decoration: none; }

.mast { border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), var(--bg)); }
.mast-in { max-width: var(--stage); margin: 0 auto; padding: .85rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.logo { font-family: var(--font); font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.05; color: var(--ink); font-weight: 800; letter-spacing: -.02em; }
.logo b { color: var(--accent); }
.logo small { display: block; font-family: var(--mono); font-size: .58rem; letter-spacing: .28em; color: var(--ink-2); text-transform: uppercase; font-weight: 500; margin-bottom: .2rem; }

h1 { font-family: var(--font); font-size: clamp(2.2rem, 6vw, 4.2rem); line-height: 1.05; margin: 0 0 1rem;
  font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
h1 .accent { color: var(--accent); }
.subtitle { font-size: clamp(1.05rem, 2.2vw, 1.35rem); color: var(--ink-2); margin: 0 0 1.25rem; }
.hero-actions { display: flex; gap: .85rem; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; font-family: var(--mono); font-size: .7rem; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent); border: 1px solid var(--line); background: var(--panel); padding: .35rem .75rem;
  border-radius: 99px; margin: 0 0 1rem; }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .85rem 1.6rem; border-radius: 8px;
  font-weight: 700; font-size: .95rem; text-decoration: none; transition: .15s; border: 1px solid transparent; }
.btn-primary { background: var(--accent); color: #1a0f00; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-2); color: #1a0f00; text-decoration: none; }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.beat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.25rem; }
.beat h3 { font-size: 1.05rem; margin: 0 0 .4rem; color: var(--accent); }
.beat p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.expect-list a, .panel a { text-decoration: underline; }
footer { border-top: 1px solid var(--line); background: var(--panel); }
footer div { max-width: var(--stage); margin: 0 auto; padding: 1.25rem; display: flex; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; color: var(--ink-2); font-size: .8rem; }
footer a { color: var(--ink-2); }

body.landing::before { content: ""; position: fixed; inset: 0;
  background-image: radial-gradient(rgba(217,138,69,.08) 1px, transparent 1px); background-size: 32px 32px;
  pointer-events: none; opacity: .35; animation: td-field 18s ease-in-out infinite alternate; z-index: -1; }
@keyframes td-field { from { opacity: .25; } to { opacity: .45; } }

@media (prefers-reduced-motion: reduce) {
  body.landing::before { animation: none; }
}
.expect-list {
  max-width: 720px; margin: 0 auto; padding-left: 1.5rem;
  color: var(--ink-2); line-height: 1.6;
}
.expect-list li { margin-bottom: .9rem; }
.expect-list li strong { color: var(--accent); font-weight: 700; }
.expect-list li::marker { color: var(--accent); }


/* /begin: the claim and the game. Canvas colours are tokens the scripts read; the canvases sit
   on a fixed sky, so their tokens do not follow the theme. */
:root {
  --danger: #ff5a4a;
  --good: #7fd18a;
  --grid-line: rgba(0, 0, 0, .25);
  --lit: rgba(240, 168, 96, .22);
  --unlit: rgba(20, 14, 10, .55);
  --lit-edge: #f0a860;
  --unlit-edge: #6a5a4c;
  --dim-alpha: .4;
  --place-ok: rgba(127, 209, 138, .45);
  --place-bad: rgba(255, 90, 74, .45);
  --place-spot: rgba(127, 209, 138, .7);   /* a cell the picked buildable can go on (the server's spots list) */
  --grade-scav: #b8b0a4;
  --grade-freighter: #4fb3ff;
  --grade-navy: #d47bff;
  --side-w: clamp(240px, 20vw, 420px);
}
.play { max-width: 720px; margin: 0 auto; padding: 2rem 1rem 4rem; }
.play h2 { margin: 0 0 .5rem; color: var(--ink); font-size: 1.1rem; }
.play h3 { margin: .6rem 0 .3rem; font-size: .95rem; color: var(--ink); }
.play h3 small, .play h2 small { color: var(--ink-2); font-weight: 400; font-size: .8rem; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1.5rem; margin: 1.5rem 0; }
.panel p { color: var(--ink-2); }
.play label { display: block; font-weight: 700; margin-bottom: .35rem; }
.play input { width: 100%; max-width: 360px; min-height: 44px; padding: .5rem .75rem; font: inherit;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; }
.play input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.hint { font-size: .85rem; margin: .3rem 0; color: var(--ink-2); }
/* The engine kit (tenshin_kit.css) draws Start over's asks, How to play, Settings and the key legend in these. */
:root {
  --tn-bg: var(--bg); --tn-panel: var(--panel); --tn-ink: var(--ink); --tn-muted: var(--ink-2); --tn-edge: var(--line);
  --tn-accent: var(--accent); --tn-on-accent: #1a0f00; --tn-danger: var(--danger); --tn-on-danger: #1a0500;
  --tn-good: var(--good); --tn-font: var(--font); --tn-font-ui: var(--font);
}
:root[data-theme="light"] { --tn-on-accent: #fff; }
.mast-tools { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.mast-tools .tn-btn.icon { border-radius: 99px; color: var(--accent); font-weight: 800; }
/* A phone: ? and Settings sit by the logo, and the house nav takes the row under them. */
@media (max-width: 480px) {
  .mast-tools { display: contents; }
  .mast .logo { margin-right: auto; }
  .mast #tn-nav-host { flex: 1 0 100%; }
}
.tn-settings-row .tn-btn { white-space: nowrap; }
.dt-window { width: min(34rem, calc(100vw - 16px)); max-height: 86vh; }
.dt-window .tn-window-bar h2 { margin: 0; font-size: 1.05rem; color: var(--accent); }
.dt-window h3 { margin: 1rem 0 .4rem; font-size: .95rem; color: var(--ink); }
.dt-window p { color: var(--ink-2); margin: 0 0 .6rem; }
.error { color: var(--accent-2); font-weight: 700; margin: .35rem 0 1rem; }
.error:empty { display: none; }
.btn { cursor: pointer; font: inherit; font-weight: 700; }
.btn-small { padding: .3rem .7rem; font-size: .8rem; min-height: 32px; }
.btn-danger { background: var(--danger); color: #1a0500; border-color: var(--danger); animation: td-pulse .5s ease-in-out infinite alternate; }
@keyframes td-pulse { from { transform: scale(1); } to { transform: scale(1.06); } }
@media (prefers-reduced-motion: reduce) { .btn-danger { animation: none; } }
.btn:disabled { opacity: .55; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .4rem 0; }
.panel p.good, li.good, span.good, p.good { color: var(--good); }
.panel p.warn, li.warn, span.warn, p.warn { color: var(--accent-2); font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fitted { display: block; width: var(--cw); height: var(--ch); image-rendering: pixelated; }
.canvas-box { min-width: 0; position: relative; --canvas-edge: 1px; --canvas-round: 6px; }
/* The Pixi stage over each canvas (scene.mjs, 0.3): inside the canvas's border, on its drawing box, see-through to the
   pointer, so a click lands on the canvas where the picture shows it. */
.canvas-box > .scene { position: absolute; left: var(--canvas-edge); top: var(--canvas-edge);
  width: calc(var(--cw) - 2 * var(--canvas-edge)); height: calc(var(--ch) - 2 * var(--canvas-edge));
  pointer-events: none; overflow: hidden; border-radius: calc(var(--canvas-round) - var(--canvas-edge)); }
.canvas-box > [hidden] + .scene { display: none; }   /* a hidden canvas takes its stage with it (the derelict view) */
.canvas-box > .scene canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
.map, .islet, .wreck-canvas { border: var(--canvas-edge) solid var(--line); border-radius: var(--canvas-round); cursor: pointer; touch-action: manipulation; }

.screen .play { flex: 1; min-height: 0; width: 100%; max-width: none; display: flex; flex-direction: column; padding: .4rem .8rem; }
.screen #claim-panel { margin: auto; width: 100%; max-width: 560px; }

/* 0.5, the ship screen: one stage fills everything under the site header, the ship in its middle, and the panels float
   over it in the dock layer, which shares the stage's grid cell. Gaps in the dock layer let clicks through to the
   stage, where a click on a piece throws a hook. */
:root {
  --deck: #3a4550;
  --deck-edge: #8a98a4;
  --deck-face: #1d242b;
  --module-top: #2c333a;
  --module-face: #15191d;
  /* 0.5 slice B: Space view's roof plating (lighter than the deck, so the silhouette reads on the night sky), the
     nacelles, hook arms and bridge drawn on it, and each bay kind's floor tint and outline in Ship view. */
  --hull-roof: #5d6b77;
  --hull-roof-seam: rgba(0, 0, 0, .28);
  --nacelle: #48535d;
  --nacelle-mouth: #101418;
  --bridge: #7f8f9c;
  --bridge-glass: #9fe3ff;
  --bay-cargo: #c9a24a;
  --bay-cargo-floor: rgba(201, 162, 74, .2);
  --bay-engine: #d9663a;
  --bay-engine-floor: rgba(217, 102, 58, .2);
  --rope: #e8ddd0;
  --reach: rgba(232, 221, 208, .22);
  --catch: #fff6e0;             /* the snap where a hook bites a piece (#364) */
  --gold: #f2c14e;              /* the walkthrough's ring and the picked thing, never decoration */
  /* Each piece of debris its own colour, by what it is: rust scrap, steel plate, pink-sheathed cable, green fuel cell,
     a painted crate. None is gold (the ring) or red (a waiting rope). */
  --piece-scrap: #c8743a;
  --piece-plate: #9dbbd6;
  --piece-cable: #e0609a;
  --piece-cell: #5fd49a;
  --piece-crate: #b98ae0;
  --piece-edge: rgba(0, 0, 0, .55);
  /* The helm: fuel in the tank (green, the fuel cell's colour), the current's arrows (water), the own ship's mark (white: not an action, not the flame) on the
     Route, and a firing Thruster's flame and its hot core. */
  --fuel: #5fd49a;
  --current: #5fb8d6;
  --ship-mark: #f4f0e8;
  --flame: #ff7a2e;
  --flame-core: #ffe0a0;
  /* 0.5 slice 4: a derelict is drawn with its kind's 0.4 wreck art; one with none, and the Route's diamonds, are
     dead rust-grey plating with darker seams and a lighter rim. The skiff's reach is sea-green, solid, never the Hook
     reach's faint dashes; a derelict inside it is ringed in that colour, and rimmed in it on the Route. */
  --derelict: #6e5b4e;
  --derelict-seam: rgba(0, 0, 0, .3);
  --derelict-edge: #b49580;
  --skiff-reach: #6fd3b8;
  /* 0.5 slice 4, the derelict view (wreck.mjs, restored from 0.4; its sky is the ship stage's): a plain cut point's dark
     face, the hull outline and seams, a scrap part's and a whole part's backing, a pinned part's cross, the cut glow (a
     cut's filling ring), a loose part's green rim (never gold: gold is selection), another salvager's rim, the Take /
     Melt part's dashes, a point's pale ring and a cut gash, and the guard machine. */
  --point-face: #2a1d14;
  --hull: #2f3438;
  --hull-edge: #7d8790;
  --hull-seam: rgba(255, 255, 255, .07);
  --part-scrap: #3d2f25;
  --part-whole: #4a3a52;
  --pin: rgba(10, 6, 4, .8);
  --cut-glow: #ffd27a;
  --other: #4fb3ff;
  --pick: #ffffff;
  --map-ink: #f0e4d4;
  --map-dim: #b49b80;
  --guard: #8f9aa3;
  --loose: #8ee08a;
  /* The panels over the stage: graphite, the sky showing at their edges; text sits on 92% panel. */
  --graphite: #23272c;
  --graphite-line: #3c434b;
  --panel-over: color-mix(in srgb, var(--graphite) 92%, transparent);
  --side-w: clamp(250px, 20vw, 360px);
  --helm-w: clamp(250px, 19vw, 340px);
  --store-w: clamp(280px, 30vw, 560px);
  --feed-h: 9rem;
  --tab-h: 3rem;
  --dock-gap: .5rem;
}
.screen .play:has(> .game:not([hidden])) { padding: 0; }
.screen .game:not([hidden]) { flex: 1; min-height: 0; position: relative; overflow: hidden; display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto; grid-template-columns: minmax(0, 1fr); }
.stage-box, .docks { grid-area: 1 / 1; }
.stage-box { --canvas-edge: 0px; --canvas-round: 0px; overflow: hidden; }
.stage { touch-action: manipulation; }
.stage.over-piece { cursor: pointer; }
.stage.wreck-canvas { cursor: default; }
.stage.wreck-canvas.over-piece { cursor: pointer; }

.docks { position: relative; z-index: 1; min-height: 0; pointer-events: none; }
.docks > * { pointer-events: auto; }
/* A refusal or a lost connection: between the left and right docks, at the top, over any window (#429: a window
   can float there now; the line is short and goes). */
.refused, .docks > .status { position: absolute; z-index: 4; top: var(--dock-gap); left: calc(var(--side-w) + 2 * var(--dock-gap));
  right: calc(var(--helm-w) + 2 * var(--dock-gap)); width: fit-content; margin: 0 auto; padding: .3rem .7rem;
  background: var(--panel-over); border: 1px solid var(--graphite-line); border-radius: 8px; text-align: center; }
.refused { color: var(--danger); font-weight: 700; border-color: var(--danger); }
.status { color: var(--ink-2); margin: 0; }
.refused:empty, .docks > .status:empty { display: none; }

/* Floating panels, to the hub's contract (tenshin_panels.css replaces these when it lands; drift-motion 5524f78): a
   title bar that folds the panel, a badge that stays on the folded bar, a body that scrolls inside the panel, never
   the page. */
.tn-panel { position: absolute; display: flex; flex-direction: column; min-height: 0; width: var(--side-w);
  max-height: calc(100% - 2 * var(--dock-gap)); background: var(--panel-over); color: var(--ink);
  border: 1px solid var(--graphite-line); border-radius: 10px; }
.tn-panel[data-dock="l"] { top: var(--dock-gap); left: var(--dock-gap); max-height: calc(55% - 1.5 * var(--dock-gap)); }
.tn-panel[data-dock="bl"] { bottom: var(--dock-gap); left: var(--dock-gap); max-height: var(--feed-h); }
.tn-panel[data-dock="r"] { top: var(--dock-gap); right: var(--dock-gap); width: var(--helm-w);
  max-height: calc(55% - 1.5 * var(--dock-gap)); }
/* /live's Route top centre, between the side columns (live.mjs frames the hull below all of it). */
.docks { --centre-w: calc(100% - var(--side-w) - var(--helm-w) - 4 * var(--dock-gap)); }
.tn-panel[data-dock="t"] { top: var(--dock-gap); left: 0; right: 0; margin: 0 auto; max-height: 35%;
  width: min(var(--store-w), var(--centre-w)); }

/* #429, the play page: the stage fills the window and the action bar sits under it, a button per window. A window
   opens where its rule below puts it, over the stage, and the engine's dragwin moves it from there by `translate` and
   remembers the place (windows.mjs). Every window docks in a side column, clear of the ship in the middle. */
/* The line over the bar that never shuts (#429): the Helm's where, way and fuel on the left, Wren's latest line on the
   right; a press opens its window. */
.hud { grid-row: 2; display: flex; justify-content: space-between; gap: .75rem; min-width: 0; padding: .15rem var(--dock-gap);
  background: var(--graphite); border-top: 1px solid var(--graphite-line); }
.hud-line { min-width: 0; min-height: 28px; padding: 0 .3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: inherit; font-size: .82rem; color: var(--ink); background: transparent; border: 0; border-radius: 4px; cursor: pointer;
  font-variant-numeric: tabular-nums; }
.hud-helm { flex: 0 1 auto; font-weight: 700; }
.hud-radio { flex: 0 1 auto; color: var(--accent-2); font-family: var(--mono); font-size: .78rem; }
.hud-line:hover { background: var(--panel-over); }
.hud-line:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.actbar { grid-row: 3; display: flex; justify-content: center; gap: .3rem; padding: .3rem var(--dock-gap);
  background: var(--graphite); border-top: 1px solid var(--graphite-line); }
.act { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  min-width: 4.4rem; min-height: 44px; padding: .2rem .45rem; font: inherit; font-size: .75rem; font-weight: 700;
  color: var(--ink-2); background: transparent; border: 1px solid var(--graphite-line); border-radius: 6px; cursor: pointer; }
.act:hover { color: var(--ink); border-color: var(--deck-edge); }
.act:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.act[aria-pressed="true"] { color: var(--ink); border-color: var(--accent); background: var(--panel-over); }
.act-badge { position: absolute; top: -4px; right: -4px; min-width: 1.4em; padding: 1px 4px; border-radius: .8em;
  background: var(--accent); color: #1a0f00; font-size: .68rem; font-weight: 800; line-height: 1.25; text-align: center;
  pointer-events: none; }
/* A phone's More button and its menu (windows.mjs fitBar): the buttons that did not fit the bar's one row. */
.act-more[hidden], .act.act-over { display: none; }
.act-dots { width: 28px; height: 28px; background: radial-gradient(circle, currentColor 2.5px, transparent 3px) 0 50% / 33.3% 100% repeat-x; }
.act-more.has-badge::after { content: ""; position: absolute; top: 3px; right: 3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); }
.act-more.act-on { color: var(--ink); border-color: var(--accent); background: var(--panel-over); }
.actmore { position: fixed; z-index: 30; right: var(--dock-gap); bottom: calc(44px + 1.2rem); display: grid; gap: .25rem;
  min-width: 11rem; padding: .35rem; background: var(--graphite); border: 1px solid var(--graphite-line); border-radius: 8px; }
.actmore[hidden] { display: none; }
.actmore-item { position: relative; display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .2rem .6rem;
  font: inherit; font-size: .85rem; font-weight: 700; color: var(--ink-2); background: transparent; text-align: left;
  border: 1px solid var(--graphite-line); border-radius: 6px; cursor: pointer; }
.actmore-item[aria-pressed="true"] { color: var(--ink); border-color: var(--accent); }
.actmore-item .act-ico { width: 24px; height: 24px; }
.actmore-item .act-badge { position: static; margin-left: auto; }
.act-ico { width: 28px; height: 28px; object-fit: contain; image-rendering: pixelated; pointer-events: none; }
/* the number key in the button's top left corner; a touch screen has no keys, so no chip there */
.act[data-num]::before { content: attr(data-num); position: absolute; top: 1px; left: 4px; font-size: .65rem;
  color: var(--ink-2); pointer-events: none; }
@media (hover: none) { .act[data-num]::before { display: none; } }

.win { z-index: 2; }
.win.win-top { z-index: 3; }
.win-bar { cursor: grab; }
body.dw-grabbing, body.dw-grabbing .win-bar { cursor: grabbing; }
.dw-ease { transition: translate var(--dw-ease, 140ms) ease-out; }
.win-bar h2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.win-x { flex: none; margin-left: auto; min-width: 32px; min-height: 32px; padding: 0; font: inherit; font-size: .8rem;
  color: var(--ink-2); background: transparent; border: 1px solid transparent; border-radius: 6px; cursor: pointer; }
.tn-panel-badge:not(:empty) + .win-x { margin-left: .2rem; }
.win-x:hover { color: var(--ink); border-color: var(--graphite-line); }
.win-x:focus-visible, .win-bar:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
/* Default places, docked in the room either side of the ship's frame (--room-l and --room-r, play.mjs dockBeside): no
   wider than that room, so a window that has not been moved never covers the hull or its reach. Left: the Radio at
   the top, the Route and the Feed at the foot, the Legend between. Right: the Helm at the top with the Market a title
   bar under it, the Store, the Skiff and the Deck at the foot (the Deck a title bar up and in, so both bars show). */
.docks { --tuck: 2.6rem; --win-min: 220px;
  --wide-l: max(var(--win-min), calc(var(--room-l, 100vw) - 2 * var(--dock-gap)));
  --wide-r: max(var(--win-min), calc(var(--room-r, 100vw) - 2 * var(--dock-gap))); }
.win[data-win="radio"], .win[data-win="legend"], .win[data-win="feed"], .win[data-win="route"] { left: var(--dock-gap); }
.win[data-win="helm"], .win[data-win="market"], .win[data-win="store"], .win[data-win="skiff"] { right: var(--dock-gap); }
.win[data-win="radio"] { top: var(--dock-gap); width: min(var(--side-w), var(--wide-l)); max-height: calc(55% - 1.5 * var(--dock-gap)); }
.win[data-win="legend"] { top: 25%; width: min(var(--side-w), var(--wide-l)); max-height: 50%; }
.win[data-win="feed"] { bottom: var(--dock-gap); width: min(var(--side-w), var(--wide-l)); max-height: var(--feed-h); }
/* tall enough for the map and its Cast off buttons, which the walkthrough rings first, under the Radio's lines */
.win[data-win="route"] { bottom: var(--dock-gap); width: min(var(--store-w), var(--wide-l)); max-height: 55%; }
.win[data-win="helm"] { top: var(--dock-gap); width: min(var(--helm-w), var(--wide-r)); max-height: calc(55% - 1.5 * var(--dock-gap)); }
.win[data-win="market"] { top: calc(var(--dock-gap) + var(--tuck)); width: min(24rem, var(--wide-r)); max-height: calc(60% - var(--tuck) - 1.5 * var(--dock-gap)); }
.win[data-win="store"] { bottom: var(--dock-gap); width: min(24rem, var(--wide-r)); max-height: calc(40% - 1.5 * var(--dock-gap)); }
.win[data-win="skiff"] { bottom: var(--dock-gap); width: min(var(--helm-w), var(--wide-r)); max-height: calc(45% - 1.5 * var(--dock-gap)); }
.win[data-win="deck"] { bottom: calc(var(--dock-gap) + var(--tuck)); right: calc(var(--dock-gap) + var(--tuck));
  width: min(var(--helm-w), calc(var(--wide-r) - var(--tuck))); max-height: calc(45% - 1.5 * var(--dock-gap)); }
/* the Tech window: wide enough for five branch columns, in the middle over the ship (it is read, then shut) */
.win[data-win="tech"] { top: var(--dock-gap); left: 0; right: 0; margin: 0 auto; width: min(54rem, calc(100% - 2 * var(--dock-gap)));
  max-height: calc(100% - 2 * var(--dock-gap)); }
.tn-panel-head { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; padding: .2rem .6rem .2rem .25rem; }
/* A panel moved by its title bar (panels.mjs) sits where it was left; the phone strip below overrides it. */
.tn-panel[data-moved] { left: var(--x); top: var(--y); right: auto; bottom: auto; margin: 0; }
.tn-panel-head { cursor: grab; user-select: none; touch-action: none; }
.tn-panel:not([data-collapsed]) > .tn-panel-head { border-bottom: 1px solid var(--graphite-line); }
.tn-panel .tn-panel-head h2 { margin: 0; font-size: .92rem; flex-shrink: 0; }
.tn-panel-fold { display: inline-flex; align-items: center; gap: .45rem; min-height: 32px; padding: .2rem .45rem;
  font: inherit; font-weight: 700; color: var(--ink); background: transparent; border: 0; border-radius: 6px; cursor: pointer; }
.tn-panel-fold::before { content: ""; width: 10px; height: 6px; background: var(--ink-2);
  clip-path: polygon(0 0, 100% 0, 50% 100%); transition: transform .15s; }
.tn-panel[data-collapsed] .tn-panel-fold::before { transform: rotate(-90deg); }
.tn-panel-fold:hover { color: var(--accent-2); }
.tn-panel-fold:focus-visible, .tn-panel-tab:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.tn-panel-badge { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .8rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tn-panel-badge:empty { display: none; }
/* A body that scrolls shows it: a thin graphite bar with a lighter thumb (not the system's auto-hiding overlay). */
.tn-panel-body { min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--deck-edge) var(--graphite);
  padding: .5rem .75rem .65rem; }
.tn-panel[data-collapsed] > .tn-panel-body { display: none; }
.tn-panel p { color: var(--ink-2); }
.tn-panel-tabs { display: none; }
@media (prefers-reduced-motion: reduce) { .tn-panel-fold::before { transition: none; } }

.radio-line { color: var(--accent-2); font-family: var(--mono); font-size: .9rem; margin: 0 0 .4rem; }
.tn-panel .radio-text { color: var(--ink); margin: 0 0 .4rem; }
.radio-face { float: left; width: 64px; height: 64px; margin: 0 .6rem .3rem 0; image-rendering: pixelated; border-radius: 4px; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; font-size: .82rem; color: var(--ink-2); }
.feed li.fresh { color: var(--ink); font-weight: 700; }
/* The Quests window (quests.mjs): open quests as cards, done ones as plain lines under a small head. */
.quests-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: .84rem; }
.quest { display: grid; gap: .15rem; }
.quest.open { padding: .4rem .5rem; border: 1px solid var(--tn-edge); border-radius: 6px; }
.quest-title { color: var(--ink); }
.quest-from, .quest-foot { color: var(--ink-2); font-size: .78rem; }
.quest-line { margin: 0; font-style: italic; color: var(--ink-2); }
.quest-text { margin: 0; color: var(--ink); }
.quest.head { margin-top: .3rem; color: var(--ink-2); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
.quest.done .quest-title { font-weight: 400; color: var(--ink-2); }
.quest.done .quest-title::before { content: "¹3  "; color: var(--tn-good); }

.tn-panel .helm-where { color: var(--ink); font-weight: 700; margin: 0 0 .35rem; }
/* How far along the leg: a <progress>, so the page sets its value and never an inline style. */
.helm-bar { display: block; appearance: none; width: 100%; height: 6px; margin: 0 0 .4rem; border: 0; border-radius: 3px;
  background: var(--deck-face); }
.helm-bar::-webkit-progress-bar { background: var(--deck-face); border-radius: 3px; }
.helm-bar::-webkit-progress-value { background: var(--deck-edge); border-radius: 3px; }
.helm-bar::-moz-progress-bar { background: var(--deck-edge); border-radius: 3px; }
.tn-panel .helm-eta { color: var(--ink); margin: 0 0 .3rem; }
.helm-eta:empty { display: none; }
/* The throttle: four modes in a 2 x 2 grid, each with its fuel a minute; the one set is gold (a selection). */
.throttles { display: grid; grid-template-columns: 1fr 1fr; gap: .3rem; margin: .4rem 0 .2rem; }
.throttle { display: flex; flex-direction: column; align-items: flex-start; min-height: 40px; padding: .25rem .5rem;
  font: inherit; color: var(--ink); text-align: left; background: transparent; border: 1px solid var(--graphite-line);
  border-radius: 6px; cursor: pointer; }
.throttle:hover { border-color: var(--deck-edge); }
.throttle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.throttle.picked { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.throttle-name { font-weight: 700; font-size: .88rem; }
.throttle-burn { color: var(--ink-2); font-size: .75rem; font-variant-numeric: tabular-nums; }
.tn-panel .helm-tank { margin-top: .4rem; }
.helm-tank::-webkit-progress-value { background: var(--fuel); }
.helm-tank::-moz-progress-bar { background: var(--fuel); }
/* The Route: stations, legs, the current's arrows and the ship, drawn in the panel's own colours. */
.route-map { display: block; width: 100%; height: auto; margin: 0 0 .2rem; }
.route-leg { stroke: var(--deck-edge); stroke-width: 2; }
.route-arrow { fill: var(--current); }
.route-km { fill: var(--ink-2); font-size: 11px; font-variant-numeric: tabular-nums; dominant-baseline: central; }
.route-station { fill: var(--deck); stroke: var(--deck-edge); stroke-width: 2; }
.route-name { fill: var(--ink); font-size: 12px; font-weight: 700; }
.route-here { fill: none; stroke: var(--ship-mark); stroke-width: 2.5; }
.route-ship { fill: var(--ship-mark); stroke: var(--graphite); stroke-width: 1.5; }
.route-derelict { fill: var(--derelict); stroke: var(--derelict-edge); stroke-width: 1.5; }
.route-derelict.near { stroke: var(--skiff-reach); }
/* The Skiff: where it is, a row per derelict near enough to list (name, distance, and in reach its Launch button). */
.tn-panel .skiff-where { color: var(--ink); font-weight: 700; margin: 0 0 .3rem; }
.tn-panel .skiff-line { margin: 0 0 .2rem; font-size: .85rem; font-variant-numeric: tabular-nums; }
.skiff-list { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .3rem; }
.skiff-row { padding: .25rem 0; border-top: 1px solid var(--graphite-line); font-size: .85rem; color: var(--ink); }
.skiff-row b { display: block; }
.skiff-row span { display: block; color: var(--ink-2); font-size: .78rem; font-variant-numeric: tabular-nums; }
.skiff-row:first-child { border-top: 0; padding-top: 0; }
.skiff-row.far { opacity: .6; }
.skiff-line:empty, .skiff-where:empty, .skiff-list:empty, .skiff-further:empty, #skiff-about:empty,
  .route-derelicts:empty { display: none; }
.tn-panel .skiff-further { margin: .35rem 0 0; font-size: .78rem; }
.tn-panel .route-derelicts { margin-top: -.2rem; }
.skiff-row .btn { margin-top: .25rem; }
/* An item's picture on a Market or Store tile: its sprite on a dark well, the count in a corner badge. */
.item-pic { position: relative; display: grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 6px; background: color-mix(in srgb, var(--graphite) 70%, transparent); border: 1px solid var(--graphite-line); }
.item-pic img { width: 32px; height: 32px; image-rendering: pixelated; }
.item-pic-letter { font-weight: 700; color: var(--ink-2); }
.item-n { position: absolute; right: -4px; bottom: -4px; min-width: 1.2rem; padding: 0 .25rem; border-radius: 999px;
  background: var(--accent); color: var(--tn-on-accent, #1a0f00); font-size: .7rem; font-weight: 700; line-height: 1.2rem;
  text-align: center; font-variant-numeric: tabular-nums; }
/* The Market: a heading per side, a tile per thing (picture, name, price each, its buttons), as many across as fit. */
.tn-panel .market-head { margin: 0 0 .3rem; font-size: .8rem; color: var(--ink-2); font-weight: 700; }
.market-side + .market-side { margin-top: .6rem; }
.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.8rem, 1fr)); gap: .35rem; }
.market-tile { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto; column-gap: .45rem;
  align-items: center; padding: .35rem; border: 1px solid var(--graphite-line); border-radius: 8px;
  background: color-mix(in srgb, var(--panel-2, #222) 60%, transparent); }
.market-tile .item-pic { grid-row: 1 / 3; }
.tn-panel .market-item { margin: 0; color: var(--ink); font-size: .85rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.market-price { color: var(--ink-2); font-size: .72rem; font-variant-numeric: tabular-nums; }
.market-btns { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .35rem; }
.market-btns .btn { flex: 1 1 auto; padding-inline: .4rem; }
/* The Store: a tile per item, the same picture, with its Install, Fit, Refit and Scrap buttons stacked under it. */
.store-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(6.8rem, 1fr));
  gap: .35rem; }
.store-list li.store-tile { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .35rem .25rem;
  border: 1px solid var(--graphite-line); border-radius: 8px; font-size: .75rem; color: var(--ink); text-align: center; }
.store-list li.hint { grid-column: 1 / -1; border: 0; padding: 0; color: var(--ink-2); }
.store-list li.store-row .btn { width: 100%; padding-inline: .3rem; }
.store-name { line-height: 1.15; font-size: .8rem; }
/* The Deck: a row per buildable, its picture, name and cost; a row the Store cannot pay for is greyed. */
.deck-list, .legend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.deck-row { display: grid; grid-template-columns: auto max-content minmax(0, 1fr); align-items: center; gap: .5rem; width: 100%;
  min-height: 40px; padding: .3rem .55rem; font: inherit; font-size: .88rem; font-weight: 700; color: var(--ink);
  text-align: left; background: transparent; border: 1px solid var(--graphite-line); border-radius: 6px; cursor: pointer; }
.deck-row:hover:not(:disabled) { border-color: var(--deck-edge); }
.deck-row:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.deck-row:disabled { opacity: .55; cursor: default; }
.deck-row.picked { outline: 2px solid var(--gold); outline-offset: -2px; }   /* the picked buildable: a selection */
/* The Tech window: a column per branch, a card per node; known is solid, ready has its Learn button, locked and
   later are dimmed. */
.tech-tree { display: grid; grid-template-columns: repeat(5, minmax(9.5rem, 1fr)); gap: .5rem; overflow-x: auto; }
.tech-branch { display: grid; align-content: start; gap: .35rem; }
.tech-branch-name { margin: 0; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2, var(--ink)); }
.tech-node { padding: .4rem .5rem; border: 1px solid var(--graphite-line); border-radius: 6px; font-size: .82rem; }
.tech-name { margin: 0 0 .2rem; font-size: .88rem; }
.tech-about { color: var(--ink); }
.tech-node p { margin: .15rem 0; }
.tech-known { border-color: var(--deck-edge); background: color-mix(in srgb, var(--deck-edge) 16%, transparent); }
.tech-locked, .tech-soon { opacity: .62; }
.tech-state, .tech-why, .tech-needs { font-size: .76rem; }
.tech-learn { width: 100%; margin-top: .25rem; white-space: normal; }
.tech-controls { display: grid; gap: .2rem; margin-top: .3rem; padding-top: .3rem; border-top: 1px solid var(--graphite-line); }
.tech-row { display: flex; align-items: center; gap: .35rem; font-size: .78rem; }
.tech-row > span { flex: 1; }
.tech-up { padding: .05rem .4rem; }
.tech-level { width: 3.6rem; }
.route-queue { align-items: center; flex-wrap: wrap; gap: .3rem; }
.route-queue-label { font-size: .8rem; flex-basis: 100%; }
.works-note { margin: 0; font-size: .8rem; flex-basis: 100%; }
.works-stalled { color: var(--danger); }
@media (max-width: 768px) { .tech-tree { grid-template-columns: 1fr; } }
/* The Radar: a round scope, a sweep line turning, each dot lighting as it passes and fading after. */
/* in the right-hand room, under the Helm's top and tucked in a title bar like the Deck, so both bars show */
.win[data-win="radar"] { top: 30%; right: calc(var(--dock-gap) + var(--tuck));
  width: min(var(--helm-w), calc(var(--wide-r) - var(--tuck))); max-height: 60%; }
.radar-scope { width: min(100%, 15rem); margin: 0 auto; aspect-ratio: 1; }
.radar-svg { display: block; width: 100%; height: 100%; }
.radar-rim { fill: color-mix(in srgb, var(--deck-edge) 10%, transparent); stroke: var(--deck-edge); }
.radar-ring, .radar-axis { fill: none; stroke: var(--graphite-line); stroke-dasharray: 2 3; }
.radar-beam { stroke: var(--accent-2); stroke-width: 2; }
.radar-sweep { transform-origin: 50% 50%; transform-box: view-box; animation: radar-turn var(--sweep) linear infinite; }
.radar-dot { opacity: .35; animation: radar-lit var(--sweep) linear infinite; animation-delay: calc(var(--at) * var(--sweep)); }
.radar-scrap { fill: var(--piece-scrap); }
.radar-plate { fill: var(--piece-plate); }
.radar-cable { fill: var(--piece-cable); }
.radar-cell { fill: var(--piece-cell); }
.radar-crate { fill: var(--piece-crate); }
.radar-derelict { fill: var(--gold); }
.radar-station { fill: var(--ink); }
.radar-ship { fill: var(--ink); }
.radar-scope.still .radar-sweep { display: none; }
.radar-scope.still .radar-dot { animation: none; opacity: 1; }
@keyframes radar-turn { to { transform: rotate(1turn); } }
@keyframes radar-lit { 0% { opacity: 1; } 60% { opacity: .35; } 100% { opacity: .35; } }
.radar-list { list-style: none; margin: .3rem 0 0; padding: 0; display: grid; gap: .15rem; font-size: .82rem; }
.radar-row { color: var(--ink); }
.radar-list .radar-derelict { font-weight: 700; }
/* The name shows whole; a long cost wraps under itself at the right. */
.deck-cost { color: var(--ink-2); font-size: .8rem; font-weight: 400; font-variant-numeric: tabular-nums; text-align: right; }
.deck-name { white-space: nowrap; }
.swatch { display: block; width: 1.5rem; height: 1.5rem; image-rendering: pixelated; }
/* The Legend: each kind of thing on the stage now, in two columns where the panel is wide enough. */
.legend-list { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: .3rem .6rem; }
.legend-row { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .45rem; align-items: center;
  font-size: .85rem; color: var(--ink); line-height: 1.25; }
.legend-row .swatch { grid-row: span 2; }
.legend-name { font-weight: 700; }
.legend-gives { grid-column: 2; color: var(--ink-2); font-size: .75rem; }
.stage.building { cursor: crosshair; }
/* Placing: what is picked and how to stop, under the refusal line. Lift and Repair by a chosen tile or module. The
   label by the pointer: a small graphite panel naming what is under it. */
.placing { position: absolute; z-index: 4; top: calc(2 * var(--dock-gap) + 2.2rem); left: calc(var(--side-w) + 2 * var(--dock-gap));
  right: calc(var(--helm-w) + 2 * var(--dock-gap)); width: fit-content; margin: 0 auto; padding: .25rem .3rem .25rem .7rem;
  display: flex; align-items: center; gap: .6rem; font-size: .88rem; color: var(--ink); background: var(--panel-over);
  border: 1px solid var(--graphite-line); border-radius: 8px; }
.part-actions { position: absolute; z-index: 4; left: var(--x); top: var(--y); display: flex; flex-wrap: wrap; gap: .3rem;
  max-width: calc(100% - 2 * var(--dock-gap)); }
.part-actions .btn-secondary { background: var(--panel-over); }
/* The derelict view's Take / Melt choice, by the loose part it is for; a greyed button's reason under the buttons. */
.wreck-choice { position: absolute; z-index: 4; left: var(--x); top: var(--y); max-width: 16rem; padding: .35rem .6rem;
  font-size: .85rem; color: var(--ink); background: var(--panel-over); border: 1px solid var(--graphite-line); border-radius: 8px; }
.wreck-choice .row { margin: .3rem 0 0; }
.wreck-why { margin: .3rem 0 0; color: var(--danger); }
.wreck-stop { position: absolute; z-index: 4; left: var(--x); top: var(--y); background: var(--panel-over); }
.tn-panel .skiff-guard { color: var(--ink-2); }
.tn-panel .skiff-guard.warn { color: var(--danger); }
.stage-label { position: absolute; z-index: 4; left: var(--x); top: var(--y); margin: 0; max-width: 16rem; padding: .3rem .6rem;
  display: flex; flex-direction: column; font-size: .85rem; line-height: 1.3; color: var(--ink);
  background: var(--panel-over); border: 1px solid var(--graphite-line); border-radius: 8px; }
.docks > .stage-label { pointer-events: none; }
.stage-label span { color: var(--ink-2); font-size: .8rem; white-space: pre-line; }
.stage-label span:empty { display: none; }
.stage-label.bad span { color: var(--danger); }

/* The walkthrough's ring: the one button or line the radio is talking about (gold, as a selection is). */
.target { outline: 3px solid var(--gold); outline-offset: 2px; }
.tn-panel-body .target, .act.target { outline-offset: -3px; }   /* inside a panel the body would clip it */

/* Phones: the panels become a tab strip along the bottom of the stage, one open at a time, as a sheet above it. Taps
   are 44 px. */
@media (max-width: 767px) {
  .docks { --dock-gap: .35rem; }
  .tn-panel[data-dock] { left: var(--dock-gap); right: var(--dock-gap); top: auto; bottom: calc(var(--tab-h) + var(--dock-gap));
    width: auto; margin: 0; max-height: calc(60% - var(--tab-h)); }
  .tn-panel[data-collapsed] { display: none; }
  .tn-panel-fold { min-height: 44px; }
  .tn-panel-head { cursor: auto; touch-action: auto; }
  .tn-panel-tabs { display: flex; position: absolute; left: 0; right: 0; bottom: 0; height: var(--tab-h);
    background: var(--panel-over); border-top: 1px solid var(--graphite-line); }
  .tn-panel-tab { flex: 1; min-width: 0; min-height: 44px; display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: .15rem .1rem; font: inherit; font-size: .82rem; font-weight: 700; color: var(--ink-2);
    background: transparent; border: 0; border-top: 2px solid transparent; cursor: pointer; }
  .tn-panel-tab[aria-expanded="true"] { color: var(--ink); border-top-color: var(--accent); }
  .tn-panel-tab .tn-panel-badge { margin: 0; max-width: 100%; font-size: .68rem; }
  /* nine tabs docked at the start (the Skiff's added in slice 4): a name too long for its tab ends in an ellipsis */
  .tn-panel-tab > span:first-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tn-panel-tab.target { outline-offset: -3px; }
  /* the play page's windows are sheets over the stage's foot, one at a time. The bar stays one row: its buttons keep
     their names only as their tips and accessible names, drop the number chips, and shrink to fit; where a touch
     screen's 44 px taps do not fit, the row scrolls sideways a button at a time. */
  .docks .win[data-win] { left: var(--dock-gap); right: var(--dock-gap); top: auto; bottom: var(--dock-gap); width: auto; margin: 0;
    max-height: 60%; translate: none !important; }
  .win-bar { cursor: auto; touch-action: auto; }
  .win-x { min-width: 44px; min-height: 44px; }
  .actbar { justify-content: flex-start; gap: .15rem; padding: .3rem .2rem; overflow-x: auto; scroll-snap-type: x mandatory;
    scrollbar-width: none; }
  .hud { flex-direction: column; gap: 0; }
  .hud-line { min-height: 24px; text-align: left; }
  .act { flex: 1 0 36px; min-width: 36px; padding: 2px; scroll-snap-align: start; }
  .act[data-num]::before { display: none; }
  @media (pointer: coarse) { .act { flex-basis: 44px; min-width: 44px; } }
  .act-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .refused, .docks > .status, .placing { left: var(--dock-gap); right: var(--dock-gap); }
  .refused, .docks > .status { top: var(--dock-gap); }
  .placing { top: calc(2 * var(--dock-gap) + 2.2rem); }
  .throttle { min-height: 44px; }
  .deck-row, .part-actions .btn, .docks > .wreck-stop, .placing .btn, .wreck-choice .btn { min-height: 44px; }
  .tn-panel .btn { min-height: 44px; padding: .55rem .9rem; }
}
/* Ultrawide: bigger type. */
@media (min-width: 2200px) {
  .play { font-size: 1.15rem; }
}
[hidden] { display: none !important; }

/* Every page is one screen (house rule: the entire screen, no page scrollbar). The body is the viewport; <main> takes what
   the slim header leaves; a page that has more to say splits it into tabs or two columns instead of scrolling. */
body.screen { height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.screen .mast-in { padding: .35rem 1rem; gap: .25rem 1rem; }
.screen .logo { font-size: 1.35rem; }
.screen .logo small { display: none; }
.screen > main { flex: 1; min-height: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; }
.tab { font: inherit; font-weight: 700; font-size: .88rem; min-height: 40px; padding: .3rem .8rem; background: transparent;
  color: var(--ink-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.tab:hover { border-color: var(--accent); color: var(--ink); }
.tab[aria-selected="true"], .tab[aria-pressed="true"] { background: var(--panel-2); color: var(--ink); border-color: var(--accent); }
.tab:focus-visible, .btn:focus-visible, .play select:focus-visible, .map:focus-visible, .pad:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* landing */
.home { width: 100%; max-width: var(--stage); margin: 0 auto; padding: .75rem 1rem; display: grid; gap: .75rem 1.5rem;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto auto;
  grid-template-areas: "lead live" "steps live" "laws laws"; }
.home-lead { grid-area: lead; align-self: center; }
.home .badge { margin-bottom: .75rem; }
.home h1 { font-size: clamp(2rem, 4.4vw, 3.6rem); margin-bottom: .75rem; }
.home .subtitle { font-size: clamp(.95rem, 1.6vw, 1.2rem); }
.home-live { grid-area: live; min-height: 0; display: flex; flex-direction: column; gap: .35rem; }
.home-live h2 { margin: 0; font-size: 1rem; color: var(--ink-2); font-weight: 600; }
.home-hero { flex: 1; min-height: 0; width: 100%; object-fit: cover; image-rendering: pixelated; border: 1px solid var(--line); border-radius: 14px; }
.home-live iframe { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); }
.home-laws { grid-area: laws; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.home-steps { grid-area: steps; margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem .85rem; color: var(--ink-2); font-size: .88rem; counter-reset: s; }
.home-steps li { counter-increment: s; padding-left: 1.9rem; position: relative; }
.home-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 1.4rem; height: 1.4rem; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--accent); font: 800 .75rem/1.4rem var(--mono); text-align: center; }
.home-steps b { color: var(--ink); }
@media (max-width: 899px) {
  .home { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; grid-template-areas: "lead" "steps"; }
  .home-live, .home-laws { display: none; }
  .home-steps { grid-template-columns: minmax(0, 1fr); }
}

/* how to play */
.howto { width: 100%; max-width: var(--stage); margin: 0 auto; padding: .6rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.page-title { font-size: 1.5rem; margin: 0; }
.howto .tabpane { flex: 1; min-height: 0; margin: 0; padding: 1rem 1.25rem; overflow: hidden; font-size: clamp(1rem, 1.1vw, 1.5rem); }
.howto .expect-list { max-width: none; margin: 0; }
.howto .expect-list li { margin-bottom: .6rem; }
.howto .tabpane > p { margin: 0 0 .75rem; }
.howto-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.howto-head .btn { padding: .45rem 1.1rem; }
@media (max-width: 700px) {
  .page-title { font-size: 1.2rem; }
  .tab { min-height: 36px; padding: .2rem .55rem; font-size: .8rem; }
  .howto .tabpane { padding: .55rem .8rem; font-size: .82rem; line-height: 1.34; }
  .howto .expect-list { padding-left: 1.1rem; }
  .howto .expect-list li { margin-bottom: .35rem; }
  .howto .btn { padding: .5rem 1rem; }
}


/* /live and the landing embed: the play page's stage and docks (above) with the watched ship on it; Watching at the
   left, the Legend at the right, the Route top centre, the chronicle bottom left. live.mjs sets --ship-mark on the
   docks to the ship's marker colour, so the Route's ring and the Legend's swatch match its outline on the stage. */
.live-page .chronicle { margin: 0; padding-left: 1.1rem; color: var(--ink-2); font-size: .85rem; }
.live-page .chronicle li { margin-bottom: .15rem; }
.tn-panel .live-action { color: var(--ink); font-weight: 700; margin: 0 0 .3rem; }
.live-page .tn-panel .hint { margin: 0; font-variant-numeric: tabular-nums; }
/* Nothing docks under the Legend here, so it takes the right side's whole height before it scrolls. */
.live-page .tn-panel[data-dock="r"] { max-height: calc(100% - 2 * var(--dock-gap)); }
/* The landing page frames /live/embed: the ship and the Watching panel, docked at the bottom with no tab strip. */
.embed .mast, .embed .tn-panel-tabs, .embed .tn-panel:not(#panel-watch) { display: none !important; }
.embed #panel-watch { top: auto; bottom: var(--dock-gap); left: var(--dock-gap); right: var(--dock-gap); width: auto;
  margin: 0; max-height: 40%; }
/* Light theme: white text on the darker accent clears 4.5:1; the dark ink does not. */
:root[data-theme="light"] .btn-primary, :root[data-theme="light"] .btn-primary:hover, :root[data-theme="light"] .act-badge { color: #fff; }
/* The ship screen's windows, the line over the bar and the bar are graphite in both themes (the stage is the night sky
   either way), so they keep the dark theme's ink and accents; light ink on them read 1.4:1. */
:root[data-theme="light"] .game { --ink: #e8ddd0; --ink-2: #a8947d; --accent: #d98a45; --accent-2: #f0a860; }
:root[data-theme="light"] .game .btn-primary, :root[data-theme="light"] .game .btn-primary:hover,
  :root[data-theme="light"] .game .act-badge { color: #1a0f00; }

