:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --ink: #111827;
  --muted: #6b7280;
  --line: #d1d5db;
  --line-soft: #e5e7eb;
  --red: #d71920;
  --red-dark: #ad1218;
  --green: #137333;
  --amber: #9a5b00;
  --shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.14);
}

textarea {
  resize: vertical;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.brand {
  font-weight: 800;
  color: var(--red);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a {
  color: var(--ink);
  font-weight: 700;
}

.topnav form {
  margin: 0;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--red);
  cursor: pointer;
  padding: 0;
  font-weight: 700;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.messages {
  width: min(1180px, calc(100% - 32px));
  margin: 16px auto 0;
  display: grid;
  gap: 8px;
}

.message {
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  background: var(--surface);
  padding: 12px 14px;
  border-radius: 6px;
}

.message-success {
  border-left-color: var(--green);
}

.message-error {
  border-left-color: var(--red);
}

.message-info {
  border-left-color: #2563eb;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

.auth-panel {
  width: min(460px, 100%);
  margin: 9vh auto 0;
  display: grid;
  gap: 26px;
  padding: 34px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-stack label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  background: var(--red);
  color: #fff;
}

.primary-button:hover {
  background: var(--red-dark);
}

.secondary-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.compact {
  min-width: 82px;
}

.dashboard-head,
.exam-header,
.result-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 24px;
}

.credit-box,
.timer-box,
.score-box {
  min-width: 168px;
  display: grid;
  gap: 5px;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.credit-box span,
.timer-box span,
.score-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.credit-box strong,
.timer-box strong,
.score-box strong {
  font-size: 30px;
  line-height: 1;
}

.timer-box.is-low strong {
  color: var(--red);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 22px;
  align-items: start;
}

.panel,
.paper-section {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.paper-section {
  overflow: hidden;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.exam-list,
.attempt-list,
.question-list {
  display: grid;
}

.exam-item,
.attempt-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 0;
  border-top: 1px solid var(--line-soft);
}

.exam-item:first-child,
.attempt-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.exam-item:last-child,
.attempt-row:last-child {
  padding-bottom: 0;
}

.exam-item p {
  margin-bottom: 6px;
}

.attempt-row {
  display: grid;
  color: var(--ink);
}

.attempt-row small {
  color: var(--muted);
}

.empty-state {
  color: var(--muted);
  margin: 0;
}

.exam-form {
  display: grid;
  gap: 22px;
}

.paper-section {
  padding: 24px;
}

.audio-panel {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.audio-panel audio {
  width: 100%;
}

.passage {
  margin: 16px 0;
  padding: 18px;
  border-left: 4px solid var(--red);
  background: var(--surface-soft);
  line-height: 1.75;
}

.instruction-copy {
  margin: 12px 0 18px;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.65;
}

.compact-copy {
  margin: 8px 0 0;
  font-weight: 700;
}

.question-group {
  padding: 18px 0 10px;
  border-top: 1px solid var(--line-soft);
}

.question-group:first-of-type {
  border-top: 0;
}

.question-group-head {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.question-group-head h3 {
  margin: 0;
  font-size: 19px;
}

.question-body {
  margin: 14px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 2;
}

.inline-answer {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: min(220px, 48vw);
  margin: 0 5px;
  vertical-align: middle;
}

.inline-answer input {
  height: 36px;
  padding: 6px 34px 6px 10px;
  border-color: #b8c0cc;
}

.inline-answer small {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--red);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 900;
}

.inline-missing {
  display: inline-flex;
  min-width: 44px;
  align-items: center;
  justify-content: center;
  color: var(--red);
  font-weight: 900;
}

.question-block {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: 0;
  padding: 18px 0;
  min-inline-size: 0;
}

.question-block:first-child {
  border-top: 0;
}

.question-block legend {
  width: 100%;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  padding: 0 0 12px;
}

.question-block legend span {
  color: var(--red);
  font-weight: 900;
}

.question-prompt {
  display: grid;
  gap: 8px;
  color: #111827;
  font-weight: 900;
  line-height: 1.55;
}

.choice-list {
  display: grid;
  gap: 8px;
}

.choice-row,
.segmented-choices label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.choice-row input,
.segmented-choices input {
  width: auto;
  flex: 0 0 auto;
}

.segmented-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.matching-widget {
  display: grid;
  gap: 16px;
}

.matching-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d5dce5;
  border-radius: 6px;
  background: #f8fafc;
}

.matching-chip,
.matching-drop-value,
.matching-clear {
  min-height: 38px;
  border: 1px solid #aeb7c3;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font-weight: 900;
}

.matching-chip {
  padding: 8px 12px;
  text-align: left;
  cursor: grab;
}

.matching-chip.is-selected {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.14);
}

.matching-targets {
  display: grid;
  gap: 10px;
}

.matching-target {
  display: grid;
  grid-template-columns: minmax(168px, 0.55fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px dashed #b8c0cc;
  border-radius: 6px;
  background: #fff;
}

.matching-target.is-dragover {
  border-color: var(--red);
  background: #fff5f5;
}

.matching-target-label {
  display: grid;
  gap: 3px;
  color: var(--red);
  font-weight: 900;
}

.matching-target-label small {
  color: #111827;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
}

.matching-drop-value {
  width: 100%;
  padding: 8px 12px;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}

.matching-drop-value.has-value {
  color: #111827;
  cursor: grab;
}

.matching-clear {
  padding: 8px 12px;
  color: var(--muted);
  cursor: pointer;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 0;
  background: linear-gradient(to top, var(--bg) 72%, rgba(243, 244, 246, 0));
}

.exam-shell-page {
  overflow: hidden;
  width: 100vw;
  height: 100dvh;
  background: #e9edf2;
}

.exam-shell-page .topbar,
.exam-shell-page .messages {
  display: none;
}

.exam-shell-page .page {
  width: 100%;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
}

.exam-shell {
  height: 100dvh;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) 62px;
  background: #e9edf2;
}

.exam-app-top,
.exam-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #c9d0da;
  background: #f8fafc;
}

.exam-app-top {
  min-height: 0;
  padding: 0 18px;
  border-bottom: 1px solid #c9d0da;
}

.exam-app-title {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.exam-app-title strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-kicker {
  color: #697386;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.exam-save-state {
  min-width: 148px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid #cfd6df;
  border-radius: 6px;
  background: #fff;
  color: #4b5563;
  font-size: 13px;
  font-weight: 800;
}

.exam-save-state[data-state="saving"],
.exam-save-state[data-state="dirty"] {
  color: var(--amber);
  background: #fff8e6;
}

.exam-save-state[data-state="saved"] {
  color: var(--green);
  background: #edf8f1;
}

.exam-save-state[data-state="error"] {
  color: var(--red-dark);
  background: #fde8e9;
}

.exam-timer {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 800;
}

.exam-timer strong {
  min-width: 76px;
  color: #0f172a;
  font-size: 24px;
  line-height: 1;
  text-align: right;
}

.exam-timer.is-low strong {
  color: var(--red);
}

.exam-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.exam-part-rail {
  min-height: 0;
  overflow: auto;
  padding: 16px 12px;
  border-right: 1px solid #c9d0da;
  background: #f3f5f8;
}

.exam-part-rail a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 54px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #374151;
}

.exam-part-rail a + a {
  margin-top: 8px;
}

.exam-part-rail a.is-active,
.exam-part-rail a:hover {
  border-color: #c9d0da;
  background: #fff;
}

.exam-part-rail span {
  display: inline-flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #d71920;
  color: #fff;
  font-weight: 900;
}

.exam-part-rail strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-stage {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  scroll-behavior: smooth;
}

.exam-panel {
  width: min(100%, 1440px);
  min-height: calc(100vh - 192px);
  margin: 0 auto 18px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  border: 1px solid #c9d0da;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.exam-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #dbe1e8;
}

.exam-panel-head span,
.exam-panel-head small {
  color: #697386;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.exam-panel-head h1 {
  margin: 3px 0 0;
  font-size: 22px;
  line-height: 1.2;
}

.exam-audio-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid #dbe1e8;
  background: #f7f9fb;
}

.exam-audio-strip audio {
  width: 100%;
}

.exam-split {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(360px, 0.94fr);
}

.exam-source-pane,
.exam-answer-pane {
  min-height: 0;
  overflow: auto;
  padding: 22px;
}

.exam-source-pane {
  border-right: 1px solid #dbe1e8;
  background: #fbfcfe;
}

.exam-answer-pane {
  background: #fff;
}

.exam-instructions {
  margin-bottom: 16px;
  color: #111827;
  font-weight: 900;
  line-height: 1.65;
}

.exam-passage {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #dbe1e8;
  border-radius: 6px;
  background: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.8;
}

.exam-source-block + .exam-source-block,
.exam-answer-block + .exam-answer-block {
  margin-top: 22px;
}

.exam-source-block h2,
.exam-answer-block h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.exam-question-body {
  padding: 18px;
  border: 1px solid #d5dce5;
  border-radius: 6px;
  background: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 2;
}

.exam-image,
.exam-image-stack {
  margin: 16px 0;
}

.exam-image img {
  display: block;
  max-width: 100%;
  max-height: 520px;
  border: 1px solid #d5dce5;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}

.exam-image figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 800;
}

.exam-bottom-bar {
  padding: 0 14px;
  border-top: 1px solid #c9d0da;
}

.question-nav {
  min-width: 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 8px 0;
}

.question-nav button {
  min-width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid #aeb7c3;
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: #111827;
  font-weight: 900;
  cursor: pointer;
}

.question-nav button.is-answered {
  border-color: var(--green);
  background: #e8f5ec;
  color: var(--green);
}

.question-nav button.is-partial {
  border-color: #b7791f;
  background: #fff8e6;
  color: #8a5a12;
}

.question-nav button:hover {
  border-color: var(--red);
}

.exam-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.exam-actions .primary-button,
.exam-actions .secondary-button {
  min-height: 38px;
  padding: 8px 14px;
}

.exam-shell .question-block {
  padding: 18px 0;
}

.exam-shell .question-block:first-child {
  padding-top: 0;
}

.exam-shell .question-block.is-current,
.exam-shell .inline-answer.is-current {
  box-shadow: 0 0 0 4px rgba(215, 25, 32, 0.16);
}

.exam-shell input[type="text"],
.exam-shell textarea {
  border-color: #aeb7c3;
}

.exam-small-screen {
  display: none;
}

.exam-brand-lockup {
  min-width: 210px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.exam-brand-lockup strong {
  color: var(--red);
  font-size: 26px;
  font-weight: 950;
  letter-spacing: 0;
}

.exam-brand-lockup span {
  max-width: 360px;
  overflow: hidden;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-session-id {
  min-width: 132px;
  display: grid;
  gap: 3px;
  text-align: right;
}

.exam-session-id span {
  color: #6b7280;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.exam-session-id strong {
  color: #111827;
  font-size: 18px;
  letter-spacing: 2px;
}

.exam-shell .exam-workspace {
  position: relative;
  min-height: 0;
  display: block;
  background: #f5f6f8;
}

.exam-shell .exam-stage {
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  scroll-behavior: auto;
}

.exam-shell .exam-panel {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.exam-shell .exam-panel[hidden] {
  display: none !important;
}

.exam-shell .exam-panel-head {
  min-height: 54px;
  padding: 8px 18px;
  background: #fff;
}

.exam-shell .exam-panel-head h1 {
  font-size: 20px;
}

.exam-shell .exam-audio-strip {
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 58px;
  padding: 10px 20px;
  background: #f2f5f8;
}

.exam-shell .exam-audio-strip audio {
  display: none;
}

.exam-shell .exam-audio-strip span {
  min-height: 38px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 18px;
  background: #e9edf2;
  color: #374151;
  font-weight: 900;
}

.exam-shell .exam-split {
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, 0.95fr);
  min-height: 0;
}

.exam-shell .exam-source-pane,
.exam-shell .exam-answer-pane {
  padding: 20px 26px 78px;
}

.exam-shell .exam-source-pane {
  background: #fff;
}

.exam-shell .exam-answer-pane {
  background: #f9fafb;
}

.exam-shell .exam-instructions {
  font-size: 17px;
}

.exam-shell .exam-question-body,
.exam-shell .exam-passage {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  font-size: 17px;
  line-height: 1.85;
}

.exam-shell .exam-answer-block h2,
.exam-shell .exam-source-block h2 {
  font-size: 22px;
}

.exam-shell .choice-row {
  min-height: 52px;
  border-color: #cbd5e1;
  border-radius: 4px;
  background: #fff;
}

.exam-shell .choice-row:hover {
  border-color: #64748b;
}

.exam-shell .question-block legend {
  grid-template-columns: 72px minmax(0, 1fr);
}

.exam-shell .question-block legend span {
  font-size: 20px;
}

.exam-shell .question-prompt {
  font-size: 17px;
}

.exam-shell textarea {
  min-height: min(360px, 52dvh);
}

.exam-footer-brand {
  width: 152px;
  color: #6b7280;
  font-size: 13px;
  font-weight: 800;
}

.exam-part-tabs {
  min-width: 260px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  align-self: stretch;
}

.exam-part-tabs button {
  min-width: 92px;
  border: 0;
  border-top: 4px solid transparent;
  background: transparent;
  color: #4b5563;
  cursor: pointer;
  font-weight: 900;
}

.exam-part-tabs button.is-active {
  border-top-color: #2f8f3a;
  color: #111827;
  background: #fff;
}

.exam-part-tabs button.is-locked,
.exam-part-tabs button:disabled {
  color: #9ca3af;
  cursor: not-allowed;
  opacity: 0.62;
}

.exam-part-tabs span,
.exam-part-tabs small {
  display: block;
}

.exam-part-tabs small {
  margin-top: 3px;
  font-size: 12px;
}

.question-nav-stack {
  min-width: 0;
  flex: 1 1 auto;
}

.question-nav-stack .question-nav {
  justify-content: center;
}

.exam-arrow-button {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 4px;
  background: #222;
  color: #fff;
  font-size: 38px;
  line-height: 1;
  cursor: pointer;
}

.exam-arrow-button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.exam-prep-screen,
.exam-part-transition {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 246, 248, 0.96);
}

.exam-prep-panel,
.exam-part-transition > div {
  width: min(560px, calc(100% - 48px));
  max-height: calc(100dvh - 96px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: clamp(22px, 4dvh, 34px);
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
  text-align: center;
}

.exam-prep-panel h1 {
  font-size: clamp(28px, 5dvh, 36px);
}

.exam-prep-panel > strong,
.exam-part-transition strong {
  color: var(--red);
  font-size: clamp(50px, 10dvh, 70px);
  line-height: 1;
}

.exam-prep-panel p,
.exam-part-transition p {
  margin: 0;
  color: #4b5563;
  font-weight: 800;
  line-height: 1.65;
}

.exam-prep-ad {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  padding: 16px;
  border: 1px solid #dbe1e8;
  background: #f8fafc;
}

.exam-prep-ad img {
  width: 100%;
  max-height: min(190px, 24dvh);
  display: block;
  object-fit: contain;
  background: #fff;
}

.exam-prep-ad span {
  color: #111827;
  font-weight: 950;
}

.exam-prep-ad small,
.exam-part-transition span {
  color: #6b7280;
  font-weight: 900;
  text-transform: uppercase;
}

.score-box small {
  color: var(--muted);
  font-weight: 800;
}

.result-table {
  display: grid;
}

.result-row {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) minmax(0, 1fr) 96px minmax(0, 1.1fr);
  gap: 12px;
  align-items: center;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
}

.result-row-head {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  border-top: 0;
}

mark {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
}

.mark-correct {
  color: var(--green);
  background: #e8f5ec;
}

.mark-wrong {
  color: var(--red-dark);
  background: #fde8e9;
}

.mark-pending {
  color: var(--amber);
  background: #fff4d6;
}

.pool-summary {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.pool-summary h3 {
  margin-bottom: 6px;
}

.pool-summary p {
  margin: 0;
  color: var(--muted);
}

.quick-entry-form {
  display: grid;
  gap: 22px;
}

.quick-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.quick-entry-grid label,
.quick-row label,
.answer-item {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.field-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.quick-image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.quick-image-list figure {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.quick-image-list img {
  display: block;
  width: 100%;
  height: 98px;
  border-radius: 4px;
  object-fit: contain;
  background: #fff;
}

.quick-image-list figcaption {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.full-span {
  grid-column: 1 / -1;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: auto;
}

.quick-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
}

.quick-help {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.6;
}

.quick-rows {
  display: grid;
  gap: 14px;
}

.quick-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quick-row-top {
  display: grid;
  grid-template-columns: 88px 92px 102px 132px 92px auto auto auto;
  gap: 10px;
  align-items: end;
}

.quick-row.is-reference .quick-row-top {
  grid-template-columns: 88px auto auto;
}

.quick-bottom-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.quick-bottom-actions {
  padding-top: 6px;
}

.answer-sidebar {
  position: sticky;
  top: 84px;
}

.answer-list {
  display: grid;
  gap: 12px;
}

.answer-item {
  grid-template-columns: 62px minmax(0, 1fr);
  align-items: center;
}

.answer-item span {
  display: inline-flex;
  min-width: 42px;
  height: 34px;
  padding: 0 8px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
}

.answer-item-wide {
  align-items: start;
}

.listening-block-panel {
  display: grid;
  gap: 16px;
}

.listening-blocks {
  display: grid;
  gap: 16px;
}

.listening-block {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.listening-block.is-reference {
  background: var(--surface-soft);
}

.listening-block-head,
.listening-block-grid,
.listening-toolbar,
.listening-add-grid {
  display: grid;
  gap: 10px;
}

.listening-block-head {
  grid-template-columns: 190px minmax(0, 1fr) auto;
  align-items: end;
}

.listening-block-grid {
  grid-template-columns: repeat(3, minmax(0, 150px));
}

.listening-toolbar {
  grid-template-columns: repeat(2, max-content);
}

.listening-add-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.listening-block label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.listening-section-title,
.structured-editor-head,
.structured-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.listening-section-title p,
.structured-editor-head small {
  display: block;
  margin-top: 3px;
}

.listening-type-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  background: #f8fafc;
}

.listening-type-editor:empty {
  display: none;
}

.choice-question-list,
.short-question-list,
.matching-author-targets,
.structured-option-list,
.blank-answer-list {
  display: grid;
  gap: 9px;
}

.structured-question-card {
  display: grid;
  gap: 11px;
  padding: 13px;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  background: #fff;
}

.structured-row-head label {
  grid-template-columns: auto 90px;
  align-items: center;
}

.structured-option-row {
  display: grid;
  grid-template-columns: 26px 34px 22px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  background: #fff;
}

.structured-option-row.is-dragging {
  opacity: 0.45;
}

.structured-option-row input[type="radio"],
.structured-option-row input[type="checkbox"] {
  width: auto;
}

.option-drag-handle {
  color: #7a8492;
  cursor: grab;
  font-weight: 900;
}

.option-letter {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: #e8edf3;
  color: #111827;
  font-weight: 900;
}

.icon-text-button {
  min-height: 34px;
  padding: 5px 8px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-weight: 800;
}

.danger-text {
  color: #b4232a;
}

.structured-number-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 150px));
  gap: 10px;
}

.matching-author-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 16px;
}

.matching-author-grid > section {
  display: grid;
  align-content: start;
  gap: 10px;
}

.matching-author-grid h3 {
  margin: 0;
  font-size: 16px;
}

.matching-author-grid h3 small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.matching-author-target {
  display: grid;
  grid-template-columns: 72px minmax(170px, 1fr) minmax(190px, 0.85fr) minmax(190px, 0.9fr) auto;
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  background: #fff;
}

.author-option-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 48px;
  padding: 9px;
  border: 1px dashed #aeb7c3;
  border-radius: 6px;
  background: #fff;
}

.author-option-chip {
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid #aeb7c3;
  border-radius: 5px;
  background: #fff;
  cursor: grab;
  font-weight: 800;
  text-align: left;
}

.author-match-drop {
  display: flex;
  min-height: 42px;
  padding: 8px 10px;
  align-items: center;
  border: 1px dashed #9ba6b4;
  border-radius: 5px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.author-match-drop.is-dragover {
  border-color: var(--red);
  background: #fff1f2;
}

.compact-check {
  margin-top: 2px;
}

.blank-answer-row,
.drag-answer-row,
.short-author-row {
  display: grid;
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid #d7dde5;
  border-radius: 6px;
  background: #fff;
}

.blank-answer-row {
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
}

.drag-answer-row {
  grid-template-columns: 52px minmax(180px, 0.8fr) minmax(180px, 1fr);
  align-items: center;
}

.short-author-row {
  grid-template-columns: 78px minmax(220px, 1.4fr) minmax(180px, 1fr) auto;
}

.empty-inline-note {
  margin: 0;
  padding: 12px;
  border: 1px dashed #bcc5d0;
  border-radius: 6px;
  color: var(--muted);
}

.listening-save-note {
  margin-right: auto;
}

.entry-type-list {
  display: grid;
  padding: 0;
  overflow: hidden;
}

.entry-type-row {
  display: flex;
  min-height: 92px;
  padding: 18px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  color: #111827;
  text-decoration: none;
}

.entry-type-row:last-child {
  border-bottom: 0;
}

.entry-type-row:hover {
  background: #f8fafc;
}

.entry-type-row span {
  display: grid;
  gap: 4px;
}

.entry-type-row strong {
  font-size: 19px;
}

.entry-type-row small {
  color: var(--muted);
}

.entry-type-row b {
  color: var(--red);
  white-space: nowrap;
}

.inline-gap-widget {
  gap: 14px;
}

.inline-gap-copy {
  font-size: 17px;
  line-height: 2.35;
}

.inline-match-target {
  display: inline-grid;
  grid-template-columns: auto minmax(145px, auto) auto;
  gap: 4px;
  align-items: center;
  margin: 2px 5px;
  vertical-align: middle;
}

.inline-match-target > small {
  color: var(--red);
  font-weight: 900;
}

.inline-match-target .matching-drop-value {
  min-width: 145px;
}

.inline-clear {
  min-height: 36px;
  padding: 5px 7px;
  font-size: 12px;
}

@media (max-width: 860px) {
  .topbar {
    padding: 0 16px;
  }

  .topnav {
    gap: 10px;
  }

  .dashboard-head,
  .exam-header,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .content-grid,
  .quick-compose,
  .segmented-choices {
    grid-template-columns: 1fr;
  }

  .quick-entry-grid,
  .quick-row-top,
  .listening-block-head,
  .listening-block-grid,
  .listening-add-grid,
  .matching-author-grid,
  .matching-author-target,
  .short-author-row,
  .drag-answer-row {
    grid-template-columns: 1fr;
  }

  .exam-item {
    display: grid;
  }

  .question-block legend,
  .result-row {
    grid-template-columns: 1fr;
  }

  .submit-bar {
    display: grid;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px), (max-height: 520px) {
  .exam-shell-page {
    overflow: auto;
  }

  .exam-shell {
    min-height: 100vh;
    height: auto;
    display: grid;
    grid-template-rows: 64px minmax(220px, 1fr);
  }

  .exam-app-top {
    padding: 0 14px;
  }

  .exam-app-title strong {
    font-size: 15px;
  }

  .exam-save-state,
  .exam-timer span {
    display: none;
  }

  .exam-workspace,
  .exam-bottom-bar {
    display: none;
  }

  .exam-small-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    padding: 28px;
    color: #111827;
    font-size: 20px;
    font-weight: 900;
    text-align: center;
  }
}
