/* Selective quiz runner — tablet-first. */
.muted { color: var(--ink-2); }

/* ── top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 10px var(--sp-5);
  background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--ink); }
.brand span { color: var(--brand); }
.topbar-title { flex: 1; color: var(--ink-2); font-weight: 600; font-size: var(--fs-sm); }

/* ── navigator ── */
.navbar {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  padding: 10px var(--sp-5); background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.nav-group-label {
  font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--ink-3); margin: 0 6px 0 14px;
}
.nav-group-label:first-child { margin-left: 0; }
.nav-pill {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border-2); background: var(--surface);
  font-weight: 700; font-size: .8rem; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .12s;
}
.nav-pill:hover { border-color: var(--brand); }
.nav-pill.answered { background: var(--brand-50); border-color: var(--brand); color: var(--brand-700); }
.nav-pill.current { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,.35); }

/* ── progress ── */
.progress { height: 5px; background: var(--border); }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--teal)); transition: width .35s; }

/* ── screens ── */
.screen { max-width: 1100px; margin: 0 auto; padding: var(--sp-6) var(--sp-5) var(--sp-8); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }

/* start */
.start-card { max-width: 560px; margin: var(--sp-7) auto; padding: var(--sp-7); text-align: center; }
.start-sections { list-style: none; padding: 0; margin: var(--sp-5) 0; display: grid; gap: var(--sp-2); }
.start-sections li { display: flex; justify-content: space-between; padding: 10px 16px; background: var(--surface-2); border-radius: var(--r-sm); }
.namefield { display: block; text-align: left; font-size: var(--fs-sm); color: var(--ink-2); margin: var(--sp-5) 0; }
.namefield input { display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit; border: 1.5px solid var(--border-2); border-radius: var(--r-sm); }

/* ── quiz layout: passage + question ── */
.quiz-layout { display: grid; gap: var(--sp-5); grid-template-columns: 1fr; }
.quiz-layout.has-passage { grid-template-columns: minmax(320px, 44%) 1fr; align-items: start; }
.passage {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-6); box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 230px); overflow-y: auto; position: sticky; top: 140px;
}
.passage h3 { font-size: var(--fs-md); color: var(--c-reading); }
.passage .ptext { white-space: pre-wrap; line-height: 1.6; color: var(--ink); font-size: .98rem; }
.passage .pimg { max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm); background: #fff; margin-top: var(--sp-2); }
.passage .ptext + .ptext { margin-top: var(--sp-5); padding-top: var(--sp-5); border-top: 1px dashed var(--border-2); }

.qpane { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6) var(--sp-6) var(--sp-5); box-shadow: var(--shadow-sm); }
.qmeta { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-4); }
.section-chip { font-size: var(--fs-sm); font-weight: 800; padding: 4px 12px; border-radius: var(--r-pill); }
.section-chip.maths { background: var(--brand-50); color: var(--brand-700); }
.section-chip.thinking { background: #d7f4f0; color: #0b6b62; }
.section-chip.reading { background: #fdecd2; color: #9a5a05; }
.qcounter { color: var(--ink-3); font-size: var(--fs-sm); font-weight: 600; }
.qprompt { font-size: 1.12rem; line-height: 1.5; white-space: pre-wrap; margin-bottom: var(--sp-4); }
.qimages img { max-width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: var(--sp-4); background: #fff; }

/* ── options (adapted from AI4EMPLOYMENT) ── */
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px; background: var(--surface);
  border: 2px solid var(--border); border-radius: var(--r-md);
  cursor: pointer; font-size: 1.02rem; line-height: 1.4; color: var(--ink);
  text-align: left; user-select: none; width: 100%;
  transition: border-color .13s, background .13s, transform .08s, box-shadow .13s;
}
.option:hover { border-color: #bcc7e8; background: #f7f9ff; box-shadow: 0 3px 10px rgba(79,70,229,.08); }
.option:active { transform: scale(.99); }
.option.selected {
  border-color: var(--brand); background: linear-gradient(135deg, #eef0fe, #fff);
  color: var(--brand-700); font-weight: 600; box-shadow: 0 6px 16px rgba(79,70,229,.16);
}
.option .letter {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--ink-2); font-weight: 800; font-size: .92rem;
  transition: background .13s, color .13s;
}
.option.selected .letter { background: var(--brand); color: #fff; }
.option .body { flex: 1; }

/* image-mode answers: compact letter pills (scan already shows option text) */
.options.letters { display: block; }
.answer-hint { font-size: var(--fs-sm); font-weight: 700; color: var(--ink-2); margin: var(--sp-2) 0 var(--sp-3); }
.letter-row { display: flex; gap: 12px; flex-wrap: wrap; }
.options.letters .option { width: auto; min-width: 60px; justify-content: center; padding: 10px 14px; }
.options.letters .option .letter { width: 40px; height: 40px; font-size: 1.05rem; }

.saving { min-height: 20px; margin-top: var(--sp-3); font-size: var(--fs-sm); color: var(--ink-3); }

/* ── nav buttons ── */
.navbtns { max-width: 1100px; margin: var(--sp-5) auto 0; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.answered-note { color: var(--ink-3); font-size: var(--fs-sm); }

/* ── results ── */
.result-head { display: flex; align-items: center; gap: var(--sp-6); padding: var(--sp-6); margin-bottom: var(--sp-6); }
.score-ring {
  flex-shrink: 0; width: 110px; height: 110px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1.8rem; font-weight: 800; color: var(--brand-700);
  background: conic-gradient(var(--brand) var(--pct, 0%), var(--border) 0);
}
.score-ring span { background: var(--surface); width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; }
.section-scores { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-3); }
.section-scores .s { font-size: var(--fs-sm); font-weight: 700; padding: 6px 14px; border-radius: var(--r-pill); background: var(--surface-2); }
.review-h { margin: var(--sp-6) 0 var(--sp-4); }
.review { display: grid; gap: var(--sp-3); }
.rev {
  background: var(--surface); border: 1px solid var(--border); border-left: 5px solid var(--bad);
  border-radius: var(--r-md); padding: var(--sp-4) var(--sp-5);
}
.rev.correct { border-left-color: var(--ok); }
.rev .rev-top { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: 6px; }
.rev .badge { font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: var(--r-pill); }
.rev.correct .badge { background: var(--ok-bg); color: var(--ok); }
.rev:not(.correct) .badge { background: var(--bad-bg); color: var(--bad); }
.rev .rev-q { font-weight: 600; }
.rev .rev-ans { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 6px; }
.rev .rev-sol { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border-2); white-space: pre-wrap; }
.result-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-6); justify-content: center; }

/* ── responsive ── */
@media (max-width: 820px) {
  .quiz-layout.has-passage { grid-template-columns: 1fr; }
  .passage { position: static; max-height: 320px; }
  html { font-size: 16px; }
}
