/* AI Patient Simulator
   Same world as the showcase film: a clinic at night. The patient is always coral,
   the doctor always teal, and a report card is the one thing printed on paper. */
:root {
  color-scheme: dark;
  --ground: #0b1a1e;
  --raised: #11272d;
  --raised-2: #1a363d;
  --coat: #f3eee4;       /* type on the dark ground, and the paper of the report card */
  --muted: #9fb4b6;
  --line: rgba(243, 238, 228, .17);
  --teal: #3fcab8;
  --coral: #ff7657;
  --amber: #ffc65c;
  --ink: #14262b;        /* type on paper */
  --paper-line: #d9d1c1;
  --teal-ink: #0b6e63;
  --coral-ink: #bd3618;
  --amber-ink: #835800;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background:
    radial-gradient(900px 700px at -10% -20%, rgba(63, 202, 184, .16), transparent 70%),
    radial-gradient(1000px 800px at 110% 120%, rgba(255, 118, 87, .13), transparent 70%),
    var(--ground);
  background-attachment: fixed;
  color: var(--coat);
  font: 400 17px/1.5 var(--body);
}
h1, h2, h3 { font-family: var(--display); letter-spacing: -.02em; line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-weight: 800; font-size: clamp(2rem, 4.4vw, 3.3rem); }
h2 { font-weight: 800; font-size: 1.45rem; }
h3 { font-weight: 600; font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- shell ---------- */
.bar { display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; padding: 18px var(--gutter); }
.brand { font: 800 1.15rem var(--display); letter-spacing: -.01em; color: var(--coat); text-decoration: none; }
.brand::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: var(--coral); margin-right: 10px; }
.nav { display: flex; gap: 6px; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 7px 14px; border-radius: 99px; font-weight: 500; }
.nav a:hover { color: var(--coat); }
.nav a.on { color: var(--ground); background: var(--coat); }
.who { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.who-name { font-weight: 600; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }
.link:hover { color: var(--coat); }
.notice { margin: 0 var(--gutter) 8px; padding: 12px 16px; border-radius: 12px; background: rgba(255, 198, 92, .13); color: var(--amber); border: 1px solid rgba(255, 198, 92, .5); }
.notice.bad { background: rgba(255, 118, 87, .13); color: var(--coral); border-color: rgba(255, 118, 87, .55); }
.view { max-width: 1160px; margin: 0 auto; padding: clamp(16px, 3vw, 36px) var(--gutter) 72px; }
.view.narrow { max-width: 760px; }

/* ---------- shared parts ---------- */
.lead { font-size: 1.15rem; color: var(--coat); max-width: 62ch; margin-top: 14px; }
.hint { color: var(--muted); font-size: .92rem; margin-top: 10px; max-width: 70ch; }
.page-head { margin-bottom: 34px; }
.section-title { margin: 46px 0 18px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 22px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; color: var(--coat); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--coat); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #06231f; }
.btn.primary:hover { background: #5fd8c8; border-color: #5fd8c8; }
.btn.danger { background: var(--coral); border-color: var(--coral); color: #2a0d05; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: rgba(255, 198, 92, .16); color: var(--amber); }
.tag.small { font-size: .72rem; padding: 1px 8px; margin-left: 8px; vertical-align: middle; }
.tag.bad { background: rgba(255, 118, 87, .18); color: var(--coral); }
.field-error { color: var(--coral); font-weight: 500; margin-top: 8px; }
.error-box { border: 1.5px solid var(--coral); border-radius: 14px; padding: 18px 20px; color: var(--coral); max-width: 640px; }
.error-box p { margin-top: 6px; color: var(--coat); }
.empty { border: 1.5px dashed var(--line); border-radius: 16px; padding: 34px 28px; max-width: 640px; }
.empty .btn { margin-top: 18px; }
label { display: block; font-weight: 500; color: var(--muted); font-size: .95rem; }
input[type="text"], select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; min-height: 48px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--raised); color: var(--coat);
}
textarea { min-height: 190px; line-height: 1.5; resize: vertical; }
input::placeholder, textarea::placeholder { color: #6f8588; }
.check { display: flex; align-items: center; gap: 10px; color: var(--coat); font-weight: 400; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 14px; }
.back { display: inline-block; margin-bottom: 18px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--muted); font-size: .85rem; }
td.num { white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
.good { color: var(--teal); } .mid { color: var(--amber); } .low { color: var(--coral); }

/* rings and meters */
.ring { position: relative; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.ring circle { fill: none; }
.ring .track { stroke: var(--raised-2); }
.ring .arc { stroke: currentColor; stroke-linecap: round; }
.ring-mid { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--coat); font-family: var(--display); font-weight: 800; font-variant-numeric: tabular-nums; }
.ring-mid b { font-size: 1.7rem; letter-spacing: -.03em; }
.ring-mid span { font-size: .9rem; margin-left: 1px; opacity: .8; }
.meter-top { display: flex; justify-content: space-between; gap: 12px; font-size: .95rem; }
.meter-top b { font-variant-numeric: tabular-nums; }
.meter-track { height: 10px; border-radius: 10px; background: var(--raised-2); overflow: hidden; margin-top: 6px; }
.meter-track i { display: block; height: 100%; border-radius: 10px; background: currentColor; }

/* ---------- 1. sign in ---------- */
.view.signin { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 48px; align-items: center; padding-top: clamp(24px, 6vw, 72px); }
.signin-copy h1 { font-size: clamp(2.3rem, 5.4vw, 4.2rem); }
.signin-form { margin-top: 32px; max-width: 440px; }
.signin-art { display: flex; flex-direction: column; align-items: center; gap: 0; }
.art-doc { width: min(46%, 210px); margin-bottom: 26px; }
.art-bench { display: flex; align-items: flex-end; justify-content: center; width: 100%; border-bottom: 8px solid var(--line); border-radius: 0 0 4px 4px; }
.art-bust { flex: 1; max-width: 170px; min-width: 0; }
.art-doc svg, .art-bust svg { display: block; width: 100%; height: auto; }

/* ---------- 2. the waiting room ---------- */
.room { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.seat { display: flex; flex-direction: column; color: var(--coat); text-decoration: none; border-radius: 18px; }
.bust { display: block; padding: 0 22%; border-bottom: 8px solid var(--line); transition: border-color .15s; }
.bust svg { display: block; width: 100%; height: auto; transition: transform .2s; transform-origin: 50% 100%; }
.seat:hover .bust, .seat:focus-visible .bust { border-color: var(--coral); }
.seat:hover .bust svg { transform: scale(1.05); }
.plate { display: flex; flex-direction: column; gap: 3px; padding: 18px 16px 30px 6px; }
.plate strong { font: 800 1.5rem/1.08 var(--display); letter-spacing: -.02em; }
.plate-who { font-weight: 600; margin-top: 4px; }
.plate-meta, .plate-state { color: var(--muted); font-size: .92rem; }
.plate-state.good { color: var(--teal); } .plate-state.mid { color: var(--amber); } .plate-state.low { color: var(--coral); }
.plate .tag { align-self: flex-start; margin-top: 8px; }

/* ---------- 3. the brief ---------- */
.view.brief { display: grid; grid-template-columns: minmax(180px, 320px) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: start; }
.brief-face { border-bottom: 8px solid var(--line); padding: 0 8%; overflow: hidden; }
.brief-who { color: var(--muted); margin-top: 10px; }
.draft { color: var(--amber); font-size: .95rem; margin-top: 12px; }
.settings { border: 1.5px solid var(--line); border-radius: 16px; padding: 18px 20px 20px; margin: 28px 0 0; min-width: 0; }
.settings legend { font: 600 1.05rem var(--display); padding: 0 8px; }

/* ---------- 4. the interview ---------- */
.view.interview { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); align-items: start; }
.stage { position: sticky; top: 16px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.stage-face { position: relative; width: 100%; max-width: 270px; padding: 9% 14% 0; border-radius: 50% 50% 0 0 / 34% 34% 0 0; background: var(--raised); border-bottom: 8px solid var(--line); overflow: hidden; transition: border-color .2s; }
.stage-face:has(.is-speaking) { border-bottom-color: var(--coral); }
.stage-face:has(.is-listening) { border-bottom-color: var(--teal); }
.stage-name { font: 800 1.4rem var(--display); margin-top: 12px; }
.stage-status { color: var(--muted); min-height: 1.5em; }
/* in a live interview the instruments stand beside the patient, like a trolley */
.stage.exam { display: grid; grid-template-columns: minmax(0, 1fr) 148px; column-gap: 12px; row-gap: 4px; align-items: end; }
.stage.exam .stage-face { grid-column: 1; grid-row: 1; max-width: none; }
.stage.exam .tray { grid-column: 2; grid-row: 1; margin: 0; }
.stage.exam .stage-name, .stage.exam .stage-status, .stage.exam .display { grid-column: 1 / -1; }
.talk { min-width: 0; }
.talk-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.timer { font: 800 2.6rem/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--coral); }
.log { display: flex; flex-direction: column; gap: 10px; min-height: 34vh; max-height: 50vh; overflow-y: auto; padding: 2px 4px 14px 2px; }
.log.tall { max-height: 62vh; margin: 0 0 12px; }
.log:empty::before { content: "The conversation will appear here."; color: var(--muted); }
.log-note { align-self: center; color: var(--muted); font-size: .92rem; padding: 4px 0; }
.bubble { max-width: 84%; padding: 12px 18px 14px; border-radius: 22px; overflow-wrap: anywhere; font-size: 1.08rem; line-height: 1.35; }
.bubble-who { display: block; font-size: .78rem; font-weight: 600; opacity: .75; margin-bottom: 2px; }
.bubble.trainee { align-self: flex-end; background: var(--teal); color: #06231f; border-bottom-right-radius: 6px; }
.bubble.patient { align-self: flex-start; background: var(--coral); color: #2a0d05; border-bottom-left-radius: 6px; }
.bubble.finding { align-self: stretch; max-width: 100%; background: transparent; border: 1.5px dashed var(--line); color: var(--coat); font-size: .98rem; border-radius: 14px; }
.hearing { color: var(--muted); font-style: italic; min-height: 1.5em; padding: 0 4px 8px; }
.left-note { border: 1.5px solid var(--coral); border-radius: 16px; padding: 16px 18px 18px; margin-bottom: 12px; }
.left-note .btn { margin-top: 12px; }
.composer { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.mic { min-height: 64px; border-radius: 16px; border: 0; background: var(--teal); color: #06231f; font: 800 1.2rem var(--display); cursor: pointer; }
.mic.listening { background: var(--coral); color: #2a0d05; }
.mic.busy { background: var(--raised-2); color: var(--coat); }
.mic:disabled { opacity: .5; cursor: not-allowed; }
.typed { display: flex; gap: 10px; }
.typed input { margin-top: 0; }
.delay { color: var(--muted); font-size: .9rem; margin-top: 10px; min-height: 1.4em; font-variant-numeric: tabular-nums; }
.findings { margin-top: 18px; border: 1.5px solid var(--line); border-radius: 16px; padding: 0 18px; }
.findings summary { cursor: pointer; font-weight: 600; padding: 15px 0; }
.findings[open] { padding-bottom: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: var(--raised); cursor: pointer; }
.chip:hover { border-color: var(--teal); }

/* the instrument tray and its display */
.display { width: 100%; height: 124px; overflow: hidden; margin-top: 10px; padding: 12px 16px 14px; border-radius: 14px; background: #06141a; border: 1.5px solid var(--line); text-align: left; }
.display-idle { color: var(--muted); font-size: .92rem; }
.display-label { color: var(--muted); font-size: .82rem; font-weight: 600; }
.display-wait { color: var(--teal); margin-top: 6px; animation: wait-pulse 1s ease-in-out infinite; }
.display-value { font: 800 2.3rem/1 var(--display); letter-spacing: -.02em; color: var(--teal); font-variant-numeric: tabular-nums; margin-top: 4px; }
.display-value span { font: 500 .95rem var(--body); letter-spacing: 0; color: var(--muted); }
.display-detail { font-size: .95rem; margin-top: 4px; }
.display-text { font-size: .95rem; line-height: 1.35; margin-top: 5px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.display-trace svg { display: block; height: 46px; width: auto; max-width: 100%; margin-top: 4px; }
.display-trace path { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 2.2s linear forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes wait-pulse { 50% { opacity: .35; } }
.tray { width: 100%; margin-top: 12px; }
.tray-title { text-align: left; font-size: .9rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.tray-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.tool-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; padding: 6px 1px 5px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--raised); color: var(--coat); font-size: .66rem; line-height: 1.1; cursor: pointer; transition: translate .12s, border-color .12s; }
.tool-btn svg { width: 24px; height: 24px; flex: none; }
.tool-btn:hover:not(:disabled) { border-color: var(--teal); translate: 0 -2px; }
.tool-btn.on { border-color: var(--teal); background: var(--raised-2); }
.tool-btn.used::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.tool-btn:disabled { cursor: default; }
.tool-btn:disabled:not(.on) { opacity: .5; }

/* ---------- the living patient ---------- */
.figure { position: relative; --gx: 0px; --gy: 0px; --beat: .75s; }
.figure svg { display: block; width: 100%; height: auto; overflow: visible; transition: translate 1.2s ease-in, opacity .9s ease-in .25s; }
.figure.gone svg { translate: 120% 0; opacity: 0; }

/* breathing, and the small movements of someone sitting in a chair */
.figure .f-body { transform-origin: 100px 322px; animation: breathe 3.8s ease-in-out infinite; }
.figure .f-head { transform-origin: 100px 150px; transition: rotate .45s ease; animation: head-breathe 3.8s ease-in-out infinite; }
@keyframes breathe { 50% { scale: 1 1.014; } }
@keyframes head-breathe { 50% { translate: 0 -2.2px; } }
@keyframes head-talk { 0%, 100% { translate: 0 0; } 30% { translate: 0 -1.8px; } 62% { translate: .9px .5px; } }
@keyframes head-nod { 0%, 70%, 100% { translate: 0 0; } 78% { translate: 0 2.4px; } 86% { translate: 0 -.6px; } 93% { translate: 0 1.8px; } }
.figure.is-listening .f-head { rotate: 2.5deg; animation: head-nod 4.4s ease-in-out infinite; }
.figure.is-thinking .f-head { rotate: -3.5deg; }
.figure.is-speaking .f-head { animation: head-talk 1.7s ease-in-out infinite; }

/* eyes: they follow the pointer, blink, and look away to think */
.figure .f-eyes { translate: var(--gx) var(--gy); transition: translate .25s ease-out; }
.figure .f-eyes circle { transform-box: fill-box; transform-origin: center; animation: blink 5.2s infinite; }
@keyframes blink { 0%, 92.5%, 100% { scale: 1 1; } 95.5% { scale: 1 .1; } }
.figure.is-thinking .f-eyes { translate: -3px -3.5px; }
.figure.mood-upset .f-eyes, .figure.mood-leaving .f-eyes { translate: 2px 3px; }
.figure.mood-annoyed .f-eyes circle { animation: none; scale: 1 .62; }
.figure.mood-pain .f-eyes circle { animation: none; scale: 1 .34; }

/* eyebrows carry most of the feeling */
.figure .f-brow { transition: rotate .3s ease, translate .3s ease; }
.figure.base-unwell .f-brow.l, .figure.base-worried .f-brow.l { rotate: -13deg; }
.figure.base-unwell .f-brow.r, .figure.base-worried .f-brow.r { rotate: 13deg; }
.figure.mood-calm .f-brow.l { rotate: -5deg; translate: 0 0; }
.figure.mood-calm .f-brow.r { rotate: 5deg; translate: 0 0; }
.figure.mood-worried .f-brow.l { rotate: -17deg; }
.figure.mood-worried .f-brow.r { rotate: 17deg; }
.figure.mood-pain .f-brow.l { rotate: -24deg; translate: 2px 3px; }
.figure.mood-pain .f-brow.r { rotate: 24deg; translate: -2px 3px; }
.figure.mood-annoyed .f-brow.l, .figure.mood-leaving .f-brow.l { rotate: 15deg; translate: 1px 3px; }
.figure.mood-annoyed .f-brow.r, .figure.mood-leaving .f-brow.r { rotate: -15deg; translate: -1px 3px; }
.figure.mood-upset .f-brow.l { rotate: -22deg; translate: 0 1px; }
.figure.mood-upset .f-brow.r { rotate: 22deg; translate: 0 1px; }
.figure.mood-relieved .f-brow.l, .figure.mood-relieved .f-brow.r { rotate: 0deg; translate: 0 -2.5px; }
.figure.mood-confused .f-brow.l { rotate: -6deg; translate: 0 -6px; }
.figure.mood-confused .f-brow.r { rotate: -13deg; translate: 0 1.5px; }
.figure.mood-confused .f-head { rotate: 5deg; }
.figure.mood-upset .f-head { rotate: -3deg; }

/* one mouth at a time: how they arrived, then their mood, then speech and reactions on top */
.figure .f-m { opacity: 0; }
.figure.base-neutral .m-smile, .figure.base-unwell .m-frown, .figure.base-worried .m-frown { opacity: 1; }
.figure[class*="mood-"] .f-m { opacity: 0; }
.figure.mood-calm .m-flat, .figure.mood-worried .m-frown, .figure.mood-pain .m-pain, .figure.mood-annoyed .m-flat, .figure.mood-upset .m-frown, .figure.mood-relieved .m-smile, .figure.mood-confused .m-skew, .figure.mood-leaving .m-frown { opacity: 1; }
.figure.mouth-open .f-m { opacity: 0; }
.figure.mouth-open .m-open { opacity: 1; }
.figure.aah .f-m { opacity: 0; }
.figure.aah .m-aah { opacity: 1; }
.figure.wince .f-m { opacity: 0; }
.figure.wince .m-pain { opacity: 1; }

/* flinching when a sore place is pressed */
.figure.wince .f-eyes circle { animation: none; scale: 1 .14; }
.figure.wince .f-brow.l { rotate: -26deg; translate: 2px 4px; }
.figure.wince .f-brow.r { rotate: 26deg; translate: -2px 4px; }
.figure.wince .f-head { animation: flinch .55s ease-out both; }
@keyframes flinch { 0% { translate: 0 0; rotate: 0deg; } 22% { translate: 0 -6px; rotate: -6deg; } 100% { translate: 0 -1px; rotate: -3deg; } }
.figure-ouch { position: absolute; right: 0; top: 7%; padding: 3px 12px 4px; border-radius: 99px 99px 99px 6px; background: var(--coat); color: var(--coral-ink); font: 800 1.05rem var(--display); opacity: 0; scale: .5; transform-origin: 0 100%; pointer-events: none; }
.figure.wince .figure-ouch { opacity: 1; scale: 1; transition: opacity .12s, scale .2s cubic-bezier(.3, 1.7, .6, 1); }
.figure .f-sweat { animation: sweat 3.6s ease-in infinite; }
@keyframes sweat { 0% { translate: 0 -5px; opacity: 0; } 18% { opacity: 1; } 75% { translate: 0 9px; opacity: 1; } 100% { translate: 0 14px; opacity: 0; } }

/* instruments: each is drawn where it is used and appears when picked up */
.figure .tool { opacity: 0; pointer-events: none; transition: opacity .25s; }
.figure.use-thermometer .t-thermometer, .figure.use-bp .t-bp, .figure.use-oximeter .t-oximeter, .figure.use-stethoscope .t-stethoscope, .figure.use-torch .t-torch, .figure.use-hands .t-hands, .figure.use-skin .t-skin, .figure.use-hammer .t-hammer, .figure.use-glucometer .t-glucometer, .figure.use-ecg .t-ecg { opacity: 1; }
@keyframes tool-in { from { translate: 34px 0; } }
@keyframes tool-up { from { translate: 26px 40px; } }
.figure.use-thermometer .t-thermometer, .figure.use-torch .t-torch, .figure.use-glucometer .t-glucometer, .figure.use-hammer .t-hammer { animation: tool-in .4s ease-out; }
.figure.use-stethoscope .t-stethoscope { animation: tool-up .45s ease-out; }
.figure .t-thermometer .beam { animation: beam .5s linear infinite; }
@keyframes beam { to { stroke-dashoffset: 16; } }
.figure .t-bp rect { transform-box: fill-box; transform-origin: center; }
.figure.use-bp .t-bp rect { animation: cuff 2.8s ease-in-out; }
@keyframes cuff { 30%, 45% { scale: 1.09 1.14; } }
.figure .t-bp .needle { transform-origin: 24px 304px; rotate: -110deg; }
.figure.use-bp .t-bp .needle { animation: needle 2.8s ease-in-out forwards; }
@keyframes needle { 0% { rotate: -110deg; } 32% { rotate: 100deg; } 100% { rotate: -35deg; } }
.figure.use-oximeter .t-oximeter .led, .figure.use-ecg .t-ecg circle { animation: led var(--beat) ease-out infinite; }
@keyframes led { 0%, 100% { opacity: .3; } 14% { opacity: 1; } }
.figure .t-stethoscope .ripple { transform-box: fill-box; transform-origin: center; opacity: 0; }
.figure.use-stethoscope .t-stethoscope .ripple { animation: ripple var(--beat) ease-out infinite; }
.figure.use-stethoscope .t-stethoscope .ripple.r2 { animation-delay: calc(var(--beat) * .26); }
@keyframes ripple { 0% { scale: 1; opacity: .9; } 70%, 100% { scale: 2.2; opacity: 0; } }
.figure .t-torch .cone { opacity: .5; }
.figure.use-torch .t-torch .cone { animation: glow 1.1s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .75; } }
.figure.use-hands .t-hands { animation: press .95s ease-in-out 2; }
@keyframes press { 50% { translate: 0 7px; } }
.figure.use-skin .t-skin { animation: scan 1.9s ease-in-out infinite; }
@keyframes scan { 30% { translate: 9px -12px; } 65% { translate: -3px 7px; } }
.figure .t-hammer { transform-origin: 186px 236px; }
.figure.use-hammer .t-hammer { animation: tool-in .4s ease-out, tap .42s ease-in .55s 2; }
@keyframes tap { 0%, 100% { rotate: 0deg; } 45% { rotate: -20deg; } }
.figure .t-glucometer .drop { transform-box: fill-box; transform-origin: 50% 0; }
.figure.use-glucometer .t-glucometer .drop { animation: drop 1.3s ease-in infinite; }
@keyframes drop { 0% { scale: 0; } 60%, 100% { scale: 1; } }

/* ---------- 6. the report card, on paper ---------- */
.view.report { max-width: 980px; }
.sheet { background: var(--coat); color: var(--ink); border-radius: 10px; padding: clamp(22px, 4.5vw, 52px); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.sheet a { color: var(--teal-ink); }
.sheet .good { color: var(--teal-ink); } .sheet .mid { color: var(--amber-ink); } .sheet .low { color: var(--coral-ink); }
.sheet-head { display: flex; gap: 22px; align-items: flex-end; border-bottom: 3px solid var(--ink); padding-bottom: 18px; }
.sheet-bust { width: 92px; flex: none; margin-bottom: -18px; }
.sheet-bust svg { display: block; width: 100%; height: auto; }
.sheet-kind { font-weight: 600; color: #54676b; }
.sheet-facts { color: #54676b; margin-top: 6px; }
.sheet-tags { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.sheet .tag { background: #ecdcb6; color: var(--amber-ink); }
.scorebox { display: flex; gap: clamp(20px, 4vw, 44px); align-items: center; flex-wrap: wrap; margin: 30px 0 8px; }
.scorebox .ring .track { stroke: var(--paper-line); }
.scorebox .ring-mid { color: var(--ink); }
.scorebox .ring-mid b { font-size: 3.6rem; }
.scorebox .ring-mid span { font-size: 1.3rem; }
.scorebox-side { flex: 1 1 280px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.scorebox-marks { font: 800 1.5rem var(--display); letter-spacing: -.02em; }
.scorebox-trend { color: #54676b; margin-top: -10px; }
.sheet .meter-top span { color: var(--ink); }
.sheet .meter-track { background: var(--paper-line); }
.critical { border-left: 8px solid var(--coral-ink); background: #f7d9d0; border-radius: 4px 12px 12px 4px; padding: 16px 20px; margin-top: 16px; }
.critical h2 { font-size: 1.2rem; color: var(--coral-ink); }
.critical p { margin-top: 6px; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; margin-top: 34px; }
.bullets h2 { font-size: 1.2rem; }
.bullets ul { margin: 10px 0 0; padding-left: 1.15rem; }
.bullets li { margin-bottom: 8px; }
.sheet-sub { margin: 40px 0 10px; font-size: 1.2rem; }
.part { border-top: 1.5px solid var(--paper-line); }
.part summary { cursor: pointer; font-weight: 600; padding: 14px 0; }
.sheet th, .sheet td { border-bottom-color: var(--paper-line); }
.sheet th { color: #54676b; }
.sheet .tag.small { margin-left: 8px; }
.quote { display: block; margin-top: 4px; color: #45585c; }
.quote.unverified { color: var(--amber-ink); }
.quote-time { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: 4px; }
.script { padding: 4px 0 14px; }
.script p { padding: 5px 0; }
.script p b { margin-right: 2px; }
.script p.patient b { color: var(--coral-ink); }
.script p.trainee b { color: var(--teal-ink); }
.script p.finding { color: #54676b; }
.closing-said { padding: 12px 0 16px; border-top: 1px dashed var(--paper-line); }
.sheet-note { color: #54676b; font-size: .92rem; margin-top: 14px; }
.actions { margin-top: 26px; }

/* ---------- 7. progress ---------- */
.progress-case { border-top: 1.5px solid var(--line); padding: 26px 0 30px; }
.progress-who { display: flex; gap: 16px; align-items: center; }
.progress-who p { color: var(--muted); margin-top: 4px; }
.mini-bust { width: 64px; flex: none; }
.mini-bust svg { display: block; width: 100%; height: auto; }
.bars { list-style: none; margin: 22px 0 18px; padding: 0; display: flex; gap: 14px; align-items: flex-end; height: 200px; border-bottom: 3px solid var(--line); }
.bars li { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; width: 74px; position: relative; }
.bars li > span { position: absolute; bottom: -30px; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.try-bar { display: flex; align-items: flex-start; justify-content: center; width: 100%; border-radius: 12px 12px 0 0; background: currentColor; text-decoration: none; }
.try-bar b { color: #06231f; font: 800 1.15rem var(--display); padding-top: 8px; }
.try-bar.low b { color: #2a0d05; }
.progress-case .btn { margin-top: 28px; }

/* ---------- 8. the educator's view ---------- */
.tools { margin: -14px 0 30px; }
.tiles { display: flex; gap: clamp(20px, 5vw, 64px); flex-wrap: wrap; }
.tile b { display: block; font: 800 clamp(2.6rem, 6vw, 4rem)/1 var(--display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tile span { color: var(--muted); }
.tile.good span, .tile.mid span, .tile.low span { color: var(--muted); }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 26px 14px; }
.person { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; color: var(--coat); text-decoration: none; padding: 10px 6px; border-radius: 16px; }
.person:hover { background: var(--raised); }
.person strong { margin-top: 8px; }
.person > span { color: var(--muted); font-size: .9rem; }
.person .tag.small { margin: 4px 0 0; }
.missed-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.missed { background: var(--raised); border-radius: 18px; padding: 22px; }
.critical-line { margin-top: 16px; color: var(--coral); }
.missed-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.missed-top { display: flex; justify-content: space-between; gap: 14px; font-size: .95rem; }
.missed-top b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.missed-list .meter-track { background: var(--ground); color: var(--coral); }

/* ---------- small screens ---------- */

/* ---------- assessments, examiner review, calibration ---------- */
.signin-form select { margin-bottom: 6px; }
.settings .check + .check { margin-top: 10px; }
.settings .check span b { color: var(--coat); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .95rem; }
.waiting-box, .examiner-box, .disputed { border-radius: 12px; padding: 16px 20px; margin-top: 16px; }
.waiting-box { background: #ecdcb6; }
.examiner-box { border-left: 8px solid var(--teal-ink); background: #d6efe9; border-radius: 4px 12px 12px 4px; }
.disputed { border-left: 8px solid var(--amber-ink); background: #f3e6c4; border-radius: 4px 12px 12px 4px; }
.waiting-box h2, .examiner-box h2, .disputed h2 { font-size: 1.15rem; margin-bottom: 6px; }
.sheet .hint { color: #4a5d61; }
.rating { margin: 4px 0 10px; }
.rating.r1, .rating.r2 { color: var(--coral-ink); }
.rating.r3 { color: var(--amber-ink); }
.rating.r4, .rating.r5 { color: var(--teal-ink); }
.review-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: start; margin-top: 20px; }
.review-script { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; background: var(--raised); border-radius: 14px; padding: 18px 20px; }
.review-script h2 { font-size: 1.15rem; margin-bottom: 10px; }
.review-form .settings { margin-bottom: 18px; }
.review-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.review-item > p { margin: 0 0 6px; }
.review-item .hint { margin: 0 0 8px; font-size: .9rem; }
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { position: relative; cursor: pointer; }
.pick input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pick span { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 600; }
.pick input:checked + span { background: var(--teal); border-color: var(--teal); color: #06231f; }
.pick input:focus-visible + span { outline: 2px solid var(--coat); outline-offset: 2px; }
.verdict { border-radius: 14px; padding: 18px 22px; margin: 18px 0 8px; border: 1.5px solid var(--line); }
.verdict.ok { border-color: var(--teal); }
.verdict.not-yet { border-color: var(--amber); }
.verdict h2 { font-size: 1.2rem; margin-bottom: 10px; }
.verdict ul { margin: 0; padding-left: 0; list-style: none; }
.verdict li { margin: 4px 0; }
.verdict li.ok { color: var(--teal); }
.verdict li.no { color: var(--amber); }
.calib { margin-top: 26px; }
@media (max-width: 860px) {
  .review-grid { grid-template-columns: 1fr; }
  .review-script { position: static; max-height: 50vh; }
}

@media (max-width: 860px) {
  .view.signin { grid-template-columns: 1fr; gap: 30px; }
  .signin-art { order: -1; max-width: 420px; margin: 0 auto; width: 100%; }
  .art-doc { display: none; }
  .view.brief { grid-template-columns: 1fr; }
  .brief-face { max-width: 200px; }
  .view.interview { grid-template-columns: 1fr; gap: 16px; }
  .stage, .stage.exam { position: static; display: grid; grid-template-columns: 124px minmax(0, 1fr); grid-template-rows: auto auto 1fr; text-align: left; align-items: start; column-gap: 14px; row-gap: 0; }
  .stage .stage-face, .stage.exam .stage-face { grid-column: 1; grid-row: 1 / span 3; max-width: none; }
  .stage .stage-name, .stage.exam .stage-name { grid-column: 2; margin: 4px 0 0; font-size: 1.15rem; }
  .stage .stage-status, .stage.exam .stage-status { grid-column: 2; font-size: .9rem; }
  .stage.exam .display { grid-column: 2; height: auto; min-height: 88px; margin-top: 8px; padding: 9px 12px 10px; }
  .display-value { font-size: 1.8rem; }
  .stage.exam .tray, .stage > .btn { grid-column: 1 / -1; grid-row: auto; }
  .stage.exam .tray { margin-top: 12px; }
  .tray-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stage > .btn { margin-top: 12px; }
  .timer { font-size: 2rem; }
  .log { min-height: 30vh; max-height: 44vh; }
  .room { grid-template-columns: 1fr; }
  .seat { flex-direction: row; align-items: flex-end; gap: 14px; border-bottom: 1.5px solid var(--line); padding: 14px 0; }
  .bust { width: 96px; flex: none; padding: 0; border-bottom-width: 5px; }
  .plate { padding: 0 0 4px; }
  .plate strong { font-size: 1.25rem; }
  .bars li { width: 56px; }
}
@media (max-height: 700px) and (min-width: 861px) {
  .stage { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
