/* The Court: the page is a top-down pickleball court. Owned by stream A. */

:root { --icon-ios: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M16.4 12.6c0-2.3 1.9-3.4 2-3.5-1.1-1.6-2.8-1.8-3.4-1.8-1.4-.1-2.8.9-3.5.9-.7 0-1.9-.8-3.1-.8-1.6 0-3.1.9-3.9 2.4-1.7 2.9-.4 7.3 1.2 9.7.8 1.2 1.8 2.5 3 2.4 1.2 0 1.7-.8 3.1-.8s1.9.8 3.1.8c1.3 0 2.1-1.2 2.9-2.3.9-1.3 1.3-2.6 1.3-2.7-.1 0-2.7-1-2.7-4.3zM14.1 5.6c.6-.8 1.1-1.9.9-3-.9 0-2.1.6-2.7 1.4-.6.7-1.1 1.8-1 2.9 1.1.1 2.1-.5 2.8-1.3z'/></svg>"); --icon-android: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M17.5 9.5h-11a.5.5 0 0 0-.5.5v7a1.5 1.5 0 0 0 1.5 1.5H8v2.5a1.5 1.5 0 0 0 3 0V18.5h2V21a1.5 1.5 0 0 0 3 0v-2.5h.5A1.5 1.5 0 0 0 18 17v-7a.5.5 0 0 0-.5-.5zM4 9.5A1.5 1.5 0 0 0 2.5 11v5a1.5 1.5 0 0 0 3 0v-5A1.5 1.5 0 0 0 4 9.5zm16 0A1.5 1.5 0 0 0 18.5 11v5a1.5 1.5 0 0 0 3 0v-5A1.5 1.5 0 0 0 20 9.5zM15.6 3.9l1.1-1.6a.3.3 0 0 0-.5-.3l-1.1 1.7A6.8 6.8 0 0 0 12 3.2a6.8 6.8 0 0 0-3.1.5L7.8 2a.3.3 0 0 0-.5.3l1.1 1.6A6 6 0 0 0 5.5 8.5h13a6 6 0 0 0-2.9-4.6zM9.3 6.6a.7.7 0 1 1 0-1.4.7.7 0 0 1 0 1.4zm5.4 0a.7.7 0 1 1 0-1.4.7.7 0 0 1 0 1.4z'/></svg>"); }

body {
  background:
    radial-gradient(70% 36% at 50% 0%, rgba(59, 124, 240, 0.32), transparent 70%),
    radial-gradient(50% 30% at 50% 100%, rgba(47, 181, 119, 0.18), transparent 70%),
    var(--surround);
  color: var(--line); overflow-x: clip;
}
.box, .kitchen-inner, .proof { min-width: 0; }
.nowrap { white-space: nowrap; }

.skip {
  position: absolute; left: var(--space-4); top: -3rem; z-index: 50;
  background: var(--ball); color: var(--ink); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius); text-decoration: none; font-weight: 600;
}
.skip:focus { top: var(--space-4); }

/* Layout: one shared column for the rail, the court and the footer */
:root { --court-w: min(100vw - 2 * var(--gutter), 60rem); }
.rail-inner, .court, .apron { width: var(--court-w); margin-inline: auto; }

/* Fixed header bar. Nothing scrolls over it; the court slides under it. */
.rail {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; padding: var(--space-2) 0;
  background: rgba(11, 40, 35, 0.82);
  border-bottom: 1px solid var(--glass-edge);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.rail-inner { display: flex; justify-content: space-between; align-items: center; min-height: 2.9rem; }
body { padding-top: 4.2rem; }
.rail-mark {
  font-family: var(--font-display); font-weight: 800; font-size: var(--step-1);
  letter-spacing: 0; text-decoration: none; color: var(--line);
}
.rail-score { margin: 0 0 0 auto; display: flex; align-items: center; gap: var(--space-3); font-family: var(--font-display); }
.rail-call {
  font-size: var(--step-1); font-weight: 800; color: var(--ink); background: var(--ball);
  padding: 0.15em 0.6em; border-radius: var(--radius-pill); font-variant-numeric: tabular-nums;
}
.rail-note { font-size: var(--step--1); font-weight: 600; opacity: 0.85; }
.rail-sound {
  margin-left: var(--space-3); cursor: pointer; font-family: var(--font-display); font-weight: 600; font-size: var(--step--1);
  color: var(--line); background: transparent; border: 1px solid var(--glass-edge); border-radius: var(--radius-pill);
  padding: 0.35em 0.8em; opacity: 0.85;
}
.rail-sound[aria-pressed="true"] { background: var(--glass); border-color: rgba(246,244,236,0.4); opacity: 1; }
@media (max-width: 30rem) { .rail-sound { display: none; } }

/* The court */
.court {
  position: relative;
  margin-top: var(--space-6);
  border: var(--line-w) solid var(--line-a);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--court-hi), var(--court) 40%);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 0 1px rgba(246, 244, 236, 0.06);
}
@media (min-width: 60rem) { .court { margin-top: var(--space-7); } }

.zone { position: relative; padding: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 3rem); }
.zone::after {
  content: attr(data-chapter); position: absolute; top: var(--space-4); right: var(--space-5);
  font-family: var(--font-display); font-weight: 600; font-size: var(--step--1); opacity: 0.55; letter-spacing: 0.02em;
}

/* Service boxes with a centre line that runs the full height of the zone */
.zone-hero, .zone-far { display: grid; grid-template-columns: 1fr; gap: var(--space-6); }
@media (min-width: 48rem) {
  .zone-hero, .zone-far { grid-template-columns: 1fr 1fr; column-gap: clamp(2rem, 5vw, 4rem); }
  .zone-hero::before, .zone-far::before {
    content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
    width: var(--line-w); margin-left: calc(var(--line-w) / -2); background: var(--line-a);
  }
}

.zone-hero { min-height: min(76vh, 44rem); align-content: center; align-items: center; }
.hero-title { font-size: clamp(3rem, 1rem + 5vw, 6rem); font-weight: 800; }
.hero-copy { max-width: 30rem; font-size: var(--step-1); line-height: 1.4; margin: var(--space-5) 0 0; opacity: 0.95; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }
.zone-actions { margin-top: var(--space-5); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer;
  font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); line-height: 1;
  padding: 0.85em 1.3em; border-radius: var(--radius); border: 1px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), border-color var(--dur-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn-ball { background: var(--ball); color: var(--ink); }
.btn-ball:hover { background: color-mix(in srgb, var(--ball) 88%, white); }
.btn-line { color: var(--line); background: var(--glass); border-color: var(--glass-edge); }
.btn-line:hover { background: rgba(246, 244, 236, 0.14); border-color: rgba(246, 244, 236, 0.4); }
.btn-small { font-size: var(--step-0); }

/* Hero stage: a 3D court with the scoreboard floating above it */
.stage { position: relative; width: 100%; max-width: 24rem; margin-inline: auto; }
.c3-scene {
  height: clamp(19rem, 40vw, 27rem);
  perspective: 900px; perspective-origin: 50% 30%;
  display: grid; place-items: center;
  padding-top: 3.5rem;
}
.c3-plane {
  --tilt-x: 56deg; --tilt-y: 0deg; --serve-from: 72%; --serve-to: 28%;
  position: relative; width: 13.5rem; height: 29rem;
  transform-style: preserve-3d;
  transform: rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(0.86);
  transform-origin: 50% 50%;
  transition: transform 200ms var(--ease-out);
}
.stage-prompt { font-size: var(--step--1); margin: 3rem 0 0; opacity: 0.7; text-align: center; }
@media (max-width: 48rem) { .stage-prompt { margin-top: 0.5rem; } }
.c3-surface {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, var(--court-deep), var(--court-hi));
  border: 2px solid var(--line-a); border-radius: 6px;
  box-shadow: 0 40px 50px rgba(5, 12, 24, 0.35);
}
.c3-surface::before {
  /* outer apron glow */
  content: ""; position: absolute; inset: -14%; z-index: -1; border-radius: 12px;
  background: rgba(47, 181, 119, 0.35); filter: blur(1px);
}
.c3-kitchen {
  position: absolute; left: 0; right: 0; top: calc(50% - 16%); height: 32%;
  background: linear-gradient(180deg, var(--kitchen), var(--kitchen-hi));
}
.c3-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--line-a); }
.c3-line-near { top: calc(50% + 16%); }
.c3-line-far { top: calc(50% - 16%); }
.c3-centre { position: absolute; left: 50%; width: 2px; margin-left: -1px; background: var(--line-a); }
.c3-centre-near { top: calc(50% + 16%); bottom: 0; }
.c3-centre-far { top: 0; height: calc(50% - 16%); }
.c3-net {
  position: absolute; left: -4%; right: -4%; top: 50%; height: 2.2rem;
  transform-origin: 50% 100%; transform: translateY(-100%) rotateX(-90deg);
  transform-style: preserve-3d;
  background:
    repeating-linear-gradient(90deg, rgba(246,244,236,0.4) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(0deg, rgba(246,244,236,0.4) 0 1px, transparent 1px 5px),
    rgba(10, 22, 44, 0.35);
  border-top: 3px solid var(--line);
}
.c3-net::before, .c3-net::after {
  content: ""; position: absolute; top: -0.2rem; bottom: 0; width: 0.35rem; background: var(--ink); border-radius: 2px;
}
.c3-net::before { left: 0; } .c3-net::after { right: 0; }
/* Two players stand on the court as upright figures. The near one serves, the far one receives.
   Both shuffle toward the ball and swing when it arrives, on the same timeline as the ball. */
.c3-player {
  position: absolute; width: 2.4rem; height: 4.2rem; margin-left: -1.2rem;
  transform-origin: 50% 100%; transform-style: preserve-3d;
}
.c3-player-near { left: calc(var(--serve-from) - 9%); top: 99%; margin-top: -4.2rem; transform: rotateX(calc(-1 * var(--tilt-x))) rotateY(calc(-1 * var(--tilt-y))); animation: p-near 4.2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.c3-player-far  { left: calc(var(--serve-to) + 9%); top: 6%; margin-top: -4.2rem; transform: rotateX(calc(-1 * var(--tilt-x))) rotateY(calc(-1 * var(--tilt-y))) scaleX(-1); animation: p-far 4.2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.c3-player .pose { position: absolute; left: 50%; bottom: 0; translate: -50% 0; height: 100%; width: auto; }
.c3-player .pose-swing { opacity: 0; }
body.swing-near .c3-player-near .pose-swing, body.swing-far .c3-player-far .pose-swing { opacity: 1; }
body.swing-near .c3-player-near .pose-idle, body.swing-far .c3-player-far .pose-idle { opacity: 0; }
@keyframes p-near { 0% { left: calc(var(--serve-from) - 9%); } 50% { left: calc(var(--serve-from) * 0.6 + 11%); } 100% { left: calc(var(--serve-from) - 9%); } }
@keyframes p-far  { 0% { left: calc(var(--serve-to) + 9%); } 50% { left: calc(var(--serve-to) * 0.6 + 29%); } 100% { left: calc(var(--serve-to) + 9%); } }
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .c3-player-near, .c3-player-far { animation-timeline: scroll(root); animation-range: 0 90vh; animation-fill-mode: both; }
  }
}
@media (prefers-reduced-motion: reduce) { .c3-player { animation: none; } }

.c3-shadow {
  position: absolute; width: 1.1rem; height: 1.1rem; border-radius: 50%; left: var(--serve-from); top: 92%;
  margin: -0.55rem 0 0 -0.55rem; background: rgba(5, 12, 24, 0.4); filter: blur(2px);
  animation: c3-path 4.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
.c3-ball {
  position: absolute; width: 1.1rem; height: 1.1rem; border-radius: 50%; left: var(--serve-from); top: 92%;
  margin: -0.55rem 0 0 -0.55rem; background: var(--ball);
  box-shadow: inset -3px -3px 0 var(--ball-shadow);
  transform-style: preserve-3d;
  animation: c3-path 4.2s cubic-bezier(0.4, 0, 0.6, 1) infinite, c3-arc 4.2s linear infinite;
}
/* the ball crosses the court twice per loop: near right to far left, then back */
@keyframes c3-path {
  0%   { left: var(--serve-from); top: 92%; }
  50%  { left: var(--serve-to); top: 8%; }
  100% { left: var(--serve-from); top: 92%; }
}
/* Pick your side moves the serve: iPhone serves from the left half, Android from the right */
body.serve-left .c3-plane { --serve-from: 28%; --serve-to: 72%; }
body.serve-right .c3-plane { --serve-from: 72%; --serve-to: 28%; }
/* Scroll scrubs the rally where supported: the reader serves by scrolling, and scrolling back rewinds */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .c3-ball { animation: c3-path linear both, c3-arc linear both; animation-timeline: scroll(root), scroll(root); animation-range: 0 90vh, 0 90vh; }
    .c3-shadow { animation: c3-path linear both; animation-timeline: scroll(root); animation-range: 0 90vh; }
  }
}
/* height above the surface: bounce on each side, clear the net at the middle */
@keyframes c3-arc {
  0%   { transform: translateZ(1.2rem) scale(1); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  12%  { transform: translateZ(4.2rem) scale(0.96); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  24%  { transform: translateZ(0.3rem) scale(1.15, 0.85); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  36%  { transform: translateZ(4.6rem) scale(0.96); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  50%  { transform: translateZ(1.4rem) scale(1); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  62%  { transform: translateZ(4.2rem) scale(0.96); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  74%  { transform: translateZ(0.3rem) scale(1.15, 0.85); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  86%  { transform: translateZ(4.6rem) scale(0.96); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  100% { transform: translateZ(1.2rem) scale(1); }
}
@media (max-width: 48rem) {
  .c3-scene { height: 24rem; padding-top: 2.5rem; perspective-origin: 50% 36%; }
  .c3-plane { transform: translateY(-3rem) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) scale(0.64); }
}
@media (prefers-reduced-motion: reduce) {
  .c3-ball, .c3-shadow { animation: none; left: 60%; top: 78%; }
  .c3-ball { transform: translateZ(1rem); }
}
.board {
  position: absolute; top: 0; left: 50%; translate: -50% 0;
  display: flex; gap: 0; z-index: 2;
  font-family: var(--font-display);
  background: rgba(10, 22, 44, 0.5); color: var(--line);
  border: 1px solid var(--glass-edge); border-radius: var(--radius);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding: var(--space-2) var(--space-3);
  box-shadow: 0 12px 30px rgba(5, 12, 24, 0.3);
}
.board-cell {
  display: grid; justify-items: center; gap: 0; padding: 0 var(--space-4); min-width: 4.5rem;
  border-left: 1px solid rgba(246, 244, 236, 0.14);
}
.board-cell:first-child { border-left: 0; }
.board-name { font-size: var(--step--1); font-weight: 600; opacity: 0.75; }
.board-num { font-size: var(--step-2); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.board-serve .board-num { color: var(--ball); }

/* Kitchen bands */
.zone-kitchen { background: linear-gradient(180deg, var(--kitchen-hi), var(--kitchen)); border-top: var(--line-w) solid var(--line-a); border-bottom: var(--line-w) solid var(--line-a); }
.kitchen-inner { max-width: 36rem; }
@media (min-width: 48rem) {
  .kitchen-inner {
    max-width: none; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; column-gap: clamp(2rem, 5vw, 4rem); align-items: start;
  }
  .kitchen-inner .zone-title, .kitchen-inner .zone-copy { grid-column: 1; }
  .kitchen-inner .signup { grid-column: 2; grid-row: 1 / span 2; margin-top: 0; }
}
.zone-title { font-size: clamp(2.2rem, 1rem + 3.2vw, 4rem); }
.zone-copy { max-width: var(--measure); font-size: var(--step-0); margin: var(--space-4) 0 0; line-height: 1.55; opacity: 0.95; }
.zone-copy-small { font-size: var(--step--1); opacity: 0.8; }

/* The net */
.net {
  position: relative; height: 1.1rem;
  background:
    repeating-linear-gradient(90deg, rgba(246,244,236,0.35) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(0deg, rgba(246,244,236,0.35) 0 1px, transparent 1px 6px),
    rgba(10, 22, 44, 0.55);
  border-top: 3px solid var(--line);
  box-shadow: 0 6px 14px rgba(5, 12, 24, 0.35);
}
.post { position: absolute; top: -0.5rem; bottom: -0.35rem; width: 0.5rem; background: var(--ink); border-radius: 3px; }
.post-left { left: 0.6rem; }
.post-right { right: 0.6rem; }

/* Signup: pick your side */
.signup { margin-top: var(--space-6); display: grid; gap: var(--space-4); }
.side-pick {
  position: relative; border: 0; padding: 0; margin: 0;
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3);
}
.side-pick legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.side {
  position: relative; display: grid; place-items: center; min-height: 7.5rem; cursor: pointer;
  background: rgba(10, 22, 44, 0.28); border: 1px solid var(--glass-edge); border-radius: var(--radius-lg);
  font-family: var(--font-display); font-weight: 700; font-size: var(--step-1);
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.side:hover { background: rgba(10, 22, 44, 0.38); }
.side input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.side > span:last-child { position: relative; z-index: 1; }
.side { grid-template-rows: auto auto; row-gap: var(--space-2); padding: var(--space-4) 0 var(--space-3); align-content: center; }
.side-figure { position: relative; display: block; width: 3rem; height: 4.4rem; }
.side-figure img { position: absolute; left: 50%; bottom: 0; translate: -50% 0; height: 100%; width: auto; filter: drop-shadow(0 6px 8px rgba(5, 12, 24, 0.35)); }
.side-figure .p-mark {
  position: absolute; left: 50%; top: 1.45rem; translate: -50% 0; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--line); display: grid; place-items: center; box-shadow: 0 2px 6px rgba(5,12,24,0.3);
}
.side-figure .p-mark::after { content: ""; width: 0.7rem; height: 0.7rem; background: var(--ink); -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.side:has(input:checked) .side-figure img { translate: -50% -0.25rem; }
.side-figure img { transition: translate var(--dur) var(--ease-out); }
.side-ios { --icon: var(--icon-ios); }
.side-android { --icon: var(--icon-android); }
.side:has(input:checked) { background: var(--court); border-color: var(--line); }
.side:has(input:focus-visible) { outline: 3px solid var(--ball); outline-offset: 3px; }
/* the ball drops onto the picked side */
.side-ball {
  position: absolute; bottom: 0.8rem; left: 25%; translate: -50% 0;
  width: 1.3rem; height: 1.3rem; border-radius: 50%; background: var(--ball);
  box-shadow: inset -3px -3px 0 var(--ball-shadow), 0 6px 10px rgba(5, 12, 24, 0.35);
  opacity: 0; transform: translateY(-3rem); pointer-events: none;
  transition: left var(--dur) var(--ease-out), transform var(--dur) cubic-bezier(0.3, 1.6, 0.5, 1), opacity var(--dur-fast);
}
.side-pick:has(.side-ios input:checked) .side-ball { opacity: 1; transform: translateY(0); left: calc(25% - var(--space-3) / 4); }
.side-pick:has(.side-android input:checked) .side-ball { opacity: 1; transform: translateY(0); left: calc(75% + var(--space-3) / 4); }

.email, .consent { display: grid; gap: var(--space-2); font-weight: 600; }
.email input {
  width: 100%; padding: 0.85em 1em; border-radius: var(--radius);
  border: 1px solid var(--glass-edge); background: rgba(10, 22, 44, 0.28); color: var(--line); font-size: var(--step-0);
}
.email input::placeholder { color: rgba(246, 244, 236, 0.5); }
.email input:focus { border-color: var(--line); outline: none; box-shadow: 0 0 0 3px rgba(240, 226, 59, 0.35); }
.consent { grid-template-columns: auto 1fr; align-items: start; font-weight: 400; font-size: var(--step--1); line-height: 1.45; opacity: 0.95; }
.consent input { width: 1.2rem; height: 1.2rem; margin-top: 0.15rem; accent-color: var(--ball); }
.signup button {
  justify-self: start; cursor: pointer;
  font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); line-height: 1;
  padding: 0.85em 1.8em; border-radius: var(--radius); background: var(--ball); color: var(--ink); border: 0;
  transition: transform var(--dur-fast) var(--ease-out);
}
.signup button:hover { transform: translateY(-1px); }
.signup.is-busy button { opacity: 0.6; pointer-events: none; }
.signup.is-done button, .signup.is-done .email, .signup.is-done .consent, .signup.is-done .side-pick { display: none; }
.signup-status { margin: 0; min-height: 1.5em; font-weight: 600; }
.signup.is-error .signup-status { color: var(--paper); background: var(--danger); padding: var(--space-2) var(--space-3); border-radius: var(--radius); }
.signup.is-done .signup-status { font-family: var(--font-display); font-size: var(--step-2); color: var(--ball); }

/* Proofs on the far kitchen: three zones separated by court lines */
.proofs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: var(--space-3); perspective: 1200px; }
.proof {
  position: relative; padding: var(--space-5); border-radius: var(--radius-lg);
  background: rgba(10, 22, 44, 0.16); border: 1px solid rgba(246, 244, 236, 0.14);
  transform-style: preserve-3d; transition: transform var(--dur) var(--ease-out), background var(--dur), border-color var(--dur);
}
.proof::after {
  content: ""; position: absolute; top: var(--space-4); right: var(--space-4); width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: var(--ball); box-shadow: inset -2px -2px 0 var(--ball-shadow); opacity: 0; transform: translateY(-1rem);
  transition: opacity var(--dur-fast), transform var(--dur) cubic-bezier(0.3, 1.6, 0.5, 1);
}
.proof:hover, .proof:focus-within { transform: translateZ(28px) translateY(-4px); background: rgba(10, 22, 44, 0.26); border-color: rgba(246, 244, 236, 0.3); }
.proof:hover::after, .proof:focus-within::after { opacity: 1; transform: translateY(0); }
.proof h2 { font-size: var(--step-2); }
.proof p { margin: var(--space-3) 0 0; max-width: 30rem; line-height: 1.55; opacity: 0.95; }
@media (min-width: 48rem) {
  .proofs { grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
}

/* Far court: the hidden game. One ball on a baseline, press space or tap it, like the offline dinosaur. */
.zone-far { background: linear-gradient(180deg, var(--court), var(--court-deep) 60%); align-items: start; padding-top: clamp(2rem, 4vw, 3rem); padding-bottom: clamp(5rem, 7vw, 6.5rem); }
@media (min-width: 48rem) { .zone-far { padding-bottom: 10rem; } }
.zone-far .zone-title { font-size: var(--step-2); }
.arena-prompt {
  position: relative; width: 100%; min-height: 13rem; cursor: pointer; border: 0; background: transparent; color: var(--line);
  display: grid; grid-template-rows: auto auto 1fr auto auto; justify-items: center; align-items: end; gap: var(--space-2); padding: 0;
  font: inherit; text-align: center;
}
.arena-heading { font-family: var(--font-display); font-weight: 800; font-size: var(--step-3); line-height: 0.98; }
.arena-sub { font-size: var(--step-0); opacity: 0.85; margin-bottom: var(--space-4); }
.arena-ball { margin: 4.5rem 0 var(--space-3); }
.arena-prompt:focus-visible { outline: 3px solid var(--ball); outline-offset: 6px; border-radius: var(--radius); }
.arena-ball { position: relative; width: 2.6rem; height: 2.6rem; animation: idle-bounce 1.6s infinite; }
.arena-ball-body {
  position: absolute; inset: 0; border-radius: 50%; background: var(--ball);
  box-shadow: inset -8px -8px 0 var(--ball-shadow);
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.45) 0 12%, transparent 13%),
    radial-gradient(circle, rgba(0,0,0,0.12) 0 2px, transparent 2.5px);
  background-size: 100% 100%, 22% 22%;
  animation: idle-squash 1.6s infinite;
}
.arena-ball-shadow { position: absolute; left: 10%; right: 10%; bottom: -0.7rem; height: 0.7rem; border-radius: 50%; background: rgba(5, 12, 24, 0.35); filter: blur(2px); animation: idle-shade 1.6s infinite; }
.arena-baseline { width: 100%; height: var(--line-w); background: var(--line-a); }
.arena-text { font-family: var(--font-display); font-weight: 600; font-size: var(--step-1); opacity: 0.9; margin-top: var(--space-3); }
.arena-prompt kbd { font: inherit; padding: 0.05em 0.5em; border: 1px solid var(--glass-edge); border-radius: 6px; background: var(--glass); }
.arena-prompt:hover .arena-ball { animation-duration: 1s; }
.arena-prompt:hover .arena-ball-body { animation-duration: 1s; }
.arena-prompt:hover .arena-ball-shadow { animation-duration: 1s; }
/* a real bounce: fast off the ground, slow at the top, squash on impact */
@keyframes idle-bounce {
  0% { transform: translateY(0); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  50% { transform: translateY(-3.2rem); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  100% { transform: translateY(0); }
}
@keyframes idle-squash {
  0%, 100% { transform: scale(1.18, 0.82); }
  8% { transform: scale(0.94, 1.08); }
  50% { transform: scale(1, 1); }
  92% { transform: scale(0.94, 1.08); }
}
@keyframes idle-shade { 0%, 100% { transform: scale(1.1); opacity: 0.45; } 50% { transform: scale(0.55); opacity: 0.15; } }
@media (prefers-reduced-motion: reduce) { .arena-ball, .arena-ball-body, .arena-ball-shadow { animation: none; } }

/* The arena: a full-screen overlay for the game */
.arena { position: fixed; inset: 0; z-index: 60; background: var(--surround); display: grid; grid-template-rows: auto 1fr; }
.arena[hidden] { display: none; }
.arena-chrome { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) var(--gutter); color: var(--line); }
.arena-call { font-family: var(--font-display); font-weight: 800; font-size: var(--step-1); color: var(--ink); background: var(--ball); padding: 0.15em 0.6em; border-radius: var(--radius-pill); }
.arena-close { cursor: pointer; font: inherit; font-family: var(--font-display); font-weight: 600; color: var(--line); background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--radius-pill); padding: 0.4em 0.9em; }
.arena-close kbd { font: inherit; opacity: 0.7; margin-left: 0.3em; }
.arena-stage { position: relative; display: grid; place-items: center; padding: 0 var(--gutter) var(--gutter); }
.arena-frame { width: min(100%, calc((100vh - 7rem) * 9 / 16)); height: calc(100vh - 7rem); border: 0; border-radius: var(--radius-lg); background: var(--surround); box-shadow: var(--shadow); }
.arena-count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: clamp(6rem, 18vw, 12rem); color: var(--line); pointer-events: none; opacity: 0; }
.arena.is-counting .arena-count { opacity: 1; animation: count-pop 260ms var(--ease-out); }
.arena.is-counting .arena-frame { opacity: 0; }
@keyframes count-pop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
body.arena-open { overflow: hidden; }

/* Footer: the apron */
.apron {
  padding: var(--space-7) 0 var(--space-9);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4); align-items: baseline;
}
.apron-line { margin: 0; opacity: 0.8; }
.apron-credits { margin: 0; flex-basis: 100%; font-size: var(--step--1); opacity: 0.55; }
.apron-links { display: flex; gap: var(--space-5); }
.apron-links a { color: var(--line); text-decoration-thickness: 1px; text-underline-offset: 4px; opacity: 0.9; }

/* Page-level rally: two rendered players on the page's own baselines, the ball travels the centre line with scroll */
.page-player { position: absolute; width: 7rem; height: 9.5rem; z-index: 3; pointer-events: none; }
.page-player-near { top: 0.3rem; left: calc(75% - 3.5rem); }
.page-player-far { bottom: 0.3rem; left: calc(25% - 3.5rem); }
.page-player .pose {
  position: absolute; left: 50%; bottom: 0; translate: -50% 0; height: 100%; width: auto;
  filter: drop-shadow(0 14px 18px rgba(5, 12, 24, 0.35));
  transition: opacity 160ms linear;
}
.page-player-near .pose { transform: scaleX(-1); }
.page-player .pose-swing { opacity: 0; }
body.swing-near .page-player-near .pose-swing, body.swing-far .page-player-far .pose-swing { opacity: 1; }
body.swing-near .page-player-near .pose-idle, body.swing-far .page-player-far .pose-idle { opacity: 0; }

.page-ball {
  position: fixed; left: 50vw; top: 9.5rem; width: 1.7rem; height: 1.7rem; translate: -50% 0;
  z-index: 15; pointer-events: none;
}
.page-ball-body {
  position: absolute; inset: 0; border-radius: 50%; background: var(--ball);
  box-shadow: inset -5px -5px 0 var(--ball-shadow), 0 8px 16px rgba(5, 12, 24, 0.3);
  background-image: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.45) 0 12%, transparent 13%),
    radial-gradient(circle, rgba(0,0,0,0.12) 0 1.5px, transparent 2px);
  background-size: 100% 100%, 22% 22%;
}
.page-ball-shadow {
  position: absolute; left: 12%; right: 12%; bottom: -60%; height: 28%; border-radius: 50%;
  background: rgba(5, 12, 24, 0.35); filter: blur(2px);
}
/* The ball waits at the near paddle until the page can scroll. Where scroll timelines exist the whole page is the rally. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .page-ball { animation: page-travel linear both; animation-timeline: scroll(root); }
    .page-ball-body { animation: page-bounce linear both; animation-timeline: scroll(root); }
    .page-ball-shadow { animation: page-shade linear both; animation-timeline: scroll(root); }
    .page-player-near .p-paddle, .page-player-far .p-paddle { animation-play-state: running; animation-timeline: scroll(root); }
  }
}
@keyframes page-travel { 0% { top: 10.6rem; left: calc(50vw + var(--court-w) / 4 - 2.6rem); } 100% { top: calc(100vh - 21.8rem); left: calc(50vw - var(--court-w) / 4 + 1.4rem); } }
/* eight touches of the court between the two paddles. Up is fast then slow, down is slow then fast, squash on touch. */
@keyframes page-bounce {
  0%   { transform: translateY(0) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  6%   { transform: translateY(-5vh) scale(0.96, 1.06); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  12%  { transform: translateY(0.4vh) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  18%  { transform: translateY(-5vh) scale(0.96, 1.06); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  25%  { transform: translateY(0.4vh) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  31%  { transform: translateY(-5vh) scale(0.96, 1.06); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  37%  { transform: translateY(0.4vh) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  43%  { transform: translateY(-8vh) scale(0.94, 1.08); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  50%  { transform: translateY(0.4vh) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  56%  { transform: translateY(-5vh) scale(0.96, 1.06); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  62%  { transform: translateY(0.4vh) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  68%  { transform: translateY(-5vh) scale(0.96, 1.06); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  75%  { transform: translateY(0.4vh) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  81%  { transform: translateY(-5vh) scale(0.96, 1.06); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  87%  { transform: translateY(0.4vh) scale(1.14, 0.86); animation-timing-function: cubic-bezier(0.2, 0.7, 0.4, 1); }
  93%  { transform: translateY(-4vh) scale(0.97, 1.04); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.3); }
  100% { transform: translateY(0) scale(1.1, 0.9); }
}
@keyframes page-shade {
  0%, 12%, 25%, 37%, 50%, 62%, 75%, 87%, 100% { opacity: 0.45; transform: scale(1.05); }
  6%, 18%, 31%, 43%, 56%, 68%, 81%, 93% { opacity: 0.18; transform: scale(0.7); }
}
@media (prefers-reduced-motion: reduce) { .page-ball-body, .page-ball-shadow { animation: none; } }
@media (max-width: 48rem) {
  .page-player { left: auto; right: 0.4rem; width: 5rem; height: 6.8rem; }
  .arena-prompt { padding-bottom: 5rem; }
  .page-player-near { left: auto; top: 0.2rem; }
  .page-player-far { left: auto; bottom: 0.2rem; }
  .page-ball { width: 1.3rem; height: 1.3rem; translate: 0 0; }
  @keyframes page-travel { 0% { top: 10.2rem; left: calc(100vw - 5.4rem); } 100% { top: calc(100vh - 25rem); left: calc(100vw - 5.4rem); } }
  .zone-hero { padding-top: 5.5rem; }
  .zone-hero::after { right: auto; left: var(--space-5); }
}
