/* ============================================================
   Cross Player - Premium Mobile Game UI
   ============================================================ */

:root {
  /* EA / Sports Premium Colors */
  --bg-primary: #0A0D15;
  --bg-secondary: #131826;
  --bg-card: rgba(26, 33, 50, 0.7);
  --bg-elevated: #1F273B;
  --bg-input: rgba(18, 23, 35, 0.8);
  
  --accent-primary: #00FF87;
  --accent-primary-alt: #00D672;
  --accent-primary-shadow: #008746;
  
  --accent-blue: #2DD4BF;
  --accent-blue-alt: #14B8A6;
  --accent-blue-shadow: #0D9488;
  
  --accent-purple: #8B5CF6;
  --accent-purple-alt: #7C3AED;
  --accent-purple-shadow: #5B21B6;
  
  --accent-danger: #F43F5E;
  --accent-danger-alt: #E11D48;
  --accent-danger-shadow: #9F1239;

  --accent-warning: #FBBF24;
  --accent-warning-alt: #F59E0B;
  
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #475569;
  --text-inverse: #020617;
  
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  
  /* Typography */
  --font-display: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  /* Spacing */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  
  --shadow-glow-green: 0 0 20px rgba(0, 255, 135, 0.25);
  --shadow-glow-blue: 0 0 20px rgba(45, 212, 191, 0.25);
  
  --ease-bounce: cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

/* ── Reset & Core ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; overflow: hidden; -webkit-text-size-adjust: 100%; }
body {
  height: 100%;
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 50% 0%, #151C2C 0%, transparent 60%),
    linear-gradient(0deg, rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 100% 100%, 40px 40px, 40px 40px;
  color: var(--text-primary);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  position: fixed;
  width: 100%;
}

#app {
  height: 100dvh;
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

#screen-container { flex: 1; display: flex; flex-direction: column; position: relative; }

/* ── Screens ── */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  opacity: 0; transform: scale(0.98);
  transition: opacity 0.3s ease, transform 0.3s ease;
  padding: 16px;
}
.screen.active { opacity: 1; transform: scale(1); }
.screen.slide-out { opacity: 0; transform: scale(1.02); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; }
.text-accent { color: var(--accent-primary); }
.text-gradient {
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text; 
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.text-sm { font-size: 0.8125rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ============================================================
   3D GAME BUTTONS
   ============================================================ */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 14px; border: none; font-family: var(--font-display);
  font-size: 1rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em;
  cursor: pointer; position: relative; width: 100%; text-decoration: none;
  transition: transform 0.1s ease; outline: none;
}
.btn:active { transform: translateY(4px); }

/* Inner wrapper to handle the top surface of the 3D button */
.btn::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 40%);
  pointer-events: none;
}

.btn-icon-wrap {
  display: flex; align-items: center; justify-content: center;
}

/* Primary (Green) */
.btn-primary {
  background: linear-gradient(180deg, var(--accent-primary) 0%, var(--accent-primary-alt) 100%);
  color: var(--text-inverse);
  box-shadow: 
    0 4px 0 var(--accent-primary-shadow), /* The 3D bottom edge */
    0 8px 16px rgba(0, 255, 135, 0.2), /* Drop shadow */
    inset 0 1px 1px rgba(255,255,255,0.4); /* Inner highlight */
}
.btn-primary:active { box-shadow: 0 0px 0 var(--accent-primary-shadow), inset 0 2px 4px rgba(0,0,0,0.2); }

/* Secondary (Dark Panel) */
.btn-secondary {
  background: linear-gradient(180deg, #2A344A 0%, #1A2132 100%);
  color: #fff; border: 1px solid rgba(255,255,255,0.05);
  box-shadow: 0 4px 0 #0F1420, 0 8px 16px rgba(0,0,0,0.4), inset 0 1px 1px rgba(255,255,255,0.1);
}
.btn-secondary:active { box-shadow: 0 0px 0 #0F1420, inset 0 2px 4px rgba(0,0,0,0.3); }

/* Blue */
.btn-blue {
  background: linear-gradient(180deg, var(--accent-blue) 0%, var(--accent-blue-alt) 100%);
  color: var(--text-inverse);
  box-shadow: 0 4px 0 var(--accent-blue-shadow), 0 8px 16px rgba(45, 212, 191, 0.2), inset 0 1px 1px rgba(255,255,255,0.4);
}
.btn-blue:active { box-shadow: 0 0px 0 var(--accent-blue-shadow), inset 0 2px 4px rgba(0,0,0,0.2); }

/* Green (Success) */
.btn-green {
  background: linear-gradient(180deg, #10B981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 4px 0 #047857, 0 8px 16px rgba(16, 185, 129, 0.2), inset 0 1px 1px rgba(255,255,255,0.3);
}
.btn-green:active { box-shadow: 0 0px 0 #047857, inset 0 2px 4px rgba(0,0,0,0.2); }

.btn-outline {
  background: transparent; color: var(--text-secondary);
  border: 1.5px solid var(--border-light); padding: 14px; border-radius: 12px;
}
.btn-outline:active { background: rgba(255,255,255,0.05); transform: scale(0.98); }

.btn-lg { padding: 18px 24px; font-size: 1.125rem; }
.btn-md { padding: 14px 20px; }

/* ============================================================
   PREMIUM INPUTS
   ============================================================ */
.input {
  width: 100%; background: var(--bg-input); color: #fff;
  border: 1.5px solid var(--border-glass); border-radius: 12px;
  font-family: var(--font-body); font-weight: 500; font-size: 1rem;
  outline: none; transition: all 0.2s ease;
}
.input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.15); }
.input::placeholder { color: var(--text-muted); }

.input-modern { padding: 14px 16px 14px 44px; }
.input-code { padding: 14px; text-transform: uppercase; font-family: var(--font-mono); font-weight: 700; text-align: center; letter-spacing: 2px;}

/* ============================================================
   GAME LAYOUT REPAIRS (Missing Flex/Grid Restored)
   ============================================================ */
.game-scoreboard {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  background: var(--bg-card); border-radius: 20px; padding: 16px 24px;
  margin-bottom: 20px; border: 1px solid var(--border-light);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.score-player { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; overflow: hidden; }
.score-player-name { font-size: 0.85rem; color: var(--text-secondary); white-space: nowrap; text-overflow: ellipsis; max-width: 100%; overflow: hidden; }
.score-player-name.you { color: var(--accent-blue); }
.score-divider { margin-top: 16px; font-weight: 800; opacity: 0.5; }

.round-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 24px; }
.round-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid; opacity: 0.5; transition: all 0.3s ease; }
.round-dot.current { opacity: 1; transform: scale(1.3); border-color: var(--accent-blue); box-shadow: var(--shadow-glow-blue); }
.round-dot.won, .round-dot.lost { opacity: 1; }

.team-pick-container { display: flex; flex-direction: column; height: 100%; gap: 16px; overflow: hidden;}
.league-filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.league-filters::-webkit-scrollbar { display: none; }
.league-filter { padding: 8px 16px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; border: 1px solid; border-color: var(--border-glass); cursor: pointer; display: flex; align-items: center; gap: 6px; }

.team-grid {
  display: flex; flex-direction: column; gap: 10px; overflow-y: auto;
  padding-bottom: 24px; flex: 1; margin-right: -8px; padding-right: 8px;
}
.team-item {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border-radius: 16px; cursor: pointer; border: 1px solid;
  transition: all 0.2s ease; position: relative;
}
.team-colors { display: flex; gap: 4px; }
.team-color-dot { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2); }
.team-check { display: none; color: var(--accent-primary); font-weight: 900; }
.team-item.selected .team-check { display: block; }
.team-item.selected { transform: scale(0.98); }

.answer-container { display: flex; flex-direction: column; height: 100%; justify-content: center; align-items: center; text-align: center; gap: 24px; }
.answer-teams { display: flex; align-items: center; gap: 12px; width: 100%; }
.answer-team-card { flex: 1; background: var(--bg-card); padding: 16px 8px; border-radius: 20px; border: 1px solid var(--border-glass); display: flex; flex-direction: column; align-items: center; }
.answer-team-colors { display: flex; gap: 4px; margin-bottom: 8px; }
.answer-team-color { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 2px 4px rgba(0,0,0,0.5); }
.answer-swap-icon { font-size: 1.5rem; opacity: 0.5; }
.answer-prompt { font-size: 0.95rem; line-height: 1.4; color: var(--text-secondary); }
.answer-input-group { display: flex; flex-direction: column; gap: 12px; width: 100%; margin-top: auto; padding-bottom: 12px;}


/* ============================================================
   HOME SCREEN REWORK
   ============================================================ */
.home-screen {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 40px 20px 20px; min-height: 100%; max-width: 480px; margin: 0 auto;
}

.brand-container { text-align: center; margin-bottom: 32px; animation: float 4s ease-in-out infinite; }
.logo-shield {
  width: 72px; height: 72px; margin: 0 auto 12px;
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-card));
  border: 2px solid var(--border-glass); border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-primary); box-shadow: var(--shadow-glow-green);
  transform: rotate(45deg);
}
.logo-shield svg { transform: rotate(-45deg); }
.home-title { font-size: 2.75rem; line-height: 1; margin-bottom: 6px; color: #fff; }
.home-subtitle { color: var(--text-secondary); font-size: 0.9375rem; font-weight: 500; }

.player-profile-card {
  background: var(--bg-card); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass); border-radius: 20px;
  padding: 20px; width: 100%; margin-bottom: 24px;
}
.input-label { display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 10px; letter-spacing: 0.05em; }
.input-wrapper { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-muted); pointer-events: none; }

.home-actions { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.action-row { display: flex; gap: 12px; }
.action-row .btn { flex: 1; font-size: 0.875rem; padding: 14px 10px; }

.room-options-panel {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border-glass);
  border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px;
  margin-top: 8px; animation: slideDown 0.3s ease;
}
.panel-header { font-size: 0.6875rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; text-align: center; }
.room-code-group { display: flex; gap: 8px; }
.room-code-group .input { flex: 1; }
.room-code-group .btn { width: auto; padding-left: 20px; padding-right: 20px; }

.server-status {
  margin-top: auto; display: flex; align-items: center; gap: 8px;
  background: rgba(0,255,135,0.05); padding: 8px 16px; border-radius: 20px;
  border: 1px solid rgba(0,255,135,0.1);
}
.pulse-dot { width: 8px; height: 8px; background: var(--accent-primary); border-radius: 50%; box-shadow: 0 0 10px var(--accent-primary); animation: pulse-status 2s infinite; }
.status-text { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.status-text strong { color: var(--accent-primary); }

/* ============================================================
   LOBBY SCREEN
   ============================================================ */
.lobby-screen { align-items: center; justify-content: center; gap: 24px; text-align: center; }
.lobby-spinner {
  width: 64px; height: 64px; border: 4px solid var(--border-glass);
  border-top-color: var(--accent-primary); border-radius: 50%; animation: spin 1s linear infinite;
}
.lobby-title { font-size: 1.75rem; color: #fff; }
.lobby-code-value {
  font-family: var(--font-mono); font-size: 2.5rem; font-weight: 800;
  color: var(--accent-primary); background: rgba(0,255,135,0.05);
  padding: 16px 32px; border-radius: 16px; border: 2px dashed rgba(0,255,135,0.2);
  letter-spacing: 0.15em; box-shadow: var(--shadow-glow-green);
}

/* ============================================================
   GAME SCREEN (Updated lightly for theme)
   ============================================================ */
.game-screen { padding: 12px 16px; }
.game-round { font-family: var(--font-mono); font-weight: 700; color: var(--text-secondary); background: var(--bg-card); padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border-glass); }
.score-player-name { font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.score-value { font-family: var(--font-display); font-size: 2.25rem; font-weight: 900; }
.score-divider { color: var(--text-muted); }
.round-dot { background: var(--bg-input); border-color: var(--border-light); }
.round-dot.won { background: var(--accent-primary); border-color: var(--accent-primary); box-shadow: var(--shadow-glow-green); }
.round-dot.lost { background: var(--accent-danger); border-color: var(--accent-danger); box-shadow: 0 0 10px rgba(244,63,94,0.3); }

.team-search-bar .input { background: var(--bg-input); border-color: var(--border-glass); }
.league-filter { background: var(--bg-card); border-color: var(--border-glass); color: var(--text-secondary); }
.league-filter.active { background: rgba(0,255,135,0.1); border-color: var(--accent-primary); color: var(--accent-primary); }
.team-item { background: var(--bg-card); border-color: var(--border-glass); }
.team-item:hover { background: var(--bg-elevated); border-color: var(--border-light); }
.team-item.selected { background: rgba(0,255,135,0.05); border-color: var(--accent-primary); }
.team-name { font-weight: 600; }

.answer-team-card { background: var(--bg-card); border-color: var(--border-glass); }
.answer-team-name { font-weight: 800; font-size: 1rem; }
.answer-input-group .input { font-size: 1.125rem; text-align: center; }

/* TIMER SVG */
/* MISC */
.toast { background: var(--bg-elevated); border-color: var(--border-glass); color: #fff; }
.result-round-item { background: var(--bg-card); border: 1px solid var(--border-glass); }
.result-score { font-size: 4rem; }

/* ============================================================
   ANIMATIONS 
   ============================================================ */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse-status { 0% { opacity: 0.5; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0.5; transform: scale(0.8); } }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 0 0 rgba(45,212,191,0.4); } 50% { box-shadow: 0 0 0 6px rgba(45,212,191,0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes bounce-in { 0% { opacity: 0; transform: scale(0.5); } 60% { transform: scale(1.1); } 100% { opacity: 1; transform: scale(1); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes score-pop { 0% { transform: scale(1); } 50% { transform: scale(1.4); } 100% { transform: scale(1); } }

@keyframes popIn { 0% { transform: scale(0.5); opacity: 0; } 70% { transform: scale(1.1); } 100% { transform: scale(1); opacity: 1; } }
