/* ── ExamZone Shared Styles ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy: #0a1628;
  --blue: #1a3a6b;
  --accent: #f5a623;
  --green: #27ae60;
  --red: #e74c3c;
  --light: #f0f4ff;
  --card: #ffffff;
  --border: #dde4f0;
  --text: #1a2340;
  --muted: #6b7a99;
  --correct: #d4f8e8;
  --wrong: #fde8e8;
  --correct-border: #27ae60;
  --wrong-border: #e74c3c;
}

body { font-family: 'Hind', sans-serif; background: #e8edf8; color: var(--text); min-height: 100vh; }

/* ── SCREENS ── */
.screen { display: none; }
.screen.active { display: block; }

/* ── TOP BAR ── */
.topbar {
  background: linear-gradient(90deg, var(--navy), var(--blue));
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 3px solid var(--accent);
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.topbar .brand {
  font-family: 'Baloo 2', cursive; font-size: 22px; font-weight: 800;
  color: #fff; letter-spacing: 1px;
}
.topbar .brand span { color: var(--accent); }
.topbar .tagline { font-size: 11px; color: #aab8d8; }

/* ── HOME ── */
.home-wrap { max-width: 860px; margin: 30px auto; padding: 0 16px; }
.home-hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 100%);
  border-radius: 16px; padding: 40px 36px; text-align: center; color: #fff;
  margin-bottom: 24px; position: relative; overflow: hidden;
  box-shadow: 0 8px 32px rgba(10,22,40,0.25);
}
.home-hero::before {
  content: ''; position: absolute; top: -40px; right: -40px;
  width: 200px; height: 200px; background: rgba(245,166,35,0.12); border-radius: 50%;
}
.home-hero h1 { font-family: 'Baloo 2', cursive; font-size: 36px; font-weight: 800; margin-bottom: 8px; }
.home-hero h1 span { color: var(--accent); }
.home-hero p { color: #aac2f0; font-size: 15px; margin-bottom: 28px; }
.home-stats { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.stat-box {
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px; padding: 12px 24px; text-align: center;
}
.stat-box .num { font-size: 28px; font-weight: 800; color: var(--accent); font-family: 'Baloo 2', cursive; }
.stat-box .lbl { font-size: 12px; color: #aac2f0; }

/* ── QUIZ CARDS ── */
.quiz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 16px; margin-bottom: 24px; }
.quiz-card {
  background: var(--card); border-radius: 12px; border: 2px solid var(--border);
  overflow: hidden; cursor: pointer; transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.quiz-card:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
.quiz-card-head { padding: 16px; display: flex; align-items: center; gap: 12px; }
.quiz-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.quiz-card-head h3 { font-family: 'Baloo 2', cursive; font-size: 16px; font-weight: 700; color: var(--text); }
.quiz-card-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.quiz-card-foot { padding: 10px 16px; background: var(--light); border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.quiz-meta { font-size: 12px; color: var(--muted); }
.quiz-meta strong { color: var(--text); }
.btn-start { background: var(--accent); color: #fff; border: none; padding: 6px 16px; border-radius: 20px; font-size: 12px; font-weight: 700; cursor: pointer; font-family: 'Hind', sans-serif; transition: background 0.15s; }
.btn-start:hover { background: #e09515; }

/* ── MODAL ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal-box { background: #fff; border-radius: 16px; padding: 32px; max-width: 480px; width: 90%; box-shadow: 0 16px 48px rgba(0,0,0,0.25); animation: popIn 0.25s ease; }
@keyframes popIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-box h2 { font-family: 'Baloo 2', cursive; font-size: 22px; color: var(--navy); margin-bottom: 6px; }
.modal-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.inst-list { list-style: none; margin-bottom: 24px; }
.inst-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; display: flex; align-items: flex-start; gap: 8px; }
.inst-list li::before { content: "✅"; flex-shrink: 0; }
.inst-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 24px; }
.inst-info { background: var(--light); border-radius: 8px; padding: 12px; text-align: center; }
.inst-info .val { font-size: 22px; font-weight: 800; color: var(--blue); font-family: 'Baloo 2', cursive; }
.inst-info .key { font-size: 11px; color: var(--muted); }
.modal-btns { display: flex; gap: 10px; }
.btn-cancel { flex: 1; padding: 12px; border: 2px solid var(--border); background: #fff; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); font-family: 'Hind', sans-serif; }
.btn-begin { flex: 2; padding: 12px; background: linear-gradient(90deg, var(--blue), #2563eb); color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: 'Baloo 2', cursive; letter-spacing: 0.5px; transition: opacity 0.15s; }
.btn-begin:hover { opacity: 0.9; }
.btn-begin:disabled { opacity: 0.5; cursor: default; }

/* ── EXAM SCREEN ── */
.exam-wrap { max-width: 900px; margin: 0 auto; padding: 16px; }
.exam-topbar { background: var(--card); border-radius: 12px; padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); border: 1px solid var(--border); gap: 16px; flex-wrap: wrap; }
.exam-title { font-family: 'Baloo 2', cursive; font-size: 18px; font-weight: 700; color: var(--navy); }
.timer-wrap { display: flex; align-items: center; gap: 10px; }
.timer-circle { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--border); display: flex; align-items: center; justify-content: center; flex-direction: column; background: #fff; }
.timer-circle.warning { border-color: #f39c12; }
.timer-circle.danger { border-color: var(--red); animation: pulse 0.8s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.timer-mins { font-family: 'Baloo 2', cursive; font-size: 20px; font-weight: 800; color: var(--navy); line-height: 1; }
.timer-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.exam-progress-info { text-align: center; }
.prog-nums { font-family: 'Baloo 2', cursive; font-size: 22px; font-weight: 800; color: var(--blue); }
.prog-lbl { font-size: 11px; color: var(--muted); }
.progress-bar-wrap { flex: 1; min-width: 120px; }
.progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--accent)); border-radius: 4px; transition: width 0.4s; }
.prog-pct { font-size: 11px; color: var(--muted); margin-top: 4px; text-align: right; }

/* Question Area */
.question-area { background: var(--card); border-radius: 12px; padding: 24px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); border: 1px solid var(--border); min-height: 200px; }
.q-number { display: inline-block; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 20px; margin-bottom: 14px; font-family: 'Baloo 2', cursive; }
.q-text { font-size: 17px; font-weight: 600; color: var(--text); line-height: 1.6; margin-bottom: 22px; }
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-btn { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border: 2px solid var(--border); border-radius: 10px; cursor: pointer; background: #fff; transition: all 0.15s; text-align: left; font-family: 'Hind', sans-serif; font-size: 14px; color: var(--text); width: 100%; }
.option-btn:hover:not(:disabled) { border-color: var(--blue); background: var(--light); }
.option-btn .opt-key { width: 30px; height: 30px; border-radius: 50%; background: var(--light); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--blue); flex-shrink: 0; transition: all 0.15s; }
.option-btn.selected { border-color: var(--blue); background: #eef3ff; }
.option-btn.selected .opt-key { background: var(--blue); color: #fff; border-color: var(--blue); }
.option-btn:disabled { cursor: default; }

/* Nav Buttons */
.exam-nav { display: flex; gap: 10px; align-items: center; background: var(--card); border-radius: 12px; padding: 14px 20px; margin-bottom: 14px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); border: 1px solid var(--border); flex-wrap: wrap; }
.btn-nav { padding: 10px 22px; border-radius: 8px; border: 2px solid var(--border); background: #fff; font-size: 14px; font-weight: 600; cursor: pointer; font-family: 'Hind', sans-serif; color: var(--text); transition: all 0.15s; }
.btn-nav:hover { border-color: var(--blue); color: var(--blue); }
.btn-nav:disabled { opacity: 0.4; cursor: default; }
.btn-nav.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-nav.primary:hover { background: #1a2f5e; }
.btn-nav.danger { background: var(--red); color: #fff; border-color: var(--red); margin-left: auto; }
.btn-skip { padding: 10px 22px; border-radius: 8px; border: 2px dashed #f39c12; background: #fff8ee; color: #e67e22; font-size: 14px; font-weight: 600; cursor: pointer; font-family: 'Hind', sans-serif; transition: all 0.15s; }
.btn-skip:hover { background: #fff0d0; }

/* Palette */
.palette-wrap { background: var(--card); border-radius: 12px; padding: 16px 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.07); border: 1px solid var(--border); }
.palette-title { font-size: 13px; font-weight: 700; color: var(--navy); margin-bottom: 12px; font-family: 'Baloo 2', cursive; }
.palette-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.palette-btn { width: 36px; height: 36px; border-radius: 6px; border: 2px solid var(--border); background: #fff; font-size: 12px; font-weight: 700; cursor: pointer; color: var(--muted); transition: all 0.15s; font-family: 'Baloo 2', cursive; }
.palette-btn.answered { background: var(--green); color: #fff; border-color: var(--green); }
.palette-btn.skipped { background: #f39c12; color: #fff; border-color: #f39c12; }
.palette-btn.current { background: var(--blue); color: #fff; border-color: var(--blue); }
.palette-legend { display: flex; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.leg-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.leg-dot { width: 12px; height: 12px; border-radius: 3px; }

/* ── RESULT SCREEN ── */
.result-wrap { max-width: 700px; margin: 30px auto; padding: 0 16px; }
.result-hero { background: linear-gradient(135deg, var(--navy), var(--blue)); border-radius: 16px; padding: 36px; text-align: center; color: #fff; margin-bottom: 20px; box-shadow: 0 8px 32px rgba(10,22,40,0.25); }
.result-emoji { font-size: 60px; margin-bottom: 10px; display: block; }
.result-hero h2 { font-family: 'Baloo 2', cursive; font-size: 28px; margin-bottom: 6px; }
.score-big { font-family: 'Baloo 2', cursive; font-size: 64px; font-weight: 800; color: var(--accent); line-height: 1; margin: 10px 0; }
.score-lbl { color: #aac2f0; font-size: 14px; }
.result-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 20px; }
.result-card { background: #fff; border-radius: 12px; padding: 16px; text-align: center; border: 2px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.rc-val { font-family: 'Baloo 2', cursive; font-size: 32px; font-weight: 800; }
.rc-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rc-correct .rc-val { color: var(--green); }
.rc-wrong .rc-val   { color: var(--red); }
.rc-skip .rc-val    { color: #f39c12; }
.rc-acc .rc-val     { color: var(--blue); }
.review-card { background: #fff; border-radius: 12px; overflow: hidden; margin-bottom: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.review-head { background: var(--navy); color: #fff; padding: 14px 20px; font-family: 'Baloo 2', cursive; font-size: 16px; font-weight: 700; }
.review-item { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.review-item:last-child { border-bottom: none; }
.review-q { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.review-opts { display: flex; flex-direction: column; gap: 4px; }
.review-opt { font-size: 12px; padding: 4px 8px; border-radius: 4px; color: var(--muted); }
.review-opt.correct-ans { background: var(--correct); color: var(--green); font-weight: 600; }
.review-opt.wrong-ans   { background: var(--wrong); color: var(--red); font-weight: 600; }
.review-badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-left: 8px; text-transform: uppercase; }
.badge-correct { background: var(--correct); color: var(--green); }
.badge-wrong   { background: var(--wrong); color: var(--red); }
.badge-skip    { background: #fff3d0; color: #e67e22; }
.result-btns { display: flex; gap: 12px; }
.btn-home, .btn-retry { flex: 1; padding: 14px; border-radius: 10px; border: none; font-size: 15px; font-weight: 700; cursor: pointer; font-family: 'Baloo 2', cursive; transition: opacity 0.15s; }
.btn-home  { background: var(--light); color: var(--navy); border: 2px solid var(--border); }
.btn-retry { background: linear-gradient(90deg, var(--blue), #2563eb); color: #fff; }
.btn-retry:hover, .btn-home:hover { opacity: 0.85; }

/* CONFETTI */
.confetti-piece { position: fixed; width: 10px; height: 10px; top: -10px; animation: fall linear forwards; z-index: 999; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg); } }

@media (max-width: 600px) {
  .result-cards { grid-template-columns: 1fr 1fr; }
  .home-hero h1 { font-size: 26px; }
  .score-big { font-size: 48px; }
}

/* ── Review: time-taken badge ── */
.review-time {
  display: inline-block;
  font-size: 11px; font-weight: 600;
  background: #eef3ff; color: #1a3a6b;
  border: 1px solid #c5d5f5;
  padding: 2px 9px; border-radius: 20px;
  margin-left: 6px; vertical-align: middle;
  white-space: nowrap;
}
