/* ── Scooter Mastery Test — professional exam engine ─────────────── */

.test-page {
  position: relative;
}

.test-page__hero {
  position: relative;
  padding: calc(var(--nav-height) + 1.5rem) 0 clamp(1.5rem, 3vw, 2rem);
  overflow: hidden;
}

.test-page__hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 50% at 20% 15%, rgba(59, 130, 246, 0.18), transparent 58%),
    radial-gradient(ellipse 45% 40% at 85% 25%, rgba(168, 85, 247, 0.14), transparent 55%),
    radial-gradient(ellipse 40% 30% at 50% 100%, rgba(34, 211, 238, 0.08), transparent 50%);
}

.test-page__hero-inner {
  position: relative;
  z-index: 1;
  max-width: 820px;
}

.test-page__eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.test-page__title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.9rem, 4.4vw, 2.85rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
}

.test-page__lead {
  margin: 0;
  max-width: 700px;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  line-height: 1.65;
  color: var(--text-secondary);
}

.test-page__body {
  padding: 0.5rem 0 clamp(2.5rem, 5vh, 4rem);
  max-width: 980px;
}

.test-card {
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: 20px;
  border: 1px solid var(--border-glass);
  background: linear-gradient(160deg, rgba(14, 22, 44, 0.78) 0%, rgba(8, 14, 30, 0.7) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* ── Intro screen ─────────────────────────────────────────────── */

.test-intro__stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.test-stat {
  padding: 0.9rem 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(255, 255, 255, 0.03);
  text-align: center;
}

.test-stat__value {
  display: block;
  font-size: clamp(1rem, 2vw, 1.3rem);
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.test-stat__label {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.test-intro__heading {
  margin: 0 0 0.35rem;
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 800;
}

.test-intro__sub {
  margin: 0 0 1.1rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.test-length-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.test-length-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem 0.9rem;
  border-radius: 14px;
  border: 1.5px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.test-length-card:hover {
  border-color: rgba(59, 130, 246, 0.45);
  transform: translateY(-2px);
}

.test-length-card.is-selected {
  border-color: var(--accent-cyan);
  background: radial-gradient(ellipse 100% 140% at 0% 0%, rgba(34, 211, 238, 0.14), transparent 60%), rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35) inset;
}

.test-length-card__name {
  font-weight: 700;
  font-size: 0.95rem;
}

.test-length-card__count {
  font-size: 0.82rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.test-length-card__time {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.test-intro__rules {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.test-rule {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.test-rule svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 0.1rem;
  color: var(--accent-cyan);
}

.test-intro__start {
  width: 100%;
  justify-content: center;
  font-size: 1rem;
  padding: 1rem 1.5rem;
}

/* ── Quiz screen ──────────────────────────────────────────────── */

.test-quiz {
  position: relative;
}

.test-score-badge {
  position: absolute;
  top: clamp(1rem, 2.5vw, 1.6rem);
  right: clamp(1rem, 2.5vw, 1.6rem);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  background: radial-gradient(ellipse 120% 140% at 100% 0%, rgba(34, 211, 238, 0.16), transparent 60%), rgba(10, 16, 32, 0.7);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.test-score-badge__label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.test-score-badge__value {
  font-size: 1.15rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.test-quiz__top {
  margin-bottom: 1.25rem;
  padding-right: 6.5rem;
}

.test-quiz__question-count {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.test-question__category {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  color: var(--accent-blue);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.5rem;
}

.test-question__type {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.14);
  color: var(--accent-purple);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.test-question__text {
  margin: 0.9rem 0 1.25rem;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight: 700;
  line-height: 1.4;
}

.test-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
}

.test-options--pill {
  flex-direction: row;
  flex-wrap: wrap;
}

.test-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1.5px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
  font-size: 0.94rem;
  color: var(--text-primary);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.test-options--pill .test-option {
  flex: 1 1 160px;
  justify-content: center;
}

.test-option:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateX(2px);
}

.test-option.is-selected {
  border-color: var(--accent-cyan);
  background: radial-gradient(ellipse 100% 140% at 0% 0%, rgba(34, 211, 238, 0.16), transparent 60%), rgba(255, 255, 255, 0.03);
}

.test-option__marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.16);
  font-size: 0.78rem;
  font-weight: 700;
}

.test-option.is-selected .test-option__marker {
  background: var(--accent-gradient);
  color: #04101f;
}

.test-option.is-locked {
  cursor: default;
}

.test-option.is-locked:hover {
  transform: none;
}

.test-option.is-correct {
  border-color: #22c55e;
  background: radial-gradient(ellipse 100% 140% at 0% 0%, rgba(34, 197, 94, 0.18), transparent 60%), rgba(255, 255, 255, 0.02);
}

.test-option.is-correct .test-option__marker {
  background: #22c55e;
  color: #04140a;
}

.test-option.is-wrong {
  border-color: #ef4444;
  background: radial-gradient(ellipse 100% 140% at 0% 0%, rgba(239, 68, 68, 0.18), transparent 60%), rgba(255, 255, 255, 0.02);
}

.test-option.is-wrong .test-option__marker {
  background: #ef4444;
  color: #1a0404;
}

.test-option.is-dimmed {
  opacity: 0.45;
}

/* ── Instant feedback modal ───────────────────────────────────── */

body.test-modal-open {
  overflow: hidden;
}

.test-feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.5rem);
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(6px);
  animation: testOverlayIn 0.2s ease;
}

.test-feedback-overlay[hidden] {
  display: none;
}

@keyframes testOverlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.test-feedback-modal {
  width: min(760px, 100%);
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(160deg, rgba(15, 23, 46, 0.99) 0%, rgba(8, 14, 30, 0.99) 100%);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55);
  animation: testModalIn 0.28s ease;
}

@keyframes testModalIn {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.test-feedback-modal__banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 1.1rem 1.5rem;
  font-weight: 800;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.test-feedback__banner.is-correct {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.test-feedback__banner.is-wrong {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.test-feedback__icon svg {
  display: block;
}

.test-feedback-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
}

.test-feedback-modal__footer {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  justify-content: flex-end;
}

.test-feedback-modal__footer .test-nav-btn {
  width: 100%;
  justify-content: center;
}

.test-feedback__notes {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.test-feedback__notes-heading {
  margin: 0 0 0.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.test-note-row {
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border-left: 3px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.02);
}

.test-note-row.is-correct {
  border-left-color: #22c55e;
}

.test-note-row.is-wrong {
  border-left-color: #ef4444;
}

.test-note-row__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.3rem;
}

.test-note-row__marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.18);
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.test-note-row__option {
  font-weight: 700;
  font-size: 0.88rem;
}

.test-note-row__tag {
  margin-left: auto;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}

.test-note-row__tag--correct {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
}

.test-note-row__tag--wrong {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.test-note-row__note {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.test-nav-btn {
  flex-shrink: 0;
}

/* ── Dotted segmented progress bar (non-interactive) ─────────────── */

.test-dot-progress {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.test-dot-progress__seg {
  flex: 1 1 0;
  min-width: 4px;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  transition: background 0.2s ease;
}

.test-dot-progress__seg.is-current {
  background: rgba(148, 163, 184, 0.5);
}

.test-dot-progress__seg.is-correct {
  background: #22c55e;
}

.test-dot-progress__seg.is-wrong {
  background: #ef4444;
}

/* ── Results screen ───────────────────────────────────────────── */

.test-results__summary {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.test-score-ring {
  position: relative;
  width: 130px;
  height: 130px;
  flex-shrink: 0;
}

.test-score-ring__svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.test-score-ring__track {
  fill: none;
  stroke: rgba(148, 163, 184, 0.14);
  stroke-width: 10;
}

.test-score-ring__fill {
  fill: none;
  stroke: var(--accent-cyan);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s ease;
}

.test-score-ring__fill.is-pass { stroke: #22c55e; }
.test-score-ring__fill.is-warn { stroke: #f59e0b; }
.test-score-ring__fill.is-fail { stroke: #ef4444; }

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

.test-score-ring__value span {
  font-size: 1.5rem;
  font-weight: 800;
}

.test-score-ring__value small {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.test-results__headline {
  flex: 1 1 260px;
}

.test-results__badge {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(148, 163, 184, 0.16);
  margin-bottom: 0.6rem;
}

.test-results__badge.is-pass { background: rgba(34, 197, 94, 0.16); color: #4ade80; }
.test-results__badge.is-warn { background: rgba(245, 158, 11, 0.16); color: #fbbf24; }
.test-results__badge.is-fail { background: rgba(239, 68, 68, 0.16); color: #f87171; }

.test-results__headline h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 800;
}

.test-results__headline p {
  margin: 0 0 0.9rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.test-results__chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.test-result-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(34, 211, 238, 0.12);
  color: var(--accent-cyan);
}

.test-result-chip--wrong {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.test-result-chip--time {
  background: rgba(168, 85, 247, 0.12);
  color: var(--accent-purple);
}

.test-results__section-title {
  margin: 0 0 0.9rem;
  font-size: 1.05rem;
  font-weight: 800;
}

.test-category-breakdown {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 2rem;
}

.test-cat-row__head {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

.test-cat-row__name {
  font-weight: 600;
  color: var(--text-secondary);
}

.test-cat-row__score {
  font-weight: 700;
  color: var(--text-primary);
}

.test-cat-row__bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.test-cat-row__fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 999px;
}

.test-results__review-hint {
  margin: 0 0 1rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.test-review-filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.test-review-filter {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.02);
}

.test-review-filter.is-active {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(34, 211, 238, 0.1);
}

.test-review-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 640px;
  overflow-y: auto;
  padding-right: 0.25rem;
  margin-bottom: 2rem;
}

.test-review-item {
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.02);
  border-left: 3px solid rgba(148, 163, 184, 0.3);
}

.test-review-item.is-correct {
  border-left-color: #22c55e;
}

.test-review-item.is-wrong {
  border-left-color: #ef4444;
}

.test-review-item__head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.test-review-item__num {
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.test-review-item__category {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-blue);
}

.test-review-item__status {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
}

.test-review-item.is-correct .test-review-item__status {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
}

.test-review-item.is-wrong .test-review-item__status {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

.test-review-item__question {
  margin: 0 0 0.55rem;
  font-weight: 700;
  font-size: 0.94rem;
  line-height: 1.45;
}

.test-review-item__answers {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
}

.test-review-item__answer-line {
  margin: 0;
  font-size: 0.85rem;
}

.test-review-item__answer-line.is-good { color: #4ade80; }
.test-review-item__answer-line.is-bad { color: #f87171; }

.test-review-item__explanation {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.55;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(148, 163, 184, 0.16);
}

.test-review-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem 0;
}

.test-results__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── Responsive ───────────────────────────────────────────────── */

@media (max-width: 860px) {
  .test-intro__stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .test-length-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .test-results__summary {
    flex-direction: column;
    text-align: center;
  }

  .test-results__chips {
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .test-intro__stats {
    grid-template-columns: 1fr;
  }

  .test-length-grid {
    grid-template-columns: 1fr;
  }

  .test-nav-btn {
    width: 100%;
    justify-content: center;
  }

  .test-score-badge {
    position: static;
    display: inline-flex;
    margin-bottom: 1rem;
  }

  .test-quiz__top {
    padding-right: 0;
  }
}
