/* Shared game layout */

.game {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100svh;
  padding: 16px var(--gutter);
  gap: 12px;
}

.page--backdrop-frame .game {
  padding: 24px 28px;
}

.game__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
}

.game__title {
  margin: 0;
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: clamp(24px, 5vw, 36px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.game__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0;
}

.game__stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.game__stat dt {
  font-size: 13px;
  color: var(--colour-muted);
}

.game__stat dd {
  margin: 0;
  font-family: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.game__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
}

.game__canvas {
  display: block;
  max-width: 100%;
  touch-action: none;
}

.game__help {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--colour-muted);
}

.game__overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  background: color-mix(in srgb, var(--colour-bg) 86%, transparent);
  text-align: center;
}

.game__overlay-title {
  margin: 0;
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: clamp(32px, 8vw, 56px);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1;
}

.game__overlay-text {
  max-width: 36ch;
  margin: 0 0 8px;
  color: var(--colour-muted);
}

.game__overlay-text:empty {
  display: none;
}

.game__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game__buttons .button {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 14px;
}

.site-footer__brand--link {
  text-decoration: none;
}

.site-footer__brand--link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Arcade hub */

.arcade {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(24px, 6vw, 64px) var(--gutter);
}

.arcade__title {
  margin: 0 0 clamp(20px, 4vw, 40px);
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: clamp(56px, 14vw, 160px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.arcade__group {
  margin: 0 0 32px;
}

.arcade__heading {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--colour-muted);
}

.arcade__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.arcade__card {
  display: grid;
  gap: 4px;
  height: 100%;
  padding: 18px;
  border: 2px solid var(--colour-fg);
  background: var(--colour-panel);
  color: var(--colour-fg);
  text-decoration: none;
  transition: translate 120ms ease;
}

.arcade__card:hover {
  translate: 0 -2px;
}

.arcade__name {
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.arcade__about {
  font-size: 14px;
  color: var(--colour-muted);
}

.arcade__best {
  margin-top: 6px;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 13px;
  font-weight: 700;
}

.arcade__best:empty {
  display: none;
}

/* Blocks */

.blocks {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.blocks__side {
  display: grid;
  gap: 8px;
  font-size: 13px;
  color: var(--colour-muted);
}

.blocks__next {
  border: 2px solid var(--colour-fg);
}

.blocks__pad {
  display: none;
}

@media (pointer: coarse) {
  .blocks__pad {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
}

/* 2048 */

.tiles {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--tile-gap);
  width: min(92vw, 62svh, 480px);
  aspect-ratio: 1;
  padding: var(--tile-gap);
  border: 2px solid var(--colour-fg);
  background: var(--colour-panel);
  touch-action: none;
  --tile-gap: clamp(6px, 1.6vw, 12px);
}

.tiles__cell {
  background: color-mix(in srgb, var(--colour-fg) 8%, var(--colour-panel));
}

.tiles__tile {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--tile-size);
  height: var(--tile-size);
  background: color-mix(in srgb, var(--colour-fg) var(--tile-strength), var(--colour-panel));
  color: var(--tile-text);
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: var(--tile-font);
  translate: var(--tile-x) var(--tile-y);
  transition: translate 110ms ease-out;
}

.tiles__tile--new {
  animation: tile-pop 160ms ease-out;
}

.tiles__tile--merged {
  animation: tile-bump 160ms ease-out;
}

@keyframes tile-pop {
  from { scale: 0.3; }
  to { scale: 1; }
}

@keyframes tile-bump {
  50% { scale: 1.12; }
}

/* Minesweeper */

.mines {
  display: grid;
  grid-template-columns: repeat(var(--mine-columns), var(--mine-size));
  gap: 2px;
  padding: 2px;
  border: 2px solid var(--colour-fg);
  background: var(--colour-fg);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.mines__cell {
  width: var(--mine-size);
  height: var(--mine-size);
  padding: 0;
  border: 0;
  background: var(--colour-panel);
  color: var(--colour-fg);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: calc(var(--mine-size) * 0.55);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.mines__cell--open {
  background: var(--colour-bg);
  cursor: default;
}

.mines__cell--boom {
  background: #d62828;
  color: #ffffff;
}

.mines__cell[data-count="1"] { color: #1d70b8; }
.mines__cell[data-count="2"] { color: #2a9d55; }
.mines__cell[data-count="3"] { color: #d62828; }
.mines__cell[data-count="4"] { color: #5b2a86; }
.mines__cell[data-count="5"] { color: #9c4a00; }
.mines__cell[data-count="6"] { color: #00838f; }

.mines__levels {
  display: flex;
  gap: 6px;
}

.mines__level[aria-pressed="true"] {
  background: var(--colour-fg);
  color: var(--colour-panel);
}

/* Reaction */

.reaction {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 24px;
  border: 2px solid var(--colour-fg);
  background: var(--colour-panel);
  color: var(--colour-fg);
  font: inherit;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.reaction--waiting {
  background: var(--colour-bg);
}

.reaction--go {
  background: var(--colour-fg);
  color: var(--colour-panel);
}

.reaction__big {
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: clamp(36px, 10vw, 96px);
  line-height: 1;
}

.reaction__small {
  max-width: 40ch;
  font-size: 15px;
  opacity: 0.75;
}

.reaction__history {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 14px;
}

/* Typing */

.typing {
  position: relative;
  display: grid;
  align-content: center;
  gap: 16px;
  width: min(100%, 860px);
}

.typing__passage {
  position: relative;
  margin: 0;
  padding: 20px;
  border: 2px solid var(--colour-fg);
  background: var(--colour-panel);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: clamp(16px, 2.4vw, 22px);
  line-height: 1.7;
  color: var(--colour-muted);
  cursor: text;
}

.typing__char--right {
  color: var(--colour-fg);
}

.typing__char--wrong {
  background: #d62828;
  color: #ffffff;
}

.typing__char--current {
  box-shadow: inset 2px 0 0 var(--colour-fg);
}

.typing__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  resize: none;
}

.typing__lengths {
  display: flex;
  gap: 6px;
}

.typing__length[aria-pressed="true"] {
  background: var(--colour-fg);
  color: var(--colour-panel);
}

/* Driving games */

.road {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.page--drive .game,
.page--cruise .game {
  grid-template-rows: 1fr;
  padding: 0;
}

.page--drive .game__bar,
.page--cruise .game__bar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  padding: 14px var(--gutter);
  color: #ffffff;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.5);
}

.page--drive .game__stat dt,
.page--cruise .game__stat dt {
  color: rgb(255 255 255 / 0.8);
}

.page--drive .game__help,
.page--cruise .game__help {
  position: absolute;
  right: 0;
  bottom: 12px;
  left: 0;
  z-index: 3;
  color: rgb(255 255 255 / 0.85);
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.6);
}

.gauges {
  position: absolute;
  bottom: 44px;
  left: var(--gutter);
  z-index: 3;
  display: grid;
  gap: 6px;
  width: min(220px, 44vw);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgb(0 0 0 / 0.6);
}

.gauge {
  display: grid;
  grid-template-columns: 52px 1fr;
  align-items: center;
  gap: 8px;
}

.gauge__bar {
  display: block;
  height: 8px;
  border: 1px solid rgb(255 255 255 / 0.8);
  background: rgb(0 0 0 / 0.35);
}

.gauge__fill {
  display: block;
  height: 100%;
  background: #ffffff;
  transform-origin: left;
  scale: var(--level, 1) 1;
}

.gauge--low .gauge__fill {
  background: #ff5a4f;
}

.drive-log {
  position: absolute;
  top: 56px;
  left: 50%;
  z-index: 3;
  margin: 0;
  padding: 8px 14px;
  background: rgb(0 0 0 / 0.55);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  translate: -50% 0;
  transition: opacity 300ms ease;
}

.drive-log:empty {
  opacity: 0;
}

.cruise-controls {
  position: absolute;
  top: 56px;
  right: var(--gutter);
  z-index: 3;
  display: flex;
  gap: 6px;
}

.cruise-controls .button {
  min-height: 34px;
  padding: 4px 12px;
  font-size: 13px;
}

.page--cruise .game__help {
  transition: opacity 400ms ease;
}

.page--cruise.page--idle .game__bar,
.page--cruise.page--idle .game__help,
.page--cruise.page--idle .cruise-controls {
  opacity: 0;
  transition: opacity 800ms ease;
}

/* Paint */

.page--draw {
  background-image: none !important;
}

.paint {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100vh;
  height: 100svh;
  background: var(--colour-panel);
  color: var(--colour-fg);
  font-size: 13px;
}

.paint__menu {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--colour-muted);
}

.paint__menu-title {
  margin: 0 12px 0 4px;
  font-family: "Archivo Black", "Arial Black", sans-serif;
  font-size: 16px;
  font-weight: 400;
}

.paint__command {
  padding: 4px 10px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
}

.paint__command:hover,
.paint__command:focus-visible {
  border-color: var(--colour-muted);
}

.paint__command:disabled {
  opacity: 0.4;
  cursor: default;
}

.paint__ribbon {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 8px;
  border-bottom: 1px solid var(--colour-muted);
}

.paint__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.paint__group-name {
  width: 100%;
  font-size: 11px;
  color: var(--colour-muted);
}

.paint__tool {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--colour-muted);
  background: var(--colour-bg);
  cursor: pointer;
}

.paint__tool[aria-pressed="true"] {
  border-color: var(--colour-fg);
  box-shadow: inset 0 0 0 2px var(--colour-fg);
}

.paint__tool svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.paint__size {
  width: 110px;
}

.paint__swatches {
  display: grid;
  grid-template-columns: repeat(10, 20px);
  gap: 3px;
}

.paint__swatch {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--colour-muted);
  background: var(--swatch);
  cursor: pointer;
}

.paint__current {
  position: relative;
  width: 44px;
  height: 44px;
  cursor: pointer;
}

.paint__colour {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid var(--colour-fg);
  background: var(--swatch);
}

.paint__colour--primary {
  top: 0;
  left: 0;
  z-index: 1;
}

.paint__colour--secondary {
  right: 0;
  bottom: 0;
}

.paint__picker {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--colour-muted);
  background: none;
  cursor: pointer;
}

.paint__workspace {
  position: relative;
  overflow: auto;
  padding: 12px;
  background: color-mix(in srgb, var(--colour-fg) 14%, var(--colour-bg));
}

.paint__sheet {
  position: relative;
  width: max-content;
}

.paint__canvas,
.paint__preview {
  display: block;
  background: #ffffff;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.25);
  touch-action: none;
  image-rendering: pixelated;
}

.paint__preview {
  position: absolute;
  inset: 0;
  background: none;
  box-shadow: none;
  pointer-events: none;
}

.paint__floating {
  position: absolute;
  outline: 1px dashed #000000;
  box-shadow: 0 0 0 1px #ffffff;
  cursor: move;
  touch-action: none;
}

.paint__floating canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.paint__handle {
  position: absolute;
  right: -6px;
  bottom: -6px;
  width: 12px;
  height: 12px;
  border: 1px solid #000000;
  background: #ffffff;
  cursor: nwse-resize;
}

.paint__text {
  position: absolute;
  min-width: 80px;
  padding: 2px;
  border: 1px dashed #000000;
  background: transparent;
  font-family: system-ui, sans-serif;
  line-height: 1.2;
  resize: both;
}

.paint__status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding: 4px 8px;
  border-top: 1px solid var(--colour-muted);
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--colour-muted);
}

.paint__drop {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  border: 3px dashed var(--colour-fg);
  background: color-mix(in srgb, var(--colour-bg) 80%, transparent);
  font-size: 20px;
  font-weight: 700;
  pointer-events: none;
}

.paint__file {
  display: none;
}

.resize-dialog {
  width: min(360px, calc(100vw - 32px));
}

.resize-dialog__form {
  display: grid;
  gap: 12px;
  padding: 24px;
}

.resize-dialog__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.resize-dialog__field {
  display: grid;
  gap: 4px;
  font-size: 14px;
}

.resize-dialog__field input {
  padding: 8px 10px;
  border: 2px solid var(--colour-fg);
  background: var(--colour-bg);
  color: var(--colour-fg);
  font: 600 16px var(--font-body);
}

/* Stopwatch and timer on /time */

.clock__laps {
  display: grid;
  gap: 2px;
  max-height: 22svh;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 15px;
  color: var(--colour-muted);
  counter-reset: lap;
}

.clock__laps li {
  display: flex;
  justify-content: space-between;
  gap: 32px;
}

.clock__controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.clock__setter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "Space Mono", ui-monospace, monospace;
  font-size: 22px;
  font-weight: 700;
}

.clock__setter input {
  box-sizing: content-box;
  width: 2ch;
  padding: 4px 6px;
  -moz-appearance: textfield;
  appearance: textfield;
  border: 2px solid var(--colour-fg);
  background: var(--colour-panel);
  color: var(--colour-fg);
  font: inherit;
  text-align: center;
}

.clock__presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.clock__presets .button {
  min-height: 34px;
  padding: 4px 12px;
  font-size: 13px;
}

.clock__setter input::-webkit-outer-spin-button,
.clock__setter input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.clock--done .clock__time {
  animation: timer-flash 1s steps(2, start) infinite;
}

@keyframes timer-flash {
  to { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .tiles__tile {
    transition: none;
  }

  .tiles__tile--new,
  .tiles__tile--merged,
  .clock__setter input::-webkit-outer-spin-button,
.clock__setter input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.clock--done .clock__time {
    animation: none;
  }
}

.pull-in {
  position: absolute;
  top: 128px;
  left: 50%;
  z-index: 4;
  translate: -50% 0;
}

.paint__command[aria-pressed="true"] {
  border-color: var(--colour-fg);
  font-weight: 700;
}

.footer-menu__link[aria-current="true"] {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Touch screens */

.game,
.paint {
  touch-action: manipulation;
}

.game--snake .game__stage,
.game--blocks .game__stage,
.game--tiles .game__stage,
.game--lanes .game__stage {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.game__help-touch,
.dpad,
.mines__flag {
  display: none;
}

.dpad {
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 48px);
  gap: 4px;
}

.dpad__button {
  min-height: 0;
  padding: 0;
  font-size: 20px;
}

.dpad__button--up { grid-area: up; }
.dpad__button--left { grid-area: left; }
.dpad__button--right { grid-area: right; }
.dpad__button--down { grid-area: down; }

.mines__flag[aria-pressed="true"] {
  background: var(--colour-fg);
  color: var(--colour-panel);
}

@media (pointer: coarse) {
  .game__help-keys {
    display: none;
  }

  .game__help-touch {
    display: inline;
  }

  .game--snake .game__stage {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 12px;
  }

  .dpad,
  .mines__flag {
    display: grid;
  }

  .mines__flag {
    display: inline-flex;
    align-items: center;
  }

  .game--blocks .game__stage {
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .game--blocks .blocks__pad {
    width: min(100%, 360px);
  }

  .game--blocks .blocks__pad .button {
    min-height: 48px;
    font-size: 20px;
  }
}

@media (max-width: 600px) {
  .page--drive .game__bar,
  .page--cruise .game__bar {
    padding: 10px 12px;
  }

  .page--drive .game__title,
  .page--cruise .game__title {
    font-size: 20px;
  }

  .page--drive .game__stat dd,
  .page--cruise .game__stat dd {
    font-size: 15px;
  }

  .drive-log {
    top: 110px;
    width: calc(100% - 24px);
    text-align: center;
  }

  .pull-in {
    top: 180px;
  }

  .gauges {
    bottom: 72px;
    left: 12px;
    width: min(180px, 46vw);
    font-size: 11px;
  }

  .cruise-controls {
    top: auto;
    bottom: 76px;
    left: 12px;
    right: 12px;
    justify-content: center;
  }
}

/* Long Drive and Cruise */

.trip {
  --trip-ink: #ece8de;
  --trip-muted: rgb(236 232 222 / 0.62);
  --trip-panel: rgb(24 25 28 / 0.62);
  --trip-line: rgb(236 232 222 / 0.22);
  --trip-serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --trip-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color: var(--trip-ink);
  font-family: var(--trip-mono);
}

.trip .game__stage {
  overflow: hidden;
  background: #2a2b30;
}

.trip__top {
  position: absolute;
  top: 22px;
  left: 28px;
  z-index: 3;
  display: grid;
  gap: 4px;
  max-width: calc(100% - 380px);
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.25);
  pointer-events: none;
}

.trip__place {
  margin: 0;
  font-family: var(--trip-serif);
  font-size: clamp(30px, 3.4vw, 46px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.05;
}

.trip__meta {
  margin: 0;
  color: var(--trip-muted);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.trip__passengers {
  display: grid;
  gap: 2px;
  margin: 8px 0 0;
  padding: 0;
  font-size: 13px;
  list-style: none;
}

.trip__passengers[hidden] {
  display: none;
}

.trip__passenger::before {
  content: "Passenger: ";
  color: var(--trip-muted);
}

.trip__dash {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 40px;
  padding: 0 28px 22px;
  pointer-events: none;
}

.trip__speedo {
  width: 140px;
  height: 140px;
}

.trip__readout {
  display: grid;
  gap: 8px;
  padding-bottom: 10px;
}

.trip__label {
  color: var(--trip-muted);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.trip__bar {
  display: block;
  width: 170px;
  height: 3px;
  background: var(--trip-line);
}

.trip__fill {
  display: block;
  height: 100%;
  background: var(--trip-ink);
  transform-origin: left;
  scale: var(--level, 1) 1;
}

.trip__bar--low .trip__fill {
  background: #e0896a;
}

.trip__note {
  color: var(--trip-muted);
  font-size: 12px;
}

.trip__value {
  font-size: 19px;
}

.trip__cans {
  display: flex;
  gap: 5px;
  height: 18px;
}

.trip__can {
  width: 13px;
  height: 18px;
  border: 1px dashed rgb(236 232 222 / 0.5);
  border-radius: 2px;
}

.trip__can--holder {
  border-style: dotted;
  border-color: rgb(236 232 222 / 0.3);
  height: 8px;
  align-self: end;
}

.trip__can--full {
  border-style: solid;
  background: rgb(236 232 222 / 0.82);
}

.trip__readout--wear {
  grid-template-columns: auto 90px;
  align-items: center;
  gap: 6px 12px;
}

.trip__readout--wear .trip__bar {
  width: 90px;
}

.trip__message {
  position: absolute;
  right: 36px;
  bottom: 34px;
  z-index: 3;
  max-width: min(44ch, 46vw);
  margin: 0;
  font-family: var(--trip-serif);
  font-size: 23px;
  font-style: italic;
  line-height: 1.3;
  text-align: right;
  text-shadow: 0 1px 10px rgb(0 0 0 / 0.35);
  transition: opacity 400ms ease;
}

.trip__message:empty {
  opacity: 0;
}

.trip__action {
  position: absolute;
  top: 30%;
  left: 50%;
  z-index: 4;
  padding: 10px 22px;
  border: 1px solid var(--trip-line);
  border-radius: 6px;
  background: rgb(24 25 28 / 0.72);
  color: var(--trip-ink);
  font-family: var(--trip-serif);
  font-size: 21px;
  font-style: italic;
  cursor: pointer;
  translate: -50% 0;
}

.trip__action--quiet {
  top: calc(30% + 62px);
  font-size: 18px;
}

.trip__action:hover,
.trip__action:focus-visible {
  border-color: rgb(236 232 222 / 0.6);
}

.trip .radio {
  position: absolute;
  top: 22px;
  right: 28px;
  z-index: 3;
  display: grid;
  grid-template-columns: 30px 1fr 30px auto;
  align-items: center;
  gap: 6px;
  width: 340px;
  padding: 8px;
  border-radius: 10px;
  background: var(--trip-panel);
  font-size: 12px;
}

.radio__button,
.radio__power {
  min-height: 30px;
  border: 1px solid var(--trip-line);
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.radio__button {
  font-size: 17px;
  line-height: 1;
}

.radio__power {
  padding: 0 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.radio__display {
  display: grid;
  margin: 0;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgb(12 12 14 / 0.7);
  color: var(--trip-muted);
  line-height: 1.3;
  text-align: center;
  overflow: hidden;
}

.radio--on .radio__display {
  color: #e9c9a0;
}

.radio__frequency {
  font-size: 15px;
}

.radio__name,
.radio__status {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.radio__status {
  color: var(--trip-muted);
  font-size: 9px;
}

.radio--on .radio__status {
  color: #c9a77e;
}

.radio__volume {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 8px;
  color: var(--trip-muted);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.radio__volume input {
  flex: 1;
  accent-color: #e9c9a0;
}

.trip .game__overlay {
  place-content: center start;
  justify-items: start;
  gap: 18px;
  padding: 6vh 6vw;
  background: linear-gradient(90deg, rgb(26 27 32 / 0.72), rgb(26 27 32 / 0.25) 60%, rgb(26 27 32 / 0));
  color: var(--trip-ink);
  text-align: left;
  overflow-y: auto;
}

.trip .game__overlay-title {
  font-family: var(--trip-serif);
  font-size: clamp(54px, 9vw, 120px);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.trip .game__overlay-text {
  max-width: 34em;
  margin: 0;
  color: rgb(236 232 222 / 0.85);
  font-family: var(--trip-serif);
  font-size: clamp(18px, 1.8vw, 24px);
  line-height: 1.5;
}

.trip__keys {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 14px;
}

.trip__keys div {
  display: grid;
  grid-template-columns: 90px 1fr;
}

.trip__keys dt {
  color: var(--trip-ink);
}

.trip__keys dd {
  margin: 0;
  color: var(--trip-muted);
}

.trip__touch,
.trip__best {
  margin: 0;
  color: var(--trip-muted);
  font-size: 13px;
}

.trip__touch {
  display: none;
}

.trip__start {
  padding: 0 0 2px;
  border: 0;
  border-bottom: 1px solid rgb(236 232 222 / 0.5);
  background: none;
  color: var(--trip-ink);
  font-family: var(--trip-serif);
  font-size: 28px;
  font-style: italic;
  cursor: pointer;
}

.trip .cruise-controls {
  top: auto;
  right: auto;
  bottom: 22px;
  left: 28px;
  flex-wrap: wrap;
}

.trip__chip {
  padding: 6px 12px;
  border: 1px solid var(--trip-line);
  border-radius: 999px;
  background: var(--trip-panel);
  color: var(--trip-ink);
  font-family: var(--trip-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.trip__hint {
  position: absolute;
  right: 28px;
  bottom: 26px;
  z-index: 3;
  margin: 0;
  color: var(--trip-muted);
  font-size: 12px;
}

.page--cruise .trip__hint,
.page--cruise .trip .radio,
.page--cruise .trip .cruise-controls {
  transition: opacity 600ms ease;
}

.page--cruise.page--idle .trip__hint,
.page--cruise.page--idle .trip .radio,
.page--cruise.page--idle .trip .cruise-controls {
  opacity: 0;
}

@media (pointer: coarse) {
  .trip__keys {
    display: none;
  }

  .trip__touch {
    display: block;
  }
}

@media (max-width: 760px) {
  .trip__top {
    top: 14px;
    left: 16px;
    max-width: calc(100% - 190px);
  }

  .trip__place {
    font-size: 28px;
  }

  .trip__meta {
    font-size: 10px;
  }

  .trip__passengers {
    font-size: 11px;
  }

  .trip .radio {
    top: 14px;
    right: 12px;
    grid-template-columns: 26px 1fr 26px;
    width: 160px;
    padding: 6px;
  }

  .trip .radio__power,
  .trip .radio__volume {
    grid-column: 1 / -1;
  }

  .trip .radio__volume-label {
    display: none;
  }

  .trip__dash {
    display: grid;
    grid-template-areas:
      "speedo fuel fuel"
      "speedo cans money"
      "wear wear wear";
    grid-template-columns: 84px 1fr auto;
    align-items: end;
    gap: 8px 14px;
    padding: 0 14px 12px;
  }

  .trip__speedo {
    grid-area: speedo;
    width: 84px;
    height: 84px;
  }

  .trip__readout {
    gap: 4px;
    padding-bottom: 0;
  }

  .trip__readout--fuel {
    grid-area: fuel;
  }

  .trip__readout:nth-of-type(2) {
    grid-area: cans;
  }

  .trip__readout:nth-of-type(3) {
    grid-area: money;
  }

  .trip__bar {
    width: 100%;
  }

  .trip__value {
    font-size: 16px;
  }

  .trip__readout--wear {
    grid-area: wear;
    grid-template-columns: auto 1fr auto 1fr;
    gap: 5px 10px;
  }

  .trip__readout--wear .trip__bar {
    width: 100%;
  }

  .trip__label {
    font-size: 9px;
  }

  .trip__message {
    top: 38%;
    right: 16px;
    bottom: auto;
    left: 16px;
    max-width: none;
    font-size: 19px;
    text-align: center;
  }

  .trip__action {
    top: 52%;
  }

  .trip__action--quiet {
    top: calc(52% + 58px);
  }

  .trip .cruise-controls {
    right: 16px;
    bottom: 50px;
    left: 16px;
  }

  .trip__hint {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }
}

.trip .game__stage:has(> .game__overlay:not([hidden])) :is(.trip__top, .trip__dash, .radio, .trip__message) {
  opacity: 0;
  pointer-events: none;
}

.trip__menu-button {
  position: absolute;
  top: 132px;
  right: 28px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--trip-line);
  border-radius: 999px;
  background: var(--trip-panel);
  color: var(--trip-ink);
  font-family: var(--trip-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.trip__menu-button:hover,
.trip__menu-button:focus-visible {
  border-color: rgb(236 232 222 / 0.6);
}

.trip__kbd {
  padding: 1px 5px;
  border: 1px solid var(--trip-line);
  border-radius: 3px;
  color: var(--trip-muted);
  font: inherit;
  font-size: 9px;
}

.trip__board {
  margin: 0;
  color: var(--trip-ink);
  font-family: var(--trip-serif);
  font-size: 18px;
  font-style: italic;
}

.trip__board:empty {
  display: none;
}

.trip__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 0;
}

.trip__link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--trip-muted);
  font-family: var(--trip-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-transform: uppercase;
  cursor: pointer;
}

.trip__link:hover,
.trip__link:focus-visible {
  color: var(--trip-ink);
}

.trip .game__stage:has(> .game__overlay:not([hidden])) .trip__menu-button {
  display: none;
}

@media (max-width: 760px) {
  .trip__menu-button {
    top: 136px;
    right: 12px;
  }

  .trip__kbd {
    display: none;
  }
}

@media (pointer: coarse) {
  .trip__kbd {
    display: none;
  }
}

.trip__action--low {
  top: calc(30% + 112px);
}

.trip__starts {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 28px;
}

.trip__start--daily {
  font-size: 20px;
}

.trip-log--end {
  width: min(560px, 100%);
  max-height: 24vh;
  padding: 12px 16px;
  border-left: 1px solid var(--trip-line);
  background: rgb(24 25 28 / 0.4);
}

.trip-log--end[hidden] {
  display: none;
}

.trip-log--end .trip-log__when {
  color: var(--trip-muted);
}

.trip-log--end .trip-log__text {
  color: var(--trip-ink);
}

.workshop__ground {
  fill: #b9b2a3;
}

.workshop__jack {
  fill: #c1121f;
  cursor: pointer;
}

.workshop__body {
  fill: #9a4c3c;
}

.workshop__arch {
  fill: #2a2a2c;
}

.workshop__wheel {
  transition: translate 400ms ease, opacity 400ms ease;
}

.workshop__wheel--off {
  opacity: 0.25;
  translate: 0 12px;
}

.workshop__tyre {
  fill: #1d1e20;
}

.workshop__rim {
  fill: #8d8f8c;
}

.workshop__hub {
  fill: #4a4b4e;
}

.workshop__nut {
  fill: #d8d2c4;
  stroke: #23221f;
  stroke-width: 1.5;
  cursor: pointer;
}

.workshop__nut:focus-visible {
  outline: none;
  stroke: #8a3f2e;
  stroke-width: 3;
}

.workshop__nut--loose {
  fill: #5d5f5e;
}

.workshop__nut--tight {
  fill: #2a7d4f;
}

.workshop__nut--hint {
  stroke: #e0a040;
  stroke-width: 3;
}

.workshop__dial {
  fill: none;
  stroke: #b9b2a3;
  stroke-width: 14;
}

.workshop__band {
  fill: none;
  stroke: #2a7d4f;
  stroke-width: 14;
}

.workshop__needle {
  stroke: #a1281c;
  stroke-width: 3;
  stroke-linecap: round;
}

.workshop__bolt {
  fill: #b9b2a3;
}

.workshop__bolt--done {
  fill: #2a7d4f;
}

@media (max-width: 760px) {
  .trip__action--low {
    top: calc(52% + 108px);
  }
}

.trip-log--end {
  min-height: min(9em, 24vh);
}

.trip__intro--ended :is(.trip__keys, .trip__touch) {
  display: none;
}

.trip__cruise {
  position: absolute;
  top: 172px;
  right: 28px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--trip-line);
  border-radius: 999px;
  background: var(--trip-panel);
  color: var(--trip-muted);
  font-family: var(--trip-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.trip__cruise[hidden] {
  display: none;
}

.trip__cruise[aria-pressed="true"] {
  border-color: rgb(150 214 160 / 0.7);
  color: #bfe6c4;
}

.trip__cruise:hover,
.trip__cruise:focus-visible {
  border-color: rgb(236 232 222 / 0.6);
}

.trip .game__stage:has(> .game__overlay:not([hidden])) .trip__cruise {
  display: none;
}

@media (max-width: 760px) {
  .trip__cruise {
    top: 176px;
    right: 12px;
  }
}
