/* =============================================================
   SHSAT CAT TEST INTERFACE
   ============================================================= */

/* Test environment uses a more focused, exam-like aesthetic */
body.test-mode {
  background: var(--cream-100);
}

.test-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   TEST HEADER — minimal, focused
   ============================================================ */
.test-header {
  background: var(--ink-900);
  color: var(--cream-100);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05), 0 4px 24px rgba(0,0,0,0.15);
}
.test-header-left { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.test-section-label {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.test-section-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255,107,91,0.15);
  border: 1px solid rgba(255,107,91,0.3);
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--coral-500);
}
.test-section-pill::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--coral-500);
  border-radius: 50%;
}

/* Timer */
.test-timer {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 8px 14px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-base);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--cream-100);
  transition: all var(--dur-base);
}
.test-timer-icon {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}
.test-timer-icon::after {
  content: '';
  position: absolute;
  top: 1px; left: calc(50% - 1px);
  width: 2px;
  height: 5px;
  background: currentColor;
  transform-origin: bottom center;
  animation: timerTick 60s linear infinite;
}
@keyframes timerTick { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.test-timer[data-low="true"] {
  background: rgba(200, 69, 110, 0.2);
  border-color: var(--rose-500);
  color: var(--rose-500);
  animation: timerPulse 1.5s ease-in-out infinite;
}
@keyframes timerPulse { 0%,100%{opacity:1;} 50%{opacity:0.65;} }

/* Progress bar */
.test-progress {
  position: relative;
  flex: 1;
  max-width: 280px;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 3px;
  overflow: hidden;
}
.test-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--coral-500), var(--coral-600));
  border-radius: 3px;
  transition: width var(--dur-slow) var(--ease-out);
}
.test-progress-label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(250,247,242,0.7);
  white-space: nowrap;
}

.test-exit {
  font-size: 13px;
  color: rgba(250,247,242,0.6);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: all var(--dur-fast);
}
.test-exit:hover { color: white; background: rgba(255,255,255,0.05); }

/* ============================================================
   QUESTION CARD
   ============================================================ */
.test-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2.5rem);
}
.question-card {
  width: 100%;
  max-width: 880px;
  background: var(--paper);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
}
@media (min-width: 880px) {
  .question-card.has-passage { grid-template-columns: 1fr 1fr; }
}

.passage-pane {
  padding: var(--sp-6) var(--sp-8);
  background: var(--cream-100);
  border-right: 1px solid var(--ink-200);
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.passage-pane h3 {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-400);
  margin-bottom: var(--sp-3);
}
.passage-pane p {
  font-size: var(--fs-md);
  line-height: 1.7;
  color: var(--ink-800);
  margin-bottom: var(--sp-4);
}

.question-pane {
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
}
.question-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.question-num {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink-700);
}
.question-num .of { color: var(--ink-400); font-weight: 400; }

.question-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--ink-200);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-500);
  transition: all var(--dur-fast);
}
.question-flag:hover { border-color: var(--gold-500); color: var(--gold-500); }
.question-flag[data-flagged="true"] {
  background: var(--gold-100);
  border-color: var(--gold-500);
  color: var(--gold-500);
}
.question-flag::before { content: '⚑'; font-size: 14px; }

.question-prompt {
  font-size: var(--fs-md);
  line-height: 1.65;
  color: var(--ink-900);
  margin-bottom: var(--sp-6);
}
.question-prompt em { font-style: italic; color: var(--ink-700); display: inline-block; padding: 12px 18px; background: var(--cream-200); border-radius: var(--r-sm); margin-block: var(--sp-2); }
.question-prompt .mono { background: var(--ink-100); padding: 2px 6px; border-radius: 4px; }

/* Answer choices */
.choices-list { display: flex; flex-direction: column; gap: 10px; }
.choice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--paper);
  border: 1.5px solid var(--ink-200);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--dur-fast);
  text-align: left;
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--ink-800);
  width: 100%;
}
.choice:hover {
  border-color: var(--ink-700);
  background: var(--ink-50);
  transform: translateX(2px);
}
.choice-letter {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink-100);
  border: 1.5px solid var(--ink-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink-700);
  transition: all var(--dur-fast);
}
.choice[data-selected="true"] {
  border-color: var(--coral-500);
  background: var(--coral-100);
}
.choice[data-selected="true"] .choice-letter {
  background: var(--coral-500);
  border-color: var(--coral-500);
  color: white;
}
.choice[data-revealed="correct"] {
  border-color: var(--teal-500);
  background: var(--teal-100);
}
.choice[data-revealed="correct"] .choice-letter {
  background: var(--teal-500);
  border-color: var(--teal-500);
  color: white;
}
.choice[data-revealed="incorrect"] {
  border-color: var(--rose-500);
  background: var(--rose-100);
}
.choice[data-revealed="incorrect"] .choice-letter {
  background: var(--rose-500);
  border-color: var(--rose-500);
  color: white;
}
.choice-text { flex: 1; padding-top: 4px; }

/* Footer controls */
.question-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--ink-200);
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.action-hint {
  font-size: 12px;
  color: var(--ink-400);
}
.action-buttons { display: flex; gap: var(--sp-2); }
.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  background: var(--ink-800);
  color: white;
  border-radius: var(--r-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: all var(--dur-base) var(--ease-out);
  cursor: pointer;
}
.btn-submit:hover:not(:disabled) { background: var(--ink-700); transform: translateY(-1px); box-shadow: var(--sh-md); }
.btn-submit:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   CONFIDENCE METER — shows CAT engine state honestly
   ============================================================ */
.cat-status {
  background: var(--cream-200);
  border: 1px solid var(--ink-200);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: 12px;
}
.cat-status-text { color: var(--ink-600); }
.cat-status-text strong { color: var(--ink-900); }
.cat-meter {
  width: 80px;
  height: 4px;
  background: var(--ink-200);
  border-radius: 2px;
  overflow: hidden;
}
.cat-meter-fill {
  height: 100%;
  background: var(--coral-500);
  transition: width var(--dur-slow) var(--ease-out);
}

/* ============================================================
   EXPLANATION REVEAL (post-answer)
   ============================================================ */
.explanation {
  margin-top: var(--sp-5);
  padding: var(--sp-5);
  background: var(--cream-200);
  border-left: 4px solid var(--ink-800);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.65;
  color: var(--ink-700);
  animation: slideDown var(--dur-slow) var(--ease-out);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.explanation-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-800);
  margin-bottom: var(--sp-2);
  display: block;
}
.explanation strong { color: var(--ink-900); }

/* ============================================================
   START SCREEN
   ============================================================ */
.start-screen, .results-screen, .section-break-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-8);
}
.start-card {
  max-width: 640px;
  width: 100%;
  background: var(--paper);
  border-radius: var(--r-2xl);
  padding: var(--sp-12);
  box-shadow: var(--sh-xl);
  text-align: center;
}
.start-card h1 {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-3);
}
.start-card h1 em { font-style: italic; color: var(--coral-600); }
.start-card .lead {
  color: var(--ink-500);
  margin-bottom: var(--sp-8);
  line-height: 1.6;
}
.test-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
  padding: var(--sp-5);
  background: var(--cream-100);
  border-radius: var(--r-lg);
}
.test-spec-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-400);
  margin-bottom: var(--sp-1);
}
.test-spec-value {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--ink-800);
}

.cat-explainer {
  text-align: left;
  background: var(--cream-200);
  border-radius: var(--r-md);
  padding: var(--sp-5);
  margin-bottom: var(--sp-8);
  font-size: 13px;
  color: var(--ink-600);
  line-height: 1.65;
}
.cat-explainer strong { color: var(--ink-900); }

/* ============================================================
   RESULTS SCREEN
   ============================================================ */
.results-card {
  max-width: 760px;
  width: 100%;
  background: var(--paper);
  border-radius: var(--r-2xl);
  padding: var(--sp-12);
  box-shadow: var(--sh-xl);
}
.results-hero { text-align: center; margin-bottom: var(--sp-10); }
.results-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral-600);
  margin-bottom: var(--sp-3);
}
.results-composite {
  font-family: var(--font-display);
  font-size: clamp(4rem, 14vw, 6.5rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, var(--ink-800) 0%, var(--coral-600) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.results-out-of {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--ink-400);
  margin-top: var(--sp-2);
}
.results-section-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
  margin-bottom: var(--sp-10);
}
.section-result {
  padding: var(--sp-5);
  background: var(--cream-100);
  border-radius: var(--r-lg);
  text-align: center;
}
.section-result-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: var(--sp-2);
}
.section-result-score {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  font-weight: 700;
  color: var(--ink-800);
  letter-spacing: -0.02em;
}
.section-result-stats {
  font-size: 12px;
  color: var(--ink-500);
  margin-top: var(--sp-2);
}

.results-schools {
  margin-bottom: var(--sp-8);
}
.results-schools h3 {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: var(--sp-4);
}
.results-confidence {
  padding: var(--sp-4);
  background: var(--gold-100);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.6;
  margin-bottom: var(--sp-8);
}
.results-confidence[data-confidence="high"] {
  background: var(--teal-100);
  border-left-color: var(--teal-500);
}
.results-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; justify-content: center; }

/* ============================================================
   SECTION BREAK
   ============================================================ */
.section-break-card {
  max-width: 560px;
  background: var(--paper);
  border-radius: var(--r-2xl);
  padding: var(--sp-12);
  box-shadow: var(--sh-xl);
  text-align: center;
}
.section-break-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--sp-5);
  background: var(--teal-100);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--teal-700);
}
.section-break-card h2 {
  font-family: var(--font-display);
  font-size: var(--fs-2xl);
  margin-bottom: var(--sp-3);
}
.section-break-card p {
  color: var(--ink-500);
  margin-bottom: var(--sp-8);
}
.partial-score {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: var(--sp-2) var(--sp-4);
  background: var(--cream-100);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  margin-bottom: var(--sp-6);
}
.partial-score-num {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--ink-800);
}
.partial-score-label { font-size: 12px; color: var(--ink-500); }

/* ============================================================
   MOBILE TUNING
   ============================================================ */
@media (max-width: 640px) {
  .test-progress { display: none; }
  .test-progress-label { font-size: 11px; }
  .start-card, .results-card, .section-break-card { padding: var(--sp-6); }
  .results-section-breakdown { grid-template-columns: 1fr; }
  .test-specs { grid-template-columns: 1fr; gap: var(--sp-3); padding: var(--sp-4); }
  .question-pane, .passage-pane { padding: var(--sp-5); }
  .test-section-label { font-size: var(--fs-base); }
}
