/* WhichAdWon — "The Arena". A/B split identity: side A = aqua, side B = coral.
   Picks are sealed during play; everything pays off in the end-of-game results
   reel. Display: Anton. UI: Instrument Sans. Data: Spline Sans Mono. */

:root {
  --ink: #0a0c13;
  --panel: #131722;
  --bone: #f3f5f9;
  --dim: #8b93a7;
  --side-a: #45d4ff;
  --side-b: #ff5c7a;
  --win: #3de38a;
  --loss: #ff5d5d;
  --radius: 18px;
  --lean: -7deg; /* the broadcast angle — every plate, chip, and bug leans on it */
  --edge: rgba(255, 255, 255, 0.09); /* hairline chrome */
  --screen: #06080d; /* the inset surface a creative sits on */
  --display: 'Anton', 'Arial Narrow', sans-serif;
  --ui: 'Instrument Sans', -apple-system, sans-serif;
  --mono: 'Spline Sans Mono', 'SF Mono', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* author display rules must never resurrect hidden elements */
[hidden] { display: none !important; }

body {
  font-family: var(--ui);
  background:
    repeating-linear-gradient(97deg, transparent 0 150px, rgba(255, 255, 255, 0.015) 150px 151px),
    radial-gradient(60vw 60vh at 12% 8%, rgba(69, 212, 255, 0.07), transparent 60%),
    radial-gradient(60vw 60vh at 88% 92%, rgba(255, 92, 122, 0.07), transparent 60%),
    var(--ink);
  color: var(--bone);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  /* clip, NOT hidden: overflow-x:hidden makes body a scroll container, which
     silently breaks position:sticky on the sponsor rails. clip contains the
     same overflow without establishing one. */
  overflow-x: clip;
}


/* faint grain so the dark field never reads flat */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

/* ── scorebug rail ──
   Broadcast convention: persistent state lives in the corners and never moves.
   Sticky so the round/score reading is always on screen. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 1rem;
  background: rgba(10, 12, 19, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--edge);
}
.topbar h1 {
  position: relative;
  z-index: 1;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.topbar h1 span {
  background: linear-gradient(100deg, var(--side-a), var(--side-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0 0.06em;
}
.topbar-right { display: flex; gap: 0.5rem; position: relative; z-index: 1; }
.badge {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  padding: 0.32rem 0.8rem;
  transform: skewX(var(--lean));
}
.badge b { color: var(--bone); font-weight: 700; }

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 1rem 1rem;
  max-width: 1020px;
  margin: 0 auto;
  width: 100%;
  min-height: 0; /* lets the arena size itself against the viewport, not content */
}
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  text-align: center;
  min-height: 0;
}

/* The play screen is a fixed frame, not a scrolling column: rail, arena,
   undercard. The arena takes whatever is left so BOTH ads always fit. */
#screen-game {
  justify-content: flex-start;
  gap: 0.55rem;
  padding-top: 0;
}
.pulse { color: var(--dim); font-family: var(--mono); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

/* ── progress track (answered only — never leaks correctness mid-game) ──
   Full-width segmented bar pinned under the rail, so it reads as part of the
   scorebug rather than a stray row of dots competing for the arena's space. */
/* Sits inside .bout, so it tracks the game's width rather than running across
   the sponsor rails as well — the round counter belongs to the match. */
.progress {
  display: flex;
  gap: 4px;
  flex: 0 0 auto;
  width: 100%;
}
.progress i {
  flex: 1;
  height: 5px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.09);
  transition: background 0.25s ease;
  transform: skewX(var(--lean));
}
/* Only completed rounds carry colour. Position/size are set per segment in JS
   so the whole run of them shares one continuous A→B gradient. */
.progress i.done {
  background-image: linear-gradient(90deg, var(--side-a), var(--side-b));
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 0.4em 1em;
  transform: skewX(var(--lean));
  align-self: center;
}

/* ── the table: undercard rail · main bout · undercard rail ── */
.table {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1rem;
}

/* Undercard rails. Deliberately the quietest thing on screen: no plates, no
   frames, desaturated and half-lit, so ten extra creatives read as ambient
   texture instead of ten more things competing with the bout. They come up
   to full strength only on hover. Hidden entirely below 1100px — there is no
   honest way to fit side rails on a phone. */
.rail { display: none; }

/* the match column: progress rail + the two contenders */
.bout {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── the arena ──
   A fixed frame, not a scrolling column. .arena claims the leftover height and
   both cards flex into it, so the pair ALWAYS fits one screen. The whole game
   is comparing two things; you cannot compare what you have to scroll to. */
.arena {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

/* Contender plate. The creative is content we don't control, so every bit of
   expression lives in the framing: a bevelled frame around an inset screen.
   That also turns the old accidental letterbox into a deliberate surface. */
/* The frame HUGS the creative (width: auto) instead of boxing it into a fixed
   slot. Real ads arrive at every aspect ratio, and a fixed slot letterboxes
   portrait creatives into a wall of black. Hugging means the frame is always
   exactly the ad, and two differently-shaped contenders is honest, not ragged. */
.card {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  width: auto;
  max-width: min(440px, 100%);
  padding: 7px;
  border: 1px solid var(--edge);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.012));
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.viewport {
  display: block;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: var(--screen);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.75), inset 0 3px 14px rgba(0, 0, 0, 0.55);
}
.card img {
  display: block;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

/* ── the ad, laid out the way Meta lays one out ──
   page name + Sponsored, primary text, creative, then the link-title bar.
   Everything except the creative is flex: 0 0 auto and line-clamped, so copy
   length can never push the pair of ads past one screen. */
.card { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.viewport { flex: 1 1 auto; min-height: 0; }

.adhead {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  padding: 0 2px;
  min-width: 0;
}
.adpage {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Copy sits on one line by default and expands on demand — a long primary text
   would otherwise push the second ad off screen, and both must stay visible. */
.adcopy {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 0.35em;
  padding: 0 2px;
  min-width: 0;
}
.adbody {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.74rem;
  line-height: 1.35;
  color: rgba(243, 245, 249, 0.82);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Full copy on hover. The card is the guess button, so this must never be a
   click target — hovering reveals, nothing else happens. */
.adcopy { position: relative; }
.adtip {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(12, 15, 24, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 44px -14px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.74rem;
  line-height: 1.4;
  color: rgba(243, 245, 249, 0.94);
  max-height: 34dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}
/* only on devices that actually have a pointer — a phone would show it stuck open */
@media (hover: hover) {
  .adcopy:hover .adtip[data-clipped='1'] { opacity: 1; transform: translateY(0); }
}
/* Touch has no hover, so the copy expands in place on tap instead. */
.adbody.open {
  -webkit-line-clamp: unset;
  display: block;
  max-height: 26dvh;
  overflow-y: auto;
}
/* the grey bar under a Meta creative carrying the headline */
.adlink {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--edge);
  font-size: 0.72rem;
  line-height: 1.3;
  font-weight: 600;
  color: rgba(243, 245, 249, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Short viewports: drop the copy before the creative — the picture is the game,
   the text is context. */
@media (max-height: 780px) {
  .adbody { -webkit-line-clamp: 1; }
}
@media (max-height: 680px) {
  .adbody { display: none; }
  .adlink { -webkit-line-clamp: 1; }
}


/* deal-in: contenders enter from opposite sides — that IS the versus read */
.card.deal { animation: dealA 0.34s cubic-bezier(0.2, 0.85, 0.25, 1) both; }
#card-b.deal { animation-name: dealB; animation-delay: 0.06s; }
#screen-game .card:not(.deal) { opacity: 0; }
@keyframes dealA { from { opacity: 0; transform: translateX(-14px) scale(0.985); } }
@keyframes dealB { from { opacity: 0; transform: translateX(14px) scale(0.985); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.card:hover:not(.locked) { transform: translateY(-2px) scale(1.006); }
#card-a:hover:not(.locked) { border-color: rgba(69, 212, 255, 0.5); box-shadow: 0 14px 44px -16px rgba(69, 212, 255, 0.4); }
#card-b:hover:not(.locked) { border-color: rgba(255, 92, 122, 0.5); box-shadow: 0 14px 44px -16px rgba(255, 92, 122, 0.4); }
.card:active:not(.locked) { transform: scale(0.985); }
.card.locked { cursor: default; }

/* Sealed pick. Squash and stretch move scaleX/scaleY in opposition so the
   plate conserves area and reads as weight; the held frame is the hit-stop. */
#card-a.picked { border-color: var(--side-a); box-shadow: 0 0 0 1px var(--side-a), 0 16px 50px -18px rgba(69, 212, 255, 0.55); }
#card-b.picked { border-color: var(--side-b); box-shadow: 0 0 0 1px var(--side-b), 0 16px 50px -18px rgba(255, 92, 122, 0.55); }
.card.picked { animation: lockin 320ms cubic-bezier(0.2, 0.9, 0.25, 1) both; }
@keyframes lockin {
  0%   { transform: scale(1, 1); }
  16%  { transform: scale(1.045, 0.945); }
  36%  { transform: scale(1.045, 0.945); } /* ~64ms hold — the hit-stop */
  64%  { transform: scale(0.982, 1.022); }
  100% { transform: scale(1, 1); }
}
/* the passed-over ad recedes instead of just sitting there unchanged */
.card.locked:not(.picked) { filter: brightness(0.48) saturate(0.6); transform: scale(0.985); }

.card.picked::after {
  content: 'LOCKED IN';
  position: absolute;
  inset: auto 0 14px 0;
  margin: 0 auto;
  width: fit-content;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--ink);
  background: var(--bone);
  border-radius: 999px;
  padding: 0.38em 0.95em;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  animation: stamp 0.28s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes stamp { from { opacity: 0; transform: scale(0.82) translateY(6px); } }

/* ── the seam: the divider IS the signature element ── */
.seam {
  flex: 0 0 auto;
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.seam-rule {
  flex: 1;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22) 45%, rgba(255, 255, 255, 0.28));
}
.seam-rule:last-child {
  background: linear-gradient(270deg, transparent, rgba(255, 255, 255, 0.22) 45%, rgba(255, 255, 255, 0.28));
}
.seam-badge {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.1em;
  line-height: 1;
  padding: 0.42em 0.82em 0.32em;
  color: var(--bone);
  border: 1px solid transparent;
  border-radius: 8px;
  transform: skewX(var(--lean));
  background-image: linear-gradient(var(--ink), var(--ink)),
    linear-gradient(120deg, var(--side-a), var(--side-b));
  background-origin: border-box;
  background-clip: padding-box, border-box;
  box-shadow: 0 4px 22px -6px rgba(69, 212, 255, 0.35), 0 4px 22px -6px rgba(255, 92, 122, 0.35);
}

/* ── verdict (errors only during play) ── */
.verdict {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1.1rem;
  border-radius: 6px;
  transform: skewX(var(--lean));
}
.verdict.good { color: var(--win); background: rgba(61, 227, 138, 0.1); }
.verdict.bad { color: var(--loss); background: rgba(255, 93, 93, 0.1); }

/* chunky parallelogram CTAs; the label counter-skews back upright */
.primary {
  font-family: var(--ui);
  display: inline-block;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--ink);
  background: var(--bone);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 2.4rem;
  cursor: pointer;
  transform: skewX(var(--lean));
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.primary .lbl {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  transform: skewX(calc(-1 * var(--lean)));
}
/* 300x271 artwork — size on height and let width follow, or it squashes */
.x-logo { height: 0.92em; width: auto; flex: 0 0 auto; display: block; }
.primary:hover { transform: skewX(var(--lean)) translateY(-2px); box-shadow: 0 10px 30px -10px rgba(243, 245, 249, 0.35); }
.primary:active { transform: skewX(var(--lean)) scale(0.97); }
.primary.ghost {
  background: transparent;
  color: var(--bone);
  border: 1px solid rgba(255, 255, 255, 0.28);
}
.primary.ghost:hover { box-shadow: none; border-color: rgba(255, 255, 255, 0.55); }
.end-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; justify-content: center; }

:is(.card, .primary):focus-visible {
  outline: 2px solid var(--side-a);
  outline-offset: 3px;
}

/* ── results reel: score hero first, shrinks into a dock on scroll ── */
#screen-end { justify-content: flex-start; padding: 0 0 2rem; }

.score-hero {
  min-height: 58dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  /* --p: 0 → 1 scroll progress, set from JS */
}
.score-hero > :not(.end-score) { opacity: calc(1 - var(--p, 0) * 1.4); }
.score-hero .end-score {
  transform: skewX(var(--lean)) scale(calc(1 - 0.45 * var(--p, 0)));
  opacity: calc(1 - 0.6 * var(--p, 0));
  transform-origin: center top;
}
.scroll-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  animation: bob 1.8s ease-in-out infinite;
}
@keyframes bob { 50% { transform: translateY(5px); } }

/* compact score bar that takes over once the hero is scrolled away */
/* the scorebug: score · streak segments in one slim pinned bar */
.score-dock {
  position: sticky;
  top: 0;
  z-index: 6;
  align-self: stretch;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.55rem;
  margin: 0 -1rem 0.9rem;
  padding: 0.45rem;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: rgba(10, 12, 19, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.dock-seg {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  padding: 0.35em 0.75em;
  transform: skewX(var(--lean));
}
.dock-seg.dock-num {
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.05em;
  border: none;
  padding: 0 0.15em;
  background: linear-gradient(100deg, var(--side-a), var(--side-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
#screen-end.docked .score-dock { opacity: 1; }
.results {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  width: 100%;
  max-width: 640px;
}
.rround {
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.rhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0 0.15rem 0.45rem;
}
.rhead span {
  display: inline-block;
  transform: skewX(var(--lean));
  padding: 0.4em 0.9em;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}
.rhead .good { color: var(--win); background: rgba(61, 227, 138, 0.12); }
.rhead .bad { color: var(--loss); background: rgba(255, 93, 93, 0.12); }
.rmatch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  align-items: start; /* pairs with different aspect ratios top-align */
}
.rside {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--panel);
}
.rside img {
  display: block;
  width: 100%;
  height: auto; /* the full creative, uncropped, at its natural aspect ratio */
}
.rside.rwon { border-color: var(--win); box-shadow: 0 0 0 1px var(--win), 0 10px 34px -14px rgba(61, 227, 138, 0.45); }
.rside.rlost { filter: grayscale(0.55) brightness(0.78); }
.rchip {
  position: absolute;
  top: 8px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  border-radius: 5px;
  padding: 0.3em 0.75em;
  transform: skewX(var(--lean));
}
.rchip.rwontag { right: 8px; color: var(--ink); background: var(--win); }
.rchip.ryou { left: 8px; color: var(--ink); background: var(--bone); }
/* brand name only — the numbers live in the tale-of-the-tape spine below */
.rfoot {
  position: absolute;
  inset: auto 0 0 0;
  padding: 1.3rem 0.6rem 0.45rem;
  background: linear-gradient(to top, rgba(6, 8, 13, 0.92) 45%, transparent);
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--bone);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* tale of the tape: values flank a centered stat label */
.rtape {
  margin-top: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.trow {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.trow .tval {
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--bone);
}
.trow .tval.a { text-align: right; }
.trow .tval.b { text-align: left; }
.trow .tval.twin { color: var(--win); }
.trow .tlabel {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  padding: 0.35em 0.8em;
  transform: skewX(var(--lean));
}
.rnote {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 0.7rem;
  display: block;
}

/* ── final score ── */
.end-score {
  font-family: var(--display);
  font-size: clamp(3.6rem, 12vw, 6rem);
  line-height: 1;
  background: linear-gradient(100deg, var(--side-a), var(--side-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pop { animation: pop 0.55s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes pop {
  from { opacity: 0; transform: scale(0.7); }
}
.end-grid { font-size: 1.4rem; letter-spacing: 3px; }
#end-streak { color: var(--dim); }

/* ── desktop arena split: contenders face each other, seam turns vertical ── */
@media (min-width: 700px) {
  .arena { flex-direction: row; align-items: stretch; justify-content: center; gap: 0.9rem; }
  /* Row layout flexes WIDTH, so a height-driven card stretches taller than its
     creative and re-introduces the letterbox top and bottom. Sizing the image
     off `height: 100%` here is circular (card width ← image width ← image
     height ← card height), so the cap is stated outright in dvh: the image
     scales to fit and the frame shrink-wraps it exactly. No bands, either axis. */
  .arena { align-items: center; }
  .card { flex: 0 1 auto; height: auto; width: auto; max-width: 49%; }
  .viewport { height: auto; }
  .card img { height: auto; width: auto; max-height: 74dvh; max-width: 100%; }

  /* Cards are content-sized here (not height-flexed like the phone column), so
     a growing .table would strand the question 200px below the bout. Auto
     margins above and below centre the pair as one group instead. */
  /* Fill the height rather than centring the whole column: auto margins here
     drag the progress bar down with the cards. The table spans the frame, the
     progress sits at its top, and .arena centres the cards in what's left. */
  .table { flex: 1 1 auto; }
  /* align-self: center, NOT stretch — a stretched seam draws a hairline all
     the way down past the bottom of the hugged cards, which reads as a stray
     artifact rather than a divider. Short accents flanking the badge instead. */
  .seam {
    width: auto;
    max-width: none;
    flex-direction: column;
    align-self: center;
    gap: 0.6rem;
  }
  .seam-rule {
    width: 2px;
    height: 68px;
    flex: 0 0 auto;
    background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.26));
  }
  .seam-rule:last-child {
    background: linear-gradient(0deg, transparent, rgba(255, 255, 255, 0.26));
  }
}

/* ── undercard rails appear only when there is genuinely room for them ── */
@media (min-width: 1100px) {
  .rail {
    display: flex;
    flex-direction: column;
    /* flex-start, not center: centring drifts the SPONSORED caption downward on
       tall screens and it stops lining up with the progress bar. */
    justify-content: flex-start;
    gap: 8px;
    /* Fixed, not sticky. Sticky is a no-op here because the rail is the tallest
       thing in .table, so it has no room to stick inside its own containing
       block. Fixed pins it to the viewport: the match can scroll as much as it
       likes and all five slots stay put, always fully visible. */
    position: fixed;
    top: 74px;
    bottom: 14px;
    width: 200px;
    z-index: 5;
  }
  #rail-left { left: 0.5rem; }
  #rail-right { right: 0.5rem; }
  /* keep the match clear of the fixed rails */
  .table { padding-left: 208px; padding-right: 208px; }
  /* line the progress bar up with the SPONSORED caption heading each rail */
  .progress { margin-top: 20px; }
  .rail-tag {
    /* hidden until real sponsors land — flip to `block` to bring it back */
    display: none;
    font-family: var(--mono);
    font-size: 0.54rem;
    font-weight: 700;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: rgba(139, 147, 167, 0.65);
    text-align: center;
    padding-bottom: 0.15rem;
  }

  /* Sponsor card: tinted panel, logo, name, one line. Each slot carries its
     own --tint so a column of five reads as distinct products rather than one
     striped block — the tint stays under 12% alpha so it never competes with
     the aqua/coral the game uses to mean something. */
  /* flex: 0 0 auto — a shrinkable slot gets squeezed by the rail's height and
     silently crops the second line of copy mid-descender. Cards keep their
     natural height; the rail is as tall as its content. */
  .rail-slot {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    /* The rail is a fixed-height viewport column, so the five slots just share
       it evenly — no viewport arithmetic, and a fifth ad can never fall off. */
    flex: 1 1 0;
    max-height: 172px;
    min-height: 0;
    overflow: hidden;
    padding: 1rem 0.9rem;
    border-radius: 13px;
    text-align: center;
    text-decoration: none;
    background: linear-gradient(180deg, rgba(var(--tint), 0.11), rgba(var(--tint), 0.04));
    border: 1px solid rgba(var(--tint), 0.17);
    /* full brightness by default — a paid placement should not need a hover
       to be legible; hover keeps the lift + border glow as feedback */
    opacity: 1;
    transition: transform 0.18s ease, border-color 0.18s ease;
  }
  .rail-slot:empty {
    background: rgba(255, 255, 255, 0.022);
    border-color: rgba(255, 255, 255, 0.06);
  }
  .rail-slot:nth-of-type(5n + 1) { --tint: 69, 212, 255; }
  .rail-slot:nth-of-type(5n + 2) { --tint: 255, 92, 122; }
  .rail-slot:nth-of-type(5n + 3) { --tint: 61, 227, 138; }
  .rail-slot:nth-of-type(5n + 4) { --tint: 168, 130, 255; }
  .rail-slot:nth-of-type(5n + 5) { --tint: 255, 183, 77; }
  .rail-slot:hover { transform: translateY(-2px); border-color: rgba(var(--tint), 0.4); }
  .rail-slot:focus-visible { outline: 2px solid rgba(var(--tint), 0.8); outline-offset: 2px; }

  .rs-logo {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 7px;
    font-size: 0.8rem;
    color: var(--bone);
    background: rgba(var(--tint), 0.2);
    border: 1px solid rgba(var(--tint), 0.28);
  }
  .rs-logo img { display: block; width: 100%; height: 100%; border-radius: 6px; object-fit: cover; }
  .rs-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--bone);
    line-height: 1.2;
  }
  .rs-desc {
    font-size: 0.65rem;
    line-height: 1.32;
    color: var(--dim);
    /* keep every card the same shape no matter how long the copy is */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .rail-slot.rail-cta { --tint: 243, 245, 249; border-style: dashed; }
  .rs-plus {
    font-family: var(--ui);
    font-size: 1.15rem;
    line-height: 1;
    color: var(--dim);
    transition: color 0.18s ease;
  }
  .rail-slot.rail-cta:hover .rs-plus { color: var(--bone); }

  .table { gap: 1.5rem; }
  .rail { flex-basis: 200px; }

  /* The 1020px cap predates the rails. Keeping it strands the table mid-screen
     with dead gutters either side and leaves the rails floating well inside the
     full-width topbar. Rails belong near the edges, as in the reference. */
  #app { max-width: none; padding-left: 0.5rem; padding-right: 0.5rem; }
  .progress { margin-left: -0.5rem; margin-right: -0.5rem; padding: 0 0.5rem; }
}

@media (min-width: 1400px) {
  .rail { width: 220px; }
  .table { padding-left: 232px; padding-right: 232px; }
  .table { gap: 1.15rem; }
  .arena { gap: 0.7rem; }
  .rs-name { font-size: 0.84rem; }
  .rs-desc { font-size: 0.7rem; }
}

/* Short viewports: shrink the sponsor card's CONTENT rather than let a
   fixed-size card overflow its slot and crop copy mid-line. */
@media (max-height: 800px) {
  .rail-slot { padding: 0.7rem 0.8rem; gap: 0.3rem; }
  .rs-logo { width: 26px; height: 26px; font-size: 0.72rem; }
}
@media (max-height: 700px) {
  .rail-slot { padding: 0.55rem 0.7rem; border-radius: 10px; }
  .rs-logo { width: 22px; height: 22px; font-size: 0.66rem; }
  .rs-name { font-size: 0.74rem; }
  .rs-desc { -webkit-line-clamp: 1; font-size: 0.64rem; }
}
@media (max-height: 600px) {
  .rail-tag { display: none; }
  .rs-desc { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rround, .card.deal, .card.picked::after { opacity: 1; }
}

/* ── sponsor setup (post-Stripe) ── */
.sponsor-card {
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.6rem 1.5rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--edge);
  text-align: left;
}
.sponsor-card .eyebrow { align-self: flex-start; }
.sp-status { font-size: 0.85rem; color: var(--dim); min-height: 1.2em; }
.sp-status.sp-error { color: var(--loss); }
.sp-form { display: flex; flex-direction: column; gap: 0.85rem; }
.sp-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.sp-label input,
.sp-label textarea {
  font-family: var(--ui);
  font-size: 0.95rem;
  color: var(--bone);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--edge);
  border-radius: 9px;
  padding: 0.6rem 0.75rem;
  resize: none;
}
.sp-label input:focus-visible,
.sp-label textarea:focus-visible { outline: 2px solid var(--side-a); outline-offset: 1px; }
.sp-label input[type='file'] { padding: 0.45rem; font-size: 0.8rem; }
.sp-form .primary { align-self: flex-start; margin-top: 0.2rem; }
.sp-big {
  font-family: var(--display);
  font-size: 1.6rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
#sp-done { display: flex; flex-direction: column; gap: 0.8rem; align-items: flex-start; }
