:root {
  --room: #0b0f14; --room-edge: #070a0e;
  --light: #eef3f4; --light-dim: rgba(238, 243, 244, .62);
  --signal: #0072b2;
  --velvet: #14203a; --walnut: #5a3a24; --walnut-dark: #3e281a;
  --card: #ede9df; --ink: #0b0f14;
  --display: "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --mono: "Atkinson Hyperlegible Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html { background: var(--room); color: var(--light); font: 400 17px/1.5 var(--display); }
body { margin: 0; background: radial-gradient(120% 90% at 30% 40%, #111823 0%, var(--room) 55%, var(--room-edge) 100%); min-height: 100vh; }
a { color: var(--light); }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; }

.top { position: fixed; inset: 0 0 auto 0; display: flex; justify-content: space-between; padding: 22px 32px; z-index: 10; pointer-events: none; }
.top a, .top nav { pointer-events: auto; }
.mark { font: 600 15px/1 var(--display); letter-spacing: .14em; text-decoration: none; }
.top nav a { margin-left: 24px; font-size: 14px; text-decoration: none; color: var(--light-dim); }
.top nav a:hover { color: var(--light); }

/* 1. Exam room */
.room { position: relative; min-height: 100vh; background: var(--room); display: grid; grid-template-columns: 58fr 42fr; align-items: end; overflow: hidden; }
.stage { position: relative; margin: 0; height: 100vh; touch-action: none; }
.stage canvas { position: absolute; left: 0; bottom: 0; height: 100%; width: auto; max-width: none; }
#sim { clip-path: circle(var(--r, 0px) at var(--x, 50%) var(--y, 60%)); filter: drop-shadow(0 10px 24px rgba(0,0,0,.45)); }
.stage.full-you #sim { clip-path: none; }
.stage.full-them #sim { clip-path: circle(0 at 50% 50%); }
.stage.full-you .lens, .stage.full-them .lens, .stage.full-you .tab, .stage.full-them .tab { opacity: 0; }
/* Dark exam room around the portrait. The centre (face and chest) is left untouched:
   the shirt colour is the evidence, so the vignette only darkens the edges. */
.vignette { position: absolute; left: 0; bottom: 0; height: 100%; width: var(--imgw, 60vw); pointer-events: none;
  background:
    radial-gradient(70% 62% at 50% 60%, transparent 58%, rgba(11,15,20,.55) 80%, var(--room) 100%),
    linear-gradient(90deg, transparent 72%, var(--room) 100%),
    linear-gradient(180deg, rgba(11,15,20,.55) 0%, transparent 22%); }
/* nothing on the stage until the first render is drawn: no bare ring, no empty canvas */
.stage canvas, .stage .lens, .stage .tab { transition: opacity .5s ease-out; }
.stage:not(.ready) canvas, .stage:not(.ready) .lens, .stage:not(.ready) .tab, .stage:not(.ready) .vignette { opacity: 0; }
.lens { position: absolute; width: calc(var(--r) * 2.2); height: calc(var(--r) * 2.2); left: var(--lx); top: var(--ly); transform: translate(-50%, -50%); pointer-events: none; transition: opacity .25s; }
.tab { position: absolute; left: var(--lx); top: var(--ly); transform: translate(calc(var(--r) * .62), calc(var(--r) * .62)) rotate(45deg); transform-origin: 0 0;
  width: calc(var(--r) * .75); height: calc(var(--r) * .26); border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #e3e7eb, #8e959c 70%, #6b7178); box-shadow: 0 4px 10px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; pointer-events: none; transition: opacity .25s; }
.tab span { font: 600 calc(var(--r) * .085)/1 var(--mono); letter-spacing: .08em; color: #2b3036; }
.lens-handle { position: absolute; left: var(--lx); top: var(--ly); width: calc(var(--r) * 2); height: calc(var(--r) * 2); transform: translate(-50%, -50%);
  border-radius: 50%; background: transparent; border: 0; cursor: grab; }
.lens-handle:active { cursor: grabbing; }
.stage figcaption { position: absolute; left: 32px; bottom: 18px; font: 400 13px/1.3 var(--mono); color: var(--light-dim); }

.chart { opacity: 0; transition: opacity .5s ease-out; }
.chart.ready { opacity: 1; }
.chart { align-self: center; padding: 0 6vw 0 2vw; text-align: center; text-transform: uppercase; }
.chart p { margin: 0; font-family: var(--display); font-weight: 800; letter-spacing: .06em; line-height: 1.05;
  color: var(--light); text-shadow: 0 0 18px rgba(238,243,244,.35), 0 0 2px rgba(238,243,244,.6); }
.chart .l1 { font-size: clamp(36px, 6.2vw, 104px); }
.chart .l2 { font-size: clamp(30px, 5vw, 84px); letter-spacing: .14em; }
.chart .l3 { font-size: clamp(24px, 3.9vw, 66px); }
.chart .l4 { font-size: clamp(20px, 3.1vw, 52px); letter-spacing: .14em; }
.chart .l5 { font-size: clamp(16px, 2.3vw, 38px); text-transform: lowercase; letter-spacing: .04em; margin-top: .3em; }
.focus { filter: blur(6px); transition: filter .6s ease-out; }
.focus.sharp { filter: none; }
.verdict { margin-top: 1.4em !important; font: 600 15px/1.4 var(--mono) !important; text-shadow: none !important; letter-spacing: .04em !important; text-transform: none; color: var(--light-dim) !important; }
.verdict b { color: var(--light); }

.flip { position: absolute; right: 32px; bottom: 28px; display: flex; border: 1.5px solid rgba(238,243,244,.5); border-radius: 6px; overflow: hidden; }
.flip button { background: transparent; color: var(--light); border: 0; padding: 10px 16px; font: 600 13px/1 var(--display); letter-spacing: .08em; cursor: pointer; }
.flip button + button { border-left: 1.5px solid rgba(238,243,244,.25); }
.flip button.on { background: var(--signal); color: #fff; }

/* 2. Case */
.case-wrap { padding: 12vh 6vw 10vh; text-align: center; }
.case-wrap h2, .you h2, .method h2 { font: 800 clamp(40px, 7vw, 110px)/1 var(--display); letter-spacing: .02em; margin: 0; }
.sub { color: var(--light-dim); margin: 14px 0 40px; font-size: 19px; }
.case { position: relative; margin: 0 auto; width: min(100%, 1180px, calc((100vh - 330px) * 1.487)); aspect-ratio: 1.487; background: url(case.jpg) center/cover;
  border-radius: 14px; box-shadow: 0 50px 90px rgba(0,0,0,.65); }
.slot { position: absolute; width: 14.2%; aspect-ratio: 1; transform: translate(-50%, -50%); background: none; border: 0; padding: 0; cursor: pointer; color: inherit; }
.slot .glass { position: absolute; inset: 6%; border-radius: 50%; background-size: 260%; background-position: 50% 42%;
  box-shadow: 0 0 0 .55vw #c3c9cf, 0 0 0 .62vw #6d747b, inset 0 0 1.4vw rgba(0,0,0,.45), 0 1.2vw 1.6vw rgba(0,0,0,.55);
  transition: transform .35s cubic-bezier(.2,.9,.3,1.3), box-shadow .3s; }
.slot .glass::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(55% 55% at 70% 24%, rgba(255,255,255,.5), transparent 60%), radial-gradient(90% 90% at 50% 50%, transparent 60%, rgba(0,0,0,.25)); }
.slot .glass::before { content: ""; position: absolute; right: -17%; bottom: 6%; width: 26%; height: 10%; border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #e6eaee, #8e959c 70%, #6b7178); transform: rotate(40deg); box-shadow: 0 .3vw .5vw rgba(0,0,0,.4); }
.slot:hover .glass, .slot:focus-visible .glass, .slot[aria-current="true"] .glass { transform: translateY(-6%) scale(1.06); }
.slot[aria-current="true"] .glass { box-shadow: 0 0 0 .55vw #c3c9cf, 0 0 0 .62vw #6d747b, 0 0 0 1vw var(--signal), 0 1.6vw 2.2vw rgba(0,0,0,.7); }
.slot .tag { position: absolute; top: -4%; right: -10%; font-size: clamp(8px, .8vw, 12px); padding: .35em .6em; }
.slot .num { position: absolute; left: -2%; top: -2%; font: 600 clamp(8px, .75vw, 11px)/1 var(--mono); color: var(--light-dim); }
.tag { font: 800 12px/1 var(--display); letter-spacing: .08em; padding: 6px 8px; border-radius: 3px; background: var(--light); color: var(--ink); }
.tag.trap { background: repeating-linear-gradient(135deg, #eef3f4 0 5px, #c9ced3 5px 8px); }
.tag.careful { background: #f0e442; }
.ticket-big { margin: 28px auto 0; max-width: 620px; background: var(--card); color: var(--ink); padding: 16px 22px; border-radius: 3px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 4px 14px; align-items: center; text-align: left; font-family: var(--mono);
  clip-path: polygon(0 6px, 6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px)); }
.ticket-big .no { font: 800 20px/1 var(--display); }
.ticket-big .plain { font: 800 20px/1.1 var(--display); letter-spacing: .04em; }
.ticket-big .row { grid-column: 1 / 3; font-size: 14px; }
.ticket-big .tag.big { grid-row: 1 / 3; grid-column: 3; font-size: 14px; padding: 10px 12px; }
.legend { margin-top: 28px; color: var(--light-dim); font-size: 14px; }
.legend .t { font: 800 12px/1 var(--display); padding: 4px 7px; border-radius: 3px; color: var(--ink); background: var(--light); }
.legend .t.trap { background: repeating-linear-gradient(135deg, #eef3f4 0 5px, #c9ced3 5px 8px); }
.legend .t.careful { background: #f0e442; }

/* 3. You */
.you, .method { padding: 10vh 6vw; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 40px; }
.card { background: #121924; border: 1px solid #222c3a; border-radius: 12px; padding: 28px; }
.card h3 { margin: 0 0 14px; font: 800 22px/1.2 var(--display); }
.card label { display: block; margin: 10px 0; }
.card input[type=radio] { accent-color: var(--signal); width: 18px; height: 18px; vertical-align: -3px; margin-right: 8px; }
.card .sev input { accent-color: var(--signal); width: 50%; vertical-align: middle; }
.note, .fine { color: var(--light-dim); font-size: 14px; }
.btn { display: inline-block; background: var(--signal); color: #fff; padding: 12px 18px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.status { font-family: var(--mono); font-size: 14px; min-height: 1.4em; }

/* Patient card (your photo, your eyes) */
.rx .card { background: var(--card); color: var(--ink); border: 0; border-radius: 3px; position: relative;
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(11,15,20,.08) 31px 32px);
  box-shadow: 0 30px 60px rgba(0,0,0,.55); transform: rotate(-.6deg); }
.rx .card + .card { transform: rotate(.5deg); }
.rx-head { margin: -6px 0 16px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); font: 800 14px/1 var(--display); letter-spacing: .14em; display: flex; justify-content: space-between; gap: 10px; }
.rx-head span { font: 600 11px/1.4 var(--mono); letter-spacing: .06em; opacity: .7; text-align: right; }
.rx .card h3 { color: var(--ink); }
.rx .card label { font-size: 16px; }
.rx .note { color: rgba(11,15,20,.62); }
.rx .status { color: var(--ink); }
.rx .card input[type=radio] { appearance: none; width: 20px; height: 20px; border: 2px solid var(--ink); border-radius: 50%; display: inline-grid; place-content: center; vertical-align: -4px; }
.rx .card input[type=radio]:checked::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.rx .card input[type=radio]:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }

/* 4. Method */
.method .cols > div { border-top: 1.5px solid rgba(238,243,244,.35); padding-top: 18px; }
.step { display: block; font: 800 64px/1 var(--display); color: var(--light); text-shadow: 0 0 18px rgba(238,243,244,.3); margin-bottom: 10px; }
.matrix { margin: 14px 0 0; padding: 12px 14px; background: #121924; border: 1px solid #222c3a; border-radius: 6px; font: 400 13px/1.5 var(--mono); color: var(--light); }
.method .cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin-top: 36px; }
.method h3 { font: 800 20px/1.2 var(--display); margin: 0 0 8px; }
.method code { font-family: var(--mono); }

@media (max-width: 860px) {
  .top { position: absolute; padding: 16px; }
  .top nav { display: none; }
  .room { grid-template-columns: 1fr; }
  .stage { height: 72vh; }
  .stage figcaption { left: 16px; right: 16px; bottom: 10px; font-size: 11px; }
  .chart { padding: 20px 16px 90px; }
  .flip { left: 16px; right: 16px; bottom: 20px; justify-content: center; }
  .flip button { flex: 1; padding: 12px 6px; font-size: 12px; }
  .case-wrap { padding: 8vh 16px; }
  .case { border-radius: 8px; }
  .slot .tag { font-size: 7px; padding: .3em .45em; right: -14%; }
  .slot .num { display: none; }
  .ticket-big { grid-template-columns: 1fr auto; padding: 12px 14px; }
  .ticket-big .no { display: none; }
  .ticket-big .plain { font-size: 16px; } .ticket-big .row { grid-column: 1; font-size: 12px; }
  .ticket-big .tag.big { grid-column: 2; font-size: 11px; }
  .you, .method { padding: 8vh 16px; }
  .cards, .method .cols { grid-template-columns: 1fr; }
  .card { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { .focus { filter: none; } * { transition: none !important; } }
.onyou { margin-top: .5em; font: 400 14px/1.45 var(--mono); color: var(--light-dim); letter-spacing: .02em; }
.onyou b { color: var(--light); font-weight: 600; }
.onyou .src { opacity: .75; }
.chart .onyou { line-height: 1.35; }
.onyou .hairpick { display: block; margin-top: .35em; }
.onyou select { font: inherit; color: var(--light); background: transparent; border: 1px solid currentColor; border-radius: 4px; padding: .1em .3em; margin-left: .3em; }
.onyou select option { color: #111; }
