@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("fonts/plus-jakarta-sans-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --cargo-yellow: #FCB600;
  --cargo-yellow-dark: #D99A00;
  --cargo-black: #010101;
  --cargo-paper: #F4F3EF;
  --cargo-paper-2: #FBFAF7;
  --cargo-slate: #5D6B77;
  --cargo-slate-dark: #2A3C4B;
  --heavy: "Plus Jakarta Sans", system-ui, sans-serif;
  --shadow: 0 12px 40px rgb(1 1 1 / 45%);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  font-weight: 400;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
  /* a tap on the snow is a throw, never a zoom or a text selection */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  background: var(--cargo-black);
  color: var(--cargo-paper);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

#stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* The picture: canvas plus anything that has to line up with its edges.
   It fills the screen rather than holding a 16:9 box — the scene is composed
   from the bottom edge up, so it takes whatever shape it's given and there's
   nothing to letterbox. dvh rather than vh so a phone's collapsing address bar
   doesn't leave a strip of background under the rail. */
.frame {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  /* size, not inline-size: the portrait rules below query the aspect ratio */
  container-type: size;

  /**
   * The interface unit.
   *
   * The scene is a picture and scales with the window; the interface is not
   * and must not. Sized as a flat percentage of the width, a logo that looks
   * right on a laptop becomes a 700-pixel banner on a 4K monitor and swallows
   * the game. So every piece of chrome is a multiple of this instead: it
   * tracks the picture through the middle of the range and then stops, top and
   * bottom. One number to tune the lot.
   */
  --ui: clamp(10px, 1.1cqw, 16px);
}

#backgroundSnow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}
#backgroundSnow[hidden] { display: none; }

#game {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
  touch-action: none;
}

/* ── overlay screens ─────────────────────────────────────────────── */
.screen {
  z-index: 4;
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 3vh 2vw;
  background: rgb(1 1 1 / 72%);
  backdrop-filter: blur(6px);
  overflow: auto;
  scrollbar-color: var(--cargo-slate) var(--cargo-black);
}
.screen.hidden { display: none; }

/* The scoreboard arrives rather than appears — it follows a two-second beat
   on the canvas, and cutting to it at full opacity undoes that. */
#results { align-items: center; }
#results .panel { animation: resultsIn .45s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes resultsIn {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #results .panel { animation: none; }
}

.panel {
  width: min(680px, 94vw);
  /* Glass over the scene rather than a slab on top of it — you should still
     see the snow you were just throwing at. */
  background: var(--cargo-black);
  backdrop-filter: blur(16px) saturate(1.15);
  border: 2px solid var(--cargo-paper);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(4, 16, 40, .55);
  padding: clamp(20px, 3.2vh, 30px) clamp(20px, 3vw, 34px) clamp(18px, 2.6vh, 26px);
  text-align: center;
}

h1, h2, h3, .scoreline span { font-family: var(--heavy); font-weight: 800; }

h1 {
  margin: 0 0 2px;
  font-size: clamp(28px, 5vw, 46px);
  letter-spacing: .5px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .3);
}
h1 em {
  font-style: normal;
  color: var(--cargo-yellow);
}
h2 { margin: 0 0 4px; font-size: clamp(20px, 3vw, 28px); }
.sub { margin: 0 0 16px; color: var(--cargo-paper); font-size: 15px; }

/* ── controls ────────────────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; }
.spacer { flex: 1 1 12px; }

button {
  display: inline-block;
  font: inherit;
  font-family: var(--heavy);
  font-weight: 800;
  cursor: pointer;
  border-radius: 999px;
  border: 2px solid transparent;
  padding: 10px 20px;
  background-color: var(--cargo-slate-dark);
  color: var(--cargo-paper);
  transition: transform .1s ease, background-color .15s ease;
}
button:hover { background-color: var(--cargo-black); transform: translateY(-1px); }
button:active { transform: translateY(1px); }

.big {
  background: var(--cargo-yellow);
  color: var(--cargo-black);
  font-size: clamp(16px, 2.4vw, 21px);
  font-weight: 600;
  padding: 13px 34px;
  box-shadow: 0 5px 0 var(--cargo-yellow-dark);
}
.big:hover, .big:active { background-color: var(--cargo-yellow-dark); }
.big:active { box-shadow: 0 2px 0 var(--cargo-yellow-dark); }
.ghost { background: transparent; border-color: var(--cargo-paper); }
.ghost:hover { background-color: var(--cargo-slate-dark); }


/* ── results ─────────────────────────────────────────────────────── */
.scoreline { line-height: .95; margin: 2px 0 0; }
.scoreline span { font-size: clamp(46px, 9vw, 76px); font-weight: 600; color: var(--cargo-yellow); }
.scoreline small { display: block; margin-top: 6px; color: var(--cargo-paper); letter-spacing: 3px; text-transform: uppercase; font-size: 11px; }


.board { width: 100%; border-collapse: separate; border-spacing: 0 5px; }
.board td {
  padding: 8px 10px;
  font-size: 14px;
  text-align: left;
  background: var(--cargo-slate-dark);
  vertical-align: middle;
}
.board td:first-child { border-radius: 10px 0 0 10px; font-weight: 600; white-space: nowrap; }
.board td:last-child { border-radius: 0 10px 10px 0; }
/* the middle column carries the detail, so it gets the room and the quiet */
.board td.n { text-align: right; color: var(--cargo-paper); font-weight: 400; font-size: 13px; width: 1%; white-space: nowrap; }
.board td.n:last-child { color: var(--cargo-yellow); font-weight: 600; font-size: 15px; }
.board img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 10px; }
/* Both actions the same height, on the same line, actually centred. */
.actions {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgb(244 243 239 / 30%);
  flex-wrap: wrap;
}
.actions button {
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  line-height: 1;
}
.actions .ghost {
  font-size: clamp(14px, 1.9vw, 16px);
  padding: 13px 24px;
  border-color: rgba(255, 255, 255, .55);
}

/* ── instruction rail ────────────────────────────────────────────── */
/* Everything here is sized in cqw against .frame, so the chrome tracks the
   picture rather than the window, and none of it is ever resampled — that was
   the whole reason for taking it off the canvas. */
.rail {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--ui) * 5);
  min-height: 34px;
  display: flex;
  align-items: stretch;
  background: var(--cargo-black);
  border-top: calc(var(--ui) * 0.18) solid var(--cargo-yellow);
  /* it's a caption, not a control: never eat a click meant for the snow */
  pointer-events: none;
  z-index: 2;
  transition: opacity .25s ease;
}
/* Once you're playing you already know how — and the rail was eating the
   bottom of the picture the front row pops up into. */
.rail.off {
  opacity: 0;
  visibility: hidden;
}

.rail-item {
  flex: 1 1 0;
  min-width: max-content;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(var(--ui) * 0.73);
  padding: 0 var(--ui);
}
.rail-item + .rail-item { border-left: 1px solid rgb(244 243 239 / 30%); }

.rail-item svg {
  flex: none;
  width: calc(var(--ui) * 1.82);
  height: calc(var(--ui) * 1.82);
  min-width: 14px;
  min-height: 14px;
  color: var(--cargo-yellow);
}

.rail-item span {
  font-family: var(--heavy);
  font-size: calc(var(--ui) * 0.95);
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cargo-paper);
  white-space: nowrap;
}


/* ── header: logo, title lockup, gauges ──────────────────────────── */
.hud {
  position: absolute;
  inset: 0 0 auto 0;
  pointer-events: none;
  z-index: 2;
  font-family: var(--heavy);
  text-transform: uppercase;
}

/* Before a round there is nothing to count. The title and sound button
   stay; the readouts wait until they mean something. */
.hud[hidden] { display: none; }

.hud.pregame .gauge {
  opacity: 0;
  visibility: hidden;
}
.gauge { transition: opacity .25s ease; }

/* ── title lockup ────────────────────────────────────────────────── */
.lockup {
  position: absolute;
  top: calc(var(--ui) * 0.55);
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(var(--ui) * 19.5), 36cqh);
  aspect-ratio: 1446 / 1087;
  height: auto;
  filter: drop-shadow(0 calc(var(--ui) * 0.45) calc(var(--ui) * 0.9) rgba(4, 16, 40, .45));
}

/* ── hits / time gauges ──────────────────────────────────────────── */
.gauge {
  position: absolute;
  top: calc(var(--ui) * 5.4);
  display: flex;
  align-items: center;
  gap: calc(var(--ui) * 0.5);
  min-width: 150px;
  padding: 14px 18px 10px;
  background: rgba(19,41,75,.45);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(4,16,40,.35);
  overflow: visible;
}
.gauge--hits { left: calc(var(--ui) * 1.8); }
.gauge--time { right: calc(var(--ui) * 1.8); }

.gauge-flake { width: calc(var(--ui) * 1.55); height: calc(var(--ui) * 1.55); color: var(--cargo-paper-2); flex: none; }
.gauge-read { flex: 1; text-align: center; line-height: 1; }
.gauge-label {
  display: block;
  font-size: max(10px, calc(var(--ui) * 0.71));
  letter-spacing: .13em;
  text-indent: .13em;
  color: var(--cargo-paper);
}
.gauge-value {
  display: block;
  margin-top: calc(var(--ui) * 0.18);
  font-size: max(24px, calc(var(--ui) * 1.86));
  letter-spacing: .02em;
  color: var(--cargo-yellow);
}
.gauge-value.hot { animation: gaugeHot .7s steps(2, end) infinite; }
@keyframes gaugeHot { 50% { text-shadow: 0 0 8px var(--cargo-yellow); } }
@media (prefers-reduced-motion: reduce) { .gauge-value.hot { animation: none; } }

/* Points and the streak live inside the panels. Loose on the sky they were
   the same white-on-pale-blue as the mountains behind them. */
.gauge-sub {
  display: block;
  margin-top: calc(var(--ui) * 0.27);
  padding-top: calc(var(--ui) * 0.25);
  border-top: 1px solid rgb(244 243 239 / 30%);
  font-size: max(10px, calc(var(--ui) * 0.64));
  letter-spacing: .04em;
  color: var(--cargo-paper);
  white-space: nowrap;
}
.gauge-sub--streak { color: var(--cargo-yellow); }
/* Kept in the layout when there's no streak, so the panel doesn't jump. */
.gauge-sub--streak.idle { color: var(--cargo-paper); }

/* Container query units carry the whole header. Without them, fall back to a
   fixed layout at the design size rather than a pile of full-size text. */
@supports not (width: 1cqw) {
  .hud, .rail { font-size: 14px; }
  .rail { height: 44px; }
  .lockup { width: 274.5px; }
  .gauge { top: 78px; min-width: 170px; padding: 16px 16px 12px; }
  .gauge-value { font-size: 35px; }
}

/* ── upright screens ─────────────────────────────────────────────── */
/* A phone needs a bigger interface, not a smaller one — and because every
   piece of chrome is a multiple of --ui, retuning that one number does most of
   the work. What's left here is the handful of things that genuinely change
   shape rather than size.

   The chrome lives inside .frame so it can use a container query; the start
   screen and the panels are siblings of it, so they take a media query. The
   frame is exactly the viewport, so the two agree. */
@container (aspect-ratio < 4/5) {
  .hud, .rail, .mute { --ui: clamp(10px, 2.2cqw, 18px); }

  .lockup { top: calc(var(--ui) * 4); }
  /* clear of the lockup, which is a good deal taller here */
  .gauge { top: calc(var(--ui) * 20); }
  .mute { width: calc(var(--ui) * 4.2); height: calc(var(--ui) * 4.2); }
  .mute svg { width: calc(var(--ui) * 2.3); height: calc(var(--ui) * 2.3); }

  /* two rows of two, so the long labels keep their own line */
  .rail {
    height: auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: calc(var(--ui) * 0.3) 0;
  }
  .rail-item { padding: calc(var(--ui) * 0.8) calc(var(--ui) * 0.6); justify-content: flex-start; }
  .rail-item + .rail-item { border-left: 0; }
  .rail-item:nth-child(even) { border-left: 1px solid rgb(244 243 239 / 30%); }
  .rail-item:nth-child(n + 3) { border-top: 1px solid rgb(244 243 239 / 30%); }
}

@media (max-aspect-ratio: 4/5) {
  .panel { width: 94vw; padding: 5vw 4.5vw; border-radius: 4vw; }
}

/* A phone on its side is short, not narrow: keep the rail out of the way. */
/* A phone on its side is short, not narrow: the interface has to come down a
   size or the rail and the gauges meet in the middle. */
@container (aspect-ratio > 4/5) and (max-height: 460px) {
  .hud, .rail, .mute { --ui: clamp(9px, 2.4cqh, 13px); }
}

/* ── save your score ─────────────────────────────────────────────── */
.saverow {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgb(244 243 239 / 30%);
}
.saverow h2 { width: 100%; margin: 0; font-size: 17px; }
.save-controls { display: flex; justify-content: center; gap: 8px; width: 100%; }
.saverow[hidden] { display: none; }
.saverow input {
  flex: 0 1 200px;
  min-width: 0;
  font: inherit;
  font-size: 15px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .35);
  background: var(--cargo-slate-dark);
  color: var(--cargo-paper);
}
.saverow input::placeholder { color: var(--cargo-paper); }
.saverow input:focus {
  outline: none;
  border-color: var(--cargo-yellow);
}
.saverow .save {
  background: var(--cargo-yellow);
  color: var(--cargo-black);
  border-color: rgba(255, 255, 255, .35);
  padding: 11px 22px;
  font-size: 15px;
}
.saverow .save:hover, .saverow .save:active { background: var(--cargo-yellow-dark); }
.saverow .skip {
  flex: none;
  padding: 8px 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  font-size: 14px;
  text-decoration: underline;
  box-shadow: none;
}
.saverow .skip:hover { background: transparent; color: var(--cargo-yellow); transform: none; }
.name-error { width: 100%; margin: 0; color: #fff; font-size: 14px; font-weight: 600; }
.name-error[hidden] { display: none; }

.saved {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgb(244 243 239 / 30%);
  color: var(--cargo-yellow);
  font-size: 14px;
}
.saved[hidden] { display: none; }

/* ── scoreboard ──────────────────────────────────────────────────── */
/* Five columns, and only the last one is allowed to take what's left — the
   shared .n rule squeezes everything to its content, which flattened the
   detail column into a one-word-per-line sliver. */
.scores td.rank {
  width: 1%;
  color: var(--cargo-paper);
  font-weight: 600;
  text-align: center;
  padding-right: 0;
}
.scores td.name { width: 1%; font-weight: 600; white-space: nowrap; }
.scores td.pts { color: var(--cargo-yellow); font-weight: 600; font-size: 15px; }
.scores tr.mine td { background: rgb(252 182 0 / 16%); }
.scores td.empty { color: var(--cargo-paper); opacity: 1; font-style: italic; text-align: center; }

@media (max-width: 520px) {
  .save-controls { flex-wrap: wrap; }
  .saverow input { flex: 1 1 calc(100% - 130px); }
  .saverow .skip { flex-basis: 100%; }
}

/* ── the way in ──────────────────────────────────────────────────── */
.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 6vh 5vw;
  background: radial-gradient(circle at 50% 15%, var(--cargo-slate-dark), var(--cargo-black) 70%);
  transition: opacity .4s ease;
}
.gate.hidden { display: none; }
.gate.opening { opacity: 0; pointer-events: none; }

.gate-card {
  width: min(420px, 100%);
  text-align: center;
}
.gate-logo {
  width: min(340px, 78%);
  height: auto;
  margin-bottom: clamp(20px, 5vh, 40px);
  filter: drop-shadow(0 8px 22px rgba(4, 16, 40, .6));
}

#gateForm {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: stretch;
}
#gateWord {
  font: inherit;
  font-size: 20px;
  text-align: center;
  letter-spacing: .35em;
  text-indent: .35em;
  padding: 15px 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, .35);
  background: var(--cargo-slate-dark);
  color: var(--cargo-paper);
}
#gateWord::placeholder { letter-spacing: .08em; text-indent: 0; color: var(--cargo-paper); }
#gateWord:focus { outline: none; border-color: var(--cargo-yellow); }
#gateForm .big { margin: 0; }

.gate-note {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--cargo-paper);
}
.gate-note[hidden] { display: none; }

/* a short shake on a wrong answer, for anyone who isn't reading the message */
#gateForm.wrong { animation: gateShake .35s ease; }
@keyframes gateShake {
  25% { transform: translateX(-7px); }
  50% { transform: translateX(7px); }
  75% { transform: translateX(-4px); }
}
@media (prefers-reduced-motion: reduce) {
  #gateForm.wrong { animation: none; }
  .gate { transition: none; }
}

/* ── end the round? ──────────────────────────────────────────────── */
/* Sits over a paused round, so it stays small and lets the frozen scene show
   round the edges — you're interrupting the game, not leaving it. */
.quitbox {
  width: min(430px, 92vw);
  padding: clamp(22px, 3.4vh, 30px) clamp(22px, 3vw, 32px) clamp(20px, 2.8vh, 26px);
}
.quitbox h2 { margin: 0 0 6px; }
.quitbox .sub { margin: 0; font-size: 14px; }
.quitbox .actions { margin-top: 18px; padding-top: 18px; }
.quitbox .big { font-size: clamp(15px, 1.9vw, 18px); padding: 13px 26px; }

#quitAsk { background: rgb(1 1 1 / 55%); backdrop-filter: blur(3px); }
#quitAsk .panel { animation: resultsIn .25s cubic-bezier(.2, .8, .3, 1) both; }
@media (prefers-reduced-motion: reduce) { #quitAsk .panel { animation: none; } }

/* ── the wait ────────────────────────────────────────────────────── */
/* Wears the gate's clothes on purpose: answering the password and waiting for
   the snow should feel like one step, not two different screens. */
#loading { z-index: 40; transition: opacity .6s ease; }
@media (prefers-reduced-motion: reduce) {
  #loading { transition: none; }
}

/* Isolate the yellow focus ring with a black backing on both light art
   and dark panels, including yellow buttons. */
button:focus-visible, input:focus-visible {
  outline: 3px solid var(--cargo-yellow);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--cargo-black);
}

/* Cargo's heavy type uses the same tight tracking across HTML readouts. */
h1, h2, h3, button, .big,
.scoreline span, .gauge-label, .gauge-value,
.board td.n:last-child, .scores td.pts {
  font-weight: 800;
  letter-spacing: -0.02em;
}
.rail-item span, .gauge-sub, .scoreline small { font-weight: 600; }

/* Cargo winter results: one panel, four short steps that each fit without scrolling. */
.hud .lockup { transition: transform .45s cubic-bezier(.3,.7,.3,1); transform-origin: 50% 0; }
.hud:not(.pregame) .lockup { transform: translateX(-50%) scale(.46); }
.gauge--hits #hudScore { font-size: max(24px, calc(var(--ui) * 2.12)); }
.gauge--hits #hudHits { font-size: 11px; }

#results {
  /* room above for the badge that overhangs the panel; little below */
  padding: 56px 2vw 16px;
  overflow: hidden;
}
#results [hidden] { display: none !important; }
#results .panel {
  --results-pad-top: 64px;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 72px);
  max-height: calc(100dvh - 72px);
  padding: var(--results-pad-top) clamp(16px, 3vw, 30px) 20px;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(252,182,0,.22), rgba(252,182,0,0) 55%),
    linear-gradient(180deg, #2B4A6F 0%, #1B3557 38%, #13294B 100%);
  border: 2px solid #FCB600;
  border-radius: 20px;
  box-shadow: 0 0 0 6px rgba(252,182,0,.15), 0 24px 60px rgba(4,16,40,.6);
  backdrop-filter: none;
}
#results .panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 8%, #fff8 0 1px, transparent 2px),
    radial-gradient(circle at 84% 5%, #fff7 0 1px, transparent 2px),
    radial-gradient(circle at 91% 23%, #fff4 0 1px, transparent 2px),
    radial-gradient(circle at 7% 38%, #fff4 0 1px, transparent 2px),
    radial-gradient(circle at 73% 18%, #fff4 0 1px, transparent 2px);
}
#results .panel > :not(.snowcap) { position: relative; z-index: 1; }
#results .panel > .results-badge {
  position: absolute;
  top: -48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  width: 132px;
  margin: 0;
  padding: 0;
  filter: drop-shadow(0 5px 8px rgba(4,16,40,.3));
}
.results-badge img { display: block; width: 100%; height: auto; }
#results .score-kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .24em; color: #FCB600; }
#results .scoreline { margin: 5px 0 0; line-height: 1; }
#results .scoreline span {
  display: block;
  font-size: clamp(64px, 9vw, 104px);
  font-weight: 800;
  color: #FFFFFF;
  -webkit-text-stroke: 8px #0B1C36;
  paint-order: stroke fill;
  text-shadow: 0 7px 0 #FCB600, 0 9px 0 #0B1C36, 0 18px 28px rgba(4,16,40,.5);
}
#results .scoreline small { margin-top: 12px; color: #CFDDEE; font-size: 11px; letter-spacing: .3em; }
#results .board tr:nth-child(odd) td { background: rgba(255,255,255,.09); }
#results .board tr:nth-child(even) td { background: rgba(255,255,255,.12); }
#results .board tr.mine td { box-shadow: inset 0 1px #FCB60080, inset 0 -1px #FCB60080; }
#results .saverow input {
  flex: 1 1 0;
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.3);
  color: #FFFFFF;
}
#results .saverow .save { flex: none; padding-inline: 16px; }
#results .actions { flex: none; margin-top: 12px; padding-top: 14px; gap: 10px; }
#results .actions button { flex: 1; min-width: 0; }

@media (max-width: 720px) {
  #results .panel { width: min(680px, calc(100vw - 48px)); }
  #results .actions { flex-wrap: nowrap; }
  #results .actions button { padding: 12px 8px; font-size: 14px; }
}
@media (max-height: 640px) {
  #results { align-items: start; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) { .hud .lockup { transition: none; } }

/* The password and loader share the game's measured winter plates. */
#gate, #loading { overflow: hidden; background: #0B1C36; padding: 16px; }
.gate-bg, .gate-fog, .gate-snow { position: absolute; inset: 0; pointer-events: none; }
.gate-bg {
  background:
    url(img/layer-3.png) center bottom / cover no-repeat,
    url(img/layer-2.png) center bottom / cover no-repeat,
    url(img/layer-1.png) center 35% / cover no-repeat;
  opacity: 0;
  transition: opacity .2s ease;
}
.gate-bg.scene-ready { opacity: 1; }
.gate-fog {
  background:
    linear-gradient(180deg, rgba(6,18,40,.15), rgba(6,18,40,.55) 60%, rgba(6,18,40,.8)),
    radial-gradient(50% 40% at 50% 50%, rgba(6,18,40,.55), rgba(6,18,40,0));
}
.gate-snow { width: 100%; height: 100%; z-index: 1; }
.gate-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 460px;
  max-width: calc(100vw - 32px);
  min-height: 416px;
  padding: 30px 34px;
  border-radius: 24px;
  background: rgba(19,41,75,.45);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 20px 60px rgba(4,16,40,.5);
}
#gate .gate-logo, #loading .gate-logo {
  display: block;
  flex: none;
  width: min(340px, 100%);
  margin: 0 auto 24px;
}
#gateWord { min-width: 0; width: 100%; }

#loading .gate-card {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  min-height: 0;
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 32px 48px 36px;
  background: rgba(12,28,66,.96);
}
#loading .gate-logo {
  width: 170px;
  margin: 0 auto 18px;
}
.intro {
  max-width: 680px;
  margin: 0 auto;
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: .01em;
  text-wrap: pretty;
}
.intro p { margin: 0; }
.intro p + p { margin-top: 16px; }
.intro-lead {
  font-size: 21px;
  font-weight: 800;
  line-height: 1.5;
  text-wrap: balance;
}
.intro-kicker { font-size: 19px; }
.intro-kicker strong { color: #FCB600; font-size: 21px; font-weight: 800; }
.intro-punch strong { color: #FCB600; font-size: 21px; font-weight: 800; line-height: 1.4; }
.intro .intro-punch { margin-top: 8px; }
.cargo-word {
  display: inline-block;
  height: 1.2em;
  aspect-ratio: 200 / 73.87;
  vertical-align: -.32em;
  margin-left: .1em;
  background: #FCB600;
  -webkit-mask: url(img/cargo-logo.svg) center / contain no-repeat;
          mask: url(img/cargo-logo.svg) center / contain no-repeat;
}
#introStart {
  width: 100%;
  max-width: 420px;
  margin: 24px auto 0;
}
#introStart[aria-busy="true"] { cursor: wait; }

@media (max-width: 520px) {
  .gate-card { min-height: 388px; padding: 24px; }
}
@media (max-width: 600px) {
  #loading .gate-card { padding: 24px 20px; }
  #loading .gate-logo { width: 130px; margin-bottom: 14px; }
  .intro { font-size: 16px; line-height: 1.5; }
  .intro-lead { font-size: 19px; }
  .intro-lead br { display: none; }
  .intro-kicker { font-size: 17px; }
  .intro-kicker strong, .intro-punch strong { font-size: 18px; }
  #introStart { max-width: none; margin-top: 20px; }
}
@media (max-height: 600px) {
  .gate-card { min-height: 300px; padding: 20px 24px; }
  #gate .gate-logo { width: 180px; margin-bottom: 16px; }
}
@media (max-height: 360px) {
  .gate-card { min-height: 260px; padding: 16px 24px; }
  #gate .gate-logo { width: 120px; margin-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) { .gate-bg { transition: none; } }

/* The HUD shares the splash glass and the results panel's painted snow. */
.gauge .gauge-read { position: relative; z-index: 2; min-width: 0; }
.gauge .gauge-label { color: #CFDDEE; letter-spacing: .2em; }
.gauge .gauge-value { color: #FCB600; text-shadow: 0 2px 0 rgba(4,16,40,.5); white-space: nowrap; }
.gauge .gauge-sub { color: #FFFFFF; opacity: .85; }
.gauge .gauge-flake { fill: #FFFFFF; color: #FFFFFF; opacity: .8; }
#mute {
  background: rgba(19,41,75,.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.3);
  color: #FFFFFF;
}
@container (aspect-ratio < 4/5) {
  .gauge { padding-inline: 10px; max-width: calc(50% - 24px); }
  .gauge--hits #hudScore { font-size: clamp(18px, 5.6cqw, 24px); }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .gauge, #mute { background: rgba(19,41,75,.8); }
}

/* ── the four steps ──────────────────────────────────────────────── */
#results .step { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
#results .step[hidden] { display: none !important; }
#results .step-score { cursor: pointer; padding: 6px 0 4px; animation: stepIn .35s ease both; }
#results .step-name, #results .step-done, #results .step-records { animation: stepIn .35s ease both; }
@keyframes stepIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #results .step { animation: none !important; } }

.level-badge {
  margin: 6px 0 0;
  padding: 7px 16px;
  border-radius: 999px;
  background: #FCB600;
  color: #010101;
  font-family: var(--heavy);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.level-line { margin: 0; max-width: 30ch; color: #fff; font-size: clamp(18px, 2.4vw, 22px); font-weight: 700; line-height: 1.35; text-wrap: balance; }
.brunt {
  margin: 4px 0 0;
  padding: 8px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

#results .copy { max-width: 520px; color: #fff; font-size: 17px; font-weight: 500; line-height: 1.5; text-wrap: pretty; }
#results .copy p { margin: 0; }
#results .copy p + p { margin-top: 10px; }
#results .copy-lead { font-size: 20px; font-weight: 800; line-height: 1.35; text-wrap: balance; }
#results .copy-ask { color: #FCB600; font-weight: 800; }

#results .saverow { width: 100%; max-width: 460px; flex-direction: column; align-items: center; margin: 0; padding-top: 4px; border: 0; }
#results .save-controls { width: 100%; }
#results .saverow input { flex: 1 1 0; background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #FFFFFF; font-size: 16px; }
#results .saverow .save { flex: none; padding: 12px 22px; font-size: 16px; }
#results .saverow .skip { flex: none; padding: 4px 8px; }

#results .records-title { margin: 0; font-size: clamp(24px, 3.4vw, 32px); color: #FCB600; }
#results .scores { width: 100%; max-width: 460px; border-spacing: 0 4px; }
#results .scores td { padding: 6px 12px; font-size: 15px; }
#results .scores td.name { width: auto; text-align: left; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
#results .scores td.pts { text-align: right; width: 1%; white-space: nowrap; }
#results .scores tr.mine td { background: rgba(252,182,0,.28); }
#results .board tr:nth-child(odd) td { background: rgba(255,255,255,.09); }
#results .board tr:nth-child(even) td { background: rgba(255,255,255,.12); }
#results .board tr.mine td { background: rgba(252,182,0,.28); box-shadow: inset 0 1px #FCB60080, inset 0 -1px #FCB60080; }
.most-hit { margin: 0; color: #fff; font-size: 15px; font-weight: 600; }

#results .actions { width: 100%; max-width: 460px; margin-top: 4px; }
#results .actions .back { flex: 0 0 56px; font-size: 22px; padding: 0; }

@media (max-width: 600px) {
  #results .copy { font-size: 15px; }
  #results .copy-lead { font-size: 17px; }
  #results .step { gap: 12px; }
  #results .scores td { padding: 5px 10px; font-size: 14px; }
}
