/* ============================================
   Naija Math Battle — Complete Stylesheet
   Nigerian Green × Gold × Dark Mode
   ============================================ */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;900&family=Nunito:wght@400;700;800&display=swap');

/* ---- CSS Variables ---- */
:root {
  --bg:          #080e1c;
  --bg-card:     #0f1929;
  --bg-panel:    #162035;
  --bg-light:    #1e2d47;
  --green:       #00c853;
  --green-dark:  #00913c;
  --green-glow:  rgba(0,200,83,.25);
  --gold:        #ffd700;
  --gold-dark:   #e6b800;
  --gold-glow:   rgba(255,215,0,.2);
  --red:         #ff3d5a;
  --blue:        #0095ff;
  --text:        #f0f4ff;
  --text-dim:    #94a3b8;
  --border:      rgba(255,255,255,.08);
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 8px 32px rgba(0,0,0,.5);
  --font-main:   'Outfit', sans-serif;
  --font-num:    'Nunito', sans-serif;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   SCREEN SYSTEM
   ============================================ */
.screen {
  position: fixed; inset: 0;
  overflow-y: auto;
  opacity: 0; pointer-events: none;
  transform: translateY(12px);
  transition: opacity .3s ease, transform .3s ease;
  padding: 1.5rem;
}
.screen.active {
  opacity: 1; pointer-events: all;
  transform: translateY(0);
}
.screen.no-pad { padding: 0; }

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.6rem; border-radius: 50px; border: none; cursor: pointer;
  font-family: var(--font-main); font-weight: 700; font-size: 1rem;
  transition: all .2s ease; text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.96); }

.btn-primary {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff; box-shadow: 0 4px 20px var(--green-glow);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 6px 28px var(--green-glow); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #000; box-shadow: 0 4px 20px var(--gold-glow);
}
.btn-ghost {
  background: var(--border); color: var(--text);
  border: 1px solid rgba(255,255,255,.15);
}
.btn-ghost:hover { background: var(--bg-panel); }

.btn-xl  { font-size: 1.1rem; padding: .9rem 2rem; }
.btn-sm  { font-size: .85rem; padding: .45rem 1rem; }
.btn-full { width: 100%; }

.btn-google {
  background: #ffffff;
  color: #1f1f1f;
  border: 1px solid #dadce0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  font-weight: 700;
  gap: .65rem;
  padding: .75rem 1.4rem;
}
.btn-google:hover {
  background: #f8f9fa;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}
.google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: block;
}

/* ---- Guest Button & Outline Gold ---- */
.btn-guest {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 215, 0, 0.06));
  color: var(--gold);
  border: 1.5px solid var(--gold);
  box-shadow: 0 4px 20px var(--gold-glow);
}
.btn-guest:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.32), rgba(255, 215, 0, 0.15));
  box-shadow: 0 6px 28px rgba(255, 215, 0, 0.38);
  transform: translateY(-1px);
}

.btn-outline-gold {
  background: rgba(255, 215, 0, 0.08);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.4);
}
.btn-outline-gold:hover {
  background: rgba(255, 215, 0, 0.18);
  border-color: var(--gold);
  box-shadow: 0 4px 16px var(--gold-glow);
}

/* ---- Guest Auth Callout ---- */
.guest-auth-callout {
  background: linear-gradient(135deg, rgba(255,215,0,0.07), rgba(0,200,83,0.04));
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.guest-callout-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.guest-callout-icon {
  font-size: 1.6rem;
  line-height: 1;
}
.guest-callout-content h4 {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 0.2rem;
}
.guest-callout-content p {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.35;
}

/* ---- Home Guest Banner & Badge ---- */
.guest-banner {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.14), rgba(22, 32, 53, 0.95));
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.guest-banner-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.guest-banner-icon {
  font-size: 1.9rem;
  flex-shrink: 0;
}
.guest-banner-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--gold);
  font-weight: 800;
}
.guest-banner-text p {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 0.15rem;
  line-height: 1.3;
}
.badge-guest {
  background: rgba(255, 215, 0, 0.16);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 0.2rem;
}

/* ---- Results Screen Guest Card ---- */
.result-guest-cta {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(15, 25, 41, 0.95));
  border: 1.5px solid rgba(255, 215, 0, 0.4);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  width: 100%;
  margin-bottom: 0.5rem;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
}
.guest-cta-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.18);
  border: 1px solid rgba(255, 215, 0, 0.35);
  padding: 0.25rem 0.85rem;
  border-radius: 50px;
  margin-bottom: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.guest-cta-title {
  font-size: 1.2rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.35rem;
}
.guest-cta-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.45;
  margin-bottom: 1.1rem;
}
.guest-cta-desc strong {
  color: var(--gold);
}

/* ---- Leaderboard Guest Notice ---- */
.lb-guest-notice {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(22, 32, 53, 0.6));
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  font-size: 0.85rem;
  color: var(--text);
}
.lb-guest-notice span {
  color: var(--text-dim);
  line-height: 1.35;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 1.25rem 0;
  color: var(--text-dim);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  padding: 0 .8rem;
}

.btn-back {
  display: inline-flex; align-items: center; gap:.4rem;
  background: none; border: none; color: var(--text-dim);
  font-family: var(--font-main); font-size: .95rem; cursor: pointer;
  margin-bottom: 1.2rem; transition: color .2s;
}
.btn-back:hover { color: var(--text); }

/* ============================================
   SPLASH SCREEN
   ============================================ */
#screen-splash { padding: 0; }
.splash-hero { position: relative; width: 100%; height: 100vh; }
.hero-img {
  width: 100%; height: 100%; object-fit: cover;
  filter: brightness(.55) saturate(1.2);
}
.hero-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(to top, rgba(8,14,28,.95) 30%, transparent 70%);
}
.hero-content { text-align: center; padding: 2rem; max-width: 520px; }
.logo-badge {
  font-size: 3.5rem; display: block; margin-bottom: .5rem;
  animation: float 3s ease-in-out infinite;
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.game-title {
  font-size: clamp(2.4rem, 8vw, 4rem);
  font-weight: 900; color: #fff;
  text-shadow: 0 0 40px var(--green-glow), 0 2px 8px rgba(0,0,0,.8);
  background: linear-gradient(135deg, #fff 30%, var(--gold));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  line-height: 1.1;
}
.game-tagline {
  color: var(--text-dim); font-size: 1.15rem; margin: .8rem 0 2rem;
  font-weight: 600;
}
.splash-btns { display: flex; flex-direction: column; gap: .8rem; align-items: center; }

/* ============================================
   AUTH
   ============================================ */
.auth-container {
  max-width: 420px; margin: 3rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px; padding: 2.5rem;
  box-shadow: var(--shadow);
}
.auth-logo {
  text-align: center; margin-bottom: 1.8rem;
}
.auth-logo .flag { font-size: 2.5rem; }
.auth-logo h2 { font-weight: 900; font-size: 1.4rem; color: var(--gold); }
.auth-tabs {
  display: flex; gap: .5rem; background: var(--bg); border-radius: 12px;
  padding: .35rem; margin-bottom: 1.8rem;
}
.tab-btn {
  flex: 1; padding: .6rem; border: none; border-radius: 9px;
  background: none; color: var(--text-dim); font-family: var(--font-main);
  font-weight: 700; cursor: pointer; transition: all .2s;
}
.tab-btn.active { background: var(--green); color: #fff; }

.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.input-group { display: flex; flex-direction: column; gap: .4rem; }
.input-group label { font-size: .85rem; color: var(--text-dim); font-weight: 600; }
.input-group input, .select-input {
  background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .75rem 1rem;
  color: var(--text); font-family: var(--font-main); font-size: 1rem;
  transition: border-color .2s, box-shadow .2s;
}
.input-group input:focus, .select-input:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-glow);
}

/* ============================================
   CHARACTER SELECT
   ============================================ */
.char-select-container {
  max-width: 700px; margin: 0 auto; text-align: center;
}
.screen-header { margin-bottom: 1.5rem; }
.screen-header h2 { font-size: 1.8rem; font-weight: 900; }
.screen-header p  { color: var(--text-dim); }

.char-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 1rem; margin: 1.5rem auto; max-width: 600px;
}
.char-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 1rem .8rem;
  cursor: pointer; transition: all .25s ease;
  display: flex; flex-direction: column; align-items: center; gap: .6rem;
}
.char-card:hover { border-color: var(--green); transform: translateY(-3px); }
.char-card.selected {
  border-color: var(--gold); background: var(--bg-panel);
  box-shadow: 0 0 0 2px var(--gold), 0 8px 24px var(--gold-glow);
}
.char-avatar-img {
  width: 100%; aspect-ratio: 1/1.2;
  background-size: 300% 100%; border-radius: 10px;
  background-repeat: no-repeat;
}
.char-card-name { font-weight: 700; font-size: .95rem; }

/* Small char grid (local setup) */
.char-grid-small {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .5rem; margin: .8rem 0;
}
.char-card-sm {
  background: var(--bg-panel); border: 2px solid var(--border);
  border-radius: 10px; padding: .5rem;
  cursor: pointer; transition: all .2s; text-align: center;
  font-size: .8rem; font-weight: 700;
}
.char-card-sm:hover    { border-color: var(--green); }
.char-card-sm.selected { border-color: var(--gold); }
.char-avatar-sm {
  width: 100%; aspect-ratio: 1/1.1;
  background-size: 300% 100%; border-radius: 6px;
  background-repeat: no-repeat; margin-bottom: .3rem;
}

/* ============================================
   HOME DASHBOARD
   ============================================ */
.home-container { max-width: 680px; margin: 0 auto; }
.home-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.2rem;
}
.home-logo { font-size: 1.4rem; font-weight: 900; color: var(--gold); }
.home-logo span { color: var(--text); }
.home-user {
  display: flex; align-items: center; gap: .5rem;
  background: var(--bg-card); padding: .4rem .9rem .4rem .4rem;
  border-radius: 50px; cursor: pointer; border: 1px solid var(--border);
  transition: border-color .2s;
}
.home-user:hover { border-color: var(--green); }
.mini-char {
  width: 36px; height: 36px; border-radius: 50%;
  background-size: 300% 100%; background-repeat: no-repeat;
}

.stats-bar {
  display: flex; gap: .8rem; margin-bottom: 1.5rem;
}
.stat-pill {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .8rem;
  display: flex; align-items: center; gap: .7rem;
}
.stat-icon { font-size: 1.5rem; }
.stat-pill strong { display: block; font-size: 1.3rem; font-weight: 800; color: var(--gold); }
.stat-pill small  { font-size: .75rem; color: var(--text-dim); }

.welcome-msg { margin-bottom: 1.8rem; }
.welcome-msg h1 { font-size: 1.6rem; font-weight: 900; }
.welcome-msg h1 span { color: var(--green); }
.welcome-msg p { color: var(--text-dim); margin-top: .3rem; }

.mode-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1rem; margin-bottom: 1.5rem;
}
.mode-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.3rem 1rem;
  cursor: pointer; transition: all .25s ease; text-align: center;
}
.mode-card:hover {
  border-color: var(--green); transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--green-glow);
}
.mode-icon { font-size: 2.2rem; margin-bottom: .5rem; }
.mode-card h3 { font-weight: 800; font-size: 1rem; margin-bottom: .3rem; }
.mode-card p  { font-size: .82rem; color: var(--text-dim); margin-bottom: .6rem; }
.mode-tag {
  display: inline-block; padding: .2rem .7rem;
  background: var(--bg-light); border-radius: 50px;
  font-size: .75rem; color: var(--green); font-weight: 700;
}
.logout-btn { display: block; margin: 0 auto; }

/* ============================================
   SETUP SCREENS
   ============================================ */
.setup-container { max-width: 520px; margin: 0 auto; }
.setup-title {
  font-size: 1.5rem; font-weight: 900; margin-bottom: .5rem;
  display: flex; align-items: center; gap: .5rem;
}
.setup-section { margin: 1.2rem 0; }
.setup-section h4 {
  font-size: .9rem; color: var(--text-dim);
  font-weight: 700; margin-bottom: .6rem; text-transform: uppercase; letter-spacing: .05em;
}
.setup-section input[type="text"] {
  width: 100%; background: var(--bg-panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .65rem .9rem;
  color: var(--text); font-family: var(--font-main); font-size: 1rem; margin-bottom: .5rem;
}
.toggle-group { display: flex; flex-wrap: wrap; gap: .5rem; }

.op-btn, .diff-btn, .qtype-btn {
  padding: .5rem 1rem; border-radius: 50px; border: 2px solid var(--border);
  background: var(--bg-panel); color: var(--text-dim);
  font-family: var(--font-main); font-weight: 700; font-size: .85rem;
  cursor: pointer; transition: all .2s;
}
.op-btn:hover, .diff-btn:hover, .qtype-btn:hover { border-color: var(--green); color: var(--text); }
.op-btn.active, .diff-btn.active, .qtype-btn.active {
  background: var(--green); border-color: var(--green); color: #fff;
  box-shadow: 0 2px 12px var(--green-glow);
}
.select-input {
  width: 100%; padding: .65rem .9rem; border-radius: var(--radius-sm);
  background: var(--bg-panel); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font-main); font-size: 1rem;
}

/* ============================================
   WAITING ROOM
   ============================================ */
.waiting-container {
  max-width: 400px; margin: 4rem auto;
  text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
}
.waiting-icon { font-size: 4rem; animation: spin 2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.waiting-container h2 { font-size: 1.4rem; font-weight: 900; }
.waiting-container p  { color: var(--text-dim); }

.room-code-display {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.2rem 2rem;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.code-label { font-size: .8rem; color: var(--text-dim); font-weight: 600; text-transform: uppercase; }
.code-value {
  font-family: var(--font-num); font-size: 2rem; font-weight: 800;
  color: var(--gold); letter-spacing: .1em;
}
.waiting-dots { display: flex; gap: .5rem; }
.waiting-dots span {
  width: 10px; height: 10px; border-radius: 50%; background: var(--green);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
.waiting-dots span:nth-child(2) { animation-delay: .2s; }
.waiting-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes pulse-dot {
  0%,100% { opacity: .3; transform: scale(.8); }
  50%      { opacity: 1;  transform: scale(1.2); }
}

/* ============================================
   ONLINE ROOM / SEARCH
   ============================================ */
.room-container { max-width: 520px; margin: 0 auto; }
.room-container h2 { font-size: 1.6rem; font-weight: 900; margin-bottom: .5rem; }
.sub-text { color: var(--text-dim); margin-bottom: 1.5rem; font-size: .95rem; }

.room-options { display: flex; flex-direction: column; gap: 1rem; }
.room-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
  cursor: pointer; transition: all .2s;
}
.room-card:hover { border-color: var(--green); }
.room-icon { font-size: 1.8rem; display: block; margin-bottom: .5rem; }
.room-card h3 { font-weight: 800; margin-bottom: .3rem; }
.room-card p  { color: var(--text-dim); font-size: .9rem; }

.search-box { display: flex; flex-direction: column; gap: .8rem; }
.search-box input {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .8rem 1.2rem;
  color: var(--text); font-family: var(--font-main); font-size: 1.1rem; width: 100%;
}
.search-box input:focus { outline: none; border-color: var(--green); }

/* ============================================
   GAME SCREEN — SHARED
   ============================================ */
#screen-game {
  background: var(--bg);
  overflow-y: auto !important;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Countdown Overlay */
.countdown-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,14,28,.85); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.countdown-overlay.show { opacity: 1; pointer-events: all; }
.countdown-num {
  font-size: 8rem; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 60px var(--gold-glow);
  animation: pulse-big .9s ease-in-out;
}
@keyframes pulse-big {
  0%   { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

/* ============================================
   TUG OF WAR ARENA & DRAGGING RIG
   ============================================ */
.tug-arena {
  position: relative;
  width: 100%;
  height: 155px;
  background: radial-gradient(ellipse at 50% 120%, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  user-select: none;
}

.online-tug-arena {
  height: 165px;
  margin: 0.2rem 0;
}

/* Ground Pitch & Hazard Center Line */
.tug-pitch {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 38px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-top: 2px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  overflow: visible;
}

/* Territory Zones on Ground Pitch */
.pitch-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  pointer-events: none;
  opacity: 0.75;
  transition: all 0.3s ease;
}
.zone-left {
  background: linear-gradient(90deg, rgba(0, 200, 83, 0.18) 0%, transparent 100%);
  border-right: 1px dashed rgba(255, 255, 255, 0.15);
}
.zone-right {
  background: linear-gradient(270deg, rgba(255, 61, 90, 0.18) 0%, transparent 100%);
  border-left: 1px dashed rgba(255, 255, 255, 0.15);
}
.zone-tag {
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
}

/* Center Hazard Demarcation Line & Border */
.pitch-center-pit {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 90px;
  height: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}
.pitch-center-pit .pit-line {
  position: absolute;
  top: -125px;
  bottom: 0;
  width: 3px;
  background: repeating-linear-gradient(
    180deg,
    var(--gold),
    var(--gold) 8px,
    #000 8px,
    #000 16px
  );
  box-shadow: 0 0 10px var(--gold-glow);
  opacity: 0.7;
}
.pitch-center-pit .pit-hazard {
  position: relative;
  z-index: 1;
  font-size: 0.65rem;
  font-weight: 900;
  color: var(--gold);
  background: rgba(15, 25, 41, 0.95);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  border: 1px solid var(--gold);
  white-space: nowrap;
  letter-spacing: 0.5px;
  animation: pulse-glow 1.5s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.7; transform: scale(0.95); }
  50% { opacity: 1; transform: scale(1.1); filter: drop-shadow(0 0 6px var(--gold)); }
}

/* The Realistic Rope Track */
.tug-rope-track {
  position: absolute;
  top: 68px;
  left: 20px;
  right: 20px;
  height: 16px;
  z-index: 2;
  display: flex;
  align-items: center;
}

.tug-rope-line {
  position: relative;
  width: 100%;
  height: 10px;
  background: repeating-linear-gradient(
    -45deg,
    #8B5A2B,
    #8B5A2B 7px,
    #d4a017 7px,
    #d4a017 13px,
    #A0522D 13px,
    #A0522D 17px
  );
  border-radius: 5px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 1px 2px rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease-out;
}

/* Rope Marker / Knotted Flag */
.rope-marker {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: left 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
  z-index: 5;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.7));
}
.rope-marker .flag-icon {
  font-size: 1.45rem;
  line-height: 1;
  animation: flag-flutter 1.2s ease-in-out infinite;
  display: inline-block;
}
.rope-marker .knot-ribbon {
  width: 14px;
  height: 16px;
  background: #ff3344;
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(255, 51, 68, 0.8);
  margin-top: -3px;
}
@keyframes flag-flutter {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-10deg) scale(1.08); }
}

.rope-marker.flash-left {
  animation: flash-left-jerk 0.5s ease-out;
}
.rope-marker.flash-right {
  animation: flash-right-jerk 0.5s ease-out;
}
@keyframes flash-left-jerk {
  0% { transform: translate(-50%, -50%) translateX(0); }
  30% { transform: translate(-50%, -50%) translateX(-14px) scale(1.2); }
  60% { transform: translate(-50%, -50%) translateX(-6px); }
  100% { transform: translate(-50%, -50%) translateX(0); }
}
@keyframes flash-right-jerk {
  0% { transform: translate(-50%, -50%) translateX(0); }
  30% { transform: translate(-50%, -50%) translateX(14px) scale(1.2); }
  60% { transform: translate(-50%, -50%) translateX(6px); }
  100% { transform: translate(-50%, -50%) translateX(0); }
}

/* Characters Row */
.tug-characters {
  position: relative;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tug-puller {
  position: absolute;
  bottom: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 3;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  --puller-color: var(--green);
}

.left-puller {
  left: 2%;
}
.left-puller .puller-char-wrap {
  transform: scaleX(-1);
}

.right-puller {
  right: 4px;
  --puller-color: var(--red);
}
.right-puller .puller-char-wrap {
  transform: scaleX(1);
}

/* Comic Speech Bubble on Strain / Pull */
.puller-shout {
  position: absolute;
  top: -26px;
  background: #ffffff;
  color: #0f172a;
  font-family: var(--font-num);
  font-weight: 900;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px) scale(0.7);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10;
}
.puller-shout.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.puller-char-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform-origin: bottom center;
}

/* Real Human Nigerian Puller Image */
.puller-human-img {
  height: 98px;
  width: auto;
  max-width: 125px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
  display: block;
  user-select: none;
  transition: filter 0.3s ease;
}

/* Badge / Name row under feet */
.puller-badge-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
  background: rgba(8, 14, 28, 0.85);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.puller-avatar-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--puller-color);
  background-size: 300% 100%;
  background-repeat: no-repeat;
  background-color: var(--bg-card);
  flex-shrink: 0;
}

.puller-name {
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffffff;
  max-width: 75px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sweat Particle */
.puller-sweat {
  position: absolute;
  top: 2px;
  right: 12px;
  font-size: 1.1rem;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.25s ease;
  z-index: 5;
}

/* Dust Puff FX under feet */
.puller-dust {
  position: absolute;
  bottom: 16px;
  width: 28px;
  height: 12px;
  background: radial-gradient(ellipse at 50% 50%, rgba(200, 160, 100, 0.55), transparent 70%);
  opacity: 0;
  border-radius: 50%;
  pointer-events: none;
}

/* ============================================
   REALISTIC TUG & DRAGGING ANIMATIONS
   ============================================ */

/* 1. Neutral Idle Strain */
.left-puller .puller-char-wrap {
  animation: tug-lean-left 1.4s ease-in-out infinite alternate;
}
.right-puller .puller-char-wrap {
  animation: tug-lean-right 1.4s ease-in-out infinite alternate;
}
@keyframes tug-lean-left {
  0%   { transform: scaleX(-1) rotate(0deg) translateY(0); }
  100% { transform: scaleX(-1) rotate(4deg) translateY(-1px); }
}
@keyframes tug-lean-right {
  0%   { transform: scaleX(1) rotate(0deg) translateY(0); }
  100% { transform: scaleX(1) rotate(-4deg) translateY(-1px); }
}

/* 2. PULLING HARD (When winning / pulling) */
.left-puller.pulling-hard .puller-char-wrap {
  animation: pull-heave-left 0.65s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite !important;
  filter: drop-shadow(0 0 10px var(--puller-color));
}
.right-puller.pulling-hard .puller-char-wrap {
  animation: pull-heave-right 0.65s cubic-bezier(0.36, 0.07, 0.19, 0.97) infinite !important;
  filter: drop-shadow(0 0 10px var(--puller-color));
}
@keyframes pull-heave-left {
  0%, 100% { transform: scaleX(-1) rotate(4deg) translateX(0); }
  50%      { transform: scaleX(-1) rotate(14deg) translateX(6px); }
}
@keyframes pull-heave-right {
  0%, 100% { transform: scaleX(1) rotate(-4deg) translateX(0); }
  50%      { transform: scaleX(1) rotate(-14deg) translateX(-6px); }
}

/* 3. BEING DRAGGED (When losing ground / slipping towards center) */
.left-puller.being-dragged .puller-char-wrap {
  animation: dragged-slip-left 0.4s ease-in-out infinite alternate !important;
}
.right-puller.being-dragged .puller-char-wrap {
  animation: dragged-slip-right 0.4s ease-in-out infinite alternate !important;
}
@keyframes dragged-slip-left {
  0%   { transform: scaleX(-1) rotate(-4deg) translateY(0); }
  100% { transform: scaleX(-1) rotate(-12deg) translateY(2px) translateX(-4px); }
}
@keyframes dragged-slip-right {
  0%   { transform: scaleX(1) rotate(4deg) translateY(0); }
  100% { transform: scaleX(1) rotate(12deg) translateY(2px) translateX(4px); }
}

.tug-puller.being-dragged .puller-sweat {
  opacity: 1;
  transform: scale(1.1);
  animation: sweat-bob 0.4s ease-in-out infinite alternate;
}
@keyframes sweat-bob {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-4px) scale(1.25); }
}

.tug-puller.being-dragged .puller-dust {
  opacity: 0.8;
  animation: dust-kick 0.4s ease-in-out infinite;
}
@keyframes dust-kick {
  0%   { transform: scale(0.6) translateX(-4px); opacity: 0.2; }
  50%  { transform: scale(1.2) translateX(6px); opacity: 0.8; }
  100% { transform: scale(1.5) translateX(12px); opacity: 0; }
}

/* 4. DRAGGED LOSS (Lost match - fell into center mud pit) */
.left-puller.dragged-loss .puller-char-wrap {
  animation: fallen-slip-left 0.8s forwards !important;
}
.right-puller.dragged-loss .puller-char-wrap {
  animation: fallen-slip-right 0.8s forwards !important;
}
@keyframes fallen-slip-left {
  0%   { transform: scaleX(-1) rotate(0); }
  100% { transform: scaleX(-1) rotate(-50deg) translateY(14px) translateX(-18px); filter: grayscale(0.5); }
}
@keyframes fallen-slip-right {
  0%   { transform: scaleX(1) rotate(0); }
  100% { transform: scaleX(1) rotate(50deg) translateY(14px) translateX(18px); filter: grayscale(0.5); }
}

/* 5. VICTORIOUS (Won the match) */
.left-puller.victorious .puller-char-wrap {
  animation: victory-bounce-left 0.6s ease-in-out infinite alternate !important;
}
.right-puller.victorious .puller-char-wrap {
  animation: victory-bounce-right 0.6s ease-in-out infinite alternate !important;
}
@keyframes victory-bounce-left {
  0%   { transform: scaleX(-1) translateY(0) scale(1); }
  100% { transform: scaleX(-1) translateY(-16px) scale(1.15); filter: drop-shadow(0 0 12px var(--gold)); }
}
@keyframes victory-bounce-right {
  0%   { transform: scaleX(1) translateY(0) scale(1); }
  100% { transform: scaleX(1) translateY(-16px) scale(1.15); filter: drop-shadow(0 0 12px var(--gold)); }
}

/* ---- Keypad (shared) ---- */
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: .5rem; width: 100%;
}
.keypad button {
  aspect-ratio: 1; border: none; border-radius: var(--radius-sm);
  background: var(--bg-light); color: var(--text);
  font-family: var(--font-num); font-size: 1.4rem; font-weight: 800;
  cursor: pointer; transition: all .15s;
  box-shadow: 0 3px 0 rgba(0,0,0,.4);
}
.keypad button:active { transform: translateY(2px); box-shadow: none; }
.keypad button:hover  { background: var(--bg-panel); }
.key-clear  { background: rgba(255,61,90,.15); color: var(--red); }
.key-clear:hover  { background: rgba(255,61,90,.3); }
.key-submit { background: linear-gradient(135deg, var(--green), var(--green-dark)); color: #fff; }
.key-submit:hover { filter: brightness(1.1); }

/* ---- Answer display ---- */
.answer-display {
  width: 100%; text-align: center;
  background: var(--bg-panel); border: 2px solid var(--border);
  border-radius: var(--radius-sm); padding: .6rem;
  color: var(--text); font-family: var(--font-num); font-size: 1.6rem; font-weight: 800;
  pointer-events: none; margin: .4rem 0;
  transition: border-color .2s, box-shadow .2s;
}
.answer-display.correct { border-color: var(--green); box-shadow: 0 0 16px var(--green-glow); }
.answer-display.wrong   { border-color: var(--red);   animation: shake .4s ease; }
@keyframes shake {
  0%,100%{transform:translateX(0)} 20%{transform:translateX(-8px)} 60%{transform:translateX(8px)}
}

/* ---- Timer ---- */
.timer-badge {
  font-family: var(--font-num); font-weight: 800; font-size: 1.1rem; color: var(--green);
}
.timer-badge.timer-urgent { color: var(--red); animation: blink .5s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

.round-label { font-size: .85rem; color: var(--text-dim); font-weight: 700; }

/* ============================================
   LOCAL GAME VIEW
   ============================================ */
.game-local {
  display: flex;
  min-height: 100%;
  height: auto;
  gap: 0;
  overflow: visible;
}
.team-panel {
  flex: 1; display: flex; flex-direction: column; padding: .8rem;
  background: var(--bg-card); gap: .5rem;
  border-right: 1px solid var(--border);
  --team-color: var(--green);
}
.team-panel.team-right { border-right: none; border-left: 1px solid var(--border); }

.team-header {
  display: flex; align-items: center; gap: .5rem;
  padding: .5rem .7rem; border-radius: var(--radius-sm);
  background: var(--team-color); color: #fff;
  font-weight: 800;
}
.team-char-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background-size: 300% 100%; background-repeat: no-repeat;
  border: 2px solid rgba(255,255,255,.3); flex-shrink: 0;
}
.team-score-badge {
  margin-left: auto; background: rgba(0,0,0,.25);
  border-radius: 8px; padding: .1rem .6rem; font-size: 1.2rem; font-family: var(--font-num);
}
.team-right .team-header { flex-direction: row-reverse; }
.team-right .team-header .team-score-badge { margin-left: 0; margin-right: auto; }

.question-box {
  background: var(--bg-panel); border-radius: var(--radius-sm);
  padding: .7rem .5rem; text-align: center;
  font-family: var(--font-num); font-size: clamp(1rem, 3vw, 1.3rem); font-weight: 800;
  color: var(--gold); min-height: 4rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}

.center-panel {
  width: clamp(220px, 25vw, 290px); flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .8rem;
  padding: .8rem .5rem; background: var(--bg);
}
.center-scores {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  font-family: var(--font-num); font-size: 1.8rem; font-weight: 900;
}
.center-info { text-align: center; display: flex; flex-direction: column; gap: .2rem; align-items: center; }
.center-panel .tug-arena { width: 100%; }

/* ============================================
   ONLINE GAME VIEW
   ============================================ */
.game-online {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  height: auto;
  padding: .8rem;
  padding-bottom: max(3.5rem, env(safe-area-inset-bottom, 28px));
  gap: .5rem;
  max-width: 500px;
  margin: 0 auto;
  overflow-y: visible;
}
.online-header {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg-card); border-radius: var(--radius); padding: .7rem 1rem;
  border: 1px solid var(--border);
}
.player-info { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .9rem; }
.online-avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--green);
  background-size: 300% 100%; background-repeat: no-repeat;
}
.opp-side { flex-direction: row-reverse; }
.score-center {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--font-num); font-weight: 900; font-size: 1.5rem;
}
.my-score-val  { color: var(--green); }
.opp-score-val { color: var(--red); }
.score-divider { color: var(--text-dim); font-size: 1rem; }

.online-rope-area,
.online-tug-arena { flex-shrink: 0; }
.online-info-row  { display: flex; justify-content: space-between; align-items: center; padding: .2rem .3rem; }

.online-question-area { text-align: center; padding: .6rem .5rem; }
.question-text {
  font-family: var(--font-num); font-size: clamp(1.4rem, 6vw, 2rem); font-weight: 900;
  color: var(--gold); min-height: 3.5rem;
  display: flex; align-items: center; justify-content: center;
  word-break: break-word; line-height: 1.3;
}
.feedback-text {
  font-size: 1rem; font-weight: 700; height: 1.5rem; margin-top: .2rem;
}

.online-answer { max-width: 100%; }
.online-keypad { flex-shrink: 0; }

/* ============================================
   RESULTS
   ============================================ */
.confetti-canvas {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
}
.results-container {
  max-width: 450px; margin: 4rem auto; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 1.2rem;
  position: relative; z-index: 1;
}
.result-trophy { font-size: 5rem; animation: float 2s ease-in-out infinite; }
#result-title {
  font-size: clamp(1.8rem, 8vw, 2.8rem); font-weight: 900;
  background: linear-gradient(135deg, var(--gold), var(--green));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.result-scores {
  display: flex; align-items: center; gap: 1.5rem;
  background: var(--bg-card); border-radius: var(--radius);
  padding: 1.2rem 2rem; border: 1px solid var(--border); width: 100%;
  justify-content: center;
}
.result-team { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.result-team span:first-child { font-size: .9rem; color: var(--text-dim); font-weight: 700; }
.result-score-val  { font-size: 2.5rem; font-weight: 900; font-family: var(--font-num); color: var(--gold); }
.result-score-label { font-size: .75rem; color: var(--text-dim); }
.result-vs { font-size: 1rem; color: var(--text-dim); font-weight: 800; }
.result-btns { display: flex; flex-direction: column; gap: .7rem; width: 100%; }

/* ============================================
   LEADERBOARD
   ============================================ */
.lb-container { max-width: 500px; margin: 0 auto; }
.lb-container h2 { font-size: 1.6rem; font-weight: 900; margin-bottom: .3rem; }
.lb-list { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }
.lb-row {
  display: flex; align-items: center; gap: .8rem;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .8rem 1rem;
}
.lb-row.lb-me { border-color: var(--gold); }
.lb-rank  { width: 2rem; text-align: center; font-weight: 800; font-size: 1.1rem; }
.lb-char-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.lb-name  { flex: 1; font-weight: 700; font-size: .95rem; }
.lb-wins  { color: var(--green); font-weight: 700; font-size: .9rem; }
.lb-rating { color: var(--gold); font-weight: 800; font-size: .9rem; width: 5rem; text-align: right; }
.loading-text { text-align: center; color: var(--text-dim); padding: 2rem; }

/* ============================================
   CHALLENGE MODAL
   ============================================ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8,14,28,.8); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .3s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 24px; padding: 2.5rem 2rem;
  max-width: 340px; width: 100%; text-align: center;
  box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.modal-icon { font-size: 3rem; }
.modal-card p { font-size: 1.1rem; font-weight: 700; }
.modal-btns { display: flex; gap: .8rem; width: 100%; }
.modal-btns .btn { flex: 1; }

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(100px);
  background: var(--bg-card); color: var(--text);
  padding: .8rem 1.6rem; border-radius: 50px; font-weight: 700;
  box-shadow: 0 8px 32px rgba(0,0,0,.5); border: 1px solid var(--border);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1); z-index: 999;
  white-space: nowrap; max-width: 90vw;
}
.toast.show     { transform: translateX(-50%) translateY(0); }
.toast.success  { border-color: var(--green); box-shadow: 0 4px 20px var(--green-glow); }
.toast.error    { border-color: var(--red);   box-shadow: 0 4px 20px rgba(255,61,90,.3); }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .char-grid { grid-template-columns: repeat(2, 1fr); }
  
  /* Local 2-Player on mobile: stacked layout with smooth vertical scrolling */
  .game-local {
    flex-direction: column;
    height: auto;
    min-height: 100%;
    padding-bottom: max(3.5rem, env(safe-area-inset-bottom, 28px));
    overflow-y: visible;
  }
  .team-panel {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border: none;
    border-bottom: 1px solid var(--border);
    padding: .8rem .6rem;
  }
  .team-panel.team-right {
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .center-panel {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: .6rem .4rem;
  }
  .center-panel .center-scores { font-size: 1.5rem; }
  .game-local .keypad button { aspect-ratio: unset; padding: .65rem .4rem; font-size: 1.15rem; }
  .online-keypad button { padding: .75rem .4rem; font-size: 1.2rem; }
  .question-box { font-size: 1.1rem; min-height: 3.5rem; }
  .stats-bar { gap: .4rem; }
  .stat-pill { padding: .5rem .4rem; gap: .4rem; }
  .stat-pill strong { font-size: 1rem; }
  .guest-banner { flex-direction: column; text-align: center; gap: .7rem; }
  .guest-banner-info { flex-direction: column; gap: .4rem; }
  .lb-guest-notice { flex-direction: column; text-align: center; gap: .6rem; }
}

@media (max-width: 480px) {
  .mode-grid { grid-template-columns: 1fr; }
  .tug-arena { height: 145px; }
  .online-tug-arena { height: 150px; }
  .puller-human-img { height: 86px; max-width: 110px; }
  .tug-rope-track { top: 60px; left: 16px; right: 16px; }
  .question-box { font-size: 1rem; min-height: 3.2rem; }
  .puller-shout { top: -22px; font-size: 0.7rem; padding: 0.15rem 0.4rem; }
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bg-light); border-radius: 4px; }
