@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;600;700;800&family=Barlow:wght@400;500;600&display=swap');

:root {
  --red: #E3000F;
  --red-dark: #a8000b;
  --red-glow: rgba(227, 0, 15, 0.35);
  --bg: #0a0a0c;
  --bg2: #131318;
  --bg3: #1c1c24;
  --border: rgba(255,255,255,0.08);
  --text: #f0f0f0;
  --text-dim: #888;
  --gold: #f5c518;
  --green: #2ecc71;
  --radius: 12px;
  --font-display: 'Barlow Condensed', sans-serif;
  --font-body: 'Barlow', sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ── Utility ── */
.hidden { display: none !important; }
.text-red { color: var(--red); }
.text-dim { color: var(--text-dim); }
.text-gold { color: var(--gold); }
.text-green { color: var(--green); }

/* ── Logo / Header ── */
.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.logo span { color: var(--red); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 20px var(--red-glow);
}
.btn-primary:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-lg { padding: 16px 36px; font-size: 1.3rem; }
.btn-sm { padding: 8px 16px; font-size: 0.95rem; }

/* ── Card ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ── Input ── */
.input {
  width: 100%;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--red); }
.input::placeholder { color: var(--text-dim); }

/* ── Timer bar ── */
.timer-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}
.timer-fill {
  height: 100%;
  background: var(--red);
  border-radius: 3px;
  transition: width 0.5s linear, background 0.5s;
}
.timer-fill.warn { background: #f39c12; }
.timer-fill.danger { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }

/* ── Answer options ── */
.answer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.answer-btn {
  position: relative;
  padding: 20px 24px;
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  color: #fff;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.answer-btn .letter {
  font-size: 1.4rem;
  font-weight: 800;
  opacity: 0.7;
  flex-shrink: 0;
}
.answer-btn:nth-child(1) { background: #1a3a6e; border-color: #2456b0; }
.answer-btn:nth-child(2) { background: #6e1a1a; border-color: #b02424; }
.answer-btn:nth-child(3) { background: #1a6e3a; border-color: #24b056; }
.answer-btn:nth-child(4) { background: #6e5a1a; border-color: #b09024; }
.answer-btn:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.2); }
.answer-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.answer-btn.selected { border-color: #fff; transform: scale(0.97); }
.answer-btn.correct { background: #1a6e1a; border-color: var(--green); box-shadow: 0 0 20px rgba(46,204,113,0.4); }
.answer-btn.wrong { background: #3a1a1a; border-color: #e74c3c; opacity: 0.5; }

/* ── Leaderboard ── */
.leaderboard-list { list-style: none; }
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  transition: background 0.2s;
}
.leaderboard-item:nth-child(1) { background: rgba(245,197,24,0.12); border-color: rgba(245,197,24,0.3); }
.leaderboard-item:nth-child(2) { background: rgba(192,192,192,0.08); border-color: rgba(192,192,192,0.2); }
.leaderboard-item:nth-child(3) { background: rgba(205,127,50,0.08); border-color: rgba(205,127,50,0.2); }
.lb-rank { font-family: var(--font-display); font-size: 1.4rem; font-weight: 800; width: 36px; text-align: center; }
.lb-name { flex: 1; font-weight: 600; font-size: 1.05rem; }
.lb-score { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--gold); }

/* ── Notification badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--red);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Toast ── */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast-info { background: var(--bg3); border: 1px solid var(--border); }
.toast-warn { background: #2a1f00; border: 1px solid #f39c12; color: #f39c12; }
.toast-error { background: #2a0000; border: 1px solid var(--red); color: #ff6b6b; }
.toast-success { background: #002a0e; border: 1px solid var(--green); color: var(--green); }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ── Pulse animation ── */
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }
.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ── Filmstrip decoration ── */
.filmstrip {
  display: flex;
  gap: 4px;
  align-items: center;
}
.filmstrip-hole {
  width: 8px;
  height: 12px;
  border-radius: 2px;
  background: var(--bg3);
  border: 1px solid var(--border);
}
