.test-stage {
  max-width: 1120px;
  margin: 0 auto;
}

.test-hero {
  margin-bottom: 32px;
}

.section-kicker {
  margin: 0 0 10px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 700;
}

.test-start-layout {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.test-rules-card,
.start-card,
.question-card,
.results-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.test-rules-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
}

.test-rules-card h2 {
  margin: 0 0 18px;
  font-size: 1.15rem;
}

.rules-list {
  margin: 0;
  display: grid;
  gap: 16px;
}

.rules-list div {
  display: grid;
  gap: 6px;
}

.rules-list dt {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 700;
}

.rules-list dd {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
  font-size: 0.95rem;
}

.start-card {
  text-align: left;
}

.start-card h2 {
  margin: 0 0 14px;
  font-size: 1.85rem;
}

.start-card p {
  color: var(--muted);
  margin: 0 0 18px;
  line-height: 1.6;
}

#test-start-extra {
  display: grid;
  gap: 12px;
}

.btn-primary,
.btn-secondary {
  display: inline-block;
  padding: 14px 32px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent-2);
  color: var(--bg);
}

.btn-primary:hover {
  background: #35b0e0;
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--accent-2);
  border: 1px solid var(--accent-2);
}

.btn-secondary:hover {
  background: rgba(68, 197, 245, 0.1);
}

.quiz-progress {
  margin-bottom: 24px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--accent-2);
  transition: width 0.3s ease;
  width: 0%;
}

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

.question-card {
  text-align: left;
  max-width: 760px;
  margin: 0 auto;
}

.question-header {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.difficulty,
.category {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.difficulty {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.difficulty.easy {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.difficulty.hard {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.category {
  background: rgba(143, 125, 243, 0.15);
  color: var(--accent);
}

.provenance-badge {
  background: rgba(68, 197, 245, 0.14);
  color: var(--accent-2);
  border: 1px solid rgba(68, 197, 245, 0.22);
}

.provenance-badge.handbook {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.24);
}

.timer-badge {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.24);
}

.timer-badge.warning {
  background: rgba(251, 191, 36, 0.14);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.24);
}

.integrity-banner {
  margin-bottom: 20px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.22);
  background: rgba(251, 191, 36, 0.1);
  color: #fbbf24;
  font-size: 0.95rem;
  line-height: 1.5;
}

.integrity-banner.error {
  border-color: rgba(239, 68, 68, 0.24);
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
}

.integrity-modal {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.integrity-modal[hidden] {
  display: none;
}

.integrity-modal-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(255, 90, 90, 0.16), transparent 45%),
    rgba(5, 7, 14, 0.9);
  backdrop-filter: blur(10px);
}

.integrity-modal-card {
  position: relative;
  width: min(100%, 460px);
  padding: 28px 28px 24px;
  border-radius: 24px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background:
    linear-gradient(180deg, rgba(29, 17, 10, 0.96), rgba(11, 9, 17, 0.98)),
    rgba(10, 11, 19, 0.98);
  box-shadow:
    0 36px 80px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  text-align: center;
  color: var(--text);
}

.integrity-modal-card.warning {
  border-color: rgba(251, 191, 36, 0.34);
}

.integrity-modal-card.error {
  border-color: rgba(239, 68, 68, 0.38);
  background:
    linear-gradient(180deg, rgba(39, 10, 10, 0.98), rgba(13, 9, 17, 0.99)),
    rgba(10, 11, 19, 0.98);
}

.integrity-modal-emblem {
  width: 112px;
  height: 112px;
  margin: 0 auto 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.14), transparent 58%),
    radial-gradient(circle at 70% 70%, rgba(251, 191, 36, 0.16), transparent 60%),
    rgba(255, 255, 255, 0.04);
  color: #fbbf24;
  box-shadow:
    0 0 0 1px rgba(251, 191, 36, 0.18) inset,
    0 18px 40px rgba(0, 0, 0, 0.34);
}

.integrity-modal-card.error .integrity-modal-emblem {
  color: #f87171;
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.2) inset,
    0 18px 40px rgba(0, 0, 0, 0.34);
}

.integrity-skull-mark {
  width: 68px;
  height: 68px;
}

.integrity-modal-kicker {
  margin: 0 0 8px;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
}

.integrity-modal-card.error .integrity-modal-kicker {
  color: #fca5a5;
}

.integrity-modal-card h2 {
  margin: 0 0 12px;
  font-size: 2rem;
  line-height: 1.05;
}

.integrity-modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 1rem;
}

.integrity-modal-actions {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.integrity-modal-actions .btn-primary {
  min-width: 190px;
}

.quiz-source-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.question-card h2 {
  margin: 0 0 32px;
  font-size: 1.5rem;
  line-height: 1.4;
}

.choice {
  display: block;
  width: 100%;
  padding: 16px 20px;
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.choice:hover:not(:disabled) {
  border-color: var(--accent-2);
  background: rgba(68, 197, 245, 0.1);
}

.choice:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.choice.correct {
  border-color: var(--success);
  background: rgba(74, 222, 128, 0.15);
}

.choice.incorrect {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
}

#question-feedback,
#answer-feedback {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

#feedback-content {
  margin-bottom: 20px;
}

.feedback-correct {
  color: var(--success);
  font-weight: 600;
  margin-bottom: 12px;
}

.feedback-incorrect {
  color: #ef4444;
  font-weight: 600;
  margin-bottom: 12px;
}

.feedback-rationale {
  color: var(--muted);
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 8px;
  margin-top: 12px;
}

.results-card h2 {
  margin: 0 0 18px;
  font-size: 2rem;
}

.results-next-step {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.6;
}

.score-display {
  margin-bottom: 32px;
}

.score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--accent-2);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 auto 20px;
}

.score-display p {
  color: var(--muted);
  font-size: 1.1rem;
}

.results-breakdown {
  text-align: left;
  margin-bottom: 32px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.results-breakdown h3 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  color: var(--accent);
}

.breakdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.breakdown-item span:first-child {
  color: var(--muted);
}

.breakdown-item span:last-child {
  font-weight: 600;
  color: var(--accent-2);
}

.results-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .test-start-layout {
    grid-template-columns: 1fr;
  }

  .test-rules-card,
  .start-card,
  .question-card,
  .results-card {
    padding: 24px;
  }

  .question-card h2 {
    font-size: 1.2rem;
  }

  .score-circle {
    width: 100px;
    height: 100px;
    font-size: 2rem;
  }

  .integrity-modal {
    padding: 16px;
  }

  .integrity-modal-card {
    padding: 24px 20px 20px;
  }

  .integrity-modal-emblem {
    width: 92px;
    height: 92px;
    margin-bottom: 14px;
  }

  .integrity-skull-mark {
    width: 56px;
    height: 56px;
  }

  .integrity-modal-card h2 {
    font-size: 1.65rem;
  }

  .integrity-modal-copy {
    font-size: 0.95rem;
  }

  .integrity-modal-actions .btn-primary {
    width: 100%;
    min-width: 0;
  }
}
