:root {
  --ink: #17110d;
  --paper: #f2d38a;
  --cream: #fff4c8;
  --black: #050505;
  --brick: #8b3f2f;
  --brick-deep: #55261e;
  --ivy: #143f29;
  --ivy-bright: #2a7040;
  --grass: #0d7c24;
  --grass-dark: #0a5f1d;
  --dirt: #b76d2d;
  --blue: #2255d8;
  --blue-deep: #0d2f7c;
  --red: #d3312b;
  --red-deep: #741613;
  --gold: #ffdf62;
  --shadow: rgba(0, 0, 0, 0.38);
  --radius: 0;
  font-family: "Courier New", "Lucida Console", monospace;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: #050505;
  color: var(--cream);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.loading-screen {
  align-items: center;
  background:
    radial-gradient(circle at 50% 32%, rgba(34, 85, 216, 0.25), transparent 34%),
    linear-gradient(180deg, #050505 0%, #142416 55%, #050505 100%);
  display: grid;
  inset: 0;
  padding: 1rem;
  place-items: center;
  position: fixed;
  z-index: 9999;
}

.loading-screen.ready {
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms steps(6);
}

.loading-card {
  background: rgba(16, 16, 16, 0.96);
  border: 6px solid var(--gold);
  box-shadow: 9px 9px 0 var(--black);
  color: var(--cream);
  max-width: 560px;
  padding: clamp(1rem, 4vw, 2rem);
  text-align: center;
  text-transform: uppercase;
  width: min(92vw, 560px);
}

.loading-card h1 {
  color: var(--gold);
  font-size: clamp(1.7rem, 7vw, 4rem);
  letter-spacing: -0.09em;
  line-height: 0.95;
  margin: 0 0 1rem;
  text-shadow: 5px 5px 0 var(--black);
}

.loading-bar {
  background: repeating-linear-gradient(90deg, #111 0 12px, #1b1b1b 12px 24px);
  border: 4px solid var(--cream);
  height: 28px;
  margin: 1rem auto;
  overflow: hidden;
  width: min(420px, 100%);
}

.loading-bar i {
  background: linear-gradient(90deg, var(--blue), var(--gold), var(--red));
  display: block;
  height: 100%;
  transform: scaleX(0.08);
  transform-origin: left center;
  transition: transform 220ms steps(5);
  width: 100%;
}

.loading-card p {
  font-weight: 900;
  margin: 0.55rem 0 0;
}

button {
  border: 4px solid var(--black);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--black);
  color: var(--cream);
  cursor: pointer;
  font: 900 0.9rem/1 "Courier New", "Lucida Console", monospace;
  letter-spacing: 0.08em;
  padding: 0.82rem 1rem;
  text-transform: uppercase;
}

button:hover,
button:focus-visible {
  filter: brightness(1.12);
  transform: translate(1px, 1px);
  box-shadow: 3px 3px 0 var(--black);
}

button:focus-visible {
  outline: 4px solid var(--gold);
  outline-offset: 3px;
}

.primary { background: var(--blue); }
.secondary,
.controls button { background: var(--brick); }

.stadium-backdrop {
  background: #050505;
  inset: 0;
  overflow: hidden;
  position: fixed;
  z-index: 0;
}

.stadium-field-stage {
  background: #72afd9;
  inset: 0;
  position: absolute;
}

.stadium-vignette {
  background:
    radial-gradient(circle at 50% 44%, transparent 0 38%, rgba(0, 0, 0, 0.18) 62%, rgba(0, 0, 0, 0.74) 100%),
    linear-gradient(180deg, rgba(5, 5, 5, 0.12), rgba(5, 5, 5, 0.58));
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 2;
}

.game-shell {
  display: grid;
  gap: 1rem;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  padding: clamp(0.65rem, 2vw, 1.4rem);
  position: relative;
  z-index: 4;
}

.marquee {
  align-items: center;
  backdrop-filter: blur(3px);
  background: rgba(17, 17, 17, 0.82);
  border: 6px solid var(--paper);
  box-shadow: 6px 6px 0 var(--black);
  display: flex;
  justify-content: space-between;
  padding: 0.85rem clamp(0.85rem, 2vw, 1.4rem);
}

.marquee h1,
.screen h2,
.screen h3,
.hero-card h2 { margin: 0; }

.marquee h1 {
  color: var(--gold);
  font-size: clamp(1.45rem, 4vw, 3rem);
  letter-spacing: -0.08em;
  text-transform: uppercase;
  text-shadow: 4px 4px 0 var(--black);
}

.eyebrow {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  margin: 0 0 0.35rem;
  text-transform: uppercase;
}

.score-ribbon {
  background: var(--black);
  border: 4px solid var(--paper);
  color: var(--cream);
  font-weight: 900;
  padding: 0.65rem 0.85rem;
  white-space: nowrap;
}

.screen-stack {
  min-height: 0;
  position: relative;
}
.screen { animation: fadeIn 220ms steps(3) both; display: none; }
.screen.active { display: block; }

.title-screen {
  align-items: stretch;
  display: none;
  gap: clamp(1rem, 3vw, 2rem);
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
}

.title-screen.active { display: grid; }

.hero-card,
.panel {
  backdrop-filter: blur(4px);
  background: rgba(255, 244, 200, 0.7);
  border: 6px solid var(--black);
  box-shadow: 8px 8px 0 var(--shadow);
  color: var(--ink);
}

.hero-card {
  display: grid;
  min-height: clamp(420px, 58vh, 520px);
  padding: clamp(1.2rem, 5vw, 4rem);
  place-content: center start;
}

.hero-card h2 {
  color: var(--blue-deep);
  font-size: clamp(2.2rem, 7vw, 6.2rem);
  letter-spacing: -0.09em;
  line-height: 0.88;
  max-width: 11ch;
  text-transform: uppercase;
}

.hero-copy {
  font-size: clamp(1rem, 2vw, 1.2rem);
  font-weight: 700;
  line-height: 1.55;
  max-width: 58ch;
}

.poster-grid {
  display: grid;
  gap: 1rem;
  grid-template-rows: 1fr 1fr 0.8fr;
}

.poster {
  align-items: end;
  backdrop-filter: blur(2px);
  background: rgba(34, 85, 216, 0.42);
  border: 6px solid var(--black);
  box-shadow: inset 0 -70px 0 rgba(0, 0, 0, 0.18), 8px 8px 0 var(--shadow);
  color: var(--cream);
  display: flex;
  font-size: clamp(1.8rem, 5vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.08em;
  min-height: 140px;
  overflow: hidden;
  padding: 1rem;
  position: relative;
  text-transform: uppercase;
}

.poster::before {
  background: repeating-linear-gradient(45deg, rgba(255,255,255,.18) 0 8px, transparent 8px 16px);
  content: "";
  inset: 0;
  position: absolute;
}

.poster.red { background: rgba(211, 49, 43, 0.42); }
.poster.field { background: linear-gradient(135deg, rgba(20, 63, 41, 0.48), rgba(13, 124, 36, 0.34)); }
.poster > * { position: relative; }

.panel { padding: clamp(1rem, 3vw, 1.6rem); }
.panel.wide { min-height: 68vh; }

.section-heading {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.team-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.team-choice {
  background: rgba(246, 223, 155, 0.68);
  border: 6px solid var(--black);
  box-shadow: 6px 6px 0 rgba(0,0,0,.24);
  cursor: pointer;
  min-height: 320px;
  padding: 1rem;
}

.team-choice:hover,
.team-choice.selected {
  border-color: var(--gold);
  transform: translate(2px, 2px);
}

.team-choice.blue { box-shadow: inset 0 0 0 999px rgba(34, 85, 216, 0.08), 6px 6px 0 rgba(0,0,0,.24); }
.team-choice.red { box-shadow: inset 0 0 0 999px rgba(211, 49, 43, 0.08), 6px 6px 0 rgba(0,0,0,.24); }
.team-choice h3 { font-size: clamp(1.6rem, 4vw, 3.2rem); letter-spacing: -0.07em; text-transform: uppercase; }
.team-choice ul { columns: 2; line-height: 1.65; padding-left: 1.15rem; }

.lineup-layout {
  display: grid;
  gap: 1.2rem;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
}

.card-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.player-card {
  background: #f6e5b7;
  border: 4px solid var(--black);
  box-shadow: 4px 4px 0 rgba(0,0,0,.22);
  margin: 0;
  overflow: hidden;
}

.player-card img {
  aspect-ratio: 4 / 5;
  display: block;
  object-fit: cover;
  width: 100%;
}

.player-card figcaption {
  display: grid;
  gap: 0.15rem;
  padding: 0.7rem;
}

.player-card strong { font-size: 0.9rem; }
.player-card span { color: rgba(23, 17, 13, 0.72); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; }

.match-screen.active { display: block; }

.game-cabinet {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--cream);
}

.game-bezel { background: transparent; padding: 0; }

.pixel-game {
  aspect-ratio: 16 / 10;
  background: transparent;
  border: 0;
  min-height: 560px;
  overflow: hidden;
  position: relative;
}

.field-stage {
  background: #0b6e22;
  inset: 0;
  overflow: hidden;
  position: absolute;
}

.field-stage canvas {
  display: block;
  height: 100% !important;
  image-rendering: pixelated;
  width: 100% !important;
}

body.fly-camera-active .field-stage canvas {
  cursor: crosshair;
}

.field-stage.no-three::after {
  align-items: center;
  background: repeating-linear-gradient(90deg, var(--grass) 0 28px, var(--grass-dark) 28px 56px);
  color: var(--cream);
  content: "Three.js renderer unavailable. Gameplay still tracks through the HUD.";
  display: grid;
  font-weight: 900;
  inset: 0;
  padding: 2rem;
  place-items: center;
  position: absolute;
  text-align: center;
}

.pixel-scorebar {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto 1fr;
  left: 10px;
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 20;
}

.pixel-scorebox,
.pixel-countbox,
.pixel-hud-card,
.pixel-prompt,
.role-badge,
.pitch-meter,
.play-log {
  background: #101010;
  border: 4px solid var(--paper);
  box-shadow: 4px 4px 0 var(--black);
  color: var(--cream);
  font-weight: 900;
  text-transform: uppercase;
}

.pixel-scorebox,
.pixel-countbox {
  align-items: center;
  display: flex;
  font-size: clamp(0.72rem, 1.45vw, 1.05rem);
  justify-content: center;
  min-height: 46px;
  padding: 0.45rem 0.65rem;
  text-align: center;
}

.pixel-countbox { color: var(--gold); gap: 0.6rem; white-space: nowrap; }

.pixel-hud-card {
  bottom: 90px;
  font-size: clamp(0.68rem, 1.15vw, 0.9rem);
  left: 12px;
  line-height: 1.35;
  max-width: min(390px, 42%);
  padding: 0.65rem;
  position: absolute;
  z-index: 24;
}

.role-badge {
  color: var(--gold);
  font-size: clamp(0.68rem, 1.2vw, 0.9rem);
  left: 12px;
  letter-spacing: 0.08em;
  padding: 0.45rem 0.65rem;
  position: absolute;
  top: 74px;
  z-index: 44;
}

.stadium-status {
  background: rgba(5, 5, 5, 0.9);
  border: 4px solid var(--gold);
  box-shadow: 4px 4px 0 var(--black);
  color: var(--gold);
  display: none;
  font-size: clamp(0.8rem, 1.5vw, 1.1rem);
  font-weight: 900;
  left: 50%;
  line-height: 1.4;
  max-width: min(760px, 88%);
  padding: 0.75rem 1rem;
  position: fixed;
  text-align: center;
  text-transform: uppercase;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 60;
}

.stadium-status.active {
  display: block;
}

.pixel-prompt {
  bottom: 132px;
  color: var(--gold);
  font-size: clamp(0.8rem, 1.55vw, 1.25rem);
  left: 50%;
  padding: 0.55rem 0.8rem;
  position: absolute;
  transform: translateX(-50%);
  z-index: 26;
}

.pitch-meter {
  display: none;
  gap: 0.35rem;
  left: 50%;
  padding: 0.55rem 0.75rem;
  position: absolute;
  top: 74px;
  transform: translateX(-50%);
  width: min(360px, 56%);
  z-index: 45;
}

.pitch-meter.active { display: grid; }

.pitch-meter span {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.pitch-meter-track {
  background: repeating-linear-gradient(90deg, #222 0 10px, #111 10px 20px);
  border: 3px solid var(--cream);
  height: 20px;
  overflow: hidden;
  position: relative;
}

.pitch-meter-track i {
  background: linear-gradient(90deg, var(--blue), var(--gold), var(--red));
  display: block;
  height: 100%;
  transform-origin: left center;
  width: 100%;
}

.pitch-meter em {
  color: var(--cream);
  font-size: 0.62rem;
  font-style: normal;
}

.pitch-meter em:last-child {
  justify-self: end;
  margin-top: -1.15rem;
}

.pixel-bases {
  display: grid;
  gap: 0.25rem;
  grid-template-areas: ". second ." "third . first";
  position: absolute;
  right: 18px;
  top: 82px;
  width: 120px;
  z-index: 24;
}

.setup-countdown {
  background: rgba(16, 16, 16, 0.9);
  border: 4px solid var(--gold);
  box-shadow: 4px 4px 0 var(--black);
  color: var(--gold);
  display: none;
  font-size: clamp(1rem, 2.6vw, 2rem);
  font-weight: 900;
  left: 50%;
  letter-spacing: 0.08em;
  padding: 0.65rem 1rem;
  position: absolute;
  text-align: center;
  text-transform: uppercase;
  top: 24%;
  transform: translateX(-50%);
  z-index: 54;
}

.setup-countdown.active {
  display: block;
}

.pitch-target-zone {
  border: 4px solid rgba(255, 244, 200, 0.86);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.72), inset 0 0 0 3px rgba(0, 0, 0, 0.4);
  display: none;
  height: clamp(96px, 20dvh, 176px);
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: 47%;
  transform: translate(-50%, -50%);
  width: clamp(76px, 10vw, 120px);
  z-index: 40;
}

.pitch-target-zone.active {
  display: block;
}

.pitch-target-zone::before,
.pitch-target-zone::after {
  background: rgba(255, 244, 200, 0.55);
  content: "";
  position: absolute;
}

.pitch-target-zone::before {
  height: 100%;
  left: calc(50% - 1px);
  top: 0;
  width: 2px;
}

.pitch-target-zone::after {
  height: 2px;
  left: 0;
  top: calc(50% - 1px);
  width: 100%;
}

.pitch-target-zone span {
  background: rgba(255, 223, 98, 0.42);
  border: 4px solid var(--gold);
  box-shadow: 3px 3px 0 var(--black);
  display: block;
  height: 28%;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 42%;
}

.umpire-call {
  color: var(--gold);
  display: none;
  font-size: clamp(3.4rem, 11vw, 10rem);
  font-weight: 900;
  left: 50%;
  letter-spacing: -0.08em;
  pointer-events: none;
  position: absolute;
  text-shadow: 7px 7px 0 var(--black), -3px 3px 0 var(--black), 3px -3px 0 var(--black);
  text-transform: uppercase;
  top: 55%;
  transform: translate(-50%, 60%);
  z-index: 70;
}

.umpire-call.active {
  animation: umpireCallRise 1100ms steps(8) both;
  display: block;
}

.umpire-call.ball-call {
  color: var(--blue);
}

.umpire-call.strike-call {
  color: var(--red);
}

.umpire-call.foul-call {
  color: var(--cream);
}

.umpire-call.out-call {
  color: var(--gold);
}

.umpire-call.score-call {
  color: #39d353;
  text-shadow: 7px 7px 0 var(--black), -3px 3px 0 var(--black), 3px -3px 0 var(--black), 0 0 24px rgba(57, 211, 83, 0.72);
}

@keyframes umpireCallRise {
  0% { opacity: 0; transform: translate(-50%, 82%) scale(0.72); }
  18% { opacity: 1; transform: translate(-50%, 34%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -8%) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -36%) scale(1.14); }
}

@media (max-width: 620px) {
  .setup-countdown {
    font-size: 0.9rem;
    top: 31%;
    width: min(92vw, 360px);
  }

  .pitch-target-zone {
    height: 104px;
    top: 50%;
    width: 72px;
  }
}

.pixel-bases span {
  align-items: center;
  aspect-ratio: 1;
  background: #252525;
  border: 4px solid var(--paper);
  color: rgba(255,244,200,.45);
  display: grid;
  font-size: 0.72rem;
  font-weight: 900;
  place-items: center;
  transform: rotate(45deg);
}

.pixel-bases span.occupied { background: var(--gold); color: var(--black); }
.pixel-bases [data-base="1"] { grid-area: first; }
.pixel-bases [data-base="2"] { grid-area: second; }
.pixel-bases [data-base="3"] { grid-area: third; }

.touch-controls {
  align-items: end;
  bottom: 12px;
  display: flex;
  justify-content: space-between;
  left: 12px;
  pointer-events: none;
  position: absolute;
  right: 12px;
  z-index: 28;
}

.touch-controls button { pointer-events: auto; }

.dpad {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 38px);
  grid-template-rows: repeat(3, 38px);
}

.dpad button,
.ab-buttons button {
  align-items: center;
  background: #111;
  border: 4px solid var(--paper);
  box-shadow: 4px 4px 0 var(--black);
  color: var(--paper);
  display: grid;
  font-size: 1rem;
  justify-content: center;
  padding: 0;
}

.dpad [data-action="aim-up"] { grid-column: 2; }
.dpad [data-action="aim-left"] { grid-column: 1; grid-row: 2; }
.dpad [data-action="aim-reset"] { grid-column: 2; grid-row: 2; background: #302014; }
.dpad [data-action="aim-right"] { grid-column: 3; grid-row: 2; }
.dpad [data-action="aim-down"] { grid-column: 2; grid-row: 3; }

.ab-buttons { display: flex; gap: 12px; }
.ab-buttons button { border-radius: 50%; height: 64px; width: 64px; }
.ab-buttons .a-button { background: var(--red-deep); }
.ab-buttons .b-button { background: var(--blue-deep); }

.scanlines {
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.045) 0 2px, rgba(0,0,0,.08) 2px 4px);
  inset: 0;
  mix-blend-mode: multiply;
  pointer-events: none;
  position: absolute;
  z-index: 60;
}

.play-log {
  display: grid;
  font-size: 0.82rem;
  gap: 0.25rem;
  line-height: 1.35;
  max-height: 138px;
  overflow: auto;
  padding: 0.75rem;
}

.play-log p { margin: 0; }
.hint { color: #ddc27a; font-size: 0.82rem; line-height: 1.4; margin: 0.7rem 1rem 1rem; }

.summary-panel { margin: 0 auto; max-width: 760px; text-align: center; }
.summary-panel h2 { color: var(--red-deep); font-size: clamp(2.2rem, 6vw, 5rem); letter-spacing: -0.08em; text-transform: uppercase; }
.summary-panel table { border-collapse: collapse; margin: 1rem auto; width: min(100%, 540px); }
.summary-panel th,
.summary-panel td { border-bottom: 2px solid rgba(23, 17, 13, 0.18); padding: 0.7rem; }
.gameover-panel strong.winner { color: var(--blue); display: block; font-size: clamp(2rem, 5vw, 4rem); letter-spacing: -0.08em; margin: 1rem 0; text-transform: uppercase; }
.end-controls { display: grid; gap: 0.65rem; grid-template-columns: repeat(2, 1fr); margin: 1rem auto 0; max-width: 420px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 980px) {
  .title-screen.active,
  .lineup-layout,
  .team-grid { grid-template-columns: 1fr; }
  .hero-card { min-height: 420px; }
  .pixel-game { aspect-ratio: 9 / 14; min-height: 720px; }
  .pixel-scorebar { grid-template-columns: 1fr; right: auto; width: min(76%, 380px); }
  .role-badge { left: auto; right: 12px; top: 86px; }
  .pixel-hud-card { bottom: 112px; max-width: 58%; }
  .pixel-prompt { bottom: 210px; white-space: nowrap; }
  .pitch-meter { top: 196px; width: min(390px, 72%); }
  .pixel-bases { top: 86px; width: 102px; }
}

@media (max-width: 620px) {
  .game-shell { padding: 0.45rem; }
  .marquee,
  .section-heading { align-items: stretch; flex-direction: column; }
  .score-ribbon { text-align: center; }
  .card-grid,
  .card-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pixel-game { min-height: 740px; }
  .pixel-hud-card { bottom: 110px; font-size: 0.66rem; max-width: 62%; }
  .pixel-prompt { bottom: 228px; font-size: 0.78rem; }
  .role-badge { font-size: 0.62rem; top: 212px; }
  .pitch-meter { top: 254px; width: 76%; }
  .dpad { grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(3, 34px); }
  .ab-buttons button { height: 58px; width: 58px; }
  .end-controls { grid-template-columns: 1fr; }
}

body.match-active {
  height: 100dvh;
  overflow: hidden;
}

body.match-active .game-shell {
  gap: 0;
  grid-template-rows: 1fr;
  min-height: 100dvh;
  overflow: hidden;
  padding: 0;
}

body.match-active .marquee {
  display: none;
}

body.match-active .screen-stack,
body.match-active .match-screen.active,
body.match-active .game-cabinet,
body.match-active .game-bezel,
body.match-active .pixel-game {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

body.match-active .pixel-game {
  aspect-ratio: auto;
  min-height: 0;
}

body.match-active .hint {
  display: none;
}

body.match-active .play-log {
  bottom: 82px;
  max-height: min(130px, 22dvh);
  position: fixed;
  right: 12px;
  width: min(360px, 32vw);
  z-index: 42;
}

body.match-active .pixel-hud-card {
  display: none;
}

.match-topbar {
  align-items: start;
  display: grid;
  gap: 8px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  left: 10px;
  right: 10px;
  top: 10px;
  z-index: 50;
}

.match-status-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, auto));
  min-width: 0;
}

.match-personnel {
  align-items: center;
  background: #101010;
  border: 4px solid var(--paper);
  box-shadow: 4px 4px 0 var(--black);
  color: var(--gold);
  display: flex;
  font-size: clamp(0.62rem, 1vw, 0.82rem);
  font-weight: 900;
  min-height: 46px;
  min-width: 0;
  overflow: hidden;
  padding: 0.45rem 0.65rem;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.active-player-card {
  align-items: center;
  background: rgba(16, 16, 16, 0.94);
  border: 4px solid var(--gold);
  box-shadow: 4px 4px 0 var(--black);
  color: var(--cream);
  display: grid;
  gap: 0.55rem;
  grid-template-columns: 54px minmax(0, 1fr);
  min-height: 72px;
  min-width: min(290px, 28vw);
  padding: 0.35rem;
  text-transform: uppercase;
}

.active-player-card img {
  aspect-ratio: 4 / 5;
  background: var(--paper);
  border: 3px solid var(--black);
  display: block;
  object-fit: cover;
  width: 54px;
}

.active-player-card strong {
  color: var(--gold);
  display: block;
  font-size: clamp(0.72rem, 1.1vw, 0.95rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-player-card span {
  color: var(--cream);
  display: block;
  font-size: clamp(0.58rem, 0.9vw, 0.72rem);
  line-height: 1.25;
}

.match-topbar .role-badge {
  left: auto;
  position: static;
  top: auto;
  white-space: nowrap;
}

body.match-active .pitch-meter {
  top: 100px;
  z-index: 51;
}

@media (max-width: 980px) {
  body.match-active .play-log {
    display: none;
  }

  .match-topbar {
    grid-template-columns: auto minmax(0, 1fr);
    right: 8px;
  }

  .match-status-grid {
    grid-template-columns: repeat(3, minmax(0, auto));
  }

  .match-topbar .role-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .active-player-card {
    min-width: 220px;
  }

  body.match-active .pitch-meter {
    top: 136px;
    width: min(390px, 72%);
  }
}

@media (max-width: 620px) {
  .match-topbar {
    gap: 5px;
    grid-template-columns: 1fr;
    left: 6px;
    right: 6px;
    top: 6px;
  }

  .match-status-grid {
    gap: 5px;
    grid-template-columns: repeat(3, 1fr);
  }

  .match-topbar .pixel-scorebox,
  .match-topbar .pixel-countbox,
  .match-personnel {
    border-width: 3px;
    font-size: 0.56rem;
    min-height: 32px;
    padding: 0.24rem 0.32rem;
  }

  .active-player-card {
    gap: 0.35rem;
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 52px;
    min-width: 0;
  }

  .active-player-card img {
    width: 38px;
  }

  .active-player-card strong {
    font-size: 0.64rem;
  }

  .active-player-card span {
    font-size: 0.52rem;
  }

  .match-topbar .role-badge {
    font-size: 0.56rem;
  }

  body.match-active .pitch-meter {
    top: 178px;
    width: 76%;
  }
}

.pitch-meter {
  right: auto;
  transform: translateX(-50%);
}

.pixel-bases {
  display: grid;
  gap: 0.25rem;
  grid-template-areas: ". second ." "third . first";
  position: absolute;
  right: 18px;
  top: 82px;
  width: 120px;
  z-index: 24;
}

body.match-active .match-topbar {
  align-items: stretch;
  display: grid;
  gap: clamp(0.45rem, 1vw, 0.9rem);
  grid-template-columns: minmax(210px, 0.45fr) minmax(360px, 1.1fr) minmax(260px, 0.68fr);
  left: clamp(0.45rem, 1vw, 0.9rem);
  right: clamp(0.45rem, 1vw, 0.9rem);
  top: clamp(0.45rem, 1vw, 0.9rem);
  width: auto;
}

body.match-active .match-status-grid {
  align-items: stretch;
  display: grid;
  gap: clamp(0.35rem, 0.8vw, 0.65rem);
  grid-template-columns: 1fr auto 1fr;
}

body.match-active .match-status-grid .match-personnel {
  grid-column: span 3;
}

body.match-active .match-status-grid #matchBatter {
  color: var(--cream);
}

body.match-active .match-status-grid #matchPitcher {
  color: var(--gold);
}

body.match-active .pixel-countbox {
  font-size: clamp(0.9rem, 1.8vw, 1.55rem);
  min-width: 190px;
}

body.match-active .pixel-scorebox {
  font-size: clamp(0.82rem, 1.45vw, 1.2rem);
}

body.match-active .match-personnel {
  font-size: clamp(0.66rem, 1.05vw, 0.95rem);
  min-height: 40px;
}

body.match-active .active-player-card {
  min-width: 0;
  width: 100%;
}

body.match-active .role-badge {
  align-items: center;
  display: flex;
  font-size: clamp(0.72rem, 1.1vw, 1rem);
  justify-content: center;
  text-align: center;
}

@media (max-width: 980px) {
  body.match-active .match-topbar {
    grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1.15fr);
  }

  body.match-active .match-topbar .role-badge {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  body.match-active .match-topbar {
    grid-template-columns: 1fr;
  }

  body.match-active .match-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.match-active .match-status-grid .match-personnel {
    grid-column: span 3;
  }

  body.match-active .pixel-countbox {
    min-width: 0;
  }
}

.umpire-call.homer-call {
  color: var(--gold);
  text-shadow: 7px 7px 0 var(--black), -3px 3px 0 var(--black), 3px -3px 0 var(--black), 0 0 28px rgba(255, 176, 57, 0.82);
}

.umpire-call.grand-slam-call {
  color: #fff4c8;
  text-shadow: 8px 8px 0 var(--black), -3px 3px 0 #0a3f1e, 3px -3px 0 #bd2a2a, 0 0 32px rgba(255, 221, 92, 0.92);
}

.umpire-call.homer-call.active,
.umpire-call.grand-slam-call.active {
  animation-duration: 1500ms;
}

body.match-active .pixel-prompt {
  bottom: clamp(228px, 25dvh, 278px);
  z-index: 57;
}

body.match-active .pitch-meter {
  bottom: clamp(172px, 19dvh, 220px);
  left: 50%;
  right: auto;
  top: auto;
  transform: translateX(-50%);
  width: min(390px, 72vw);
  z-index: 56;
}

@media (max-width: 620px) {
  body.match-active .pixel-prompt {
    bottom: 248px;
  }

  body.match-active .pitch-meter {
    bottom: 182px;
    width: 82%;
  }
}

.pixel-prompt.pitch-ui-hidden {
  display: none;
}

.pitch-command-panel.active {
  align-items: center;
  display: grid;
  gap: clamp(0.55rem, 1.2vw, 0.9rem);
  grid-template-columns: minmax(0, 1fr) auto;
}

.pitch-command-copy {
  display: grid;
  gap: 0.36rem;
  min-width: 0;
}

.pitch-meter-scale {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.pitch-meter .pitch-meter-scale em {
  margin: 0;
}

.pitch-meter .pitch-target-zone {
  background: rgba(16, 16, 16, 0.82);
  display: none;
  height: clamp(78px, 12dvh, 116px);
  left: auto;
  position: relative;
  top: auto;
  transform: none;
  width: clamp(58px, 8vw, 88px);
  z-index: 1;
}

.pitch-meter .pitch-target-zone.active {
  display: block;
}

.pitch-meter .pitch-target-zone span {
  height: 24%;
  width: 38%;
}

body.match-active .pitch-command-panel {
  bottom: clamp(126px, 15dvh, 176px);
  max-width: min(460px, 82vw);
  padding: 0.72rem 0.82rem;
}

@media (max-width: 620px) {
  body.match-active .pitch-command-panel {
    bottom: 138px;
    width: 86%;
  }

  .pitch-command-panel.active {
    gap: 0.48rem;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pitch-meter .pitch-target-zone {
    height: 78px;
    width: 58px;
  }
}

.pitch-target-zone b {
  background: rgba(214, 42, 42, 0.42);
  border: 3px dashed var(--red);
  box-shadow: 0 0 12px rgba(214, 42, 42, 0.72);
  display: block;
  height: 30%;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 46%;
}

.pitch-meter .pitch-target-zone b {
  height: 30%;
  width: 46%;
}

.walkup-overlay {
  display: none;
  left: 50%;
  pointer-events: none;
  position: absolute;
  top: clamp(112px, 17dvh, 180px);
  transform: translateX(-50%);
  width: min(560px, 88vw);
  z-index: 58;
}

.walkup-overlay.active {
  animation: walkupCardIn 1800ms steps(10) both;
  display: block;
}

.walkup-card {
  align-items: center;
  background: rgba(16, 16, 16, 0.94);
  border: 5px solid var(--gold);
  box-shadow: 7px 7px 0 var(--black), 0 0 30px rgba(217, 164, 65, 0.32);
  color: var(--cream);
  display: grid;
  gap: clamp(0.7rem, 1.8vw, 1.2rem);
  grid-template-columns: 94px minmax(0, 1fr);
  padding: clamp(0.65rem, 1.8vw, 1rem);
  text-transform: uppercase;
}

.walkup-card img {
  aspect-ratio: 4 / 5;
  background: var(--paper);
  border: 4px solid var(--black);
  object-fit: cover;
  width: 94px;
}

.walkup-copy h3 {
  color: var(--gold);
  font-size: clamp(1.35rem, 4vw, 2.55rem);
  letter-spacing: -0.08em;
  line-height: 0.95;
  margin: 0;
}

.walkup-copy p {
  margin: 0.35rem 0;
}

.walkup-zone-row {
  align-items: center;
  display: flex;
  gap: 0.7rem;
  justify-content: space-between;
}

.walkup-zone-row span {
  color: var(--red);
  font-weight: 900;
}

.walkup-zone {
  background: repeating-linear-gradient(0deg, #111 0 8px, #1d1d1d 8px 16px);
  border: 3px solid var(--cream);
  height: 64px;
  position: relative;
  width: 48px;
}

.walkup-zone::before,
.walkup-zone::after {
  background: rgba(255, 244, 200, 0.36);
  content: "";
  position: absolute;
}

.walkup-zone::before {
  height: 100%;
  left: calc(50% - 1px);
  top: 0;
  width: 2px;
}

.walkup-zone::after {
  height: 2px;
  left: 0;
  top: calc(50% - 1px);
  width: 100%;
}

.walkup-zone i {
  background: var(--red);
  box-shadow: 0 0 12px rgba(214, 42, 42, 0.84);
  display: block;
  height: 18px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
}

@keyframes walkupCardIn {
  0% { opacity: 0; transform: translate(-50%, 24px) scale(0.92); }
  16% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  78% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -18px) scale(1.03); }
}

@media (max-width: 620px) {
  .walkup-overlay {
    top: 188px;
    width: 92vw;
  }

  .walkup-card {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .walkup-card img {
    width: 72px;
  }

  .walkup-zone-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }
}

.summary-lineup-preview {
  margin-top: 1rem;
}

.summary-lineup-preview h3 {
  color: var(--gold);
  font-size: clamp(1rem, 2.8vw, 1.45rem);
  letter-spacing: -0.05em;
  margin: 0 0 0.7rem;
  text-transform: uppercase;
}

.summary-lineup-preview > div {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
}

.summary-batter-card {
  background: rgba(16, 16, 16, 0.92);
  border: 4px solid var(--paper);
  box-shadow: 4px 4px 0 var(--black);
  color: var(--cream);
  min-width: 0;
  padding: 0.45rem;
  text-align: center;
  text-transform: uppercase;
}

.summary-batter-card img {
  aspect-ratio: 4 / 5;
  background: var(--paper);
  border: 3px solid var(--black);
  display: block;
  margin: 0 auto 0.4rem;
  object-fit: cover;
  width: min(76px, 100%);
}

.summary-batter-card strong {
  color: var(--gold);
  display: block;
  font-size: 0.72rem;
  line-height: 1.05;
}

.summary-batter-card span {
  display: block;
  font-size: 0.58rem;
  line-height: 1.2;
  margin-top: 0.25rem;
}

@media (max-width: 760px) {
  .summary-lineup-preview > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
