/* Slit-Lamp Simulator (DEC-059, DEC-060). The Corneal Endothelium Lab's dark instrument design (an exception
   DEC-052 made for that page; extending it here awaits the owner's approval), with the Hub's typeface. A slit-lamp
   view is a dark room with a bright beam, so the page stays dark around the eyepiece. The examination fits one
   screen: the view and a tabbed control panel side by side on wide screens, the panel under the view on phones. */

@font-face {
  font-family: Figtree;
  src: url('/fonts/figtree-latin-400-normal.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url('/fonts/figtree-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: Figtree;
  src: url('/fonts/figtree-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #06080b;
  --panel: #10151b;
  --panel-2: #151b23;
  --line: #242d38;
  --line-2: #344050;
  --text: #e8edf2;
  --dim: #a3afbd;
  --rec: #f5c063;
  --sim: #7cc8f0;
  --na: #a3afbd;
  --ok: #7fe3a4;
  --miss: #ff9a8a;
  --amber: #f2a900;
  /* DEC-069: each tab has its own colour, in the order to work in: examine, then the guide, then the findings. */
  --tab-examine: #f2a900;
  --tab-examine-bg: rgba(242, 169, 0, 0.14);
  --tab-guide: #7cc8f0;
  --tab-guide-bg: rgba(124, 200, 240, 0.14);
  --tab-findings: #7fe3a4;
  --tab-findings-bg: rgba(127, 227, 164, 0.13);
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px;
  /* DEC-076: one colour for each part of the eye, used in study mode's case list and its filter. */
  --reg-conjunctiva: #ff8fa3;
  --reg-cornea: #7cc8f0;
  --reg-chamber: #f4a56a;
  --reg-lens: #c4a7ff;
  --reg-normal: #7fe3a4;
  --arrive: cubic-bezier(0.16, 1, 0.3, 1);
}
::selection {
  background: rgba(242, 169, 0, 0.35);
  color: #fff;
}
html {
  scrollbar-color: var(--line-2) var(--bg);
  accent-color: var(--amber);
}

* {
  box-sizing: border-box;
}
/* The hidden attribute always wins over a display set below. */
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.5 var(--sans);
  font-variant-numeric: tabular-nums;
}
body.examining {
  overflow: hidden;
}
a {
  color: var(--sim);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.01em;
}
h2 {
  font-size: 22px;
}
h3 {
  font-size: 16px;
  margin-top: 1.2em;
}

/* ---------- the case list ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px max(16px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.top .home {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.top .sep,
.top .here {
  color: var(--dim);
}
.chip.eye {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  color: var(--dim);
  white-space: nowrap;
}
.chip.review {
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  color: var(--rec);
  white-space: nowrap;
}
.top .chip.review {
  margin-left: auto;
}
main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}
/* DEC-076: the opening sets the words beside a loop recorded from the simulator, in its round eyepiece. */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(200px, 30vw, 340px);
  align-items: center;
  gap: 24px 40px;
  margin-bottom: 28px;
}
.intro-words {
  max-width: 640px;
}
.eyepiece {
  margin: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
}
.eyepiece video {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #000;
  box-shadow:
    0 0 0 1px var(--line-2),
    0 24px 60px -18px rgba(0, 0, 0, 0.85),
    0 0 0 10px #0b0f14,
    0 0 0 11px var(--line);
  object-fit: cover;
}
.eyepiece figcaption {
  color: var(--dim);
  font-size: 13px;
}
@media (max-width: 720px) {
  .intro {
    grid-template-columns: minmax(0, 1fr);
  }
  .eyepiece {
    order: -1;
    width: min(62vw, 260px);
    justify-self: center;
  }
}
.lede {
  color: var(--dim);
  font-size: 17px;
}
.legend {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--dim);
  font-size: 14px;
}
.tag {
  display: inline-block;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 13px;
  font-weight: 600;
}
.tag.rec {
  color: #1a1407;
  background: var(--rec);
}
.tag.sim {
  color: #071620;
  background: var(--sim);
}
.tag.na {
  color: var(--na);
  border: 1px dashed var(--line-2);
}
.row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.hint,
.note {
  color: var(--dim);
  font-size: 15px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  overflow: hidden;
}
.seg button {
  background: transparent;
  border: 0;
  min-height: 44px;
  min-width: 88px;
  padding: 0 16px;
  cursor: pointer;
}
.seg button[aria-checked='true'] {
  background: var(--panel-2);
  color: var(--amber);
  font-weight: 600;
}
/* DEC-076: study mode's filter, one button per part of the eye, each with its colour and count. */
.regions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 4px;
}
.region {
  --reg: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  transition:
    background-color 0.2s,
    border-color 0.2s,
    color 0.2s;
}
.region::before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--reg);
}
.region[data-region='all']::before {
  background: conic-gradient(
    var(--reg-conjunctiva) 0 25%,
    var(--reg-cornea) 0 50%,
    var(--reg-chamber) 0 75%,
    var(--reg-lens) 0
  );
}
.region-n {
  color: var(--dim);
  font-size: 13px;
}
.region:hover {
  border-color: var(--reg);
}
.region[aria-pressed='true'] {
  border-color: var(--reg);
  background: color-mix(in srgb, var(--reg) 16%, transparent);
  color: var(--reg);
  font-weight: 600;
}
.region[aria-pressed='true'] .region-n {
  color: inherit;
}
.region[data-region='all'][aria-pressed='true'] {
  --reg: var(--amber);
}
[data-region='conjunctiva'] {
  --reg: var(--reg-conjunctiva);
}
[data-region='cornea'] {
  --reg: var(--reg-cornea);
}
[data-region='chamber'] {
  --reg: var(--reg-chamber);
}
[data-region='lens'] {
  --reg: var(--reg-lens);
}
[data-region='normal'] {
  --reg: var(--reg-normal);
}
.case-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.case {
  width: 100%;
  min-height: 110px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 6px;
  cursor: pointer;
  transition:
    border-color 0.2s,
    transform 0.25s var(--arrive),
    box-shadow 0.25s var(--arrive),
    background-color 0.2s;
}
/* A card without a part of the eye (quiz mode) keeps the plain blue; the parts' colours above stay in force. */
.case:not([data-region]) {
  --reg: var(--sim);
}
.case:hover,
.case:focus-visible {
  border-color: var(--reg);
  background: color-mix(in srgb, var(--reg) 6%, var(--panel));
  box-shadow: 0 14px 30px -16px color-mix(in srgb, var(--reg) 45%, transparent);
  transform: translateY(-2px);
}
.case:active {
  transform: translateY(0) scale(0.985);
  transition-duration: 0.08s;
}
.case-region {
  color: var(--reg);
  font-weight: 600;
}
.case-region::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--reg);
  vertical-align: 1px;
}
/* The cards arrive one after another when the list is shown (capped at about a third of a second). */
.case-list.arrive .case {
  animation: case-in 0.5s var(--arrive) backwards;
  animation-delay: calc(var(--i, 0) * 28ms);
}
@keyframes case-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
::view-transition-group(*) {
  animation-duration: 0.35s;
  animation-timing-function: var(--arrive);
}
.case-title {
  font-weight: 700;
  font-size: 18px;
}
.case-prompt {
  font-size: 15px;
}
.case-meta {
  color: var(--dim);
  font-size: 13px;
}
.foot {
  border-top: 1px solid var(--line);
  color: var(--dim);
  padding: 32px 16px 40px;
}
.foot h2 {
  margin: 0 auto 18px;
  max-width: 1080px;
  color: var(--text);
  font-size: 24px;
  text-align: center;
}
/* DEC-074: six highlights, each led by a figure in amber. */
.foot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.foot-grid li {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.foot-grid .stat {
  display: block;
  color: var(--amber);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
}
.foot-grid b {
  display: block;
  margin: 6px 0 6px;
  color: var(--text);
  font-size: 17px;
}
.foot-grid p {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- buttons ---------- */
.ghost,
.primary,
.tech,
.mag {
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
}
.ghost {
  background: transparent;
  border: 1px solid var(--line-2);
  padding: 0 14px;
}
.primary {
  background: var(--amber);
  color: #1a1203;
  border: 0;
  font-weight: 700;
  padding: 0 24px;
  width: 100%;
  min-height: 48px;
}
.primary:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ---------- the examination: one screen ---------- */
.exam {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  background: var(--bg);
}
.exam-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.exam-bar h1 {
  font-size: 18px;
  margin: 0;
  white-space: nowrap;
}
.exam-prompt {
  margin: 0;
  color: var(--dim);
  font-size: 14px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exam-body {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 400px);
}
.scope-area {
  position: relative;
  container-type: size;
  min-height: 0;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 10px;
}
.scope {
  position: relative;
  width: min(100cqw, 100cqh);
  height: min(100cqw, 100cqh);
  background: #000;
  border-radius: 50%;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  box-shadow:
    0 0 0 6px #0c1117,
    0 0 0 7px var(--line);
}
.scope:active {
  cursor: grabbing;
}
.scope canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#overlay {
  pointer-events: none;
}
.hud {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 80%;
  font-size: 13px;
  background: rgba(6, 8, 11, 0.72);
  padding: 4px 10px;
  border-radius: 999px;
  pointer-events: none;
}
.scope-msg {
  position: absolute;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18%;
  color: var(--dim);
}
/* Over a drawn eye (a finding that could not be loaded): readable on top of it. */
.scope-msg.over {
  background: rgb(6 8 11 / 0.78);
  color: var(--text);
}

/* The panel scrolls inside itself; the page never does. */
.panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
}
.panel-head {
  display: grid;
}
/* Study mode's first control, larger than the rest: the outlines of the findings, off until asked for. */
.outline-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  margin: 10px 12px 4px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font: 700 18px/1.2 var(--sans);
  text-align: left;
  cursor: pointer;
}
.outline-state {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 96px;
  justify-content: flex-end;
  color: var(--dim);
  font-size: 16px;
}
.outline-switch .track {
  position: relative;
  width: 54px;
  height: 32px;
  border-radius: 16px;
  background: var(--line-2);
  transition: background 0.15s;
}
.outline-switch .track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 0.15s;
}
.outline-switch[aria-checked='true'] {
  border-color: var(--amber);
}
.outline-switch[aria-checked='true'] .outline-state {
  color: var(--amber);
}
.outline-switch[aria-checked='true'] .track {
  background: var(--amber);
}
.outline-switch[aria-checked='true'] .track::after {
  transform: translateX(22px);
}
.outline-switch:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .outline-switch .track,
  .outline-switch .track::after {
    transition: none;
  }
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}
.tabs button {
  --tab: var(--tab-examine);
  --tab-bg: var(--tab-examine-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  box-shadow: inset 0 -1px 0 var(--tab);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  font-size: 16px;
  padding: 0 4px;
  transition:
    background 0.15s,
    color 0.15s;
}
.tabs button[data-tab='answer'] {
  --tab: var(--tab-guide);
  --tab-bg: var(--tab-guide-bg);
}
.tabs button[data-tab='findings'] {
  --tab: var(--tab-findings);
  --tab-bg: var(--tab-findings-bg);
}
.tabs .step {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--tab);
  color: var(--tab);
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.tabs button:hover:not(:disabled) {
  background: var(--tab-bg);
}
.tabs button[aria-selected='true'] {
  color: var(--tab);
  background: var(--tab-bg);
}
/* DEC-076: one underline slides to the open tab and takes its colour. */
.tabs {
  position: relative;
}
.tab-ink {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(100% / 3);
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--tab-examine);
  transform: translateX(calc(var(--tab-at, 0) * 100%));
  transition:
    transform 0.35s var(--arrive),
    background-color 0.35s;
  pointer-events: none;
}
.tabs[data-open='answer'] .tab-ink {
  background: var(--tab-guide);
}
.tabs[data-open='findings'] .tab-ink {
  background: var(--tab-findings);
}
.tabpanel:not([hidden]) {
  animation: panel-in 0.25s var(--arrive);
}
@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}
/* DEC-076: the lamp comes on as a case opens, and the readout flashes when new settings reach the lamp. */
.scope.lamp-on canvas#view {
  animation: lamp-on 0.8s var(--arrive);
}
@keyframes lamp-on {
  from {
    opacity: 0;
    filter: brightness(0.2) blur(6px);
  }
  45% {
    opacity: 1;
  }
}
.hud.ack {
  animation: hud-ack 0.6s var(--arrive);
}
@keyframes hud-ack {
  from {
    box-shadow: 0 0 0 0 rgba(242, 169, 0, 0.6);
    background-color: rgba(242, 169, 0, 0.35);
  }
  to {
    box-shadow: 0 0 0 10px rgba(242, 169, 0, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .case-list.arrive .case,
  .tabpanel:not([hidden]) {
    animation: fade-in 0.2s ease-out;
    animation-delay: 0s;
  }
  .scope.lamp-on canvas#view {
    animation: fade-in 0.25s ease-out;
  }
  .case,
  .case:hover,
  .case:focus-visible,
  .case:active {
    transform: none;
  }
  .tab-ink {
    transition: background-color 0.2s;
  }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
.tabs button[aria-selected='true'] .step {
  background: var(--tab);
  color: var(--bg);
}
.tabs button:disabled {
  color: var(--dim);
  box-shadow: none;
  opacity: 0.6;
  cursor: default;
}
.tabs button:disabled .step {
  border-color: var(--dim);
  color: var(--dim);
}
@media (prefers-reduced-motion: reduce) {
  .tabs button {
    transition: none;
  }
}
.tabpanel {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 14px 18px;
  min-height: 0;
}
.techniques {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.tech {
  display: grid;
  gap: 2px;
  justify-items: start;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 6px 9px;
  font-size: 14px;
  min-width: 0;
}
.tech .tag {
  font-size: 11px;
}
.tech[aria-pressed='true'] {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}
.tech:disabled {
  cursor: default;
  background: transparent;
  color: var(--dim);
}
.sliders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 14px;
}
.slider {
  display: grid;
  margin-top: 6px;
  font-size: 14px;
  min-width: 0;
}
.slider span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.slider output {
  color: var(--sim);
  white-space: nowrap;
}
input[type='range'] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--amber);
}
input[type='range']:disabled {
  opacity: 0.4;
}
.mags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mag {
  flex: 1 1 52px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.mag[aria-pressed='true'] {
  border-color: var(--amber);
  color: var(--amber);
}
.pad-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 12px;
}
.pad {
  flex: none;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: radial-gradient(circle, #1a222c, #0c1117);
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
}
.knob {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #4b5a6b, #222b35);
  border: 1px solid var(--line-2);
}
.pad-help p {
  margin: 0 0 8px;
  color: var(--dim);
  font-size: 14px;
}
.select {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  font-weight: 600;
}
.select.compact {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 10px 0 2px;
}
.select select {
  /* Safari on iPhone keeps its own small height unless the native look is turned off. */
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  padding: 0 36px 0 10px;
  background-color: var(--panel-2);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--dim) 50%), linear-gradient(135deg, var(--dim) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  font-weight: 400;
}
.check {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  font-size: 15px;
}
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--amber);
}
.how {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}
.how summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
}
.how p {
  font-size: 14px;
  color: var(--dim);
}

/* ---------- findings and answer ---------- */
.finding-groups {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.finding {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0;
  padding: 6px 8px;
  min-width: 0;
}
.finding legend {
  font-weight: 600;
  padding: 0 4px;
  font-size: 15px;
}
.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  font-size: 14px;
}
.opt input {
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--amber);
}
.r-diagnosis {
  font-size: 17px;
  font-weight: 600;
  margin-top: 0;
}
.marks {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.marks th,
.marks td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 6px 4px;
  vertical-align: top;
}
.marks th {
  color: var(--dim);
  font-weight: 600;
}
.marks tr.ok td:first-child {
  color: var(--ok);
}
.marks tr.miss td:first-child {
  color: var(--miss);
}
.recs {
  display: grid;
  gap: 10px;
}
.reco {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--panel-2);
}
/* Each finding in the guide is a button that sets the slit lamp for it (DEC-064). */
.reco-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  margin: 0 0 8px;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.reco-title::after {
  content: 'Show';
  flex: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--amber);
}
.reco-title[aria-pressed='true'] {
  border-color: var(--amber);
  background: rgb(242 169 0 / 0.12);
}
.reco-title[aria-pressed='true']::after {
  content: 'Showing';
}
.reco-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0;
  font-size: 14px;
}
.reco-grid dt {
  color: var(--dim);
}
.reco-grid dd {
  margin: 0;
}
.reco-notes {
  font-size: 14px;
  margin: 8px 0 4px;
}
.reco-status {
  font-size: 13px;
  color: var(--dim);
  margin: 4px 0 8px;
}
.reco-src a,
.refs a,
.ref-photo a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.pearls dt {
  font-weight: 700;
  color: var(--amber);
  margin-top: 8px;
}
.pearls dd {
  margin: 2px 0 0;
  font-size: 15px;
}
.ref-photos {
  display: grid;
  gap: 10px;
}
.ref-photo {
  margin: 0;
}
.ref-photo img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}
.ref-photo figcaption {
  font-size: 13px;
  color: var(--dim);
  margin-top: 4px;
}
.refs {
  padding-left: 18px;
  font-size: 14px;
  margin: 0;
}
.status {
  color: var(--dim);
  font-size: 13px;
}
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- phones held upright: the view on top, the panel below ---------- */
@media (max-width: 899px) and (orientation: portrait), (max-width: 599px) {
  .exam-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 46fr) minmax(0, 54fr);
  }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .scope-area {
    padding: 6px;
  }
  .exam-prompt,
  .exam-bar .chip.review {
    display: none;
  }
  .exam-bar h1 {
    flex: 1;
  }
}
/* Phones held sideways: side by side, a narrower panel. */
@media (orientation: landscape) and (max-height: 520px) {
  .exam-body {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 46%);
  }
  .exam-prompt,
  .exam-bar .chip {
    display: none;
  }
}

/* ---------- the calmer exam (DEC-061) ---------- */
.light-main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.light {
  min-height: 52px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.light[aria-pressed='true'] {
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: inset 0 0 0 1px var(--amber);
}
.tech-note {
  font-size: 12px;
  color: var(--dim);
  font-weight: 400;
}
.quiet {
  color: var(--dim);
  font-size: 14px;
  margin: 10px 0 0;
}
.more {
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.more > summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
}
.more[open] > summary {
  color: var(--amber);
}
.scope-area .credit {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 2px;
  margin: 0;
  font-size: 12px;
  text-align: center;
  color: var(--dim);
  pointer-events: auto;
}
.how a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
