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

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container { max-width: 900px; margin: 0 auto; padding: 24px 20px; }
.container.narrow { max-width: 700px; }

.screen { display: none; }
.screen.active { display: block; }

/* Hero */
.hero { text-align: center; padding: 48px 0 32px; }
.badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
  letter-spacing: 1px;
}
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.subtitle { color: var(--text-muted); max-width: 540px; margin: 0 auto; font-size: 1.05rem; }

/* Info Cards */
.info-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 32px; }
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.info-icon { font-size: 2rem; margin-bottom: 8px; }
.info-card h3 { margin-bottom: 8px; }
.info-card p { color: var(--text-muted); font-size: 0.9rem; }

/* Exam Info */
.exam-info {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 32px;
}
.exam-info h2 { text-align: center; margin-bottom: 16px; font-size: 1.2rem; }
.exam-details { display: flex; justify-content: space-around; gap: 16px; }
.detail { text-align: center; }
.detail-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.detail-value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

/* Mode Select */
.mode-select { margin-bottom: 40px; }
.mode-select h2 { text-align: center; margin-bottom: 20px; }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}
.mode-card:hover { border-color: var(--primary); background: var(--surface-hover); }
.mode-card h3 { font-size: 1rem; margin-bottom: 6px; }
.mode-card p { color: var(--text-muted); font-size: 0.85rem; }
.mode-tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 8px;
  background: rgba(59,130,246,0.15);
  color: var(--primary);
}

/* Batch Selection */
.batch-grid { display: grid; gap: 12px; margin-top: 20px; }
.batch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.batch-card:hover { border-color: var(--primary); }
.batch-card h3 { font-size: 1rem; }
.batch-card span { color: var(--text-muted); font-size: 0.85rem; }

.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 8px 0;
  margin-bottom: 12px;
}
.back-btn:hover { color: var(--text); }

/* Quiz Header */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}
.quiz-info { display: flex; align-items: center; gap: 8px; }
.quiz-info span:first-child { font-weight: 600; font-size: 0.95rem; }
.timer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 1.1rem;
}
.timer.warning { border-color: var(--warning); color: var(--warning); }
.timer.danger { border-color: var(--danger); color: var(--danger); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }

.quiz-progress { color: var(--text-muted); font-size: 0.9rem; }

/* Progress Bar */
.progress-bar-container {
  height: 4px;
  background: var(--surface);
  border-radius: 2px;
  margin-bottom: 28px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Question */
.question-area { margin-bottom: 28px; }
.question-num { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.priority-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}
.priority-high { background: rgba(34,197,94,0.15); color: #22c55e; }
.priority-med { background: rgba(59,130,246,0.15); color: #3b82f6; }
.priority-mod { background: rgba(245,158,11,0.15); color: #f59e0b; }
.priority-low { background: rgba(148,163,184,0.15); color: #94a3b8; }
.question-text { font-size: 1.15rem; font-weight: 600; line-height: 1.5; margin-bottom: 20px; }

.options { display: grid; gap: 10px; }
.option {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.95rem;
}
.option:hover { border-color: var(--primary); background: var(--surface-hover); }
.option.selected { border-color: var(--primary); background: rgba(59,130,246,0.1); }
.option .opt-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}
.option.selected .opt-letter { background: var(--primary); color: #fff; }

/* Feedback states (practice/batch) */
.option.correct {
  border-color: var(--success);
  background: rgba(34,197,94,0.1);
  cursor: default;
}
.option.correct .opt-letter { background: var(--success); color: #fff; }
.option.wrong {
  border-color: var(--danger);
  background: rgba(239,68,68,0.1);
  cursor: default;
}
.option.wrong .opt-letter { background: var(--danger); color: #fff; }
.option.correct:hover, .option.wrong:hover {
  border-color: inherit;
  background: inherit;
}

.feedback-msg {
  margin-top: 16px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}
.feedback-correct { background: rgba(34,197,94,0.12); color: var(--success); }
.feedback-wrong { background: rgba(239,68,68,0.12); color: var(--danger); }

/* Quiz Nav */
.quiz-nav { display: flex; justify-content: space-between; gap: 12px; }

/* Buttons */
.btn {
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); }

/* Results */
.results-card { text-align: center; padding: 40px 0; }
.results-card h2 { margin-bottom: 28px; }
.score-circle {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 6px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}
.score-circle.pass { border-color: var(--success); }
.score-circle.fail { border-color: var(--danger); }
#score-percent { font-size: 2.2rem; font-weight: 800; }
#score-fraction { color: var(--text-muted); font-size: 0.9rem; }
.score-breakdown {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 32px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.score-breakdown .correct { color: var(--success); font-weight: 600; }
.score-breakdown .incorrect { color: var(--danger); font-weight: 600; }
.results-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* Review */
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.review-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.review-item.correct { border-left: 4px solid var(--success); }
.review-item.incorrect { border-left: 4px solid var(--danger); }
.review-item.skipped { border-left: 4px solid var(--warning); }
.review-q-num { color: var(--text-muted); font-size: 0.8rem; margin-bottom: 6px; }
.review-question { font-weight: 600; margin-bottom: 12px; }
.review-options { display: grid; gap: 6px; }
.review-opt {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.review-opt.correct-answer { background: rgba(34,197,94,0.12); color: var(--success); }
.review-opt.wrong-answer { background: rgba(239,68,68,0.12); color: var(--danger); }
.review-opt .opt-marker { font-weight: 700; width: 20px; }
.review-footer { display: flex; justify-content: center; gap: 12px; padding: 24px 0; }

/* Responsive */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.5rem; }
  .info-cards { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .exam-details { flex-direction: column; gap: 12px; }
  .quiz-header { flex-direction: column; align-items: flex-start; }
  .results-actions { flex-direction: column; }
  .review-footer { flex-direction: column; }
  .btn { width: 100%; text-align: center; }
}
