/* Shared Pearl presentation; only exam-local palette tokens change with the theme. */
:root #app :is(.student-exam-workspace, .student-exam-dialog) {
  --bg: #fbfcfc;
  --bg-alt: #eef2f1;
  --card: #ffffff;
  --card-strong: #ffffff;
  --text: #242729;
  --muted: #676d72;
  --quiet: #737b7e;
  --border: #dce0e1;
  --border-strong: #c5cdcb;
  --gold: #e9bf54;
  --gold-dark: #907021;
  --gold-soft: #faf6e9;
  --workspace-canvas: var(--bg);
  --workspace-surface: var(--card);
  --workspace-line: var(--border);
  --workspace-gold-ink: var(--gold-dark);
  --accent-violet: var(--exam-mint-accent);
  --accent-violet-soft: transparent;
  --accent-violet-rim: var(--border);
  --accent-violet-glow: transparent;
  --accent-gradient: var(--gold);
  --accent-gradient-hover: var(--exam-gold-hover);
  --accent-outline-gradient: var(--border);
  --accent-outline-glow: none;
  --button-gold-fill: var(--gold);
  --button-gold-fill-hover: var(--exam-gold-hover);
  --gold-violet-soft: var(--gold-soft);
  --gold-violet-active: var(--gold-soft);
  --focus-ring: 0 0 0 2px var(--gold-dark);
  --shadow: 0 16px 48px #2130320a;
  --shadow-soft: none;
  --mock-card-untaken-bg: var(--card);
  --mock-card-untaken-hover-bg: var(--exam-hover);
  --mock-card-untaken-border: var(--border);
  --mock-card-taken-bg: var(--exam-passage);
  --mock-card-taken-hover-bg: var(--exam-completed-hover);
  --mock-card-taken-border: var(--exam-completed-border);
  --mock-card-icon-bg: var(--exam-passage);
  --exam-mint-accent: #a5bcb3;
  --exam-hover: #f5f8f6;
  --exam-hover-border: #b5c5bd;
  --exam-passage: #f0f5f3;
  --exam-passage-border: #dbe3df;
  --exam-passage-text: #46524d;
  --exam-completed-hover: #e9f1ed;
  --exam-completed-border: #bfcec5;
  --exam-selected-border: #b89541;
  --exam-gold-border: #d9ae45;
  --exam-gold-hover: #e1b546;
  --exam-on-gold: #28241c;
  --exam-button-highlight: #ffffff55;
  --exam-disabled: #e9edeb;
  --exam-disabled-text: #747d78;
  --exam-pill-text: #56615b;
  --exam-warning-border: #dac58e;
  --exam-warning-text: #725716;
  --exam-success: #edf7f0;
  --exam-success-border: #8fbea0;
  --exam-success-text: #22633c;
  --exam-danger: #fff1ef;
  --exam-danger-border: #d9aaa4;
  --exam-danger-text: #963e35;
  --exam-overlay: #24272955;
  color-scheme: light;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

:root[data-theme="dark"] #app :is(.student-exam-workspace, .student-exam-dialog) {
  color-scheme: dark;
  --bg: #171b1c;
  --bg-alt: #28312e;
  --card: #202627;
  --card-strong: #29312f;
  --text: #edf1ef;
  --muted: #aab5b0;
  --quiet: #9aa8a1;
  --border: #394340;
  --border-strong: #66776e;
  --gold: #e7c361;
  --gold-dark: #e7c361;
  --gold-soft: #353224;
  --shadow: 0 16px 48px #00000022;
  --exam-mint-accent: #9db8ac;
  --exam-hover: #293730;
  --exam-hover-border: #718b7d;
  --exam-passage: #212e2a;
  --exam-passage-border: #3a5147;
  --exam-passage-text: #c5d3cb;
  --exam-completed-hover: #293a31;
  --exam-completed-border: #567261;
  --exam-selected-border: #bfa055;
  --exam-gold-border: #c6a34b;
  --exam-gold-hover: #f0ce76;
  --exam-on-gold: #252219;
  --exam-button-highlight: #ffffff22;
  --exam-disabled: #2b3230;
  --exam-disabled-text: #84918a;
  --exam-pill-text: #c0cec6;
  --exam-warning-border: #8c7743;
  --exam-warning-text: #edcf85;
  --exam-success: #203b2c;
  --exam-success-border: #70b78a;
  --exam-success-text: #a4e8bb;
  --exam-danger: #412a2b;
  --exam-danger-border: #dc8a84;
  --exam-danger-text: #ffb6b0;
  --exam-overlay: #080c0bb3;
  --theme-control-bg: var(--card);
  --theme-hover-bg: var(--exam-hover);
  --theme-raised-bg: var(--card-strong);
  --theme-on-gold: var(--exam-on-gold);
  --theme-selected-border: var(--exam-selected-border);
  --theme-warning-bg: var(--gold-soft);
  --theme-warning-border: var(--exam-warning-border);
  --theme-warning-text: var(--exam-warning-text);
}

:root #app .student-exam-workspace { background: var(--bg); }
:root #app .student-exam-dialog { background: var(--exam-overlay); }

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(h1, h2, h3, h4, .eyebrow, .qb-filter-control > span) {
  letter-spacing: 0;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .top-nav::before,
:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.app-sidebar, .mobile-drawer-panel, .profile-popover) {
  background: var(--card);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .app-sidebar::before {
  background: transparent;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.card, .stat-card, .strategy-modal, .reading-history-card, .reading-mode-card, .fluency-select-popover, .speaking-review-card) {
  background: var(--card);
  border-color: var(--border);
  border-radius: 8px;
  box-shadow: none;
  backdrop-filter: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-start-card, .reading-question-panel, .writing-editor-panel, .qb-question-card, .sat-results-summary, .sat-breakdown-card, .sat-review-list-card, .sat-review-detail-card) {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* Exam start dialogs live outside the app frame, unlike inline start screens. */
:root #app .student-exam-dialog .reading-start-card {
  background: var(--card);
  border-color: var(--border);
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-passage-panel, .writing-task-panel, .sat-text-block, .sat-notes-list, .act-passage-panel, .speaking-prompt-card, .listening-transcript-box) {
  background: var(--exam-passage);
  border: 1px solid var(--exam-passage-border);
  border-radius: 8px;
  box-shadow: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .sat-passage-text {
  padding: 24px;
  border: 1px solid var(--exam-passage-border);
  border-radius: 8px;
  background: var(--exam-passage);
}

/* Paired passages and ACT already have a mint parent; do not nest another panel. */
:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.sat-text-block, .act-passage-panel) .sat-passage-text {
  padding: 0;
  border: 0;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-passage-text, .writing-prompt-box p:not(.eyebrow), .listening-transcript-lines, .sat-notes-list) {
  color: var(--exam-passage-text);
  font-size: 16px;
  line-height: 1.85;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-passage-text p {
  margin: 0;
  line-height: inherit;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-question-group, .reading-question-item, .writing-prompt-box, .writing-helper-card, .sat-review-question, .speaking-cue-card) {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-question-stack { gap: 28px; }
:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-question-group { gap: 20px; }
:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-question-item { gap: 12px; }

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-passage-panel h2, .writing-task-head h2, .sat-stimulus-stack h2, .reading-question-panel h2, .speaking-cue-card h2) {
  color: var(--text);
  font-size: 21px;
  line-height: 1.4;
  font-weight: 650;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .speaking-prompt-text {
  font-size: 28px;
  font-weight: 650;
  line-height: 1.45;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-choice {
  min-height: 48px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  box-shadow: none;
  font-size: 15px;
  line-height: 1.6;
  transform: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-choice span { line-height: inherit; }
:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-choice strong { color: var(--gold-dark); }

:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-choice:hover:not(:disabled):not(.active):not(.correct):not(.incorrect):not(.selected) {
  border-color: var(--exam-hover-border);
  background: var(--exam-hover);
  transform: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-choice.active, .filter-pill.active, .sat-question-pill.active, .sat-review-row.active) {
  border-color: var(--exam-selected-border);
  background: var(--gold-soft);
  color: var(--text);
  box-shadow: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.btn-secondary, .filter-pill:not(.active), .fluency-select-trigger, .text-input, .textarea, .select-input, .listening-audio-player, .listening-audio-btn, .writing-image-card) {
  background: var(--card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.btn-primary, .listening-audio-btn.primary) {
  background: var(--gold);
  border-color: var(--exam-gold-border);
  color: var(--exam-on-gold);
  box-shadow: inset 0 1px 0 var(--exam-button-highlight);
}

/* Keep source diagrams readable, including transparent images with dark labels. */
:root[data-theme="dark"] #app :is(.student-exam-workspace, .student-exam-dialog) .writing-image-card:not(.is-missing) {
  background: var(--theme-media-bg);
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .btn-primary:hover:not(:disabled) {
  background: var(--exam-gold-hover);
  box-shadow: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.btn, .listening-audio-btn):disabled {
  background: var(--exam-disabled);
  border-color: var(--border);
  color: var(--exam-disabled-text);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.timer-pill, .tiny-pill, .reading-primary-type-pill) {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--exam-pill-text);
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.timer-pill.warning, .reading-alert) {
  background: var(--gold-soft);
  border-color: var(--exam-warning-border);
  color: var(--exam-warning-text);
}

/* Feedback overrides selection colors, including disabled answer-review buttons. */
:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-choice.correct, .reading-question-correct, .qb-feedback-card.correct) {
  background: var(--exam-success);
  border-color: var(--exam-success-border);
  color: var(--exam-success-text);
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-choice.incorrect, .sat-review-choice.selected:not(.correct), .reading-question-incorrect, .qb-feedback-card.incorrect) {
  background: var(--exam-danger);
  border-color: var(--exam-danger-border);
  color: var(--exam-danger-text);
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-question-unanswered {
  background: var(--gold-soft);
  color: var(--exam-warning-text);
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-question-correct, .reading-question-incorrect, .reading-question-unanswered) {
  padding: 12px;
  border-radius: 8px;
}

:root #app :is(.student-exam-workspace, .student-exam-dialog) :is(button, a, input, textarea, select, summary):focus-visible {
  outline: 2px solid var(--gold-dark);
  outline-offset: 3px;
  box-shadow: none;
}

@media (max-width: 820px) {
  :root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-passage-panel, .writing-task-panel, .sat-passage-text, .speaking-prompt-card) { padding: 20px; }
  :root #app :is(.student-exam-workspace, .student-exam-dialog) :is(.reading-question-panel, .writing-editor-panel, .qb-question-card) { padding: 4px; }
  :root #app :is(.student-exam-workspace, .student-exam-dialog) .reading-choice { padding: 12px; }
  :root #app :is(.student-exam-workspace, .student-exam-dialog) .speaking-prompt-text { font-size: 23px; }
}

/* Mock catalog and Reading passage typography. */
:root #app .student-exam-workspace .tests-section .mock-content-intro { display:grid; gap:5px; }
:root #app .student-exam-workspace .tests-section .mock-content-intro :is(h2,p) { margin:0; }
:root #app .student-exam-workspace .tests-section .reading-test-card:not(.is-locked) {
  border-color:var(--study-edge); border-radius:8px; box-shadow: inset 0 2px 0 var(--study-edge);
}
:root #app .student-exam-workspace .reading-test-card:not(.is-locked) .mock-card-heading-row .icon-circle {
  border-radius:8px; background:var(--study-wash); color:var(--study-ink);
}
:root #app .student-exam-workspace .reading-test-card .mock-card-heading { display:grid; gap:4px; }
:root #app .student-exam-workspace .reading-test-card .mock-card-heading :is(h3,p) { margin:0; }
:root #app .student-exam-workspace .reading-test-card .mock-card-topics { line-height:1.5; }
:root #app .student-exam-workspace .reading-test-card .mock-card-facts { font-variant-numeric:tabular-nums; }
:root #app .student-exam-workspace .reading-exam-page .reading-exam-topbar .timer-pill { font-variant-numeric:tabular-nums; }
:root #app .student-exam-workspace .reading-exam-page .reading-passage-panel {
  border:1px solid var(--study-edge); border-top:3px solid var(--study-edge); border-radius:8px; padding:24px;
}
:root #app .student-exam-workspace .reading-exam-page .reading-passage-text { max-width:66ch; line-height:1.72; }
:root #app .student-exam-workspace .reading-exam-page .reading-passage-text p + p { margin-top:1em; }
:root #app .student-exam-workspace .reading-exam-page .reading-question-group-head {
  padding-inline-start:14px; border-inline-start:2px solid var(--study-line);
}
:root #app .student-exam-workspace .reading-exam-page .reading-question-group-head h3 { margin:0; }
:root #app .student-exam-workspace .reading-exam-page .reading-question-group-head p { line-height:1.55; }
@media (max-width:640px){
  :root #app .student-exam-workspace .reading-exam-page .reading-passage-panel { padding:16px; }
}
