/* Cold Chain: headlights on a frozen pass, white stickers on a black dash.
   The world is the console's; the chrome is the site's. Same nine neutrals,
   same eight type steps, same three radii, no shadows. The one colour the
   site draws, the green of the graphics card's stripe, appears here only
   where there is a graphics card: the crates in the bed, their useful life,
   and a crate lying in the snow on the map. See DESIGN.md, section "05 Haul".                                  */
:root {
  --void: #000000;
  --carbon: #0b0b0b;
  --graphite: #161616;
  --smoke: #242424;
  --ash: #4a4a4a;
  --fog: #8c8c8c;
  --mist: #bdbdbd;
  --bone: #ececec;
  --paper: #ffffff;
  --gpu: #8fd400;
  /* the storm, and nothing else: a warning, a gust */
  --danger: #ff4636;

  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --t-micro: 0.72rem;
  --t-note: 0.78rem;
  --t-meta: 0.84rem;
  --t-row: 0.9rem;
  --t-num: 1rem;
  --t-body: 1.05rem;
  --t-lead: 1.25rem;
  --t-sub: 1.6rem;
  --t-display: clamp(2.8rem, 8vw, 5.6rem);
  --t-banner: clamp(1.7rem, 3.6vw, 2.5rem);

  --r-chip: 0.625rem;
  --r-card: 1.375rem;
  --r-pill: 999px;

  --gap: 0.75rem;
  --pad-card: 1.25rem;
  --inset: clamp(0.75rem, 2.2vw, 1.5rem);
  --hud-w: 19rem;
  --map: 10.5rem;
  --map-s: 6.4rem;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* {
  box-sizing: border-box;
}
/* the chrome grows with the screen: main.js sets --ui from the window
   (1 up to about 1280 by 740, then in step with it), and every size is in
   rem, so one number scales the whole HUD */
html {
  font-size: calc(100% * var(--ui, 1));
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--bone);
  font-family: var(--sans);
  font-optical-sizing: auto;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
button {
  font: inherit;
  color: inherit;
}
a {
  color: inherit;
}
[hidden] {
  display: none !important;
}
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---- the picture ---------------------------------------------------------- */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--void);
}
#view {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

/* ---- shared parts ------------------------------------------------------------ */
.kicker {
  margin: 0;
  color: var(--fog);
  font: 500 var(--t-micro) / 1.2 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.card {
  border: 1px solid var(--smoke);
  border-radius: var(--r-card);
  background: var(--carbon);
  padding: var(--pad-card);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  height: 2.75rem;
  padding: 0 1.3rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: var(--carbon);
  color: var(--bone);
  font: 500 var(--t-row) var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.14s var(--ease-out);
}
.btn svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
.btn-primary {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--void);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  cursor: progress;
  opacity: 0.55;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    border-color: var(--paper);
  }
  .btn-primary:hover {
    background: var(--bone);
  }
}
.btn:focus-visible,
.chip:focus-visible,
.rail a:focus-visible,
.brand:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  border-radius: var(--r-chip);
  background: var(--paper);
  color: var(--void);
  font: 500 var(--t-note) / 1 var(--mono);
}
.chip {
  height: 2.2rem;
  padding: 0 0.95rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: var(--carbon);
  color: var(--mist);
  font: 500 var(--t-meta) var(--sans);
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}
.chip[aria-pressed="true"] {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--void);
}

/* ---- masthead, as on the site -------------------------------------------------- */
.masthead {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: calc(var(--inset) + env(safe-area-inset-top)) calc(var(--inset) + 0.4rem) 0;
  pointer-events: none;
}
.masthead > * {
  pointer-events: auto;
}
body:not(.is-title):not(.is-paused) .masthead {
  display: none;
}
body.is-paused .hud,
body.is-paused .touch {
  visibility: hidden;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}
.brand-mark {
  display: block;
  width: 1.875rem;
  height: 1.875rem;
  border-radius: var(--r-chip);
}
.brand-word {
  color: var(--paper);
  font-size: var(--t-row);
  font-weight: 600;
  letter-spacing: 0.14em;
}
.rail {
  display: flex;
  gap: 1.5rem;
}
.rail a {
  color: var(--fog);
  font: var(--t-micro) var(--mono);
  letter-spacing: 0.18em;
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s ease;
}
.rail a[aria-current="page"] {
  color: var(--paper);
}
/* over the 3D title the rail sits on a band of shade, so it reads */
body.is-title .masthead::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 -2.5rem;
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  pointer-events: none;
}
body.is-title .rail a {
  color: var(--mist);
}
@media (hover: hover) and (pointer: fine) {
  .rail a:hover {
    color: var(--paper);
  }
}

/* the share-card render keeps the brand and the title, drops the controls */
.is-og .rail,
.is-og .title .actions,
.is-og .title .fine {
  display: none;
}

/* ---- the title: one sticker on the glass ------------------------------------------ */
.title {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: var(--inset);
  padding-bottom: calc(var(--inset) + env(safe-area-inset-bottom));
  transition:
    opacity 0.3s var(--ease-out),
    transform 0.3s var(--ease-out);
}
body:not(.is-title) .title {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}
body:not(.fonts-ready) .title-card {
  opacity: 0;
}
.title-card {
  transition: opacity 0.3s var(--ease-out);
  width: min(100%, 31rem);
  border: 1px solid var(--smoke);
  border-radius: var(--r-card);
  background: var(--carbon);
  padding: 1.75rem 1.75rem 1.5rem;
}
.title h1 {
  margin: 0.55rem 0 0;
  color: var(--paper);
  font-size: var(--t-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.9;
  text-transform: uppercase;
}
.title .deck {
  margin: 0.9rem 0 0;
  color: var(--paper);
  font-size: var(--t-lead);
  font-weight: 300;
  line-height: 1.3;
}
.title .objective {
  margin: 1rem 0 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--smoke);
}
.title .objective p:last-child {
  margin: 0.4rem 0 0;
  color: var(--bone);
  font-size: var(--t-row);
  line-height: 1.5;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.4rem;
}
.fine {
  margin: 1rem 0 0;
  color: var(--fog);
  font: var(--t-micro) var(--mono);
  letter-spacing: 0.08em;
}

/* ---- sheets: controls, report, pause ------------------------------------------------ */
.sheet {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--inset);
  background: rgba(0, 0, 0, 0.72);
}
.sheet .card {
  width: min(100%, 26rem);
  max-height: calc(100dvh - 2 * var(--inset));
  overflow: auto;
}
.sheet .card.wide {
  width: min(100%, 44rem);
}
.sheet h2 {
  margin: 0.45rem 0 1rem;
  color: var(--paper);
  font-size: var(--t-sub);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
  text-transform: uppercase;
}
#report .card {
  transition:
    opacity 0.24s var(--ease-out),
    transform 0.24s var(--ease-out);
}
#report.is-entering .card {
  opacity: 0;
  transform: scale(0.97);
}
.keys {
  display: grid;
  gap: 0.45rem;
  margin: 0.9rem 0 1.1rem;
}
.keys div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--graphite);
}
.keys dt {
  color: var(--mist);
  font-size: var(--t-row);
}
.keys dd {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  color: var(--fog);
  font: var(--t-note) var(--mono);
}
.ledger {
  display: grid;
  gap: 0.4rem;
  margin: 0 0 1.2rem;
}
.ledger div {
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--graphite);
}
.ledger dt {
  color: var(--mist);
  font-size: var(--t-row);
}
.ledger dd {
  margin: 0;
  color: var(--paper);
  font: 500 var(--t-row) var(--mono);
  font-variant-numeric: tabular-nums;
}
.pause-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.6rem;
}
.pause-grid .keys {
  margin-top: 0;
}
.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---- the heads-up display ------------------------------------------------------- */
.hud {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
}
.hud > * {
  position: absolute;
}

/* the objective, top left: what to do and where; the side job under it */
.stack {
  top: calc(var(--inset) + env(safe-area-inset-top));
  left: calc(var(--inset) + env(safe-area-inset-left));
  display: grid;
  gap: 0.5rem;
  width: min(var(--hud-w), calc(100vw - 2 * var(--inset) - 3.5rem));
}
.ticket {
  position: relative;
  border: 1px solid var(--smoke);
  border-radius: var(--r-chip);
  background: var(--carbon);
  padding: 0.75rem 0.875rem;
}
.ticket > * {
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}
.ticket.is-updating > * {
  opacity: 0;
  transform: translateY(-4px);
  transition: none;
}
.ticket .kicker {
  padding-right: 4.6rem;
}
.goal {
  margin: 0.45rem 0 0;
  color: var(--bone);
  font-size: var(--t-row);
  font-weight: 600;
  line-height: 1.3;
}
.dest {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.3rem 0 0;
  color: var(--paper);
}
.dest svg {
  flex: none;
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  transform: rotate(var(--bearing, 0deg));
}
.dest b {
  font-size: var(--t-lead);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  text-transform: uppercase;
}
.dist {
  margin-left: auto;
  color: var(--mist);
  font: 500 var(--t-meta) var(--mono);
  font-variant-numeric: tabular-nums;
}
.job {
  border: 1px solid var(--smoke);
  border-radius: var(--r-chip);
  background: var(--carbon);
  padding: 0.6rem 0.875rem 0.7rem;
}
.job-step {
  margin: 0.3rem 0 0;
  color: var(--bone);
  font-size: var(--t-meta);
  line-height: 1.35;
}
.bar {
  height: 0.25rem;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--smoke);
}
.bar i {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--gpu);
  transform-origin: left center;
}

/* the useful life of the load, top centre: the clock the run is against.
   Under thirty seconds it turns into a white sticker and beats each second;
   run out, and the figure is struck through */
.clock {
  position: fixed;
  top: calc(var(--inset) + env(safe-area-inset-top));
  left: 50%;
  min-width: 11.5rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-chip);
  background: var(--carbon);
  padding: 0.55rem 1.1rem 0.75rem;
  text-align: center;
  transform: translateX(-50%);
  transition:
    transform 0.12s var(--ease-out),
    background-color 0.2s ease,
    border-color 0.2s ease;
}
.clock b {
  display: block;
  margin-top: 0.25rem;
  color: var(--paper);
  font: 500 2.3rem / 1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.clock .bar {
  margin-top: 0.55rem;
}
.clock.is-urgent {
  border-color: var(--paper);
  background: var(--paper);
}
.clock.is-urgent .kicker {
  color: var(--ash);
}
.clock.is-urgent b {
  color: var(--void);
}
.clock.is-urgent .bar {
  background: var(--mist);
}
.clock.is-beat {
  transform: translateX(-50%) scale(1.06);
  transition-duration: 0.05s;
}
.clock.is-dead b {
  color: var(--fog);
  text-decoration: line-through;
}
.clock.is-dead .bar i {
  background: var(--ash);
}

/* the four crates in the bed, in the ticket's corner */
.slot-row.mini {
  position: absolute;
  top: 0.75rem;
  right: 0.875rem;
  display: grid;
  grid-template-columns: repeat(4, 0.8rem);
  gap: 0.19rem;
  margin: 0;
}
.slot-row.mini i {
  position: relative;
  width: 0.8rem;
  height: 0.8rem;
  overflow: hidden;
  border: 1px solid var(--ash);
  border-radius: 0.19rem;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease;
}
.slot-row.mini i.is-full {
  border-color: var(--paper);
  background: var(--paper);
}
.slot-row.mini i.is-full::before {
  content: "";
  position: absolute;
  top: 0.125rem;
  bottom: 0.125rem;
  left: 0.125rem;
  width: 0.125rem;
  border-radius: var(--r-pill);
  background: var(--gpu);
}
.slot-row.mini i.is-lost::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -2px;
  right: -2px;
  height: 1px;
  background: var(--mist);
  transform: rotate(-45deg);
}

/* the map, bottom left. A gauge, so it is round */
.minimap {
  bottom: calc(var(--inset) + env(safe-area-inset-bottom));
  left: calc(var(--inset) + env(safe-area-inset-left));
  width: var(--map);
  height: var(--map);
  overflow: hidden;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: var(--carbon);
}
.minimap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* speed and fuel, bottom right, like the bike film's */
.gauges {
  right: calc(var(--inset) + env(safe-area-inset-right));
  bottom: calc(var(--inset) + env(safe-area-inset-bottom));
  display: grid;
  justify-items: end;
  gap: 0.45rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-chip);
  background: var(--carbon);
  padding: 0.55rem 0.8rem 0.6rem;
}
.fuel {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.fuel span {
  color: var(--mist);
  font: var(--t-micro) var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.fuel .bar {
  width: 5.5rem;
}
.fuel .bar i {
  background: var(--paper);
}
.fuel.is-low span {
  color: var(--paper);
  text-decoration: line-through;
}
.speed {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  color: var(--paper);
}
.speed b {
  font: 500 var(--t-sub) / 1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.speed span {
  color: var(--mist);
  font: var(--t-micro) var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* the storm: the one other colour in the chrome, and only while it lasts.
   A warning in the upper third when it is coming, with hazard tape along its
   top; then a gauge under the ticket with the wind in it, gone red when a
   gust hits */
.storm {
  border: 1px solid var(--danger);
  border-radius: var(--r-chip);
  background: var(--carbon);
  padding: 0.6rem 0.875rem 0.7rem;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease;
}
.storm .kicker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--danger);
}
.storm-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: var(--r-pill);
  background: var(--danger);
  animation: storm-dot 1.1s ease-in-out infinite;
}
@keyframes storm-dot {
  50% {
    opacity: 0.2;
  }
}
.storm-wind {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  margin: 0.3rem 0 0;
  color: var(--paper);
}
.storm-wind b {
  font: 500 var(--t-sub) / 1 var(--mono);
  font-variant-numeric: tabular-nums;
}
.storm-wind span {
  color: var(--mist);
  font: var(--t-micro) var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.storm .bar {
  margin-top: 0.45rem;
}
.storm .bar i {
  background: var(--danger);
}
.storm.is-gust {
  background: var(--danger);
}
.storm.is-gust .kicker,
.storm.is-gust .storm-wind,
.storm.is-gust .storm-wind span {
  color: var(--void);
}
.storm.is-gust .storm-dot,
.storm.is-gust .bar i {
  background: var(--void);
}
.storm.is-gust .bar {
  background: rgba(0, 0, 0, 0.28);
}
.alert {
  top: max(13rem, 26vh);
  left: 50%;
  width: min(32rem, calc(100vw - 2 * var(--inset)));
  margin-left: calc(min(32rem, calc(100vw - 2 * var(--inset))) / -2);
  overflow: hidden;
  border: 1px solid var(--danger);
  border-radius: var(--r-card);
  background: var(--carbon);
  padding: 1.7rem 1.375rem 1.25rem;
  text-align: center;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}
.alert::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 0.55rem;
  background: repeating-linear-gradient(-45deg, var(--danger) 0 0.55rem, var(--void) 0.55rem 1.1rem);
}
.alert.is-on {
  opacity: 1;
  transform: none;
  transition-duration: 0.26s;
}
.alert .kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--danger);
}
.alert.is-on .kicker {
  animation: alert-blink 0.8s steps(1) 5;
}
@keyframes alert-blink {
  50% {
    opacity: 0.3;
  }
}
.alert .kicker svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: var(--danger);
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.alert h2 {
  margin: 0.5rem 0 0;
  color: var(--paper);
  font-size: var(--t-banner);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 0.95;
  text-transform: uppercase;
}
.alert p:last-child {
  margin: 0.65rem 0 0;
  color: var(--mist);
  font-size: var(--t-row);
  line-height: 1.45;
}
@media (prefers-reduced-motion: reduce) {
  .storm-dot,
  .alert.is-on .kicker {
    animation: none;
  }
  .alert,
  .alert.is-on {
    transform: none;
    transition-property: opacity;
  }
}

/* each objective, announced once in the upper third, then kept in the ticket */
.banner {
  top: max(15rem, 30vh);
  left: 50%;
  width: min(30rem, calc(100vw - 2 * var(--inset)));
  margin-left: calc(min(30rem, calc(100vw - 2 * var(--inset))) / -2);
  border: 1px solid var(--smoke);
  border-radius: var(--r-card);
  background: var(--carbon);
  padding: 1.125rem 1.375rem 1.25rem;
  text-align: center;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}
.banner.is-on {
  opacity: 1;
  transform: none;
  transition-duration: 0.26s;
}
.banner h2 {
  margin: 0.5rem 0 0;
  color: var(--paper);
  font-size: var(--t-banner);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 0.95;
  text-transform: uppercase;
}
.banner p:last-child {
  margin: 0.65rem 0 0;
  color: var(--mist);
  font-size: var(--t-row);
  line-height: 1.45;
}

/* what to press here, and what it does; a tap or click presses it. The
   pump's hold fills the chip from the left */
.prompt {
  bottom: calc(var(--inset) + env(safe-area-inset-bottom));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  overflow: hidden;
  padding: 0.35rem 0.9rem 0.35rem 0.35rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: var(--carbon);
  color: var(--paper);
  font: 600 var(--t-row) var(--sans);
  white-space: nowrap;
  cursor: pointer;
  opacity: 0;
  transform: translate(-50%, 4px);
  transition:
    opacity 0.15s var(--ease-out),
    transform 0.15s var(--ease-out);
}
.prompt.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
.prompt .keys {
  display: flex;
  gap: 0.25rem;
}
.prompt .keys:empty {
  display: none;
}
.prompt.is-bare {
  padding-left: 0.9rem;
}
.prompt::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper);
  opacity: 0.16;
  transform: scaleX(var(--hold, 0));
  transform-origin: left center;
  pointer-events: none;
}
.flash {
  bottom: calc(var(--inset) + env(safe-area-inset-bottom) + 4.8rem);
  left: 50%;
  margin: 0;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: var(--carbon);
  color: var(--paper);
  font: 500 var(--t-micro) var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.flash.is-on {
  opacity: 1;
  transition: none;
}

/* the receipt that comes with a delivery, top centre under the clock */
.toast {
  top: calc(var(--inset) + env(safe-area-inset-top) + 7rem);
  left: 50%;
  width: min(26rem, calc(100vw - 2 * var(--inset)));
  margin-left: calc(min(26rem, calc(100vw - 2 * var(--inset))) / -2);
  border: 1px solid var(--smoke);
  border-radius: var(--r-chip);
  background: var(--carbon);
  padding: 0.75rem 1rem 0.875rem;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  transition:
    opacity 0.18s var(--ease-out),
    transform 0.18s var(--ease-out);
}
.toast.is-on {
  opacity: 1;
  transform: none;
  transition-duration: 0.22s;
}
.toast .body {
  margin: 0.35rem 0 0;
  color: var(--bone);
  font-size: var(--t-row);
  line-height: 1.45;
}

/* a person talking: the second line waits a beat */
.dialog {
  bottom: calc(var(--inset) + env(safe-area-inset-bottom) + 3.6rem);
  left: 50%;
  width: min(34rem, calc(100vw - 2 * var(--inset)));
  margin-left: calc(min(34rem, calc(100vw - 2 * var(--inset))) / -2);
  border: 1px solid var(--smoke);
  border-radius: var(--r-card);
  background: var(--carbon);
  padding: 1rem 1.25rem 1.125rem;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}
.dialog.is-on {
  opacity: 1;
  transform: none;
}
.dialog .line {
  margin: 0.4rem 0 0;
  color: var(--paper);
  font-size: var(--t-body);
  font-weight: 500;
  line-height: 1.4;
}
.dialog .late {
  color: var(--mist);
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
}
.dialog.is-late .late {
  opacity: 1;
}
.dialog .late:empty {
  display: none;
}
/* in a conversation the card takes the map's corner on a wide screen, and
   the camera sets the pair right of centre */
@media (min-width: 860px) {
  body.is-talking .dialog {
    bottom: calc(var(--inset) + env(safe-area-inset-bottom));
    left: calc(var(--inset) + env(safe-area-inset-left));
    width: min(30rem, 44vw);
    margin-left: 0;
  }
  body.is-talking .minimap {
    visibility: hidden;
  }
}
body.is-talking .prompt,
body.is-talking .flash {
  visibility: hidden;
}
/* what Ceedo can do in reply: numbered, never words in his mouth */
.choices {
  display: grid;
  gap: 0.35rem;
  margin: 0.85rem 0 0;
  padding: 0.75rem 0 0;
  border-top: 1px solid var(--graphite);
  list-style: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease-out);
}
.choices:empty {
  display: none;
}
.dialog.is-ready .choices {
  opacity: 1;
}
.choices button {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0.3rem 0.9rem 0.3rem 0.35rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: var(--graphite);
  color: var(--bone);
  font: 500 var(--t-row) var(--sans);
  text-align: left;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.dialog.is-ready .choices button {
  pointer-events: auto;
}
.choices button.is-sel {
  border-color: var(--paper);
  background: var(--paper);
  color: var(--void);
}
.choices button.is-sel kbd {
  background: var(--void);
  color: var(--paper);
}
@media (hover: hover) and (pointer: fine) {
  .choices button:hover {
    border-color: var(--paper);
  }
}

/* the keys for something, once, the first time it matters */
.hint {
  top: 34%;
  right: calc(var(--inset) + env(safe-area-inset-right));
  width: min(17.5rem, 46vw);
  border: 1px solid var(--smoke);
  border-radius: var(--r-chip);
  background: var(--carbon);
  padding: 0.75rem 0.9rem 0.85rem;
  opacity: 0;
  transform: translateX(8px);
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.2s var(--ease-out);
}
.hint.is-on {
  opacity: 1;
  transform: none;
}
.hint-keys {
  display: grid;
  gap: 0.4rem;
  margin: 0.6rem 0 0;
}
.hint-keys:empty,
.hint-touch:empty {
  display: none;
}
.hint-keys div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}
.hint-keys dd {
  display: flex;
  flex: none;
  gap: 0.2rem;
  margin: 0;
}
.hint-keys dt {
  color: var(--mist);
  font-size: var(--t-meta);
  text-align: right;
}
.hint-touch {
  margin: 0.45rem 0 0;
  color: var(--bone);
  font-size: var(--t-meta);
  line-height: 1.4;
}


.pause-btn {
  top: calc(var(--inset) + env(safe-area-inset-top));
  right: calc(var(--inset) + env(safe-area-inset-right));
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: var(--carbon);
  cursor: pointer;
  pointer-events: auto;
}
.pause-btn svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: var(--paper);
  stroke-width: 2;
}

/* ---- thumbs -------------------------------------------------------------------------- */
.touch {
  position: fixed;
  z-index: 12;
  inset: auto 0 0 0;
  height: 11rem;
  pointer-events: none;
}
.stick {
  position: absolute;
  bottom: calc(var(--inset) + env(safe-area-inset-bottom));
  left: calc(var(--inset) + env(safe-area-inset-left));
  width: 8rem;
  height: 8rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: rgba(11, 11, 11, 0.62);
  pointer-events: auto;
  touch-action: none;
}
.stick i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3.2rem;
  height: 3.2rem;
  margin: -1.6rem 0 0 -1.6rem;
  border-radius: var(--r-pill);
  background: var(--paper);
}
.pads {
  position: absolute;
  right: calc(var(--inset) + env(safe-area-inset-right));
  bottom: calc(var(--inset) + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(2, 4.2rem);
  grid-template-rows: 2.8rem 4.2rem;
  gap: 0.6rem;
  align-items: end;
}
.pad {
  width: 4.2rem;
  height: 4.2rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-pill);
  background: rgba(11, 11, 11, 0.62);
  color: var(--bone);
  font: 500 var(--t-micro) var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: auto;
  touch-action: none;
  transition: transform 0.12s var(--ease-out);
}
.pad:active,
.pad.is-down {
  transform: scale(0.94);
}
.pad-small {
  height: 2.8rem;
  grid-row: 1;
}
.pad-act {
  font: 500 var(--t-lead) var(--mono);
}

/* on touch the thumbs take the bottom corners: the map moves under the pause
   button and the speed sits between the stick and the pads */
body.is-touch .stack {
  width: calc(100vw - 2 * var(--inset) - var(--map-s) - 0.6rem - env(safe-area-inset-left) - env(safe-area-inset-right));
}
body.is-touch .minimap {
  top: calc(var(--inset) + env(safe-area-inset-top) + 3.2rem);
  right: calc(var(--inset) + env(safe-area-inset-right));
  bottom: auto;
  left: auto;
  width: var(--map-s);
  height: var(--map-s);
}
body.is-touch .gauges {
  right: auto;
  left: 50%;
  bottom: calc(var(--inset) + env(safe-area-inset-bottom) + 0.6rem);
  justify-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.6rem 0.45rem;
  transform: translateX(-50%);
}
body.is-touch .fuel span {
  display: none;
}
body.is-touch .fuel .bar {
  width: 3rem;
}
body.is-touch .speed b {
  font-size: var(--t-num);
}
body.is-touch .speed span {
  display: none;
}
body.is-touch .hint,
body.is-touch .hint.is-on {
  top: auto;
  right: auto;
  bottom: calc(var(--inset) + env(safe-area-inset-bottom) + 12.6rem);
  left: 50%;
  width: min(20rem, calc(100vw - 2 * var(--inset)));
  transform: translateX(-50%);
}
body.is-touch.is-talking .hint {
  visibility: hidden;
}

body.is-touch .prompt {
  bottom: calc(var(--inset) + env(safe-area-inset-bottom) + 9.4rem);
}
body.is-touch .dialog {
  bottom: calc(var(--inset) + env(safe-area-inset-bottom) + 12.6rem);
}
body.is-touch .toast {
  top: calc(var(--inset) + env(safe-area-inset-top) + 16rem);
}
body.is-touch .flash {
  top: calc(var(--inset) + env(safe-area-inset-top) + 18.6rem);
  bottom: auto;
}
body.is-touch .banner {
  top: max(21rem, 40vh);
}

/* ---- loading: Ceedo, cut as a sticker, while the valley is built ---------------------- */
.loading {
  position: fixed;
  z-index: 15;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.4rem;
  pointer-events: none;
  transition: opacity 0.6s var(--ease-out);
}
.loading.is-done {
  opacity: 0;
}
/* on a wide screen he stands right of the title card, where the 3D cat will */
@media (min-width: 720px) {
  .loading {
    padding-left: min(33rem, 44vw);
  }
}
@media (max-width: 719px) {
  .loading {
    align-content: start;
    padding-top: 16vh;
  }
}
.ceedo {
  display: block;
  width: min(17rem, 34vw, 38vh);
  overflow: visible;
}
@media (max-width: 719px) {
  .ceedo {
    width: min(13rem, 52vw);
  }
}
.c-body path,
.c-body circle {
  fill: #1d1e21;
  stroke: var(--paper);
  stroke-width: 3.4;
  stroke-linejoin: round;
}
.c-glasses path {
  fill: var(--paper);
  stroke: var(--paper);
  stroke-width: 3;
  stroke-linejoin: round;
}
.c-eyes circle {
  fill: var(--void);
}
.c-shade {
  fill: var(--graphite);
}
.c-bob {
  animation: c-bob 2.6s ease-in-out infinite;
}
.c-eyes {
  transform-origin: 60px 68px;
  animation: c-blink 4.2s linear infinite;
}
@keyframes c-bob {
  50% {
    transform: translateY(-3px);
  }
}
@keyframes c-blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  97% {
    transform: scaleY(0.1);
  }
}
.load-meter {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  width: min(15rem, 60vw);
}
.load-meter .bar {
  width: 100%;
}
.load-meter .bar i {
  width: 100%;
  background: var(--paper);
  transform: scaleX(var(--p, 0.05));
  transition: transform 0.4s var(--ease-out);
}

/* ---- the story: four shots before the shift, letterboxed ----------------------------- */
.story {
  position: fixed;
  z-index: 30;
  bottom: calc(var(--inset) + env(safe-area-inset-bottom) + 2vh);
  left: 50%;
  width: min(40rem, calc(100vw - 2 * var(--inset)));
  border: 1px solid var(--smoke);
  border-radius: var(--r-card);
  background: var(--carbon);
  padding: 1.25rem 1.5rem 1.2rem;
  transform: translateX(-50%);
}
.story-a {
  margin: 0.55rem 0 0;
  color: var(--paper);
  font-size: var(--t-lead);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.story-b {
  margin: 0.4rem 0 0;
  color: var(--mist);
  font-size: var(--t-body);
  line-height: 1.45;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
}
.story.is-late .story-b {
  opacity: 1;
}
.story-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.1rem;
}
.story-foot .fine {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0 auto;
}
body.is-story .stage::before,
body.is-story .stage::after {
  content: "";
  position: absolute;
  z-index: 1;
  right: 0;
  left: 0;
  height: 8vh;
  background: var(--void);
}
body.is-story .stage::before {
  top: 0;
}
body.is-story .stage::after {
  bottom: 0;
}
body.is-story .masthead {
  display: none;
}
@media (max-width: 719px) {
  .story-foot .fine {
    display: none;
  }
}

/* the side jobs, in the pause sheet */
.jobs {
  display: grid;
  gap: 0.4rem;
  margin: 0.55rem 0 1.2rem;
  padding: 0;
  list-style: none;
}
.jobs li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--graphite);
  color: var(--mist);
  font-size: var(--t-row);
}
.jobs li b {
  flex: none;
  color: var(--paper);
  font: 500 var(--t-meta) var(--mono);
}
.jobs li.is-done span {
  color: var(--fog);
  text-decoration: line-through;
}

.noscript,
.fail {
  position: fixed;
  z-index: 50;
  inset: auto var(--inset) var(--inset);
  margin: 0;
  padding: 1rem 1.2rem;
  border: 1px solid var(--smoke);
  border-radius: var(--r-card);
  background: var(--carbon);
  color: var(--bone);
}

/* ---- narrower windows ---------------------------------------------------------------- */
/* the receipt drops below the ticket before the two would touch */
@media (max-width: 1040px) {
  body:not(.is-touch) .toast {
    top: calc(var(--inset) + env(safe-area-inset-top) + 13rem);
    left: calc(var(--inset) + env(safe-area-inset-left));
    margin-left: 0;
  }
}
@media (max-width: 860px) {
  .clock {
    position: static;
    min-width: 0;
    transform: none;
  }
  .clock.is-beat {
    transform: scale(1.03);
  }
}
@media (prefers-reduced-motion: reduce) and (min-width: 861px) {
  .clock.is-beat {
    transform: translateX(-50%);
  }
}
@media (prefers-reduced-motion: reduce) and (max-width: 860px) {
  .clock.is-beat {
    transform: none;
  }
}
@media (max-width: 720px) {
  .rail {
    gap: 0.9rem;
  }
  .rail a:not([aria-current]) {
    display: none;
  }
  .title {
    align-items: flex-end;
  }
  .title-card {
    padding: 1.375rem 1.25rem 1.25rem;
  }
  .pause-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title,
  .toast,
  .dialog,
  .prompt,
  .banner,
  .hint,
  .story,
  #report .card,
  .ticket > * {
    transition-property: opacity;
  }
  body:not(.is-title) .title,
  .toast,
  .dialog,
  .banner,
  .hint,
  #report.is-entering .card,
  .ticket.is-updating > * {
    transform: none;
  }
  .c-bob,
  .c-eyes {
    animation: none;
  }
  .prompt,
  .prompt.is-on {
    transform: translateX(-50%);
  }
}
