/* ============================================================
   BEERLYMPICS — styles.css
   Refactored for clean mobile layout, single background source,
   and no conflicting override layers.
   ============================================================ */

/* ── 1. DESIGN TOKENS ────────────────────────────────────── */

:root {
  color-scheme: light;
  --bg: #f4f7fc;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --border: rgba(19, 33, 68, 0.12);
  --border-strong: rgba(48, 80, 170, 0.28);
  --text: #111a2c;
  --muted: #5a6782;
  --primary: #2f59ff;
  --primary-strong: #1f46d3;
  --secondary: #ff4f95;
  --success: #15b58b;
  --warning: #d06c2f;
  --radius: 20px;
  --shadow-sm: 0 10px 22px rgba(16, 26, 47, 0.08);
  --shadow-md: 0 18px 44px rgba(16, 26, 47, 0.12);
  --leaderboard-flag-url: none;
}

/* ── 2. BASE RESET ───────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/*
 * Desktop default: html gets a fallback background.
 * body carries the gradient for the desktop view.
 * Both are transparent in mobile mode (background comes from ::before).
 */
html {
  margin: 0;
  min-height: 100%;
  background-color: #f4f7fc;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -8%, rgba(47, 89, 255, 0.15), transparent 35%),
    radial-gradient(circle at 90% -10%, rgba(255, 79, 149, 0.12), transparent 36%),
    linear-gradient(165deg, #f8faff 0%, #eef2fa 60%, #f6f8fd 100%);
  background-repeat: no-repeat;
  background-size: cover;
}

/* ── 3. DESKTOP LAYOUT & NAVBAR ──────────────────────────── */

/* Desktop background — dark gradient matching mobile palette */
body:not(.mobile-app) {
  background:
    radial-gradient(circle at 50% -10%, rgba(255,255,255,0.06), transparent 34%),
    radial-gradient(circle at 10% 92%, rgba(206,184,143,0.10), transparent 34%),
    linear-gradient(180deg, #0a0804 0%, #1a1209 40%, #4a3a1e 72%, #c8b88a 100%);
  background-attachment: fixed;
  background-size: cover;
  color: #f0ece2;
}

/* ── DESKTOP NAVBAR ─────────────────────────────────────── */

.top-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(8, 5, 2, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(216, 191, 124, 0.18);
  padding: 0 32px;
}

.dt-navbar {
  max-width: 1220px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.dt-nav-brand {
  flex-shrink: 0;
}

.dt-nav-logo {
  height: 52px;
  width: auto;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.4));
}

.dt-nav-links {
  display: flex;
  gap: 6px;
  flex: 1;
}

.dt-nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Override old .tabs — not used on desktop any more but still referenced by JS */
.tabs { display: none; }

/* Desktop nav tabs */
.tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(240, 236, 226, 0.62);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 150ms ease;
  white-space: nowrap;
}

.tab:hover {
  color: #f7f1de;
  background: rgba(216,191,124,0.1);
}

.tab.active {
  color: #1a0d00;
  font-weight: 700;
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

.tab.leaderboard-accent:not(.active) {
  color: #c9a860;
}

/* Mode pills in navbar */
.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.82rem;
  color: #c9a860;
  border-radius: 999px;
  background: rgba(216,191,124,0.1);
  border: 1px solid rgba(216,191,124,0.28);
}

.mode-pill.host {
  color: #ff8cc4;
  background: rgba(255,79,149,0.1);
  border-color: rgba(255,79,149,0.22);
}

.mode-banner { display: none; } /* replaced by dt-nav-right inline */
.subtitle { display: none; }
.brand-wrap { display: none; }
.brand-mark { display: none; }
.top-header h1 { display: none; }
.install-app-btn { font-size: 0.85rem; min-height: 36px; padding: 6px 14px; }

/* ── DESKTOP MAIN & CARDS ────────────────────────────────── */

main {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 32px 60px;
  display: grid;
  gap: 24px;
}

/* Desktop cards get the dark glass treatment */
body:not(.mobile-app) .card {
  background: rgba(10, 7, 3, 0.62);
  border: 1px solid rgba(216, 191, 124, 0.18);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 24px;
  color: #f0ece2;
}

body:not(.mobile-app) h2,
body:not(.mobile-app) h3,
body:not(.mobile-app) h4 { color: #f7f1de; }

body:not(.mobile-app) label { color: #d4c49a; }

body:not(.mobile-app) input,
body:not(.mobile-app) select {
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(216,191,124,0.28);
  color: #f0ece2;
  font-size: 16px;
}

body:not(.mobile-app) input::placeholder { color: rgba(240,236,226,0.38); }

body:not(.mobile-app) input:focus,
body:not(.mobile-app) select:focus {
  border-color: rgba(216,191,124,0.6);
  box-shadow: 0 0 0 3px rgba(184,145,70,0.18);
  outline: none;
}

body:not(.mobile-app) .status { color: rgba(240,236,226,0.6); }
body:not(.mobile-app) .hint  { color: rgba(240,236,226,0.5); }
body:not(.mobile-app) .hint.error { color: #ff8080; }

/* ── DESKTOP LANDING OVERLAY ─────────────────────────────── */

.dt-landing {
  position: fixed;
  inset: 0;
  top: 64px;
  z-index: 100;
  overflow-y: auto;
  padding: 48px 24px 80px;
  background:
    radial-gradient(circle at 50% -10%, rgba(255,255,255,0.06), transparent 34%),
    radial-gradient(circle at 10% 92%, rgba(206,184,143,0.10), transparent 34%),
    linear-gradient(180deg, #0a0804 0%, #1a1209 40%, #4a3a1e 72%, #c8b88a 100%);
  background-attachment: fixed;
}

.dt-landing.hidden { display: none; }

.dt-landing-inner {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.dt-landing-logo {
  height: min(18vh, 160px);
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 32px rgba(0,0,0,0.45));
}

.dt-landing-sub {
  margin: -16px 0 0;
  font-size: 1rem;
  color: rgba(240,236,226,0.6);
  letter-spacing: 0.04em;
}

.dt-landing-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
}

.dt-landing-cards-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
  .dt-landing-cards-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
  .dt-landing-cards { grid-template-columns: 1fr; }
  .dt-landing-cards-3 { grid-template-columns: 1fr; }
}

.dt-card {
  background: rgba(10, 7, 3, 0.72);
  border: 1px solid rgba(216, 191, 124, 0.22);
  border-radius: 22px;
  padding: 28px 24px 24px;
  display: grid;
  gap: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.36);
  /* Subtle gradient border ring */
  position: relative;
}

.dt-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, rgba(255,255,255,0.14), rgba(212,187,127,0.32), rgba(255,255,255,0.05));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.dt-card-icon {
  font-size: 2rem;
  line-height: 1;
}

.dt-card h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #f7f1de;
  letter-spacing: -0.02em;
}

.dt-card p {
  margin: 0;
  color: rgba(240,236,226,0.65);
  font-size: 0.9rem;
  line-height: 1.55;
}

.dt-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #c9a860;
  margin-bottom: 5px;
}

.dt-card input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(216,191,124,0.28);
  background: rgba(0,0,0,0.45);
  color: #f0ece2;
  font: inherit;
  font-size: 16px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  box-sizing: border-box;
}

.dt-card input::placeholder { color: rgba(240,236,226,0.35); }
.dt-card input:focus {
  outline: none;
  border-color: rgba(216,191,124,0.6);
  box-shadow: 0 0 0 3px rgba(184,145,70,0.18);
}

.dt-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.dt-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  min-height: 48px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  width: 100%;
}

.dt-btn-gold {
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  color: #1a0d00;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.dt-btn-gold:hover { transform: translateY(-1px); box-shadow: 0 12px 28px rgba(0,0,0,0.35); }
.dt-btn-gold:active { transform: translateY(1px); }
.dt-btn-gold:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.dt-hint {
  font-size: 0.83rem;
  color: rgba(240,236,226,0.55);
  margin: 0;
  min-height: 1.2em;
}
.dt-hint.success { color: #3dffc0; }
.dt-hint.error   { color: #ff8080; }

/* House rules list */
.dt-rules-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #c9a860;
  margin: 0 0 8px;
}

.dt-rules-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: visible;
  padding-right: 4px;
}

.dt-rule-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  color: rgba(240,236,226,0.82);
  cursor: pointer;
  padding: 4px 0;
}

.dt-rule-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #c9a860;
  flex-shrink: 0;
  padding: 0;
  min-height: unset;
  border: none;
  background: transparent;
  box-shadow: none;
}

/* Admin toggle in landing */
/* ── ADMIN TOGGLE — NAVBAR VERSION ──────────────────────── */
.dt-nav-admin {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(216,191,124,0.2);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.72rem;
  color: rgba(240,236,226,0.7);
  transition: background 140ms, border-color 140ms;
  white-space: nowrap;
}
.dt-nav-admin:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(216,191,124,0.4);
}
.dt-nav-admin input[type="checkbox"] {
  width: 13px; height: 13px;
  accent-color: #c9a860;
  margin: 0; padding: 0;
  flex-shrink: 0;
}
.dt-nav-admin-label { font-weight: 700; color: #f0ece2; }
.dt-nav-admin-status { color: rgba(240,236,226,0.4); font-size: 0.66rem; }

/* ── ADMIN PANEL / GRID ─────────────────────────────────── */
.admin-panel,
.admin-grid {
  background: rgba(216,191,124,0.05);
  border: 1px solid rgba(216,191,124,0.18);
  border-radius: 14px;
  padding: 14px;
}

/* ── LEADERBOARD ADMIN ROW ──────────────────────────────── */
.leaderboard-card.admin {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

/* ── ROSTER ADMIN BUTTONS ───────────────────────────────── */
body:not(.mobile-app) .roster-actions .btn {
  background: rgba(216,191,124,0.1);
  border: 1px solid rgba(216,191,124,0.25);
  color: #f0ece2;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 8px;
}
body:not(.mobile-app) .roster-actions .btn:hover {
  background: rgba(216,191,124,0.2);
}
body:not(.mobile-app) .roster-actions .btn.danger,
body:not(.mobile-app) .roster-actions .btn[class*="remove"],
body:not(.mobile-app) .roster-actions .btn[class*="delete"] {
  background: rgba(180,40,40,0.15);
  border-color: rgba(220,70,60,0.35);
  color: rgba(255,145,120,0.9);
}
body:not(.mobile-app) .roster-actions .btn.danger:hover {
  background: rgba(180,40,40,0.28);
}

/* ── ADMIN MERGE SECTION ────────────────────────────────── */
.admin-merge {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(216,191,124,0.2);
}

/* ── MERGE ROW / CONTROLS ───────────────────────────────── */
.merge-row {
  gap: 8px;
}
.merge-row input,
.merge-row select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(216,191,124,0.2);
  color: #f0ece2;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
}
.merge-row input::placeholder { color: rgba(240,236,226,0.35); }

/* Legacy admin-toggle (mobile / old location) — hide on desktop */
body:not(.mobile-app) .admin-toggle:not(.dt-admin-toggle):not(.dt-nav-admin) {
  display: none;
}
body:not(.mobile-app) .dt-admin-toggle { display: none; }

/* Stepper hidden on desktop */
body:not(.mobile-app) .stepper { display: none; }

/* Split layout */
body:not(.mobile-app) .split {
  grid-template-columns: minmax(360px, 440px) 1fr;
  align-items: start;
  gap: 20px;
}

/* ── DESKTOP LEADERBOARD STAGE ───────────────────────────── */
body:not(.mobile-app) .leaderboard-stage {
  color: #f7f1de;
}

body:not(.mobile-app) .leaderboard-split {
  grid-template-columns: minmax(280px,360px) 1fr;
  align-items: start;
}

body:not(.mobile-app) .current-matches-card {
  display: block;
  position: sticky;
  top: 80px;
}

/* ── DESKTOP RULES SECTION ───────────────────────────────── */
body:not(.mobile-app) .rules-item {
  border-color: rgba(216,191,124,0.2);
  background: rgba(0,0,0,0.25);
  color: #f0ece2;
}

body:not(.mobile-app) .rules-item summary { color: #f7f1de; }
body:not(.mobile-app) .rules-item[open] summary { border-bottom-color: rgba(216,191,124,0.18); }
body:not(.mobile-app) .rules-item ul li { color: rgba(240,236,226,0.82); }

/* Ask the Ref on desktop */
body:not(.mobile-app) .ask-ref-wrap,
body:not(.mobile-app) #ref-section .ref-page {
  color: #f0ece2;
}

/* Game cards on desktop */
body:not(.mobile-app) .game-card,
body:not(.mobile-app) .leaderboard-card,
body:not(.mobile-app) .roster-team {
  background: rgba(0,0,0,0.55) !important;
  border-color: rgba(216,191,124,0.18) !important;
  color: #f0ece2 !important;
}

body:not(.mobile-app) .access-card {
  border-color: rgba(216,191,124,0.3);
}

body:not(.mobile-app) .step {
  background: rgba(0,0,0,0.3);
  border-color: rgba(216,191,124,0.18);
  color: #f0ece2;
}

body:not(.mobile-app) .step small { color: rgba(240,236,226,0.55); }
body:not(.mobile-app) .step-circle { color: #c9a860; background: rgba(216,191,124,0.12); }
body:not(.mobile-app) .step.active .step-circle { background: #c9a860; color: #1a0d00; }

body:not(.mobile-app) .stat-pill {
  background: rgba(216,191,124,0.1);
  border-color: rgba(216,191,124,0.22);
  color: #f0ece2;
}

body:not(.mobile-app) .flag {
  border-color: rgba(216,191,124,0.22);
  background: rgba(0,0,0,0.3);
  color: #c9a860;
}

body:not(.mobile-app) .section-title h2,
body:not(.mobile-app) .section-title h3 { color: #f7f1de; }

/* Roster */
body:not(.mobile-app) .roster-group h3 { color: #c9a860; }
body:not(.mobile-app) .roster-team strong { color: #f0ece2 !important; }
body:not(.mobile-app) .roster-team .flag-avatar { background: rgba(255,255,255,0.08); }

/* Leaderboard stage */
body:not(.mobile-app) .leaderboard-stage {
  background: linear-gradient(160deg, #0a0804 0%, #221c12 48%, #ceb88f 76%, #f4efe6 100%);
}

/* Admin toggle in hero (now in dt-admin-toggle) */
body:not(.mobile-app) .admin-toggle:not(.dt-admin-toggle) { display: none; }

/* ── 4. CARD & COMPONENT STYLES ─────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
  padding: 20px;
}

.hero {
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(244, 248, 255, 0.9)),
    radial-gradient(circle at 10% 0%, rgba(47, 89, 255, 0.14), transparent 60%);
}

.hero h2 { margin: 0; }

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
}

.hero-badges {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge {
  background: #f3f6ff;
  border: 1px solid rgba(47, 89, 255, 0.14);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.admin-toggle {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-solid);
}

.admin-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

form,
.mobile-panel,
.admin-panel,
.admin-grid,
.leaderboard,
.roster,
.score-actions,
.merge-row,
.split,
.leaderboard-split,
.current-matches-grid,
.current-match-teams,
.leaderboard-edit {
  display: grid;
  gap: 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title h2,
.section-title h3,
.game-card h3,
h2,
h3,
h4 {
  margin: 0;
}

label {
  display: inline-block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #243252;
}

input,
select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid rgba(51, 70, 119, 0.2);
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: rgba(47, 89, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(47, 89, 255, 0.15);
}

input.small {
  padding: 8px 10px;
  font-size: 0.88rem;
}

.status {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.hint.error {
  color: #b73e3e;
  font-weight: 600;
}

/* ── 5. BUTTONS ──────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: linear-gradient(120deg, var(--primary), #6480ff);
  color: #fff;
  border-radius: 12px;
  min-height: 42px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
  box-shadow: 0 8px 18px rgba(47, 89, 255, 0.24);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }

.btn.secondary {
  background: linear-gradient(120deg, var(--secondary), #ff78b3);
  box-shadow: 0 8px 18px rgba(255, 79, 149, 0.22);
}

.btn.ghost {
  background: #edf3ff;
  border-color: rgba(47, 89, 255, 0.18);
  color: #2e4bb1;
  box-shadow: none;
}

.btn.ghost:hover {
  background: #e3ecff;
  border-color: rgba(47, 89, 255, 0.3);
}

#mobile-exit-game-btn {
  background: linear-gradient(135deg, #d63a3a 0%, #b61f1f 100%);
  border-color: rgba(128, 15, 15, 0.6);
  color: #fff;
  box-shadow: 0 10px 22px rgba(158, 25, 25, 0.35);
}

#mobile-exit-game-btn:hover {
  border-color: rgba(98, 10, 10, 0.75);
}

#exit-pause-btn {
  color: #163067;
  background: #e9f0ff;
  border-color: rgba(22, 66, 156, 0.35);
  font-weight: 700;
}

.btn.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.84rem;
}

.btn.link {
  background: transparent;
  border: 0;
  color: var(--primary-strong);
  box-shadow: none;
  padding: 0;
  min-height: auto;
}

.btn[disabled] {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
}

.btn.loading {
  position: relative;
  overflow: hidden;
}

.btn.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.45) 50%, transparent 100%);
  animation: shimmer 1.2s linear infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* ── 6. STEPPER ──────────────────────────────────────────── */

.stepper { margin-bottom: 14px; }

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f5f8ff;
  border: 1px solid rgba(48, 80, 170, 0.14);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 600;
}

.step small { color: var(--muted); font-weight: 500; }

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-strong);
  background: rgba(47, 89, 255, 0.12);
}

.step.active .step-circle { background: var(--primary); color: #fff; }
.step.complete .step-circle { background: rgba(21, 181, 139, 0.2); color: #0a7a5d; }

/* ── 7. GAME CARDS & LEADERBOARD COMPONENTS ─────────────── */

.game-card,
.roster-group,
.current-match-card,
.leaderboard-card {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
}

.access-card { border-color: rgba(47, 89, 255, 0.24); }

.opponents { display: grid; gap: 8px; }

.opponent-pill,
.current-match-team,
.stat-pill {
  border-radius: 999px;
  background: #f4f7ff;
  border: 1px solid rgba(47, 89, 255, 0.13);
}

.opponent-pill,
.current-match-team {
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}

.leaderboard-section {
  position: relative;
  overflow: hidden;
}

.leaderboard-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(var(--leaderboard-accent-rgb, 47, 89, 255), 0.08), transparent 65%);
  pointer-events: none;
}

.leaderboard-heading {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(var(--leaderboard-accent-rgb, 47, 89, 255), 0.24);
  padding: 14px;
  background: linear-gradient(145deg, rgba(var(--leaderboard-accent-rgb, 47, 89, 255), 0.2), rgba(var(--leaderboard-secondary-rgb, 255, 79, 149), 0.15));
}

.leaderboard-heading::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--leaderboard-flag-url);
  background-size: cover;
  opacity: 0.2;
  filter: blur(10px) saturate(1.1);
}

.leaderboard-heading > * { position: relative; z-index: 1; }
.leaderboard-heading h2 { font-size: clamp(1.4rem, 3.5vw, 2rem); }

.current-matches-card { display: none; }

.current-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.leaderboard-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.leaderboard-card.admin {
  display: grid;
  grid-template-columns: 1fr auto;
}

.rank {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-right: 10px;
}

.rank--gold {
  color: transparent;
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.rank--silver { color: #c0c0c0; }
.rank--bronze { color: #cd7f32; }
.rank--default { color: #fff; }

.team-info { display: grid; gap: 6px; }

.team-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.flag {
  width: 32px;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(47, 89, 255, 0.18);
  background: #f3f5ff;
  display: inline-grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #2f4fb5;
}

.flag img { width: 100%; height: 100%; object-fit: cover; }

.stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
}

.roster-team {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}

.roster-team.admin { display: grid; grid-template-columns: 1fr auto auto; }
.roster-team:last-child { margin-bottom: 0; }

.roster-team strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.roster-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* admin-merge now styled in the admin theme block above */

.game-code {
  font-weight: 800;
  font-size: 1.55rem;
  letter-spacing: 0.2rem;
  color: var(--primary-strong);
}

.reward-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(38, 170, 129, 0.24);
  background: rgba(21, 181, 139, 0.1);
  font-weight: 600;
  animation: pop 300ms ease;
}

.reward-banner.loss,
.reward-banner.ready {
  border-color: rgba(47, 89, 255, 0.2);
  background: rgba(47, 89, 255, 0.08);
}

.points-burst span {
  font-weight: 800;
  color: var(--primary-strong);
  animation: float-up 1.4s ease forwards;
}

@keyframes pop {
  from { transform: scale(0.97); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes float-up {
  0%   { transform: translateY(0);     opacity: 0; }
  25%  { opacity: 1; }
  100% { transform: translateY(-14px); opacity: 0; }
}

.powerups {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.powerups .charges { letter-spacing: 1px; }

.powerups.active .charges { animation: pulse 0.9s ease infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1);   }
  50%       { transform: scale(1.1); }
}

/* ── 8. LEADERBOARD STAGE ────────────────────────────────── */

.leaderboard-stage {
  border-radius: 16px;
  background: linear-gradient(160deg, #000000 0%, #221c12 48%, #ceb88f 76%, #ffffff 100%);
  color: #fff;
  padding: 20px;
  margin-bottom: 10px;
}

.leaderboard-split { margin-top: 10px; }

.matchup-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.opponents.aesthetic {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.opponent-card {
  border-radius: 12px;
  border: 1px solid rgba(47, 89, 255, 0.2);
  background: rgba(47, 89, 255, 0.06);
  padding: 10px 12px;
}

.opponent-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.opponent-meta { display: grid; gap: 2px; }

.opponent-country {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  color: #c9a860;
  font-weight: 700;
}

.opponent-members { font-weight: 700; }

.stage-kicker {
  margin: 0;
  font-size: 0.92rem;
  opacity: 0.92;
}

.game-code-hero {
  font-size: clamp(2.3rem, 8vw, 4rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.08em;
  margin-top: 8px;
}

.join-tools {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.join-qr {
  width: 118px;
  height: 118px;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
}

.join-link {
  margin: 6px 0 8px;
  font-weight: 600;
  word-break: break-all;
}

/* ── 9. TOAST ────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: grid;
  gap: 8px;
}

.toast {
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  background: #1c2a4b;
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  animation: toast-in 220ms ease forwards;
}

.toast.success { background: #204fcf; }
.toast.warning { background: var(--warning); }
.toast.info    { background: #2f3f6e; }

.toast.is-leaving { animation: toast-out 260ms ease forwards; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(6px) scale(0.98); }
}

/* ── 10. CONFETTI ────────────────────────────────────────── */

.confetti {
  position: fixed;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  animation: confetti-fall 1.4s ease-out forwards;
  z-index: 210;
}

@keyframes confetti-fall {
  from { transform: translateY(-20px) rotate(0);   opacity: 1; }
  to   { transform: translateY(180px) rotate(120deg); opacity: 0; }
}

/* ── 11. MOBILE DOCK (default hidden on desktop) ─────────── */

.mobile-dock {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
}

.mobile-dock-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(47, 89, 255, 0.1);
}

.mobile-dock-text { display: grid; }
.mobile-dock-title { font-weight: 700; }
.mobile-dock-subtitle { color: var(--muted); font-size: 0.84rem; }

/* ── 12. MOBILE PANEL COMPONENTS ────────────────────────── */

.mobile-panel-header {
  background: #f4f7ff;
  border: 1px solid rgba(47, 89, 255, 0.14);
  border-radius: 12px;
  padding: 10px 12px;
}

.mobile-panel-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
  color: var(--primary-strong);
}

/* ── 13. VISIBILITY UTILITIES ────────────────────────────── */

.hidden       { display: none !important; }
.mobile-only  { display: none; }
.desktop-only { display: block; }

/* Hide the hero card on desktop when leaderboard is active */
body[data-view="leaderboard"] .hero { display: none; }

/* ── 14. DESKTOP MEDIA QUERIES ───────────────────────────── */

@media (min-width: 768px) {
  .split {
    grid-template-columns: minmax(380px, 460px) 1fr;
    align-items: start;
    gap: 16px;
  }

  .leaderboard-split {
    grid-template-columns: minmax(280px, 360px) 1fr;
    align-items: start;
  }

  .current-matches-card {
    display: block;
    position: sticky;
    top: 16px;
  }

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

  .merge-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-header {
    padding-top: calc(16px + env(safe-area-inset-top));
  }

  .install-app-btn { width: auto; margin-top: 0; }

  .join-qr { width: 118px; height: 118px; }
}

@media (max-width: 767px) {
  .navbar {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .tabs {
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .tab {
    flex: 0 0 auto;
    min-width: 120px;
  }

  .join-qr { width: 96px; height: 96px; }
}

/* ── 15. MOBILE WELCOME / ONBOARDING ────────────────────── */

.mobile-welcome-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 20px;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms ease;
}

body[data-mobile-state="onboarding-code"] .mobile-welcome-screen,
body[data-mobile-state="onboarding-team"] .mobile-welcome-screen {
  pointer-events: auto;
  opacity: 1;
  background: linear-gradient(160deg, #000000 0%, #221c12 48%, #ceb88f 76%, #ffffff 100%);
}

body:not([data-mobile-state="onboarding-code"]):not([data-mobile-state="onboarding-team"]) .mobile-welcome-screen {
  display: none;
}

.mobile-welcome-card {
  width: min(92vw, 380px);
  position: absolute;
  top: 50%;
  left: 50%;
  background: rgba(255, 255, 255, 0.985);
  border: 1px solid rgba(17, 26, 44, 0.16);
  border-radius: 18px;
  padding: 22px;
  text-align: left;
  color: #101a2e;
  box-shadow: var(--shadow-md);
  display: grid;
  gap: 10px;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 12px));
  pointer-events: none;
  transition: opacity 260ms ease, transform 260ms ease;
}

.mobile-welcome-card h1,
.mobile-welcome-card h2,
.mobile-welcome-card label { color: #101a2e; }

.mobile-welcome-card.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.welcome-continue { margin-top: 8px; width: 100%; }

.mobile-onboarding-note {
  margin: 0;
  color: rgba(17, 26, 44, 0.78);
  font-size: 0.9rem;
  font-weight: 600;
}

.mobile-onboarding-note.success { color: #0f8f69; }

/* ── 16. INSTALL / EXIT MODAL ────────────────────────────── */

.install-app-btn { min-height: 42px; white-space: nowrap; }

.install-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  align-items: end;
  animation: modalFadeIn 180ms ease;
}

.install-modal.hidden { display: none; }

.install-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 28, 0.48);
  backdrop-filter: blur(2px);
}

.install-modal-sheet {
  position: relative;
  width: min(560px, 100%);
  margin: 0 auto;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(19, 33, 68, 0.12);
  animation: modalSlideIn 220ms ease;
}

.install-modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f6f8ff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.install-kicker {
  margin: 0;
  color: var(--primary-strong);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.install-steps { margin: 14px 0; display: grid; gap: 10px; }

.install-step-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(47, 89, 255, 0.14);
  background: rgba(246, 248, 255, 0.9);
  border-radius: 12px;
  padding: 11px 12px;
}

.install-step-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(47, 89, 255, 0.14);
  font-size: 1rem;
}

.exit-modal-sheet .status { margin: 8px 0 0; }
.exit-options { margin-top: 14px; display: grid; gap: 10px; }

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

@keyframes modalSlideIn {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── 17. RULES ACCORDION ─────────────────────────────────── */

#rules-section h2 { margin-bottom: 4px; }

.rules-accordion { margin-top: 14px; display: grid; gap: 10px; }

.rules-item {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.rules-item summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
}

.rules-item summary::-webkit-details-marker { display: none; }
.rules-item[open] summary { border-bottom: 1px solid rgba(255, 255, 255, 0.12); }

.rules-item ul {
  margin: 0;
  padding: 10px 18px 14px 30px;
  display: grid;
  gap: 8px;
}

/* ========================================================
   MOBILE APP SHELL
   Single, authoritative section — no overrides below this.
   ======================================================== */

/*
 * ARCHITECTURE:
 * - html.mobile-app-bg: solid fallback color to plug safe-area gaps
 * - body.mobile-app::before: position:fixed gradient that covers entire viewport
 * - body.mobile-app and all children: transparent
 * - body.mobile-app main: single scroll container, natural height
 * - Sections show/hide via JS-toggled .hidden class only
 * - Bottom nav: always a 3-column grid, never block
 */

/* ── 18. MOBILE BACKGROUND ───────────────────────────────── */

html.mobile-app-bg {
  /* Solid color fills notch / home-indicator safe-area edges */
  background-color: #040404;
  min-height: 100dvh;
}

body.mobile-app {
  background: transparent;
  color: #fff;
  min-height: 100dvh;
  min-height: 100svh;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/*
 * One ::before, one definition — the full-screen gradient.
 * position:fixed covers the entire viewport regardless of scroll.
 * Extending slightly beyond inset:0 via negative top/bottom ensures
 * the gradient reaches behind the status bar and home indicator on iOS.
 */
body.mobile-app::before {
  content: "";
  position: fixed;
  top: calc(-1 * env(safe-area-inset-top, 0px) - 20px);
  right: 0;
  bottom: calc(-1 * env(safe-area-inset-bottom, 0px) - 20px);
  left: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.10), transparent 34%),
    radial-gradient(circle at 10% 92%, rgba(206, 184, 143, 0.16), transparent 34%),
    linear-gradient(180deg, #040404 0%, #17120b 42%, #5b4a2d 78%, #f4efe6 100%);
  background-size: cover;
  background-repeat: no-repeat;
}

/* ── 19. MOBILE HIDE / SHOW RULES ────────────────────────── */

body.mobile-app header,
body.mobile-app #roster-section,
body.mobile-app #control-section,
body.mobile-app .hero,
body.mobile-app .stepper,
body.mobile-app .team-setup-column,
body.mobile-app .desktop-only,
body.mobile-app .tabs,
body.mobile-app .top-header {
  display: none !important;
}

body.mobile-app .mobile-only { display: block; }

/* State-driven panel visibility */
body.mobile-app[data-mobile-state="access"]  .mobile-register-panel,
body.mobile-app[data-mobile-state="register"] .mobile-access-panel,
body.mobile-app[data-mobile-state="register"] .mobile-play-panel,
body.mobile-app[data-mobile-state="access"]  .mobile-play-panel,
body.mobile-app[data-mobile-state="playing"] .mobile-register-panel,
body.mobile-app[data-mobile-state="playing"] .mobile-access-panel,
body.mobile-app[data-mobile-state="playing"] .team-setup-column {
  display: none;
}

/* Onboarding: hide the dock during welcome flow */
body.mobile-app[data-mobile-state="onboarding-code"] .mobile-dock,
body.mobile-app[data-mobile-state="onboarding-team"] .mobile-dock {
  display: none !important;
}

/* ── 20. MOBILE MAIN LAYOUT ──────────────────────────────── */

body.mobile-app main {
  width: 100%;
  max-width: none;
  margin: 0;
  display: block;
  background: transparent;
  padding:
    max(16px, env(safe-area-inset-top, 16px))
    16px
    calc(104px + env(safe-area-inset-bottom, 0px));
  position: relative;
  z-index: 1;
  /* Let the page scroll naturally — no fixed height, no nested overflow */
  min-height: 100dvh;
  min-height: 100svh;
}

/* ── 21. PLAYER SECTION ──────────────────────────────────── */

body.mobile-app #player-section,
body.mobile-app .mobile-play-panel {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

/* ── 22. LOGO / DOCK ─────────────────────────────────────── */

body.mobile-app .mobile-dock {
  display: flex;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #fff;
  padding: 0;
  margin: 0 auto;
  width: 100%;
}

body.mobile-app .mobile-dock-logo {
  /* Larger, more prominent logo */
  width: min(92vw, 440px);
  max-height: 180px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 8px 28px rgba(0, 0, 0, 0.36));
}

/* ── 23. PLAY PANEL ──────────────────────────────────────── */

body.mobile-app .mobile-play-panel {
  display: none;
  gap: 14px;
}

body.mobile-app.has-active-team .mobile-play-panel,
body.mobile-app[data-mobile-state="playing"] .mobile-play-panel {
  display: grid;
}

body.mobile-app .section-title { margin-bottom: 4px; }

body.mobile-app .section-title h2 {
  font-size: 1.55rem;
  color: #fff;
}

body.mobile-app .score-actions { gap: 12px; }
body.mobile-app .powerups { color: rgba(255, 255, 255, 0.86); }
body.mobile-app .reward-banner { color: #fff; }
body.mobile-app #manual-refresh { margin-top: 4px; }

/* ── 24. LEADERBOARD SECTION ─────────────────────────────── */

/*
 * Leaderboard is shown/hidden via JS's .hidden class.
 * We do NOT set display:none here — we just style it.
 * padding-bottom ensures content clears the fixed navbar.
 */
body.mobile-app #leaderboard-section {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  /* Extra bottom space so last item clears the fade + navbar */
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

/* Leaderboard fade curtain — standalone <div> directly in <body>.
   A ::after on #leaderboard-section can NEVER work here because .card applies
   backdrop-filter: blur(8px), which creates a new stacking context. Any fixed
   child inside that context gets a local z-index, so the global navbar (1100)
   always paints over it no matter what value we set.
   Solution: a real element that is a direct body child — no stacking context. */
.leaderboard-fade-curtain {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100px;
  pointer-events: none;
  z-index: 1099;
  background: linear-gradient(
    to bottom,
    transparent                    0%,
    rgba(244, 239, 230, 0.30)     55%,
    rgba(244, 239, 230, 0.72)     80%,
    rgba(244, 239, 230, 0.90)    100%
  );
}

body.mobile-app[data-view="leaderboard"] .leaderboard-fade-curtain,
body.mobile-app[data-view="player"] .leaderboard-fade-curtain,
body.mobile-app[data-view="rules"] .leaderboard-fade-curtain,
body.mobile-app[data-view="ref"] .leaderboard-fade-curtain {
  display: block;
}

body.mobile-app .leaderboard-stage { margin-bottom: 14px; }
body.mobile-app .leaderboard-heading { margin-bottom: 14px; }
body.mobile-app .leaderboard-split { margin-top: 0; gap: 14px; }
body.mobile-app .leaderboard { gap: 14px; padding-top: 4px; }

/* ── 25. RULES SECTION ───────────────────────────────────── */

body.mobile-app #rules-section {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

/* ── 26. MOBILE CARD THEMING ─────────────────────────────── */

body.mobile-app .card,
body.mobile-app .mobile-dock {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.18);
}

body.mobile-app .mobile-dock-subtitle { color: rgba(255, 255, 255, 0.78); }
body.mobile-app .status  { color: rgba(255, 255, 255, 0.78); }
body.mobile-app .hint    { color: rgba(255, 255, 255, 0.78); }

body.mobile-app .game-card,
body.mobile-app .reward-banner,
body.mobile-app .leaderboard-card,
body.mobile-app .roster-team,
body.mobile-app .opponent-card,
body.mobile-app .current-match-card {
  background: rgba(10, 10, 10, 0.48);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  border-radius: 18px;
}

body.mobile-app #next-game h3,
body.mobile-app .mobile-play-panel h2,
body.mobile-app .mobile-play-panel .matchup-subtitle,
body.mobile-app .opponent-country,
body.mobile-app .opponent-members { color: #fff; }

body.mobile-app .flag { border-color: rgba(255, 255, 255, 0.18); }

body.mobile-app .stat-pill {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* Mobile-themed form panels */
body.mobile-app .mobile-register-panel,
body.mobile-app .mobile-access-panel,
body.mobile-app[data-mobile-state="playing"] .mobile-play-panel {
  background: linear-gradient(160deg, rgba(0, 0, 0, 0.92), rgba(34, 28, 18, 0.9), rgba(206, 184, 143, 0.42));
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 18px;
  padding: 16px;
  color: #fff;
}

body.mobile-app .mobile-play-panel .status,
body.mobile-app .mobile-register-panel .hint,
body.mobile-app .mobile-access-panel .hint,
body.mobile-app .mobile-register-panel .status,
body.mobile-app .mobile-access-panel .status,
body.mobile-app .mobile-panel-kicker { color: rgba(255, 255, 255, 0.9); }

body.mobile-app .mobile-register-panel label,
body.mobile-app .mobile-access-panel label,
body.mobile-app .mobile-register-panel h3,
body.mobile-app .mobile-access-panel h3,
body.mobile-app .mobile-register-panel .section-title h2,
body.mobile-app .mobile-access-panel .section-title h3,
body.mobile-app #player-section .section-title h2 { color: #f6f8ff; }

body.mobile-app .mobile-register-panel .mobile-panel-header,
body.mobile-app .mobile-access-panel .mobile-panel-header {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
}

body.mobile-app .mobile-play-panel .game-card { color: #f0ece2; }

body.mobile-app .mobile-play-panel .game-card .status { color: rgba(240, 236, 226, 0.78); }

body.mobile-app .mobile-play-panel .matchup-subtitle {
  color: #f7f1de;
  font-size: 1.25rem;
  font-weight: 700;
}
  font-weight: 700;
}

body.mobile-app .mobile-play-panel .opponent-country {
  color: #c9a860;
  font-size: 0.82rem;
}

body.mobile-app .mobile-play-panel .opponent-members {
  color: #f5efe0;
  font-size: 1.2rem;
  line-height: 1.2;
}

body.mobile-app .mobile-register-panel input,
body.mobile-app .mobile-access-panel input { background: rgba(255, 255, 255, 0.96); color: #111; }

/* ── 27. MOBILE BUTTON THEMING ───────────────────────────── */

body.mobile-app .btn {
  border-radius: 18px;
  min-height: 52px;
  font-size: 1rem;
  font-weight: 800;
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  color: #0b0b0b;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
}

body.mobile-app .btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: none;
}

body.mobile-app .btn.ghost {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
}

/* ── 28. BOTTOM NAV ──────────────────────────────────────── */

/*
 * Always a 3-column grid. The .mobile-only override (display:block) is
 * counteracted here with an explicit display:grid on the nav itself.
 * No !important needed because this selector is more specific.
 */
.mobile-bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
  gap: 6px;
  padding: 7px;
  border-radius: 18px;
  background: rgba(9, 9, 9, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/*
 * Override the .mobile-only { display: block } that gets applied
 * when body.mobile-app is set. The nav needs display:grid, not block.
 */
body.mobile-app .mobile-bottom-nav.mobile-only {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mobile-bottom-nav__tab {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.88);
  border-radius: 12px;
  min-height: 52px;
  font-weight: 600;
  font-size: 0.68rem;
  cursor: pointer;
  white-space: nowrap;
  text-align: center;
  padding: 6px 4px;
  width: 100%;
  overflow: hidden;
}

.mobile-bottom-nav__tab svg {
  stroke: currentColor;
  flex-shrink: 0;
}

.mobile-bottom-nav__tab.is-active {
  color: #111a2c;
  border-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(120deg, #ffe4aa, #ffffff);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

/* ── 29. TOAST (mobile offset) ───────────────────────────── */

body.mobile-app .toast-container {
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

/* ── 30. SPLASH SCREEN ───────────────────────────────────── */

body.mobile-app .mobile-splash-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding:
    max(20px, env(safe-area-inset-top, 0px))
    24px
    max(20px, env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.10), transparent 34%),
    radial-gradient(circle at 10% 92%, rgba(206, 184, 143, 0.16), transparent 34%),
    linear-gradient(180deg, #040404 0%, #17120b 42%, #5b4a2d 78%, #f4efe6 100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 340ms ease, visibility 340ms ease;
}

body.mobile-app.is-splash-active .mobile-splash-screen {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.mobile-app.is-splash-exiting .mobile-splash-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.mobile-app .mobile-splash-logo {
  width: min(78vw, 330px);
  max-height: 36vh;
  object-fit: contain;
  filter: drop-shadow(0 14px 38px rgba(0, 0, 0, 0.35));
  transform-origin: center center;
  animation: splashZoomIn 1650ms cubic-bezier(0.16, 0.84, 0.24, 1) forwards;
}

body.mobile-app.is-splash-exiting .mobile-splash-logo {
  animation: splashZoomOutFast 320ms cubic-bezier(0.4, 0, 1, 1) forwards;
}

/* Content stays mounted behind splash so it's ready when splash exits */
body.mobile-app.pre-mobile-app main,
body.mobile-app.pre-mobile-app .mobile-welcome-screen,
body.mobile-app.is-splash-active main,
body.mobile-app.is-splash-active .mobile-welcome-screen,
body.mobile-app.is-splash-exiting main,
body.mobile-app.is-splash-exiting .mobile-welcome-screen {
  opacity: 1;
  pointer-events: auto;
}

@keyframes splashZoomIn {
  0%   { transform: scale(0.68); opacity: 0.42; }
  60%  { transform: scale(1.04); opacity: 0.94; }
  100% { transform: scale(1.14); opacity: 1; }
}

@keyframes splashZoomOutFast {
  from { transform: scale(1.14); opacity: 1; }
  to   { transform: scale(0.22); opacity: 0; }
}

/* ── 31. MOBILE WELCOME CARD (in-app) ────────────────────── */

body.mobile-app .mobile-welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 500;
  padding:
    max(20px, env(safe-area-inset-top, 0px))
    18px
    max(20px, env(safe-area-inset-bottom, 0px));
  display: grid;
  place-items: center;
  align-content: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: transparent;
}

body.mobile-app[data-mobile-state="onboarding-code"] .mobile-welcome-screen,
body.mobile-app[data-mobile-state="onboarding-team"] .mobile-welcome-screen {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

body.mobile-app .mobile-welcome-card {
  display: none;
  position: relative;
  top: auto;
  left: auto;
  transform: none;
  width: min(100%, 420px);
  max-width: 420px;
  margin: auto;
  max-height: min(82dvh, 760px);
  overflow-y: auto;
  border-radius: 28px;
  padding: 26px 22px 22px;
  background: rgba(7, 7, 7, 0.72);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  gap: 14px;
}

body.mobile-app .mobile-welcome-card.is-visible {
  display: grid;
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* Gradient border ring */
body.mobile-app .mobile-welcome-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(212, 187, 127, 0.42), rgba(255, 255, 255, 0.08));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

body.mobile-app .mobile-welcome-card h1,
body.mobile-app .mobile-welcome-card h2,
body.mobile-app .mobile-welcome-card label { color: #fff; }

body.mobile-app .mobile-welcome-card h1,
body.mobile-app .mobile-welcome-card h2 {
  font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0 0 2px;
}

body.mobile-app .mobile-welcome-card label {
  font-size: 0.92rem;
  margin-bottom: 4px;
}

body.mobile-app .mobile-welcome-card input {
  background: rgba(255, 255, 255, 0.96);
  color: #111;
  border-radius: 16px;
  min-height: 54px;
  font-size: 16px; /* prevents iOS auto-zoom on focus */
  border: 1px solid rgba(255, 255, 255, 0.16);
}

body.mobile-app .mobile-onboarding-note {
  color: rgba(255, 255, 255, 0.78);
  min-height: 1.4em;
}

body.mobile-app .mobile-onboarding-note.success { color: #c8ffd8; }
body.mobile-app .welcome-download { margin-top: 2px; }

/* ── 32. MOBILE MODAL THEMING ────────────────────────────── */

body.mobile-app .install-modal-sheet { color: var(--text); }

body.mobile-app .install-modal-sheet h2,
body.mobile-app .install-modal-sheet .install-kicker { color: var(--text); }

body.mobile-app .install-modal-sheet .status { color: var(--muted); }

body.mobile-app .exit-modal-sheet .btn.secondary {
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  color: #0b0b0b;
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
}

body.mobile-app .exit-modal-sheet .btn.ghost {
  background: rgba(20, 32, 62, 0.08);
  color: #132750;
  border-color: rgba(20, 55, 130, 0.36);
  box-shadow: inset 0 0 0 1px rgba(20, 55, 130, 0.08);
  text-shadow: none;
}

/* ── 33. HTML PRELOAD (before JS runs) ───────────────────── */

html.mobile-preload {
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.1), transparent 34%),
    radial-gradient(circle at 10% 92%, rgba(206, 184, 143, 0.16), transparent 34%),
    linear-gradient(180deg, #040404 0%, #17120b 42%, #5b4a2d 78%, #f4efe6 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-color: #040404;
}

html.mobile-preload body {
  min-height: 100dvh;
  background: transparent;
}

html.mobile-preload body > :not(#mobile-splash) { visibility: hidden; }

html.mobile-preload #mobile-splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ── 34. ASK THE REF CHATBOT ─────────────────────────────── */

.ask-ref-wrap {
  margin-top: 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(6, 4, 2, 0.54);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
}

.ask-ref-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
}

.ask-ref-icon {
  font-size: 1.45rem;
  line-height: 1;
  flex-shrink: 0;
}

.ask-ref-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #f7f1de;
}

.ask-ref-header .status {
  margin: 2px 0 0;
  font-size: 0.78rem;
}

.ask-ref-messages {
  max-height: 290px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.ask-ref-message {
  display: flex;
  animation: pop 200ms ease;
}

.ask-ref-message.user-msg {
  justify-content: flex-end;
}

.ask-ref-bubble {
  max-width: 86%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.5;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.92);
  white-space: pre-wrap;
  word-break: break-word;
}

.ask-ref-message.user-msg .ask-ref-bubble {
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  color: #1a0d00;
  border-color: transparent;
  font-weight: 600;
}

.ask-ref-message.ref-msg .ask-ref-bubble {
  border-color: rgba(216, 191, 124, 0.22);
}

.ask-ref-message.thinking .ask-ref-bubble {
  opacity: 0.7;
  font-style: italic;
}

.ask-ref-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.ask-ref-input-row input {
  flex: 1;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 12px;
  min-height: 42px;
  font-size: 0.9rem;
}

.ask-ref-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.ask-ref-input-row input:focus {
  outline: none;
  border-color: rgba(216, 191, 124, 0.5);
  box-shadow: 0 0 0 3px rgba(184, 145, 70, 0.18);
}

.ask-ref-send {
  flex-shrink: 0;
  min-height: 42px;
  padding: 0 16px;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ── 35. REF SECTION (standalone Ask the Ref view) ──────────── */

body.mobile-app #ref-section {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
}

body.mobile-app #ref-section .ask-ref-wrap {
  margin-top: 0;
}

/* ── WIN CONFETTI (gold, black, white) ──────────────────────── */
@keyframes win-confetti-fall {
  0%   { transform: translateY(-10px) rotate(0deg) scale(1);   opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg) scale(0.6); opacity: 0; }
}
.win-confetti {
  position: fixed;
  top: 0;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 2000;
  animation: win-confetti-fall linear forwards;
}

/* ── REF PAGE — full-page conversation ─────────────────────── */
body.mobile-app #ref-section {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 90px);
}

.ref-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  height: calc(100dvh - calc(90px + env(safe-area-inset-bottom, 0px)));
  position: relative;
}

.ref-page-header {
  padding: 16px 16px 12px;
  text-align: center;
  flex-shrink: 0;
}

.ref-page-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c9a860;
  margin: 0 0 4px;
}

.ref-page-title {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 800;
  color: #f7f1de;
  margin: 0;
  letter-spacing: -0.02em;
}

.ref-page-subtitle {
  font-size: 0.85rem;
  color: rgba(247, 241, 222, 0.6);
  margin: 4px 0 0;
}

.ref-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.ref-message {
  display: flex;
  flex-direction: column;
  animation: pop 220ms ease;
}

.ref-message.user-msg {
  align-items: flex-end;
}

.ref-message.ref-msg {
  align-items: flex-start;
}

.ref-bubble {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 20px;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.ref-message.user-msg .ref-bubble {
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  color: #1a0d00;
  font-weight: 600;
  border-bottom-right-radius: 5px;
}

.ref-message.ref-msg .ref-bubble {
  background: rgba(8, 6, 2, 0.82);
  border: 1px solid rgba(216, 191, 124, 0.2);
  color: #f0ece2;
  border-bottom-left-radius: 5px;
  backdrop-filter: blur(10px);
}

.ref-message.thinking .ref-bubble {
  opacity: 0.65;
  font-style: italic;
  color: rgba(240, 236, 226, 0.7);
}

/* Ruling verdict badge */
.ref-verdict {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  animation: pop 300ms ease;
}

.ref-verdict.good {
  background: rgba(21, 181, 139, 0.18);
  border: 1px solid rgba(21, 181, 139, 0.4);
  color: #3dffc0;
}

.ref-verdict.bad {
  background: rgba(220, 60, 60, 0.18);
  border: 1px solid rgba(220, 60, 60, 0.4);
  color: #ff8080;
}

/* Ref ruling flash overlay */
.ref-ruling-flash {
  position: fixed;
  inset: 0;
  z-index: 1900;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: ref-flash-in 2.4s ease forwards;
}

@keyframes ref-flash-in {
  0%   { opacity: 0; }
  10%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

.ref-ruling-flash-inner {
  text-align: center;
  padding: 24px 32px;
  border-radius: 24px;
  backdrop-filter: blur(16px);
}

.ref-ruling-flash.good .ref-ruling-flash-inner {
  background: rgba(14, 50, 35, 0.92);
  border: 1px solid rgba(21, 181, 139, 0.5);
}

.ref-ruling-flash.bad .ref-ruling-flash-inner {
  background: rgba(50, 14, 14, 0.92);
  border: 1px solid rgba(220, 60, 60, 0.5);
}

.ref-ruling-flash-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 8px;
}

.ref-ruling-flash-text {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.ref-ruling-flash.good .ref-ruling-flash-text { color: #3dffc0; }
.ref-ruling-flash.bad  .ref-ruling-flash-text { color: #ff8080; }

/* Ref input bar */
.ref-input-bar {
  flex-shrink: 0;
  padding: 10px 12px;
  border-top: none;
  background: transparent;
  backdrop-filter: none;
  display: flex;
  gap: 8px;
  position: sticky;
  bottom: calc(82px + env(safe-area-inset-bottom, 0px));
}

.ref-input-bar input {
  flex: 1;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  border-radius: 22px !important;
  -webkit-border-radius: 22px !important;
  min-height: 46px;
  font-size: 16px !important;
  padding: 0 16px;
}

/* High-specificity override to beat global input and mobile-app input rules */
body.mobile-app #ref-section .ref-input-bar input,
body #ref-section .ref-input-bar input {
  border-radius: 22px !important;
  -webkit-border-radius: 22px !important;
}

.ref-input-bar input::placeholder { color: rgba(255,255,255,0.35); }
.ref-input-bar input:focus {
  outline: none;
  border-color: rgba(216, 191, 124, 0.5);
  box-shadow: 0 0 0 3px rgba(184, 145, 70, 0.18);
}

.ref-input-bar .ref-send-btn {
  flex-shrink: 0;
  min-height: 46px;
  padding: 0 18px;
  font-size: 0.92rem;
  font-weight: 700;
  border-radius: 14px;
}

/* Pre-game card */
.pre-game-card {
  background: linear-gradient(145deg, rgba(14,10,4,0.92), rgba(60,40,10,0.88));
  border: 1px solid rgba(216,191,124,0.45);
  border-radius: 18px;
  padding: 22px 18px 20px;
  text-align: center;
}
.pre-game-card .pre-game-kicker {
  font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #c9a860; margin: 0 0 8px;
}
.pre-game-card .pre-game-title {
  font-size: clamp(1.4rem, 5.5vw, 1.9rem); font-weight: 800;
  color: #f7f1de; margin: 0 0 10px; line-height: 1.2; letter-spacing: -0.02em;
}
.pre-game-card .pre-game-question {
  font-size: 0.95rem; color: rgba(247,241,222,0.82); margin: 0 0 20px; line-height: 1.5;
}
.pre-game-timer-ring {
  width: 64px; height: 64px; margin: 0 auto 4px;
  position: relative; display: flex; align-items: center; justify-content: center;
}
.pre-game-timer-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 5; }
.ring-fill {
  fill: none; stroke: #c9a860; stroke-width: 5; stroke-linecap: round;
  stroke-dasharray: 163; stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.4s ease;
}
.ring-fill.urgent { stroke: #e05c5c; }
.pre-game-timer-label {
  position: relative; z-index: 1; font-size: 1.15rem;
  font-weight: 800; color: #f7f1de; line-height: 1;
}

/* Onboarding tips */
.onboarding-tip {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: 12px;
  background: rgba(216,191,124,0.14); border: 1px solid rgba(216,191,124,0.32);
  font-size: 0.84rem; line-height: 1.5; color: rgba(255,255,255,0.9);
  transition: opacity 0.6s ease, max-height 0.6s ease, padding 0.6s ease, margin 0.6s ease, border 0.6s ease;
  max-height: 140px; overflow: hidden;
}
.onboarding-tip.is-dismissed {
  opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; border-width: 0;
}
.onboarding-tip-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* Join link buttons */
.join-link-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }

/* Help button */
.help-btn {
  position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); right: 16px; left: auto;
  z-index: 1098; width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.3); background: rgba(20,14,6,0.65);
  color: rgba(255,255,255,0.85); font-size: 1rem; font-weight: 700; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  transition: background 150ms ease, border-color 150ms ease;
}
body.mobile-app .help-btn.mobile-only { display: flex; }
.help-btn:hover { background: rgba(40,28,10,0.80); border-color: rgba(216,191,124,0.5); }

/* Help modal */
.help-modal { position: fixed; inset: 0; z-index: 1200; display: grid; align-items: end; animation: modalFadeIn 180ms ease; }
.help-modal.hidden { display: none; }
.help-modal-backdrop { position: absolute; inset: 0; background: rgba(4,4,4,0.6); backdrop-filter: blur(3px); }
.help-modal-sheet {
  position: relative; width: min(560px, 100%); margin: 0 auto;
  background: rgba(14,10,4,0.97); border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(32px + env(safe-area-inset-bottom, 0px));
  border: 1px solid rgba(216,191,124,0.22); border-bottom: none;
  box-shadow: 0 -18px 44px rgba(0,0,0,0.4); animation: modalSlideIn 220ms ease; display: grid; gap: 16px;
}
.help-modal-close {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px;
  border-radius: 50%; border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.8);
  font-size: 1.4rem; line-height: 1; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
}
.help-modal-kicker { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #c9a860; }
.help-tip-row {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px;
  border-radius: 14px; background: rgba(216,191,124,0.1); border: 1px solid rgba(216,191,124,0.22);
}
.help-tip-icon { font-size: 1.3rem; flex-shrink: 0; margin-top: 1px; }
.help-tip-row p { margin: 0; font-size: 0.9rem; line-height: 1.55; color: rgba(255,255,255,0.88); }

/* ── CLEAR INPUT WRAPPER ────────────────────────────────────── */
.input-clear-wrap {
  position: relative;
  display: grid;
}

.input-clear-wrap input {
  padding-right: 40px;
}

.input-clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.18);
  color: rgba(0, 0, 0, 0.55);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 120ms ease;
  z-index: 2;
}

.input-clear-btn.is-visible {
  display: flex;
}

.input-clear-btn:hover { background: rgba(0,0,0,0.28); }

/* ── FLIPCUP CONFIRM MODAL ──────────────────────────────────── */
.flipcup-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 4, 4, 0.72);
  backdrop-filter: blur(4px);
  animation: modalFadeIn 180ms ease;
}

.flipcup-confirm-card {
  background: linear-gradient(145deg, rgba(14,10,4,0.96), rgba(55,38,10,0.94));
  border: 1px solid rgba(216,191,124,0.38);
  border-radius: 22px;
  padding: 26px 22px 22px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}

.flipcup-confirm-card h3 {
  color: #f7f1de;
  font-size: 1.2rem;
  margin: 0 0 10px;
}

.flipcup-confirm-card p {
  color: rgba(247,241,222,0.75);
  font-size: 0.9rem;
  margin: 0 0 20px;
  line-height: 1.5;
}

.flipcup-confirm-actions {
  display: grid;
  gap: 10px;
}

/* ── SPINNING HOURGLASS ─────────────────────────────────────── */
@keyframes hourglass-spin {
  0%   { transform: rotate(0deg);   }
  40%  { transform: rotate(180deg); }
  50%  { transform: rotate(180deg); }
  90%  { transform: rotate(360deg); }
  100% { transform: rotate(360deg); }
}

.hourglass-spin {
  display: inline-block;
  animation: hourglass-spin 1.8s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
  transform-origin: center;
}

/* ── DESKTOP LANDING STEP CONTAINERS ───────────────────── */
#dt-step-1 {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

#dt-step-2 {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

#dt-step-2.hidden { display: none; }

.dt-configure-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.dt-code-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #d8bf7c 0%, #f7f1de 52%, #b89146 100%);
  color: #1a0d00;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  padding: 10px 28px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  margin-bottom: 4px;
}

.dt-configure-header h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  color: #f7f1de;
  letter-spacing: -0.02em;
}

.dt-configure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  width: 100%;
}

.dt-configure-go {
  max-width: 320px;
  font-size: 1.05rem;
}

/* Mode pill hidden by default on desktop until in-game */
body:not(.mobile-app) .dt-mode-pill { display: none; }
body:not(.mobile-app) .dt-mode-pill.dt-visible { display: inline-flex; }

/* Play tab hidden for hosts on desktop */
body:not(.mobile-app) .dt-play-tab.dt-host-hide { display: none; }

/* ── COMPACT BUTTON VARIANT ─────────────────────────────── */
.dt-btn-compact {
  min-height: 40px;
  padding: 8px 16px;
  font-size: 0.88rem;
}

/* ── LOGO AS BUTTON ─────────────────────────────────────── */
.dt-logo-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  border-radius: 8px;
  transition: opacity 150ms ease;
}
.dt-logo-btn:hover { opacity: 0.78; }
/* Only show the leave prompt if we're past the landing */
.dt-logo-btn.dt-landing-active { pointer-events: none; cursor: default; opacity: 1; }

/* ── DESKTOP LEAVE MODAL ────────────────────────────────── */
.dt-leave-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 180ms ease;
}
.dt-leave-modal.hidden { display: none; }

.dt-leave-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 4, 0.68);
  backdrop-filter: blur(4px);
}

.dt-leave-sheet {
  position: relative;
  width: min(480px, calc(100% - 48px));
  background: rgba(14, 10, 4, 0.97);
  border: 1px solid rgba(216, 191, 124, 0.28);
  border-radius: 24px;
  padding: 32px 28px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  display: grid;
  gap: 14px;
  animation: modalSlideIn 220ms ease;
}

.dt-leave-kicker {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #c9a860;
}

.dt-leave-sheet h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  color: #f7f1de;
  letter-spacing: -0.02em;
}

.dt-leave-sheet p {
  margin: 0;
  color: rgba(240, 236, 226, 0.72);
  font-size: 0.92rem;
  line-height: 1.6;
}

.dt-leave-actions {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.dt-btn-ghost {
  background: rgba(255,255,255,0.06);
  color: rgba(240,236,226,0.82);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: none;
}
.dt-btn-ghost:hover { background: rgba(255,255,255,0.10); }

/* ── DISPUTE MODAL ────────────────────────────────────────── */
.dispute-sheet {
  background: rgba(14, 10, 4, 0.97) !important;
  color: #f0ece2 !important;
  border-top: 1px solid rgba(216,191,124,0.22);
}
.dispute-sheet h2, .dispute-sheet .install-kicker { color: #f7f1de; }
.dispute-sheet .status { color: rgba(240,236,226,0.65); }

/* Dispute button on game page */
/* Dispute button — solid crimson, clearly distinct from the gold exit button */
#dispute-last-result {
  background: linear-gradient(135deg, #8b1e1e, #c0392b);
  border: 1px solid rgba(255, 100, 80, 0.4);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(180, 30, 20, 0.35);
}
#dispute-last-result:hover {
  background: linear-gradient(135deg, #a02424, #d44030);
  box-shadow: 0 6px 18px rgba(180, 30, 20, 0.5);
}

/* ── NULLIFY OVERLAY ──────────────────────────────────────── */
.nullify-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(6, 4, 2, 0.94);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalFadeIn 280ms ease;
}

.nullify-overlay.hidden { display: none; }

.nullify-overlay-inner {
  max-width: 380px;
  width: 100%;
  text-align: center;
  display: grid;
  gap: 16px;
}

.nullify-icon {
  font-size: 3.5rem;
  line-height: 1;
  animation: pulse 1.5s ease infinite;
}

.nullify-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 800;
  color: #f7f1de;
  letter-spacing: -0.02em;
}

.nullify-body {
  margin: 0;
  color: rgba(240,236,226,0.72);
  font-size: 0.92rem;
  line-height: 1.55;
}

.nullify-count {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #c9a860;
}

.nullify-actions {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

/* ── DESKTOP CARD OVERRIDES — beats --surface-solid and #fff base styles ── */
body:not(.mobile-app) .current-match-card,
body:not(.mobile-app) .game-card {
  background: rgba(0, 0, 0, 0.52) !important;
  border-color: rgba(216, 191, 124, 0.18) !important;
  color: #f0ece2 !important;
}

body:not(.mobile-app) .current-match-team,
body:not(.mobile-app) .opponent-pill {
  background: rgba(216, 191, 124, 0.12) !important;
  border-color: rgba(216, 191, 124, 0.22) !important;
  color: #f0ece2 !important;
}

body:not(.mobile-app) .current-match-header {
  color: rgba(240, 236, 226, 0.65) !important;
}

body:not(.mobile-app) .stat-pill {
  background: rgba(216, 191, 124, 0.1) !important;
  border-color: rgba(216, 191, 124, 0.22) !important;
  color: #f0ece2 !important;
}

/* Logo — mix-blend-mode handles white PNG backgrounds gracefully */
body:not(.mobile-app) .dt-nav-logo {
  mix-blend-mode: luminosity;
  opacity: 0.95;
}

/* Ensure logo button has no background bleed */
.dt-logo-btn {
  background-color: transparent !important;
  -webkit-appearance: none;
}

/* ── TEST SIMULATOR LAUNCH BUTTON (desktop only) ────────── */
.dt-sim-btn {
  appearance: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 140ms, border-color 140ms;
  flex-shrink: 0;
}
.dt-sim-btn:hover {
  background: rgba(255,255,255,0.14);
  border-color: rgba(216,191,124,0.3);
}

/* ── ROSTER DESKTOP OVERRIDES (beat #fff base) ──────────── */
body:not(.mobile-app) .roster-group,
body:not(.mobile-app) .roster-group > * {
  background: rgba(0,0,0,0.55) !important;
  border-color: rgba(216,191,124,0.2) !important;
  color: #f0ece2 !important;
}

body:not(.mobile-app) .roster-team {
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(216,191,124,0.18) !important;
}

/* ── SIM BUTTON — no white box ────────────────────────────── */
.dt-sim-btn {
  border: none !important;
  background: transparent !important;
  padding: 0;
  width: 32px;
  height: 32px;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: opacity 140ms;
}
.dt-sim-btn:hover { opacity: 0.7; background: transparent !important; }

/* ── DISPUTE MODAL DARK OVERRIDE ─────────────────────────── */
body.mobile-app .dispute-sheet,
body.mobile-app .dispute-sheet * {
  background: rgba(14,10,4,0.98) !important;
  color: #f0ece2 !important;
  border-color: rgba(216,191,124,0.22) !important;
}
body.mobile-app .dispute-sheet h2 { color: #f7f1de !important; font-size: 1.2rem; }
body.mobile-app .dispute-sheet .install-kicker { color: #c9a860 !important; }
body.mobile-app .dispute-sheet .status { color: rgba(240,236,226,0.65) !important; }
body.mobile-app .dispute-sheet .btn {
  background: rgba(255,255,255,0.08) !important;
  color: #f0ece2 !important;
  border-color: rgba(255,255,255,0.15) !important;
}
body.mobile-app .dispute-sheet .btn.secondary {
  background: rgba(220,80,60,0.15) !important;
  color: rgba(255,160,130,0.95) !important;
  border-color: rgba(220,80,60,0.3) !important;
}
body.mobile-app .dispute-sheet .install-modal-close {
  background: rgba(255,255,255,0.1) !important;
  color: #f0ece2 !important;
  border-color: rgba(255,255,255,0.15) !important;
}

/* ── MOBILE GAME ACTION ROW (dispute + exit side-by-side) ── */
.mobile-game-action-row {
  display: flex;
  gap: 8px;
  padding: 0 0 4px;
}
.mobile-game-action-row .btn {
  flex: 1;
  min-height: 42px;
  font-size: 0.82rem;
}
/* When dispute button is hidden, exit takes full width */
.mobile-game-action-row #dispute-last-result[style*="none"] + #mobile-exit-game-btn,
.mobile-game-action-row #dispute-last-result:not([style]) + #mobile-exit-game-btn {
  flex: 1;
}

/* ── FLIP CUP SIDE DISPLAY ───────────────────────────────── */
.flip-sides {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.flip-side {
  flex: 1;
  min-width: 120px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.flip-side--you { border-color: rgba(216,191,124,0.35); background: rgba(216,191,124,0.08); }
.flip-side-label { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #c9a860; }
.flip-side-teams { font-size: 0.82rem; color: #f0ece2; line-height: 1.4; }
.flip-side-vs { font-size: 0.75rem; font-weight: 700; color: rgba(240,236,226,0.4); flex-shrink: 0; }

/* ── DESKTOP NAVBAR LOGO — LARGER ────────────────────────── */
body:not(.mobile-app) .dt-navbar { height: 72px; }
body:not(.mobile-app) .dt-nav-logo { height: 62px !important; }
body:not(.mobile-app) .dt-landing { top: 72px; }

/* ── CURRENT MATCHES — SPACING & CONTRAST REFRESH ────────── */

/* More breathing room between subtitle and first card */
body.mobile-app #current-matches,
body:not(.mobile-app) #current-matches {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

/* Card itself — slightly taller padding */
body.mobile-app .current-match-card {
  padding: 14px 14px 12px !important;
  gap: 10px;
  display: flex;
  flex-direction: column;
}

/* Game title row */
body.mobile-app .current-match-header {
  margin-bottom: 10px;
}

body.mobile-app .current-match-header strong {
  font-size: 0.97rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #f7e79a;           /* bright warm gold — pops against dark card */
  text-shadow: 0 0 12px rgba(247, 225, 100, 0.35);
}

body.mobile-app .current-match-header .status {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.38);
  font-weight: 500;
}

/* Team pills — filled gold gradient instead of transparent */
body.mobile-app .current-match-teams {
  display: grid;
  gap: 7px;
}

body.mobile-app .current-match-team {
  background: linear-gradient(135deg,
    rgba(216, 185, 100, 0.18) 0%,
    rgba(216, 185, 100, 0.10) 100%) !important;
  border: 1px solid rgba(216, 185, 100, 0.35) !important;
  border-radius: 12px !important;
  padding: 10px 13px !important;
  color: #f7f1de !important;
  font-weight: 600;
  font-size: 0.88rem;
}

/* Desktop current-match-card matching treatment */
body:not(.mobile-app) .current-match-card {
  padding: 14px 16px 12px !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body:not(.mobile-app) .current-match-header strong {
  color: #f7e79a !important;
  font-weight: 800;
  font-size: 0.95rem;
}

body:not(.mobile-app) .current-match-team {
  background: linear-gradient(135deg,
    rgba(216, 185, 100, 0.18) 0%,
    rgba(216, 185, 100, 0.10) 100%) !important;
  border: 1px solid rgba(216, 185, 100, 0.35) !important;
  border-radius: 12px !important;
  color: #f7f1de !important;
  font-weight: 600;
}

/* Gap between "Live battles happening right now." and first match card */
.current-matches-grid {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

/* ── SVG SPIN ICON (replaces hourglass emoji) ───────────── */
@keyframes icon-spin {
  0%   { transform: rotate(0deg); }
  40%  { transform: rotate(180deg); }
  60%  { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}
.spin-icon {
  animation: icon-spin 2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
}

/* SVG icons in section-title align correctly */
body.mobile-app .section-title svg,
.section-title svg {
  flex-shrink: 0;
  vertical-align: middle;
}

/* ── CSS LOADING SPINNER (replaces spin-icon SVG) ────────── */
@keyframes spinner-rotate {
  to { transform: rotate(360deg); }
}
.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(240, 236, 226, 0.25);
  border-top-color: rgba(240, 236, 226, 0.85);
  border-radius: 50%;
  animation: spinner-rotate 0.75s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
  flex-shrink: 0;
}

/* Remove old spin-icon keyframes (no longer used) */

/* ── LEADERBOARD STAT PILLS ──────────────────────────────── */

/* Points pill: gold gradient on desktop, gold on mobile */
.stat-pill--points {
  background: linear-gradient(135deg, #d8bf7c, #f7f1de 52%, #b89146) !important;
  color: #1a0d00 !important;
  border-color: transparent !important;
  font-weight: 700;
}

/* Win/loss pills: visible on desktop, hidden on mobile */
body.mobile-app .stat-pill--wl {
  display: none !important;
}

/* On mobile, points pill gets gold tint to stand out */
body.mobile-app .stat-pill--points {
  background: linear-gradient(135deg, rgba(216,191,100,0.25), rgba(247,241,222,0.15)) !important;
  border-color: rgba(216,191,124,0.4) !important;
  color: #f7e79a !important;
  font-weight: 700;
}

/* ── RULES PAGE REF TIP ──────────────────────────────────── */
.rules-ref-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(216, 191, 124, 0.1);
  border: 1px solid rgba(216, 191, 124, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: rgba(240, 236, 226, 0.75);
  margin-bottom: 4px;
}
.rules-ref-tip svg {
  stroke: #c9a860;
  flex-shrink: 0;
}
.rules-ref-tip strong {
  color: #f7e79a;
}

/* ── DESKTOP POINTS PILL — compound selector beats all single-class rules ── */
body:not(.mobile-app) .stat-pill.stat-pill--points {
  background: linear-gradient(135deg, #d8bf7c, #f7f1de 52%, #b89146) !important;
  color: #1a0d00 !important;
  border-color: transparent !important;
  font-weight: 700 !important;
}

/* ── HOUSE RULES DROPDOWN GROUPS ────────────────────────── */
.dt-rules-group {
  border: 1px solid rgba(216,191,124,0.18);
  border-radius: 8px;
  margin-bottom: 6px;
}
.dt-rules-group summary {
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #f0ece2;
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(216,191,124,0.07);
  border-radius: 8px;
}
.dt-rules-group[open] summary {
  border-radius: 8px 8px 0 0;
}
.dt-rules-group summary::-webkit-details-marker { display: none; }
.dt-rules-group summary::after {
  content: "›";
  font-size: 1rem;
  opacity: 0.5;
  transition: transform 180ms;
  flex-shrink: 0;
}
.dt-rules-group[open] summary::after { transform: rotate(90deg); }
.dt-rules-group .dt-rule-check {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  font-size: 0.79rem;
  gap: 8px;
  color: #f0ece2;
}

/* ── MOBILE RULES REF TIP — CLEANER LAYOUT ────────────────── */
.rules-ref-tip {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 8px 10px;
  background: rgba(216, 191, 124, 0.08);
  border: 1px solid rgba(216, 191, 124, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.81rem;
  color: rgba(240, 236, 226, 0.72);
  margin-top: 12px;
  margin-bottom: 2px;
  line-height: 1.5;
}
.rules-ref-tip svg {
  stroke: #c9a860;
  flex-shrink: 0;
  margin-top: 2px;
}
.rules-ref-tip strong {
  color: #f7e79a;
  display: block;
  margin-bottom: 2px;
  font-size: 0.86rem;
}



/* ── COUNTDOWN RESET BUTTON (admin only) ─────────────────── */
.dt-cd-reset {
  appearance: none;
  background: transparent;
  border: none;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 140ms;
  padding: 2px 4px;
}
.dt-cd-reset:hover { opacity: 1; }

/* ── NAVBAR RIGHT — UNIFIED DARK GLASS STYLE ────────────── */



/* Sim button — match the same ghost style */
.dt-sim-btn {
  appearance: none;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(240,236,226,0.6);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 140ms, border-color 140ms;
  line-height: 1;
}
.dt-sim-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(216,191,124,0.3);
  color: #f0ece2;
}

/* ── ADMIN CONTROL ROOM BUTTONS ─────────────────────────── */
.dt-admin-action {
  background: rgba(216,191,124,0.1) !important;
  border: 1px solid rgba(216,191,124,0.22) !important;
  color: #f0ece2 !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  border-radius: 10px !important;
  padding: 10px 16px !important;
  min-height: 42px !important;
  box-shadow: none !important;
  transition: background 140ms, border-color 140ms !important;
}
.dt-admin-action:hover {
  background: rgba(216,191,124,0.18) !important;
  border-color: rgba(216,191,124,0.4) !important;
}
.dt-admin-danger {
  background: rgba(180,40,40,0.15) !important;
  border-color: rgba(220,70,60,0.3) !important;
  color: rgba(255,150,130,0.9) !important;
}
.dt-admin-danger:hover {
  background: rgba(180,40,40,0.28) !important;
  border-color: rgba(220,70,60,0.5) !important;
}
.dt-admin-neutral {
  background: rgba(255,255,255,0.06) !important;
  border-color: rgba(255,255,255,0.12) !important;
  color: rgba(240,236,226,0.8) !important;
}
.dt-admin-neutral:hover {
  background: rgba(255,255,255,0.1) !important;
}

/* ── UNIFIED NAVBAR ICON BUTTONS ─────────────────────────── */
.dt-nav-icon-btn {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  cursor: pointer;
  color: rgba(240,236,226,0.55);
  transition: background 140ms, border-color 140ms, color 140ms;
  flex-shrink: 0;
  text-decoration: none;
}
.dt-nav-icon-btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(216,191,124,0.35);
  color: #f0ece2;
}
.dt-nav-icon-btn.active {
  background: rgba(216,191,124,0.12);
  border-color: rgba(216,191,124,0.4);
  color: #c9a860;
}
/* Install App on desktop — force it to match icon button shape */
body:not(.mobile-app) #install-app-btn {
  width: 34px !important;
  height: 34px !important;
  min-height: unset !important;
  padding: 0 !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: rgba(240,236,226,0.55) !important;
}
body:not(.mobile-app) #install-app-btn svg { display: block; }
/* Admin label acts like a button */
.dt-admin-label {
  user-select: none;
}

/* ── ADMIN LEADERBOARD EDIT ──────────────────────────────── */
.leaderboard-edit {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}
.leaderboard-edit input[type="number"] {
  width: 60px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(216,191,124,0.2);
  color: #f0ece2;
  border-radius: 7px;
  padding: 4px 8px;
  font-size: 0.82rem;
  text-align: center;
}
.leaderboard-edit input[type="number"]:focus {
  outline: none;
  border-color: rgba(216,191,124,0.45);
}

/* ── ADMIN ROSTER ROW ────────────────────────────────────── */
.roster-team.admin {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
}

/* ── MERGE PANEL ─────────────────────────────────────────── */
.admin-merge {
  margin-top: 16px;
  padding: 14px;
  background: rgba(216,191,124,0.05);
  border: 1px solid rgba(216,191,124,0.15);
  border-radius: 12px;
}
.admin-merge-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.admin-merge-header h4 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: #f0ece2;
}
.admin-merge-header svg { stroke: #c9a860; flex-shrink: 0; }
.merge-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 12px 0;
  flex-wrap: wrap;
}
.merge-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}
.merge-field label {
  font-size: 0.72rem;
  color: rgba(240,236,226,0.5);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.merge-field select {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(216,191,124,0.2);
  color: #f0ece2;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.82rem;
}
.merge-arrow {
  color: rgba(216,191,124,0.5);
  font-size: 1.1rem;
  padding-bottom: 6px;
  flex-shrink: 0;
}

/* ── ROSTER FORM BUTTONS ─────────────────────────────────── */
.roster-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.roster-actions .btn.small.dt-admin-action,
.roster-actions .btn.small.dt-admin-danger {
  font-size: 0.8rem !important;
  padding: 6px 14px !important;
  min-height: 34px !important;
  border-radius: 8px !important;
}
