:root {
  --bg: #0a0a0c;
  --bg-2: #111114;
  --panel: rgba(255, 255, 255, 0.04);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #ececec;
  --text-dim: #9a9aa2;
  --text-faint: #6a6a72;
  --accent-1: #fe7b02;
  --accent-2: #fe3f21;
  --accent-3: #f858bc;
  --accent-4: #575ecf;
  --gradient: linear-gradient(135deg, var(--accent-1) 0%, var(--accent-2) 28%, var(--accent-3) 62%, var(--accent-4) 100%);
  --win: #22c55e;
  --lose: #ef4444;
  --tie: #eab308;
  --radius: 14px;
  --radius-lg: 20px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  color: var(--text);
  background: radial-gradient(ellipse at 20% -10%, rgba(254, 63, 33, 0.18), transparent 55%),
    radial-gradient(ellipse at 90% 110%, rgba(87, 94, 207, 0.22), transparent 55%), var(--bg);
  min-height: 100vh; min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Screen plumbing */
.screen { display: none; min-height: 100vh; min-height: 100dvh; flex-direction: column; }
.screen[data-active="true"] { display: flex; }

/* Topbar */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 20px 28px; gap: 16px; }
.logo { display: flex; align-items: baseline; gap: 6px; }
.logo-num { font-size: 1.8rem; font-weight: 900; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.logo-word { font-size: 0.7rem; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; color: var(--text-dim); }
.logo.small .logo-num { font-size: 1.3rem; }
.topnav a { color: var(--text-dim); text-decoration: none; font-size: 0.9rem; font-weight: 500; }

/* Hero */
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 28px; gap: 16px; }
.eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--accent-2); }
.headline { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; line-height: 1.15; max-width: 500px; }
.gradient-text { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.sub { color: var(--text-dim); max-width: 380px; font-size: 0.95rem; line-height: 1.55; }

/* Card page */
.card-page { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 28px; gap: 16px; max-width: 480px; margin: 0 auto; }
.card-page h2 { font-size: 1.4rem; font-weight: 700; }
.muted { color: var(--text-dim); font-size: 0.9rem; line-height: 1.55; }
.tiny { color: var(--text-faint); font-size: 0.8rem; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer; font-family: inherit; font-weight: 600; border-radius: var(--radius); transition: transform 0.12s, opacity 0.2s; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary { background: var(--gradient); color: #fff; padding: 14px 32px; font-size: 1rem; }
.btn-ghost { background: var(--panel); color: var(--text); padding: 12px 24px; font-size: 0.9rem; border: 1px solid var(--panel-border); }
.btn-xl { padding: 18px 48px; font-size: 1.1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; }
.btn-icon { background: rgba(255,255,255,0.08); color: var(--text); width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--panel-border); }
.btn-icon.muted-on { background: var(--lose); color: #fff; border-color: var(--lose); }
.btn-back { background: none; border: none; color: var(--text-dim); font-size: 1.4rem; cursor: pointer; padding: 4px 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Status box */
.status-box { display: flex; align-items: center; gap: 10px; padding: 14px 20px; background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); width: 100%; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.status-box[data-state="ok"] .status-dot { background: var(--win); }
.status-box[data-state="err"] .status-dot { background: var(--lose); }
.status-text { font-size: 0.88rem; color: var(--text-dim); }

/* Matchmaking */
.match-page { gap: 24px; }
.match-spinner {
  width: 56px; height: 56px; border-radius: 50%;
  border: 4px solid var(--panel-border);
  border-top-color: var(--accent-2);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* BATTLE STAGE */
.screen-battle { position: relative; }

.battle-stage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 0; min-height: 0; padding: 8px 0;
}

.battle-player {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  position: relative; min-width: 0;
}

.player-label {
  position: absolute; top: 8px; z-index: 5;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  background: rgba(0,0,0,0.6); padding: 3px 12px; border-radius: 20px;
  color: var(--text-dim);
}

.player-video-wrap {
  width: 100%; aspect-ratio: 1; position: relative; overflow: hidden;
  background: #000; border-radius: 8px;
}

.player-video-wrap video {
  width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1);
}

.player-video-wrap canvas {
  position: absolute; inset: 0; pointer-events: none;
  transform: scaleX(-1);
}

.player-score {
  font-size: 2.4rem; font-weight: 900; font-family: var(--mono);
  padding: 8px 0;
  width: 100%; text-align: center;
}
.battle-you .player-score { color: var(--accent-1); }
.battle-opp .player-score { color: var(--accent-3); }

.battle-vs {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 60px; flex-shrink: 0; gap: 6px;
  z-index: 2;
}

.vs-timer {
  font-size: 1.6rem; font-weight: 800; font-family: var(--mono);
  color: var(--text);
}
.vs-timer[data-warn="true"] { color: var(--lose); }

.vs-label {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 3px;
  color: var(--text-faint);
}

/* Battle HUD bottom */
.battle-hud-bottom {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px 20px;
  background: var(--bg);
  border-top: 1px solid var(--panel-border);
}

.arm-indicator { display: flex; gap: 8px; }
.arm {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--panel-border);
  font-size: 0.8rem; font-family: var(--mono);
}
.arm-label { color: var(--text-faint); font-weight: 600; }
.arm-state { font-weight: 700; }
.arm[data-state="UP"] .arm-state { color: var(--accent-1); }
.arm[data-state="DOWN"] .arm-state { color: var(--accent-3); }

/* Countdown overlay */
.countdown {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: rgba(10, 10, 12, 0.75);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.countdown[hidden] { display: none !important; }
.countdown-label { font-size: 0.9rem; letter-spacing: 3px; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; }
.countdown-num { font-size: 5rem; font-weight: 900; background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
@keyframes popin { 0% { transform: scale(0.5); opacity: 0; } 50% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* Coach toast */
.coach {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: rgba(254, 63, 33, 0.9); color: #fff;
  padding: 10px 24px; border-radius: 12px;
  font-size: 0.85rem; font-weight: 600; z-index: 50;
  white-space: nowrap; max-width: 90vw; text-overflow: ellipsis; overflow: hidden;
}

/* RESULT */
.result { max-width: 500px; }
.result .eyebrow { font-size: 1rem; }

.result-scores {
  display: flex; align-items: center; gap: 20px;
  margin: 12px 0;
}
.result-side { text-align: center; }
.result-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.result-num { font-size: 3rem; font-weight: 900; font-family: var(--mono); }
.result-you .result-num { color: var(--accent-1); }
.result-opp .result-num { color: var(--accent-3); }
.result-vs { font-size: 1.2rem; font-weight: 700; color: var(--text-faint); }

.result[data-outcome="win"] .eyebrow { color: var(--win); }
.result[data-outcome="lose"] .eyebrow { color: var(--lose); }
.result[data-outcome="tie"] .eyebrow { color: var(--tie); }

.verdict { color: var(--text-dim); font-size: 0.95rem; font-style: italic; }

.stat-grid { display: flex; gap: 32px; margin: 8px 0; }
.stat-label { display: block; font-size: 0.7rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--text-faint); }
.stat-value { font-size: 1.3rem; font-weight: 800; font-family: var(--mono); }

/* Premium / Gender Modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 10, 12, 0.82);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 16px;
}
.modal-overlay[hidden] { display: none !important; }

.modal-card {
  background: var(--bg-2); border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg); padding: 36px 32px; width: 100%; max-width: 420px;
  position: relative; text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  max-height: 90vh; overflow-y: auto;
}

.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--text-faint); font-size: 1.5rem;
  cursor: pointer; width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.modal-step[hidden] { display: none !important; }
.modal-step { display: flex; flex-direction: column; align-items: center; gap: 14px; }

.modal-icon { font-size: 2.4rem; margin-bottom: 4px; }
.modal-step h2 { font-size: 1.3rem; font-weight: 700; }

.premium-perks { display: flex; flex-direction: column; gap: 8px; width: 100%; margin: 4px 0; }
.perk {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--panel-border);
  font-size: 0.88rem; color: var(--text-dim); text-align: left;
}
.perk-icon { font-size: 1.1rem; flex-shrink: 0; }

.modal-input {
  width: 100%; padding: 14px 16px; border-radius: var(--radius);
  border: 1px solid var(--panel-border); background: rgba(255,255,255,0.04);
  color: var(--text); font-family: inherit; font-size: 0.95rem;
  outline: none; transition: border-color 0.2s;
}
.modal-input:focus { border-color: var(--accent-2); }
.modal-input::placeholder { color: var(--text-faint); }

.modal-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 4px; }
.modal-actions .btn { width: 100%; }

.modal-buy-link {
  display: inline-block; margin-top: 4px;
  color: var(--accent-1); font-size: 0.85rem; text-decoration: none;
  transition: color 0.2s;
}
.modal-buy-link:hover { color: var(--accent-3); }
.modal-buy-link strong { font-weight: 700; }

.modal-error {
  width: 100%; padding: 10px 14px; border-radius: 8px;
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171; font-size: 0.85rem;
}
.modal-error[hidden] { display: none; }

/* Gender selection */
.gender-section { width: 100%; }
.gender-label {
  display: block; text-align: left; font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px; color: var(--text-faint);
  margin-bottom: 8px;
}
.gender-row { display: flex; gap: 10px; width: 100%; }
.gender-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px; border-radius: var(--radius); cursor: pointer;
  background: var(--panel); border: 2px solid var(--panel-border);
  color: var(--text-dim); font-family: inherit; font-size: 0.88rem; font-weight: 600;
  transition: all 0.2s;
}
.gender-btn:hover { border-color: rgba(255,255,255,0.15); color: var(--text); }
.gender-btn.selected {
  border-color: var(--accent-2); color: var(--text);
  background: rgba(254, 63, 33, 0.1);
  box-shadow: 0 0 20px rgba(254, 63, 33, 0.15);
}
.gender-icon { font-size: 1.6rem; }

.premium-welcome { color: var(--win); font-weight: 600; }

.modal-spinner {
  display: inline-block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  animation: spin 0.6s linear infinite; vertical-align: middle; margin-right: 6px;
}

/* Embed mode */
html[data-embed="1"] .topbar,
html[data-embed="1"] .hero,
html[data-embed="1"] #screen-home { display: none !important; }

/* Responsive */
@media (max-width: 600px) {
  .battle-stage { padding: 4px 0; }
  .battle-vs { width: 36px; }
  .vs-timer { font-size: 1.1rem; }
  .vs-label { font-size: 0.55rem; letter-spacing: 2px; }
  .player-score { font-size: 1.8rem; padding: 4px 0; }
  .player-label { font-size: 0.55rem; top: 6px; padding: 2px 8px; }
  .player-video-wrap { border-radius: 6px; }
  .result-num { font-size: 2.4rem; }
  .battle-hud-bottom { padding: 6px 12px; gap: 10px; }
}

@media (max-height: 600px) {
  .player-score { font-size: 1.4rem; padding: 3px 0; }
  .battle-hud-bottom { padding: 4px 10px; gap: 8px; }
  .battle-vs { width: 32px; gap: 3px; }
  .vs-timer { font-size: 1rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .player-video-wrap { aspect-ratio: 4/3; }
  .battle-vs { width: 50px; }
  .player-score { font-size: 1.4rem; padding: 3px 0; }
  .battle-hud-bottom { padding: 4px 16px; }
}

/* ==========================================================================
   Retro Sports Brand Overrides — Battle
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@400;500;600;700&display=swap');

:root {
  --accent-1: #c0392b;
  --accent-2: #c0392b;
  --accent-3: #e8a87c;
  --accent-4: #c0392b;
  --gradient: #c0392b;
  --radius: 0px;
  --radius-lg: 0px;
  --bg: #0f0d0b;
  --bg-2: #161311;
  --panel: rgba(255,255,255,0.05);
  --panel-border: rgba(255,255,255,0.1);
}

body { background: var(--bg); }

.gradient-text {
  background: none; -webkit-background-clip: unset;
  -webkit-text-fill-color: #c0392b; color: #c0392b;
}

.headline, .card-page h2 {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase; letter-spacing: 2px;
}

.btn {
  border-radius: 0; font-family: 'Oswald', sans-serif;
  text-transform: uppercase; letter-spacing: 2px;
}
.btn-primary {
  background: #c0392b; box-shadow: none; border: 2px solid #c0392b;
}
.btn-primary:hover:not(:disabled) {
  background: #8e2b21; border-color: #8e2b21; filter: none;
}
.btn-ghost {
  border-radius: 0; border: 2px solid rgba(255,255,255,0.2);
  background: transparent;
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3);
}
.btn-xl { border-radius: 0; }
.btn-sm { border-radius: 0; }
.btn-icon { border-radius: 0; }

.btn.copied, .btn.copied:hover:not(:disabled) {
  border-radius: 0; box-shadow: none;
}

.countdown { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(0,0,0,0.5); }
.countdown-num {
  background: none; -webkit-background-clip: unset;
  -webkit-text-fill-color: #c0392b; color: #c0392b;
  font-family: 'Oswald', monospace;
}

.battle-you .player-score { color: #c0392b; }
.battle-opp .player-score { color: #e8a87c; }

.result-you .result-num { color: #c0392b; }
.result-opp .result-num { color: #e8a87c; }

.result-num {
  font-family: 'Oswald', monospace;
}

.arm { border-radius: 0; backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(15,13,11,0.6); }
.arm[data-state="UP"] { border-color: rgba(192,57,43,0.8); background: rgba(192,57,43,0.2); }
.arm[data-state="DOWN"] { border-color: rgba(246,242,236,0.4); background: rgba(246,242,236,0.08); }

.hud-chip { border-radius: 0; }
.status-box { border-radius: 0; }
.coach { border-radius: 0; }
.modal { border-radius: 0; }
.modal-input { border-radius: 0; }
.stat-grid > div { border-radius: 0; }
code { border-radius: 0; }
.topnav a { border-radius: 0; }

.logo-num {
  background: none; -webkit-background-clip: unset;
  -webkit-text-fill-color: #c0392b; color: #c0392b;
  font-family: 'Oswald', monospace;
}
.logo-word { font-family: 'Oswald', sans-serif; letter-spacing: 4px; }

.eyebrow { color: #c0392b; }

.gender-btn { border-radius: 0; }
.gender-btn.selected { border-color: #c0392b; background: rgba(192,57,43,0.1); box-shadow: none; }
