/* ── RESET & VARIABLES ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0d0d0d;
  --surface: #161616;
  --card: #1e1e1e;
  --accent: #f0c040;
  --accent2: #e05a2b;
  --text: #f0ede8;
  --muted: #888;
  --correct: #3ecf8e;
  --wrong: #e05a2b;
  --radius: 16px;
}

/* ── BODY ── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(240,192,64,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 90% 90%, rgba(224,90,43,0.08) 0%, transparent 60%);
  pointer-events: none;
}

/* ── APP WRAPPER ── */
#app {
  width: 100%;
  max-width: 680px;
  position: relative;
}

/* ── SCREENS ── */
.screen {
  display: none;
  animation: fadeUp 0.4s ease forwards;
}

.screen.active {
  display: block;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ────────────────────────────────
   WELCOME SCREEN
──────────────────────────────── */
#welcome-screen {
  text-align: center;
  padding: 56px 32px;
  background: var(--surface);
  border: 1px solid #2a2a2a;
  border-radius: 24px;
}

.badge {
  display: inline-block;
  background: rgba(240,192,64,0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(240,192,64,0.3);
  margin-bottom: 28px;
}

h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: 16px;
}

h1 span {
  color: var(--accent);
}

.subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 420px;
  margin: 0 auto 40px;
}

.meta-grid {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.meta-item .dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
}

/* ── PRIMARY BUTTON ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--accent);
  color: #000;
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 16px 40px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(240,192,64,0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

/* ────────────────────────────────
   QUIZ SCREEN
──────────────────────────────── */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.q-counter {
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 1px;
}

.q-counter span {
  color: var(--text);
}

.score-pill {
  background: rgba(240,192,64,0.12);
  border: 1px solid rgba(240,192,64,0.25);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
}

/* ── PROGRESS BAR ── */
.progress-track {
  height: 4px;
  background: #2a2a2a;
  border-radius: 99px;
  margin-bottom: 36px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 99px;
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

/* ── QUESTION CARD ── */
.question-card {
  background: var(--card);
  border: 1px solid #2a2a2a;
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 20px;
}

.category-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 14px;
}

.question-text {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.1rem, 3vw, 1.4rem);
  font-weight: 700;
  line-height: 1.4;
}

/* ── OPTIONS ── */
.options-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1.5px solid #2a2a2a;
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  width: 100%;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(240,192,64,0.06);
  transform: translateX(4px);
}

.option-btn .opt-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: all 0.2s;
}

.option-btn.correct {
  border-color: var(--correct);
  background: rgba(62,207,142,0.08);
}

.option-btn.correct .opt-letter {
  background: var(--correct);
  color: #000;
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: rgba(224,90,43,0.08);
}

.option-btn.wrong .opt-letter {
  background: var(--wrong);
  color: #fff;
}

.option-btn:disabled {
  cursor: default;
}

/* ── FEEDBACK ── */
.feedback {
  display: none;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 20px;
  line-height: 1.5;
}

.feedback.show {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feedback.correct-fb {
  background: rgba(62,207,142,0.1);
  border: 1px solid rgba(62,207,142,0.3);
  color: var(--correct);
}

.feedback.wrong-fb {
  background: rgba(224,90,43,0.1);
  border: 1px solid rgba(224,90,43,0.3);
  color: #f07a5a;
}

.feedback-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

/* ── NEXT BUTTON ── */
.btn-next {
  width: 100%;
  padding: 16px;
  background: var(--accent);
  color: #000;
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 800;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  display: none;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-next.show {
  display: block;
}

.btn-next:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ── TIMER ── */
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.timer-wrap.danger {
  color: var(--wrong);
}

#timer-bar {
  width: 80px;
  height: 4px;
  background: #2a2a2a;
  border-radius: 99px;
  overflow: hidden;
}

#timer-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 1s linear, background 0.3s;
}

#timer-fill.danger {
  background: var(--wrong);
}

/* ────────────────────────────────
   RESULT SCREEN
──────────────────────────────── */
#result-screen {
  background: var(--surface);
  border: 1px solid #2a2a2a;
  border-radius: 24px;
  padding: 48px 32px;
  text-align: center;
}

.result-emoji {
  font-size: 4rem;
  margin-bottom: 20px;
  display: block;
  animation: bounce 0.6s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.3); }
}

.result-title {
  font-family: 'Syne', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-sub {
  color: var(--muted);
  margin-bottom: 36px;
}

.score-display {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto 36px;
}

.score-display svg {
  transform: rotate(-90deg);
}

.score-display .score-num {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-display .big-num {
  font-family: 'Syne', sans-serif;
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
}

.score-display .out-of {
  font-size: 0.8rem;
  color: var(--muted);
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.stat-box {
  background: var(--card);
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 18px 24px;
  min-width: 100px;
}

.stat-val {
  font-family: 'Syne', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
}

.stat-lbl {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 4px;
}

.stat-correct { color: var(--correct); }
.stat-wrong   { color: var(--wrong); }

/* ── RETRY BUTTON ── */
.btn-retry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1.5px solid #3a3a3a;
  color: var(--text);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 14px 32px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-retry:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .question-card { padding: 20px; }
  #result-screen { padding: 36px 20px; }
  #welcome-screen { padding: 40px 20px; }
}
