/* ============================================================
   style.css – Interactive Quiz Application
   ============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --clr-primary:    #2563eb;
  --clr-primary-dk: #1d4ed8;
  --clr-success:    #16a34a;
  --clr-danger:     #dc2626;
  --clr-warning:    #d97706;
  --clr-bg:         #f1f5f9;
  --clr-card:       #ffffff;
  --clr-text:       #1e293b;
  --clr-muted:      #64748b;
  --clr-border:     #e2e8f0;
  --radius:         12px;
  --shadow:         0 4px 24px rgba(0,0,0,.08);
  --transition:     .2s ease;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

/* ---------- App shell ---------- */
#app {
  width: 100%;
  max-width: 680px;
}

/* ---------- Card ---------- */
.card {
  background: var(--clr-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.5rem 2rem;
}

/* ---------- Screen visibility ---------- */
.screen { display: none; }
.screen.active { display: block; }

/* ============================================================
   START SCREEN
   ============================================================ */
#start-screen { text-align: center; }

#start-screen .logo {
  font-size: 3rem;
  margin-bottom: .5rem;
}

#start-screen h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: .5rem;
  color: var(--clr-primary);
}

#start-screen p {
  color: var(--clr-muted);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.meta-row {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .9rem;
  color: var(--clr-muted);
}

.meta-item span:first-child { font-size: 1.1rem; }

/* ============================================================
   QUIZ SCREEN
   ============================================================ */

/* Progress bar */
.progress-wrap {
  margin-bottom: 1.5rem;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--clr-muted);
  margin-bottom: .4rem;
}

.progress-bar {
  height: 8px;
  background: var(--clr-border);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--clr-primary);
  border-radius: 99px;
  transition: width .4s ease;
}

/* Score badge */
.score-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: #eff6ff;
  color: var(--clr-primary);
  font-size: .85rem;
  font-weight: 600;
  padding: .3rem .75rem;
  border-radius: 99px;
  border: 1px solid #bfdbfe;
  margin-bottom: 1.5rem;
}

/* Question */
#question-number {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--clr-primary);
  margin-bottom: .5rem;
}

#question-text {
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* Options */
.options-grid {
  display: grid;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: .85rem;
  width: 100%;
  padding: .9rem 1.1rem;
  background: #f8fafc;
  border: 2px solid var(--clr-border);
  border-radius: 10px;
  font-size: 1rem;
  color: var(--clr-text);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.option-btn:hover:not(:disabled) {
  border-color: var(--clr-primary);
  background: #eff6ff;
  transform: translateY(-1px);
}

.option-btn:focus-visible {
  outline: 3px solid var(--clr-primary);
  outline-offset: 2px;
}

/* Option letter badge */
.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--clr-border);
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

/* Correct / Incorrect states */
.option-btn.correct {
  border-color: var(--clr-success);
  background: #f0fdf4;
}

.option-btn.correct .option-letter {
  background: var(--clr-success);
  color: #fff;
}

.option-btn.incorrect {
  border-color: var(--clr-danger);
  background: #fef2f2;
}

.option-btn.incorrect .option-letter {
  background: var(--clr-danger);
  color: #fff;
}

.option-btn:disabled { cursor: default; transform: none; }

/* Feedback box */
#feedback-box {
  display: none;
  align-items: flex-start;
  gap: .75rem;
  padding: 1rem 1.1rem;
  border-radius: 10px;
  font-size: .95rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
  animation: fadeIn .25s ease;
}

#feedback-box.correct {
  display: flex;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

#feedback-box.incorrect {
  display: flex;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.feedback-icon { font-size: 1.2rem; flex-shrink: 0; }
.feedback-title { font-weight: 700; margin-bottom: .1rem; }

/* Navigation */
.quiz-nav {
  display: flex;
  justify-content: flex-end;
}

/* ============================================================
   RESULTS SCREEN
   ============================================================ */
#results-screen { text-align: center; }

.result-emoji { font-size: 4rem; margin-bottom: .75rem; }

#results-screen h2 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: .5rem;
}

#results-screen .subtitle {
  color: var(--clr-muted);
  margin-bottom: 2rem;
}

/* Score circle */
.score-circle {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 2rem;
}

.score-circle svg {
  transform: rotate(-90deg);
  width: 140px;
  height: 140px;
}

.score-circle .track {
  fill: none;
  stroke: var(--clr-border);
  stroke-width: 10;
}

.score-circle .fill {
  fill: none;
  stroke: var(--clr-primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.score-circle .fill.high   { stroke: var(--clr-success); }
.score-circle .fill.medium { stroke: var(--clr-warning); }
.score-circle .fill.low    { stroke: var(--clr-danger);  }

.score-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#score-percent {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
}

#score-fraction {
  font-size: .8rem;
  color: var(--clr-muted);
}

/* Stats row */
.stats-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.stat-card {
  background: #f8fafc;
  border: 1px solid var(--clr-border);
  border-radius: 10px;
  padding: .85rem 1.25rem;
  min-width: 110px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 800;
}

.stat-label {
  font-size: .78rem;
  color: var(--clr-muted);
  margin-top: .1rem;
}

.stat-card.correct  .stat-value { color: var(--clr-success); }
.stat-card.incorrect .stat-value { color: var(--clr-danger); }

/* Review list */
.review-section { text-align: left; margin-bottom: 2rem; }

.review-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .75rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--clr-border);
}

.review-item {
  display: flex;
  gap: .75rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--clr-border);
  font-size: .9rem;
  line-height: 1.45;
}

.review-item:last-child { border-bottom: none; }

.review-icon { font-size: 1.1rem; flex-shrink: 0; padding-top: .05rem; }

.review-q { font-weight: 600; margin-bottom: .15rem; }
.review-a { color: var(--clr-muted); }
.review-a .highlight { font-weight: 600; }
.review-a .highlight.ok  { color: var(--clr-success); }
.review-a .highlight.bad { color: var(--clr-danger);  }

/* Result actions */
.result-actions {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .75rem 1.75rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.btn:focus-visible {
  outline: 3px solid var(--clr-primary);
  outline-offset: 2px;
}

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
}

.btn-primary:hover { background: var(--clr-primary-dk); }

.btn-outline {
  background: transparent;
  border-color: var(--clr-border);
  color: var(--clr-text);
}

.btn-outline:hover {
  border-color: var(--clr-primary);
  color: var(--clr-primary);
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

.card { animation: fadeIn .3s ease; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
  .card { padding: 1.75rem 1.25rem; }
  #question-text { font-size: 1.05rem; }
  .stats-row { gap: .6rem; }
  .stat-card { min-width: 90px; padding: .7rem .9rem; }
}
