.resume-box { margin-bottom: 14px; padding: 14px; border: 1px solid var(--brand); border-radius: 8px; background: var(--tint); }
.resume-box[hidden] { display: none; }
.resume-box .msg { font-size: 14px; margin-bottom: 10px; }

/* Previous-completion status + admin retake code. Informational look (not an
   error): shown automatically on load when this device already finished. */
.retake-box { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--brand); border-radius: 10px; background: #f7faf5; }
.retake-box[hidden] { display: none; }
.retake-box .msg { font-size: 14px; margin-bottom: 10px; line-height: 1.55; }
.retake-box .msg a { color: var(--brand-dark); font-weight: 600; }
.retake-box label { display: block; font-size: 13px; color: var(--muted); font-weight: 600; }
.retake-box input { margin-top: 4px; }

.start-actions { margin-top: 12px; }

/* ---- start form: split fields ---- */
.form-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.form-grid .field { flex: 1; min-width: 220px; }
.form-grid label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.form-grid input { width: 100%; padding: 10px; border: 1px solid #cfcfcf; border-radius: 8px; font-size: 15px; transition: border-color .15s ease, box-shadow .15s ease; }
.form-grid input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--tint); }
.form-grid input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--redt); }
.field-err { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.field-err[hidden] { display: none; }

/* ---- wizard shell: compact sticky header nav ---- */
.wizard[hidden] { display: none; }

/* Sticky, narrow, glassy header: progress + step dots stay visible while
   the questions scroll underneath. */
.wizard-nav {
  position: sticky; top: 10px; z-index: 40;
  max-width: 600px; margin: 0 auto 20px;
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
  background:
    linear-gradient(rgba(255, 255, 255, 0.93), rgba(255, 255, 255, 0.89)) padding-box,
    linear-gradient(120deg, rgba(109, 172, 58, 0.55), rgba(64, 168, 155, 0.5), rgba(109, 172, 58, 0.55)) border-box;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(44, 82, 28, 0.12);
}

.nav-progress .progress-track { height: 6px; border-radius: 6px; background: #e7ece4; overflow: hidden; }
.nav-progress .progress-fill {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--brand), #40a89b 55%, var(--brand));
  background-size: 200% 100%;
  animation: progressFlow 3.2s linear infinite;
  transition: width .45s cubic-bezier(.22, .7, .3, 1);
}
.nav-progress .progress-text { font-size: 12.5px; color: var(--muted); text-align: center; margin: 7px 0 9px; letter-spacing: .01em; }
@keyframes progressFlow { to { background-position: -200% 0; } }

.step-dots { display: flex; justify-content: center; align-items: center; gap: 7px; flex-wrap: wrap; }
.step-dot { display: block; padding: 0; background: transparent; border: none; cursor: pointer; border-radius: 50%; }
.step-dot .dot-index {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); background: #fff; color: var(--muted);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}
.step-dot .dot-label { display: none; } /* compact header shows numbers only */
.step-dot:hover:not(.locked) .dot-index { transform: translateY(-2px); border-color: var(--brand); }
.step-dot.done .dot-index { border-color: var(--brand); background: var(--tint); color: var(--brand-dark); }
.step-dot.current .dot-index {
  border-color: transparent; color: #fff;
  background: linear-gradient(135deg, var(--brand), #40a89b);
  box-shadow: 0 0 0 4px rgba(109, 172, 58, 0.18);
  animation: dotPulse 2s ease infinite;
}
.step-dot.locked { cursor: not-allowed; }
.step-dot.locked .dot-index { opacity: .45; border-style: dashed; }

@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(109, 172, 58, 0.18); }
  50% { box-shadow: 0 0 0 8px rgba(109, 172, 58, 0.08); }
}

/* ---- steps ---- */
.wizard-steps { position: relative; }
.step { display: none; }
.step.active { display: block; animation: stepIn .34s cubic-bezier(.2, .7, .3, 1); }
/* Cards inside the entering step rise one after another. */
.step.active > .card { animation: cardRise .4s cubic-bezier(.2, .7, .3, 1) both; }
.step.active > .card:nth-child(2) { animation-delay: .07s; }
.step.active > .card:nth-child(3) { animation-delay: .14s; }
.step.active > .card:nth-child(4) { animation-delay: .21s; }
@keyframes stepIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .step.active, .step.active > .card, .step-dot.current .dot-index, .nav-progress .progress-fill { animation: none; }
}

@media (max-width: 760px) {
  .wizard-nav { top: 6px; padding: 10px 12px; border-radius: 12px; }
  .step-dots { justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
  .step-dot .dot-index { width: 26px; height: 26px; }
}

.q-title { font-weight: 600; margin-bottom: 10px; }
.q { scroll-margin-top: 120px; } /* keep highlighted cards clear of the sticky header */
.q.invalid { border-left: 6px solid var(--red); }
.q.correct { border-left: 6px solid var(--brand); }
.q.partial { border-left: 6px solid var(--yellow); }
.q.wrong { border-left: 6px solid var(--red); }

.expl { margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--tint); font-size: 14px; }
.q.wrong .expl, .q.partial .expl { background: var(--redt); }
.q.partial .expl { background: var(--yellowt); }
.expl .you { color: var(--red); font-weight: 600; }
.q.partial .expl .you { color: var(--yellow); }
.expl .why { display: block; margin: 6px 0; }
.expl .corr { color: var(--brand-dark); font-weight: 600; }

.wizard-actions { display: flex; gap: 10px; margin-top: 6px; }

.score-big { font-size: 34px; font-weight: 700; }
.result-links { margin-top: 10px; font-size: 14px; }
.result-links a { color: var(--brand-dark); }
