:root {
  --ink: #0c2744;
  --ink-2: #16385c;
  --paper: #f4f1e8;
  --yellow: #d4e157;
  --teal: #1aa39a;
  --coral: #e45a43;
  --line: rgba(244, 241, 232, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #050e18;
  color: var(--paper);
  font-family: Outfit, "Segoe UI", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#page {
  width: 100%;
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 160px;
  gap: 10px;
  margin: 0;
  padding: 8px;
  align-items: stretch;
}

.ad-rail {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

#stage {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#app {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #07182c;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

body.game-open #app {
  touch-action: none;
  overscroll-behavior: none;
}

.site-foot {
  flex: 0 0 auto;
  padding: 0 12px 2px;
  font-size: 13px;
  text-align: center;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-weight: 600; }
.foot-note { margin: 2px auto 0; max-width: none; font-size: 11px; line-height: 1.4; color: rgba(244,241,232,0.45); }
.site-foot a {
  color: rgba(244, 241, 232, 0.7);
  text-decoration: none;
}
.site-foot a:hover { color: var(--yellow); }

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

#menu canvas, body.menu-open canvas { cursor: default; }

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 16px 0;
  padding-top: max(12px, env(safe-area-inset-top));
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.sb {
  display: flex;
  align-items: stretch;
  min-width: min(560px, 92vw);
  background: rgba(7, 24, 44, 0.72);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  overflow: hidden;
}

.sb-side {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  min-width: 28%;
}
.sb-side.right { justify-content: flex-end; }

.sb-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  opacity: 0.8;
}
.sb-side.right .sb-name { text-align: right; }

.sb-pts {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 36px;
  line-height: 1;
  font-weight: 800;
}
#pts-near { color: var(--yellow); }
#pts-far { color: #ffb4a8; }

.sb-mid {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 6px 8px;
}
.sb-call {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.sb-serve {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yellow);
  font-weight: 600;
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chip {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(7, 24, 44, 0.55);
  border: 1px solid var(--line);
  opacity: 0.55;
}
.chip.on {
  opacity: 1;
  background: rgba(212, 225, 87, 0.18);
  border-color: rgba(212, 225, 87, 0.45);
  color: var(--yellow);
}
.chip-rally { opacity: 0.8; }
.chip-objective {
  opacity: 0.92;
  border-color: rgba(255,180,168,0.5);
  color: #ffd0c8;
}
.chip-objective.done {
  border-color: rgba(212,225,87,0.55);
  background: rgba(212,225,87,0.16);
  color: var(--yellow);
}
.chip[hidden] { display: none !important; }

.keys {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  pointer-events: none;
  opacity: 0.78;
}
.keys.touch { display: none; }
.keys[hidden] { display: none !important; }
.wasd { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.wasd .w { margin-bottom: 0; }
.asd { display: flex; gap: 3px; }
.keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(7, 24, 44, 0.72);
  font: 700 10px Outfit, sans-serif;
  letter-spacing: 0.04em;
  color: var(--paper);
}
.keys kbd.wide { min-width: 48px; }
.keys-lab { font-size: 9px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.65; max-width: 72px; line-height: 1.25; }

/* Keep the far-side human visible in same-keyboard play. The compact score
   panel sits in the unused left gutter instead of over the far baseline. */
#hud.p2-layout {
  align-items: flex-start;
}
#hud.p2-layout .sb {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 160px;
  min-width: 160px;
  margin-left: 82px;
}
#hud.p2-layout .sb-side {
  min-width: 0;
  gap: 4px;
  padding: 6px 8px;
}
#hud.p2-layout .sb-side.right {
  grid-column: 2;
  grid-row: 1;
}
#hud.p2-layout .sb-name {
  min-width: 0;
  overflow: hidden;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#hud.p2-layout .sb-pts {
  flex: 0 0 auto;
  font-size: 24px;
}
#hud.p2-layout .sb-mid {
  grid-column: 1 / -1;
  grid-row: 2;
  border: 0;
  border-top: 1px solid var(--line);
  padding: 4px 6px 5px;
}
#hud.p2-layout .sb-call { font-size: 16px; }
#hud.p2-layout .sb-serve {
  max-width: 100%;
  overflow: hidden;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#hud.p2-layout .chips {
  width: 160px;
  margin-left: 82px;
  gap: 3px;
  justify-content: flex-start;
}
#hud.p2-layout .chip {
  padding: 3px 6px;
  font-size: 9px;
}
#hud.p2-layout .keys {
  top: 154px;
}
#hud.p2-layout .keys-p2 {
  left: 104px;
}

#banner, #toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  text-align: center;
}
#banner {
  top: 38%;
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-size: clamp(40px, 8vw, 84px);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 18px 40px rgba(0,0,0,0.45);
  opacity: 0;
  transition: opacity 0.12s linear;
}
#banner.show { opacity: 1; }
#toast {
  bottom: 22%;
  font-size: 15px;
  font-weight: 600;
  background: rgba(7, 24, 44, 0.78);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  opacity: 0;
}
#toast.show { opacity: 1; }

.coach {
  position: absolute;
  z-index: 7;
  top: 150px;
  left: 50%;
  width: min(380px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 14px 16px 15px;
  border: 1px solid rgba(212, 225, 87, 0.42);
  border-radius: 14px;
  background: rgba(7, 24, 44, 0.92);
  box-shadow: 0 18px 45px rgba(0,0,0,0.32);
  backdrop-filter: blur(12px);
  pointer-events: none;
}
.coach-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  color: var(--yellow);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.coach-top button {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  color: var(--paper);
  font: 700 11px Outfit, sans-serif;
  cursor: pointer;
  pointer-events: auto;
}
.coach strong {
  display: block;
  margin-bottom: 3px;
  font-size: 18px;
}
.coach p {
  color: rgba(244,241,232,0.78);
  font-size: 13px;
  line-height: 1.4;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(7, 24, 44, 0.35), rgba(7, 24, 44, 0.72));
  z-index: 5;
}
.overlay[hidden] { display: none !important; }

.card {
  width: min(440px, 100%);
  background: rgba(12, 39, 68, 0.88);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 26px 22px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.4);
  backdrop-filter: blur(16px);
}
.card.wide { width: min(640px, 100%); max-height: min(86dvh, 820px); overflow: auto; }
.challenge-card.wide, .scout-card { max-height: 100%; overflow: hidden; padding: 0; display: flex; flex-direction: column; }
.roster-card {
  width: min(820px, 100%);
  max-height: 100%;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.roster-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 20px 22px 8px; display: flex; flex-direction: column; }
.roster-actions {
  flex: 0 0 auto;
  padding: 10px 22px calc(14px + env(safe-area-inset-bottom));
  background: rgba(12, 39, 68, 0.96);
  border-top: 1px solid var(--line);
}
body:has(#roster:not([hidden]), #challenge:not([hidden]), #scout:not([hidden])) .site-foot { display: none; }
.roster-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.roster-top h2 { margin: 0; }
.roster-top .lede { margin: 0; max-width: 280px; text-align: right; }
.roster-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 28px;
  row-gap: 8px;
  align-items: start;
  margin: 0 0 12px;
}
.side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tune { display: flex; flex-direction: column; gap: 8px; }
.btn.tune-toggle { display: none; } /* phone-only, see the 700px block */
.kit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.kit canvas {
  width: 120px;
  height: 156px;
  border-radius: 12px;
  background: rgba(0,0,0,0.18);
  display: block;
  transform-origin: 50% 70%;
}
.kit canvas.spinning {
  animation: kit-spin 0.11s linear infinite;
}
.kit canvas.landed {
  animation: kit-land 0.28s ease-out;
}
@keyframes kit-spin {
  0% { transform: rotate(-8deg) scale(0.94); filter: saturate(1.15); }
  50% { transform: rotate(8deg) scale(1.04); }
  100% { transform: rotate(-8deg) scale(0.94); }
}
@keyframes kit-land {
  0% { transform: scale(1.08) rotate(4deg); }
  100% { transform: scale(1) rotate(0); }
}
.kit .btn:disabled { opacity: 0.65; cursor: wait; }
.kit .btn { width: 100%; padding: 8px 10px; }
.build-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-height: 22px;
}
.build-head h3 { margin: 0; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.budget { font-size: 12px; font-weight: 700; color: var(--yellow); }
.budget.over { color: var(--coral); }
.presets {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px;
}
.presets button {
  font: 650 11px Outfit, sans-serif;
  letter-spacing: 0.03em;
  color: var(--paper);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 4px;
  cursor: pointer;
  text-align: center;
  width: 100%;
}
.presets button.on { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.presets button.wide { grid-column: 1 / -1; }
.stat-list { display: flex; flex-direction: column; gap: 4px; }
.stat-row {
  display: grid;
  grid-template-columns: 58px 1fr 22px;
  gap: 8px;
  align-items: center;
  min-height: 26px;
}
.stat-row label { font-size: 12px; font-weight: 600; }
.stat-row input[type="range"] { width: 100%; accent-color: var(--yellow); }
.stat-row .n { font-family: "Barlow Condensed", sans-serif; font-size: 18px; font-weight: 800; text-align: right; }
.roster-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.roster-actions .btn { margin: 0; }

.tourney-map {
  display: flex;
  flex-direction: column-reverse;
  gap: 0;
  margin: 8px 0 16px;
  padding-left: 8px;
}
.map-you {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px 14px;
  font: 800 13px Outfit, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
}
.map-you .dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(212, 225, 87, 0.2);
  flex-shrink: 0;
}
.map-you::after {
  content: "";
  position: absolute;
  left: 10px;
  bottom: 100%;
  width: 2px;
  height: 10px;
  background: rgba(212, 225, 87, 0.35);
}
.map-node {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 0 6px;
  padding: 12px 14px 12px 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  color: var(--paper);
  font: 700 15px Outfit, sans-serif;
  text-align: left;
  cursor: pointer;
}
.map-node + .map-node { margin-top: 10px; }
.map-node::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -11px;
  width: 2px;
  height: 11px;
  background: rgba(212, 225, 87, 0.35);
}
.map-node .round-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.map-node .round-meta strong { font-size: 15px; }
.map-node .round-meta em { font-style: normal; font-size: 12px; font-weight: 500; opacity: 0.72; }
.map-node .tag { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--yellow); flex-shrink: 0; }
.map-node:hover { filter: brightness(1.08); }
.map-node.locked { opacity: 0.38; cursor: not-allowed; }
.map-node.done { border-color: rgba(212, 225, 87, 0.45); }
.map-node.now {
  border-color: var(--yellow);
  box-shadow: 0 0 0 2px rgba(212, 225, 87, 0.25);
  background: rgba(212, 225, 87, 0.08);
}
.scout-diff {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
  margin: 4px 0 10px;
}
.scout-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0 0 16px; }
.scout-stat { display: flex; flex-direction: column; gap: 4px; }
.scout-stat span { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.75; }
.scout-plan {
  display: grid;
  gap: 7px;
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}
.scout-plan p { display: grid; gap: 2px; }
.scout-plan strong,
.scout-boosts {
  color: var(--yellow);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.scout-plan span { font-size: 12px; line-height: 1.35; color: rgba(244,241,232,0.8); }
.scout-boosts {
  margin: -2px 0 12px;
  padding: 7px 9px;
  border-radius: 8px;
  background: rgba(212,225,87,0.1);
}
.scout-record {
  margin: -3px 0 12px;
  color: rgba(244,241,232,0.62);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.scout-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
.scout-bar i {
  display: block;
  height: 100%;
  background: var(--yellow);
  border-radius: 99px;
}

.tourney-upgrade {
  margin: 16px 0 10px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.tourney-upgrade h3 { margin: 2px 0 3px; font-size: 22px; }
.tourney-upgrade .hint { margin: 0 0 10px; }
.upgrade-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.upgrade-choice {
  min-width: 0;
  padding: 10px 8px;
  border: 1px solid rgba(212,225,87,0.32);
  border-radius: 11px;
  background: rgba(212,225,87,0.08);
  color: var(--paper);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.upgrade-choice:hover { border-color: var(--yellow); background: rgba(212,225,87,0.15); }
.upgrade-choice strong { display: block; margin-bottom: 3px; color: var(--yellow); font-size: 13px; }
.upgrade-choice span { display: block; font-size: 10px; line-height: 1.3; opacity: 0.72; }

@media (max-width: 500px) {
  .upgrade-choices { grid-template-columns: 1fr; }
}

.venue-bar { margin: 8px 0 12px; }
.venue-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.venue-grid button {
  min-width: 0;
  font: 600 11px Outfit, sans-serif;
  color: rgba(244, 241, 232, 0.88);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(244, 241, 232, 0.12);
  border-radius: 8px;
  padding: 7px 4px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.venue-grid button:hover { background: rgba(255,255,255,0.09); color: var(--paper); }
.venue-grid button.on { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
@media (min-width: 701px) {
  /* Wide roster card: all eight venues on one row. */
  #roster-venue .venue-grid { grid-template-columns: repeat(8, 1fr); }
}
.roster-top .kicker { margin-bottom: 4px; }
@media (max-width: 700px) {
  /* Phone roster: kits side by side, Start always on screen; stats + venue fold away. */
  .roster-body { padding: 16px 14px 4px; }
  .roster-top { margin-bottom: 10px; }
  .roster-top .lede { display: none; }
  .roster-top h2 { font-size: 34px; }
  .roster-grid { grid-template-columns: 1fr 1fr; column-gap: 10px; margin-bottom: 8px; order: 1; }
  .kit { padding: 6px 6px 8px; gap: 6px; }
  .kit canvas { width: 100%; height: auto; aspect-ratio: 200 / 260; max-width: 150px; }
  .kit .btn { padding: 8px 6px; font-size: 13px; }
  .presets { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .presets button { font-size: 10px; padding: 6px 2px; min-width: 0; overflow: hidden; }
  .stat-row { grid-template-columns: 44px 1fr 18px; gap: 6px; }
  .stat-row label { font-size: 11px; }
  #roster .venue-bar, .tune { display: none; }
  .roster-card.tuning #roster-venue { display: block; order: 2; margin-bottom: 8px; }
  .roster-card.tuning .tune { display: flex; }
  .btn.tune-toggle { display: block; margin: 0 0 8px; order: 3; }
  .roster-actions { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); grid-template-columns: 1fr auto; }
  .challenge-card .roster-body, .scout-card .roster-body { padding: 16px 14px 4px; }
  .scout-card .scout-stats { margin-bottom: 8px; }
  .challenge-card .lede { font-size: 14px; margin-bottom: 4px; }
  .tourney-map { margin: 4px 0 8px; }
  .roster-actions .btn.ghost { padding-left: 16px; padding-right: 16px; }
}

.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 8px;
}
h1, h2 {
  font-family: "Barlow Condensed", Impact, sans-serif;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 0.95;
}
h1 { font-size: clamp(52px, 10vw, 76px); margin-bottom: 10px; }
h2 { font-size: 42px; margin-bottom: 12px; }
.wordmark .vs { display: inline-block; color: var(--yellow); transform: skewX(-9deg); margin-right: 0.04em; }
h3 { font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase; margin: 18px 0 8px; }
.lede { color: rgba(244,241,232,0.82); line-height: 1.45; margin-bottom: 18px; }
.hint { font-size: 13px; line-height: 1.5; color: rgba(244,241,232,0.62); margin-top: 12px; }

.diff {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.diff button {
  flex: 1;
  font: 650 13px Outfit, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 0;
  cursor: pointer;
}
.diff button.on {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
}

.btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  font: 700 15px Outfit, sans-serif;
  color: var(--paper);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
}
.btn[hidden] { display: none !important; }
.btn.primary {
  background: var(--yellow);
  color: var(--ink);
  border-color: var(--yellow);
}
.btn.ghost { background: transparent; }
.btn:hover { filter: brightness(1.08); }

#menu { flex-direction: column; justify-content: flex-start; }
#menu .card { margin-top: auto; }
.seo-blurb { width: min(440px, 100%); margin: 14px 0 auto; padding: 18px 22px 16px; background: rgba(12, 39, 68, 0.86); border: 1px solid var(--line); border-radius: 20px; color: rgba(244,241,232,0.78); font-size: 13px; line-height: 1.5; }
.seo-blurb h2 { font-size: 15px; line-height: 1.25; margin: 0 0 6px; letter-spacing: 0; }
.seo-blurb p { margin: 0 0 8px; }
.seo-blurb h3 { font-size: 14px; line-height: 1.25; margin: 14px 0 6px; letter-spacing: 0; color: rgba(244,241,232,0.9); }
.seo-blurb ul { margin: 0 0 8px; padding-left: 18px; }
.seo-blurb li { margin: 0 0 6px; }
.seo-blurb strong { color: rgba(244,241,232,0.9); }
.faq { margin: 0 0 10px; }
.faq dt { font-weight: 600; color: rgba(244,241,232,0.9); margin: 8px 0 2px; }
.faq dd { margin: 0; }
.seo-blurb a { color: var(--paper); text-decoration: underline; }
.seo-blurb a:hover { color: var(--yellow); }

.rules { padding-left: 18px; display: flex; flex-direction: column; gap: 10px; }
.rules li { line-height: 1.45; color: rgba(244,241,232,0.86); font-size: 14px; }

#toolbar {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  gap: 6px;
  z-index: 6;
}
#toolbar button {
  font: 700 12px Outfit, sans-serif;
  letter-spacing: 0.06em;
  color: var(--paper);
  background: rgba(7, 24, 44, 0.55);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

#touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
/* The whole lower-left area is the stick's hit zone: the pad jumps to
   wherever the thumb lands, so you never have to find the knob first. */
#stick-zone {
  pointer-events: auto;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  position: absolute;
  left: 0;
  bottom: 0;
  width: 55%;
  height: 62%;
}
#stick {
  pointer-events: none;
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(7, 24, 44, 0.35);
  border: 1px solid var(--line);
}
#stick-zone #stick.floating { left: var(--sx); top: var(--sy); bottom: auto; transform: translate(-50%, -50%); }
#knob {
  position: absolute;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(212, 225, 87, 0.9);
  left: 33px;
  top: 33px;
  pointer-events: none;
}
#btn-swing {
  --charge: 0deg;
  pointer-events: auto;
  touch-action: none;
  -webkit-touch-callout: none;
  position: absolute;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 3px solid rgba(212, 225, 87, 0.5);
  background:
    radial-gradient(circle, rgba(7, 24, 44, 0.9) 0 66%, transparent 68%),
    conic-gradient(var(--orange) 0 var(--charge), rgba(212, 225, 87, 0.34) var(--charge) 360deg);
  color: var(--yellow);
  font: 800 14px Outfit, sans-serif;
  letter-spacing: 0.08em;
  cursor: pointer;
  box-shadow: 0 9px 24px rgba(0,0,0,0.3);
  text-shadow: 0 1px 4px rgba(0,0,0,0.7);
  transition: transform 0.08s ease, opacity 0.15s ease;
}
#btn-swing.charging { transform: scale(0.95); }
#btn-swing.inactive { opacity: 0.72; }

body.menu-open #hud,
body.menu-open #toolbar #btn-pause { display: none; }
body.menu-open #touch { display: none; }

.touch-only { display: none; }
@media (pointer: coarse) {
  #btn-full { display: none; }
  #btn-p2 { display: none; }
  .kb-only { display: none; }
  .touch-only { display: inline; }
}

@media (min-width: 1800px) {
  #page { grid-template-columns: 300px minmax(0, 1fr) 300px; }

  #menu .card,
  #over .card,
  #pause .card,
  #scout .card,
  .seo-blurb { width: min(clamp(520px, 30vw, 680px), 100%); }
  #menu .lede { font-size: 16px; }

  .sb { min-width: 680px; border-radius: 17px; }
  .sb-side { gap: 12px; padding: 10px 18px; }
  .sb-name { font-size: 15px; }
  .sb-pts { font-size: 44px; }
  .sb-call { font-size: 25px; }
  .sb-serve { font-size: 13px; }
  .chip { font-size: 13px; padding: 5px 11px; }
  .keys { transform: scale(1.2); transform-origin: top left; }
  #toolbar { transform: scale(1.15); transform-origin: top right; }
  #toast { font-size: 17px; padding: 10px 17px; }
}

@media (min-width: 2400px) and (min-height: 1200px) {
  .sb { min-width: 760px; }
  .sb-name { font-size: 17px; }
  .sb-pts { font-size: 50px; }
  .sb-call { font-size: 28px; }
  .sb-serve { font-size: 14px; }
  .chip { font-size: 14px; padding: 6px 13px; }
  .keys { transform: scale(1.4); }
  #toolbar { transform: scale(1.3); }
  #toast { font-size: 19px; }

  #over .card { padding: 38px 36px 30px; }
  #over .kicker { font-size: 15px; }
  #over h2 { font-size: 60px; margin-bottom: 16px; }
  #over .lede { font-size: 24px; }
  #over .hint { font-size: 16px; }
  #over .btn { font-size: 17px; padding: 15px 18px; }
}

@media (max-height: 850px) and (min-width: 701px) {
  .overlay { padding: 12px; }
  #menu .card { padding: 18px 20px 14px; }
  #menu h1 { font-size: 60px; margin-bottom: 6px; }
  #menu .lede { line-height: 1.35; margin-bottom: 10px; }
  #menu .diff { margin-bottom: 8px; }
  #menu .venue-bar { margin: 4px 0 8px; }
  #menu .venue-grid { gap: 4px; }
  #menu .btn { margin-top: 5px; padding: 9px 14px; }
  #menu .hint { margin-top: 7px; }
}

@media (max-width: 1100px) {
  #page {
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
  }
  .ad-rail { display: none; }
  #app {
    border-radius: 0;
    box-shadow: none;
  }
  .site-foot { padding: 8px 12px 10px; }
  body.game-open .site-foot { display: none; }
}
@media (max-width: 420px) {
  /* Small phones: keep the six footer links on one line. */
  .foot-links { gap: 4px 11px; font-size: 12px; }
  .foot-note { font-size: 10px; }
}

@media (max-height: 600px) {
  .site-foot { display: none; }
  #menu,
  #roster,
  #howto,
  #challenge { align-items: flex-start; }
  #hud { padding: 6px 10px 0; gap: 4px; }
  .coach {
    top: 82px;
    width: min(340px, calc(100% - 260px));
    padding: 9px 12px 10px;
  }
  .coach strong { font-size: 15px; }
  .coach p { font-size: 11px; }
  .chips { gap: 4px; }
  #stick {
    left: max(22px, env(safe-area-inset-left));
    bottom: max(22px, env(safe-area-inset-bottom));
    width: 100px;
    height: 100px;
  }
  #knob { width: 44px; height: 44px; left: 28px; top: 28px; }
  #btn-swing {
    right: max(12px, env(safe-area-inset-right));
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 92px;
    height: 92px;
    font-size: 13px;
  }
}

@media (max-width: 700px) {
  #hud { padding-top: 52px; }
  #menu,
  #roster,
  #howto,
  #challenge { align-items: flex-start; }
  .sb { min-width: auto; width: calc(100% - 24px); }
  .sb-pts { font-size: 26px; }
  .sb-name { font-size: 11px; }
  .sb-call { font-size: 16px; }
  #banner { font-size: 36px; top: 32%; }
  .coach { top: 172px; }
  #btn-full { display: none; }
  .card { padding: 22px 16px 16px; }
  h1 { font-size: 52px; }
  .keys { display: none; }
  /* Phone menu: keep the primary Start button inside the first screen. */
  #menu .kicker { font-size: 10.5px; letter-spacing: 0.08em; margin-bottom: 6px; white-space: nowrap; }
  #menu .kicker-more { display: none; }
  #menu h1 { margin-bottom: 8px; }
  #menu .lede { font-size: 15px; line-height: 1.4; margin-bottom: 12px; }
  #menu .diff { margin-bottom: 10px; }
  #menu .venue-bar { margin: 4px 0 10px; }
  #menu .hint { font-size: 12px; margin-top: 8px; }
}

@media (max-width: 380px) {
  #stick { width: 108px; height: 108px; }
  #knob { width: 48px; height: 48px; left: 30px; top: 30px; }
  #btn-swing { width: 96px; height: 96px; font-size: 13px; }
}

/* Portrait phones: the court ends above the touch controls, so park the toast
   in the near kitchen instead of over the player. */
@media (max-width: 700px) and (orientation: portrait) {
  /* Keep the toast out of the play area: tuck it under the HUD chips, small and translucent. */
  #toast { bottom: auto; top: 134px; font-size: 13px; padding: 5px 12px; background: rgba(7, 24, 44, 0.55); max-width: 80vw; }
}
