/* ============================================================
   GLASS PITCH — holographic soccer for Meta Ray-Ban Display
   Additive display: #000 is transparent. UI surfaces use dark
   gray-green so they read as opaque; accents glow bright.
   ============================================================ */

:root {
  --bg: #000000;                 /* transparent on device */
  --surface: #0c1411;            /* faint dark panel */
  --surface-2: #122019;          /* raised panel */
  --line: #1f3a2e;               /* hairline borders */
  --ink: #eafcf1;                /* primary text */
  --ink-2: #a9c6b6;              /* secondary text */
  --ink-3: #6f8c7e;              /* muted text */
  --grn: #3ef08f;                /* primary accent (pass / go) */
  --cyn: #58d6ff;                /* focus / shoot */
  --gold: #ffd23f;              /* highlight */
  --red: #ff5f6e;                /* danger / tackle */
  --grass-far: #0a2417;
  --grass-near: #0e3220;
  --shadow-glow: 0 0 18px rgba(88, 214, 255, 0.55);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}
/* center the fixed 600x600 app; it is scaled to fit the screen by fitToScreen() (glasses stay 1:1) */
body { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; touch-action: none; }

#app { position: relative; width: 600px; height: 600px; flex: 0 0 auto; transform-origin: center center; }

.screen {
  position: absolute;
  inset: 0;
  width: 600px;
  height: 600px;
  padding: 8px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}
.screen.hidden { display: none; }
.hidden { display: none !important; }

/* ---------- Shared focus / button states ---------- */
.focusable {
  outline: none;
  transition:
    transform 180ms cubic-bezier(0.6, 0, 0.4, 1),
    box-shadow 200ms ease,
    border-color 200ms ease,
    background 200ms ease;
}
.focusable:focus,
.focusable:focus-visible {
  border-color: var(--cyn);
  box-shadow: var(--shadow-glow);
}

/* ============================================================
   TITLE
   ============================================================ */
#title { align-items: center; justify-content: center; }
.title-frame {
  position: relative;
  width: 584px; height: 584px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  overflow: hidden;
}
.title-pitch-bg {
  position: absolute; inset: 0;
  opacity: 0.5;
  pointer-events: none;
}
.title-pitch-bg::before {
  content: ''; position: absolute;
  left: 40px; right: 40px; top: 60px; bottom: 60px;
  border: 2px solid rgba(62, 240, 143, 0.35);
  border-radius: 6px;
  box-shadow: 0 0 24px rgba(62, 240, 143, 0.18) inset;
}
.tp-circle {
  position: absolute; left: 50%; top: 50%;
  width: 150px; height: 150px; margin: -75px 0 0 -75px;
  border: 2px solid rgba(62, 240, 143, 0.30);
  border-radius: 50%;
}
.tp-halfway {
  position: absolute; left: 40px; right: 40px; top: 50%;
  height: 2px; background: rgba(62, 240, 143, 0.30);
}
.tp-box {
  position: absolute; left: 50%; width: 220px; height: 70px;
  margin-left: -110px; border: 2px solid rgba(62, 240, 143, 0.22);
}
.tp-box-top { top: 60px; border-top: none; }
.tp-box-bottom { bottom: 60px; border-bottom: none; }

.title-emblem {
  width: 86px; height: 86px; margin-bottom: 14px;
  position: relative; z-index: 2;
}
.title-ball {
  width: 86px; height: 86px; border-radius: 50%;
  background:
    radial-gradient(circle at 36% 32%, #ffffff 0%, #d6efe2 38%, #5a7d6c 100%);
  box-shadow: 0 0 26px rgba(255,255,255,0.5), 0 8px 18px rgba(0,0,0,0.6);
  position: relative;
}
.title-ball::after {
  content: '';
  position: absolute; left: 50%; top: 50%;
  width: 26px; height: 26px; margin: -13px 0 0 -13px;
  background: #16241d;
  clip-path: polygon(50% 0%, 95% 35%, 78% 90%, 22% 90%, 5% 35%);
}
.title-name {
  position: relative; z-index: 2;
  font-size: 52px; font-weight: 800; letter-spacing: 3px;
  color: var(--ink);
  text-shadow: 0 0 22px rgba(88,214,255,0.55), 0 2px 0 rgba(0,0,0,0.5);
}
.title-divider {
  z-index: 2; width: 180px; height: 2px; margin: 12px 0;
  background: linear-gradient(90deg, transparent, var(--grn), transparent);
}
.title-tagline {
  z-index: 2; color: var(--ink-2); font-size: 15px; margin-bottom: 16px;
}
.title-menu {
  z-index: 2; display: flex; flex-direction: column; gap: 9px; width: 320px;
}
.title-btn {
  height: 49px; border-radius: 13px;
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  color: var(--ink);
  font-size: 18px; font-weight: 700; letter-spacing: 0.5px;
  cursor: pointer;
}
.title-btn:focus { background: #16291f; transform: scale(1.03); }
.title-btn.danger { color: var(--red); }
.title-btn.primary { background: var(--grn); color: #06120b; border-color: var(--grn); box-shadow: 0 0 16px rgba(62,240,143,0.4); }
.title-btn.primary:focus { background: #54f5a4; transform: scale(1.03); box-shadow: 0 0 22px rgba(62,240,143,0.6); }
.title-record { z-index: 2; margin-top: 16px; color: var(--ink-3); font-size: 13px; min-height: 16px; }
.title-hint { z-index: 2; margin-top: 6px; color: var(--ink-3); font-size: 12px; }

/* ============================================================
   HEADER (shared)
   ============================================================ */
.header {
  display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 8px; flex: none;
}
.header h1 { font-size: 24px; font-weight: 800; flex: 1; }
.header-meta { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.back-btn {
  width: 48px; height: 48px; flex: none;
  border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface-2); color: var(--ink);
  font-size: 22px; cursor: pointer;
}
.back-btn:focus { transform: scale(1.05); }

.content { flex: 1; overflow-y: auto; padding: 4px 6px 24px; display: flex; flex-direction: column; gap: 12px; }

/* ============================================================
   TEAM SELECT
   ============================================================ */
.ts-stage {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.ts-arrow {
  width: 52px; height: 120px; flex: none;
  border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); color: var(--grn);
  font-size: 40px; line-height: 1; cursor: pointer;
}
.ts-arrow:focus { transform: scale(1.05); }
.ts-card {
  width: 360px; min-height: 360px;
  background: var(--surface-2);
  border: 1.5px solid var(--line); border-radius: 22px;
  padding: 22px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}
.ts-crest {
  width: 132px; height: 132px; border-radius: 22px;
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; font-weight: 900; letter-spacing: 1px;
  box-shadow: 0 0 26px rgba(0,0,0,0.5), 0 0 30px var(--crest-glow, rgba(62,240,143,0.3));
}
.ts-name { font-size: 26px; font-weight: 800; }
.ts-sub { color: var(--ink-2); font-size: 14px; margin-top: -4px; }
.ts-ratings { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.rt-row { display: flex; align-items: center; gap: 10px; }
.rt-label { width: 38px; font-size: 12px; color: var(--ink-2); font-weight: 700; }
.rt-bar { flex: 1; height: 9px; border-radius: 6px; background: #0a130e; overflow: hidden; }
.rt-fill { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--grn), var(--cyn)); }
.rt-val { width: 24px; text-align: right; font-size: 12px; color: var(--ink); font-weight: 700; }

.ts-dots { display: flex; justify-content: center; gap: 7px; padding: 10px 0 6px; }
.ts-dot { width: 8px; height: 8px; border-radius: 50%; background: #20342a; }
.ts-dot.on { background: var(--grn); box-shadow: 0 0 8px var(--grn); }

.ts-actions { display: flex; flex-direction: column; gap: 10px; padding: 0 30px; }
.ts-confirm, .ts-random {
  height: 56px; border-radius: 14px; cursor: pointer;
  font-size: 19px; font-weight: 800; letter-spacing: 0.5px;
}
.ts-confirm { background: var(--grn); color: #06120b; border: none; }
.ts-confirm:focus { transform: scale(1.03); box-shadow: 0 0 20px rgba(62,240,143,0.6); }
.ts-random { background: var(--surface-2); color: var(--ink); border: 1.5px solid var(--line); }
.ts-random:focus { transform: scale(1.03); }
.ts-hint { text-align: center; color: var(--ink-3); font-size: 12px; padding: 8px 0 4px; }
.ts-diff {
  align-self: center; margin: 2px 0 6px; padding: 8px 20px; border-radius: 999px;
  background: var(--surface-2); border: 1.5px solid var(--line); color: var(--ink);
  font-size: 15px; font-weight: 800; letter-spacing: 0.5px; cursor: pointer;
}
.ts-diff:focus { transform: scale(1.04); border-color: var(--cyn); box-shadow: var(--shadow-glow); }

/* ============================================================
   MATCH — canvas + HUD overlay
   ============================================================ */
#match { padding: 0; }
#pitch { position: absolute; inset: 0; width: 600px; height: 600px; }
#pitch3d { position: absolute; inset: 0; width: 600px; height: 600px; z-index: 1; }
/* rain overlay (weather) — light diagonal streaks over the pitch, under the HUD */
#rain { position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 600ms ease;
  background-image: repeating-linear-gradient(102deg, rgba(190,215,255,0) 0 6px, rgba(190,215,255,0.16) 6px 7px);
  background-size: 100% 26px; }
#match.weather-rain #rain { opacity: 1; animation: rainfall 0.5s linear infinite; }
@keyframes rainfall { from { background-position: 0 0; } to { background-position: -26px 130px; } }
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 2; }

.scoreboard {
  position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 11px;
  background: rgba(8, 16, 12, 0.9);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 4px 12px;   /* no backdrop-filter: re-blurring the live canvas every frame is costly on the glasses GPU */
  box-shadow: 0 4px 18px rgba(0,0,0,0.5);
}
.sb-team { display: flex; align-items: center; gap: 7px; }
.sb-dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.sb-code { font-size: 15px; font-weight: 800; letter-spacing: 1px; color: var(--ink); }
.sb-score { font-size: 22px; font-weight: 900; min-width: 18px; text-align: center; }
.sb-center { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.sb-clock { font-size: 16px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; }
.sb-half { font-size: 9px; color: var(--ink-3); font-weight: 700; letter-spacing: 1px; }

.possession {
  position: absolute; top: 42px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 4px; border-radius: 3px;
  background: var(--away-col, #ff5f6e); overflow: hidden;
  border: 1px solid rgba(0,0,0,0.4);
}
.possession-fill { height: 100%; width: 50%; background: var(--home-col, #3ef08f); transition: width 400ms ease; }
/* momentum tug-of-war bar — centre-anchored fill grows toward the side on top */
.momentum { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); width: 160px; height: 4px; border-radius: 3px; background: rgba(255,255,255,0.10); border: 1px solid rgba(0,0,0,0.4); }
.momentum::before { content: ''; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255,255,255,0.45); }
.mom-fill { position: absolute; top: 0; bottom: 0; left: 80px; width: 0; border-radius: 3px; transition: left 280ms ease, width 280ms ease, background 500ms ease; }

.match-banner {
  position: absolute; top: 40%; left: 0; right: 0;
  text-align: center; font-size: 64px; font-weight: 900; letter-spacing: 4px;
  color: var(--ink); opacity: 0; transform: scale(0.6);
  text-shadow: 0 0 30px var(--cyn), 0 4px 12px rgba(0,0,0,0.7);
}
.match-banner.show { animation: bannerPop 1.6s cubic-bezier(0.2,0.8,0.3,1) forwards; }
@keyframes bannerPop {
  0% { opacity: 0; transform: scale(0.4); }
  18% { opacity: 1; transform: scale(1.06); }
  70% { opacity: 1; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(1.05); }
}

.action-row {
  position: absolute; bottom: 7px; left: 0; right: 0;
  display: flex; justify-content: center;
}
/* 3D Behind-the-net: lift the action chip + dash pip into the band just below the
   scoreboard so the camera can drop lower and zoom into the field. */
#match.cam-behind .action-row { bottom: auto; top: 56px; }
#match.cam-behind .dash-pip { bottom: auto; top: 54px; }
/* push the transient pills clear of the lifted chip so they don't stack into a blob */
#match.cam-behind .match-ticker { top: 96px; }
#match.cam-behind .match-toast { top: 100px; }
#match.cam-behind .tutorial-prompt { top: 106px; }
#match.cam-behind .replay-tag { top: 78px; }
.action-chip {
  display: flex; align-items: center; gap: 9px;
  background: rgba(8, 16, 12, 0.85);
  border: 2px solid var(--grn); border-radius: 999px;
  padding: 6px 18px;
  box-shadow: 0 0 18px rgba(62,240,143,0.35);
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 120ms ease;
}
.action-chip.pulse { transform: scale(1.08); }
.action-ic { font-size: 18px; line-height: 1; color: var(--grn); }
.action-tx { font-size: 17px; font-weight: 900; letter-spacing: 2px; color: var(--ink); }
.action-chip.shoot { border-color: var(--cyn); box-shadow: 0 0 20px rgba(88,214,255,0.5); }
.action-chip.shoot .action-ic { color: var(--cyn); }
.action-chip.tackle { border-color: var(--red); box-shadow: 0 0 18px rgba(255,95,110,0.45); }
.action-chip.tackle .action-ic { color: var(--red); }
.action-chip.switch { border-color: var(--gold); box-shadow: 0 0 18px rgba(255,210,63,0.4); }
.action-chip.switch .action-ic { color: var(--gold); }

.match-toast {
  position: absolute; top: 78px; left: 50%; transform: translateX(-50%);
  background: rgba(8,16,12,0.9); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 14px;
  font-size: 14px; font-weight: 700; color: var(--ink);
  opacity: 0; transition: opacity 250ms ease;
}
.match-toast.show { opacity: 1; }

/* live other-scores ticker */
.match-ticker {
  position: absolute; top: 74px; left: 50%; transform: translateX(-50%);
  background: rgba(8,16,12,0.9); border: 1px solid var(--gold); border-radius: 10px;
  padding: 5px 14px; font-size: 13px; font-weight: 800; color: var(--gold);
  letter-spacing: 0.3px; opacity: 0; transition: opacity 250ms ease; white-space: nowrap;
}
.match-ticker.show { opacity: 1; }

/* lineups / vs intro */
.lu-sheets { flex: 1; display: flex; align-items: stretch; gap: 8px; padding: 4px 6px; overflow: hidden; }
.lu-sheets > div { flex: 1; min-width: 0; }
.lu-vs { flex: 0 0 auto !important; align-self: center; font-size: 20px; font-weight: 900; color: var(--ink-3); letter-spacing: 1px; }
.lu-col { display: flex; flex-direction: column; height: 100%; }
.lu-crest { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 900; margin: 0 auto 4px; }
.lu-tname { text-align: center; font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.lu-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.lu-row { display: flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 6px; padding: 4px 7px; font-size: 12px; }
.lu-num { width: 20px; text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; }
.lu-pname { flex: 1; min-width: 0; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lu-ovr { color: var(--gold); font-weight: 900; font-size: 11px; font-variant-numeric: tabular-nums; min-width: 18px; text-align: right; }
.lu-pos { color: var(--ink-3); font-size: 10px; font-weight: 800; }
.result-motm { font-size: 14px; font-weight: 700; color: var(--gold); text-align: center; margin-top: -4px; }

/* substitutions screen */
#subs-auto-row { margin: 0 8px 6px; }
.subs-auto-hint { color: var(--ink-3); font-weight: 600; font-size: 12px; }
.subs-title { padding: 4px 12px; color: var(--ink-2); font-size: 14px; font-weight: 700; }
.subs-list { gap: 8px; padding-top: 2px; }
.sub-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 11px 14px; cursor: pointer; text-align: left; width: 100%;
}
.sub-row.static { cursor: default; opacity: 0.85; }
.sub-row:focus { transform: scale(1.02); border-color: var(--cyn); box-shadow: var(--shadow-glow); }
.sub-row.sub-cancel { justify-content: center; color: var(--ink-2); background: var(--surface); }
.sub-num { font-size: 16px; font-weight: 900; width: 38px; color: var(--ink); }
.sub-role { font-size: 12px; font-weight: 700; color: var(--ink-3); width: 40px; letter-spacing: 0.5px; }
.fit-bar { flex: 1; height: 10px; border-radius: 6px; background: #0a130e; overflow: hidden; }
.fit-fill { display: block; height: 100%; border-radius: 6px; }
.fit-pct { width: 30px; text-align: right; font-size: 12px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sub-card { font-size: 14px; }

/* spectator badge */
.watch-badge {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: rgba(8,16,12,0.86); border: 1.5px solid var(--cyn); border-radius: 999px;
  padding: 6px 16px; font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--ink);
  box-shadow: 0 0 16px rgba(88,214,255,0.4);
}
.watch-badge .wb-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cyn); box-shadow: 0 0 8px var(--cyn); animation: wbpulse 1.4s ease-in-out infinite; }
@keyframes wbpulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* guided tutorial prompt */
.tutorial-prompt {
  position: absolute; top: 84px; left: 50%; transform: translateX(-50%);
  width: 430px; max-width: 92%; text-align: center;
  background: rgba(8, 16, 12, 0.9); border: 1.5px solid var(--cyn);
  border-radius: 16px; padding: 14px 18px;
  font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.45;
  box-shadow: 0 0 22px rgba(88,214,255,0.35);
}
.tutorial-prompt .tut-step { display: block; font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--cyn); margin-bottom: 6px; }
.tutorial-prompt .tut-skip { display: block; font-size: 11px; color: var(--ink-3); margin-top: 8px; font-weight: 600; }

.tut-cta {
  height: 60px; border-radius: 14px; cursor: pointer;
  background: var(--grn); color: #06120b; border: none;
  font-size: 18px; font-weight: 800; letter-spacing: 0.5px;
}
.tut-cta:focus { transform: scale(1.02); box-shadow: 0 0 20px rgba(62,240,143,0.55); }

/* live commentary line */
.commentary {
  position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%);
  max-width: 460px; text-align: center;
  font-size: 15px; font-weight: 600; font-style: italic; color: var(--ink-2);
  text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  opacity: 0; transition: opacity 200ms ease;
}
.commentary.show { opacity: 1; }

/* sprint stamina pip — a gold radial meter (conic-gradient set in JS) that empties
   as you sprint and refills when you don't. ⚡ stays readable on gold or dark. */
.dash-pip {
  position: absolute; right: 16px; bottom: 12px;
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #0b1410; text-shadow: 0 0 3px rgba(255,255,255,0.55);
  background: var(--gold);          /* overridden each frame by an inline conic-gradient fill */
  border: 2px solid rgba(255,210,63,0.55);
  box-shadow: 0 0 10px rgba(255,210,63,0.4);
  transition: box-shadow 150ms ease, transform 120ms ease, border-color 150ms ease, opacity 150ms ease;
}
/* actively surging — bright, enlarged, gently pulsing */
.dash-pip.sprinting { border-color: var(--gold); box-shadow: 0 0 22px rgba(255,210,63,0.95); transform: scale(1.14); animation: pipPulse 600ms ease-in-out infinite; }
@keyframes pipPulse { 50% { box-shadow: 0 0 30px rgba(255,210,63,1); } }
/* nearly empty — dim hint that you need to ease off to recharge */
.dash-pip.low { opacity: 0.5; filter: grayscale(0.4); }
/* refilled to full — a quick confirming pulse */
.dash-pip.ready { animation: pipReady 500ms ease-out; }
@keyframes pipReady {
  0%   { transform: scale(1);    box-shadow: 0 0 10px rgba(255,210,63,0.4); }
  45%  { transform: scale(1.26); box-shadow: 0 0 26px rgba(255,210,63,0.95); }
  100% { transform: scale(1);    box-shadow: 0 0 10px rgba(255,210,63,0.4); }
}

/* goal impact punch on the pitch (both the 2D and 3D canvases) */
#pitch, #pitch3d { transform-origin: 50% 42%; }
#pitch.punch, #pitch3d.punch { animation: pitchPunch 0.55s cubic-bezier(0.2,0.8,0.3,1); }
@keyframes pitchPunch {
  0% { transform: scale(1); }
  22% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ============================================================
   OVERLAYS — pause / halftime / result
   ============================================================ */
#pause, #halftime, #result { align-items: center; justify-content: center; }
.overlay-frame {
  width: 460px; padding: 30px 28px;
  background: rgba(10, 18, 14, 0.92);
  border: 1.5px solid var(--line); border-radius: 22px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.6);
}
.overlay-title {
  font-size: 36px; font-weight: 900; letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(88,214,255,0.5);
}
.overlay-sub { font-size: 18px; color: var(--ink-2); font-weight: 700; }
.result-score { font-size: 34px; color: var(--ink); font-weight: 900; }
.overlay-menu { display: flex; flex-direction: column; gap: 11px; width: 300px; margin-top: 8px; }

/* in-match coach / tactics panel + compact pause layout so it all fits 600px */
#pause .overlay-frame { padding: 22px 24px; gap: 10px; }
#pause .overlay-menu { gap: 9px; margin-top: 2px; }
.tactics-panel {
  width: 320px; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.tactics-head { font-size: 12px; font-weight: 800; letter-spacing: 1px; color: var(--cyn); text-transform: uppercase; }
.tactics-panel .opt-row { height: 46px; }
.tactics-panel .opt-value { color: var(--cyn); }

.stat-grid {
  width: 100%; display: flex; flex-direction: column; gap: 7px;
  background: var(--surface); border-radius: 14px; padding: 14px 16px;
}
.stat-line { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.stat-name { width: 120px; text-align: center; color: var(--ink-3); font-size: 12px; font-weight: 700; letter-spacing: 0.5px; }
.stat-bar { flex: 1; height: 10px; border-radius: 5px; overflow: hidden; display: flex; background: #0a130e; }
.stat-h { background: var(--home-col, var(--grn)); }
.stat-a { background: var(--away-col, var(--red)); }
.stat-num { width: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-num.h { text-align: right; }
.stat-num.a { text-align: left; }

/* goal replay bar (in-match) — full-width strip so it's unmistakable */
.replay-tag {
  position: absolute; top: 60px; left: 0; right: 0;
  text-align: center; padding: 6px 0; font-size: 16px; font-weight: 900; letter-spacing: 3px;
  color: #0a130e; background: linear-gradient(90deg, transparent 2%, var(--gold) 15%, var(--gold) 85%, transparent 98%);
  box-shadow: 0 0 20px rgba(255,210,63,0.5), inset 0 0 12px rgba(255,255,255,0.15);
  opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 10;
}
.replay-tag.show { opacity: 1; animation: replay-pulse 1.2s ease-in-out infinite; }
@keyframes replay-pulse {
  0%   { box-shadow: 0 0 20px rgba(255,210,63,0.5), inset 0 0 12px rgba(255,255,255,0.15); }
  50%  { box-shadow: 0 0 36px rgba(255,210,63,0.95), inset 0 0 18px rgba(255,255,255,0.3); }
  100% { box-shadow: 0 0 20px rgba(255,210,63,0.5), inset 0 0 12px rgba(255,255,255,0.15); }
}
/* dim the pitch slightly during replays to visually differentiate */
.replay-vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.35) 100%);
  opacity: 0; transition: opacity 0.4s;
}
.replay-vignette.show { opacity: 1; }

/* post-match shot map */
.result-shotmap { width: 100%; margin-top: 10px; }
.shotmap-title { font-size: 12px; font-weight: 800; color: var(--ink-3); letter-spacing: 0.5px; display: flex; align-items: center; gap: 12px; padding: 2px 2px 6px; }
.sm-leg { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); font-weight: 700; }
.shotmap {
  position: relative; width: 100%; aspect-ratio: 88 / 70; background: var(--surface);
  border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden;
}
.sm-goalline { position: absolute; top: 0; left: 28%; width: 44%; height: 3px; background: var(--ink-2); border-radius: 0 0 3px 3px; }
.sm-dot { position: absolute; width: 9px; height: 9px; border-radius: 50%; transform: translate(-50%, -50%); }
.sm-dot.sm-h { background: var(--cyn); }
.sm-dot.sm-a { background: var(--orange, #ff7a45); }
.sm-dot.sm-on { box-shadow: 0 0 0 2px rgba(255,255,255,0.55); }
.sm-dot.sm-goal { width: 13px; height: 13px; background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* ============================================================
   HOW TO PLAY / SETTINGS
   ============================================================ */
.how-body { gap: 12px; }
.how-card {
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 14px 16px;
}
.how-card h2 { font-size: 17px; color: var(--grn); margin-bottom: 8px; }
.how-row { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--ink); line-height: 1.4; }
.how-list { margin: 8px 0 0 4px; padding-left: 18px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.how-card p { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.kbd {
  flex: none; min-width: 64px; text-align: center;
  background: #0a130e; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 8px; font-size: 14px; font-weight: 800; color: var(--cyn);
}
.c-grn { color: var(--grn); } .c-cyn { color: var(--cyn); } .c-red { color: var(--red); } .c-gold { color: var(--gold); }

.opt-row {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 18px;
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: 14px; cursor: pointer; color: var(--ink);
}
.opt-row:focus { transform: scale(1.02); }
.opt-label { font-size: 17px; font-weight: 700; color: var(--ink); }
.opt-value { font-size: 17px; font-weight: 800; color: var(--grn); }
.opt-row.danger .opt-value { color: var(--red); }

/* ============================================================
   CUP / BRACKET
   ============================================================ */
.cup-bracket { display: flex; gap: 6px; align-items: stretch; padding: 4px 0; }
.cup-col { display: flex; flex-direction: column; justify-content: space-around; gap: 8px; flex: 1; }
.cup-col-title { font-size: 10px; color: var(--ink-3); text-align: center; letter-spacing: 1px; font-weight: 800; }
.cup-match { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 9px; overflow: hidden; }
.cup-match.you { border-color: var(--cyn); box-shadow: 0 0 10px rgba(88,214,255,0.4); }
.cup-match.next { border-color: var(--grn); }
.cup-team { display: flex; align-items: center; justify-content: space-between; padding: 5px 7px; font-size: 12px; font-weight: 800; gap: 6px; }
.cup-team + .cup-team { border-top: 1px solid var(--line); }
.ct-id { display: flex; align-items: center; gap: 5px; }
.ct-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 5px currentColor; }
.cup-team.lose { color: var(--ink-3); opacity: 0.55; }
.cup-team.you-row .ct-code { color: var(--cyn); }
.cup-champion { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.cup-champion .trophy { font-size: 34px; }
.cup-champion .champ-code { font-size: 16px; font-weight: 900; }
.cup-status { text-align: center; color: var(--ink-2); font-size: 15px; font-weight: 600; margin-top: 12px; min-height: 18px; }
.cup-actions { display: flex; flex-direction: column; gap: 10px; padding: 8px 30px; }

/* tournaments hub */
.tourn-list { gap: 16px; padding-top: 10px; }
.tourn-card {
  display: flex; align-items: center; gap: 16px; text-align: left;
  background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: 16px; padding: 18px; cursor: pointer;
}
.tourn-card:focus { transform: scale(1.02); }
.tourn-ic { font-size: 40px; flex: none; }
.tourn-name { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.tourn-desc { font-size: 14px; color: var(--ink-2); line-height: 1.4; }

/* league table */
.league-table { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border-radius: 12px; padding: 8px 6px; }
.lg-row {
  display: grid; grid-template-columns: 24px 1fr 22px 22px 22px 22px 36px 34px;
  align-items: center; gap: 3px; padding: 6px 8px; font-size: 13px; font-weight: 700;
  border-radius: 7px; font-variant-numeric: tabular-nums;
}
.lg-row span { text-align: center; }
.lg-head { color: var(--ink-3); font-size: 11px; letter-spacing: 0.5px; font-weight: 800; }
.lg-pos { color: var(--ink-3); }
.lg-team { text-align: left !important; display: flex; align-items: center; gap: 6px; }
.lg-pts { color: var(--gold); font-weight: 900; }
.lg-row.you-row { background: rgba(88,214,255,0.14); }
.lg-row.you-row .lg-team { color: var(--cyn); }
.lg-champ { background: rgba(255,210,63,0.16); }

/* career */
.career-tabs { display: flex; gap: 8px; padding: 2px 8px 8px; flex: none; }
.cr-tab { flex: 1; height: 38px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 14px; font-weight: 700; cursor: pointer; }
.cr-tab.on { background: var(--surface-2); color: var(--ink); border-color: var(--cyn); box-shadow: 0 0 10px rgba(88,214,255,0.25); }
.cr-tab:focus { transform: scale(1.03); }
.cr-boot-head, .cr-hist-head { font-size: 13px; font-weight: 800; color: var(--gold); letter-spacing: 0.5px; padding: 8px 6px 4px; }
.cr-boot-row { display: grid; grid-template-columns: 26px 1fr auto 30px; align-items: center; gap: 8px; padding: 7px 8px; font-size: 14px; font-weight: 700; border-radius: 7px; }
.cr-boot-row.you-row { background: rgba(88,214,255,0.14); }
.cr-rank { color: var(--ink-3); text-align: center; }
.cr-name { color: var(--ink); }
.cr-club { display: flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: 12px; }
.cr-goals { color: var(--gold); font-weight: 900; text-align: right; }
.cr-empty { color: var(--ink-3); text-align: center; padding: 24px 12px; font-size: 14px; }
.cr-cabinet { display: flex; align-items: center; gap: 14px; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 6px; }
.cr-trophy { font-size: 36px; }
.cr-trophy-n { font-size: 18px; font-weight: 800; }
.cr-trophy-sub { font-size: 13px; color: var(--ink-2); }
.cr-hist-row { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 8px; padding: 6px 8px; font-size: 13px; font-weight: 700; border-radius: 6px; }
.cr-hist-s { color: var(--ink-3); }
.cr-hist-pos.won { color: var(--gold); }
.cr-hist-pts { color: var(--ink-2); font-size: 12px; }
.cr-hist-champ { display: flex; align-items: center; gap: 5px; color: var(--ink-2); font-size: 12px; }

/* season bar: board objective + recent form */
.season-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 10px 8px; flex: none; }
.season-obj { font-size: 13px; font-weight: 700; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.season-form { display: flex; gap: 4px; flex: none; }
.form-chip { display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px; border-radius: 5px; font-size: 11px; font-weight: 900; color: #06120c; }
.form-chip.form-W { background: var(--grn); }
.form-chip.form-D { background: var(--gold); }
.form-chip.form-L { background: var(--red); color: #fff; }
.form-chip.form-none { background: transparent; color: var(--ink-3); width: auto; }

/* season fixtures / schedule */
.fx-list { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border-radius: 12px; padding: 6px; }
.fx-row { display: grid; grid-template-columns: 40px 22px 1fr 52px; align-items: center; gap: 8px; padding: 6px 8px; font-size: 13px; font-weight: 700; border-radius: 7px; font-variant-numeric: tabular-nums; }
.fx-row.fx-next { background: rgba(88,214,255,0.14); box-shadow: inset 0 0 0 1px rgba(88,214,255,0.4); }
.fx-md { color: var(--ink-3); font-size: 11px; font-weight: 800; }
.fx-ha { color: var(--ink-2); text-align: center; }
.fx-opp { display: flex; align-items: center; gap: 6px; color: var(--ink); overflow: hidden; }
.fx-res { text-align: right; font-weight: 900; }
.fx-res.fx-up { color: var(--ink-3); }
.fx-res.form-W { color: var(--grn); }
.fx-res.form-D { color: var(--gold); }
.fx-res.form-L { color: var(--red); }
.lg-scorers { margin-top: 8px; background: var(--surface); border-radius: 12px; padding: 4px 6px 8px; }
.cr-invest { padding: 4px 8px 8px; color: var(--cyn); font-weight: 800; letter-spacing: 0.5px; }

/* world cup groups */
.wc-group-head { font-size: 13px; font-weight: 800; color: var(--gold); letter-spacing: 0.5px; padding: 10px 6px 4px; }
.wc-group { margin-bottom: 4px; }
.lg-row.wc-qual { box-shadow: inset 3px 0 0 var(--grn); }   /* top two of the group qualify */

/* tighten tabs when the bar holds 5 (career) */
.career-tabs .cr-tab { font-size: 13px; padding: 0 2px; }

/* career: end-of-season review */
.cn-content { gap: 0; }
.cn-verdict { background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; text-align: center; margin-bottom: 10px; }
.cn-finish { font-size: 20px; font-weight: 800; }
.cn-finish b { color: var(--gold); }
.cn-obj { font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.cn-met { color: var(--grn); font-weight: 800; }
.cn-miss { color: var(--red); font-weight: 800; }
.cn-head { font-size: 13px; font-weight: 800; color: var(--gold); letter-spacing: 0.5px; padding: 6px 4px 6px; }
.cn-awards { background: var(--surface); border-radius: 12px; padding: 4px 6px; }
.cn-award { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 8px; font-size: 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.cn-award:last-child { border-bottom: none; }
.cn-award > span:last-child { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.cn-offer { margin-top: 12px; padding: 12px 14px; background: rgba(88,214,255,0.10); border: 1.5px solid rgba(88,214,255,0.4); border-radius: 12px; font-size: 15px; line-height: 1.4; text-align: center; }

/* career: transfer window */
.ct-hint { color: var(--ink-2); font-size: 13px; line-height: 1.4; padding: 2px 4px 12px; }
.ct-ratings { display: flex; flex-direction: column; gap: 8px; }
.ct-row { display: grid; grid-template-columns: 40px 1fr 64px 44px; align-items: center; gap: 10px; background: var(--surface); border-radius: 10px; padding: 8px 12px; }
.ct-stat { font-weight: 800; color: var(--ink-2); font-size: 13px; }
.ct-val { text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }
.ct-boost { color: var(--grn); font-size: 12px; }
.ct-buy { width: 40px; height: 34px; border-radius: 9px; border: 1.5px solid var(--cyn); background: rgba(88,214,255,0.14); color: var(--cyn); font-size: 20px; font-weight: 900; cursor: pointer; }
.ct-buy:focus { transform: scale(1.06); }
.ct-buy:disabled { opacity: 0.3; border-color: var(--line); color: var(--ink-3); background: transparent; cursor: default; }

/* shootout */
#shootout, #setpiece { padding: 0; }
#pen-canvas, #sp-canvas { position: absolute; inset: 0; width: 600px; height: 600px; }
.pen-top {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(8,16,12,0.85); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 20px; font-size: 18px; font-weight: 800; letter-spacing: 1px;
}

/* ============================================================
   TOUCH CONTROLS (fallback / preview)
   ============================================================ */
/* fixed control bar pinned to the BOTTOM of the viewport (below the pitch on phones) */
.touch-controls { position: fixed; left: 0; right: 0; bottom: 0; height: 172px; pointer-events: none; z-index: 60; }
.touch-dpad {
  position: absolute; left: 20px; bottom: max(16px, env(safe-area-inset-bottom));
  width: 174px; height: 174px;
}
.touch-btn {
  position: absolute; pointer-events: auto;
  background: rgba(10, 22, 17, 0.82); border: 2px solid rgba(62,240,143,0.6);
  color: var(--ink); border-radius: 14px; font-size: 26px;
  width: 58px; height: 58px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent; touch-action: none;
}
.touch-btn:active { background: rgba(62,240,143,0.45); transform: scale(0.94); }
.touch-up    { left: 58px; top: 0; }
.touch-left  { left: 0; top: 58px; }
.touch-right { left: 116px; top: 58px; }
.touch-down  { left: 58px; top: 116px; }
.touch-pinch {
  position: absolute; right: 26px; left: auto; top: auto;
  bottom: max(40px, calc(env(safe-area-inset-bottom) + 24px));
  width: 96px; height: 96px; border-radius: 50%;
  font-size: 36px; color: var(--cyn); border-color: rgba(88,214,255,0.75);
  background: rgba(8, 22, 28, 0.85);
}
.touch-pinch:active { background: rgba(88,214,255,0.4); transform: scale(0.94); }
/* "Touch Outlines: OFF" — strip the boxes/borders for a clean screen; the controls stay
   tappable, just shown as faint glyphs with a soft press flash. */
body.touch-bare .touch-btn { background: transparent; border-color: transparent; box-shadow: none; color: rgba(234,252,241,0.28); }
body.touch-bare .touch-pinch { color: rgba(88,214,255,0.34); }
body.touch-bare .touch-btn:active { background: rgba(255,255,255,0.10); transform: scale(0.94); }
/* phone: top-align the pitch so the bottom control bar sits below it (not over the play area).
   The padding clears the status bar; #app scales from its TOP edge (set in fitToScreen) so the
   scoreboard always sits just below the status bar instead of being pushed up under it. */
body.is-phone { align-items: flex-start; padding-top: max(34px, env(safe-area-inset-top)); }
