/* Cases, the wheel, the battle formats, and the deck's three routes.
 *
 * Its own stylesheet rather than another eight hundred lines on the end of surfaces.css,
 * which was already the largest file in the project and had stopped being navigable.
 * Everything in here belongs to surfaces that did not exist before this release, so the
 * split falls on a real seam rather than an arbitrary line number.
 */

/* ══ the deck's three routes ══════════════════════════════════════════════

   The old deck stacked three chip groups of very different weight in one column, and the
   lightest of them — three mode buttons — was given a panel sized for a section. That is
   what read as empty and uneven, and no amount of padding was going to fix a structure
   that promised a box and delivered a stub.

   A route is a panel that earns its box: a heading saying what this way of deciding *is*,
   the controls it needs, and the button that commits to it. */
.route {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border-radius: var(--r-md);
  background: linear-gradient(168deg, var(--shell-hi), var(--shell-lo));
  box-shadow: inset 0 0 0 1px var(--well-line), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.route-head {
  display: grid;
  gap: var(--sp-1);
}

.route-title {
  font-family: var(--font-marker);
  font-size: var(--step-2);
  color: var(--label);
  letter-spacing: 0.01em;
}

.route-sub {
  font-family: var(--font-label);
  font-size: var(--step--1);
  color: var(--osd-dim);
  max-width: 58ch;
}

/* The battle and case panels are wide and short; their button sits beside the copy
   rather than under it, so neither leaves a band of dead space. */
.route-battle,
.route-cases {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.route-battle > .route-head,
.route-cases > .route-head,
.route-battle > .route-body,
.route-cases > .deck-case-row,
.route-cases > .quiet-line {
  grid-column: 1;
}

.route-battle > .key,
.route-cases > .key {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .route-battle,
  .route-cases {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-battle > .key,
  .route-cases > .key {
    grid-column: 1;
    grid-row: auto;
  }
}

/* A chip that is a sample rather than a control. It must not look pressable, or the
   format preview reads as six buttons that do nothing. */
.chip.is-static {
  pointer-events: none;
  opacity: 0.72;
}

.bf-preview {
  display: grid;
  gap: var(--sp-2);
}

/* ── the case lids on the deck ─────────────────────────────────────────── */
.deck-case-row {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.deck-case {
  display: grid;
  gap: var(--sp-2);
  justify-items: center;
  width: 96px;
  padding: var(--sp-2);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--osd);
  cursor: pointer;
}

.deck-case:hover {
  background: rgba(255, 255, 255, 0.05);
}

.deck-case-svg {
  width: 100%;
  height: 52px;
  display: block;
}

.deck-case-name {
  font-family: var(--font-label);
  font-size: var(--step--2);
  color: var(--osd-dim);
  text-align: center;
  line-height: 1.2;
}

/* ══ the case shelf ═══════════════════════════════════════════════════════ */

.case-tabs {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--well-line);
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(192px, 1fr));
  gap: var(--sp-4);
  padding: var(--sp-4);
}

.case-card {
  display: grid;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border: 0;
  border-radius: var(--r-md);
  background: linear-gradient(168deg, var(--shell-hi), var(--shell-lo));
  box-shadow: inset 0 0 0 1px var(--well-line);
  color: var(--osd);
  text-align: left;
  cursor: pointer;
  transition:
    transform var(--t-key) ease,
    box-shadow var(--t-key) ease;
}

.case-card:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px hsl(var(--case-hue) 55% 45% / 0.6),
    0 10px 26px rgba(0, 0, 0, 0.45);
}

/* ── the case itself ────────────────────────────────────────────────────
   Three stacked layers filling one box, so posters can sit *between* the hull and the
   lid. That sandwich is the whole illusion — titles sticking out of a container — and it
   is why the artwork is two SVGs rather than one background image. See caseart.js. */
.case-art {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: radial-gradient(120% 90% at 50% 110%, hsl(var(--case-hue) 26% 12%), #0a0806 70%);
}

.case-hull,
.case-lid-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.case-hull {
  z-index: 1;
}

.case-lid-art {
  z-index: 3;
  transform-origin: 50% 62%;
  transition: transform 260ms cubic-bezier(0.3, 1.3, 0.5, 1);
}

/* The posters live between the hull and the lid, and they stand *up out of the case*
   rather than peeking from under a raised lid.
   
   The first attempt did it the other way — lid lifts, posters revealed in the gap — and
   it was exactly backwards: the fan sits above the seam, so raising the lid covered more
   of it than it uncovered and all you saw was a coloured sliver. Anchoring the fan's feet
   at the top face and letting it rise clear of the back edge is the shape that reads.
   
   The bottom inset is what puts the poster feet at the top face (y≈55 of the 150-unit
   drawing), so the lid's front band always hides where they go in. */
.case-slot {
  position: absolute;
  inset: 0 18% 63%;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

/* Each poster sits a little higher, a little further over, at its own angle. The fan is
   what sells "things sticking out of a box"; four squared-up thumbnails do not. */
.case-peek {
  width: 18%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 2px;
  margin-inline: -4%;
  /* A hard edge on each poster: without it a fan of four flat images reads as one smear,
     which is exactly what it did until the outline went on. */
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.85), 0 5px 12px rgba(0, 0, 0, 0.7);
  transform: translateY(calc(var(--i) * -5%)) rotate(calc((var(--i) - 1.5) * 8deg));
  transform-origin: bottom center;
}

/* Open: a small tilt, no lift. The lid is what the fan comes out from behind, so moving
   it up would hide the thing it is meant to frame — see the slot comment above. Applied
   only once posters have actually arrived; an empty case tilting open onto nothing would
   be the same lie as four grey rectangles pretending to be posters. */
.case-art.is-open .case-lid-art {
  transform: rotate(-2.4deg) translateY(1.5%);
}

/* A case with a gold in it says so along the lid seam, faintly — the way the reference
   sells a knife case without spelling it out. */
.case-card.has-gold .case-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background: radial-gradient(70% 34% at 50% 46%, rgba(240, 180, 41, 0.30), transparent 70%);
}

/* Sealed is a closed box with nothing behind the lid, which is the honest picture of a
   case nobody has opened. It is drawn a touch cooler so a shelf of them does not compete
   with the ones that have contents. */
.case-card.is-sealed .case-art {
  filter: saturate(0.72) brightness(0.9);
}

/* Not in your country. Shown rather than hidden, for the same reason the sealed state is
   shown: a shelf that silently changes length between countries leaves nobody able to
   tell what they are missing. It cannot be opened and it says why. */
.case-card.is-unavailable {
  cursor: not-allowed;
  opacity: 0.42;
}

.case-card.is-unavailable .case-art {
  filter: grayscale(1) brightness(0.7);
}

.case-card.is-unavailable:hover {
  transform: none;
  box-shadow: inset 0 0 0 1px var(--well-line);
}

.case-card.is-unavailable .case-foot {
  color: var(--warn);
}

.case-name {
  font-family: var(--font-marker);
  font-size: var(--step-0);
  color: var(--label);
}

.case-blurb {
  font-family: var(--font-label);
  font-size: var(--step--2);
  color: var(--osd-dim);
  line-height: 1.3;
  min-height: 2.6em;
}

.case-foot {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  color: var(--accent-lit);
}

.case-card.is-sealed .case-foot {
  color: var(--osd-dim);
}

/* ══ looking inside a case ════════════════════════════════════════════════ */

.case-preview {
  display: grid;
  gap: var(--sp-4);
  padding: var(--sp-4);
}

.case-preview-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* Said once, plainly, above the coloured ladder — because a screen shaped like a weapon
   case invites exactly the assumption this app does not make. */
.case-odds {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px var(--well-line);
}

.case-odds-line {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-lit);
}

.tier {
  display: grid;
  gap: var(--sp-2);
}

.tier-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.tier-swatch {
  width: 28px;
  height: 4px;
  border-radius: 2px;
  background: var(--rr-industrial);
}

.tier-name {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--osd);
}

.tier-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: var(--sp-3);
}

.case-item {
  display: grid;
  gap: var(--sp-1);
  padding-bottom: var(--sp-1);
  border-bottom: 3px solid var(--rr-industrial);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent);
}

.item-art {
  aspect-ratio: 2 / 3;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}

.item-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-name {
  font-family: var(--font-label);
  font-size: var(--step--2);
  color: var(--label);
  padding-inline: var(--sp-1);
  line-height: 1.25;
}

.item-year {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  color: var(--osd-dim);
  padding-inline: var(--sp-1);
}

.case-open-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--well-line);
}

/* Genre cases collapse the lower tiers into a single count line. */
.tier-collapsed {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--well-line);
  text-align: center;
}

/* ── the ladder's colours, in one place ─────────────────────────────────
   Every rarity-coded thing in the app — a preview tile, a tier swatch, a ticker cell —
   reads its colour from `[data-rarity]`, so the ladder is defined once and cannot drift
   between the screen that promises a tier and the screen that pays it out. */
[data-rarity="industrial"] {
  --rr: var(--rr-industrial);
}
[data-rarity="milspec"] {
  --rr: var(--rr-milspec);
}
[data-rarity="restricted"] {
  --rr: var(--rr-restricted);
}
[data-rarity="classified"] {
  --rr: var(--rr-classified);
}
[data-rarity="covert"] {
  --rr: var(--rr-covert);
}
[data-rarity="gold"] {
  --rr: var(--rr-gold);
}

.tier[data-rarity] .tier-swatch {
  background: var(--rr);
  box-shadow: 0 0 10px var(--rr);
}

.tier[data-rarity] .tier-name {
  color: var(--rr);
}

.case-item[data-rarity] {
  border-bottom-color: var(--rr);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rr) 30%, transparent);
}

.case-item[data-rarity="gold"] {
  box-shadow:
    inset 0 0 0 1px var(--rr-gold),
    0 0 18px rgba(240, 180, 41, 0.28);
}

/* ══ opening a case ═══════════════════════════════════════════════════════ */

.ticker-stage {
  display: grid;
  gap: var(--sp-4);
  justify-items: center;
  padding: var(--sp-5) 0;
}

/* The lid, before the ticker. It swings back on its hinge and then leaves. */
.opening-case {
  position: relative;
  width: 180px;
  height: 96px;
  perspective: 500px;
}

.opening-body {
  position: absolute;
  inset: 40px 0 0 0;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, #3b2c1c, #14100b);
  box-shadow: inset 0 0 0 1px var(--well-line);
}

.opening-lid {
  position: absolute;
  inset: 0 0 auto 0;
  height: 46px;
  transform-origin: bottom center;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  background: linear-gradient(180deg, #4d3a24, #2a1f14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 420ms cubic-bezier(0.3, 1.4, 0.5, 1);
}

.opening-case.unlatched .case-latch {
  transform: translate(-50%, 4px) rotate(12deg);
}

.opening-case.open .opening-lid {
  transform: rotateX(-108deg);
}

.opening-case.gone {
  opacity: 0;
  transition: opacity 260ms ease;
}

/* ── the ticker ─────────────────────────────────────────────────────────
   A window with a fixed marker at dead centre and a strip that only ever travels one
   way. The fades at each end are what stop it looking like a list that happens to be
   moving: you should never see a cell arrive, only pass. */
/* The height is derived, not guessed: a cell is its poster (116px wide at 2:3 = 174px),
   two lines of title, a year, the colour bar and the padding around them. Sized by eye it
   came out 190px, which clipped the bar off the bottom of every cell — and the bar is the
   only part of a cell that is legible at speed, so the strip lost its entire reading
   language exactly when it needed it. */
.ticker-window {
  position: relative;
  width: min(92vw, 1000px);
  height: 252px;
  overflow: hidden;
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.32);
  box-shadow: inset 0 0 0 1px var(--well-line);
}

.ticker-marker {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  translate: -50% 0;
  background: var(--accent-lit);
  box-shadow: 0 0 12px var(--accent-lit);
  z-index: 3;
}

.ticker-marker::before,
.ticker-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  translate: -50% 0;
  border: 7px solid transparent;
}

.ticker-marker::before {
  top: 0;
  border-top-color: var(--accent-lit);
}

.ticker-marker::after {
  bottom: 0;
  border-bottom-color: var(--accent-lit);
}

.ticker-marker.ping {
  animation: marker-ping 140ms ease-out;
}

@keyframes marker-ping {
  from {
    filter: brightness(2.4);
  }
  to {
    filter: brightness(1);
  }
}

.ticker-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 90px;
  z-index: 2;
  pointer-events: none;
}

.ticker-fade.left {
  left: 0;
  background: linear-gradient(90deg, var(--well), transparent);
}

.ticker-fade.right {
  right: 0;
  background: linear-gradient(270deg, var(--well), transparent);
}

.ticker-track {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  gap: 8px; /* must match GAP in caseopen.js */
  padding: var(--sp-3);
  will-change: transform, filter;
}

.ticker-track.is-still {
  position: static;
  justify-content: center;
}

.ticker-cell {
  position: relative;
  flex: 0 0 auto;
  width: 116px;
  display: grid;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-2) 0;
  border-radius: var(--r-sm);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--rr, var(--rr-industrial)) 26%, #0d0a07),
    #0d0a07
  );
  overflow: hidden;
}

.ticker-cell.is-plain {
  background: linear-gradient(180deg, #241a10, #0d0a07);
}

.ticker-art {
  aspect-ratio: 2 / 3;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.4);
}

.ticker-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Two lines, always — a one-line title must still reserve the second, or cells of
   different name lengths put their colour bars at different heights and the strip stops
   reading as a single band of colour. */
.ticker-name {
  font-family: var(--font-label);
  font-size: var(--step--2);
  color: var(--label);
  line-height: 1.2;
  height: 2.4em;
  overflow: hidden;
}

.ticker-year {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  color: var(--osd-dim);
}

/* The colour bar along the bottom is the whole reading language of the strip: at speed
   it is the only thing legible, and the deceleration is a wash of colour resolving. */
.ticker-bar {
  height: 6px;
  margin-top: var(--sp-1);
  margin-inline: calc(var(--sp-2) * -1);
  background: var(--rr, var(--rr-industrial));
  box-shadow: 0 0 14px var(--rr, var(--rr-industrial));
}

.ticker-cell.won {
  outline: 2px solid var(--rr, var(--accent-lit));
  outline-offset: -2px;
}

.ticker-window.seated .ticker-cell:not(.won) {
  filter: brightness(0.55) saturate(0.7);
  transition: filter 320ms ease;
}

.ticker-window.hot .ticker-name,
.ticker-window.hot .ticker-year {
  opacity: 0.35;
}

.ticker-stage.landed .osd-cursor {
  color: var(--accent-lit);
}

/* ══ the wheel ════════════════════════════════════════════════════════════ */

.wheel-stage {
  display: grid;
  gap: var(--sp-4);
  justify-items: center;
  padding: var(--sp-4) 0;
}

.wheel-frame {
  position: relative;
  width: min(78vh, 78vw, 520px);
  aspect-ratio: 1;
}

.wheel-canvas {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #241a10, #0b0806);
  box-shadow:
    inset 0 0 0 2px var(--well-line),
    0 14px 40px rgba(0, 0, 0, 0.55);
}

.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  translate: -50% 0;
  z-index: 2;
  border: 13px solid transparent;
  border-top-color: var(--accent-lit);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
}

.wheel-stage.landed .wheel-canvas {
  box-shadow:
    inset 0 0 0 2px var(--accent),
    0 0 34px rgba(240, 138, 69, 0.35);
}

/* ══ the battle formats ═══════════════════════════════════════════════════ */

.bt-stage {
  display: grid;
  gap: var(--sp-4);
  justify-items: center;
  padding: var(--sp-5) 0;
  width: 100%;
}

.bt-floor {
  width: min(92vw, 900px);
  display: grid;
  gap: var(--sp-4);
}

.bt-face {
  display: grid;
  gap: 2px;
  padding: var(--sp-3);
  border-radius: var(--r-sm);
  background: linear-gradient(168deg, var(--shell-hi), var(--shell-lo));
  box-shadow: inset 0 0 0 1px var(--well-line);
  transition:
    filter 240ms ease,
    box-shadow 240ms ease,
    opacity 240ms ease;
}

.bt-name {
  font-family: var(--font-marker);
  font-size: var(--step-1);
  color: var(--label);
}

.bt-sub {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  color: var(--osd-dim);
}

.bt-face.is-won {
  box-shadow:
    inset 0 0 0 2px var(--accent),
    0 0 26px rgba(240, 138, 69, 0.3);
}

.bt-face.is-out {
  filter: saturate(0.3) brightness(0.6);
  opacity: 0.6;
}

/* ══ the played formats ═══════════════════════════════════════════════════ */

/* The instruction line. Both keys, named, before a countdown either of them can act on. */
.bt-keys {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px var(--well-line);
}

.bt-key-side {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
}

.bt-key-side.is-right {
  justify-content: flex-end;
}

.bt-kbd {
  display: grid;
  place-items: center;
  min-width: 30px;
  padding: 4px 8px;
  border-radius: 6px;
  background: linear-gradient(168deg, var(--shell-hi), var(--shell-lo));
  box-shadow:
    inset 0 0 0 1px var(--well-line),
    0 2px 0 rgba(0, 0, 0, 0.5);
  font-family: var(--font-osd);
  font-size: var(--step-0);
  color: var(--label);
}

.bt-key-for,
.bt-key-vs {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  color: var(--osd-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* The countdown, and the fact that it is live. */
.bt-stage.is-count .bt-floor {
  transform: scale(1.015);
}

.bt-stage.is-live .bt-keys {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.bt-face.is-pulling {
  filter: brightness(1.4);
  transform: scale(1.03);
}

/* ── tug of war: a rope, two ends ──────────────────────────────────────── */
.bt-contest {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.7fr) 1fr;
  align-items: center;
  gap: var(--sp-4);
}

.bt-pit {
  position: relative;
  height: 64px;
  display: grid;
  align-items: center;
}

/* Twisted hemp, drawn with a repeating gradient rather than an image. */
.bt-rope {
  position: absolute;
  inset: 50% 0 auto 0;
  translate: 0 -50%;
  height: 12px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(
      66deg,
      rgba(0, 0, 0, 0.32) 0 4px,
      rgba(255, 255, 255, 0.14) 4px 9px
    ),
    linear-gradient(180deg, #b8894e, #7d5528);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
  /* Pulled taut toward whoever is winning. `--taut` is computed where the pull is. */
  transform: scaleY(var(--taut, 1));
}

.bt-knot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 34px;
  border-radius: 5px;
  background: linear-gradient(180deg, #e0b071, #8a5f2d);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 14px rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%);
  transition: transform 90ms linear;
  z-index: 2;
}

.bt-centre {
  position: absolute;
  left: 50%;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
}

.bt-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.55;
}

.bt-line.is-left {
  left: 4%;
}

.bt-line.is-right {
  right: 4%;
}

/* ── standoff ──────────────────────────────────────────────────────────── */
.bt-standoff {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--sp-5);
}

.bt-versus {
  font-family: var(--font-osd);
  font-size: var(--step-2);
  color: var(--osd-dim);
}

.bt-stage.tense .bt-face {
  filter: brightness(1.25);
}

.bt-stage.tense .bt-versus {
  color: var(--accent-lit);
}

/* ── shootout ──────────────────────────────────────────────────────────── */
.bt-shootout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.bt-side {
  display: grid;
  gap: var(--sp-2);
  justify-items: center;
}

.bt-score {
  font-family: var(--font-osd);
  font-size: var(--step-4);
  color: var(--label);
}

.bt-marks {
  display: flex;
  gap: var(--sp-1);
  min-height: 12px;
}

.bt-mark {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.bt-mark.is-hit {
  background: var(--good);
  box-shadow: 0 0 8px var(--good);
}

.bt-mark.is-miss {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--ink-soft);
}

/* ── the goal, for the shootout ────────────────────────────────────────── */
.bt-goal {
  position: relative;
  display: grid;
  justify-items: center;
  padding-bottom: 46px;
}

/* The floodlight behind the goal. Not the netting — that is drawn on the mouth itself —
   but the light that makes a goal mouth read as a thing standing in a dark stadium. */
.bt-net {
  position: absolute;
  left: 50%;
  top: -6%;
  width: min(112%, 760px);
  height: 116%;
  translate: -50% 0;
  background: radial-gradient(58% 74% at 50% 24%, rgba(255, 255, 255, 0.06), transparent 72%);
  pointer-events: none;
}

.bt-goal-mouth {
  position: relative;
  width: min(88%, 620px);
  aspect-ratio: 16 / 7;
  border: 6px solid #e9edf2;
  border-bottom-width: 3px;
  border-radius: 4px 4px 0 0;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 15px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.09) 0 1px, transparent 1px 15px),
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.5));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}

.bt-spot {
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 10px;
  height: 5px;
  translate: -50% 0;
  border-radius: 50%;
  background: #e9edf2;
  opacity: 0.75;
}

/* ── the five places, and the dividers you cannot see ───────────────────────
   The goal mouth is tiled edge to edge: three columns by two rows, with the middle
   column one region spanning both. Nothing is drawn between them — the divider is
   wherever the wash under the pointer stops, which is the whole idea. What you are
   choosing is an *area of the goal*, so the area is what lights up. */
.bt-zones {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 0.78fr 1fr;
  grid-template-rows: 1fr 1fr;
  z-index: 2;
}

.bt-zone {
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  background: none;
  color: var(--osd);
  cursor: pointer;
  overflow: hidden;
  transition: box-shadow 160ms ease;
}

.bt-zone:disabled {
  cursor: default;
}

/* The wash. One layer, one colour swapped by state, so a hover and a verdict cannot
   fight each other over the same background. */
.bt-zone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--wash, var(--accent));
  opacity: 0;
  transition:
    opacity 140ms ease,
    background 140ms ease;
  pointer-events: none;
}

/* Approach the goal and the dividers ghost in — just enough to say the mouth is
   divided, never enough to look like five buttons sitting on a form. */
.bt-zones:hover .bt-zone:not(:disabled) {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.bt-zone:not(:disabled):hover,
.bt-zone:not(:disabled):focus-visible,
.bt-zone.is-lit {
  box-shadow:
    inset 0 0 0 1px var(--accent),
    inset 0 0 40px rgba(0, 0, 0, 0.3);
}

.bt-zone:not(:disabled):hover::before,
.bt-zone:not(:disabled):focus-visible::before,
.bt-zone.is-lit::before {
  opacity: 0.26;
}

.bt-zone-key {
  position: relative;
  font-family: var(--font-osd);
  font-size: var(--step--1);
  opacity: 0;
  transition: opacity 140ms ease;
}

.bt-zone:not(:disabled):hover .bt-zone-key,
.bt-zone:not(:disabled):focus-visible .bt-zone-key,
.bt-zone.is-lit .bt-zone-key,
.bt-stage.is-showing .bt-zone-key {
  opacity: 0.8;
}

/* Where you put it, held while the ball is in the air. */
.bt-zone.is-chosen {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.bt-zone.is-chosen::before {
  opacity: 0.12;
}

/* ── and afterwards, his hand ───────────────────────────────────────────────
   Red is a corner he had, green is one he left. The order of these three rules is
   load-bearing: `is-picked` is drawn over whichever verdict the region got. */
.bt-zone.is-covered {
  box-shadow: inset 0 0 0 1px var(--bad);
}

.bt-zone.is-covered::before {
  --wash: var(--bad);
  opacity: 0.26;
}

.bt-zone.is-open {
  box-shadow: inset 0 0 0 1px var(--good);
}

.bt-zone.is-open::before {
  --wash: var(--good);
  opacity: 0.2;
}

.bt-zone.is-picked {
  box-shadow:
    inset 0 0 0 3px var(--accent),
    inset 0 0 34px rgba(0, 0, 0, 0.4);
}

/* ── the keeper ─────────────────────────────────────────────────────────────
   Centred by the `translate` property rather than by `transform`, because the dive is
   an animation *on* transform and the two would otherwise be the same slot. He never
   takes the pointer: the regions underneath him have to stay clickable. */
.bt-keeper {
  position: absolute;
  left: 50%;
  bottom: 0;
  /* Wide enough that reaching a corner is plausible. At 74px he was a doll in a stadium
     and every save looked like the ball had gone to him rather than him to it. */
  width: 96px;
  translate: -50% 0;
  color: #e9edf2;
  --silk: var(--accent);
  pointer-events: none;
  z-index: 3;
}

.bt-keeper-art {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

/* Local origins, so the parts rotate about their own joints rather than about the
   viewBox: the arms at the shoulders, the legs at the hips. */
.bt-k-arms,
.bt-k-legs,
.bt-k-torso {
  transform-box: fill-box;
}

.bt-k-arms {
  transform-origin: 50% 8%;
}

.bt-k-legs {
  transform-origin: 50% 0%;
}

.bt-k-torso {
  transform-origin: 50% 90%;
}

/* On his toes and shifting his weight, right up until the ball is struck. A keeper who
   stands perfectly still reads as a decision already made. */
.bt-keeper.is-set {
  animation: keeper-ready 1100ms ease-in-out infinite;
}

@keyframes keeper-ready {
  0%,
  100% {
    transform: translate(-3px, 0) rotate(-1deg);
  }
  50% {
    transform: translate(3px, -3px) rotate(1deg);
  }
}

/* The catch. On `scale` rather than `transform`, because the dive owns transform and
   the two properties compose instead of overwriting each other. */
.bt-keeper.is-clutching .bt-k-arms {
  animation: keeper-clutch 340ms ease-out;
}

@keyframes keeper-clutch {
  0% {
    scale: 1.08;
  }
  40% {
    scale: 0.9;
  }
  100% {
    scale: 1;
  }
}

/* While the verdict is up, he is not the thing to look at. */
.bt-stage.is-showing .bt-keeper {
  opacity: 0.45;
  transition: opacity 220ms ease;
}

/* ── the ball, and what the net does about it ──────────────────────────────
   The ball lives at the mouth's own origin and is moved entirely by transform, so
   every position it takes is measured off the regions rather than guessed at in
   percentages. See `centre()` in penalties.js. */
.bt-ball {
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  background: radial-gradient(60% 60% at 35% 30%, #fff, #b9c0c8);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 4;
}

.bt-ball.is-in {
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.6),
    0 0 26px var(--good);
}

/* The net takes it, where it went in. */
.bt-net-bulge {
  position: absolute;
  left: 0;
  top: 0;
  width: 150px;
  height: 150px;
  margin: -75px 0 0 -75px;
  border-radius: 50%;
  background: radial-gradient(
    50% 50% at 50% 50%,
    rgba(255, 255, 255, 0.32),
    rgba(255, 255, 255, 0.07) 55%,
    transparent 72%
  );
  opacity: 0;
  scale: 0.25;
  pointer-events: none;
  z-index: 1;
}

.bt-net-bulge.is-hit {
  animation: net-bulge 640ms cubic-bezier(0.15, 0.75, 0.3, 1) forwards;
}

@keyframes net-bulge {
  0% {
    opacity: 0;
    scale: 0.25;
  }
  20% {
    opacity: 1;
    scale: 1.08;
  }
  100% {
    opacity: 0;
    scale: 0.94;
  }
}

/* ── roll off: dice ────────────────────────────────────────────────────── */
.bt-values {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4);
}

.bt-slot {
  display: grid;
  gap: var(--sp-2);
  justify-items: center;
}

.bt-die-box {
  display: grid;
  place-items: center;
  height: 96px;
}

.bt-die {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 12px;
  background: linear-gradient(158deg, #f4f1ea, #cfc9bd);
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    inset 0 0 0 1px rgba(0, 0, 0, 0.25),
    0 6px 14px rgba(0, 0, 0, 0.5);
}

.bt-pip {
  position: absolute;
  width: 11px;
  height: 11px;
  translate: -50% -50%;
  border-radius: 50%;
  background: #23201c;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35);
}

.bt-die.is-rolling {
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.25),
    0 14px 22px rgba(0, 0, 0, 0.55);
}

.bt-slot.is-won .bt-die {
  box-shadow:
    inset 0 0 0 3px var(--accent),
    0 0 26px rgba(240, 138, 69, 0.45);
}

/* ── high card: real cards, dealt off a deck ───────────────────────────── */
.bt-card-seat {
  display: grid;
  place-items: center;
  width: 74px;
  height: 106px;
}

.bt-card {
  position: relative;
  width: 74px;
  height: 106px;
  border-radius: 7px;
  transform-style: preserve-3d;
  transition: transform 320ms cubic-bezier(0.3, 0.9, 0.3, 1);
  visibility: hidden;
}

.bt-card.is-turned {
  transform: rotateY(180deg);
}

.bt-card-back,
.bt-card-face {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  backface-visibility: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    0 6px 14px rgba(0, 0, 0, 0.5);
}

.bt-card-back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 4px, transparent 4px 8px),
    linear-gradient(160deg, var(--accent), #7a2f12);
}

.bt-card-face {
  transform: rotateY(180deg);
  background: linear-gradient(168deg, #f7f4ee, #ddd8cd);
  color: #1d1a16;
  display: grid;
  place-items: center;
}

.bt-card-face.is-red {
  color: #b3211d;
}

.bt-corner {
  position: absolute;
  display: grid;
  justify-items: center;
  line-height: 1;
  font-family: var(--font-osd);
}

.bt-corner.tl {
  top: 6px;
  left: 6px;
}

.bt-corner.br {
  bottom: 6px;
  right: 6px;
  transform: rotate(180deg);
}

.bt-rank {
  font-size: var(--step-0);
}

.bt-suit {
  font-size: var(--step--1);
}

.bt-card-mid {
  font-size: var(--step-5);
  line-height: 1;
}

.bt-card.is-won {
  box-shadow:
    0 0 0 3px var(--accent),
    0 0 28px rgba(240, 138, 69, 0.45);
  border-radius: 7px;
}

.bt-deck-row {
  display: grid;
  place-items: center;
  padding-top: var(--sp-2);
}

.bt-deck {
  position: relative;
  width: 74px;
  height: 106px;
}

.bt-deck-card {
  position: absolute;
  inset: 0;
  border-radius: 7px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 4px, transparent 4px 8px),
    linear-gradient(160deg, var(--accent), #7a2f12);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    0 4px 10px rgba(0, 0, 0, 0.45);
}

.bt-deck-card:nth-child(2) {
  translate: 2px -3px;
}

.bt-deck-card:nth-child(3) {
  translate: 4px -6px;
}

/* ── the horse race ────────────────────────────────────────────────────── */
.bt-race {
  overflow: hidden;
  border-radius: var(--r-sm);
}

.bt-track-set {
  position: relative;
  display: grid;
  gap: var(--sp-2);
  transition:
    transform 520ms cubic-bezier(0.3, 0.8, 0.3, 1),
    filter 520ms ease;
}

/* The push-in for a photo finish. The origin is set on the tape, in pixels, by the race. */
.bt-track-set.is-photo {
  transform: scale(2.1);
}

.bt-lane {
  display: grid;
  grid-template-columns: minmax(96px, 20%) minmax(0, 1fr);
  align-items: center;
  gap: var(--sp-2);
  height: 52px;
  padding: 0 var(--sp-2) 0 0;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: inset 0 0 0 1px var(--well-line);
  transition:
    opacity 320ms ease,
    box-shadow 240ms ease;
}

.bt-rail {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  padding-left: var(--sp-2);
}

.bt-silk {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: var(--silk);
  color: #101010;
  font-family: var(--font-osd);
  font-size: var(--step--2);
  flex: none;
}

.bt-runner-name {
  font-family: var(--font-label);
  font-size: var(--step--1);
  color: var(--label);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bt-lane-track {
  position: relative;
  height: 100%;
  overflow: hidden;
}

/* The going. Something for the hooves to be on, and for the dirt to come out of. */
.bt-lane-track::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: linear-gradient(180deg, rgba(126, 92, 58, 0.5), rgba(52, 37, 24, 0.8));
  pointer-events: none;
}

/* The line, at the end of the lane. It sat at 86% while the runners finished at 100%,
   which is the whole width of a horse past it. The inset comes from the race, which is
   also what positions the camera on it — see TAPE_INSET in horserace.js. */
.bt-tape {
  position: absolute;
  right: var(--tape, 22px);
  top: 0;
  bottom: 0;
  width: 4px;
  background: repeating-linear-gradient(180deg, #fff 0 5px, #1a1a1a 5px 10px);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

.bt-horse {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 64px;
  color: var(--coat, var(--label));
  will-change: transform;
  z-index: 2;
}

.bt-horse-art {
  width: 100%;
  height: auto;
  overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

/* ── the joints ─────────────────────────────────────────────────────────────
   Origins in user units off the 84×52 viewBox rather than as percentages of each part's
   own box: a leg's bounding box includes its hoof, so `50% 0%` would hang it a pixel and
   a half to the wrong side of the shoulder — and a leg pivoting anywhere but the
   shoulder is the exact thing that makes a gallop look like a wind-up toy. */
.bt-h-frame,
.bt-h-neck,
.bt-h-mane,
.bt-h-tail,
.bt-h-jockey,
.bt-h-whip,
.bt-leg,
.bt-shin {
  transform-box: view-box;
}

.bt-h-frame {
  transform-origin: 38px 23px;
}

.bt-h-neck {
  transform-origin: 47px 19px;
}

.bt-h-mane {
  transform-origin: 54px 11px;
}

.bt-h-tail {
  transform-origin: 23px 20px;
}

.bt-h-jockey {
  transform-origin: 40px 16px;
}

.bt-h-whip {
  transform-origin: 43px 11px;
}

.bt-leg-0 {
  transform-origin: 27px 30px;
}

.bt-leg-1 {
  transform-origin: 32px 30px;
}

.bt-leg-2 {
  transform-origin: 47px 30px;
}

.bt-leg-3 {
  transform-origin: 52px 30px;
}

.bt-leg-0 .bt-shin {
  transform-origin: 27px 40px;
}

.bt-leg-1 .bt-shin {
  transform-origin: 32px 40px;
}

.bt-leg-2 .bt-shin {
  transform-origin: 47px 40px;
}

.bt-leg-3 .bt-shin {
  transform-origin: 52px 40px;
}

/* ── what the hooves throw ──────────────────────────────────────────────────
   A zero-height line at the going, so a clod's own coordinates are "along the lane" and
   "above the ground" with no offsets to keep in step with the horse's box. */
.bt-lane-dirt {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  height: 0;
  pointer-events: none;
  z-index: 3;
}

.bt-clod {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  margin: -1px 0 0 -1px;
  border-radius: 40%;
  background: #9a7549;
  opacity: 0;
}

.bt-dust {
  position: absolute;
  left: 0;
  top: 0;
  width: 16px;
  height: 9px;
  margin: -9px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(198, 170, 130, 0.6), transparent 70%);
  opacity: 0;
}

/* Flat out: the air stops getting out of the way. */
.bt-horse.is-flatout::before {
  content: "";
  position: absolute;
  right: 76%;
  top: 30%;
  width: 46px;
  height: 34%;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.22) 0 1px,
    transparent 1px 6px
  );
  -webkit-mask-image: linear-gradient(90deg, transparent, #000);
  mask-image: linear-gradient(90deg, transparent, #000);
  pointer-events: none;
}

/* In the stalls, and then out of them: the field sits back on its hocks and rears, which
   is not what a horse in a starting stall does and is exactly the point. The outer
   element carries the shove backwards, the frame carries the rear — the same division of
   labour the simulation uses, so neither animation fights the other for a transform. */
.bt-track-set.is-stalls .bt-horse {
  animation: horse-coil 420ms cubic-bezier(0.4, 0, 0.7, 1);
}

.bt-track-set.is-stalls .bt-h-frame {
  animation: horse-rear 420ms cubic-bezier(0.3, 0.8, 0.4, 1);
}

@keyframes horse-coil {
  0%,
  100% {
    transform: translateX(0);
  }
  55% {
    transform: translateX(-5px);
  }
}

@keyframes horse-rear {
  0%,
  100% {
    transform: rotate(0deg) translateY(0);
  }
  50% {
    transform: rotate(-15deg) translateY(-2px);
  }
}

/* The lunge at the tape: everything thrown forward, forelegs tucked, nose out. */
.bt-horse.is-lunging .bt-h-frame {
  animation: horse-lunge 260ms cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes horse-lunge {
  0% {
    transform: rotate(0deg) scale(1, 1);
  }
  45% {
    transform: translate(4px, -2px) rotate(-8deg) scale(1.18, 0.9);
  }
  100% {
    transform: rotate(0deg) scale(1, 1);
  }
}

.bt-lane.is-hot {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.bt-track-set.is-photo .bt-lane:not(.is-hot) {
  opacity: 0.25;
}

.bt-lane.is-out {
  opacity: 0.45;
}

.bt-lane.is-won {
  box-shadow:
    inset 0 0 0 2px var(--accent),
    0 0 22px rgba(240, 138, 69, 0.3);
}

/* Slow motion: the whole stage cools down while the last stride plays out. */
.bt-stage.is-slowmo .bt-floor {
  filter: saturate(0.75) contrast(1.1);
}

/* ── knockout ──────────────────────────────────────────────────────────── */
.bt-standing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-3);
}

/* Named, and held there for a beat. This is the half-second the format is made of. */
.bt-face.is-marked {
  box-shadow:
    inset 0 0 0 2px var(--warn),
    0 0 22px rgba(219, 158, 47, 0.35);
  filter: brightness(1.25);
  animation: marked 340ms ease-in-out infinite alternate;
}

@keyframes marked {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.035);
  }
}

.bt-face.is-struck {
  animation: struck 420ms cubic-bezier(0.2, 0.9, 0.3, 1);
  box-shadow:
    inset 0 0 0 2px var(--bad),
    0 0 26px rgba(198, 60, 44, 0.45);
}

@keyframes struck {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
  18% {
    transform: translate(-9px, 2px) rotate(-3deg) scale(1.06);
  }
  40% {
    transform: translate(8px, -3px) rotate(3deg) scale(0.98);
  }
  70% {
    transform: translate(-4px, 4px) rotate(-1.5deg) scale(1.01);
  }
  100% {
    transform: translate(0, 0) rotate(0deg) scale(1);
  }
}

/* ...and then it drops out of the row, which is what makes the field close up. */
.bt-standing .bt-face.is-out {
  animation: knocked-out 320ms cubic-bezier(0.4, 0, 0.7, 0.2) forwards;
}

@keyframes knocked-out {
  to {
    transform: translateY(26px) rotate(6deg) scale(0.86);
    opacity: 0.12;
    filter: saturate(0) brightness(0.5);
  }
}

/* ══ setting up a battle ══════════════════════════════════════════════════ */

.bf-group {
  display: grid;
  gap: var(--sp-2);
  padding-bottom: var(--sp-2);
}

/*
 * The played formats wear a keyboard.
 *
 * They are the only three that ask the room to do something, and finding that out after
 * pressing *settle it* — with a countdown already running — is how you lose the first two
 * seconds of a game that is decided in eight.
 */
.bf-chip.is-played::after {
  content: "⌨";
  margin-left: 6px;
  opacity: 0.75;
  font-size: var(--step--1);
}

.bf-count {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--osd-dim);
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-3);
}

.seat {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px var(--well-line);
}

.seat.is-filled {
  box-shadow: inset 0 0 0 1px var(--accent);
}

.seat-no {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  color: var(--osd-dim);
  padding-top: 2px;
}

.seat-body {
  min-width: 0;
}

.seat-name {
  font-family: var(--font-marker);
  font-size: var(--step-1);
  color: var(--label);
}

.seat-meta {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  color: var(--osd-dim);
}

.seat-search {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--sp-2);
}

.seat-input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px var(--well-line);
  color: var(--label);
  font-family: var(--font-label);
  font-size: var(--step-0);
}

.seat-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.seat-hits {
  grid-column: 1 / -1;
  display: grid;
  gap: 2px;
}

.seat-hit {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--label);
  text-align: left;
  cursor: pointer;
}

.seat-hit:hover {
  background: rgba(255, 255, 255, 0.06);
}

.seat-hit-name {
  font-family: var(--font-label);
  font-size: var(--step-0);
}

.seat-hit-meta {
  font-family: var(--font-osd);
  font-size: var(--step--2);
  color: var(--osd-dim);
  margin-left: auto;
}

.bf-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-4);
  border-top: 1px dashed var(--well-line);
}

/* ── reduced motion ────────────────────────────────────────────────────────
   Everything above that moves is driven from JS, which checks `motionOn()` and skips the
   travel entirely. These rules are the belt to that braces, covering the transitions and
   keyframes CSS owns on its own. */
@media (prefers-reduced-motion: reduce) {
  .opening-lid,
  .bt-face,
  .bt-row,
  .case-card,
  .case-latch {
    transition: none;
  }

  .ticker-marker.ping,
  .bt-value.shown,
  .bt-face.is-struck,
  .bt-keeper.is-set,
  .bt-keeper.is-clutching .bt-k-arms,
  .bt-net-bulge.is-hit {
    animation: none;
  }
}

/* ══ icons ════════════════════════════════════════════════════════════════

   Every control in this app used to be a word in a box. That works at three controls and
   fails at forty: the deck asks four questions in a row and the battle surface offers
   fourteen formats, and a wall of identically-sized text pills gives the eye nothing to
   land on — you had to read all of it, in order, to find the one thing you wanted.

   The rule here is that an icon never replaces a label, it precedes one. These are aids
   to *scanning*, not a pictographic language to be learned, so nothing is ever only an
   icon. See icons.js. */
.icon {
  flex: 0 0 auto;
  display: block;
  /* Optical alignment: a 24-grid glyph next to a lowercase label sits a hair high. */
  transform: translateY(0.5px);
}

/* A chip with a glyph in front of its label. */
.chip-icon {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Pressed chips get their icon lit along with the text, which is most of what makes a
   selected genre findable in a row of nineteen. */
.chip-icon[aria-pressed="true"] .icon {
  opacity: 1;
}

.chip-icon .icon {
  opacity: 0.66;
  transition: opacity var(--t-key) ease;
}

.chip-icon:hover .icon {
  opacity: 1;
}

/* Section legends: the glyph is what lets you find "how well known" without reading
   "of what kind" first. */
.set-legend {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.set-legend .icon {
  opacity: 0.55;
}

/* Route headings carry the biggest glyph on the screen, because the three panels are the
   one decision the deck most needs to make obvious: chance, contest, or case. */
.route-title {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.route-title .icon {
  color: var(--accent-lit);
  opacity: 0.9;
}

/* The mode buttons are the deck's primary control and now lead with an icon, so they
   become a row rather than a stack of text. */
.mode {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.mode-icon {
  margin-top: 2px;
  color: var(--accent-lit);
  opacity: 0.75;
}

.mode[aria-pressed="true"] .mode-icon {
  opacity: 1;
}

.mode-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

/* ── the two narrowings, paired ─────────────────────────────────────────
   Genre and audience are both "which titles are eligible", and stacking them made the
   chance panel four near-identical rows of chips in a column — a form. Side by side they
   read as the two dials they are. */
.chance-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}

@media (max-width: 900px) {
  .chance-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ── the genre grid ─────────────────────────────────────────────────────
   Twenty options, laid out in full.

   This was briefly a half-width column with `max-height` and `overflow-y: auto`, which
   was a bad trade twice over: a scroll box *hides* options — the whole point of showing
   genres as chips rather than a dropdown — and a nested scroller inside a page that
   already scrolls steals the wheel the moment the pointer crosses it. Neither is worth
   saving eighty pixels.

   Equal columns rather than wrapped flex, so the chips form readable columns and their
   icons line up vertically. At the panel's usual width that is five across and four
   rows, with nothing clipped and nothing to scroll. */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: var(--sp-2);
}

/* A chip in a grid cell fills it, so the labels start on a common left edge.

   Labels wrap rather than truncate. `.chip` is `nowrap` everywhere else, which is right
   for a one-word action — but "Action & Adventure" and "Mystery & Thriller" are longer
   than a third of a narrow panel, and at 960px they were being clipped mid-word. A chip
   two lines tall is honest; a chip reading "MYSTERY & THRILL" is not. */
.genre-grid .chip {
  width: 100%;
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
  line-height: 1.25;
  align-items: center;
}

/* The glyph stays on the first line rather than centring against a two-line label, so a
   column of chips keeps its icons aligned whatever the labels do. */
.genre-grid .chip .icon {
  align-self: center;
}

/* The three mode buttons are the deck's primary control, and flex-wrap left them ragged:
   two on the first row at different widths, one orphaned below. Equal columns instead, so
   the row reads as one choice of three rather than as a wrapped list. */
.mode-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--sp-3);
}

@media (max-width: 780px) {
  .mode-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The battle surface's title carries the crossed swords. */
.surface-title {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Format chips are wide enough that their glyphs line up into a column, which is what
   makes fourteen of them scannable instead of a wall. */
.bf-chip {
  min-width: 148px;
  justify-content: flex-start;
}

/* A seat is mostly its search field, and at 280px the placeholder was being cut off
   mid-word — which makes the one control the whole surface exists for look broken. */
.seat-grid {
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

.seat-search {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.seat-input {
  min-width: 0;
}

/* ══ your own list ════════════════════════════════════════════════════════

   The one surface that is not about the catalogue. Four people round a laptop typing what
   they each want, and a wheel to settle it — so the controls are sized for someone else's
   hands reaching over, not for a careful solo click. */
.route-custom {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.route-custom > .route-head {
  grid-column: 1;
}

.route-custom > .key {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .route-custom {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-custom > .key {
    grid-column: 1;
    grid-row: auto;
  }
}

.entry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-2);
}

.entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2);
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px var(--well-line);
}

.entry-no {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  color: var(--osd-dim);
  min-width: 1.5em;
  text-align: right;
}

/* Typed into by people who are not the person who installed this, so it is bigger than a
   normal field and does not rely on a placeholder to explain itself. */
.entry-input {
  width: 100%;
  min-width: 0;
  padding: var(--sp-2) var(--sp-3);
  border: 0;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: inset 0 0 0 1px var(--well-line);
  color: var(--label);
  font-family: var(--font-marker);
  font-size: var(--step-1);
}

.entry-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.custom-stage {
  display: grid;
  min-height: 60vh;
  align-content: center;
}

/* The answer. No poster, no watch button, no "playing it" — the app does not know what
   these are, and dressing a typed string up as a catalogue card would be a lie. */
.custom-won {
  display: grid;
  gap: var(--sp-4);
  justify-items: center;
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
}

.custom-won-label {
  font-family: var(--font-osd);
  font-size: var(--step--1);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--osd-dim);
}

.custom-won-name {
  font-family: var(--font-marker);
  font-size: var(--step-5);
  line-height: 1.1;
  color: var(--label);
  max-width: 18ch;
  text-shadow: 0 0 40px rgba(240, 138, 69, 0.35);
}
