/* CRASH OF THE NIGHT (/crash/): the nightly crash short on an arcade cabinet,
   and THE CRASH BOARD under it. The site's tokens (site.css) for the page;
   the short's own 8-bit palette and its own 5x7 letters (Dip Pixel, built
   from tools/shorts-engine/daily/pixel-font.mjs) for the machine. */

@font-face {
  font-family: 'Dip Pixel';
  src: url('/fonts/DipPixel.woff2') format('woff2');
  font-display: swap;
}

.crash-page {
  /* the short's palette (crash-8bit.mjs P) */
  --px-bg0: #0a0d1e;
  --px-cyan: #5ee6ff;
  --px-green: #3ef08a;
  --px-red: #ff4b5c;
  --px-gold: #ffcf6e;
  --cab-body: #151b31;
  --cab-edge: #232b4a;
}

.px {
  font-family: 'Dip Pixel', 'Spline Sans Mono', ui-monospace, monospace;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: uppercase;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

.crash { padding-block: clamp(24px, 5vw, 64px) 48px; }

/* ── the hero: the cabinet beside the words ─────────────────────────────── */
.crash-hero {
  display: grid;
  grid-template-columns: minmax(0, 400px) minmax(0, 1fr);
  gap: clamp(28px, 6vw, 88px);
  align-items: center;
}
@media (max-width: 860px) {
  .crash-hero { grid-template-columns: 1fr; justify-items: center; }
  .crash-side { text-align: center; }
}

/* the cabinet: a marquee, a bezel round a portrait screen, a control deck,
   a coin door. Hard edges and stepped shadows, no gradients that read soft. */
.cab {
  position: relative;
  width: min(100%, 400px);
  padding: 14px 18px 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 8px, rgba(255, 255, 255, 0.025) 8px 16px),
    var(--cab-body);
  border: 4px solid #070914;
  box-shadow:
    inset 6px 0 0 var(--cab-edge), inset -6px 0 0 #0d1124,
    0 0 0 4px #070914, 12px 12px 0 rgba(0, 0, 0, 0.45),
    0 0 60px rgba(var(--down-rgb), 0.12);
  image-rendering: pixelated;
}
/* the side art: a stepped red line falling down each flank */
.cab::before, .cab::after {
  content: '';
  position: absolute;
  top: 74px;
  bottom: 120px;
  width: 6px;
  background: repeating-linear-gradient(180deg, var(--px-red) 0 12px, transparent 12px 18px, var(--px-gold) 18px 24px, transparent 24px 36px);
  opacity: 0.85;
}
.cab::before { left: 4px; }
.cab::after { right: 4px; }

.cab__marquee {
  position: relative;
  display: grid;
  place-items: center;
  height: 58px;
  margin: 0 -4px 14px;
  background: #05060d;
  border: 4px solid #2c3458;
  overflow: hidden;
}
.cab__title {
  position: relative;
  font-size: 20px;
  line-height: 1;
  color: var(--px-gold);
  text-shadow: 3px 3px 0 #7a2430, 0 0 18px rgba(255, 207, 110, 0.55);
}
/* the bulbs: a dotted frame that chases */
.cab__bulbs {
  position: absolute;
  inset: 4px;
  border: 4px dotted var(--px-gold);
  opacity: 0.55;
  animation: cab-chase 0.9s steps(2) infinite;
}
@keyframes cab-chase { 50% { opacity: 0.18; } }

.cab__bezel {
  padding: 14px;
  background: #090b16;
  border: 4px solid #2c3458;
  box-shadow: inset 0 0 0 4px #000;
}
.cab__screen {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--px-bg0);
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.8);
}
.cab__screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  background: var(--px-bg0);
}
/* the tube: scanlines and a curved dark edge, over the picture */
.cab__scan {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(120% 90% at 50% 50%, transparent 62%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
}
.cab__osd {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 20px;
  color: var(--px-green);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s steps(2);
}
.cab__osd.on { opacity: 1; }
.cab__coin {
  position: absolute;
  left: 50%;
  bottom: 5%;
  translate: -50% 0;
  display: grid;
  gap: 6px;
  padding: 12px 16px;
  white-space: nowrap;
  line-height: 1;
  color: var(--px-gold);
  background: rgba(5, 6, 13, 0.82);
  border: 3px solid var(--px-gold);
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
}
.cab__coin span { font-size: 20px; animation: cab-blink 1.1s steps(1) infinite; }
.cab__coin small { font-family: 'Spline Sans Mono', monospace; font-size: 11px; letter-spacing: 0.08em; color: var(--ink2); }
.cab__coin:hover, .cab__coin:focus-visible { background: #000; outline: none; }
.cab__coin:hover span, .cab__coin:focus-visible span { animation: none; }
.cab__coin[hidden] { display: none; }
@keyframes cab-blink { 60% { opacity: 0; } }
.cab__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 10px;
  margin: 0;
  text-align: center;
  font-size: 20px;
  color: var(--ink2);
  background: repeating-linear-gradient(0deg, #0b0e1a 0 2px, #12162a 2px 4px);
}
.cab__empty[hidden] { display: none; }
.cab__empty small { font-family: 'Spline Sans Mono', monospace; font-size: 11px; letter-spacing: 0.08em; color: var(--ink-mute); }

/* the deck: < joystick > */
.cab__deck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
  height: 92px;
  margin: 14px -18px 0;
  background: linear-gradient(180deg, #1d2440 0 50%, #11162a 50%);
  border-top: 4px solid #070914;
  border-bottom: 4px solid #070914;
}
.cab__btn {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid #070914;
  font-size: 18px;
  color: #fff;
  cursor: pointer;
  box-shadow: inset -4px -6px 0 rgba(0, 0, 0, 0.3), 0 6px 0 #070914;
  transition: translate var(--d-press) steps(1), box-shadow var(--d-press) steps(1);
}
.cab__btn--prev { background: var(--px-green); color: #062a17; }
.cab__btn--next { background: var(--px-red); color: #3a0710; }
.cab__btn:active { translate: 0 4px; box-shadow: inset -4px -6px 0 rgba(0, 0, 0, 0.3), 0 2px 0 #070914; }
.cab__btn:disabled { filter: grayscale(0.85) brightness(0.6); cursor: default; }
.cab__stick {
  position: relative;
  width: 44px;
  height: 22px;
  border-radius: 50%;
  background: #070914;
}
.cab__stick i {
  position: absolute;
  left: 50%;
  bottom: 9px;
  width: 8px;
  height: 34px;
  translate: -50% 0;
  background: #9aa4bd;
  transform-origin: 50% 100%;
  transition: rotate 0.12s steps(2);
}
.cab__stick i::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -16px;
  width: 26px;
  height: 26px;
  translate: -50% 0;
  border-radius: 50%;
  background: var(--px-gold);
  box-shadow: inset -4px -5px 0 #b8892c;
}
.cab[data-lean='prev'] .cab__stick i { rotate: -22deg; }
.cab[data-lean='next'] .cab__stick i { rotate: 22deg; }

.cab__door {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  height: 64px;
  font-size: 11px;
  color: var(--px-red);
  text-shadow: 0 0 10px rgba(255, 75, 92, 0.7);
}
.cab__door i {
  width: 22px;
  height: 30px;
  background: #070914;
  border: 3px solid #39426a;
  box-shadow: inset 0 0 0 5px #1b2140;
}

/* ── the words ────────────────────────────────────────────────────────────
   The pixel face only at whole multiples of its pixel (10 px = one dot), so
   every letter lands on the grid; small labels are the site's mono. */
.crash-side { min-width: 0; }
.crash-kicker, .led__k, .led__s, .led__foot, .crash-clock, .board__key, .board__sub, .row__sub {
  font-family: 'Spline Sans Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  -webkit-font-smoothing: auto;
}
.crash-kicker { margin: 0 0 16px; color: var(--px-red); }
.crash-side h1 {
  margin: 0 0 20px;
  font-size: 40px;
  line-height: 1.1;
  color: var(--px-gold);
  text-shadow: 4px 4px 0 #7a2430;
  text-wrap: balance;
}
@media (min-width: 1100px) { .crash-side h1 { font-size: 60px; } }
.crash-lede { max-width: 32em; margin: 0 0 28px; color: var(--ink2); font-size: 17px; line-height: 1.6; }
@media (max-width: 860px) { .crash-lede { margin-inline: auto; } }

/* the readout: two numbers, what it did and what it paid */
.led {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  max-width: 460px;
  padding: 4px;
  background: #05060d;
  border: 3px solid #2c3458;
}
@media (max-width: 860px) { .led { margin-inline: auto; } }
.led__cell { display: grid; gap: 10px; padding: 14px 16px 16px; background: #0b0f20; text-align: left; min-width: 0; }
.led__k { color: var(--ink-mute); }
.led__v { font-size: 30px; line-height: 1; font-weight: 400; white-space: nowrap; }
.led__v.dn { color: var(--px-red); text-shadow: 0 0 12px rgba(255, 75, 92, 0.45); }
.led__v.up { color: var(--px-green); text-shadow: 0 0 12px rgba(62, 240, 138, 0.4); }
.led__s { color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.led__cell--paid { background: #0b1a17; }
.led__foot { max-width: 460px; margin: 10px 0 28px; color: var(--ink-mute); font-size: 11px; }
@media (max-width: 860px) { .led__foot { margin-inline: auto; } }
.led.flick .led__v { animation: led-in 0.32s steps(3); }
@keyframes led-in { 0% { opacity: 0; } 50% { opacity: 1; } 70% { opacity: 0.2; } }
@media (max-width: 400px) { .led__v { font-size: 20px; } .led__cell { padding: 12px; } }

.crash-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
@media (max-width: 860px) { .crash-cta { justify-content: center; } }
.crash-clock { color: var(--ink-mute); }
.crash-clock b { color: var(--px-gold); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ── THE CRASH BOARD: the nights, ranked by what buying the dip paid ─────── */
.board {
  max-width: 820px;
  margin: clamp(64px, 10vw, 112px) auto 0;
  padding: 28px clamp(16px, 3.5vw, 32px) 24px;
  background: #070912;
  border: 4px solid #2c3458;
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.4);
}
.board__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; }
.board h2 { margin: 0 0 10px; font-size: 30px; line-height: 1; color: var(--px-gold); text-shadow: 3px 3px 0 #7a2430; }
@media (max-width: 400px) { .board h2 { font-size: 20px; } }
.board__sub { margin: 0; color: var(--ink-mute); text-transform: none; letter-spacing: 0.02em; }
.board__tabs { display: flex; gap: 6px; }
.board__tabs button {
  padding: 9px 12px 8px;
  font-size: 10px;
  line-height: 1;
  color: var(--ink2);
  background: transparent;
  border: 2px solid #2c3458;
  cursor: pointer;
}
.board__tabs button:hover { border-color: var(--px-cyan); }
.board__tabs button[aria-selected='true'] { color: #05060d; background: var(--px-cyan); border-color: var(--px-cyan); }
.board__tabs button:focus-visible { outline: 2px solid var(--px-gold); outline-offset: 2px; }

/* one grid for the key and the rows, so every column lines up */
.board__key, .row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 96px 132px; align-items: center; gap: 12px; }
.board__key { padding: 0 12px 10px; margin: 0; color: var(--ink-mute); font-size: 11px; border-bottom: 2px solid #1c223d; }
.board__key .dr, .board__key .pd { text-align: right; }
.board__rows { list-style: none; margin: 0; padding: 0; }
.board__rows li + li { border-top: 2px dashed #161b33; }
.row {
  width: 100%;
  padding: 14px 12px;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.row:hover { background: #0e1328; }
.row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--px-cyan); }
.row__v { font-family: 'Dip Pixel', monospace; font-size: 20px; line-height: 1; white-space: nowrap; }
.row__sub { display: block; margin-top: 7px; color: var(--ink-mute); font-size: 11px; white-space: nowrap; }
.row .rk .row__v { color: var(--ink-mute); }
.row .nt .row__v { color: var(--px-cyan); }
.row .dr, .row .pd { text-align: right; }
.row .dr .row__v { color: var(--px-red); }
.row .pd .row__v { color: var(--px-green); }
.row[aria-current='true'] { background: #121833; box-shadow: inset 4px 0 0 var(--px-gold); }
.row .tag { display: inline-block; margin-left: 8px; padding: 3px 5px 2px; font-family: 'Spline Sans Mono', monospace; font-size: 10px; letter-spacing: 0.06em; line-height: 1; color: #05060d; background: var(--px-gold); vertical-align: 3px; }
/* the podium on BEST DIPS */
.board[data-order='paid'] li:nth-child(1) .rk .row__v { color: var(--px-gold); }
.board[data-order='paid'] li:nth-child(2) .rk .row__v { color: #c9d3e6; }
.board[data-order='paid'] li:nth-child(3) .rk .row__v { color: #d9925b; }
.board[data-order='paid'] li:nth-child(-n+3) .pd .row__v { text-shadow: 0 0 12px rgba(62, 240, 138, 0.45); }
@media (max-width: 560px) {
  .board__key, .row { grid-template-columns: 34px minmax(0, 1fr) 76px 86px; gap: 8px; }
  .board__key, .row { padding-inline: 6px; }
  .row__v { font-size: 20px; }
  .row .tag { display: none; }
}
@media (max-width: 380px) {
  .board__key, .row { grid-template-columns: 30px minmax(0, 1fr) 0 86px; }
  .row .dr, .board__key .dr { visibility: hidden; overflow: hidden; }
}
.board__note { margin: 20px 0 0; font-size: 13px; line-height: 1.55; color: var(--ink-mute); max-width: 62em; }

@media (prefers-reduced-motion: reduce) {
  .cab__bulbs, .cab__coin span { animation: none; }
  .led.flick .led__v { animation: none; }
}
