:root {
  color-scheme: light;
  --ink: #14213d;
  --ink-soft: #34435d;
  --muted: #68758a;
  --line: #d9e0ea;
  --line-strong: #c4cedd;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --surface-blue: #eef4ff;
  --navy: #102a43;
  --blue: #2457d6;
  --blue-dark: #1746bb;
  --cyan: #14b8a6;
  --amber: #c67a0a;
  --red: #c23b4a;
  --green: #248057;
  --shadow: 0 18px 45px rgba(23, 42, 72, 0.1);
  --radius: 12px;
  --font: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  background: #f3f6fa;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

body.restore-open {
  overflow: hidden;
}

.is-hidden {
  display: none !important;
}

.page-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
  background:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.45)),
    radial-gradient(circle at 20% 20%, rgba(36, 87, 214, 0.07), transparent 35%),
    radial-gradient(circle at 86% 8%, rgba(20, 184, 166, 0.06), transparent 28%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 520px) minmax(260px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 10px clamp(22px, 3vw, 52px);
  border-bottom: 1px solid rgba(196, 206, 221, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, var(--navy), #1d4a72);
  box-shadow: 0 8px 20px rgba(16, 42, 67, 0.2);
}

.brand-mark svg {
  width: 30px;
  fill: none;
  stroke: #6ee7d8;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 16px;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.study-progress {
  width: 100%;
}

.progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.progress-copy strong {
  color: var(--blue);
  font-size: 12px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #e6ebf2;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width 300ms ease;
}

.topbar-meta {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
}

.language-switch {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border: 1px solid #cbd6e4;
  border-radius: 10px;
  background: #f5f8fc;
  box-shadow: inset 0 1px 2px rgba(16, 42, 67, 0.04);
}

.language-switch button {
  min-width: 42px;
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.language-switch button[aria-pressed="true"] {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 3px 9px rgba(16, 42, 67, 0.18);
}

.language-switch button:focus-visible {
  outline: 3px solid rgba(36, 87, 214, 0.22);
  outline-offset: 2px;
}

.role-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #bfe8dc;
  border-radius: 99px;
  color: #176447;
  background: #edf9f5;
  font-size: 12px;
  font-weight: 650;
}

.role-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(36, 128, 87, 0.11);
}

.text-button {
  padding: 7px 2px;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-weight: 650;
}

.app-shell {
  width: min(1880px, calc(100% - 40px));
  min-height: calc(100vh - 76px);
  margin: 0 auto;
}

.welcome-view {
  min-height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(300px, 0.65fr) minmax(720px, 1.35fr);
  align-items: start;
  gap: clamp(48px, 7vw, 120px);
  padding: 70px clamp(20px, 4vw, 70px);
}

.welcome-copy {
  position: sticky;
  top: 138px;
}

body.saudi-consent-active .welcome-view {
  display: block;
  width: min(1120px, 100%);
  min-height: auto;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

body.saudi-consent-active .welcome-copy {
  display: none;
}

body.saudi-consent-active .registration-card {
  width: 100%;
  max-width: none;
}

.eyebrow,
.card-kicker {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.welcome-copy h1,
.complete-view h1 {
  margin: 20px 0;
  color: var(--navy);
  font-size: clamp(44px, 5.6vw, 78px);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.welcome-copy > p {
  max-width: 700px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.8;
}

.study-steps {
  max-width: 720px;
  margin-top: 48px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.study-steps article {
  padding: 20px 18px;
  border-top: 2px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.42);
}

.study-steps article:first-child {
  border-color: var(--blue);
}

.study-steps article > span {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.study-steps strong {
  display: block;
  margin: 13px 0 7px;
  font-size: 14px;
}

.study-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.registration-card {
  width: 100%;
  padding: clamp(28px, 3vw, 42px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.registration-card h2 {
  margin: 12px 0 8px;
  font-size: 22px;
}

.form-help {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 12px;
}

.restore-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -8px 0 24px;
  padding: 12px 14px;
  border: 1px solid #c9d8f4;
  border-radius: 10px;
  background: #f6f9ff;
}

.restore-entry strong,
.restore-entry span {
  display: block;
}

.restore-entry strong {
  color: var(--ink);
  font-size: 12px;
}

.restore-entry span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.restore-entry .secondary-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 8px 13px;
  font-size: 12px;
}

.registration-timing-note {
  margin: -10px 0 24px;
  padding: 12px 14px;
  border: 1px solid #e7c875;
  border-radius: 10px;
  background: #fffaf0;
}

.registration-timing-note strong {
  display: block;
  color: #805a0b;
  font-size: 12px;
}

.registration-timing-note p {
  margin: 4px 0 0;
  color: #705f3e;
  font-size: 10px;
  line-height: 1.55;
}

.participant-information-step {
  width: 100%;
}

.registration-card.site-consent-active > .card-kicker,
.registration-card.site-consent-active > h2,
.registration-card.site-consent-active > .form-help {
  display: none;
}

.site-consent-step {
  margin-top: 10px;
  padding: 20px;
  border: 1px solid #c9d8f4;
  border-radius: 12px;
  background: linear-gradient(145deg, #fbfdff, #f5f8ff);
}

.site-consent-heading {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.site-consent-heading h3 {
  margin: 8px 0 6px;
  color: var(--navy);
  font-size: 18px;
  line-height: 1.3;
}

.site-consent-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.site-study-information {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.site-study-information section {
  padding: 12px 13px;
  border: 1px solid #dce5f4;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.9);
}

.site-study-information .site-device-note {
  grid-column: 1 / -1;
  border-color: #e7c875;
  background: #fffaf0;
}

.site-study-information .saudi-priority-notice {
  grid-column: 1 / -1;
  padding: 14px 16px;
  border-color: #e69ba3;
  background: #fff2f3;
  box-shadow: 0 0 0 3px rgba(166, 22, 36, 0.055);
}

.site-study-information .saudi-priority-notice h4 {
  margin-bottom: 7px;
  color: #a51624;
  font-size: 12px;
  font-weight: 900;
}

.site-study-information .saudi-priority-notice p {
  color: #7e1721;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.65;
}

.site-study-information h4 {
  margin: 0 0 5px;
  color: var(--navy);
  font-size: 11px;
}

.site-study-information p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.saudi-consent-information {
  display: grid;
  min-width: 0;
  gap: 12px;
  margin-top: 14px;
}

.saudi-irb-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid #9fcbb8;
  border-radius: 11px;
  background: linear-gradient(145deg, #f5fbf8, #ffffff);
  box-shadow: 0 7px 18px rgba(25, 108, 75, 0.06);
}

.saudi-irb-source-marks {
  display: grid;
  grid-template-columns: minmax(132px, 0.8fr) minmax(420px, 3fr) minmax(160px, 1fr);
  align-items: center;
  gap: 18px;
  margin: -4px -2px 20px;
  padding: 12px 14px;
  border: 1px solid rgba(61, 133, 93, 0.22);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.saudi-irb-source-marks svg,
.saudi-irb-source-marks img {
  display: block;
  width: 100%;
  max-height: 126px;
  overflow: hidden;
}

.saudi-irb-source-marks img {
  object-fit: contain;
}

.saudi-source-logo,
.saudi-source-seal {
  height: 126px;
}

.saudi-source-contact {
  height: 96px;
}

.saudi-irb-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.saudi-approval-status {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  color: #176847;
  background: #dff4e8;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.saudi-irb-heading h4 {
  margin: 5px 0 2px;
  color: var(--navy);
  font-size: 13px;
  line-height: 1.35;
}

.saudi-irb-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.45;
}

.saudi-study-title-block {
  display: grid;
  gap: 3px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid #cfe4db;
}

.saudi-study-title-block span,
.saudi-irb-facts dt {
  color: #5f7187;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.saudi-study-title-block strong {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.4;
}

.saudi-irb-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 11px 0 0;
}

.saudi-irb-facts > div {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #dceae4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.saudi-irb-facts .saudi-ncbe-fact {
  grid-column: span 2;
}

.saudi-irb-facts dt {
  margin: 0 0 3px;
}

.saudi-irb-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--navy);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 750;
}

.saudi-study-information-grid {
  min-width: 0;
  margin-top: 0;
}

@media (max-width: 900px) {
  .saudi-irb-source-marks {
    grid-template-columns: minmax(90px, 0.8fr) minmax(0, 2.4fr) minmax(100px, 1fr);
    gap: 10px;
    padding: 10px;
  }
}

.saudi-consent-meaning {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #2b5bd7;
  border-radius: 7px;
  color: #30445f;
  background: #eef4ff;
  font-size: 10px;
  line-height: 1.55;
}

.site-consent-choice {
  margin: 16px 0 0;
  padding: 14px;
  border: 1px solid #b8caed;
  border-radius: 9px;
  background: #fff;
}

.site-consent-choice legend {
  padding: 0 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.site-consent-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.site-consent-actions button {
  min-height: 40px;
  font-size: 12px;
}

.site-consent-status {
  min-height: 0;
  margin: 8px 0 0;
  color: var(--red);
  font-size: 10px;
  line-height: 1.5;
}

.site-consent-status:empty {
  display: none;
}

.restore-dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 35, 61, 0.48);
  backdrop-filter: blur(6px);
}

.restore-card {
  width: min(440px, 100%);
  padding: 28px;
}

.restore-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.restore-card-heading h2 {
  margin-top: 8px;
}

.restore-card-heading .form-help {
  margin-bottom: 20px;
  line-height: 1.55;
}

.registration-success-card .form-help {
  margin-bottom: 18px;
  line-height: 1.55;
}

.registration-recovery-details {
  display: grid;
  gap: 9px;
  margin: 0 0 20px;
}

.registration-recovery-details div {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f9fd;
}

.registration-recovery-details dt {
  color: var(--muted);
  font-size: 10px;
}

.registration-recovery-details dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.restore-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 22px;
  line-height: 1;
}

.restore-close:hover,
.restore-close:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.registration-card label {
  display: block;
  margin-bottom: 18px;
}

.registration-card label > span,
.rationale-field > span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.registration-card label > small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.registration-card label > small.field-help {
  margin: -3px 0 7px;
  color: #8a640e;
}

.registration-card input,
.registration-card select,
.registration-card textarea,
.rationale-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.registration-card textarea {
  min-height: 84px;
  resize: vertical;
}

.registration-card input:focus,
.registration-card select:focus,
.registration-card textarea:focus,
.rationale-field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-wide {
  grid-column: 1 / -1;
}

.registration-section {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.registration-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}

.registration-section-heading > span {
  flex: 0 0 auto;
  padding: 5px 7px;
  border-radius: 5px;
  color: #fff;
  background: var(--navy);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 750;
}

.registration-section-heading h3,
.registration-section-heading p {
  margin: 0;
}

.registration-section-heading h3 {
  color: var(--navy);
  font-size: 14px;
}

.registration-section-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.checkbox-fieldset {
  min-width: 0;
  margin: 4px 0 18px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
}

.checkbox-fieldset legend {
  padding: 0 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
}

.registration-card .checkbox-grid label,
.registration-card .consent-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 8px 9px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.registration-card .checkbox-grid input,
.registration-card .consent-check input {
  flex: 0 0 auto;
  width: 16px;
  min-height: 16px;
  margin: 1px 0 0;
  accent-color: var(--blue);
}

.registration-card .checkbox-grid label > span,
.registration-card .consent-check > span {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 550;
  line-height: 1.45;
}

.nested-field {
  margin: 12px 0 0 !important;
}

.field-error {
  min-height: 14px;
  margin: 8px 0 0;
  color: var(--red);
  font-size: 11px;
}

.consent-section {
  padding: 24px 18px 18px;
  border: 1px solid #c9d8f5;
  border-radius: 10px;
  background: #f8faff;
}

.consent-clauses {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
}

.consent-clauses li + li {
  margin-top: 5px;
}

.registration-card .consent-check {
  padding: 12px;
  border: 1px solid #b8caed;
  background: #fff;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 11px 16px;
  border-radius: 8px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.primary-button {
  border: 1px solid var(--blue);
  color: #fff;
  background: var(--blue);
}

.primary-button:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

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

.secondary-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.start-button {
  width: 100%;
}

.form-error {
  min-height: 18px;
  margin: 9px 0 0;
  color: var(--red);
  font-size: 12px;
}

.study-view {
  padding: 18px 0 80px;
}

.case-command-bar {
  position: sticky;
  top: 86px;
  z-index: 20;
  min-height: 55px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 24px rgba(23, 42, 72, 0.06);
  backdrop-filter: blur(10px);
}

.case-command-bar > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.level-badge,
.phase-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 750;
}

.level-badge {
  min-width: 34px;
  padding: 5px 7px;
  color: #fff;
  background: var(--navy);
}

.case-command-bar strong {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.command-divider {
  width: 1px;
  height: 27px;
  background: var(--line);
}

.case-command-bar p {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.case-clock {
  text-align: right;
}

.case-clock span,
.case-clock strong {
  display: block;
}

.case-clock span {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
}

.case-clock strong {
  font-variant-numeric: tabular-nums;
}

.case-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 360px;
  align-items: start;
  gap: 18px;
}

.study-sidebar {
  position: sticky;
  top: 157px;
  min-height: calc(100vh - 176px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(23, 42, 72, 0.045);
}

.sidebar-brand {
  padding: 20px 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand span,
.sidebar-brand strong {
  display: block;
}

.sidebar-brand span,
.sidebar-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.sidebar-brand strong {
  margin-top: 10px;
  color: var(--navy);
  font-size: 18px;
  letter-spacing: 0.03em;
}

.sidebar-section {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-case {
  margin-top: 10px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.sidebar-case.is-active {
  border-color: #7ea1eb;
  background: var(--surface-blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.sidebar-case span,
.sidebar-case strong,
.sidebar-case small {
  display: block;
}

.sidebar-case span {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 750;
}

.sidebar-case strong {
  margin: 8px 0 5px;
  font-family: var(--mono);
  font-size: 13px;
}

.sidebar-case small {
  color: var(--muted);
  font-size: 10px;
}

.sidebar-progress {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.sidebar-progress strong {
  color: var(--blue);
  font-family: var(--mono);
}

.sidebar-path {
  max-height: calc(100vh - 430px);
  overflow-y: auto;
  border-bottom: 0;
}

#sidebarTools {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.sidebar-tool {
  padding: 7px 8px;
  overflow: hidden;
  border-radius: 5px;
  color: #176447;
  background: #dff7ef;
  font-family: var(--mono);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-column {
  min-width: 0;
}

.panel,
.decision-card,
.agent-card,
.evidence-hierarchy-card,
.assistance-workspace {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(23, 42, 72, 0.045);
}

.panel {
  margin-bottom: 16px;
}

.panel-heading {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-index {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}

.panel-heading h2 {
  margin: 0;
  font-size: 14px;
}

.phase-pill {
  padding: 6px 9px;
  color: var(--blue);
  background: var(--surface-blue);
}

.question-text {
  margin: 0;
  padding: 18px 20px 21px;
  font-size: 17px;
  font-weight: 650;
  line-height: 1.7;
}

.ecg-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ecg-controls button {
  min-width: 31px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface-soft);
}

.ecg-controls button:last-child {
  padding: 0 10px;
}

.ecg-controls output {
  min-width: 46px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}

.ecg-viewport {
  position: relative;
  height: clamp(590px, 66vh, 850px);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background:
    linear-gradient(rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.1)),
    #edf1f5;
}

.ecg-viewport.is-dragging {
  cursor: grabbing;
}

.ecg-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform-origin: center;
  will-change: transform;
}

.ecg-stage img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  user-select: none;
}

.ecg-image-quality {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid #c9d8f4;
  border-radius: 999px;
  color: #2857b7;
  background: #f2f6ff;
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
}

.ecg-image-quality.is-loading {
  color: #8a6413;
  border-color: #ead69b;
  background: #fff9e9;
}

.ecg-image-quality.is-original {
  color: #176b4b;
  border-color: #b9dfd0;
  background: #eefaf5;
}

.ecg-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
}

.ecg-loading span {
  width: 18px;
  height: 18px;
  border: 2px solid #cad4e2;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.ecg-footer {
  min-height: 37px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 15px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.decision-column {
  position: sticky;
  top: 157px;
  max-height: calc(100vh - 176px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: #bcc8d8 transparent;
  scrollbar-width: thin;
}

.decision-card,
.agent-card,
.evidence-hierarchy-card {
  margin-bottom: 16px;
  padding: 20px;
}

.right-card-heading {
  margin: -20px -20px 15px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.right-card-heading strong,
.right-card-heading span {
  display: block;
}

.right-card-heading strong {
  font-size: 15px;
}

.right-card-heading span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.hierarchy-item {
  position: relative;
  width: 100%;
  margin-bottom: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  text-align: left;
}

.hierarchy-item:last-child {
  margin-bottom: 0;
}

.hierarchy-item > strong {
  font-size: 11px;
}

.hierarchy-item > span {
  float: right;
  color: var(--muted);
  font-size: 9px;
}

.hierarchy-item p {
  clear: both;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.hierarchy-item.measured {
  border-color: #a9c8e7;
  background: #f4f9ff;
}

.hierarchy-item.model {
  border-color: #b8e5dc;
  background: #f2fbf8;
}

.hierarchy-item.guideline {
  border-color: #ead9a3;
  background: #fffdf4;
}

.decision-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.decision-step span {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
}

.decision-step strong {
  font-size: 15px;
}

.decision-note {
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.option-list {
  display: grid;
  gap: 9px;
}

.option-button {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.option-button:hover {
  border-color: #8fa9e4;
  background: #f8faff;
}

.option-button.is-selected {
  border-color: var(--blue);
  background: var(--surface-blue);
  box-shadow: inset 3px 0 0 var(--blue);
}

.option-letter {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  background: #fff;
}

.option-button.is-selected .option-letter {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.option-copy {
  font-size: 13px;
  line-height: 1.45;
}

.confidence-control {
  display: block;
  margin: 22px 0 18px;
}

.confidence-control > span {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

.confidence-control output {
  color: var(--blue);
  font-family: var(--mono);
}

.confidence-control input {
  width: 100%;
  accent-color: var(--blue);
}

.decision-card > .primary-button {
  width: 100%;
}

.important-registration-note,
.registration-section-heading .important-registration-note,
.registration-card small.important-registration-note {
  color: #c62828;
  font-weight: 700;
}

.case-confidence {
  margin: 8px 0;
  padding: 9px 11px 8px;
  border: 1px solid #d8e2f1;
  border-radius: 10px;
  background: #f8faff;
}

.case-confidence legend {
  padding: 0 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.confidence-scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(38px, 1fr));
  gap: 7px;
}

.confidence-scale label {
  cursor: pointer;
}

.confidence-scale input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.confidence-scale span {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid #cbd7ea;
  border-radius: 8px;
  background: #fff;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-weight: 800;
  transition: 140ms ease;
}

.confidence-scale input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.confidence-scale input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.confidence-anchors {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 10px;
}

.case-navigation {
  display: flex;
  gap: 8px;
}

.case-navigation .secondary-button {
  min-height: 38px;
  flex: 1;
  padding: 7px 12px;
  font-size: 12px;
}

.case-navigation .secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.agent-card {
  position: relative;
  overflow: hidden;
  border-color: #b7c8ed;
  background: linear-gradient(145deg, #f9fbff, #edf3ff);
}

.agent-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(var(--blue), var(--cyan));
}

.agent-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.agent-card-top span,
.agent-card-top strong {
  display: block;
}

.agent-card-top > div > span {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.agent-card-top strong {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.agent-role {
  padding: 5px 8px;
  border: 1px solid #b7c8ed;
  border-radius: 5px;
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
}

.agent-choice {
  margin: 18px 0 12px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 750;
  line-height: 1.5;
}

.agent-evidence {
  margin: 0 0 16px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.agent-card .secondary-button {
  width: 100%;
  min-height: 40px;
  color: var(--blue);
  background: rgba(255, 255, 255, 0.75);
}

.safety-copy {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.initial-recall {
  margin: 14px 0;
  padding: 10px 12px;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
}

.rationale-field {
  display: block;
  margin-bottom: 16px;
}

.rationale-field textarea {
  resize: vertical;
  font-size: 12px;
}

.assistance-workspace {
  overflow: hidden;
  margin-top: 16px;
}

.evidence-drawer {
  position: fixed;
  z-index: 80;
  top: 72px;
  right: 14px;
  bottom: 14px;
  width: min(1040px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  margin: 0;
  border-color: #b9c8df;
  box-shadow: 0 28px 80px rgba(16, 42, 67, 0.24);
}

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

.drawer-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.assistance-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, #fff, #f3f7ff);
}

.assistance-header h2 {
  margin: 0;
  font-size: 16px;
}

.assistance-header p {
  display: none;
}

.advisory-stamp {
  padding: 4px 8px;
  border: 1.5px solid rgba(194, 59, 74, 0.55);
  border-radius: 4px;
  color: var(--red);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  transform: rotate(-3deg);
}

.assistance-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.assistance-tabs button {
  min-width: max-content;
  padding: 15px 13px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.assistance-tabs button.is-active {
  border-color: var(--blue);
  color: var(--blue);
}

.assistance-content {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px 14px;
}

.option-evidence-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 7px 0;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.option-evidence-tab {
  min-width: 0;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid #c8d5eb;
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
}

.option-evidence-tab:hover {
  border-color: #8eabe0;
  color: var(--blue);
  background: #f5f8ff;
}

.option-evidence-tab.is-active {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 5px 14px rgba(36, 87, 214, 0.18);
}

.option-evidence-view {
  margin: 0;
}

.option-evidence-summary-card {
  overflow: visible;
  padding: 12px;
}

.option-evidence-detail-card {
  border-color: #d5dfef;
  background: #fff;
}

.option-subview-intro {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  background: var(--surface-blue);
}

.option-subview-intro strong {
  display: block;
  font-size: 13px;
}

.option-subview-intro p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
}

.option-subview-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.option-subview-section > h4,
.option-guideline-sections h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 12px;
}

.option-guideline-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option-guideline-sections > section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.option-guideline-sections ul,
.option-guideline-sections p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.option-guideline-sources {
  grid-column: 1 / -1;
}

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

.evidence-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.evidence-card.is-primary {
  border-color: #b7c8ed;
  background: var(--surface-blue);
}

.evidence-card.is-warning {
  border-color: #ecd5a8;
  background: #fffaf0;
}

.evidence-card h3 {
  margin: 0 0 12px;
  font-size: 13px;
}

.evidence-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.evidence-fallback {
  padding: 13px 15px;
  border: 1px solid #b9d2fb;
  border-radius: 8px;
  background: #f4f8ff;
}

.evidence-fallback strong {
  color: var(--blue);
  font-size: 12px;
}

.evidence-fallback p {
  margin: 7px 0;
  color: var(--ink);
}

.evidence-fallback small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.evidence-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.route-tag,
.tier-tag,
.status-tag {
  display: inline-flex;
  margin: 0 5px 5px 0;
  padding: 4px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  background: #edf1f6;
}

.tier-tag {
  color: var(--blue);
  background: var(--surface-blue);
}

.status-tag {
  color: var(--green);
  background: #edf9f5;
}

.status-tag.evidence-against {
  color: #a23f46;
  background: #fff0f1;
}

.status-tag.evidence-mixed {
  color: #8b5b08;
  background: #fff6de;
}

.status-tag.evidence-insufficient {
  color: #58697b;
  background: #eef2f6;
}

.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.kv-item {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e3e8ef;
  border-radius: 6px;
  background: #fbfcfe;
}

.kv-item span,
.kv-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.kv-item span {
  margin-bottom: 4px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
}

.kv-item strong {
  color: var(--ink);
  font-size: 11px;
  font-weight: 650;
}

.option-evidence-card {
  margin-bottom: 14px;
}

.l4-clinical-context-card {
  grid-column: 1 / -1;
  border-left: 4px solid #2c6a9e;
  background: linear-gradient(135deg, #f4f9ff, #f8fbfe);
}

.l4-clinical-context-card > p {
  margin: 7px 0;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-line;
}

.l4-clinical-context-card > small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.l4-evidence-chain-list {
  display: grid;
  gap: 8px;
}

.l4-evidence-chain-list article {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid #dde7f0;
  border-radius: 7px;
  background: #f8fbfe;
}

.l4-evidence-chain-list article > span {
  padding: 3px 6px;
  border-radius: 4px;
  color: #225d8d;
  background: #e7f2fb;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.l4-evidence-chain-list article > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.55;
}

.option-complete-notice {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-left: 3px solid #7890a8;
  border-radius: 6px;
  background: #f4f7fa;
}

.option-complete-notice > strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-size: 12px;
}

.option-complete-notice > p {
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.option-complete-notice > div {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
}

.option-complete-notice > div span,
.option-complete-notice > div em {
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-style: normal;
}

.option-complete-notice > div span {
  color: #fff;
  background: #a84952;
  font-weight: 750;
}

.option-complete-notice > div em {
  color: #75363b;
  background: #fff;
  border: 1px solid #efd4d7;
}

.option-evidence-header {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 7px;
}

.option-evidence-header .option-letter {
  flex: 0 0 auto;
}

.option-evidence-header h3 {
  margin: 1px 0 0;
  font-size: 13px;
}

.evidence-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.evidence-list {
  padding: 8px 9px;
  border-radius: 7px;
  background: var(--surface-soft);
}

.evidence-list strong {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
}

.evidence-list ul {
  margin: 0;
  padding-left: 17px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.complete-evidence-section {
  margin-top: 11px;
  border: 1px solid #dbe3ec;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
}

.complete-evidence-section > summary {
  padding: 10px 12px;
  color: var(--navy);
  background: #f6f8fb;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
  list-style-position: inside;
}

.complete-evidence-section[open] > summary {
  border-bottom: 1px solid #dbe3ec;
}

.complete-evidence-section > :not(summary) {
  margin-left: 12px;
  margin-right: 12px;
}

.complete-evidence-section > :last-child {
  margin-bottom: 12px;
}

.complete-evidence-section h5 {
  margin-top: 13px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 10px;
}

.complete-evidence-section ul {
  margin-top: 0;
  padding-left: 19px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.6;
}

.criterion-completeness-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.criterion-completeness-grid > div {
  padding: 8px 9px;
  border: 1px solid #e4e9ef;
  border-radius: 6px;
  background: #fbfcfe;
}

.criterion-completeness-grid strong {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
}

.criterion-completeness-grid p {
  color: var(--ink);
  font-size: 10px;
  line-height: 1.45;
}

.option-trace-list {
  display: grid;
  gap: 7px;
  margin-top: 11px;
}

.option-trace-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 8px;
  padding: 9px;
  border: 1px solid #e2e7ed;
  border-radius: 6px;
  background: #fbfcfe;
}

.option-trace-item > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.option-trace-item strong,
.option-trace-item em {
  display: block;
  overflow-wrap: anywhere;
}

.option-trace-item strong {
  color: var(--blue);
  font-size: 10px;
}

.option-trace-item em {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-style: normal;
}

.option-trace-item p {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.5;
}

.option-tool-audit {
  margin-top: 11px;
}

.option-tool-audit > strong {
  display: block;
  margin: 10px 0 5px;
  color: var(--navy);
  font-size: 10px;
}

.open-full-toolchain {
  width: 100%;
  margin-top: 9px;
  padding: 9px 11px;
  border: 1px solid #b8cdf3;
  border-radius: 6px;
  color: var(--blue);
  background: #f3f7ff;
  font-size: 10px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.open-full-toolchain:hover,
.open-full-toolchain:focus-visible {
  border-color: var(--blue);
  background: #eaf1ff;
}

.route-card {
  margin-bottom: 12px;
  padding: 13px 15px;
  border-left: 3px solid var(--blue);
  background: var(--surface-soft);
}

.route-card h3 {
  margin: 0 0 8px;
  font-size: 12px;
}

.route-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.tool-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin: 18px 0 10px;
}

.tool-summary h3 {
  margin: 0;
  font-size: 13px;
}

.tool-summary span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.tool-timeline {
  display: grid;
  gap: 7px;
  max-height: 650px;
  overflow: auto;
  padding-right: 5px;
}

.tool-step {
  display: grid;
  grid-template-columns: 46px minmax(140px, 0.28fr) 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.tool-step > span:first-child {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.tool-step strong {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.tool-step p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.audit-link {
  color: var(--blue);
  font-size: 9px;
  font-weight: 700;
  text-decoration: none;
}

.criteria-card {
  margin-bottom: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.criteria-card h3 {
  margin: 0 0 10px;
  font-size: 13px;
}

.criteria-card h4 {
  margin: 12px 0 5px;
  color: var(--muted);
  font-size: 10px;
}

.criteria-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 26px;
  bottom: 26px;
  max-width: 390px;
  padding: 12px 15px;
  border-radius: 8px;
  color: #fff;
  background: var(--navy);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.post-study-view {
  min-height: calc(100vh - 76px);
  display: grid;
  place-items: center;
  padding: 52px 20px;
}

.post-study-card {
  width: min(760px, 100%);
  padding: clamp(28px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.post-study-card h1 {
  margin: 10px 0 8px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.12;
}

.post-study-intro {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.post-study-form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.survey-question {
  margin: 0;
  padding: 17px 18px 14px;
  border: 1px solid #d9e1ee;
  border-radius: 12px;
  background: #f9fbff;
}

.survey-question legend {
  max-width: 100%;
  padding: 0 5px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.5;
}

.likert-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.likert-scale label {
  position: relative;
  cursor: pointer;
}

.likert-scale input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.likert-scale span {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd7e9;
  border-radius: 8px;
  color: var(--ink-soft);
  background: #fff;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 800;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease;
}

.likert-scale input:checked + span {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.12);
}

.likert-scale input:focus-visible + span {
  outline: 3px solid rgba(36, 87, 214, 0.22);
  outline-offset: 2px;
}

.likert-anchors {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.survey-comments {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.survey-comments textarea {
  width: 100%;
  resize: vertical;
  padding: 12px 13px;
  border: 1px solid #cbd7e9;
  border-radius: 9px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 500;
  line-height: 1.55;
}

.survey-comments textarea:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(36, 87, 214, 0.1);
}

.survey-submit {
  width: 100%;
  justify-content: center;
  margin-top: 2px;
}

.complete-view {
  min-height: calc(100vh - 76px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 70px 20px;
  text-align: center;
}

.complete-mark {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-size: 34px;
  box-shadow: 0 15px 35px rgba(36, 128, 87, 0.22);
}

.complete-view h1 {
  margin: 14px 0;
  font-size: clamp(36px, 4.5vw, 58px);
}

.complete-view > p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.complete-actions {
  display: flex;
  gap: 12px;
  margin-top: 30px;
}

@media (max-width: 600px) {
  .post-study-view {
    padding: 24px 12px;
  }

  .post-study-card {
    padding: 24px 16px;
  }

  .survey-question {
    padding-right: 12px;
    padding-left: 12px;
  }
}

@media (min-width: 901px) {
  body.study-active {
    overflow: hidden;
  }

  body.study-active .topbar {
    min-height: 58px;
    height: 58px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  body.study-active .brand-mark {
    width: 36px;
    height: 36px;
  }

  body.study-active .app-shell {
    min-height: calc(100vh - 58px);
  }

  body.study-active .study-view {
    height: calc(100vh - 58px);
    display: flex;
    flex-direction: column;
    padding: 8px 0 10px;
    overflow: hidden;
  }

  body.study-active .case-command-bar {
    position: static;
    min-height: 42px;
    flex: 0 0 42px;
    margin-bottom: 8px;
    padding: 6px 12px;
  }

  body.study-active .case-layout {
    min-height: 0;
    flex: 1;
    grid-template-columns: 178px minmax(0, 1fr) 350px;
    align-items: stretch;
    gap: 10px;
  }

  body.study-active .study-sidebar {
    position: static;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  body.study-active .sidebar-brand {
    padding: 11px 12px;
  }

  body.study-active .sidebar-brand strong {
    margin-top: 4px;
    font-size: 15px;
  }

  body.study-active .sidebar-section {
    padding: 10px;
  }

  body.study-active .sidebar-case {
    margin-top: 6px;
    padding: 9px 10px;
  }

  body.study-active .sidebar-case strong {
    margin: 4px 0 2px;
  }

  body.study-active .sidebar-progress {
    margin-top: 7px;
  }

  body.study-active .sidebar-path {
    min-height: 0;
    flex: 1;
    overflow-y: auto;
  }

  body.study-active #sidebarTools {
    gap: 4px;
    margin-top: 6px;
  }

  body.study-active .sidebar-tool {
    padding: 5px 6px;
  }

  body.study-active .reading-column {
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
  }

  body.study-active .panel {
    margin-bottom: 0;
  }

  body.study-active .question-panel {
    max-height: 118px;
    overflow: hidden;
  }

  body.study-active .question-panel .panel-heading {
    min-height: 34px;
    padding: 6px 11px;
  }

  body.study-active .question-text {
    max-height: 78px;
    overflow-y: auto;
    padding: 8px 13px 10px;
    font-size: clamp(12px, 0.82vw, 14px);
    line-height: 1.45;
  }

  body.study-active .ecg-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  body.study-active .ecg-panel .panel-heading {
    min-height: 40px;
    flex: 0 0 40px;
    padding: 5px 11px;
  }

  body.study-active .ecg-controls button {
    height: 28px;
  }

  body.study-active .ecg-viewport {
    min-height: 0;
    height: auto;
    flex: 1;
  }

  body.study-active .ecg-footer {
    min-height: 28px;
    flex: 0 0 28px;
    padding: 6px 11px;
  }

  body.study-active .decision-column {
    position: static;
    min-height: 0;
    height: 100%;
    max-height: none;
    display: grid;
    grid-template-rows: auto auto minmax(0, 1fr);
    gap: 8px;
    overflow: hidden;
    padding-right: 0;
  }

  body.study-active .decision-card,
  body.study-active .agent-card,
  body.study-active .evidence-hierarchy-card {
    margin: 0;
    padding: 10px;
  }

  body.study-active .right-card-heading {
    margin: -10px -10px 8px;
    padding: 8px 10px;
  }

  body.study-active .evidence-hierarchy-card {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  body.study-active .right-card-heading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  body.study-active .hierarchy-item {
    min-height: 35px;
    margin: 0;
    padding: 5px 4px;
    text-align: center;
  }

  body.study-active .hierarchy-item > strong {
    display: block;
    font-size: 8px;
    line-height: 1.2;
  }

  body.study-active .hierarchy-item > span {
    float: none;
    display: block;
    margin-top: 2px;
    font-size: 7px;
  }

  body.study-active .hierarchy-item p {
    display: none;
  }

  body.study-active .agent-choice {
    max-height: 22px;
    margin: 5px 0 3px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.study-active .agent-evidence {
    max-height: 16px;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    line-height: 1.4;
  }

  body.study-active .agent-card .secondary-button {
    min-height: 30px;
    padding: 5px 10px;
    font-size: 10px;
  }

  body.study-active .safety-copy {
    display: none;
  }

  body.study-active .final-card {
    min-height: 0;
    overflow: hidden;
  }

  body.study-active .decision-step strong {
    font-size: 13px;
  }

  body.study-active .option-list {
    gap: 5px;
    margin-top: 7px;
  }

  body.study-active .option-button {
    min-height: 40px;
    height: 40px;
    grid-template-columns: 24px 1fr;
    gap: 7px;
    padding: 5px 7px;
    overflow: hidden;
  }

  body.study-active .option-letter {
    width: 23px;
    height: 23px;
  }

  body.study-active .option-copy {
    display: -webkit-box;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.3;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  body.study-active .confidence-control {
    margin: 7px 0 5px;
  }

  body.study-active .confidence-control > span {
    margin-bottom: 3px;
  }

  body.study-active .rationale-field {
    margin-bottom: 5px;
  }

  body.study-active .rationale-field > span {
    margin-bottom: 4px;
    font-size: 10px;
  }

  body.study-active .rationale-field textarea {
    min-height: 34px;
    height: 34px;
    resize: none;
    padding: 6px 8px;
    font-size: 10px;
  }

  body.study-active .decision-card > .primary-button {
    min-height: 34px;
    padding: 6px 10px;
    font-size: 11px;
  }

  body.study-active .form-error {
    min-height: 0;
    margin-top: 3px;
  }
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr 1fr;
  }

  .study-progress {
    grid-row: 2;
    grid-column: 1 / -1;
    padding-bottom: 6px;
  }

  body.study-active .case-layout {
    grid-template-columns: 160px minmax(0, 1fr) 320px;
  }

  .welcome-view {
    grid-template-columns: 1fr;
    padding-top: 50px;
  }

  .welcome-copy {
    position: static;
  }

  .registration-card {
    max-width: 960px;
  }

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

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 22px, 1880px);
  }

  .role-chip {
    display: none;
  }

  .case-layout {
    grid-template-columns: 1fr;
  }

  .study-sidebar,
  .decision-column {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .decision-column {
    grid-row: auto;
  }

  .study-sidebar {
    min-height: 0;
  }

  .sidebar-path {
    max-height: none;
  }

  .ecg-viewport {
    height: 58vh;
    min-height: 430px;
  }

  .evidence-grid,
  .evidence-columns {
    grid-template-columns: 1fr;
  }
}

/* Compact case actions: keep navigation visible without oversized bars. */
body.study-active #submitFinal {
  min-height: 30px;
  height: 30px;
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11px;
}

body.study-active .case-navigation {
  min-height: 28px;
  justify-content: flex-start;
  gap: 6px;
}

body.study-active .case-navigation .secondary-button {
  width: auto;
  min-width: 96px;
  min-height: 28px;
  height: 28px;
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 7px;
  font-size: 11px;
}

/* Hidden condition-specific blocks must not leave phantom grid rows. */
body.study-active .final-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

body.study-active .evidence-linked-options {
  min-height: 90px;
  height: auto;
  flex: 1 1 auto;
  overflow-y: auto;
}

body.study-active .case-confidence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 6px 0 4px;
  border: 0;
  border-top: 1px solid #dce5f2;
  border-radius: 0;
  background: transparent;
}

body.study-active .confidence-copy strong {
  display: block;
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
}

body.study-active .confidence-anchors {
  width: auto;
  justify-content: flex-start;
  gap: 9px;
  margin-top: 2px;
  font-size: 8px;
}

body.study-active .confidence-scale {
  display: flex;
  grid-template-columns: none;
  gap: 4px;
}

body.study-active .confidence-scale label {
  flex: 0 0 auto;
}

body.study-active .confidence-scale span {
  width: 32px;
  min-height: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 11px;
}

@media (max-width: 520px) {
  body.study-active .case-confidence {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 66px;
    padding: 9px 14px;
  }

  .brand small,
  .topbar-meta .role-chip,
  .topbar-meta .text-button {
    display: none;
  }

  .topbar {
    grid-template-columns: auto minmax(96px, 1fr) auto;
    gap: 8px;
  }

  .topbar-meta {
    display: flex;
  }

  .language-switch button {
    min-width: 38px;
    min-height: 28px;
    padding: 4px 8px;
  }

  .welcome-view {
    gap: 40px;
    padding: 45px 4px;
  }

  .welcome-copy h1 {
    font-size: 42px;
  }

  .study-steps,
  .form-grid,
  .form-grid-three,
  .checkbox-grid {
    grid-template-columns: 1fr;
  }

  .registration-card {
    padding: 24px 18px;
  }

  .restore-entry {
    align-items: stretch;
    flex-direction: column;
  }

  .restore-entry .secondary-button {
    width: 100%;
  }

  .site-consent-step {
    padding: 15px 12px;
  }

  .site-study-information,
  .site-consent-actions {
    grid-template-columns: 1fr;
  }

  .saudi-irb-heading {
    align-items: flex-start;
  }

  .saudi-irb-source-marks {
    grid-template-columns: minmax(100px, 0.9fr) minmax(120px, 1.1fr);
    gap: 10px;
    padding: 10px;
  }

  .saudi-source-logo,
  .saudi-source-seal {
    height: 104px;
  }

  .saudi-source-contact {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 66px;
  }

  .saudi-irb-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .saudi-irb-facts .saudi-ncbe-fact {
    grid-column: 1 / -1;
  }

  .site-study-information .site-device-note {
    grid-column: auto;
  }

  .site-study-information .saudi-priority-notice {
    grid-column: auto;
  }

  .restore-card {
    padding: 24px 20px;
  }

  .case-command-bar {
    top: 74px;
  }

  .case-command-bar p,
  .command-divider {
    display: none;
  }

  .case-clock {
    margin-left: auto;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .ecg-controls {
    align-self: stretch;
  }

  .ecg-viewport {
    height: 52vh;
    min-height: 360px;
  }

  .ecg-footer {
    flex-direction: column;
    gap: 2px;
  }

  .tool-step {
    grid-template-columns: 38px 1fr;
  }

  .tool-step p,
  .audit-link {
    grid-column: 2;
  }

  .complete-actions {
    flex-direction: column;
  }
}

/* Final mobile cascade guard. Keep this block at the end of the stylesheet:
   several legacy desktop rules above are intentionally broad and must not
   restore fixed-height panes on phones. */
@media (max-width: 699px) {
  html.study-active,
  body.study-active {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.study-active #app,
  body.study-active .app-shell {
    width: 100%;
    min-height: 0;
    height: calc(100vh - 54px);
    height: calc(100dvh - 54px);
    overflow: hidden;
  }

  body.study-active .study-view {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }

  body.study-active .mobile-study-tabs {
    display: grid;
  }

  body.study-active .case-layout.clinical-cockpit {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
    display: block;
    padding: 0 6px 6px;
  }

  body.study-active.mobile-pane-ecg .decision-column,
  body.study-active.mobile-pane-answer .reading-column {
    display: none !important;
  }

  body.study-active.mobile-pane-ecg .reading-column,
  body.study-active.mobile-pane-answer .decision-column {
    display: block;
  }

  body.study-active .reading-column,
  body.study-active .decision-column {
    min-height: 0;
    height: 100%;
  }

  body.study-active .ecg-panel {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  body.study-active .ecg-viewport {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
  }

  body.study-active .decision-column {
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.study-active .final-card {
    min-height: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  body.study-active .evidence-linked-options {
    min-height: 0;
    height: auto;
    grid-auto-rows: auto;
    overflow: visible;
  }
}

@media (min-width: 700px) and (max-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
  html.study-active,
  body.study-active {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.study-active #app,
  body.study-active .app-shell {
    width: 100%;
    min-height: 0;
    height: calc(100vh - 46px);
    height: calc(100dvh - 46px);
    overflow: hidden;
  }

  body.study-active .study-view {
    height: 100%;
    padding: 4px 6px 6px;
    overflow: hidden;
  }

  body.study-active .mobile-study-tabs {
    display: none;
  }

  body.study-active .case-layout.clinical-cockpit {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 54fr) minmax(300px, 46fr);
    align-items: stretch;
    gap: 6px;
  }

  body.study-active .reading-column,
  body.study-active .decision-column,
  body.study-active .ecg-panel {
    min-height: 0;
    height: 100%;
  }

  body.study-active .reading-column,
  body.study-active .ecg-panel {
    display: flex;
    flex-direction: column;
  }

  body.study-active .decision-column {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body.study-active .ecg-viewport {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
  }

  body.study-active .final-card {
    min-height: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  body.study-active .evidence-linked-options {
    height: auto;
    grid-auto-rows: auto;
    overflow: visible;
  }
}

/* Mobile study workspace --------------------------------------------------
   Narrow phones use two explicit panes so the ECG never pushes the question
   several screens below it. Wider landscape phones keep both panes visible. */
.mobile-study-tabs {
  display: none;
}

@media (max-width: 699px) {
  .app-shell {
    width: calc(100% - 12px);
  }

  .welcome-view {
    gap: 22px;
    padding: 26px 0 36px;
  }

  .welcome-copy h1 {
    font-size: clamp(30px, 10vw, 38px);
    line-height: 1.18;
  }

  .registration-card {
    padding: 20px 14px;
    border-radius: 13px;
  }

  .registration-card input,
  .registration-card select,
  .registration-card textarea {
    font-size: 16px;
  }

  .registration-card button,
  .restore-card button {
    min-height: 44px;
  }

  .restore-dialog {
    align-items: start;
    overflow-y: auto;
    padding: 8px;
  }

  .restore-card {
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    padding: 20px 16px;
  }

  body.study-active {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.study-active .topbar {
    position: relative;
    min-height: 54px;
    height: 54px;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 5px 7px;
  }

  body.study-active .brand {
    gap: 0;
  }

  body.study-active .brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  body.study-active .brand-mark svg {
    width: 23px;
  }

  body.study-active .brand strong,
  body.study-active .brand small,
  body.study-active #remainingCount {
    display: none;
  }

  body.study-active .study-progress {
    min-width: 0;
    padding: 0;
  }

  body.study-active .study-progress .progress-copy {
    margin-bottom: 3px;
  }

  body.study-active .case-navigator-toggle {
    min-width: 0;
    padding: 1px 3px;
    font-size: 10px;
  }

  body.study-active .progress-status {
    font-size: 9px;
  }

  body.study-active .topbar-meta {
    gap: 3px;
  }

  body.study-active .language-switch {
    padding: 2px;
  }

  body.study-active .language-switch button {
    min-width: 31px;
    min-height: 27px;
    padding: 3px 5px;
    font-size: 9px;
  }

  body.study-active #app,
  body.study-active .app-shell {
    width: 100%;
    min-height: 0;
    height: calc(100vh - 54px);
    height: calc(100dvh - 54px);
    overflow: hidden;
  }

  body.study-active .study-view {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }

  body.study-active .mobile-study-tabs {
    flex: 0 0 42px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    padding: 5px 6px;
    border-bottom: 1px solid var(--line);
    background: #fff;
  }

  .mobile-study-tabs button {
    min-width: 0;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid #cbd7e9;
    border-radius: 7px;
    color: var(--ink-soft);
    background: #f8fafc;
    font-size: 12px;
    font-weight: 750;
  }

  .mobile-study-tabs button[aria-pressed="true"] {
    border-color: var(--blue);
    color: #fff;
    background: var(--blue);
  }

  body.study-active .case-layout.clinical-cockpit {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
    display: block;
    padding: 0 6px 6px;
  }

  body.study-active.mobile-pane-ecg .decision-column,
  body.study-active.mobile-pane-answer .reading-column {
    display: none !important;
  }

  body.study-active .reading-column,
  body.study-active .decision-column {
    min-height: 0;
    height: 100%;
  }

  body.study-active .reading-column {
    display: block;
  }

  body.study-active .ecg-panel {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    margin: 0;
  }

  body.study-active .ecg-panel .panel-heading {
    min-height: 40px;
    flex: 0 0 40px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 4px 6px;
  }

  body.study-active .ecg-panel .panel-heading h2 {
    display: none;
  }

  body.study-active .ecg-controls {
    width: 100%;
    align-self: center;
    justify-content: flex-end;
    gap: 3px;
  }

  body.study-active .ecg-controls button {
    min-width: 30px;
    height: 30px;
    padding: 3px 6px;
  }

  body.study-active .ecg-controls output {
    min-width: 34px;
    font-size: 10px;
  }

  body.study-active .ecg-viewport {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
  }

  body.study-active .decision-column {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0 0 calc(8px + env(safe-area-inset-bottom));
  }

  body.study-active .final-card {
    min-height: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    padding: 8px;
    overflow: visible;
  }

  body.study-active .question-choice-header {
    margin: -8px -8px 0;
    padding: 6px 8px 8px;
  }

  body.study-active .question-choice-header .question-text {
    max-height: none;
    overflow: visible;
    font-size: 13px;
    line-height: 1.35;
  }

  body.study-active .evidence-linked-options {
    min-height: 0;
    height: auto;
    display: grid;
    grid-auto-rows: auto;
    flex: 0 0 auto;
    overflow: visible;
  }

  body.study-active .option-choice-card,
  body.study-active .option-choice-card.is-unable-answer {
    min-height: 46px;
    height: auto;
  }

  body.study-active .option-select {
    min-height: 44px;
    padding: 6px 7px;
  }

  body.study-active .option-evidence-jump {
    min-height: 34px;
    padding: 5px 7px;
    font-size: 10px;
  }

  body.study-active .case-confidence,
  body.study-active .reasoning-trace-rating {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  body.study-active .confidence-scale,
  body.study-active .reasoning-rating-scale {
    width: 100%;
    justify-content: space-between;
  }

  body.study-active .confidence-scale span {
    width: clamp(42px, 14vw, 58px);
    min-height: 38px;
    height: 38px;
  }

  body.study-active .reasoning-rating-scale span {
    min-width: 36px;
    height: 36px;
  }

  body.study-active .reasoning-rating-scale .not-viewed-choice span {
    min-width: 60px;
  }

  body.study-active #submitFinal {
    position: sticky;
    z-index: 4;
    bottom: 0;
    min-height: 44px;
    height: 44px;
    font-size: 13px;
    box-shadow: 0 -5px 12px rgba(255, 255, 255, 0.94);
  }

  body.study-active .case-navigation .secondary-button {
    min-height: 40px;
    height: 40px;
    font-size: 12px;
  }

  body.study-active .evidence-drawer {
    inset: 4px;
    width: auto;
    max-width: none;
    border-radius: 10px;
  }

  body.study-active .assistance-header {
    min-height: 48px;
    padding: 7px 9px;
  }

  body.study-active .assistance-header h2 {
    font-size: 14px;
  }

  body.study-active .advisory-stamp {
    display: none;
  }

  body.study-active .assistance-content {
    padding: 6px 8px 10px;
  }

  body.study-active .option-evidence-tabs {
    position: sticky;
    z-index: 3;
    top: 0;
    gap: 4px;
    margin-top: 0;
    padding: 5px 0;
    background: #fff;
  }

  body.study-active .option-evidence-tab {
    min-height: 38px;
    padding: 5px 4px;
    font-size: 10px;
  }
}

@media (min-width: 700px) and (max-width: 1024px) and (max-height: 600px) and (orientation: landscape) {
  html.study-active,
  body.study-active {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  body.study-active .topbar {
    min-height: 46px;
    height: 46px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 7px;
    padding: 4px 8px;
  }

  body.study-active .brand-mark {
    width: 34px;
    height: 34px;
  }

  body.study-active .brand strong,
  body.study-active .brand small,
  body.study-active #remainingCount {
    display: none;
  }

  body.study-active #app,
  body.study-active .app-shell {
    width: 100%;
    min-height: 0;
    height: calc(100vh - 46px);
    height: calc(100dvh - 46px);
    overflow: hidden;
  }

  body.study-active .study-view {
    height: 100%;
    padding: 4px 6px 6px;
    overflow: hidden;
  }

  body.study-active .mobile-study-tabs {
    display: none;
  }

  body.study-active .case-layout.clinical-cockpit {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(0, 54fr) minmax(300px, 46fr);
    align-items: stretch;
    gap: 6px;
  }

  body.study-active .reading-column,
  body.study-active .decision-column,
  body.study-active .ecg-panel {
    min-height: 0;
    height: 100%;
  }

  body.study-active .reading-column,
  body.study-active .ecg-panel {
    display: flex;
    flex-direction: column;
  }

  body.study-active .decision-column {
    display: block;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0;
  }

  body.study-active .ecg-panel .panel-heading {
    min-height: 36px;
    flex: 0 0 36px;
    padding: 3px 6px;
  }

  body.study-active .ecg-panel .panel-heading h2 {
    display: none;
  }

  body.study-active .ecg-controls button {
    min-width: 28px;
    height: 28px;
    padding: 2px 5px;
  }

  body.study-active .ecg-viewport {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
  }

  body.study-active .final-card {
    min-height: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 7px;
    overflow: visible;
  }

  body.study-active .question-choice-header {
    margin: -7px -7px 0;
    padding: 4px 7px 6px;
  }

  body.study-active .question-choice-header .question-text {
    max-height: 82px;
    overflow-y: auto;
    font-size: 11px;
    line-height: 1.3;
  }

  body.study-active .evidence-linked-options {
    min-height: 0;
    height: auto;
    grid-auto-rows: auto;
    overflow: visible;
  }

  body.study-active .option-choice-card,
  body.study-active .option-choice-card.is-unable-answer {
    min-height: 40px;
  }

  body.study-active .option-select {
    min-height: 38px;
    padding: 4px 6px;
  }

  body.study-active .case-confidence,
  body.study-active .reasoning-trace-rating {
    grid-template-columns: 1fr;
  }

  body.study-active #submitFinal {
    min-height: 38px;
    height: 38px;
    font-size: 11px;
  }

  body.study-active .evidence-drawer {
    inset: 3px;
    width: auto;
    max-width: none;
  }
}

/* Five-choice guard: A-E must remain visible together on common laptops. */
body.study-active .evidence-linked-options {
  grid-auto-rows: minmax(48px, auto);
  gap: 4px;
}

body.study-active .option-choice-card {
  min-height: 48px;
}

body.study-active .option-select {
  min-height: 27px;
  padding-top: 3px;
  padding-bottom: 3px;
}

body.study-active .option-nearby-evidence {
  min-height: 19px;
  padding-top: 2px;
  padding-bottom: 3px;
}

body.study-active .option-plain-explanation span {
  display: none;
}

body.study-active .option-choice-card.is-unable-answer {
  min-height: 38px;
}

/* Clinical cockpit v2: question, choices and option-level evidence share one view. */
.clinical-cockpit {
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 10px;
}

.reading-column {
  min-width: 0;
}

.ecg-panel {
  overflow: hidden;
}

.overlay-toggle {
  min-width: 78px !important;
  color: var(--muted) !important;
}

.overlay-toggle.is-active {
  border-color: #7aaae9 !important;
  color: #165ca4 !important;
  background: #eaf5ff !important;
  box-shadow: inset 0 0 0 1px rgba(36, 87, 214, 0.08);
}

.ecg-stage {
  position: relative;
}

.ecg-overlay {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.lead-highlight {
  position: absolute;
  border: 2px solid rgba(22, 109, 185, 0.78);
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.lead-highlight > span {
  position: absolute;
  top: -18px;
  left: -1px;
  padding: 2px 5px;
  border-radius: 3px 3px 0 0;
  color: #fff;
  background: rgba(16, 78, 132, 0.92);
  font-family: var(--mono);
  font-size: clamp(6px, 0.55vw, 9px);
  font-weight: 700;
  white-space: nowrap;
}

.measurement-dock {
  position: absolute;
  top: 3%;
  right: 2%;
  width: min(46%, 400px);
  padding: 7px;
  border: 1px solid rgba(127, 153, 187, 0.62);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: 0 7px 18px rgba(16, 42, 67, 0.1);
  backdrop-filter: blur(1.5px);
  pointer-events: auto;
}

.measurement-dock-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 5px;
  padding-bottom: 5px;
  border-bottom: 1px solid #dce4ed;
}

.measurement-dock-heading span {
  color: #155b93;
  font-family: var(--mono);
  font-size: clamp(6px, 0.57vw, 9px);
  font-weight: 800;
}

.measurement-dock-heading small {
  color: var(--muted);
  font-size: clamp(5px, 0.48vw, 8px);
  text-align: right;
  white-space: normal;
}

.overlay-measurement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 3px 2px;
  border-bottom: 1px solid rgba(217, 224, 234, 0.7);
}

.overlay-measurement:last-child {
  border-bottom: 0;
}

.overlay-measurement span,
.measurement-dock p {
  margin: 0;
  min-width: 0;
  color: var(--muted);
  font-size: clamp(5px, 0.48vw, 8px);
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.overlay-measurement strong {
  color: var(--navy);
  font-family: var(--mono);
  font-size: clamp(6px, 0.54vw, 9px);
  white-space: nowrap;
}

.overlay-interpretation {
  margin: 0 0 5px;
  padding: 6px 7px;
  border-left: 3px solid #7f91a5;
  border-radius: 4px;
  background: rgba(238, 242, 246, 0.72);
}

.overlay-interpretation.evidence-support {
  border-left-color: #238461;
  background: rgba(232, 248, 241, 0.74);
}

.overlay-interpretation.evidence-against {
  border-left-color: #c75a62;
  background: rgba(255, 239, 240, 0.76);
}

.overlay-interpretation.evidence-mixed {
  border-left-color: #bd8421;
  background: rgba(255, 246, 222, 0.78);
}

.overlay-interpretation strong {
  display: block;
  margin-bottom: 2px;
  color: var(--navy);
  font-size: clamp(6px, 0.55vw, 9px);
}

.overlay-interpretation p {
  margin: 0;
  color: #354b60;
  font-size: clamp(5px, 0.5vw, 8px);
  font-weight: 600;
  line-height: 1.4;
}

.overlay-gap-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  margin-top: 5px;
}

.overlay-gap-list span,
.overlay-gap-list em {
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 8px;
  font-style: normal;
  line-height: 1.25;
}

.overlay-gap-list span {
  color: #fff;
  background: #9f4a51;
  font-weight: 800;
}

.overlay-gap-list em {
  color: #773239;
  background: rgba(255, 255, 255, 0.76);
  font-weight: 650;
}

.overlay-section-label {
  margin: 5px 1px 2px;
  color: #607286;
  font-size: clamp(5px, 0.47vw, 7px);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.overlay-evidence-button {
  position: relative;
  z-index: 2;
  width: 100%;
  margin-top: 7px;
  padding: 6px 8px;
  border: 1px solid rgba(36, 87, 214, 0.25);
  border-radius: 5px;
  color: #1859bd;
  background: rgba(239, 245, 255, 0.68);
  font: 700 11px/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}

.overlay-evidence-button:hover,
.overlay-evidence-button:focus-visible {
  border-color: rgba(36, 87, 214, 0.62);
  background: rgba(227, 238, 255, 0.88);
}

.transparency-rail {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(135px, 0.9fr) repeat(4, minmax(70px, 0.5fr)) minmax(120px, 1.2fr);
  align-items: center;
  gap: 6px;
  min-height: 54px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(23, 42, 72, 0.04);
}

.transparency-intro strong,
.transparency-intro span {
  display: block;
}

.transparency-intro strong {
  color: var(--navy);
  font-size: 10px;
}

.transparency-intro span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.transparency-rail > button {
  min-height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 5px 7px;
  border: 1px solid #d8e1ec;
  border-radius: 6px;
  color: var(--ink-soft);
  background: #f8fafc;
}

.transparency-rail > button:hover {
  border-color: #90afe8;
  background: var(--surface-blue);
}

.transparency-rail > button span {
  font-size: 8px;
}

.transparency-rail > button strong {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
}

.tool-chip-strip,
body.study-active #sidebarTools {
  min-width: 0;
  display: flex;
  gap: 4px;
  margin: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tool-chip-strip .sidebar-tool {
  flex: 0 0 auto;
  padding: 5px 6px;
  font-size: 7px;
}

.decision-column {
  min-width: 0;
}

.final-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.question-choice-header {
  margin: -10px -10px 0;
  padding: 10px 11px 9px;
  border-bottom: 1px solid #cdd9e9;
  background: linear-gradient(110deg, #f9fbff, #eef5ff);
}

.question-heading-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.question-choice-header h2 {
  margin: 5px 0 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.question-choice-header .question-text {
  max-height: 74px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  color: var(--navy);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

.agent-context-strip {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  margin: 7px 0;
  padding: 7px 9px;
  border: 1px solid #b9caec;
  border-radius: 7px;
  background: #f2f6ff;
}

.agent-context-strip > div:first-child {
  min-width: 0;
}

.agent-context-strip span,
.agent-context-strip strong {
  display: block;
}

.agent-context-strip span {
  color: var(--muted);
  font-size: 8px;
}

.agent-context-strip strong {
  max-width: 250px;
  margin-top: 2px;
  color: var(--blue);
  font-size: 10px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  white-space: normal;
}

.agent-context-strip > div:last-child {
  flex: 0 0 auto;
  text-align: right;
}

.agent-context-strip button {
  margin-top: 3px;
  padding: 0;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 8px;
  font-weight: 700;
}

.l1-unassisted-notice {
  margin: 8px 0;
  padding: 10px 11px;
  border: 1px solid #b9d8cf;
  border-radius: 8px;
  background: linear-gradient(120deg, #f2fbf8, #f8fcfb);
}

.l1-unassisted-notice > span {
  display: block;
  color: #287a68;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.l1-unassisted-notice strong {
  display: block;
  margin-top: 3px;
  color: #174f44;
  font-size: 12px;
}

.l1-unassisted-notice p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.agent-action-links {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.evidence-linked-options {
  min-height: 0;
  display: grid;
  gap: 5px;
  margin-top: 5px;
}

.option-choice-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.option-choice-card:hover {
  border-color: #90aae0;
}

.option-choice-card.is-previewing {
  border-color: #4e85df;
  background: #f8fbff;
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.11);
}

.option-choice-card.is-recommended {
  border-color: #9cb6e7;
}

.option-choice-card.is-selected {
  border-color: var(--blue);
  box-shadow: inset 3px 0 0 var(--blue), 0 0 0 1px rgba(36, 87, 214, 0.08);
}

.option-choice-heading {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.option-choice-heading .option-select {
  min-width: 0;
  grid-template-columns: 25px minmax(0, 1fr);
  align-items: center;
}

.option-nearby-evidence .option-badges {
  max-width: none;
  align-self: center;
  flex-wrap: nowrap;
}

.option-choice-heading .option-evidence-jump {
  align-self: center;
  margin-right: 7px;
  padding: 4px 7px;
  border: 1px solid #cddbf2;
  border-radius: 5px;
  color: var(--blue);
  background: #f5f8ff;
}

.option-choice-heading .option-evidence-jump:hover,
.option-choice-heading .option-evidence-jump:focus-visible {
  border-color: #8eaae2;
  background: #eaf1ff;
}

.option-choice-card.is-unassisted .option-select {
  min-height: 52px;
  grid-template-columns: 30px minmax(0, 1fr);
  padding: 9px 10px;
}

.option-choice-card.is-unassisted .option-copy {
  font-size: 12px;
  line-height: 1.4;
}

.option-select {
  width: 100%;
  min-height: 35px;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.option-select .option-letter {
  width: 23px;
  height: 23px;
}

.option-choice-card.is-selected .option-letter {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.option-select .option-copy {
  display: block;
  overflow: visible;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.3;
}

.option-badges {
  display: flex;
  align-items: center;
  gap: 3px;
}

.option-badges em {
  margin: 0;
  padding: 3px 5px;
  border-radius: 99px;
  font-size: 7px;
  font-style: normal;
  white-space: nowrap;
}

.agent-badge {
  color: #1f4db0;
  background: #e5eeff;
}

.option-nearby-evidence {
  min-height: 28px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px 5px 39px;
  border-top: 1px solid #edf0f4;
  background: #fbfcfe;
}

.option-plain-explanation {
  min-width: 0;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 5px;
  padding: 3px 5px;
  border-left: 3px solid #7f91a5;
  border-radius: 3px;
  color: #405469;
  background: #f1f4f7;
}

.option-plain-explanation.evidence-support {
  border-left-color: #238461;
  color: #1b674d;
  background: #ebf8f3;
}

.option-plain-explanation.evidence-against {
  border-left-color: #c75a62;
  color: #84383e;
  background: #fff1f2;
}

.option-plain-explanation.evidence-mixed {
  border-left-color: #bd8421;
  color: #79520e;
  background: #fff7e3;
}

.option-plain-explanation strong,
.option-plain-explanation span {
  min-width: 0;
  font-size: 9px;
  line-height: 1.35;
}

.option-plain-explanation strong {
  white-space: nowrap;
}

.option-plain-explanation span {
  overflow-wrap: anywhere;
}

.option-evidence-metrics,
.option-evidence-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.option-evidence-meta {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.measurement-chip {
  min-width: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 3px 5px;
  border-radius: 4px;
  color: #176447;
  background: #eaf8f3;
  white-space: normal;
}

.measurement-chip small {
  max-width: none;
  font-size: 6px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.measurement-chip strong {
  font-family: var(--mono);
  font-size: 7px;
}

.evidence-pending,
.option-evidence-meta > span {
  color: var(--muted);
  font-size: 7px;
  white-space: nowrap;
}

.option-evidence-meta .support-count {
  color: var(--green);
}

.option-evidence-meta .failed-count {
  color: var(--red);
}

.option-evidence-jump {
  padding: 2px 4px;
  border: 0;
  color: var(--blue);
  background: transparent;
  font-size: 7px;
  font-weight: 700;
  white-space: nowrap;
}

.option-evidence-card.is-focused {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.12);
}

.tool-disclosure,
.criteria-source-notice {
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid #b8d8cf;
  border-radius: 8px;
  background: #f1faf7;
}

.tool-disclosure strong,
.criteria-source-notice strong {
  font-size: 12px;
}

.tool-disclosure p,
.criteria-source-notice p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.tool-disclosure > span {
  display: inline-flex;
  margin-top: 7px;
  padding: 3px 6px;
  border-radius: 4px;
  color: #176447;
  background: #dff7ef;
  font-family: var(--mono);
  font-size: 8px;
}

.tool-identity strong,
.tool-identity span,
.tool-identity em {
  display: block;
}

.tool-identity span {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.4;
}

.tool-identity em {
  margin-top: 5px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 7px;
  font-style: normal;
}

.tool-identity .tool-status.is-failed {
  color: var(--red);
  font-weight: 750;
}

.guideline-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.guideline-link-card {
  min-width: 0;
  display: block;
  padding: 10px;
  border: 1px solid #e4d39c;
  border-radius: 7px;
  color: var(--ink);
  background: #fffcf2;
  text-decoration: none;
}

.guideline-link-card:hover {
  border-color: #c99d29;
  background: #fff9e5;
}

.guideline-link-card span,
.guideline-link-card strong,
.guideline-link-card small {
  display: block;
}

.guideline-link-card span {
  color: var(--amber);
  font-family: var(--mono);
  font-size: 8px;
}

.guideline-link-card strong {
  margin: 5px 0;
  font-size: 10px;
  line-height: 1.4;
}

.guideline-link-card small {
  color: var(--blue);
  font-size: 8px;
}

.guideline-gap {
  padding: 10px;
  border: 1px dashed #d5bd76;
  border-radius: 7px;
  background: #fffcf3;
}

.guideline-gap strong {
  color: var(--amber);
  font-size: 10px;
}

.guideline-gap p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

@media (min-width: 901px) {
  body.study-active .clinical-cockpit {
    grid-template-columns: minmax(0, 1fr) 430px;
  }

  body.study-active .reading-column {
    grid-template-rows: minmax(0, 1fr) 54px;
  }

  body.study-active .decision-column {
    display: block;
  }

  body.study-active .final-card {
    padding: 10px;
  }

  body.study-active .confidence-control {
    margin: 6px 0 4px;
  }

  body.study-active .rationale-field {
    margin-bottom: 4px;
  }

  body.study-active .rationale-field textarea {
    min-height: 31px;
    height: 31px;
  }
}

@media (min-width: 901px) and (max-width: 1280px) {
  body.study-active .clinical-cockpit {
    grid-template-columns: minmax(0, 1fr) 390px;
  }

  .transparency-rail {
    grid-template-columns: repeat(4, minmax(62px, 1fr)) minmax(100px, 1.2fr);
  }

  .transparency-intro {
    display: none;
  }

  .measurement-chip small {
    max-width: 55px;
  }
}

@media (max-width: 900px) {
  .clinical-cockpit {
    grid-template-columns: 1fr;
  }

  .reading-column {
    display: block;
  }

  .transparency-rail {
    margin-bottom: 10px;
    grid-template-columns: repeat(4, 1fr);
  }

  .transparency-intro,
  .tool-chip-strip {
    grid-column: 1 / -1;
  }

  .decision-column {
    display: block;
  }

  .final-card {
    height: auto;
  }

  .option-nearby-evidence {
    padding-left: 39px;
  }
}

@media (max-width: 640px) {
  .measurement-dock {
    width: 42%;
  }

  .option-nearby-evidence,
  .option-evidence-meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .guideline-links {
    grid-template-columns: 1fr;
  }
}

/* Compact-height correction for real Chrome windows (browser chrome reduces viewport height). */
.final-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(100px, 1fr) auto auto auto auto;
  gap: 5px;
}

.question-choice-header,
.agent-context-strip,
.decision-step,
.confidence-control,
.rationale-field,
.case-navigation,
.final-card > .primary-button,
.final-card > .form-error {
  flex-shrink: 0;
}

.agent-context-strip,
.confidence-control,
.rationale-field,
.final-card > .form-error {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.evidence-linked-options {
  height: 100%;
  display: grid;
  grid-template-rows: none;
  grid-auto-rows: minmax(64px, auto);
  align-content: start;
  gap: 5px;
  margin: 0;
  overflow-y: auto;
}

.option-choice-card {
  min-height: 64px;
  display: grid;
  grid-template-rows: auto auto;
}

.option-select {
  min-height: 28px;
  padding-top: 3px;
  padding-bottom: 3px;
}

.option-nearby-evidence {
  min-height: 17px;
  padding-top: 2px;
  padding-bottom: 2px;
}

@media (min-width: 901px) and (max-height: 700px) {
  body.study-active .topbar {
    min-height: 48px;
    height: 48px;
    padding-top: 4px;
    padding-bottom: 4px;
  }

  body.study-active .brand-mark {
    width: 31px;
    height: 31px;
  }

  body.study-active .brand small,
  body.study-active .role-chip {
    display: none;
  }

  body.study-active .app-shell {
    min-height: calc(100vh - 48px);
  }

  body.study-active .study-view {
    height: calc(100vh - 48px);
    padding: 5px 0 7px;
  }

  body.study-active .case-command-bar {
    min-height: 34px;
    flex-basis: 34px;
    margin-bottom: 5px;
    padding: 3px 10px;
  }

  body.study-active .case-clock span {
    display: none;
  }

  body.study-active .reading-column {
    grid-template-rows: minmax(0, 1fr) 46px;
    gap: 5px;
  }

  body.study-active .ecg-panel .panel-heading {
    min-height: 35px;
    flex-basis: 35px;
    padding: 3px 9px;
  }

  body.study-active .ecg-controls button {
    height: 26px;
  }

  body.study-active .ecg-footer {
    min-height: 23px;
    flex-basis: 23px;
    padding: 4px 9px;
  }

  .transparency-rail {
    min-height: 46px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .transparency-rail > button {
    min-height: 34px;
  }

  body.study-active .final-card {
    grid-template-rows: auto auto auto minmax(82px, 1fr) auto auto auto auto;
    gap: 3px;
    padding: 7px;
  }

  .question-choice-header {
    margin: -7px -7px 0;
    padding: 6px 8px;
  }

  .question-choice-header h2 {
    display: none;
  }

  .question-choice-header .question-text {
    max-height: 47px;
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.35;
  }

  .agent-context-strip {
    min-height: 34px;
    padding: 4px 7px;
  }

  .decision-step strong {
    font-size: 10px !important;
  }

  .evidence-linked-options {
    grid-template-rows: none;
    grid-auto-rows: minmax(58px, auto);
    gap: 3px;
  }

  .option-choice-card {
    min-height: 58px;
    grid-template-rows: auto auto;
  }

  .option-select {
    min-height: 25px;
    padding: 2px 5px;
  }

  .option-select .option-letter {
    width: 20px;
    height: 20px;
  }

  .option-select .option-copy {
    font-size: 10px;
  }

  .option-nearby-evidence {
    min-height: 15px;
    padding: 1px 5px 2px 33px;
  }

  .measurement-chip {
    padding: 1px 4px;
  }

  body.study-active .confidence-control {
    margin: 2px 0 !important;
  }

  body.study-active .rationale-field textarea {
    min-height: 27px;
    height: 27px;
  }

  body.study-active .decision-card > .primary-button {
    min-height: 31px;
  }
}

/* Product typography: doctor-facing content must remain readable at 70% ECG scale. */
.case-command-bar p,
.ecg-footer {
  font-size: 12px;
}

.panel-heading h2 {
  font-size: 16px;
}

.ecg-controls button {
  font-size: 14px;
  font-weight: 650;
}

.ecg-controls output {
  font-size: 12px;
}

.lead-highlight {
  border-width: 3px;
}

.lead-highlight > span {
  top: -25px;
  padding: 4px 7px;
  font-size: 15px;
}

.measurement-dock {
  width: min(39%, 330px);
  padding: 10px;
}

.measurement-dock-heading span {
  font-size: 16px;
}

.measurement-dock-heading small {
  font-size: 13px;
}

.overlay-measurement {
  padding: 6px 3px;
}

.overlay-measurement span,
.measurement-dock p {
  font-size: 14px;
}

.overlay-measurement strong {
  font-size: 15px;
}

.transparency-intro strong {
  font-size: 12px;
}

.transparency-intro span,
.transparency-rail > button span {
  font-size: 10px;
}

.transparency-rail > button strong {
  font-size: 14px;
}

.tool-chip-strip .sidebar-tool {
  font-size: 9px;
}

.question-choice-header h2,
.question-heading-line .section-index {
  font-size: 11px;
}

.question-choice-header .question-text {
  font-size: 16px;
  line-height: 1.5;
}

.agent-context-strip span {
  font-size: 10px;
}

.agent-context-strip strong {
  font-size: 13px;
}

.agent-context-strip button {
  font-size: 10px;
}

.decision-step span {
  font-size: 11px;
}

.decision-step strong {
  font-size: 13px;
}

.option-select .option-copy {
  font-size: 13px;
  line-height: 1.35;
}

.option-badges em {
  font-size: 9px;
}

.measurement-chip small {
  max-width: 105px;
  font-size: 10px;
}

.measurement-chip strong {
  font-size: 11px;
}

.evidence-pending,
.option-evidence-meta > span,
.option-evidence-jump {
  font-size: 10px;
}

.confidence-control > span,
.rationale-field > span {
  font-size: 12px;
}

.confidence-control > span > span small {
  display: inline;
  margin-left: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.confidence-control output {
  font-size: 14px;
  font-weight: 750;
}

.rationale-field textarea {
  font-size: 12px;
}

.evidence-card h3,
.criteria-card h3,
.tool-summary h3 {
  font-size: 15px;
}

.evidence-card p,
.evidence-card ul,
.criteria-card ul {
  font-size: 13px;
  line-height: 1.75;
}

.evidence-list strong,
.criteria-card h4 {
  font-size: 12px;
}

.evidence-list ul {
  font-size: 13px;
  line-height: 1.75;
}

.kv-item span {
  font-size: 10px;
}

.kv-item strong {
  font-size: 13px;
}

.tool-step strong {
  font-size: 12px;
}

.tool-identity span,
.tool-step p {
  font-size: 12px;
}

.tool-identity em,
.audit-link {
  font-size: 10px;
}

.guideline-link-card span,
.guideline-link-card small,
.guideline-gap p {
  font-size: 10px;
}

.guideline-link-card strong,
.guideline-gap strong {
  font-size: 12px;
}

body.study-active .question-choice-header .question-text {
  font-size: 16px;
  line-height: 1.45;
}

body.study-active .option-select .option-copy {
  font-size: 14px;
  line-height: 1.35;
}

body.study-active .measurement-chip small {
  font-size: 12px;
}

body.study-active .measurement-chip strong {
  font-size: 13px;
}

body.study-active .option-evidence-meta > span,
body.study-active .option-evidence-jump {
  font-size: 12px;
}

body.study-active .option-plain-explanation strong {
  font-size: 12px;
}

body.study-active .option-plain-explanation span {
  font-size: 11px;
}

body.study-active .rationale-field > span {
  font-size: 12px;
}

body.study-active .rationale-field textarea {
  font-size: 13px;
}

/* Overlay is transformed together with the ECG at 70%, so compensate here. */
body.study-active .lead-highlight > span {
  top: -17px;
  padding: 2px 4px;
  font-size: 9px;
  line-height: 1.15;
}

body.study-active .measurement-dock-heading span {
  font-size: 15px;
}

body.study-active .measurement-dock-heading small {
  font-size: 12px;
}

body.study-active .overlay-measurement span,
body.study-active .measurement-dock p {
  font-size: 13px;
}

body.study-active .overlay-measurement strong {
  font-size: 14px;
}

body.study-active .overlay-interpretation strong {
  font-size: 14px;
}

body.study-active .overlay-interpretation p {
  font-size: 12px;
}

body.study-active .overlay-section-label {
  font-size: 11px;
}

/* Reader-study product finish: show complete labels and make evidence inspectable. */
.measurement-dock {
  width: min(46%, 400px);
  background: rgba(255, 255, 255, 0.54);
}

.measurement-dock-heading small,
.overlay-measurement span,
.measurement-chip,
.measurement-chip small,
.tool-chip-strip .sidebar-tool {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.overlay-measurement span {
  flex: 1 1 auto;
}

.measurement-chip {
  flex-wrap: wrap;
}

.option-evidence-metrics {
  flex: 1 1 auto;
}

/* Reader-study layout refinement: full-bleed ECG and calmer option cards. */
.ecg-viewport {
  background: #fffafa;
}

/*
 * The interaction scale resets to 70%. Enlarge the base canvas by 1 / 0.7 so
 * that this reset state fills the viewport instead of shrinking an already
 * fitted image a second time.
 */
.ecg-stage {
  position: absolute;
  inset: -21.428571%;
  width: auto;
  height: auto;
  display: block;
}

.ecg-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.evidence-linked-options {
  grid-auto-rows: minmax(70px, auto);
  gap: 8px;
  padding: 2px 3px 5px;
}

.option-choice-card {
  min-height: 70px;
  overflow: hidden;
  border-radius: 9px;
  background: #fff;
}

.option-select {
  min-height: 34px;
  padding: 5px 8px;
}

.option-nearby-evidence {
  min-height: 30px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 5px 8px 7px 41px;
  background: #fcfdff;
}

.option-plain-explanation {
  grid-column: auto;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px;
  padding: 3px 6px;
}

.option-evidence-jump {
  align-self: center;
  font-weight: 750;
}

body.study-active .option-select .option-copy {
  font-size: 13px;
  line-height: 1.3;
}

body.study-active .option-plain-explanation strong,
body.study-active .option-plain-explanation span {
  font-size: 10px;
  line-height: 1.32;
}

body.study-active .option-evidence-jump {
  font-size: 10px;
}

.measurement-dock {
  width: min(43%, 370px);
  padding: 6px;
}

body.study-active .measurement-dock-heading span {
  font-size: 13px;
}

body.study-active .measurement-dock-heading small {
  font-size: 10px;
}

body.study-active .overlay-interpretation strong {
  font-size: 12px;
}

body.study-active .overlay-interpretation p {
  font-size: 10px;
  line-height: 1.35;
}

body.study-active .overlay-gap-list span,
body.study-active .overlay-gap-list em {
  font-size: 9px;
}

body.study-active .overlay-section-label {
  font-size: 9px;
}

body.study-active .overlay-measurement span,
body.study-active .measurement-dock p {
  font-size: 10px;
}

body.study-active .overlay-measurement strong {
  font-size: 12px;
}

/*
 * Evidence belongs next to the tracing, never on top of it. The ECG overlay is
 * now reserved for lightweight lead outlines; interpretation and measurements
 * live in this compact tray below the image.
 */
.ecg-evidence-tray {
  flex: 0 0 auto;
  padding: 7px 10px 8px;
  border-top: 1px solid #d9e2ec;
  background: linear-gradient(110deg, #f8fbff, #f3f7fb);
}

.measurement-tray-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 5px;
}

.measurement-tray-heading > span {
  flex: 0 0 auto;
  color: #155b93;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
}

.measurement-tray-heading > small {
  min-width: 0;
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.measurement-tray-heading .overlay-evidence-button {
  width: auto;
  flex: 0 0 auto;
  display: inline-flex;
  margin: 0;
  padding: 3px 7px;
  font-size: 10px;
}

.measurement-tray-content {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) minmax(300px, 1fr);
  gap: 8px;
  align-items: stretch;
}

.ecg-evidence-tray .overlay-interpretation {
  min-width: 0;
  margin: 0;
  padding: 5px 7px;
}

.ecg-evidence-tray .overlay-interpretation strong {
  font-size: 11px;
}

.ecg-evidence-tray .overlay-interpretation p {
  font-size: 10px;
  line-height: 1.35;
}

.measurement-tray-values {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 8px;
  align-content: start;
}

.measurement-tray-values > .overlay-section-label {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 9px;
}

.measurement-tray-values .overlay-measurement {
  min-width: 0;
  display: block;
  padding: 2px 0;
  border: 0;
}

.measurement-tray-values .overlay-measurement span,
.measurement-tray-values .overlay-measurement strong {
  display: block;
  overflow-wrap: anywhere;
  white-space: normal;
}

.measurement-tray-values .overlay-measurement span {
  font-size: 9px;
}

.measurement-tray-values .overlay-measurement strong {
  margin-top: 1px;
  font-size: 11px;
}

.measurement-tray-values > p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
}

/* English evidence copy wraps more than Chinese; keep the compact tray from
 * shrinking the ECG viewport. The complete text remains available in the
 * full-evidence drawer. */
html[lang="en"] body.study-active .ecg-evidence-tray .overlay-interpretation p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

html[lang="en"] body.study-active .ecg-evidence-tray .overlay-gap-list {
  display: none;
}

/* Match the concise Chinese option-card hierarchy in English. Full criteria,
 * gaps, and measurements remain available through View evidence. */
html[lang="en"] body.study-active .option-plain-explanation span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body.study-active.case-level-l4 .option-plain-explanation span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

@media (min-width: 901px) {
  body.study-active.case-level-l4 .decision-column {
    height: 100%;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 7px;
  }

  body.study-active.case-level-l4 .final-card {
    min-height: 100%;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: visible;
  }

  body.study-active.case-level-l4 .question-choice-header .question-text {
    max-height: none;
    overflow: visible;
  }

  body.study-active.case-level-l4 .evidence-linked-options {
    height: auto;
    grid-auto-rows: auto;
    overflow: visible;
  }

  body.study-active.case-level-l4 .option-choice-card {
    height: auto;
    min-height: 0;
  }

  body.study-active.case-level-l4 .option-select {
    align-items: flex-start;
  }

  body.study-active.case-level-l4 .option-select .option-copy {
    display: block;
    max-height: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    -webkit-box-orient: initial;
    -webkit-line-clamp: unset;
  }

  body.study-active.case-level-l4 .option-badges {
    align-items: flex-start;
  }
}

@media (max-width: 900px) {
  .measurement-tray-content {
    grid-template-columns: 1fr;
  }

  .option-guideline-sections {
    grid-template-columns: 1fr;
  }

  .option-guideline-sources {
    grid-column: auto;
  }

  .measurement-tray-values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.study-active.case-level-l4 .question-choice-header .question-text,
  body.study-active.case-level-l4 .option-select .option-copy {
    max-height: none;
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
  }
}

/* Keep the question header compact so all answer choices remain visible. */
body.study-active .question-choice-header {
  padding: 5px 8px 6px;
}

body.study-active .question-heading-line .section-index {
  font-size: 8px;
}

body.study-active .question-choice-header .phase-pill {
  padding: 3px 6px;
  font-size: 9px;
}

body.study-active .question-choice-header h2 {
  display: none;
}

body.study-active .question-choice-header .question-text {
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.3;
}

/* Final desktop height guard after all legacy layout rules. */
@media (min-width: 901px) {
  html.study-active,
  body.study-active {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body.study-active #app,
  body.study-active .app-shell {
    min-height: 0;
    height: calc(100vh - 58px);
    overflow: hidden;
  }

  body.study-active .study-view {
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  body.study-active .case-layout.clinical-cockpit {
    min-height: 0;
    height: auto;
    flex: 1 1 0;
    align-items: stretch;
  }

  body.study-active .reading-column {
    min-height: 0;
    height: 100%;
    grid-template-rows: minmax(0, 1fr);
  }

  body.study-active .decision-column,
  body.study-active .ecg-panel,
  body.study-active .final-card {
    min-height: 0;
    height: 100%;
  }
}

/* Formal-study progress navigator, remaining count, and per-case timer. */
.study-progress {
  position: relative;
}

.study-progress .progress-copy {
  align-items: center;
  margin-bottom: 5px;
}

.case-navigator-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 5px;
  border: 0;
  border-radius: 5px;
  color: var(--blue);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}

.case-navigator-toggle:hover,
.case-navigator-toggle[aria-expanded="true"] {
  background: #eef4ff;
}

.progress-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

#caseTimer {
  min-width: 43px;
  color: var(--ink-soft);
  font-weight: 750;
  text-align: right;
}

.case-navigator-popover {
  position: absolute;
  z-index: 80;
  top: calc(100% + 10px);
  left: 50%;
  width: min(440px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid #cbd7e8;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 42px rgba(16, 42, 67, 0.2);
  transform: translateX(-50%);
}

.case-navigator-heading,
.case-navigator-legend,
.case-navigator-legend > span {
  display: flex;
  align-items: center;
}

.case-navigator-heading {
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 11px;
}

.case-navigator-heading span {
  color: var(--muted);
  font-size: 9px;
}

.case-navigator-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.case-navigator-item {
  min-width: 0;
  min-height: 42px;
  display: grid;
  place-items: center;
  gap: 0;
  padding: 3px;
  border: 1px solid #d5deea;
  border-radius: 7px;
  color: var(--ink-soft);
  background: #fff;
}

.case-navigator-item strong {
  font-family: var(--mono);
  font-size: 11px;
}

.case-navigator-item span {
  color: var(--muted);
  font-size: 8px;
}

.case-navigator-item.is-answered {
  border-color: #9ed6c3;
  color: #176447;
  background: #edf9f5;
}

.case-navigator-item.is-current {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(36, 87, 214, 0.17);
}

.case-navigator-legend {
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 8px;
}

.case-navigator-legend > span {
  gap: 4px;
}

.case-navigator-legend i {
  width: 8px;
  height: 8px;
  border: 1px solid #d5deea;
  border-radius: 2px;
  background: #fff;
}

.case-navigator-legend i.is-current {
  border: 2px solid var(--blue);
}

.case-navigator-legend i.is-answered {
  border-color: #9ed6c3;
  background: #d9f3ea;
}

/* Compact case-level evaluation, positioned directly above Submit. */
body.study-active .reasoning-trace-rating {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid #dce5f2;
}

.reasoning-rating-copy strong,
.reasoning-rating-copy span {
  display: block;
}

.reasoning-rating-copy strong {
  font-size: 10px;
  line-height: 1.25;
}

.reasoning-rating-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.reasoning-rating-scale {
  display: flex;
  gap: 3px;
}

.reasoning-rating-scale label {
  cursor: pointer;
}

.reasoning-rating-scale input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  clip-path: inset(50%);
}

.reasoning-rating-scale span {
  min-width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 1px solid #cbd7ea;
  border-radius: 6px;
  color: var(--ink-soft);
  background: #fff;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 750;
}

.reasoning-rating-scale .not-viewed-choice span {
  min-width: 54px;
  font-family: var(--font);
  font-size: 9px;
}

.reasoning-rating-scale input:checked + span {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.reasoning-rating-scale input:focus-visible + span {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 2px;
}

.option-choice-card.is-unable-answer {
  grid-template-rows: 1fr;
  border-style: dashed;
  background: #fafbfc;
}

.option-choice-card.is-unable-answer .option-select {
  height: 100%;
}

/* Keep every answer option compact and fully readable, including long L2/L3 text. */
body.study-active .option-select .option-copy {
  display: block;
  max-height: none;
  overflow: visible;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: clip;
  white-space: normal;
  -webkit-line-clamp: unset;
}

body.study-active .option-select .option-letter {
  font-size: 10px;
}

@media (max-width: 640px) {
  .case-navigator-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.study-active .reasoning-trace-rating {
    grid-template-columns: 1fr;
  }
}
