:root {
  --navy: #0b1f3a;
  --navy-2: #142a52;
  --red: #c8102e;
  --blue: #1e4fb4;
  --gold: #ffc72c;
  --green: #1fa672;
  --text: #f4f6fb;
  --muted: #a7b3cc;
  --card-bg: #ffffff;
  --card-text: #16213e;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at top, var(--navy-2), var(--navy) 70%);
  color: var(--text);
  display: flex;
  justify-content: center;
  padding: 24px 16px 60px;
}

.app { width: 100%; max-width: 560px; }

.screen { display: none; animation: fadeIn .35s ease; }
.screen.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(8px);} to { opacity: 1; transform: translateY(0);} }

/* START SCREEN */
#start-screen { text-align: center; }
.crest { font-size: 56px; margin-bottom: 4px; }
h1 { font-size: 28px; margin: 4px 0 4px; }
h1 span { color: var(--gold); }
.tagline { color: var(--muted); margin-bottom: 20px; }

.stat-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 24px; flex-wrap: wrap; }
.stat-chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  min-width: 100px;
}
.stat-chip strong { font-size: 18px; color: var(--gold); }

.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field select {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: none;
  background: rgba(255,255,255,0.08); color: var(--text); font-size: 15px;
  border: 1px solid rgba(255,255,255,0.15);
}

.btn-primary, .btn-secondary {
  width: 100%; padding: 14px; border-radius: 14px; border: none; font-size: 16px;
  font-weight: 700; margin-top: 12px; cursor: pointer; transition: transform .12s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--red), #e0384f); color: white; }
.btn-secondary { background: rgba(255,255,255,0.08); color: var(--text); border: 1px solid rgba(255,255,255,0.2); }
.btn-primary:active, .btn-secondary:active { transform: scale(0.97); }

/* GAME SCREEN */
.hud { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.lives { font-size: 20px; letter-spacing: 2px; }
.hud-center { flex: 1; text-align: center; }
.progress-track { background: rgba(255,255,255,0.1); border-radius: 8px; height: 8px; overflow: hidden; }
.progress-fill { background: var(--gold); height: 100%; width: 0%; transition: width .3s ease; }
.q-counter { font-size: 12px; color: var(--muted); margin-top: 4px; }
.hud-right { display: flex; gap: 8px; }
.score-box, .streak-box { background: rgba(255,255,255,0.08); border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.streak-box.hot { background: linear-gradient(135deg, #ff7a18, #c8102e); }

.timer-track { background: rgba(255,255,255,0.1); border-radius: 8px; height: 6px; margin: 10px 0 16px; overflow: hidden; }
.timer-fill { background: var(--green); height: 100%; width: 100%; transition: width 0.1s linear; }
.timer-fill.warn { background: var(--gold); }
.timer-fill.danger { background: var(--red); }

.card {
  background: var(--card-bg); color: var(--card-text); border-radius: 20px;
  padding: 24px 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.category-tag {
  display: inline-block; background: var(--blue); color: white; font-size: 11px;
  font-weight: 700; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
}
#question-text { font-size: 19px; margin: 0 0 18px; line-height: 1.35; }

.options { display: grid; gap: 10px; }
.option-btn {
  text-align: left; padding: 14px 16px; border-radius: 12px; border: 2px solid #e1e5ee;
  background: #f7f8fc; font-size: 15px; cursor: pointer; transition: all .15s ease;
  color: var(--card-text);
}
.option-btn:hover { border-color: var(--blue); }
.option-btn.correct { background: #e5f8ef; border-color: var(--green); color: #0d6b46; font-weight: 700; }
.option-btn.incorrect { background: #fdeaec; border-color: var(--red); color: #a10d24; font-weight: 700; }
.option-btn.disabled { pointer-events: none; opacity: 0.75; }

.feedback { margin-top: 14px; font-size: 13px; color: #4a5573; min-height: 20px; }

/* RESULTS */
#results-screen { text-align: center; }
.result-score { font-size: 48px; font-weight: 800; color: var(--gold); margin: 8px 0; }
.result-sub { color: var(--muted); margin-bottom: 16px; }
.new-badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.badge-pill {
  background: linear-gradient(135deg, var(--gold), #ffe08a); color: #4a3600;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
}
.review { text-align: left; max-height: 300px; overflow-y: auto; margin-bottom: 12px; }
.review-item {
  background: rgba(255,255,255,0.06); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; font-size: 13px;
}
.review-item.wrong { border-left: 4px solid var(--red); }
.review-item.right { border-left: 4px solid var(--green); }
.review-item .q { font-weight: 700; margin-bottom: 4px; }
.review-item .a { color: var(--muted); }

/* BADGES SCREEN */
.badge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.badge-card { background: rgba(255,255,255,0.06); border-radius: 14px; padding: 14px; text-align: center; }
.badge-card.locked { opacity: 0.35; }
.badge-card .icon { font-size: 26px; margin-bottom: 6px; }
.badge-card .name { font-size: 13px; font-weight: 700; }
.badge-card .desc { font-size: 11px; color: var(--muted); margin-top: 2px; }