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

:root {
  --bg: #07071A;
  --surface: #0F0F2E;
  --card: #13133A;
  --border: rgba(255,255,255,0.08);
  --accent: #F59E0B;
  --accent2: #8B5CF6;
  --neon-green: #10F5A0;
  --neon-red: #FF4D6D;
  --neon-blue: #38BDF8;
  --text: #F0EEF8;
  --muted: #7B78A8;
  --font: 'Outfit', sans-serif;
  --mono: 'DM Mono', monospace;
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  position: relative;
}

/* ===== PARTICLES ===== */
#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ===== SCREENS ===== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  overflow-y: auto;
}

.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ===== START SCREEN ===== */
.start-inner {
  text-align: center;
  padding: 40px 24px;
  max-width: 480px;
  width: 100%;
}

.game-logo {
  font-size: 5rem;
  margin-bottom: 12px;
  animation: float 3s ease-in-out infinite;
  display: block;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-12px); }
}

.game-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  opacity: 0.9;
}

.game-title {
  font-size: clamp(3rem, 10vw, 5.5rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: #fff;
  margin-bottom: 16px;
}

.glow-text {
  color: var(--accent);
  text-shadow: 0 0 40px rgba(245,158,11,0.7), 0 0 80px rgba(245,158,11,0.3);
}

.game-desc {
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 28px;
}

.rules-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 36px;
}

.rule-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 100px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.btn-start {
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 800;
  color: #000;
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  border: none;
  border-radius: 16px;
  padding: 18px 56px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 40px rgba(245,158,11,0.5);
  letter-spacing: 0.01em;
}

.btn-start:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 0 60px rgba(245,158,11,0.7);
}

/* ===== GAME SCREEN ===== */
#gameScreen {
  flex-direction: column;
  justify-content: flex-start;
  padding: 0;
  align-items: stretch;
}

/* ===== HUD ===== */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: rgba(15,15,46,0.95);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  gap: 12px;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 100px;
}

.lives {
  font-size: 1.2rem;
  letter-spacing: 2px;
  transition: all 0.3s;
}

.streak-badge {
  background: linear-gradient(135deg, #FF6B35, #F59E0B);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 800;
  color: #000;
  animation: pulse-streak 1s ease-in-out infinite;
}

@keyframes pulse-streak {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.5); }
  50%       { box-shadow: 0 0 0 6px rgba(245,158,11,0); }
}

.hud-center {
  flex: 1;
  text-align: center;
  max-width: 260px;
  margin: 0 auto;
}

.q-counter {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.08em;
}

.xp-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 100px;
  overflow: hidden;
  margin-bottom: 4px;
}

.xp-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8B5CF6, #F59E0B, #10F5A0);
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.34,1.56,0.64,1);
}

.xp-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

.hud-right { min-width: 60px; display: flex; justify-content: flex-end; }

/* ===== TIMER RING ===== */
.timer-ring {
  position: relative;
  width: 48px;
  height: 48px;
}

.timer-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.08);
  stroke-width: 3;
}

.ring-fill {
  fill: none;
  stroke: var(--neon-green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 113;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.ring-fill.warning { stroke: var(--accent); }
.ring-fill.danger  { stroke: var(--neon-red); }

.timer-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* ===== QUESTION AREA ===== */
.q-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 24px 24px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.q-category {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 14px;
  opacity: 0.8;
}

.q-text {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 700;
  color: #fff;
  text-align: center;
  line-height: 1.45;
  margin-bottom: 28px;
  min-height: 60px;
}

/* ===== OPTIONS ===== */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 560px;
}

.option-btn {
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  line-height: 1.4;
  position: relative;
  overflow: hidden;
}

.option-btn .opt-letter {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: rgba(255,255,255,0.07);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  line-height: 24px;
  margin-right: 8px;
  flex-shrink: 0;
  transition: all 0.18s;
}

.option-btn:hover:not(:disabled) {
  background: rgba(139,92,246,0.15);
  border-color: rgba(139,92,246,0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139,92,246,0.2);
}

.option-btn:hover:not(:disabled) .opt-letter {
  background: var(--accent2);
  color: #fff;
}

.option-btn.correct {
  background: rgba(16,245,160,0.12) !important;
  border-color: var(--neon-green) !important;
  color: var(--neon-green) !important;
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(16,245,160,0.25);
}

.option-btn.wrong {
  background: rgba(255,77,109,0.12) !important;
  border-color: var(--neon-red) !important;
  color: var(--neon-red) !important;
  animation: shake 0.4s ease;
}

.option-btn.show-correct {
  background: rgba(16,245,160,0.08) !important;
  border-color: rgba(16,245,160,0.4) !important;
  color: rgba(16,245,160,0.7) !important;
}

.option-btn:disabled { cursor: not-allowed; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* ===== ANSWER FEEDBACK ===== */
.answer-feedback {
  margin-top: 20px;
  font-size: 0.88rem;
  font-family: var(--mono);
  color: var(--muted);
  text-align: center;
  min-height: 24px;
  transition: all 0.3s;
  max-width: 480px;
}

/* ===== COMBO POPUP ===== */
.combo-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(245,158,11,0.8);
  pointer-events: none;
  z-index: 100;
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  opacity: 0;
  white-space: nowrap;
}

.combo-popup.show {
  transform: translate(-50%, -60%) scale(1);
  opacity: 1;
}

/* ===== RESULT SCREEN ===== */
#resultScreen {
  align-items: flex-start;
  justify-content: flex-start;
  overflow-y: auto;
}

.result-inner {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 24px 60px;
  text-align: center;
}

.result-trophy {
  font-size: 5rem;
  margin-bottom: 12px;
  animation: trophy-bounce 0.6s cubic-bezier(0.34,1.56,0.64,1) 0.2s both;
}

@keyframes trophy-bounce {
  from { transform: scale(0) rotate(-10deg); }
  to   { transform: scale(1) rotate(0deg); }
}

.result-rank {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 6px 18px;
  border-radius: 100px;
  margin-bottom: 14px;
  font-weight: 500;
}

.rank-s { background: rgba(245,158,11,0.2); color: var(--accent); border: 1px solid rgba(245,158,11,0.4); }
.rank-a { background: rgba(16,245,160,0.15); color: var(--neon-green); border: 1px solid rgba(16,245,160,0.35); }
.rank-b { background: rgba(56,189,248,0.15); color: var(--neon-blue); border: 1px solid rgba(56,189,248,0.35); }
.rank-c { background: rgba(139,92,246,0.15); color: #A78BFA; border: 1px solid rgba(139,92,246,0.35); }
.rank-d { background: rgba(255,77,109,0.12); color: var(--neon-red); border: 1px solid rgba(255,77,109,0.3); }

.result-heading {
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: 28px;
  letter-spacing: -0.02em;
}

/* ===== STATS ROW ===== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 28px;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 8px;
}

.stat-val {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ===== REVIEW LIST ===== */
.review-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 28px;
  text-align: left;
}

.review-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.85rem;
}

.review-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.review-q    { color: var(--muted); font-size: 0.78rem; margin-bottom: 3px; font-family: var(--mono); }
.review-a    { color: var(--text); font-weight: 600; }
.review-item.correct-item { border-color: rgba(16,245,160,0.2); }
.review-item.wrong-item   { border-color: rgba(255,77,109,0.2); }

/* ===== RESULT ACTIONS ===== */
.result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.btn-play-again {
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 800;
  color: #000;
  background: linear-gradient(135deg, #F59E0B, #FBBF24);
  border: none;
  border-radius: 14px;
  padding: 15px 44px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 30px rgba(245,158,11,0.4);
}

.btn-play-again:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 50px rgba(245,158,11,0.6);
}

.email-section { width: 100%; }

.email-status {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
  padding: 12px 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all 0.3s;
}

.email-status.sent {
  color: var(--neon-green);
  border-color: rgba(16,245,160,0.3);
  background: rgba(16,245,160,0.06);
}

.email-status.failed {
  color: var(--neon-red);
  border-color: rgba(255,77,109,0.3);
  background: rgba(255,77,109,0.06);
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(15,15,46,0.95);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  backdrop-filter: blur(12px);
  z-index: 999;
  transition: transform 0.35s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s;
  opacity: 0;
  white-space: nowrap;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 520px) {
  .options-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .hud { padding: 12px 16px; }
  .q-area { padding: 20px 16px; }
}