:root {
  color-scheme: light;
  --ink: #191a1f;
  --muted: #626671;
  --line: #d9dddc;
  --paper: #f7f2e8;
  --court: #4fa187;
  --kitchen: #d87363;
  --team-a: #f0c94a;
  --team-b: #6ba6e8;
  --panel: #fffaf0;
  --shadow: 0 18px 45px rgba(20, 25, 25, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(25, 26, 31, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(25, 26, 31, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.game-shell {
  width: min(1180px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 0;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto auto;
  gap: 14px;
}

.scorebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.team-score,
.serve-pill,
.turn-card,
.side-panel {
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--ink);
}

.team-score {
  min-height: 82px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: transform 160ms ease, background 160ms ease;
}

.team-score-a {
  border-left: 12px solid var(--team-a);
}

.team-score-b {
  border-right: 12px solid var(--team-b);
}

.team-label {
  min-width: 0;
  font-size: clamp(1.25rem, 2.2vw, 2rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.team-score strong {
  font-size: clamp(2.7rem, 7vw, 5.8rem);
  line-height: 0.8;
}

.serve-pill {
  min-width: 118px;
  padding: 14px 18px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 950;
}

.court-wrap {
  min-height: 360px;
  display: grid;
  place-items: stretch;
  perspective: 1100px;
}

.stadium {
  position: relative;
  min-height: 410px;
  overflow: hidden;
  border: 4px solid var(--ink);
  background:
    radial-gradient(circle at 22% 4%, rgba(255, 240, 166, 0.72), transparent 18%),
    radial-gradient(circle at 78% 4%, rgba(238, 249, 255, 0.86), transparent 18%),
    linear-gradient(#2f3941 0 17%, #65747b 17% 25%, #58765f 25% 100%);
  box-shadow: var(--shadow);
}

.stadium::before {
  content: "";
  position: absolute;
  inset: 15% 2% 9%;
  border-radius: 50% / 9%;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(rgba(25, 26, 31, 0.14) 1px, transparent 1px),
    #31543d;
  background-size: 28px 28px;
  transform: perspective(760px) rotateX(58deg);
  transform-origin: center bottom;
}

.crowd {
  position: absolute;
  left: 0;
  right: 0;
  height: 58px;
  z-index: 1;
  background:
    radial-gradient(circle, #f0c94a 0 4px, transparent 5px) 0 12px / 31px 22px,
    radial-gradient(circle, #6ba6e8 0 4px, transparent 5px) 12px 20px / 37px 24px,
    radial-gradient(circle, #d87363 0 4px, transparent 5px) 22px 10px / 43px 20px,
    #20242b;
  border-bottom: 4px solid var(--ink);
}

.crowd-top {
  top: 0;
}

.crowd-bottom {
  bottom: 0;
  height: 48px;
  border-top: 4px solid var(--ink);
  border-bottom: 0;
}

.stadium-lights {
  position: absolute;
  top: 52px;
  z-index: 3;
  width: 80px;
  height: 104px;
  border-left: 4px solid var(--ink);
  border-top: 4px solid var(--ink);
  opacity: 0.9;
}

.stadium-lights::before {
  content: "";
  position: absolute;
  left: -17px;
  top: -17px;
  width: 72px;
  height: 22px;
  border: 3px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, #fff7b8 0 10px, #d7ff3f 10px 20px);
  box-shadow: 0 0 35px rgba(255, 247, 184, 0.74);
}

.lights-left {
  left: 7%;
}

.lights-right {
  right: 7%;
  transform: scaleX(-1);
}

.sideline {
  position: absolute;
  top: 28%;
  bottom: 18%;
  z-index: 2;
  width: 72px;
  background:
    linear-gradient(90deg, rgba(25, 26, 31, 0.26) 2px, transparent 2px) 0 0 / 18px 18px,
    #e8dfc8;
  border: 3px solid var(--ink);
  transform: perspective(700px) rotateX(58deg);
}

.sideline-left {
  left: 3%;
  transform-origin: right bottom;
}

.sideline-right {
  right: 3%;
  transform-origin: left bottom;
}

.court {
  position: relative;
  overflow: hidden;
  width: min(920px, 86vw);
  min-height: 330px;
  height: min(54vw, 470px);
  margin: 54px auto 42px;
  border: 4px solid var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.13) 1px, transparent 1px),
    var(--court);
  background-size: 34px 34px;
  box-shadow: 0 14px 0 #2e6f5d, 0 26px 28px rgba(0, 0, 0, 0.24);
  transform: rotateX(7deg);
  transform-origin: center bottom;
  z-index: 4;
}

.court.impact {
  animation: court-impact 260ms steps(2, end);
}

.court.rally-glow {
  animation: rally-glow 520ms ease;
}

.court-zone {
  position: absolute;
  left: 5.5%;
  right: 5.5%;
  z-index: 1;
}

.zone-baseline-top {
  top: 7%;
  height: 34%;
  background: #4da98f;
}

.court.zone-serve-top .zone-baseline-top,
.court.zone-rally-top .zone-baseline-top,
.court.zone-serve-bottom .zone-baseline-bottom,
.court.zone-rally-bottom .zone-baseline-bottom,
.court.zone-kitchen .zone-kitchen-top,
.court.zone-kitchen .zone-kitchen-bottom {
  animation: zone-focus 1.1s ease-in-out infinite;
}

.zone-kitchen-top {
  top: 41%;
  height: 9%;
  background: color-mix(in srgb, var(--kitchen) 80%, white);
}

.zone-kitchen-bottom {
  top: 50%;
  height: 9%;
  background: color-mix(in srgb, var(--kitchen) 80%, white);
}

.zone-baseline-bottom {
  top: 59%;
  height: 34%;
  background: #4da98f;
}

.court.zone-transition-top .zone-baseline-top,
.court.zone-transition-bottom .zone-baseline-bottom {
  background:
    linear-gradient(to bottom, transparent 0 48%, rgba(255, 240, 166, 0.52) 48% 76%, transparent 76%),
    #4da98f;
  animation: zone-focus 820ms ease-in-out infinite;
}

.court-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  z-index: 3;
  box-shadow: 0 0 0 1px rgba(25, 26, 31, 0.12);
}

.center-line {
  width: 3px;
  transform: translateX(-50%);
}

.center-line.top {
  left: 50%;
  top: 7%;
  height: 34%;
}

.center-line.bottom {
  left: 50%;
  top: 59%;
  height: 34%;
}

.sideline-court {
  top: 7%;
  width: 4px;
  height: 86%;
}

.sideline-court.left {
  left: 5.5%;
}

.sideline-court.right {
  right: 5.5%;
}

.baseline {
  left: 5.5%;
  right: 5.5%;
  height: 4px;
}

.baseline.top {
  top: 7%;
}

.baseline.bottom {
  bottom: 7%;
}

.kitchen-top,
.kitchen-bottom {
  left: 5.5%;
  right: 5.5%;
  height: 3px;
}

.kitchen-top {
  top: 41%;
}

.kitchen-bottom {
  bottom: 41%;
}

.net {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 50%;
  z-index: 4;
  height: 16px;
  transform: translateY(-50%);
  background:
    repeating-linear-gradient(90deg, transparent 0 17px, rgba(25, 26, 31, 0.5) 17px 20px),
    repeating-linear-gradient(0deg, transparent 0 8px, rgba(25, 26, 31, 0.22) 8px 10px),
    #f4f1e9;
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform-origin: center;
}

.net.ripple {
  animation: net-ripple 360ms cubic-bezier(.2,.75,.22,1);
}

.net-post {
  position: absolute;
  top: 47%;
  z-index: 5;
  width: 12px;
  height: 50px;
  background: #f4f1e9;
  border: 3px solid var(--ink);
}

.post-left {
  left: 2.4%;
}

.post-right {
  right: 2.4%;
}

.ref-chair {
  position: absolute;
  right: 0.8%;
  top: 43%;
  z-index: 6;
  width: 38px;
  height: 72px;
  border: 3px solid var(--ink);
  background:
    linear-gradient(#fff0a6 0 22px, transparent 22px),
    linear-gradient(90deg, transparent 0 11px, var(--ink) 11px 14px, transparent 14px 24px, var(--ink) 24px 27px, transparent 27px);
}

.broadcast-banner {
  --x: 50%;
  --y: 50%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 10;
  min-width: 124px;
  max-width: 260px;
  padding: 8px 11px;
  border: 3px solid var(--ink);
  background: #fff0a6;
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  font-size: clamp(0.9rem, 1.8vw, 1.25rem);
  font-weight: 950;
  line-height: 1;
  opacity: 0;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%) scale(0.72) rotate(-3deg);
  pointer-events: none;
}

.broadcast-banner.show {
  animation: broadcast-pop 920ms cubic-bezier(.2,.75,.22,1);
}

.pressure-meter {
  position: absolute;
  left: 50%;
  bottom: 2.2%;
  z-index: 8;
  width: min(300px, 42%);
  min-height: 32px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 7px;
  align-items: center;
  padding: 5px 8px;
  border: 2px solid var(--ink);
  background: rgba(255, 250, 240, 0.94);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  transform: translateX(-50%);
}

.pressure-meter div {
  position: relative;
  height: 12px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(90deg, var(--team-a), #ffffff 48% 52%, var(--team-b));
}

.pressure-meter i {
  --advantage: 50%;
  position: absolute;
  left: var(--advantage);
  top: 50%;
  width: 12px;
  height: 22px;
  border: 2px solid var(--ink);
  background: #d7ff3f;
  transform: translate(-50%, -50%);
  transition: left 260ms cubic-bezier(.2,.75,.22,1);
}

.rally-map {
  position: absolute;
  left: 4.5%;
  top: 4%;
  z-index: 7;
  display: flex;
  gap: 5px;
  align-items: center;
  max-width: 43%;
  min-height: 24px;
  padding: 4px 6px;
  border: 2px solid var(--ink);
  background: rgba(255, 250, 240, 0.92);
  box-shadow: 3px 3px 0 var(--ink);
  overflow: hidden;
}

.rally-map span {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.58rem;
  font-weight: 950;
  line-height: 1;
}

.rally-map .team-a {
  background: var(--team-a);
}

.rally-map .team-b {
  background: var(--team-b);
}

.target-preview {
  --x: 50%;
  --y: 50%;
  --color: #d7ff3f;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 6;
  width: 62px;
  aspect-ratio: 1;
  border: 3px dashed var(--ink);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 18%, transparent 19%),
    radial-gradient(circle, color-mix(in srgb, var(--color) 66%, white) 0 46%, transparent 47%);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--color) 40%, transparent);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
  pointer-events: none;
}

.target-preview.show {
  animation: target-lock 780ms ease-in-out infinite;
  opacity: 1;
}

.court-callout {
  --x: 50%;
  --y: 50%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 8;
  max-width: 150px;
  padding: 6px 8px;
  border: 2px solid var(--ink);
  background: #eef9ff;
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 950;
  line-height: 1;
  opacity: 0;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -150%) rotate(-2deg);
  pointer-events: none;
}

.court-callout.show {
  opacity: 1;
}

.speed-lines {
  --x: 50%;
  --y: 50%;
  --angle: 0deg;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 6;
  width: 132px;
  height: 74px;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--angle));
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(255, 255, 255, 0.92) 18% 44%, transparent 44%) 0 13px / 100% 5px no-repeat,
    linear-gradient(90deg, transparent 0 28%, rgba(215, 255, 63, 0.92) 28% 60%, transparent 60%) 0 34px / 100% 5px no-repeat,
    linear-gradient(90deg, transparent 0 12%, rgba(255, 255, 255, 0.82) 12% 34%, transparent 34%) 0 55px / 100% 5px no-repeat;
}

.speed-lines.show {
  animation: speed-lines 420ms ease-out;
}

.court-toast {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 9;
  min-width: 96px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  background: #fff0a6;
  box-shadow: 4px 4px 0 var(--ink);
  color: var(--ink);
  font-size: clamp(1.1rem, 2.4vw, 1.7rem);
  font-weight: 950;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.75) rotate(-3deg);
}

.court-toast.show {
  animation: toast-pop 760ms cubic-bezier(.2,.75,.22,1);
}

.shot-trace {
  --x1: 50%;
  --y1: 50%;
  --x2: 50%;
  --y2: 50%;
  position: absolute;
  left: var(--x1);
  top: var(--y1);
  z-index: 6;
  width: max(36px, var(--trace-length, 120px));
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(215, 255, 63, 0), rgba(215, 255, 63, 0.95), #ffffff);
  box-shadow: 0 0 14px rgba(215, 255, 63, 0.8);
  opacity: 0;
  transform: translate(-2px, -50%) rotate(var(--trace-angle, 0deg));
  transform-origin: left center;
  pointer-events: none;
}

.shot-trace.live {
  animation: trace-flash 520ms ease;
}

.bounce-marker {
  --x: 50%;
  --y: 50%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 6;
  width: 38px;
  aspect-ratio: 1;
  border: 3px solid #d7ff3f;
  border-radius: 999px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.42);
  pointer-events: none;
}

.bounce-marker.show {
  animation: bounce-ring 620ms ease;
}

.landing-label {
  --x: 50%;
  --y: 50%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 8;
  min-width: 54px;
  padding: 4px 7px;
  border: 2px solid var(--ink);
  background: #ffffff;
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 950;
  opacity: 0;
  text-align: center;
  text-transform: uppercase;
  transform: translate(-50%, -50%) scale(0.74) rotate(-4deg);
  pointer-events: none;
}

.landing-label.show {
  animation: landing-label 700ms cubic-bezier(.2,.75,.22,1);
}

.player {
  --x: 50%;
  --y: 50%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 5;
  width: clamp(54px, 8vw, 86px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transition: left 280ms cubic-bezier(.2,.75,.22,1), top 280ms cubic-bezier(.2,.75,.22,1), transform 180ms ease, filter 180ms ease;
}

.player::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 3%;
  z-index: -1;
  width: 76%;
  height: 18%;
  border-radius: 999px;
  background: rgba(25, 26, 31, 0.22);
  filter: blur(2px);
  transform: translateX(-50%);
}

.player::after {
  content: "";
  position: absolute;
  right: -7%;
  top: 44%;
  width: 16px;
  height: 28px;
  border: 2px solid var(--ink);
  border-radius: 10px 10px 14px 14px;
  background: var(--team-a);
  box-shadow: 2px 2px 0 var(--ink);
  transform: rotate(-24deg);
  transform-origin: center 80%;
}

.player-b::after {
  background: var(--team-b);
  left: -7%;
  right: auto;
  transform: rotate(24deg);
}

.player.active {
  filter: drop-shadow(0 0 0.8rem rgba(255, 255, 255, 0.95));
  transform: translate(-50%, -50%) scale(1.08);
}

.player.ready {
  animation: player-ready 240ms cubic-bezier(.2,.75,.22,1);
}

.player.recover {
  animation: player-recover 360ms cubic-bezier(.2,.75,.22,1);
}

.player.swing {
  animation: player-swing 420ms cubic-bezier(.2,.75,.22,1);
}

.player.swing::after {
  animation: paddle-swing 420ms cubic-bezier(.2,.75,.22,1);
}

.player.smash-swing {
  animation: player-smash 430ms cubic-bezier(.2,.75,.22,1);
}

.player.smash-swing::after {
  animation: paddle-smash 430ms cubic-bezier(.2,.75,.22,1);
}

.player.dink-swing {
  animation: player-dink 420ms cubic-bezier(.2,.75,.22,1);
}

.player.dink-swing::after {
  animation: paddle-dink 420ms cubic-bezier(.2,.75,.22,1);
}

.player.lob-swing {
  animation: player-lob 560ms cubic-bezier(.2,.75,.22,1);
}

.player.lob-swing::after {
  animation: paddle-lob 560ms cubic-bezier(.2,.75,.22,1);
}

.player img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

.p0 { --x: 32%; --y: 78%; }
.p1 { --x: 68%; --y: 70%; }
.p2 { --x: 32%; --y: 30%; }
.p3 { --x: 68%; --y: 22%; }

.ball {
  --x: 31%;
  --y: 72%;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 7;
  width: clamp(16px, 2.5vw, 24px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #d7ff3f;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  transform: translate(-50%, -50%);
  transition: left 220ms ease, top 220ms ease;
  will-change: left, top, transform;
}

.ball.squash {
  animation: ball-squash 210ms cubic-bezier(.2,.75,.22,1);
}

.ball-shadow {
  --x: 31%;
  --y: 72%;
  --scale: 1;
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 4;
  width: clamp(18px, 2.7vw, 28px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(25, 26, 31, 0.24);
  filter: blur(2px);
  transform: translate(-50%, -18%) scale(var(--scale));
  opacity: 0.8;
  transition: left 220ms ease, top 220ms ease;
  pointer-events: none;
}

.ball::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(215, 255, 63, 0.72), rgba(215, 255, 63, 0));
  opacity: 0;
  transform: scale(0.7);
}

.ball.in-flight {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.66), 2px 2px 0 var(--ink);
}

.ball.in-flight::after {
  animation: ball-glow 520ms ease infinite;
}

.ball.shot-smash {
  background: #fff07a;
}

.ball.shot-lob {
  background: #c8fffb;
}

.ball.shot-drive {
  background: #ffed66;
}

.ball.shot-drop,
.ball.shot-dink {
  background: #d7ff3f;
}

.hud {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(360px, 1.2fr) minmax(230px, 0.9fr);
  gap: 14px;
  align-items: stretch;
}

.turn-card,
.side-panel {
  padding: 14px;
}

.rally-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.rally-strip span {
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 4px 7px;
  border: 2px solid var(--ink);
  background: #ffffff;
  font-size: 0.76rem;
  font-weight: 950;
}

.rally-strip span.hot {
  background: #d7ff3f;
}

.minor {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 5px 0 8px;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.02;
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.controls button,
.secondary {
  cursor: pointer;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: #ffffff;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 100ms ease, box-shadow 100ms ease, background 100ms ease;
}

.controls button {
  min-height: 108px;
  padding: 10px 8px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  font-weight: 900;
  transform-origin: center;
}

.controls button.recommended {
  background: #fff0a6;
  animation: recommend-pulse 880ms steps(2, end) infinite;
}

.shot-odds {
  min-height: 18px;
  padding: 2px 6px;
  border: 2px solid var(--ink);
  background: #eef9ff;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 950;
}

.controls button:hover,
.secondary:hover {
  background: #fff0a6;
  transform: translate(-1px, -1px);
}

.controls button:active,
.secondary:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
}

.controls button:disabled {
  cursor: default;
  opacity: 0.55;
  transform: none;
}

.score-pop {
  animation: score-pop 560ms cubic-bezier(.2,.75,.22,1);
}

@keyframes player-swing {
  0% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
  35% { transform: translate(-50%, -54%) scale(1.16) rotate(-6deg); }
  70% { transform: translate(-50%, -48%) scale(1.03) rotate(4deg); }
  100% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
}

@keyframes player-ready {
  0% { transform: translate(-50%, -50%) scale(1); }
  55% { transform: translate(-50%, -45%) scale(1.08, 0.92); }
  100% { transform: translate(-50%, -50%) scale(1.03); }
}

@keyframes player-recover {
  0% { transform: translate(-50%, -50%) scale(1.05) rotate(0deg); }
  45% { transform: translate(-52%, -51%) scale(0.96, 1.08) rotate(-3deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

@keyframes player-smash {
  0% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
  20% { transform: translate(-50%, -62%) scale(1.14, 0.95) rotate(7deg); }
  52% { transform: translate(-50%, -42%) scale(1.22, 1.05) rotate(-10deg); }
  72% { transform: translate(-50%, -48%) scale(1.08) rotate(5deg); }
  100% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
}

@keyframes player-dink {
  0% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
  30% { transform: translate(-50%, -52%) scale(1.08, 0.96) rotate(-2deg); }
  62% { transform: translate(-50%, -47%) scale(1.02, 1.08) rotate(3deg); }
  100% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
}

@keyframes player-lob {
  0% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
  25% { transform: translate(-50%, -54%) scale(1.06, 0.96) rotate(-5deg); }
  56% { transform: translate(-50%, -60%) scale(1.15) rotate(7deg); }
  100% { transform: translate(-50%, -50%) scale(1.08) rotate(0deg); }
}

@keyframes paddle-swing {
  0%, 100% { transform: rotate(-24deg); }
  50% { transform: translate(10px, -5px) rotate(48deg); }
}

@keyframes paddle-smash {
  0% { transform: translate(0, 0) rotate(-62deg); }
  44% { transform: translate(11px, -18px) rotate(18deg); }
  72% { transform: translate(13px, 7px) rotate(68deg); }
  100% { transform: translate(0, 0) rotate(-24deg); }
}

@keyframes paddle-dink {
  0%, 100% { transform: rotate(-24deg); }
  58% { transform: translate(8px, 4px) rotate(8deg); }
}

@keyframes paddle-lob {
  0%, 100% { transform: rotate(-24deg); }
  46% { transform: translate(3px, -15px) rotate(-78deg); }
  72% { transform: translate(8px, -19px) rotate(-38deg); }
}

@keyframes court-impact {
  0%, 100% { transform: rotateX(7deg) translate(0, 0); }
  25% { transform: rotateX(7deg) translate(3px, -2px); }
  50% { transform: rotateX(7deg) translate(-2px, 2px); }
  75% { transform: rotateX(7deg) translate(2px, 1px); }
}

@keyframes rally-glow {
  0%, 100% { filter: brightness(1); }
  48% { filter: brightness(1.08) saturate(1.14); }
}

@keyframes zone-focus {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.16) saturate(1.15); }
}

@keyframes net-ripple {
  0%, 100% { transform: translateY(-50%) scaleY(1); }
  26% { transform: translateY(-50%) scaleY(1.5) skewX(-5deg); }
  62% { transform: translateY(-50%) scaleY(0.78) skewX(4deg); }
}

@keyframes ball-glow {
  0%, 100% { opacity: 0.18; transform: scale(0.78); }
  50% { opacity: 0.75; transform: scale(1.28); }
}

@keyframes ball-squash {
  0% { transform: translate(-50%, -50%) scale(1); }
  38% { transform: translate(-50%, -50%) scale(1.35, 0.58); }
  68% { transform: translate(-50%, -58%) scale(0.82, 1.3); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes trace-flash {
  0% { opacity: 0; transform: translate(-2px, -50%) rotate(var(--trace-angle, 0deg)) scaleX(0.12); }
  22% { opacity: 0.95; }
  100% { opacity: 0; transform: translate(-2px, -50%) rotate(var(--trace-angle, 0deg)) scaleX(1); }
}

@keyframes speed-lines {
  0% { opacity: 0; transform: translate(-62%, -50%) rotate(var(--angle)) scaleX(0.2); }
  24% { opacity: 1; }
  100% { opacity: 0; transform: translate(-18%, -50%) rotate(var(--angle)) scaleX(1.12); }
}

@keyframes target-lock {
  0%, 100% { transform: translate(-50%, -50%) scale(0.74); }
  50% { transform: translate(-50%, -50%) scale(1); }
}

@keyframes bounce-ring {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.36); }
  28% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.55); }
}

@keyframes landing-label {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.68) rotate(-6deg); }
  18% { opacity: 1; transform: translate(-50%, -70%) scale(1.06) rotate(3deg); }
  68% { opacity: 1; transform: translate(-50%, -84%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -118%) scale(0.9) rotate(4deg); }
}

@keyframes broadcast-pop {
  0% { opacity: 0; transform: translate(-50%, -42%) scale(0.68) rotate(-5deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
  76% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -70%) scale(0.9) rotate(4deg); }
}

@keyframes toast-pop {
  0% { opacity: 0; transform: translate(-50%, -44%) scale(0.7) rotate(-4deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
  72% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  100% { opacity: 0; transform: translate(-50%, -64%) scale(0.9) rotate(2deg); }
}

@keyframes score-pop {
  0% { transform: translate(0, 0); background: var(--panel); }
  35% { transform: translate(-2px, -4px) scale(1.025); background: #dfff3c; }
  100% { transform: translate(0, 0); background: var(--panel); }
}

@keyframes recommend-pulse {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-1px, -2px); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

.icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--team-a);
  font-weight: 950;
}

.side-panel {
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 12px;
  min-height: 140px;
}

.mode-switch,
.difficulty-switch,
.watch-speed {
  display: grid;
  gap: 8px;
}

.mode-switch {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.difficulty-switch,
.watch-speed {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mode-switch button,
.difficulty-switch button,
.watch-speed button {
  min-height: 38px;
  cursor: pointer;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 0.86rem;
  font-weight: 950;
}

.mode-switch button.active,
.difficulty-switch button.active,
.watch-speed button.active,
.secondary.active {
  background: #d7ff3f;
  transform: translate(3px, 3px);
  box-shadow: 0 0 0 var(--ink);
}

.secondary {
  min-height: 44px;
  padding: 8px 12px;
  font-weight: 950;
}

.log {
  min-height: 76px;
  max-height: 136px;
  overflow: auto;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.3;
}

.log div + div {
  margin-top: 6px;
}

.league-panel {
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: 6px 6px 0 var(--ink);
  padding: 14px;
}

.league-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.league-header h2 {
  margin: 4px 0 0;
  font-size: clamp(1.35rem, 2.4vw, 2.2rem);
  line-height: 1;
}

.league-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.league-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.9fr 0.85fr;
  gap: 12px;
}

.league-card-wide {
  grid-column: span 2;
}

.league-card {
  min-height: 170px;
  border: 2px solid var(--ink);
  background: #ffffff;
  padding: 12px;
}

.league-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  line-height: 1;
  text-transform: uppercase;
}

.standing-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 28px;
  border-top: 1px solid rgba(25, 26, 31, 0.14);
  font-size: 0.9rem;
}

.standing-row:first-child {
  border-top: 0;
}

.standing-row span {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 850;
}

.standing-row strong,
.standing-row small {
  font-weight: 950;
}

.season-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.team-overview-card {
  min-height: 116px;
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 10px;
  border: 2px solid var(--ink);
  background: #f6efd9;
  overflow: hidden;
}

.team-overview-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  background: var(--team-a);
}

.team-overview-card:nth-child(even)::before {
  background: var(--team-b);
}

.team-overview-card strong,
.team-overview-card span,
.team-overview-card small,
.team-overview-card em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.team-overview-card strong {
  font-size: 1rem;
  line-height: 1;
}

.team-overview-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.team-overview-card small {
  font-size: 0.75rem;
  font-weight: 850;
}

.team-overview-card em {
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 950;
  text-transform: uppercase;
}

.team-overview-card b {
  position: absolute;
  right: 7px;
  bottom: 5px;
  color: rgba(25, 26, 31, 0.18);
  font-size: 2.6rem;
  line-height: 1;
}

.season-timeline {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 7px;
}

.season-timeline button {
  cursor: pointer;
  min-height: 50px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 950;
}

.season-timeline button.active {
  background: #d7ff3f;
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 var(--ink);
}

.season-timeline small {
  font-size: 0.65rem;
  font-weight: 900;
}

.league-today {
  display: grid;
  gap: 8px;
}

.league-match {
  cursor: pointer;
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 2px solid var(--ink);
  background: #f6efd9;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 900;
}

.league-match.featured {
  background: #d7ff3f;
}

.league-match span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mint-card {
  min-height: 128px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 12px;
  border: 2px dashed var(--ink);
  background: #eef9ff;
}

.team-spotlight,
.tomorrow-card,
.trophy-case {
  display: grid;
  gap: 8px;
}

#teamSpotlightSelect {
  width: 100%;
  min-height: 38px;
  margin-bottom: 10px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 900;
}

.team-spotlight {
  min-height: 108px;
  padding: 10px;
  border: 2px solid var(--ink);
  background: #f6efd9;
  font-size: 0.92rem;
}

.team-spotlight strong {
  font-size: 1.2rem;
}

.watch-speed {
  margin-bottom: 10px;
}

.watch-speed button {
  min-height: 30px;
  font-size: 0.76rem;
  box-shadow: 2px 2px 0 var(--ink);
}

.tomorrow-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 5px 7px;
  border: 2px solid var(--ink);
  background: #eef9ff;
  font-size: 0.9rem;
  font-weight: 900;
}

.trophy-case {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.trophy-case span {
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 5px;
  border: 2px solid var(--ink);
  background: #f1f1f1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
  text-align: center;
}

.trophy-case span.unlocked {
  background: #fff0a6;
  color: var(--ink);
}

.mint-card p,
.mint-card strong,
.mint-card small {
  margin: 0;
}

.mint-card strong {
  font-size: 2rem;
  line-height: 1;
}

.secondary:disabled,
.mode-switch button:disabled,
.difficulty-switch button:disabled {
  cursor: default;
  opacity: 0.55;
}

@media (max-width: 820px) {
  .game-shell {
    width: min(100vw - 18px, 640px);
    grid-template-rows: auto minmax(330px, 46vh) auto;
  }

  .scorebar,
  .hud,
  .league-grid {
    grid-template-columns: 1fr;
  }

  .league-card-wide {
    grid-column: span 1;
  }

  .season-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .season-timeline {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .league-header {
    align-items: stretch;
    flex-direction: column;
  }

  .serve-pill {
    width: 100%;
  }

  .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .controls button {
    min-height: 82px;
  }

  .team-score {
    min-height: 66px;
  }
}

@media (max-width: 460px) {
  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
