/* ===== BRAINBATTLE QUIZ — ESTILOS PRINCIPALES ===== */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
  --primary: #6c47ff;
  --primary-dark: #5035cc;
  --secondary: #ff6b35;
  --gold: #ffd700;
  --green: #00c853;
  --red: #ff3d3d;
  --bg: #0a0a1a;
  --bg2: #12122a;
  --bg3: #1a1a3a;
  --card: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.1);
  --text: #ffffff;
  --text2: rgba(255,255,255,0.6);
  --text3: rgba(255,255,255,0.35);
  --radius: 16px;
  --shadow: 0 8px 32px rgba(0,0,0,0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body { font-family: 'Nunito', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; }

/* SCREENS */
.screen { display: none; position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; }
.screen.active { display: block; }

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* TOAST */
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: rgba(20,20,40,0.95); color: #fff; border-radius: 24px; padding: 10px 22px; font-size: 14px; font-weight: 700; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 9999; white-space: nowrap; max-width: 90vw; border: 1px solid var(--border); }
.toast.show { opacity: 1; }

/* LOADER */
.loader { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; z-index: 99999; }
.loader-logo { font-size: 42px; font-weight: 900; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.loader-bar { width: 200px; height: 4px; background: var(--border); border-radius: 4px; overflow: hidden; }
.loader-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 4px; animation: loading 1.5s ease-in-out infinite; }
@keyframes loading { 0% { width: 0%; } 50% { width: 70%; } 100% { width: 100%; } }

/* BUTTONS */
.btn { border: none; border-radius: var(--radius); padding: 14px 24px; font-size: 15px; font-weight: 800; cursor: pointer; transition: all 0.2s; width: 100%; font-family: 'Nunito', sans-serif; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 4px 20px rgba(108,71,255,0.4); }
.btn-primary:active { transform: scale(0.97); }
.btn-secondary { background: var(--card); color: var(--text); border: 1.5px solid var(--border); }
.btn-gold { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #000; }
.btn-danger { background: linear-gradient(135deg, #ff3d3d, #cc0000); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; width: auto; }

/* INPUTS */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 13px; font-weight: 700; color: var(--text2); }
.input { background: var(--card); border: 1.5px solid var(--border); border-radius: 12px; padding: 14px 16px; font-size: 15px; color: var(--text); font-family: 'Nunito', sans-serif; width: 100%; transition: border-color 0.2s; }
.input:focus { outline: none; border-color: var(--primary); }
.input::placeholder { color: var(--text3); }

/* CARDS */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

/* NAV */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(10,10,26,0.95); backdrop-filter: blur(20px); border-top: 1px solid var(--border); display: flex; padding: 8px 0 20px; z-index: 100; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; color: var(--text3); background: none; border: none; cursor: pointer; padding: 4px; transition: color 0.2s; font-family: 'Nunito', sans-serif; }
.nav-btn.active { color: var(--primary); }
.nav-btn svg { width: 22px; height: 22px; }

/* ===== AUTH SCREEN ===== */
.auth-bg { min-height: 100vh; background: linear-gradient(160deg, #0a0a1a 0%, #1a0a3a 50%, #0a1a2a 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; position: relative; overflow: hidden; }
.auth-bg::before { content: ''; position: absolute; top: -100px; right: -100px; width: 400px; height: 400px; background: radial-gradient(circle, rgba(108,71,255,0.2) 0%, transparent 70%); }
.auth-bg::after { content: ''; position: absolute; bottom: -100px; left: -100px; width: 300px; height: 300px; background: radial-gradient(circle, rgba(255,107,53,0.15) 0%, transparent 70%); }
.auth-logo { font-size: 38px; font-weight: 900; background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.7) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 4px; }
.auth-logo span { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-subtitle { font-size: 14px; color: var(--text2); margin-bottom: 32px; }
.auth-card { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 24px; padding: 28px 24px; width: 100%; max-width: 400px; backdrop-filter: blur(20px); position: relative; z-index: 1; }
.auth-tabs { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 24px; }
.auth-tab { flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 700; color: var(--text2); cursor: pointer; border-radius: 10px; transition: all 0.2s; border: none; background: none; font-family: 'Nunito', sans-serif; }
.auth-tab.active { background: var(--primary); color: #fff; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-divider { text-align: center; color: var(--text3); font-size: 12px; margin: 4px 0; }
.lang-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.lang-btn { flex: 1; min-width: 60px; padding: 10px 8px; background: var(--card); border: 1.5px solid var(--border); border-radius: 10px; color: var(--text2); font-size: 13px; font-weight: 700; cursor: pointer; text-align: center; transition: all 0.2s; font-family: 'Nunito', sans-serif; }
.lang-btn.active { border-color: var(--primary); color: var(--primary); background: rgba(108,71,255,0.1); }

/* ===== HOME SCREEN ===== */
.home-bg { min-height: 100vh; background: linear-gradient(180deg, #0f0f2a 0%, #0a0a1a 100%); padding: 0 0 90px; }
.home-header { display: flex; justify-content: space-between; align-items: center; padding: 50px 20px 20px; }
.home-logo { font-size: 22px; font-weight: 900; }
.home-logo span { background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.coins-badge { display: flex; align-items: center; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 14px; font-weight: 800; }
.hero-banner { margin: 0 16px 20px; background: linear-gradient(135deg, var(--primary), var(--secondary)); border-radius: 20px; padding: 20px; position: relative; overflow: hidden; }
.hero-banner::after { content: '🧠'; position: absolute; right: -10px; top: -10px; font-size: 80px; opacity: 0.2; }
.hero-title { font-size: 22px; font-weight: 900; color: #fff; margin-bottom: 4px; }
.hero-sub { font-size: 13px; color: rgba(255,255,255,0.8); margin-bottom: 16px; }
.hero-btn { background: #fff; color: var(--primary); border: none; border-radius: 12px; padding: 12px 24px; font-size: 15px; font-weight: 800; cursor: pointer; font-family: 'Nunito', sans-serif; }
.section-title { font-size: 13px; font-weight: 800; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; padding: 0 20px 12px; }
.modes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 20px; }
.mode-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 18px 14px; cursor: pointer; transition: all 0.2s; position: relative; overflow: hidden; }
.mode-card:active { transform: scale(0.97); }
.mode-card.featured { border-color: var(--primary); background: rgba(108,71,255,0.1); }
.mode-emoji { font-size: 32px; margin-bottom: 10px; }
.mode-name { font-size: 15px; font-weight: 800; color: #fff; margin-bottom: 2px; }
.mode-desc { font-size: 11px; color: var(--text3); }
.mode-badge { position: absolute; top: 10px; right: 10px; background: var(--primary); color: #fff; font-size: 9px; font-weight: 800; border-radius: 8px; padding: 2px 8px; }
.streak-bar { margin: 0 16px 20px; background: linear-gradient(135deg, #ff6b35, #ff3d3d); border-radius: 16px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; }
.streak-info h3 { font-size: 15px; font-weight: 800; color: #fff; }
.streak-info p { font-size: 12px; color: rgba(255,255,255,0.7); }
.streak-num { font-size: 36px; font-weight: 900; color: #fff; }

/* ===== GAME SCREEN ===== */
.game-bg { min-height: 100vh; background: linear-gradient(180deg, #0f0f2a 0%, #0a0a1a 100%); padding: 0 0 20px; }
.game-header { display: flex; align-items: center; justify-content: space-between; padding: 50px 16px 16px; gap: 12px; }
.back-btn { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 700; color: var(--text2); cursor: pointer; font-family: 'Nunito', sans-serif; }
.timer-box { background: var(--primary); color: #fff; font-size: 18px; font-weight: 900; border-radius: 12px; padding: 6px 16px; min-width: 52px; text-align: center; transition: background 0.3s; }
.timer-box.urgent { background: var(--red); animation: pulse 0.5s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.progress-bar { height: 4px; background: var(--border); margin: 0 16px 20px; border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 4px; transition: width 0.4s; }
.question-card { margin: 0 16px 20px; background: var(--card); border: 1px solid var(--border); border-radius: 20px; padding: 24px 20px; }
.question-category { font-size: 11px; font-weight: 800; color: var(--primary); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
.question-text { font-size: 17px; font-weight: 700; color: #fff; line-height: 1.5; }
.options { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.option-btn { background: var(--card); border: 1.5px solid var(--border); border-radius: 14px; padding: 15px 16px; font-size: 15px; font-weight: 600; color: #fff; cursor: pointer; text-align: left; display: flex; align-items: center; gap: 14px; transition: all 0.15s; width: 100%; font-family: 'Nunito', sans-serif; line-height: 1.4; }
.option-btn:active:not(:disabled) { transform: scale(0.98); }
.option-btn.correct { border-color: var(--green); background: rgba(0,200,83,0.15); }
.option-btn.wrong { border-color: var(--red); background: rgba(255,61,61,0.15); }
.opt-letter { font-weight: 900; color: var(--primary); min-width: 26px; height: 26px; background: rgba(108,71,255,0.15); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; }
.option-btn.correct .opt-letter { color: var(--green); background: rgba(0,200,83,0.15); }
.option-btn.wrong .opt-letter { color: var(--red); background: rgba(255,61,61,0.15); }
.lives-bar { display: flex; gap: 6px; align-items: center; justify-content: center; padding: 0 0 16px; }

/* ===== RESULT SCREEN ===== */
.result-bg { min-height: 100vh; background: linear-gradient(160deg, #0f0f2a 0%, #0a0a1a 100%); padding: 0 16px 30px; display: flex; flex-direction: column; gap: 16px; }
.result-header { display: flex; justify-content: space-between; align-items: center; padding: 50px 0 0; }
.result-emoji { font-size: 64px; text-align: center; }
.result-score { text-align: center; font-size: 64px; font-weight: 900; background: linear-gradient(135deg, var(--gold), #ffaa00); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1; }
.result-msg { text-align: center; font-size: 22px; font-weight: 800; color: #fff; }
.result-sub { text-align: center; font-size: 14px; color: var(--text2); }
.stats-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; text-align: center; }
.stat-num { font-size: 24px; font-weight: 900; color: #fff; }
.stat-lbl { font-size: 11px; color: var(--text3); font-weight: 700; margin-top: 2px; }
.rewards-card { background: linear-gradient(135deg, rgba(108,71,255,0.2), rgba(255,107,53,0.1)); border: 1px solid var(--primary); border-radius: 16px; padding: 16px; display: flex; justify-content: space-around; }
.reward-item { text-align: center; }
.reward-num { font-size: 22px; font-weight: 900; color: var(--gold); }
.reward-lbl { font-size: 11px; color: var(--text2); font-weight: 700; }

/* ===== MULTIPLAYER ===== */
.waiting-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60vh; gap: 20px; padding: 20px; }
.waiting-spinner { width: 60px; height: 60px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.players-lobby { display: flex; flex-direction: column; gap: 10px; padding: 0 16px; }
.lobby-player { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.lobby-avatar { font-size: 28px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--bg3); border-radius: 12px; }
.lobby-name { font-size: 15px; font-weight: 700; }
.lobby-level { font-size: 12px; color: var(--text3); }
.lobby-ready { margin-left: auto; font-size: 20px; }
.vs-badge { text-align: center; font-size: 28px; font-weight: 900; color: var(--primary); padding: 10px; }
.score-live { display: flex; justify-content: space-around; margin: 0 16px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
.score-player { text-align: center; }
.score-name { font-size: 12px; color: var(--text2); font-weight: 700; }
.score-pts { font-size: 28px; font-weight: 900; color: #fff; }

/* ===== PROFILE SCREEN ===== */
.profile-bg { min-height: 100vh; background: linear-gradient(180deg, #0f0f2a 0%, #0a0a1a 100%); padding: 0 0 90px; }
.profile-header { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); padding: 50px 20px 30px; text-align: center; }
.profile-avatar { font-size: 56px; width: 80px; height: 80px; background: rgba(255,255,255,0.15); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.profile-name { font-size: 22px; font-weight: 900; color: #fff; }
.profile-level { font-size: 13px; color: rgba(255,255,255,0.7); margin-bottom: 12px; }
.xp-bar { background: rgba(255,255,255,0.2); border-radius: 8px; height: 8px; margin: 0 20px; overflow: hidden; }
.xp-fill { height: 100%; background: #fff; border-radius: 8px; transition: width 0.5s; }
.profile-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; background: var(--border); }
.profile-stat { background: var(--bg2); padding: 16px; text-align: center; }
.profile-stat-num { font-size: 22px; font-weight: 900; color: #fff; }
.profile-stat-lbl { font-size: 11px; color: var(--text3); font-weight: 700; }
.achievements-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; padding: 0 16px; }
.achievement { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; }
.achievement.locked { opacity: 0.4; filter: grayscale(1); }
.achievement-icon { font-size: 28px; margin-bottom: 4px; }
.achievement-name { font-size: 10px; color: var(--text2); font-weight: 700; }

/* ===== RANKING SCREEN ===== */
.ranking-bg { min-height: 100vh; background: linear-gradient(180deg, #0f0f2a 0%, #0a0a1a 100%); padding: 0 0 90px; }
.ranking-header { padding: 50px 20px 20px; }
.ranking-tabs { display: flex; background: var(--card); border-radius: 12px; padding: 4px; margin: 0 16px 16px; }
.ranking-tab { flex: 1; padding: 8px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text2); cursor: pointer; border-radius: 10px; transition: all 0.2s; border: none; background: none; font-family: 'Nunito', sans-serif; }
.ranking-tab.active { background: var(--primary); color: #fff; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.rank-pos { font-size: 16px; font-weight: 900; color: var(--text3); min-width: 28px; text-align: center; }
.rank-avatar { font-size: 24px; width: 40px; height: 40px; background: var(--card); border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.rank-info { flex: 1; }
.rank-name { font-size: 14px; font-weight: 700; color: #fff; }
.rank-level { font-size: 11px; color: var(--text3); }
.rank-score { font-size: 16px; font-weight: 900; color: var(--gold); }
.rank-row.me { background: rgba(108,71,255,0.1); border-color: var(--primary); }

/* ===== STORE SCREEN ===== */
.store-bg { min-height: 100vh; background: linear-gradient(180deg, #0f0f2a 0%, #0a0a1a 100%); padding: 0 0 90px; }
.store-header { padding: 50px 20px 20px; display: flex; justify-content: space-between; align-items: center; }
.store-title { font-size: 22px; font-weight: 900; color: #fff; }
.store-grid { display: flex; flex-direction: column; gap: 12px; padding: 0 16px; }
.store-item { background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: flex; align-items: center; gap: 14px; }
.store-item.featured { border-color: var(--gold); background: rgba(255,215,0,0.05); }
.store-icon { font-size: 36px; min-width: 48px; text-align: center; }
.store-info { flex: 1; }
.store-name { font-size: 15px; font-weight: 800; color: #fff; margin-bottom: 2px; }
.store-desc { font-size: 12px; color: var(--text3); }
.store-price { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: 8px 16px; font-size: 14px; font-weight: 800; cursor: pointer; white-space: nowrap; font-family: 'Nunito', sans-serif; }
.store-price.gold { background: linear-gradient(135deg, var(--gold), #ffaa00); color: #000; }

/* ===== AD OVERLAY ===== */
.ad-overlay { position: fixed; inset: 0; z-index: 9000; background: rgba(0,0,0,0.92); display: none; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
.ad-label { font-size: 11px; color: var(--text3); letter-spacing: 1px; text-transform: uppercase; }
.ad-box { width: 320px; height: 250px; background: var(--card); border: 1px dashed var(--border); border-radius: 20px; display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 14px; text-align: center; }
.ad-countdown { font-size: 20px; font-weight: 900; color: var(--primary); min-width: 32px; text-align: center; }
.ad-skip { background: var(--primary); color: #fff; border: none; border-radius: 12px; padding: 12px 28px; font-size: 15px; font-weight: 800; cursor: pointer; font-family: 'Nunito', sans-serif; display: none; }

/* ===== RESPONSIVE ===== */
@media (min-width: 768px) {
  .auth-card { max-width: 420px; }
  .modes-grid { grid-template-columns: repeat(4,1fr); max-width: 800px; margin: 0 auto; }
  .home-bg, .game-bg, .result-bg, .profile-bg, .ranking-bg, .store-bg { max-width: 800px; margin: 0 auto; }
}

/* ===== FIX DUELO ALTURA FIJA ===== */
#screen-duel .game-bg {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
#duel-content {
  flex: 1;
  overflow-y: auto;
}
#duel-question-area {
  min-height: 420px;
}
