/* Kickoff — floodlit pitch: deep green, chalk white, red vs blue */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #0b1610;
  color: #eef6ef;
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
:root { --red: #e5483f; --blue: #3b7ff0; --chalk: #f4f8f2; --gold: #ffd25a; }

#gameCanvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; z-index: 0;
}

/* ── HUD ─────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; }

.scorebug {
  position: absolute; left: 50%; top: calc(8px + env(safe-area-inset-top));
  transform: translateX(-50%);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .5);
  background: rgba(8, 16, 11, .9); border: 1px solid rgba(255, 255, 255, .12);
  min-width: 250px;
}
.sb-team { display: flex; align-items: center; gap: 10px; padding: 4px 12px; font-weight: 900; }
.sb-team b { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sb-name { font-size: 12px; letter-spacing: .16em; opacity: .9; }
.sb-red { background: linear-gradient(90deg, #a82a24, var(--red)); justify-content: flex-end; }
.sb-blue { background: linear-gradient(90deg, var(--blue), #2453a8); }
.sb-mid { padding: 3px 14px; text-align: center; min-width: 74px; }
.sb-clock { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.15; }
.sb-clock.warn { color: #ffb44a; }
.sb-ot { font-size: 10px; letter-spacing: .14em; color: var(--gold); font-weight: 800; min-height: 0; }
.sb-ot:empty { display: none; }
.sb-poss { grid-column: 1 / -1; height: 4px; background: var(--blue); }
.sb-poss > div { height: 100%; width: 50%; background: var(--red); transition: width .4s; }

.sheet-btn {
  position: absolute; left: calc(8px + env(safe-area-inset-left));
  top: calc(8px + env(safe-area-inset-top)); pointer-events: auto;
  width: 36px; height: 36px; border-radius: 10px; font-size: 17px;
  background: rgba(8, 16, 11, .85); border: 1px solid rgba(255, 255, 255, .16); color: #fff;
  cursor: pointer;
}
.hud-sheet {
  position: absolute; left: calc(8px + env(safe-area-inset-left));
  top: calc(50px + env(safe-area-inset-top));
  display: none; gap: 8px; pointer-events: none;
  background: rgba(8, 16, 11, .86); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 12px; padding: 8px 10px; font-size: 12px; max-width: min(420px, 92vw);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45);
}
.hud-sheet.open { display: grid; grid-template-columns: 1fr 1fr; }
.sheet-col h4 { margin: 0 0 4px; font-size: 11px; letter-spacing: .14em; }
.sheet-col.red h4 { color: #ff8a82; }
.sheet-col.blue h4 { color: #8fb6ff; }
.sheet-row { display: flex; align-items: baseline; gap: 6px; padding: 2px 0; flex-wrap: wrap; }
.sheet-row .num {
  width: 18px; height: 18px; border-radius: 50%; display: inline-flex; flex: none;
  align-items: center; justify-content: center; font-size: 10px; font-weight: 800;
}
.sheet-col.red .num { background: var(--red); }
.sheet-col.blue .num { background: var(--blue); }
.sheet-row .nm { font-weight: 700; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-row .g { color: var(--gold); font-weight: 800; }
.sheet-row.me .nm { text-decoration: underline; text-decoration-color: var(--gold); }

.hud-toast {
  position: absolute; top: calc(66px + env(safe-area-inset-top)); right: 8px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end; max-width: 60vw;
}
.toast {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(8, 16, 11, .86); color: #eef6ef;
  border: 1px solid rgba(255, 255, 255, .14);
  animation: toast-in .18s ease-out, toast-out .4s ease-in 2.6s forwards;
}
@keyframes toast-in { from { transform: translateX(16px); opacity: 0; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

.hud-center {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none; width: min(94vw, 620px);
}
.goal-banner { animation: goal-pop .5s cubic-bezier(.2, 1.6, .4, 1); }
.goal-banner .big {
  font-size: clamp(52px, 16vw, 120px); font-weight: 900; font-style: italic;
  letter-spacing: .04em; line-height: 1;
  color: #fff; -webkit-text-stroke: 2px rgba(0, 0, 0, .35);
  text-shadow: 0 6px 0 rgba(0, 0, 0, .35), 0 0 40px var(--glow, rgba(255, 210, 90, .8));
}
.goal-banner .who {
  display: inline-block; margin-top: 8px; padding: 6px 16px; border-radius: 999px;
  background: rgba(8, 16, 11, .82); font-size: 17px; font-weight: 800;
}
.goal-banner .sub { margin-top: 4px; font-size: 13px; color: #cfe3d3; text-shadow: 0 2px 0 rgba(0,0,0,.6); }
@keyframes goal-pop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } }
.center-note {
  display: inline-block; padding: 8px 18px; border-radius: 14px; font-weight: 800;
  background: rgba(8, 16, 11, .8); border: 1px solid rgba(255, 255, 255, .15); font-size: 18px;
}

.stamina {
  position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-50%); width: 160px; height: 7px; border-radius: 4px;
  background: rgba(0, 0, 0, .45); overflow: hidden; display: none;
}
.stamina > div { height: 100%; width: 100%; background: linear-gradient(90deg, #6ee87a, #d8ff6a); }
.stamina.low > div { background: linear-gradient(90deg, #ff6a4a, #ffb44a); }

/* touch controls — shown only on coarse pointers */
#touchLayer { display: none; }
@media (pointer: coarse) {
  #touchLayer { display: block; }
  .stamina { display: block; bottom: auto; top: calc(66px + env(safe-area-inset-top)); width: 120px; }
}
.stick {
  position: absolute; width: 120px; height: 120px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .07);
  display: none; pointer-events: none;
}
.stick-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; border-radius: 50%;
  transform: translate(-50%, -50%); background: rgba(255, 255, 255, .55);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .4);
}
.stick-hint {
  position: absolute; left: calc(22px + env(safe-area-inset-left));
  bottom: calc(26px + env(safe-area-inset-bottom));
  font-size: 12px; color: rgba(255, 255, 255, .5); letter-spacing: .08em;
}
.act-btn {
  position: absolute; pointer-events: auto; touch-action: none;
  border-radius: 50%; font-weight: 900; letter-spacing: .06em; color: #fff;
  border: 3px solid rgba(255, 255, 255, .7); padding: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .4);
}
.kick-btn {
  right: calc(18px + env(safe-area-inset-right)); bottom: calc(30px + env(safe-area-inset-bottom));
  width: 92px; height: 92px; font-size: 16px; background: rgba(229, 72, 63, .55);
}
.sprint-btn {
  right: calc(122px + env(safe-area-inset-right)); bottom: calc(20px + env(safe-area-inset-bottom));
  width: 64px; height: 64px; font-size: 11px; background: rgba(110, 232, 122, .35);
}
.slide-btn {
  right: calc(40px + env(safe-area-inset-right)); bottom: calc(134px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; font-size: 11px; background: rgba(255, 210, 90, .3);
}
.act-btn.held { filter: brightness(1.6); transform: scale(.94); }
.act-btn.cool { opacity: .4; }

/* audio strip in the HUD: tucked behind a small toggle so it never covers play */
.hud-gear {
  position: absolute; right: calc(8px + env(safe-area-inset-right));
  top: calc(8px + env(safe-area-inset-top)); pointer-events: auto;
}
.hud-gear summary {
  list-style: none; cursor: pointer; width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  background: rgba(8, 16, 11, .85); border: 1px solid rgba(255, 255, 255, .16);
}
.hud-gear summary::-webkit-details-marker { display: none; }
/* site_audio.css pins #hudAudio fixed bottom-centre; inside the gear it sits
   below the toggle instead, so restate ALL four placement properties. */
#hudAudio {
  position: absolute; top: 42px; right: 0; left: auto; bottom: auto; transform: none;
  background: rgba(8, 16, 11, .94); border-radius: 12px; padding: 6px 8px;
  width: max-content; max-width: 86vw;
}
.audio-controls {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  justify-content: center; padding: 4px 0;
}
.audio-controls button {
  background: #16291c; color: #dff0e1; border: 1px solid #2f5238;
  border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.audio-controls input[type="range"] { width: 86px; accent-color: var(--gold); }
/* web/style.css pins .volume-slider position:fixed top:12px — undo it here
   or every slider lands in the corner of the screen (CLAUDE.md item 5). */
.volume-slider { position: static !important; top: auto !important; }

.spectator-flag {
  position: fixed; bottom: calc(14px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 9; padding: 4px 12px;
  background: rgba(8, 16, 11, .86); border: 1px solid #2f5238;
  border-radius: 999px; font-size: 12px; letter-spacing: .1em; color: #dff0e1;
}

/* ── overlays / lobby card ───────────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; display: flex; align-items: flex-start;
  justify-content: center; z-index: 10; overflow-y: auto; padding: 24px 0;
  background:
    radial-gradient(700px 420px at 15% 0%, rgba(255, 255, 230, .10), transparent 60%),
    radial-gradient(700px 420px at 85% 0%, rgba(255, 255, 230, .10), transparent 60%),
    repeating-linear-gradient(90deg, #12301c 0 70px, #153820 70px 140px);
}
#lobbyOverlay.in-play { background: rgba(5, 12, 8, .72); }
.card {
  width: min(480px, 94vw); padding: 20px 20px 14px; margin: auto 0;
  background: rgba(9, 20, 13, .95); border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px; box-shadow: 0 16px 60px rgba(0, 0, 0, .6); text-align: center;
}
.ko-title {
  margin: 4px 0 6px; font-size: clamp(36px, 10vw, 56px); font-weight: 900; font-style: italic;
  letter-spacing: .04em; color: var(--chalk);
  text-shadow: 0 3px 0 #0a3d1c, 0 0 24px rgba(160, 255, 170, .25);
  display: flex; align-items: center; justify-content: center; gap: .18em;
}
.ko-title span:not(.ko-ball) { color: var(--gold); margin-left: -.12em; }
.ko-title.small { font-size: clamp(26px, 7vw, 38px); }
.ko-ball {
  width: .8em; height: .8em; border-radius: 50%; flex: none;
  background:
    radial-gradient(circle at 50% 50%, #1c1c1c 0 17%, transparent 18%),
    radial-gradient(circle at 18% 30%, #1c1c1c 0 10%, transparent 11%),
    radial-gradient(circle at 82% 30%, #1c1c1c 0 10%, transparent 11%),
    radial-gradient(circle at 30% 85%, #1c1c1c 0 10%, transparent 11%),
    radial-gradient(circle at 70% 85%, #1c1c1c 0 10%, transparent 11%),
    radial-gradient(circle at 35% 30%, #fff, #d9dfe3);
  box-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
.tagline { margin: 0 0 14px; color: #bcd4c1; font-size: 14px; }
.instructions { margin: 12px 0 4px; font-size: 12.5px; color: #9fbca6; display: grid; gap: 4px; }
.muted { color: #8fae96; }

input#nameInput {
  width: 100%; padding: 11px 14px; border-radius: 10px; font-size: 15px;
  border: 1px solid #2f5238; background: #0f2216; color: #eef6ef;
  outline: none; margin-bottom: 10px;
}
button.primary, button.secondary {
  width: 100%; padding: 12px; border: 0; border-radius: 10px;
  font-size: 16px; font-weight: 800; letter-spacing: .04em; cursor: pointer;
}
button.primary {
  background: linear-gradient(180deg, #ffe07a, #f5b62a); color: #2a1d02;
  box-shadow: 0 6px 22px rgba(245, 182, 42, .28);
}
button.secondary { margin-top: 8px; background: #15291c; color: #dff0e1; border: 1px solid #2f5238; }
button.primary:active, button.secondary:active { filter: brightness(.9); }
button:disabled { opacity: .55; cursor: default; }
.link-btn {
  margin-top: 10px; background: none; border: 0; color: var(--gold); cursor: pointer;
  font-size: 14px; font-weight: 700;
}
.back-link { display: block; margin-top: 10px; color: #8fae96; font-size: 13px; }

.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 6px 0 8px; }
.team-col {
  border-radius: 12px; padding: 8px; text-align: left; min-height: 120px;
  display: flex; flex-direction: column; gap: 4px; transition: box-shadow .15s;
}
.team-col.red { background: linear-gradient(180deg, rgba(229, 72, 63, .28), rgba(229, 72, 63, .08)); border: 1px solid rgba(229, 72, 63, .45); }
.team-col.blue { background: linear-gradient(180deg, rgba(59, 127, 240, .28), rgba(59, 127, 240, .08)); border: 1px solid rgba(59, 127, 240, .45); }
.team-col.drop { box-shadow: 0 0 0 3px var(--gold) inset; }
.team-head { font-weight: 900; letter-spacing: .14em; font-size: 13px; }
.team-head span { font-weight: 600; opacity: .75; letter-spacing: 0; }
.team-list { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.p-row {
  display: flex; align-items: center; gap: 6px; padding: 4px 7px; border-radius: 8px;
  background: rgba(0, 0, 0, .28); font-size: 13.5px; flex-wrap: wrap;
}
.p-row[draggable="true"] { cursor: grab; outline: 1px dashed rgba(255, 210, 90, .5); }
.p-row .tag { margin-left: auto; font-size: 10.5px; color: #cfe3d3; opacity: .8; }
.p-row.bot { opacity: .55; font-style: italic; }
.team-join {
  margin-top: 4px; padding: 6px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(0, 0, 0, .25); color: #fff; font-weight: 700; cursor: pointer;
}
.team-join.small { margin: 0 0 0 auto; padding: 3px 10px; font-size: 12px; }
.team-join.here { display: none; }
.stands {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px;
  background: rgba(255, 255, 255, .05); border-radius: 10px; padding: 6px 8px; text-align: left;
}
.stands.drop { box-shadow: 0 0 0 2px var(--gold) inset; }
.stands-label { color: #9fbca6; }
.stands-list { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.host-only { display: none; }
.is-host .host-only { display: inline-block; }

.settings { margin: 8px 0 10px; text-align: left; }
.settings-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; flex-wrap: wrap; }
.settings-label { width: 78px; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #9fbca6; }
.seg { display: inline-flex; border-radius: 9px; overflow: hidden; border: 1px solid #2f5238; flex-wrap: wrap; }
.seg button {
  background: #0f2216; color: #d3e8d7; border: 0; padding: 6px 10px; font-size: 12.5px; cursor: pointer;
}
.seg button.on { background: linear-gradient(180deg, #ffe07a, #f5b62a); color: #2a1d02; font-weight: 800; }
.seg.locked button { cursor: default; }
.seg.locked button:not(.on) { opacity: .6; }

.briefing { text-align: left; margin: 10px 0; font-size: 13px; color: #bcd4c1; }
.briefing ul { margin: 6px 0 0 18px; padding: 0; }
.briefing li { margin-bottom: 4px; }

.leaderboard { margin-top: 12px; text-align: left; }
.leaderboard, .lb-panel, .lb-card {
  --lb-accent: #ffd25a;
  --lb-text: #eef6ef;
  --lb-dim: rgba(238, 246, 239, .55);
  --lb-edge: rgba(255, 255, 255, .14);
  --lb-panel: rgba(18, 40, 26, .75);
}
.lb-card { max-width: min(600px, 94vw) !important; width: min(600px, 94vw) !important; }

.load-bar {
  height: 10px; border-radius: 6px; background: #0f2216; overflow: hidden;
  border: 1px solid #2f5238; margin: 12px 0 6px;
}
#loadBar { height: 100%; width: 100%; background: linear-gradient(90deg, var(--red), var(--gold), var(--blue)); }
.peers { min-height: 16px; font-size: 12px; }
.countdown { font-size: 84px; font-weight: 900; color: var(--chalk); text-shadow: 0 0 30px rgba(255, 220, 120, .55); }

/* ── results ─────────────────────────────────────────────────────── */
.card.results-wide { width: min(820px, 96vw); }
.result-score {
  display: inline-flex; align-items: center; gap: 14px; font-size: 40px; font-weight: 900;
  font-variant-numeric: tabular-nums; margin: 2px 0 6px;
}
.result-score .r { color: #ff8a82; }
.result-score .b { color: #8fb6ff; }
.result-score .dash { opacity: .5; font-size: 28px; }
#resultTable { overflow-x: auto; scrollbar-width: thin; }
#resultTable .fs-table { width: max-content; min-width: 100%; font-size: .84rem; }
#resultTable .fs-table th, #resultTable .fs-table td { padding: 6px 8px; }
@media (max-width: 560px) {
  #resultTable .fs-table { font-size: .76rem; }
  .sb-team b { font-size: 21px; }
  .sb-clock { font-size: 18px; }
  .scorebug { min-width: 0; }
  .sb-name { display: none; }
}

/* ── how to play ─────────────────────────────────────────────────── */
.card { position: relative; }
.card-help {
  position: absolute; left: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255, 210, 90, .6); background: rgba(255, 210, 90, .12);
  color: var(--gold); font-weight: 900; font-size: 16px; cursor: pointer; z-index: 2;
}
.help-hud { top: calc(50px + env(safe-area-inset-top)); color: var(--gold); font-weight: 900; }
.hud-sheet { top: calc(92px + env(safe-area-inset-top)); }
.help-overlay {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-start;
  justify-content: center; overflow-y: auto; padding: 16px 0;
  background: rgba(3, 9, 5, .78); backdrop-filter: blur(2px);
}
.help-card {
  position: relative; width: min(520px, calc(100vw - 24px)); margin: auto 0;
  background: linear-gradient(180deg, #10261a, #0a1a11); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 18px; padding: 18px 18px 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.help-card h2 { margin: 0 34px 4px 0; font-size: 22px; }
.help-ko { color: var(--gold); font-style: italic; }
.help-lead { margin: 0 0 10px; color: #bcd4c1; font-size: 14px; }
.help-x {
  position: absolute; right: 10px; top: 10px; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, .08); border: 0; color: #fff; font-size: 15px; cursor: pointer;
}
.help-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.help-tab {
  flex: 1; padding: 8px; border-radius: 9px; border: 1px solid #2f5238; background: #0f2216;
  color: #d3e8d7; font-weight: 700; cursor: pointer;
}
.help-tab.on { background: linear-gradient(180deg, #ffe07a, #f5b62a); color: #2a1d02; border-color: transparent; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help-item {
  display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; border-radius: 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); font-size: 13px;
}
.help-ico { font-size: 22px; line-height: 1; }
.help-item small { color: #a9c4b0; font-size: 11.5px; line-height: 1.35; }
.kb, .tc {
  display: inline-block; width: max-content; padding: 1px 7px; border-radius: 6px; font-size: 11.5px;
  font-weight: 700; background: #1d3b27; border: 1px solid #335c40; color: #e6f3e8;
}
.tc { display: none; background: #3a2f0f; border-color: #6a5420; color: #ffe7a6; }
@media (pointer: coarse) { .kb { display: none; } .tc { display: inline-block; } }
.help-note { font-size: 12.5px; color: #bcd4c1; margin: 10px 0 0; }
.gold { color: var(--gold); }
.help-rules { margin: 0; padding-left: 18px; font-size: 13.5px; color: #dbeadf; text-align: left; }
.help-rules li { margin-bottom: 7px; line-height: 1.4; }
.help-again { display: block; margin: 12px 0 8px; font-size: 12.5px; color: #9fbca6; }
@media (max-width: 420px) {
  .help-grid { grid-template-columns: 1fr; }
  .help-item { display: grid; grid-template-columns: 30px auto 1fr; align-items: center; column-gap: 8px; }
  .help-item .help-ico { grid-row: span 2; font-size: 20px; }
  .help-item small { grid-column: 2 / -1; }
  .help-card h2 { font-size: 19px; }
}
/* at phone width the audio strip spans the card: give the "?" its own row */
@media (max-width: 480px) {
  .card { padding-top: 46px; }
  .card-help { left: 10px; top: 8px; }
}
