/* Grachten Racer decomp. Direction and tokens: web/DESIGN.md
   "Autorun": the site as the menu that opened when the game CD went in,
   in the same family as the hub at retrodecomps.nl. The title band is the canal
   at dusk (night in dark mode); menus, buttons and panels are bevelled like CD
   menus of the time, and panels cast a hard shadow like a window on that menu.
   Motif: the bevel (light top-left, dark bottom-right) and the numbered menu. */

@font-face { font-family: "Bungee"; src: url(/static/fonts/bungee.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; src: url(/static/fonts/barlow.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(/static/fonts/barlow-semibold.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(/static/fonts/barlow-bold.woff2) format("woff2"); font-weight: 700 900; font-display: swap; }

:root {
  color-scheme: light dark;
  /* The quay in the afternoon */
  --page: #efe7d6;
  --panel: #fffaf0;
  --panel-2: #f4ecdc;
  --line: #d8ccb6;
  --ink: #1a1530;
  --muted: #4c4658;
  --link: #24358a;
  --red: #b3261e;
  --button: #1f2a55;
  --button-hi: #4c5d9e;
  --button-lo: #0c1230;
  --button-hover: #2f3d75;
  --on-button: #fffaf0;
  --accent: #ff7a1a;       /* the current menu item and the title's shadow */
  --on-accent: #1a1530;
  --matched: #b56f00;
  --effective: #008a7c;
  --track: #e3d9c5;
  --focus: #24358a;
  --ok-bg: #dce8d2;
  --error-bg: #f5d9cc;
  --drop: rgba(26, 21, 48, .22);

  /* The sky over the canal */
  --sky-top: #f7e2b8;
  --sky-mid: #f2b37a;
  --sky-low: #ec9a62;
  --on-sky: #1a1530;
  --on-sky-muted: #3b2a3a;
  --house-back: #8a5a4a;
  --house: #4a2f2a;
  --house-win: #ffe2a0;
  --bridge: #3a241d;

  /* Night panels: the timing tower, the city map, tooltips. Dark in both themes. */
  --hud-bg: #0b1022;
  --hud-line: #27305a;
  --hud-ink: #f3f1ea;
  --hud-muted: #b8b6c9;
  --hud-gold: #ffb347;
  --hud-red: #ff7a1a;
  --hud-link: #ffc58f;
  --water: #1b2b33;
  --water-line: #45606b;
  --boat-red: #d63c2f;
  --boat-white: #fbfbf6;

  /* The city map: canal houses at dusk, one window per function. */
  --city-f1: #2e221c;
  --city-f2: #2a2b25;
  --city-f3: #221c16;
  --city-f4: #37332a;
  --city-glass: #14150f;
  --city-lit: #f5bb4b;
  --city-glow: rgba(245, 187, 75, .75);
  --city-eff: #35d2bd;
  --city-hit: #d9dccb;
  --city-canal: #1b2b33;
  --city-quay: #3b3a2f;

  --display: "Bungee", "Arial Black", Impact, sans-serif;
  --text: "Barlow", "Segoe UI", "DejaVu Sans", sans-serif;
  --hudf: "Barlow", "Segoe UI", "DejaVu Sans", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --bevel: 3px;
  --width: 76rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* The same canal at night, with the windows lit */
    --page: #0c1120;
    --panel: #121a31;
    --panel-2: #18213d;
    --line: #2c3557;
    --ink: #f1efe8;
    --muted: #b8b6c9;
    --link: #aebcff;
    --red: #ff8a7a;
    --button: #25316a;
    --button-hi: #4b5aa3;
    --button-lo: #070b1f;
    --button-hover: #33428a;
    --on-button: #f6f3ea;
    --matched: #d28a24;
    --effective: #25b5a2;
    --track: #232c4b;
    --focus: #ffb070;
    --ok-bg: #1d3328;
    --error-bg: #3e231c;
    --drop: rgba(0, 0, 0, .55);
    --sky-top: #070b1f;
    --sky-mid: #151d44;
    --sky-low: #2b2f5e;
    --on-sky: #f3f1ea;
    --on-sky-muted: #cfcce0;
    --house-back: #1a1f3a;
    --house: #0a0d1c;
    --house-win: #ffc75a;
    --bridge: #0e0f1d;
  }
}

*, *::before, *::after { box-sizing: border-box; }
/* Components set their own display; hidden must still hide them. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 400 17px/1.55 var(--text); }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
code { font-family: var(--mono); font-size: .88em; }
h1 { font: 400 clamp(1.7rem, 3.6vw, 2.4rem)/1.1 var(--display); margin: 0 0 .7rem; }
h2 { font: 400 1.3rem/1.2 var(--display); margin: 0 0 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: .5rem; top: -4rem; z-index: 10; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0 1rem; background: var(--panel); color: var(--ink);
}
.skip:focus { top: .5rem; }

/* The bevel, shared by menu buttons, buttons and panels. */
.bevel, .tabs a, .tab, button, .button, .readout {
  border: var(--bevel) solid; border-color: var(--button-hi) var(--button-lo) var(--button-lo) var(--button-hi);
}

/* --- The title band: the canal at dusk ------------------------------------ */

.hud {
  color: var(--on-sky); overflow: hidden;
  background: linear-gradient(var(--sky-top), var(--sky-mid) 70%, var(--sky-low));
}
.hud-row, .tabs-row {
  max-width: var(--width); margin: 0 auto; padding-left: 1rem; padding-right: 1rem;
  display: flex; justify-content: space-between; gap: 1rem 2rem;
}
.hud-row { padding-top: 28px; padding-bottom: 18px; align-items: center; }
/* The game's box cover beside the title: the only game artwork on the site (see DESIGN.md). */
.id { display: flex; align-items: center; gap: 1.25rem; min-width: 0; }
.id-text { min-width: 0; }
.cover { display: block; flex: none; width: 128px; height: 128px; border: 3px solid var(--panel); box-shadow: .35rem .35rem 0 var(--drop); }
.title {
  display: inline-flex; align-items: center; min-height: 44px; color: var(--on-sky); text-decoration: none;
  font: 400 clamp(2rem, 4.6vw, 3.9rem)/.95 var(--display);
  /* A hard drop shadow, like the extruded logos on CD menus of the time */
  text-shadow: .06em .06em 0 var(--accent);
}
.sub { margin: .7rem 0 0; color: var(--on-sky); font: 600 1.1rem/1.35 var(--hudf); max-width: 40rem; text-wrap: balance; }

/* The readout is a small window on the menu: the matched share */
.readout {
  margin-left: auto; flex: none; padding: .8rem 1.1rem .9rem; min-width: 15rem;
  background: var(--panel); color: var(--ink); border-color: var(--line) var(--button-lo) var(--button-lo) var(--line);
  box-shadow: .4rem .4rem 0 var(--drop);
}
.readout p { margin: 0; }
.ro-label, .ro-stats dt { font: 700 .8rem/1.2 var(--hudf); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ro-value { font: 400 clamp(2.4rem, 4.6vw, 3.6rem)/1 var(--display); font-variant-numeric: tabular-nums; }
.ro-value span:not(.visually-hidden) { font-size: .55em; color: var(--muted); margin-left: .04em; }
.ro-stats { display: flex; gap: 1.5rem; margin: .5rem 0 0; }
.ro-stats dd { margin: 0; font: 700 1.1rem/1.3 var(--hudf); font-variant-numeric: tabular-nums; }
.ro-stats dd span { color: var(--muted); font-weight: 400; }
.ro-wait { font: 700 1.2rem/1.3 var(--hudf); max-width: 15rem; text-wrap: balance; }

/* The numbered menu */
.tabs-row { flex-wrap: wrap; align-items: center; padding-bottom: 22px; }
.tabs, .account { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; }
.account { margin-left: auto; }
.account form { margin: 0; }
.tabs a, .tab {
  display: inline-flex; align-items: center; gap: .6rem; min-height: 46px; padding: .3rem .9rem .3rem .4rem;
  background: var(--button); color: var(--on-button); text-decoration: none; cursor: pointer;
  font: 400 .95rem/1 var(--display); text-transform: uppercase;
}
.tab { padding-left: .9rem; }
.tabs .key {
  display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; flex: none;
  background: var(--button-lo); color: var(--on-button); font-size: .85rem;
}
.tabs a:hover, .tab:hover { background: var(--button-hover); text-decoration: underline; text-underline-offset: .2em; }
.tabs a:active, .tab:active { border-color: var(--button-lo) var(--button-hi) var(--button-hi) var(--button-lo); }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--on-accent); text-decoration: none; }
.tabs a[aria-current="page"] .key { background: var(--on-accent); color: var(--accent); }
.tab.signin { background: var(--accent); color: var(--on-accent); }
.tab.signin:hover { filter: brightness(1.08); }

/* The canal: houses against the sky, the race on the water */
.canal { position: relative; }
.skyline { display: block; width: 100%; height: 120px; }
.skyline .back { fill: var(--house-back); opacity: .7; }
.skyline .facade { fill: var(--house); }
.skyline .windows { fill: var(--house-win); opacity: .85; }
.skyline .bridge { fill: var(--bridge); }
.skyline .under { fill: var(--water); }
.skyline .railing { fill: none; stroke: var(--bridge); stroke-width: 1.6; }
.skyline .lantern { fill: var(--house-win); }
.water {
  height: 18px; border-top: 3px solid var(--button-lo);
  background: url(/static/ripples.svg) repeat-x 0 50% / 120px 24px, var(--water);
}
.track {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 1rem;
  height: 68px; padding: 0 max(1rem, calc((100% - var(--width)) / 2 + 1rem));
  background: url(/static/ripples.svg) repeat-x 0 70% / 120px 24px, var(--water);
  border-top: 3px solid var(--button-lo);
}
.start, .end { font: 400 .78rem var(--display); color: var(--hud-gold); }
.end { padding-left: 14px; }
.lane { position: relative; height: 4px; background: var(--water-line); margin: 18px 0 0; }
.trail { position: absolute; left: var(--x, 0); top: 0; bottom: 0; width: var(--w); background: var(--hud-gold); }
.trail.effective { background: var(--effective); }
.cp { position: absolute; left: var(--at); top: -7px; width: 2px; height: 18px; background: var(--water-line); }
.cp b {
  position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  font: 600 .75rem var(--hudf); color: var(--hud-muted);
}
.finish {
  position: absolute; left: 100%; top: -12px; width: 14px; height: 28px;
  background: conic-gradient(#fff 25%, #111 0 50%, #fff 0 75%, #111 0) 0 0 / 7px 7px;
}
.boat-at { position: absolute; bottom: -10px; left: max(-6px, calc(var(--at) - 92px)); }
.boat { display: block; width: 90px; height: 32px; }
.boat .deck { fill: var(--boat-white); stroke: #0b0d0a; stroke-width: .8; }
.boat .hull, .boat .stripe { fill: var(--boat-red); }
.boat .hull { stroke: #0b0d0a; stroke-width: .8; }
.boat .screen { fill: #3d5248; stroke: #0b0d0a; stroke-width: .8; }
.boat .engine { fill: #0b0d0a; }
.boat .wake { fill: none; stroke: var(--hud-muted); stroke-width: 1.6; stroke-linecap: round; }

.env-note { margin: 0; padding: .5rem 1rem; text-align: center; background: var(--panel-2); color: var(--ink); font-size: .9rem; }

/* --- Page ----------------------------------------------------------------- */

main { max-width: var(--width); margin: 0 auto; padding: 2.5rem 1rem 3.5rem; }
section { margin-bottom: 2.75rem; }
.lead { max-width: 48rem; color: var(--muted); margin-top: 0; }
.empty { color: var(--muted); max-width: 42rem; }
.note { color: var(--muted); font-size: .9rem; max-width: 52rem; }
.scroll { overflow-x: auto; max-width: 100%; }

.flash { padding: .75rem 1rem; margin: 0 0 1.5rem; font-weight: 600; border: 2px solid var(--line); }
.flash.ok { background: var(--ok-bg); }
.flash.error { background: var(--error-bg); }

/* Panels are windows on the menu: bevelled, with a hard shadow */
.panel, .checkpoint, .telemetry, .enter, .laps {
  background: var(--panel); padding: 1.5rem 1.6rem;
  border: var(--bevel) solid; border-color: var(--line) var(--button-lo) var(--button-lo) var(--line);
  box-shadow: .45rem .45rem 0 var(--drop);
}

.checkpoint { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.5rem 3rem; align-items: center; padding: 2rem 2.2rem; }
.checkpoint.plain { display: block; }
.checkpoint h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); margin-bottom: .6rem; }
.cp-line { margin: 0; font: 600 1.2rem var(--hudf); }
.cp-line strong { font: 400 1.5rem var(--display); }
.cp-line .sep { color: var(--muted); margin: 0 .35rem; }
.cp-line .part { white-space: nowrap; }
.cp-note { color: var(--muted); margin: .7rem 0 0; font-size: .95rem; max-width: 40rem; }
.cp-bar { position: relative; height: 26px; background: var(--track); overflow: hidden; border: 2px solid; border-color: var(--button-lo) var(--line) var(--line) var(--button-lo); }
.cp-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); background: var(--matched); }
.cp-bar > span:not(.cp-fill) { position: absolute; left: var(--at); top: 0; bottom: 0; width: 2px; background: var(--panel); }
.cp-scale { display: flex; justify-content: space-between; margin-top: .35rem; font: 600 .88rem var(--hudf); color: var(--muted); }
.cp-pct { margin: .3rem 0 0; font: 400 2.4rem/1 var(--display); font-variant-numeric: tabular-nums; }
.cp-pct span { font: 600 1rem var(--hudf); color: var(--muted); margin-left: .35rem; }

.duo { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 1.75rem; align-items: start; margin-bottom: 2.75rem; }
.duo.reverse { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.duo > section { margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.rules-split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

/* Standings: a timing tower, a night panel in both themes. */
.tower {
  background: var(--hud-bg); color: var(--hud-ink); padding: 1.4rem 1.4rem 1rem;
  border: var(--bevel) solid; border-color: var(--hud-line) #000 #000 var(--hud-line);
  box-shadow: .45rem .45rem 0 var(--drop);
}
.tower h2 { color: #fff; }
.tower a { color: var(--hud-link); }
.tower :focus-visible { outline-color: var(--hud-gold); }
.tower .empty { color: var(--hud-muted); }
.tower-list { list-style: none; padding: 0; margin: 0; }
.tower-list li { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; align-items: center; gap: .8rem; min-height: 56px; border-bottom: 1px solid var(--hud-line); }
.tower .person { min-height: 44px; font-weight: 700; font-size: 1.05rem; color: var(--hud-ink); overflow-wrap: anywhere; }
.tower .person img { background: var(--hud-line); }
.pos {
  font: 400 1.05rem/1 var(--display); text-align: center; padding: .5rem 0;
  background: var(--hud-gold); color: #1a1530;
  border: 2px solid; border-color: #ffe0b0 #7a4a00 #7a4a00 #ffe0b0;
}
.pts { font: 700 1.3rem var(--hudf); font-variant-numeric: tabular-nums; }
.pts span { font: 600 .8rem var(--hudf); color: var(--hud-muted); margin-left: .3rem; text-transform: uppercase; letter-spacing: .08em; }
.tower-list .open .pos { background: transparent; color: var(--hud-muted); border: 2px dashed var(--hud-muted); }
.open-text { grid-column: 2 / 4; color: var(--hud-muted); font-size: .95rem; padding: .5rem 0; }
.more { margin: .9rem 0 0; }

.laps { padding-bottom: 1rem; }
.laps td.name a { font-weight: 700; overflow-wrap: anywhere; }
.laps td.name .status { margin-left: .4rem; }
.laps td.addr { white-space: nowrap; }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; }
.steps li { counter-increment: step; position: relative; padding-left: 3.2rem; margin-bottom: 1.1rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: .05rem; width: 2.2rem; height: 2.2rem;
  display: grid; place-items: center;
  font: 400 1rem/1 var(--display); color: var(--on-button); background: var(--button);
  border: var(--bevel) solid; border-color: var(--button-hi) var(--button-lo) var(--button-lo) var(--button-hi);
}

.person { display: inline-flex; align-items: center; gap: .4rem; }
.person img { border-radius: 50%; background: var(--panel-2); flex: none; }

/* --- Chart ---------------------------------------------------------------- */

.chart { position: relative; margin: 0; }
.chart-scroll { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 520px; height: auto; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 600 13px var(--hudf); font-variant-numeric: tabular-nums; }
.chart .area { fill: var(--matched); opacity: .14; }
.chart .line { fill: none; stroke: var(--matched); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .end, .chart .focus { fill: var(--matched); stroke: var(--panel); stroke-width: 2; }
.chart .end-label { fill: var(--ink); font: 700 15px var(--hudf); }
.chart .crosshair { stroke: var(--muted); stroke-width: 1; }
.chart svg:focus-visible { outline-offset: 4px; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 2; background: var(--hud-bg); color: var(--hud-ink);
  padding: .4rem .65rem; font: 600 .85rem/1.4 var(--hudf); white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
}
.table-view { margin-top: .8rem; }
.table-view summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--link); }

/* --- Status labels and tables --------------------------------------------- */

.status {
  display: inline-block; font: 700 .8rem/1.6 var(--hudf); letter-spacing: .03em; white-space: nowrap; padding: 0 .55rem;
  border: 1px solid var(--line); color: var(--ink); background: var(--panel);
}
.status.s-matched { border-color: var(--matched); box-shadow: inset 4px 0 0 var(--matched); padding-left: .75rem; }
.status.s-effective { border-color: var(--effective); box-shadow: inset 4px 0 0 var(--effective); padding-left: .75rem; }
.status.s-partial { border-style: dashed; }
.status.s-todo { color: var(--muted); }

table { width: 100%; border-collapse: collapse; font-size: .97rem; background: var(--panel); }
.laps table, .telemetry table { background: transparent; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { font: 700 .78rem var(--hudf); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--panel-2); }
.laps thead th { background: transparent; }
tbody th[scope="row"] { padding-top: 0; padding-bottom: 0; }
tbody th[scope="row"] a { display: inline-flex; align-items: center; min-height: 44px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.num { font: 700 1rem var(--hudf); }
tbody tr:hover { background: color-mix(in srgb, var(--panel-2) 70%, transparent); }
td form { margin: 0; }
table.functions td.name { min-width: 11rem; max-width: 24rem; overflow-wrap: anywhere; }
.fname.hint { color: var(--muted); font-style: italic; }
table.scoreboard .rank { width: 4.5rem; }
table.scoreboard .rank .pos { display: block; width: 3rem; margin-left: auto; font-size: .95rem; padding: .35rem 0; }
table.scoreboard tr.you { background: var(--ok-bg); }
.claimed { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0 .2rem; font-size: .9rem; }
.count { margin: 0 0 .6rem; }

/* --- Forms and buttons ---------------------------------------------------- */

button, .button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 1.1rem; background: var(--button); color: var(--on-button); cursor: pointer; text-decoration: none;
  font: 700 1rem/1 var(--hudf);
}
button:hover, .button:hover { background: var(--button-hover); text-decoration: underline; }
button:active, .button:active { border-color: var(--button-lo) var(--button-hi) var(--button-hi) var(--button-lo); }
button:disabled { cursor: not-allowed; opacity: .55; }
button.secondary { background: transparent; color: var(--link); border-color: currentColor; }
button.secondary:hover { background: var(--panel-2); }
button.small { min-height: 36px; padding: 0 .8rem; font-size: .88rem; position: relative; }
/* Small buttons stay 36px tall but get a 44px hit area. */
button.small::after { content: ""; position: absolute; inset: -6px -3px; }
.button-row { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }

label { display: block; font: 700 .82rem var(--hudf); letter-spacing: .05em; text-transform: uppercase; margin-bottom: .3rem; color: var(--muted); }
input, select {
  font: inherit; color: var(--ink); background: var(--panel);
  border: 2px solid; border-color: var(--button-lo) var(--line) var(--line) var(--button-lo);
  min-height: 44px; padding: 0 .6rem; width: 100%;
}
.filters {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem;
  margin: 1.5rem 0 1.75rem;
}
.filters .field { flex: 0 1 12rem; }
.filters .field.grow { flex: 1 1 14rem; }
.filters .field.size { flex: 0 1 6.5rem; }
.filters .actions { display: flex; align-items: center; gap: 1rem; }
.reset { white-space: nowrap; min-height: 44px; display: inline-flex; align-items: center; }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .5rem 1rem; }
.inline-form label { width: 100%; }
.inline-form input { max-width: 18rem; }
form.inline { display: inline; margin-left: .5rem; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: 1.25rem; font-family: var(--hudf); font-weight: 600; }
.pager a { min-height: 44px; display: inline-flex; align-items: center; }

/* --- The city map (functions page) ------------------------------------------ */

.city-panel {
  background: var(--hud-bg); color: var(--hud-ink); padding: 1.4rem 1.4rem 1.2rem;
  border: var(--bevel) solid; border-color: var(--hud-line) #000 #000 var(--hud-line);
  box-shadow: .45rem .45rem 0 var(--drop);
}
.city-panel h2 { color: #fff; margin-bottom: .4rem; }
.city-panel p { margin: 0; color: var(--hud-muted); max-width: 52rem; }
.city-panel a { color: var(--hud-link); }
.city-panel code { color: var(--hud-ink); }
.city-panel :focus-visible { outline-color: var(--hud-gold); }
.city-wrap { position: relative; margin-top: 1.2rem; }
.city-status { margin: 0; padding: 2rem 0; color: var(--hud-muted); }
.city-status button { margin-left: 1rem; }

.city {
  --ww: 4px; --wh: 6px; --gx: 2px; --gy: 3px; --px: 3px; --py: 3px; --gh: 10px; --wt: 9px;
  --fmax: calc(7 * var(--wh) + 6 * var(--gy) + 2 * var(--py));
  --street: calc(var(--gh) + var(--fmax) + var(--wt));
  --quay-at: calc(var(--street) - var(--wt));
  display: flex; flex-wrap: wrap; column-gap: 2px; align-items: flex-end; justify-content: space-between;
  background: repeating-linear-gradient(transparent 0 var(--quay-at),
    var(--city-quay) var(--quay-at) calc(var(--quay-at) + 2px),
    var(--city-canal) calc(var(--quay-at) + 2px) var(--street));
  cursor: pointer;
}
.city:focus-visible { outline: 3px solid var(--hud-gold); outline-offset: 6px; }
.city .br { flex-basis: 100%; height: 0; }
.house { height: var(--street); display: flex; flex-direction: column; justify-content: flex-end; padding-bottom: var(--wt); }
.gable { height: var(--gh); }
.facade {
  display: grid; grid-template-columns: repeat(var(--cols), var(--ww)); grid-auto-rows: var(--wh);
  gap: var(--gy) var(--gx); padding: var(--py) var(--px);
}
.f1 .gable, .f1 .facade { background: var(--city-f1); }
.f2 .gable, .f2 .facade { background: var(--city-f2); }
.f3 .gable, .f3 .facade { background: var(--city-f3); }
.f4 .gable, .f4 .facade { background: var(--city-f4); }
.g-step .gable { clip-path: polygon(0 100%, 0 66%, 12% 66%, 12% 33%, 25% 33%, 25% 0, 75% 0, 75% 33%, 88% 33%, 88% 66%, 100% 66%, 100% 100%); }
.g-neck .gable { clip-path: polygon(0 100%, 0 72%, 27% 72%, 27% 18%, 50% 0, 73% 18%, 73% 72%, 100% 72%, 100% 100%); }
.g-bell .gable { clip-path: polygon(0 100%, 0 82%, 15% 76%, 23% 40%, 35% 10%, 50% 0, 65% 10%, 77% 40%, 85% 76%, 100% 82%, 100% 100%); }
.g-spout .gable { clip-path: polygon(0 100%, 50% 0, 100% 100%); }

/* Window states. Shape as well as colour: effective windows are half lit,
   windows in progress only have their frame lit. */
.city i, .city-legend i { display: block; width: var(--ww); height: var(--wh); background: var(--city-glass); }
.city i.m, .city-legend i.m { background: var(--city-lit); box-shadow: 0 0 6px 1px var(--city-glow); }
.city i.e, .city-legend i.e { background: linear-gradient(var(--city-eff) 50%, var(--city-glass) 50%); }
.city i.p, .city-legend i.p { box-shadow: inset 0 0 0 1px var(--city-lit); }
.city-legend i.h { background: var(--city-hit); }
/* With filters on: the windows that pass light up, the rest dim. */
.city.filtering .house:not(.has-hit) { opacity: .4; }
.city.filtering i:not(.hit) { opacity: .25; box-shadow: none; }
.city.filtering i.hit:not(.m):not(.e):not(.p) { background: var(--city-hit); }
.city i.sel { outline: 2px solid #fff; outline-offset: 1px; position: relative; z-index: 1; opacity: 1; }

.city-legend { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; margin: 1rem 0 0; padding: 0; font-size: .95rem; color: var(--hud-ink); }
.city-legend li { display: flex; align-items: center; gap: .45rem; }
.city-legend i { --ww: 8px; --wh: 12px; outline: 1px solid var(--hud-muted); }

.tip {
  position: absolute; z-index: 5; width: max-content; max-width: min(24rem, 88vw);
  background: var(--panel); color: var(--ink); padding: .5rem .7rem; font-size: .9rem; line-height: 1.4;
  border: 2px solid; border-color: var(--line) var(--button-lo) var(--button-lo) var(--line);
  box-shadow: .3rem .3rem 0 rgba(0, 0, 0, .45);
  transform: translate(-14px, calc(-100% - 10px));
}
.tip.flip { transform: translate(calc(-100% + 14px), calc(-100% - 10px)); }
.tip.below { transform: translate(-14px, 18px); }
.tip.below.flip { transform: translate(calc(-100% + 14px), 18px); }
.tip code { display: block; color: inherit; }
.tip b { display: block; overflow-wrap: anywhere; }
.tip b.hint { font-style: italic; font-weight: 600; }
.tip span { display: block; }
.tip a { display: inline-flex; align-items: center; min-height: 44px; color: var(--link); font-weight: 700; }

/* --- Function page ---------------------------------------------------------- */

.crumb { margin: 0 0 .5rem; font-family: var(--hudf); font-weight: 600; }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; }
.fn-name { font-family: var(--hudf); font-weight: 700; font-size: 1.15em; overflow-wrap: anywhere; }
h1 code { font-size: .7em; }
.function-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.75rem; margin: 1.5rem 0; align-items: start; }
/* Flex, not grid: the facts on the last row grow to fill it, so no empty cell shows. */
.facts { margin: 0; display: flex; flex-wrap: wrap; gap: 1px; background: var(--line); border: var(--bevel) solid; border-color: var(--line) var(--button-lo) var(--button-lo) var(--line); box-shadow: .45rem .45rem 0 var(--drop); }
.facts div { flex: 1 1 9rem; background: var(--panel); padding: .7rem .9rem; }
.facts dt { font: 700 .78rem var(--hudf); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: .2rem 0 0; font: 700 1.15rem/1.3 var(--hudf); }
.facts dd .muted { font: 400 .92rem var(--text); }
.claim-box p { margin-top: 0; }
.credits { list-style: none; padding: 0; margin: 0; }
.credits li { padding: .4rem 0; }

.profile { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 2rem; }
.profile-avatar { border-radius: 50%; background: var(--panel-2); flex: none; }
.profile h1 { margin: 0; }
.profile p { margin: .25rem 0 0; }

.error-page { padding: 1rem 0 2rem; }

footer.site { border-top: 3px solid var(--line); color: var(--muted); font-size: .9rem; padding: 1.5rem max(1rem, calc((100% - var(--width)) / 2 + 1rem)) 2.5rem; }
footer.site p { max-width: 52rem; }

/* Motion with a purpose: the boat and the checkpoint bar travel to the current
   position once on load, so the eye lands on how far the race has come. */
@media (prefers-reduced-motion: no-preference) {
  .boat-at { animation: boat-in 1.1s cubic-bezier(.2, .7, .2, 1) .15s both; }
  .cp-fill { animation: fill-in .9s ease-out .35s both; }
  @keyframes boat-in { from { left: -6px; } }
  @keyframes fill-in { from { width: 0; } }
}

@media (max-width: 64rem) {
  .hud-row { flex-wrap: wrap; }
  .title { font-size: clamp(2rem, 6vw, 3.6rem); }
  .cover { width: 104px; height: 104px; }
  /* The readout moves under the title: the number beside its counts. */
  .readout { margin-left: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1.2rem; }
  .ro-label { width: 100%; }
  .ro-stats { margin: 0; }
  .ro-wait { max-width: none; }
  .city { --ww: 3px; --wh: 5px; --gx: 2px; --gy: 2px; --px: 2px; --py: 3px; --gh: 8px; --wt: 7px; }
}
@media (max-width: 56rem) {
  .checkpoint, .duo, .duo.reverse, .split, .rules-split, .function-head { grid-template-columns: minmax(0, 1fr); }
  .checkpoint { padding: 1.6rem 1.4rem; }
}
@media (max-width: 40rem) {
  body { font-size: 16px; }
  .hud-row { padding-top: 20px; padding-bottom: 14px; gap: .9rem; }
  .title { font-size: 1.85rem; }
  .id { gap: .8rem; }
  .cover { width: 68px; height: 68px; }
  .sub { display: none; }
  .readout { gap: 0 .9rem; width: 100%; min-width: 0; }
  .ro-value { font-size: 2.3rem; }
  .ro-stats { flex-direction: column; gap: 0; }
  .ro-stats div { display: flex; gap: .4rem; align-items: baseline; }
  .ro-stats dd { font-size: 1rem; }
  .tabs-row { padding-bottom: 16px; gap: .5rem; }
  /* The menu becomes a two-by-two block of buttons */
  .tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: .45rem; }
  .tabs a { font-size: .8rem; padding-right: .5rem; gap: .45rem; }
  .account { margin-left: 0; gap: .45rem; }
  .tab { font-size: .8rem; }
  .skyline { height: 72px; }
  .cp:not(.half) b { display: none; }
  .cp-line .sep { display: none; }
  .cp-line .part { display: block; }
  .track { gap: .6rem; }
  .panel, .checkpoint, .telemetry, .enter, .laps, .tower, .city-panel { box-shadow: .3rem .3rem 0 var(--drop); }
  /* The finish table becomes one block per function. */
  .laps thead { display: none; }
  .laps table, .laps tbody { display: block; }
  .laps tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
  .laps td { display: block; padding: 0; border: 0; }
  .laps td.name { grid-column: 1 / 3; order: -1; }
  .laps td.num::after { content: " bytes"; font: 400 .88rem var(--hudf); color: var(--muted); }
  .city-panel { padding: 1.2rem 1rem 1rem; }
  .city { --ww: 2px; --wh: 3px; --gx: 1px; --gy: 2px; --px: 2px; --py: 2px; --gh: 5px; --wt: 5px; }
  th, td { padding: .5rem; }
}
@media (forced-colors: active) {
  .trail, .cp-fill, .pos, .city i, .city-legend i { forced-color-adjust: none; }
  .tabs a[aria-current="page"] { border-width: 5px; }
  .status.s-matched, .status.s-effective { box-shadow: none; border-width: 2px; }
}
