/* CardioAT Echo Lab: dark instrument shell, CardioAT type and red accent */
:root {
  --bg: #0c0e11;
  --panel: #14171c;
  --panel-2: #1a1e24;
  --line: #262b33;
  --text: #e9e7e3;
  --muted: #8d939c;
  --red: #e2304a;
  --green: #35e08a;
  --display: "Schibsted Grotesk", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 14px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; }
.app { position: relative; z-index: 1; height: 100dvh; display: flex; flex-direction: column; pointer-events: none; }
.app > *, .pane > * { pointer-events: auto; }

/* header */
.top { height: 50px; flex: none; display: flex; align-items: center; gap: 18px; padding: 0 16px; background: rgba(12, 14, 17, 0.92); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--text); }
.brand svg { width: 24px; height: 14px; color: var(--red); }
.brand em { font-style: normal; color: var(--red); }
.title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.title strong { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.title .sub { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--red); border: 1px solid rgba(226, 48, 74, 0.45); padding: 1px 6px; border-radius: 999px; }
.icon-btn { margin-left: auto; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); cursor: pointer; display: grid; place-items: center; font-weight: 600; }
.icon-btn:hover { border-color: #3a414b; }
.icon-btn.on { background: var(--red); border-color: var(--red); color: #fff; }
.icon-btn svg { width: 17px; height: 17px; }

/* layout: 3D left, echo + controls right */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 40vw, 620px); grid-template-rows: auto minmax(0, 1fr); pointer-events: none; }
.pane { position: relative; min-height: 0; pointer-events: none; }
.pane-3d { grid-row: 1 / span 2; grid-column: 1; }
.pane-echo { grid-column: 2; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: transparent; }
.pane-controls { grid-column: 2; border-left: 1px solid var(--line); border-top: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 12px 16px 18px; }
.viewport { position: absolute; inset: 0; touch-action: none; }
.pane-3d .viewport { cursor: grab; }
.pane-3d .viewport.over-probe { cursor: pointer; }
.pane-3d .viewport.dragging { cursor: grabbing; }

.echo-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 12px 16px 6px; background: var(--bg); }
.view-name { font-family: var(--display); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }
.match { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.match.good { color: var(--green); }
.marker-read { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.marker-read .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.echo-vp { position: relative; inset: auto; width: 100%; aspect-ratio: 1.42; max-height: 56vh; background: transparent; cursor: crosshair; }
#echoOverlay { position: absolute; inset: 0; pointer-events: none; }
.tip { position: absolute; pointer-events: none; background: rgba(12, 14, 17, 0.92); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 12px; display: flex; gap: 8px; white-space: nowrap; }
.tip[hidden] { display: none; }
.tip span { font-family: var(--mono); color: var(--muted); font-size: 11px; }
.echo-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px 12px; background: var(--bg); }

/* controls */
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
.seg button.on { background: #2a3039; color: var(--text); }
.toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; user-select: none; }
.toggle input { accent-color: var(--red); width: 15px; height: 15px; }
.toggle.small { color: var(--muted); }
.group + .group { margin-top: 14px; }
.group h3 { font-family: var(--mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.link { background: none; border: 0; color: var(--muted); text-transform: none; letter-spacing: 0; font-family: var(--body); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link:hover { color: var(--text); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-group { width: 100%; font-size: 11px; color: var(--muted); margin-top: 4px; }
.chip-group:first-child { margin-top: 0; }
.chips button, .chip { border: 1px solid var(--line); background: var(--panel-2); padding: 5px 10px; border-radius: 999px; cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chips button:hover, .chip:hover { border-color: #3a414b; }
.chips button.on, .chip.on { background: var(--red); border-color: var(--red); color: #fff; }
.chip svg { width: 15px; height: 15px; }
.slider { display: grid; grid-template-columns: 76px 1fr 54px; align-items: center; gap: 10px; padding: 3px 0; }
.slider label { color: var(--muted); font-weight: 500; }
.slider output { font-family: var(--mono); font-size: 12px; text-align: right; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: #2a3039; }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: #2a3039; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--text); margin-top: -6px; border: 0; box-shadow: 0 0 0 3px rgba(226, 48, 74, 0.35); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--text); border: 0; box-shadow: 0 0 0 3px rgba(226, 48, 74, 0.35); }
.tabs { display: none; }
.mode-note { color: var(--muted); font-size: 12px; margin: 6px 0 8px; }
.hud-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.seg-sm button { padding: 4px 10px; font-size: 13px; }
.hud .seg { background: rgba(20, 23, 28, 0.9); }
.position-note { max-width: 340px; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.4; text-shadow: 0 1px 2px #000; pointer-events: none; }
.position-note:empty { display: none; }
#layersPanel { position: absolute; top: 100%; left: 0; z-index: 4; }
.hud-tl { display: flex; flex-direction: column; align-items: flex-start; }
.hud-tl > .hud-row { position: relative; }

/* practice coach */
.coach { position: absolute; z-index: 3; left: 12px; bottom: 36px; width: min(400px, calc(100% - 24px)); background: rgba(16, 20, 18, 0.94); border: 1px solid #2b4a3a; border-radius: 12px; padding: 12px 14px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
.coach[hidden] { display: none; }
.coach.success { border-color: var(--green); }
.coach-head { display: flex; align-items: baseline; gap: 8px; }
.coach-kicker { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--green); }
.coach-head b { font-family: var(--display); font-size: 15px; flex: 1; min-width: 0; }
.coach .close { background: none; border: 0; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
.coach-checks { list-style: none; display: grid; gap: 4px; margin: 10px 0 8px; }
.coach-checks li { display: grid; grid-template-columns: 12px 64px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13px; }
.coach-checks i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid #4b5560; }
.coach-checks li.ok i { background: var(--green); border-color: var(--green); }
.coach-checks span { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.coach-hint { font-size: 14px; line-height: 1.45; }
.coach.success .coach-hint { color: var(--green); }
.coach-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.coach-actions .toggle { margin-left: auto; }
.seg-wrap { flex-wrap: wrap; }
.lesson { margin: 10px 0 6px; padding: 0; list-style: none; display: grid; gap: 8px; max-height: 46vh; overflow: auto; }
.lesson > li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 1.4; }
.lesson > li > i { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 2px solid #4b5560; }
.lesson > li.ok > i { background: var(--green); border-color: var(--green); }
.lesson > li b { display: block; font-size: 12px; font-family: var(--mono); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.lesson > li.ok b { color: var(--green); }
.lesson details { color: var(--muted); font-size: 12px; margin-top: 2px; }
.lesson summary { cursor: pointer; width: max-content; }
.lesson ul { margin: 2px 0 0 16px; display: block; }
.lesson ul li { display: list-item; }
.guide-tip { position: absolute; z-index: 4; pointer-events: none; max-width: 300px; background: rgba(12, 14, 17, 0.95); border: 1px solid #2b4a3a; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.45; color: var(--text, #e8eaed); }
.guide-tip b { display: block; color: #35e08a; font-size: 12px; margin-bottom: 3px; }
.tgc { display: grid; grid-template-columns: 76px repeat(3, 1fr); align-items: center; gap: 10px; padding: 3px 0; }
.tgc-head { color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.tgc-band { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.tgc-band input { width: 100%; min-width: 0; }
.tgc-band output { font-family: var(--mono); font-size: 11px; width: 22px; text-align: right; }
.fps { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.cam-rig { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.cam-rig[hidden] { display: none; }
.cam-slider { position: absolute; pointer-events: auto; display: flex; align-items: center; gap: 8px; background: rgba(16, 19, 24, 0.82); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: 500 10.5px var(--mono); color: var(--muted); letter-spacing: 0.04em; }
.cam-slider input { accent-color: var(--green); }
.cam-az { right: 56px; bottom: 40px; width: min(360px, 40%); }
/* the left-hand panels (Layers, Patient) take that edge: the zoom slider steps aside */
.cam-rig.panel-open .cam-zoom { display: none; }
.cam-az input { flex: 1; min-width: 0; }
.cam-el, .cam-zoom { flex-direction: column; padding: 10px 6px; }
.cam-el { right: 12px; top: 64px; bottom: 96px; }
.cam-zoom { left: 12px; top: 150px; height: min(220px, 30%); }
.cam-el input, .cam-zoom input { writing-mode: vertical-lr; direction: rtl; flex: 1; min-height: 0; width: 18px; }
.cam-el span, .cam-zoom span { writing-mode: vertical-lr; transform: rotate(180deg); }
/* phones: the 3D pane is short; pinch and one-finger drag already zoom and tilt, so only Turn round stays */
@media (max-width: 860px) { .cam-zoom, .cam-el { display: none; } .cam-az { bottom: 8px; right: auto; left: 50%; transform: translateX(-50%); width: 64%; padding: 4px 10px; } }
.measure-card { margin: 0 16px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; line-height: 1.45; }
.measure-card[hidden] { display: none; }
.measure-head { display: flex; gap: 8px; align-items: center; }
.measure-head select { flex: 1; min-width: 0; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
.measure-card .close { background: none; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; }
.measure-out { margin-top: 6px; font-size: 13.5px; }
.measure-out b { font-family: var(--mono); }
.measure-out .ok { color: var(--green); } .measure-out .bad { color: #ffb347; }
.measure-how { margin-top: 4px; color: var(--muted); font-size: 12px; }
#measureBtn.on { background: var(--green); color: #0c0e11; border-color: var(--green); }
.viewport.measuring { cursor: crosshair; }
.toggle-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.toggle-row .toggle { margin-left: 8px; }
.toggle-row .toggle:first-child { margin-left: 0; }
.lesson > li.note { display: block; padding-left: 22px; color: var(--muted); }
.lesson > li.note b { display: inline; margin-right: 6px; }
.lesson > li.source { font-size: 11px; line-height: 1.35; }
.quiz { margin: 10px 0 4px; }
.quiz-q { font-size: 13.5px; line-height: 1.4; }
.quiz-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quiz-options button.right { background: var(--green); border-color: var(--green); color: #0c0e11; }
.quiz-options button.wrong { background: var(--red); border-color: var(--red); color: #fff; }
.quiz-feedback { margin-top: 8px; font-size: 13px; line-height: 1.45; }
.demo-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; color: var(--muted); font-size: 12px; }
.demo-row span { margin-right: 4px; }
.demo-caption { position: absolute; left: 12px; right: 12px; bottom: 10px; background: rgba(12, 14, 17, 0.9); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.4; pointer-events: none; }
.demo-caption[hidden] { display: none; }
.demo-caption b { margin-right: 6px; color: var(--green); }
.image-only-cover { }

/* 3D HUD */
.hud { position: absolute; z-index: 2; }
.hud-tl { top: 12px; left: 12px; }
.hud-tr { top: 12px; right: 12px; }
.hud-tr { display: flex; gap: 8px; align-items: center; }
.hud-tr .icon-btn { margin: 0; }
.hud-bl { left: 14px; bottom: 12px; right: 14px; }
.hint { color: var(--muted); font-size: 12px; pointer-events: none !important; text-shadow: 0 1px 2px #000; }
.hint b { color: var(--text); font-weight: 600; }
.popover { margin-top: 8px; width: 290px; background: rgba(20, 23, 28, 0.96); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45); }
.popover hr { border: 0; border-top: 1px solid var(--line); margin: 8px 0; }
.range-row { display: grid; gap: 4px; color: var(--muted); font-size: 12px; padding-top: 4px; }
.layer-row { display: grid; grid-template-columns: minmax(0, 1fr) 84px; align-items: center; gap: 10px; }
.layer-row .toggle { min-width: 0; }
.layer-row .toggle span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
input[type="range"]:disabled { opacity: 0.35; cursor: default; }
.probe-tip { z-index: 3; font-size: 12px; }

/* loader + help */
#loader { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: var(--bg); transition: opacity 0.5s; }
#loader.done { opacity: 0; pointer-events: none; }
.loader-box { width: min(280px, 80vw); text-align: center; }
.loader-title { font-family: var(--display); font-weight: 700; font-size: 1.3rem; margin-bottom: 14px; }
.loader-track { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
#loaderBar { height: 100%; width: 0; background: var(--red); transition: width 0.2s; }
#loaderText { margin-top: 10px; color: var(--muted); font-size: 12px; }
#loader.error #loaderText { color: #ff8a8a; }
dialog { margin: auto; max-width: min(560px, 92vw); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog h2 { font-family: var(--display); font-size: 1.2rem; margin-bottom: 12px; }
dialog ul { padding-left: 18px; display: grid; gap: 7px; line-height: 1.45; }
dialog .fine { color: var(--muted); font-size: 12px; margin-top: 12px; line-height: 1.5; }
dialog a { color: var(--text); }
dialog form { margin-top: 16px; text-align: right; }

/* phones and narrow tablets: echo on top, 3D under it, tabbed controls at the bottom */
@media (max-width: 860px) {
  .top { height: 46px; gap: 12px; padding: 0 12px; }
  .title .sub { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; } /* minmax: the panes never grow wider than the phone */
  .hud-tl { max-width: calc(100% - 136px); } /* wrap before the right-hand column of buttons */
  .pane-echo { grid-row: 1; grid-column: 1; border-left: 0; }
  .pane-3d { grid-row: 2; grid-column: 1; border-top: 1px solid var(--line); }
  .pane-controls { grid-row: 3; grid-column: 1; border-left: 0; padding: 0 12px calc(10px + env(safe-area-inset-bottom)); max-height: 32dvh; }
  .echo-head { padding: 8px 12px 2px; }
  .view-name { font-size: 1rem; }
  .echo-vp { max-height: 30dvh; }
  .echo-tools { padding: 4px 12px 8px; flex-wrap: wrap; row-gap: 6px; }
  .tabs { display: flex; gap: 4px; position: sticky; top: 0; background: var(--panel); padding: 8px 0 8px; z-index: 1; }
  .tabs button { flex: 1; border: 1px solid var(--line); background: var(--panel-2); border-radius: 8px; padding: 6px; cursor: pointer; color: var(--muted); font-weight: 500; }
  .tabs button.on { color: var(--text); border-color: #3a414b; background: #232830; }
  .pane-controls .group { display: none; margin: 0; }
  .pane-controls[data-tab="views"] [data-group="views"], .pane-controls[data-tab="probe"] [data-group="probe"], .pane-controls[data-tab="image"] [data-group="image"] { display: block; }
  .group h3 { display: none; }
  .pane-controls[data-tab="probe"] .group h3 { display: flex; }
  .hint { display: none; }
  .hud-tr { flex-direction: column; align-items: flex-end; }
  .hud-tr .chip { font-size: 12px; padding: 4px 9px; }
  .position-note { display: none; }
  .coach { position: relative; bottom: auto; left: auto; width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: 10px; box-shadow: none; }
  .coach-head b { font-size: 13px; }
  .coach-kicker { display: none; }
  .coach-checks { display: flex; gap: 12px; margin: 4px 0; }
  .coach-checks li { display: flex; gap: 5px; font-size: 12px; }
  .coach-checks span { display: none; }
  .coach-checks i { width: 9px; height: 9px; }
  .coach-hint { font-size: 12.5px; line-height: 1.35; }
  .coach-actions { margin-top: 6px; }
  .coach-actions .chip { font-size: 12px; padding: 3px 9px; }
  .popover { width: min(290px, calc(100vw - 24px)); }
}

/* info buttons: hover or tap for a fuller explanation */
.info { display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 50%; border: 1px solid #4b5560; background: transparent; color: var(--muted); font: 600 10px/1 var(--mono); cursor: help; vertical-align: middle; flex: none; padding: 0; }
.info:hover, .info:focus-visible, .info.on { color: var(--text); border-color: var(--text); }
.info-tip { position: fixed; z-index: 20; max-width: min(320px, calc(100vw - 24px)); background: #1d222a; border: 1px solid #3a414b; border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.45; color: var(--text); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); pointer-events: none; }
.info-tip b { display: block; margin-bottom: 4px; font-family: var(--display); }
.slider label { display: inline-flex; align-items: center; }
.echo-tools .info, .hud-row .info { margin-left: -2px; }
.tool-pair { display: inline-flex; align-items: center; gap: 5px; }
.tool-pair .info { margin-left: 0; }

/* feedback mode toggle (labs/feedback/stub.js): sits before the help button */
.lab-feedback-toggle { margin-left: auto; }
.lab-feedback-toggle + .icon-btn { margin-left: 0; }
@media (max-width: 520px) { .top:has(.lab-feedback-toggle) { gap: 8px; padding: 0 12px; } .top:has(.lab-feedback-toggle) .title { gap: 6px; } .top:has(.lab-feedback-toggle) .title strong, .top:has(.lab-feedback-toggle) .badge { white-space: nowrap; } .top:has(.lab-feedback-toggle) .badge { letter-spacing: 0.02em; padding: 1px 5px; } .lab-feedback-toggle { width: 32px; height: 32px; padding: 0; justify-content: center; flex: none; } .lab-feedback-toggle .lab-feedback-label { display: none; } }

/* the lock pulses when someone tries to move a locked view */
#lockView { position: relative; }
#lockView.ping::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--red); animation: lock-ping 0.9s ease-out 2; pointer-events: none; }
#lockView.ping { border-color: var(--red); }
@keyframes lock-ping { from { transform: scale(1); opacity: 1; } to { transform: scale(2.1); opacity: 0; } }
.lock-hint { position: absolute; top: 52px; right: 12px; z-index: 3; background: #1d222a; border: 1px solid #3a414b; border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--text); pointer-events: none; }

/* walk-through: a card beside the part it talks about, and a ring round that part */
.tour-ring { position: fixed; z-index: 30; border: 2px solid var(--red); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45); pointer-events: none; transition: all 0.35s ease; }
.tour-card { position: fixed; z-index: 31; width: min(320px, calc(100vw - 24px)); background: #1d222a; border: 1px solid #3a414b; border-radius: 12px; padding: 14px; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5); display: flex; flex-direction: column; gap: 8px; transition: left 0.35s ease, top 0.35s ease; }
.tour-card b { font-family: var(--display); font-size: 15px; }
.tour-card p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text); }
.tour-card .tour-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.tour-card .tour-step { margin-right: auto; font: 500 11px var(--mono); color: var(--muted); }

/* the other lab, one tap away (ECG Lab has the matching link back) */
.lab-switch { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; white-space: nowrap; }
.lab-switch:hover { border-color: #3a414b; }
.lab-switch-short { display: none; }
@media (max-width: 520px) {
  .lab-switch { padding: 4px 9px; font-size: 12px; }
  .lab-switch-long { display: none; } .lab-switch-short { display: inline; }
  .top .badge #version { display: none; }
}
@media (max-width: 440px) { .top .brand span { display: none; } .top:has(.lab-feedback-toggle) { gap: 6px; } .lab-switch { padding: 3px 7px; } }
@media (max-width: 380px) { .lab-switch > span[aria-hidden] { display: none; } }

/* ---------- phones (owner 2026-10-11, src/phone.js): three tabs along the bottom instead of the full lab.
   Scan: the image and the probe. Views: a quick reference for each view. Moves: what slide, rotate, tilt and rock do. */
html.phone .app { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
html.phone .layout { position: relative; grid-template-columns: minmax(0, 1fr); }
html.phone .hud-tl, html.phone #tourBtn, html.phone #facePlane, html.phone .echo-tools, html.phone .measure-card, html.phone .pane-controls .tabs, html.phone .hint { display: none !important; }
html.phone .phone-panel { display: none; }
.phone-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: rgba(12, 14, 17, 0.97); border-top: 1px solid var(--line); padding: 4px 6px calc(4px + env(safe-area-inset-bottom)); }
.phone-bar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font: 500 11.5px var(--body, system-ui); padding: 6px 0 4px; border-radius: 10px; cursor: pointer; }
.phone-bar button svg { width: 22px; height: 22px; }
.phone-bar button.on { color: var(--text); background: #1b1f26; }
.phone-bar button.on svg { color: var(--red); }

/* Scan: image on top, the probe below, three slim sliders at the bottom */
html.phone[data-phone="scan"] .layout { grid-template-rows: auto minmax(0, 1fr) auto; }
html.phone[data-phone="scan"] .pane-echo { grid-row: 1; }
html.phone[data-phone="scan"] .echo-vp { height: 40dvh; max-height: 40dvh; }
html.phone[data-phone="scan"] .pane-3d { grid-row: 2; }
html.phone[data-phone="scan"] .pane-controls { grid-row: 3; display: block; max-height: none; padding: 4px 14px 6px; overflow: visible; }
html.phone[data-phone="scan"] .pane-controls .group { display: none; }
html.phone[data-phone="scan"] .pane-controls [data-group="probe"] { display: block; }
html.phone[data-phone="scan"] [data-group="probe"] h3 { display: flex; margin: 0 0 2px; font-size: 11px; }
html.phone[data-phone="scan"] [data-group="probe"] .slider { margin: 0; padding: 2px 0; }
html.phone[data-phone="scan"] [data-group="probe"] .demo-row { display: none; }

/* Views: the probe on the patient beside the image it gives, the reference card below (no overlap: the 3D and the
   image are drawn on one canvas, so neither can float over the other) */
html.phone[data-phone="views"] .layout { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: 34dvh minmax(0, 1fr); }
html.phone[data-phone="views"] .pane-3d { grid-row: 1; grid-column: 1; }
html.phone[data-phone="views"] .pane-echo { grid-row: 1; grid-column: 2; border-left: 1px solid var(--line); justify-content: center; }
html.phone[data-phone="views"] .echo-head { display: none; }
html.phone[data-phone="views"] .echo-vp { height: 100%; max-height: none; aspect-ratio: auto; }
html.phone[data-phone="views"] .pane-controls { display: none; }
html.phone[data-phone="views"] .hud-tr { top: 8px; left: 8px; right: auto; flex-direction: row; }
html.phone[data-phone="views"] .phone-views { display: flex; grid-row: 2; grid-column: 1 / -1; }
.phone-views { flex-direction: column; min-height: 0; border-top: 1px solid var(--line); background: var(--panel, #12151a); }
.phone-chips { display: flex; gap: 6px; align-items: center; overflow-x: auto; padding: 10px 12px; scrollbar-width: none; flex: none; }
.phone-chips::-webkit-scrollbar { display: none; }
.phone-chips button { flex: none; border: 1px solid var(--line); background: #1b1f26; color: var(--text); border-radius: 999px; padding: 6px 12px; font: 500 13px var(--body, system-ui); cursor: pointer; }
.phone-chips button.on { background: var(--red); border-color: var(--red); color: #fff; }
.phone-chip-group { flex: none; font: 500 10.5px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding-left: 6px; }
.phone-chip-group:first-child { padding-left: 0; }
.phone-card { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.phone-card-head { display: flex; align-items: center; gap: 10px; }
.phone-card-head > div { flex: 1; min-width: 0; }
.phone-card h2 { font-family: var(--display); font-size: 1.1rem; margin: 0; line-height: 1.25; }
.phone-sub { font: 500 11.5px var(--mono); color: var(--muted); }
.phone-step { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #1b1f26; color: var(--text); font-size: 20px; line-height: 1; cursor: pointer; }
.phone-step:disabled { opacity: 0.3; }
.phone-row { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.phone-row b { font: 600 11px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: #ffd34d; }
.phone-row p { margin: 0; font-size: 14px; line-height: 1.45; }
.phone-why { color: var(--muted); font-size: 13px; }
.phone-good summary { cursor: pointer; font-weight: 600; font-size: 14px; color: #35c07a; }
.phone-good ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 5px; font-size: 13.5px; line-height: 1.4; }
.phone-actions { display: flex; justify-content: flex-end; padding-top: 4px; }
.phone-primary { border: 0; background: var(--red); color: #fff; border-radius: 999px; padding: 9px 18px; font: 600 14px var(--body, system-ui); cursor: pointer; }

/* Moves: image on top, the probe below, the four moves and what they do */
html.phone[data-phone="moves"] .layout { grid-template-rows: auto minmax(0, 1fr) auto; }
html.phone[data-phone="moves"] .pane-echo { grid-row: 1; }
html.phone[data-phone="moves"] .echo-vp { height: 34dvh; max-height: 34dvh; }
html.phone[data-phone="moves"] .pane-3d { grid-row: 2; }
html.phone[data-phone="moves"] .pane-controls { display: none; }
html.phone[data-phone="moves"] .phone-moves { display: flex; grid-row: 3; }
html.phone[data-phone="moves"] #demoCaption { display: none; } /* the card says it */
.phone-moves { flex-direction: column; gap: 8px; padding: 10px 14px 12px; border-top: 1px solid var(--line); background: var(--panel, #12151a); }
.phone-move-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.phone-move { border: 1px solid var(--line); background: #1b1f26; color: var(--text); border-radius: 12px; padding: 12px 4px; font: 600 14px var(--body, system-ui); cursor: pointer; }
.phone-move.on { border-color: var(--red); background: rgba(226, 48, 74, 0.15); }
.phone-move-text { margin: 0; font-size: 13.5px; line-height: 1.45; min-height: 3.9em; }
.phone-fine { margin: 0; font-size: 11.5px; line-height: 1.4; color: var(--muted); }

/* a phone on its side: image and probe side by side; the cards along the bottom */
@media (orientation: landscape) {
  html.phone .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  html.phone[data-phone]:not([data-phone="views"]) .pane-echo { grid-row: 1; grid-column: 1; }
  html.phone[data-phone] .echo-head { display: none; }
  html.phone[data-phone] .pane-echo { min-height: 0; overflow: hidden; }
  html.phone[data-phone] .echo-vp { height: 100%; max-height: none; aspect-ratio: auto; flex: 1; min-height: 0; }
  html.phone[data-phone] .phone-fine { display: none; }
  html.phone[data-phone="moves"] .phone-moves { padding: 8px 14px; gap: 6px; }
  html.phone[data-phone="moves"] .phone-move { padding: 8px 4px; }
  html.phone[data-phone="moves"] .phone-move-text { min-height: 0; font-size: 13px; }
  html.phone[data-phone="views"] .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  html.phone[data-phone="views"] .pane-echo { grid-column: 2; border-left: 1px solid var(--line); }
  html.phone[data-phone="views"] .pane-3d { grid-column: 1; }
  html.phone[data-phone]:not([data-phone="views"]) .pane-3d { grid-row: 1; grid-column: 2; }
  html.phone[data-phone="scan"] .layout, html.phone[data-phone="moves"] .layout, html.phone[data-phone="views"] .layout { grid-template-rows: minmax(0, 1fr) auto; }
  html.phone[data-phone] .pane-controls, html.phone[data-phone] .phone-panel { grid-column: 1 / -1; grid-row: 2; }
  html.phone[data-phone="views"] .phone-views { max-height: 38dvh; }
  .phone-card { flex-direction: row; flex-wrap: wrap; }
}
.phone-panel, .phone-bar { pointer-events: auto; }

/* the lab links sit on the right, beside Feedback (owner 2026-10-11) */
.top .lab-cases { margin-left: auto; }
.top .lab-cases ~ .lab-feedback-toggle, .top .lab-cases ~ .icon-btn { margin-left: 0; }

/* rib and lung shadows start off: a small grey note on the image leads to their switches */
.shadow-note { border: 0; white-space: nowrap; background: transparent; color: #7b8390; font: 500 11.5px var(--mono); letter-spacing: 0.02em; padding: 2px 0; cursor: pointer; text-decoration: underline dotted rgba(123, 131, 144, 0.6); text-underline-offset: 3px; }
.shadow-note:hover { color: var(--text); }
.shadow-note[hidden] { display: none; }
html.phone .shadow-note { display: none; }
@keyframes ping-row { 0% { box-shadow: 0 0 0 0 rgba(226, 48, 74, 0.7); } 70% { box-shadow: 0 0 0 10px rgba(226, 48, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(226, 48, 74, 0); } }
.toggle.ping { animation: ping-row 0.9s ease-out 3; border-radius: 8px; outline: 1.5px solid var(--red); outline-offset: 3px; }

/* public beta note (2026-11-22): shown once under the header until dismissed */
.beta-note { position: fixed; z-index: 20; top: 58px; left: 50%; transform: translateX(-50%); width: min(640px, calc(100vw - 24px)); background: rgba(20, 23, 28, 0.97); color: var(--text); border: 1px solid rgba(242, 184, 75, 0.6); border-radius: 10px; padding: 10px 14px; font-size: 13px; line-height: 1.5; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); }
.beta-note b:first-child { color: #f2b84b; }
.beta-note .chip { margin-left: 8px; }
