/* Renal-GU POCUS Simulator — © 2026 Yuriy Bronshteyn, MD, FASE. All rights reserved. */
:root {
  --bg: #efeee9; --panel: #ffffff; --panel2: #f7f6f2; --ink: #1c2026; --muted: #5f6771; --line: #dcdad2;
  --accent: #0e7a83; --accent-ink: #ffffff; --amber: #e39a12; --good: #1d8a4e; --bad: #c0392b;
  --skin: #f1ddcc; --skin-line: #d4b59d; --bone: #f7f3ea; --bone-line: #bfb3a0; --pill: #eef0f2; --pill-line: #cfd4da;
  --screen: #050607; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.05);
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1115; --panel: #161a20; --panel2: #1c2129; --ink: #e6e8eb; --muted: #9aa3ad; --line: #2a3039;
    --accent: #2bb3bd; --accent-ink: #061216; --amber: #f2ae2e; --good: #3fbf78; --bad: #ef6b5b;
    --skin: #3a3230; --skin-line: #5a4c46; --bone: #565a62; --bone-line: #6f7580; --pill: #222831; --pill-line: #3a424d;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1115; --panel: #161a20; --panel2: #1c2129; --ink: #e6e8eb; --muted: #9aa3ad; --line: #2a3039;
  --accent: #2bb3bd; --accent-ink: #061216; --amber: #f2ae2e; --good: #3fbf78; --bad: #ef6b5b;
  --skin: #3a3230; --skin-line: #5a4c46; --bone: #565a62; --bone-line: #6f7580; --pill: #222831; --pill-line: #3a424d;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 30px; height: 30px; flex: none; } .logo-a { fill: var(--ink); } .logo-b { fill: var(--accent); }
.brand h1 { font-size: 17px; letter-spacing: -.01em; }
.brand .sub { margin: 0; font-size: 12px; color: var(--muted); }
.modes { display: flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-left: auto; }
.modes button { border: 0; background: none; padding: 6px 16px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 600; }
.modes button[aria-selected="true"] { background: var(--ink); color: var(--panel); }
.top-right { display: flex; align-items: center; gap: 6px; }
.chip-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 5px 11px; cursor: pointer; max-width: 220px; }
.chip-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-btn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.chip-btn.signed .dot { background: var(--good); }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 700; }

.stage { display: grid; gap: 12px; padding: 12px 16px; grid-template-columns: 400px minmax(0, 1fr) 340px; grid-template-areas: "probe echo side"; align-items: start; max-width: 1600px; margin: 0 auto; }

.probe-panel { grid-area: probe; position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.echo-panel { grid-area: echo; }
.side { grid-area: side; display: grid; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 0; }
.panel-head h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; padding: 2px 4px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel2); padding: 4px 8px; font-size: 12px; cursor: pointer; font-weight: 600; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--pill); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.seg.full { display: flex; } .seg.full button { flex: 1; padding: 7px 4px; }

.torso-host { touch-action: none; user-select: none; -webkit-user-select: none; }
.torso-svg { width: 100%; height: auto; display: block; max-height: 400px; font: 600 8px system-ui, sans-serif; }
.torso-svg .skin { fill: var(--skin); stroke: var(--skin-line); stroke-width: 1.5; stroke-linejoin: round; }
.torso-svg .bone { fill: var(--bone); stroke: var(--bone-line); stroke-width: 1; }
.torso-svg .rib-edge { fill: none; stroke: var(--bone-line); stroke-width: 10; stroke-linecap: round; }
.torso-svg .rib { fill: none; stroke: var(--bone); stroke-width: 7.5; stroke-linecap: round; }
.torso-svg .bone.thin { fill: none; stroke: var(--bone); stroke-width: 5; stroke-linecap: round; }
.torso-svg .costal { fill: none; stroke: var(--bone-line); stroke-width: 1.2; stroke-dasharray: 4 3; }
.torso-svg .navel { fill: var(--skin-line); }
.torso-svg .tag { fill: var(--muted); font-size: 9px; font-weight: 600; }
.torso-svg .liver { fill: rgba(150,70,60,.10); stroke: rgba(150,70,60,.45); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.torso-svg .stomach { fill: rgba(222,150,120,.22); stroke: rgba(200,110,80,.7); stroke-width: 1.2; stroke-dasharray: 3 3; pointer-events: none; }
.torso-svg .organ-lbl { fill: rgba(150,70,60,.75); font-size: 8px; pointer-events: none; }
.torso-svg .midline { stroke: var(--skin-line); stroke-width: 1; stroke-dasharray: 2 4; }
.torso-svg .win { fill: rgba(14,122,131,.06); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; cursor: pointer; opacity: .55; }
.torso-svg .win.active { fill: rgba(14,122,131,.16); stroke-dasharray: none; stroke-width: 1.5; opacity: 1; }
.torso-svg .win:hover, .torso-svg .win:focus-visible { opacity: 1; outline: none; }
.torso-svg .win-lbl { fill: var(--accent); font-size: 8.5px; pointer-events: none; }
.torso-svg .aim { stroke: var(--amber); stroke-width: 1.6; stroke-dasharray: 3 2.5; fill: none; pointer-events: none; }
.torso-svg .aim-head { fill: var(--amber); }
.torso-svg .ring { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 3; cursor: grab; opacity: .8; }
.torso-svg .foot { fill: #2f343c; stroke: #14171c; stroke-width: 1; cursor: move; }
.torso-svg .foot-line { stroke: #8a929c; stroke-width: 1; pointer-events: none; }
.torso-svg .indicator { fill: var(--amber); pointer-events: none; }
.torso-svg .knob { fill: var(--panel); stroke: var(--ink); stroke-width: 1.5; cursor: grab; }
.torso-svg .knob:hover { fill: var(--amber); }
.torso-svg .pressed .foot { fill: #1b1f25; }
.torso-svg g:focus { outline: none; } .torso-svg g:focus-visible .foot { stroke: var(--accent); stroke-width: 2.5; }

.probe-row { display: grid; grid-template-columns: 118px auto minmax(0, 1fr); gap: 8px; align-items: start; }
.ctl-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-bottom: 3px; white-space: nowrap; }
.ctl-lbl .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
.pad-host { touch-action: none; }
.pad-svg { width: 118px; height: 118px; display: block; cursor: crosshair; }
.pad-svg:focus { outline: none; } .pad-svg:focus-visible .pad-bg { stroke: var(--accent); stroke-width: 2; }
.pad-bg { fill: var(--panel2); stroke: var(--line); }
.pad-axis { stroke: var(--line); stroke-width: 1.5; } .pad-tick { stroke: var(--line); stroke-width: 1; }
.pad-lbl { font: 600 7.5px system-ui, sans-serif; fill: var(--muted); }
.pad-dot { fill: var(--amber); stroke: #111; stroke-width: 1; cursor: grab; }
.gauge-wrap { touch-action: none; }
.gauge-svg { width: 36px; height: 118px; display: block; cursor: ns-resize; }
.gauge-svg:focus { outline: none; } .gauge-svg:focus-visible .gauge-bg { stroke: var(--accent); stroke-width: 2; }
.gauge-bg { fill: var(--panel2); stroke: var(--line); }
.gauge-fill { fill: var(--accent); opacity: .5; }
.gauge-handle { fill: var(--panel); stroke: var(--ink); stroke-width: 1.5; }
.readouts { display: grid; grid-template-columns: 1fr; gap: 4px; margin: 0; align-content: start; }
.readouts div { background: var(--panel2); border-radius: 8px; padding: 3px 7px; display: flex; justify-content: space-between; gap: 6px; align-items: baseline; }
.readouts dt { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.readouts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.field.compact { gap: 4px; }

.screen { position: relative; background: var(--screen); border-radius: 10px; overflow: hidden; aspect-ratio: 1.36 / 1; max-height: calc(100vh - 170px); touch-action: none; }
.screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.screen > div { position: absolute; color: #d8dde3; font: 600 12px/1.3 ui-monospace, "SF Mono", Menlo, Consolas, monospace; pointer-events: none; }
.scr-tl { top: 10px; left: 12px; display: grid; max-width: 60%; } .scr-tl span:first-child { color: #ffd27a; font-size: 15px; } .scr-tl span:last-child { color: #8a929c; font-size: 11px; }
.scr-tr { top: 10px; right: 12px; color: #f2ae2e; }
.scr-bl { left: 12px; bottom: 10px; max-width: 70%; }
.scr-bl .nv { color: #7ee2a8; } .scr-bl .nv.none { color: #8a929c; } .scr-bl .nv.warn { color: #ffb36b; }
.scr-br { right: 12px; bottom: 10px; color: #8a929c !important; }
.freeze { top: 10px; left: 50%; transform: translate(-50%, 0); background: rgba(227,154,18,.9); color: #111 !important; padding: 3px 10px; border-radius: 6px; letter-spacing: .1em; }
.offtorso { top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(192,57,43,.9); color: #fff !important; padding: 6px 12px; border-radius: 6px; }
.bezel { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 2px 0; }
.bz-group { display: flex; align-items: center; gap: 4px; }
.bz-lbl { font-size: 12px; color: var(--muted); margin-right: 2px; }
.bz { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; min-width: 36px; }
.bz.toggle[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.bz.store { margin-left: auto; background: var(--amber); border-color: var(--amber); color: #111; padding: 8px 18px; }

.view3d-panel .panel-head { flex-wrap: wrap; }
.view3d-wrap { position: relative; }
#view3d { width: 100%; aspect-ratio: 1 / 0.86; display: block; background: var(--panel2); border-radius: 8px; cursor: grab; touch-action: none; }
#view3d.grabbing { cursor: grabbing; }
.legend { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 3px 0 6px; vertical-align: -1px; }
.sw.st { background: #de9678; } .sw.an { background: #e8785a; } .sw.pa { background: #dec460; } .sw.ao { background: #c43440; } .sw.ivc { background: #789ce2; }
.sw.co { background: #b09676; } .sw.gb { background: #6cb074; } .sw.sc { background: var(--amber); } .sw.calA { background: #ffd27a; } .sw.calB { background: #7ee2ff; }

.steppers { gap: 10px; }
.stepper { display: inline-flex; align-items: center; gap: 5px; }
.stepper .stp-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.stepper b { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.stepper .bz { padding: 3px 9px; min-width: 28px; }
.bz.small { font-size: 12px; padding: 4px 9px; }

.readouts.cal { margin: 6px 0; } .readouts.cal dt .sw { margin: 0 4px 0 0; }
.thumb { width: 100%; aspect-ratio: 1 / 0.72; display: block; background: #050607; border-radius: 8px; margin-top: 6px; }
#gradeSeg button { font-size: 11.5px; white-space: normal; }

.task-panel { display: grid; gap: 10px; }
.mode-body { display: grid; gap: 10px; }
.row { display: flex; gap: 6px; align-items: center; } .row.wrap { flex-wrap: wrap; } .row.end { justify-content: flex-end; }
.field { display: grid; gap: 5px; } .field > span { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
select, input[type="email"], textarea { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 7px 9px; min-width: 0; width: 100%; }
.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: none; }
.btn.danger { color: var(--bad); } .danger-text { color: var(--bad); }
.btn.wide { width: 100%; padding: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.sweeps { display: grid; gap: 6px; } .sweeps .btn { text-align: left; white-space: normal; }
.caption { margin: 0; min-height: 1.4em; font-size: 12.5px; color: var(--muted); }
.nearest-card, .task-card { background: var(--panel2); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; }
.nc-k, .tc-k { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.nc-v, .tc-v { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.nc-s { color: var(--amber); letter-spacing: 2px; min-height: 1em; }
.nc-t { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.tc-meta { font-size: 12px; color: var(--muted); }
.hints { margin: 4px 0 0; padding-left: 18px; font-size: 13px; display: grid; gap: 3px; } .hints:empty { display: none; }
.result { border-radius: 10px; padding: 10px 12px; border: 1px solid var(--line); display: grid; gap: 6px; font-size: 13px; }
.result.pass { border-color: var(--good); background: color-mix(in srgb, var(--good) 9%, var(--panel)); }
.result.fail { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--panel)); }
.result h3 { font-size: 16px; } .result .stars { color: var(--amber); letter-spacing: 3px; font-size: 18px; }
.result ul { margin: 0; padding-left: 18px; } .result .metrics { display: flex; gap: 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.result .metrics b { font-size: 15px; } .result p { margin: 0; }
.picker summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 4px 0; }
.view-list { display: grid; gap: 2px; margin-top: 6px; max-height: 300px; overflow: auto; }
.view-list .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 6px 0 2px; }
.view-list button { display: flex; justify-content: space-between; gap: 8px; border: 0; background: none; text-align: left; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.view-list button:hover, .view-list button.on { background: var(--pill); }
.view-list .st { color: var(--amber); letter-spacing: 1px; white-space: nowrap; } .view-list .st.none { color: var(--line); }

.feedback { border-top: 1px dashed var(--line); padding-top: 8px; }
.fb-toggle { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; padding: 2px 0; text-align: left; }
#fbForm { display: grid; gap: 6px; margin-top: 6px; }
.fb-help { margin: 0; font-size: 12px; color: var(--muted); }
.fb-status { margin: 0; font-size: 12.5px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal-card { background: var(--panel); color: var(--ink); border-radius: 14px; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 16px; display: grid; gap: 10px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.profile-list { display: flex; flex-wrap: wrap; gap: 6px; } .profile-list button { border: 1px solid var(--line); border-radius: 999px; background: var(--panel2); padding: 4px 10px; cursor: pointer; }
.profile-list button.on { border-color: var(--good); }
.progress-table { overflow-x: auto; } .progress-table table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.progress-table th, .progress-table td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.progress-table td.st { color: var(--amber); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.help-grid h3 { font-size: 14px; margin-bottom: 4px; } .help-grid ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.keys td { padding: 2px 8px 2px 0; } kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; font: 600 11.5px ui-monospace, Menlo, monospace; background: var(--panel2); }
#helpViews { display: grid; gap: 3px; } #helpViews p { margin: 4px 0 0; }

.foot { max-width: 1600px; margin: 0 auto; padding: 4px 16px 24px; font-size: 12px; color: var(--muted); }
.foot p { margin: 4px 0; } .copyright { font-weight: 600; }

.torso-pair { display: grid; gap: 10px; min-width: 0; }
.torso-col { min-width: 0; display: grid; gap: 4px; }
.torso-col .ctl-lbl { white-space: normal; }
.ring-host { width: 100%; max-width: 300px; margin: 0 auto; min-width: 0; }

.torso-pair svg { width: 100%; height: auto; max-height: none; display: block; touch-action: none; }
.ring-svg { font: 600 15px system-ui, sans-serif; }
.ring-svg .skin { fill: var(--skin); stroke: var(--skin-line); stroke-width: 3; }
.ring-svg .bone { fill: var(--bone); stroke: var(--bone-line); stroke-width: 2; }
.ring-svg .tag { fill: var(--muted); font-size: 15px; font-weight: 600; }
.ring-svg .side-tag { fill: var(--accent); }
.ring-svg .ring-win { fill: none; stroke: var(--accent); stroke-width: 13; stroke-linecap: round; opacity: .3; cursor: pointer; }
.ring-svg .organ-lbl { font-size: 13px; }

.organ { stroke-width: 1.2; stroke-dasharray: 3 3; pointer-events: none; }
.ring-svg .organ { stroke-width: 2.4; stroke-dasharray: 6 5; }
.organ.liver { fill: rgba(150,70,60,.12); stroke: rgba(150,70,60,.5); }
.organ.kidney { fill: rgba(96,124,86,.16); stroke: rgba(80,120,70,.65); }
.organ.spleen { fill: rgba(126,84,140,.16); stroke: rgba(120,70,140,.6); }
.organ.bladder { fill: rgba(70,130,180,.16); stroke: rgba(60,120,180,.65); }
.torso-svg .organ-lbl, .ring-svg .organ-lbl { fill: var(--muted); font-weight: 600; pointer-events: none; }
.ring-svg .ring-win.active { opacity: .85; }
.ring-svg .ring-win:hover { opacity: .6; }
.ring-svg .ring-dot { fill: #2f343c; stroke: var(--amber); stroke-width: 3.5; cursor: grab; }
.ring-svg .aim { stroke: var(--muted); stroke-width: 4; stroke-dasharray: 7 5; fill: none; pointer-events: none; opacity: .75; }

.ring-svg .ind-arm { stroke: var(--amber); stroke-width: 5; fill: none; pointer-events: none; stroke-linecap: round; }
.ring-svg .ind-head { fill: var(--amber); }
.ring-svg .ind-lbl { fill: var(--amber); font-size: 14px; font-weight: 700; pointer-events: none; }

.torso-svg .ind-ring { fill: var(--panel); stroke: var(--amber); stroke-width: 2; pointer-events: none; }
.torso-svg .ind-fill { fill: var(--amber); pointer-events: none; }
.torso-svg .ind-x { stroke: var(--amber); stroke-width: 2.2; pointer-events: none; stroke-linecap: round; }

.torso-svg .ind-lbl { fill: var(--amber); font-size: 11px; font-weight: 700; pointer-events: none;
  stroke: var(--panel); stroke-width: 3; paint-order: stroke fill; }
.torso-svg .ind-note { font-size: 9px; font-weight: 600; }
.ring-svg .ind-lbl { stroke: var(--panel); stroke-width: 3.5; paint-order: stroke fill; }
.torso-svg .side-tag { fill: var(--accent); font-size: 10px; }
.torso-svg .win.flank { stroke-width: 1.2; }

.fluid-line { margin: 2px 0 8px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.fluid-line b { color: var(--amber); }

.phone-pair { display: flex; gap: 16px; align-items: center; margin: 10px 0 4px; flex-wrap: wrap; }
#phoneQR { background: #fff; border-radius: 8px; padding: 0; width: 168px; height: 168px; image-rendering: pixelated; flex: none; }
.phone-code-wrap { flex: 1; min-width: 200px; }
.phone-code { font: 700 34px/1.15 ui-monospace, Menlo, monospace; letter-spacing: .28em; color: var(--accent); margin: 6px 0; user-select: all; }
#phoneStatus { color: var(--muted); }
.big-ok { font-size: 19px; font-weight: 650; margin: 4px 0 8px; }
#btnPhone.phone-on { color: var(--good); font-weight: 650; }

@media (max-width: 1180px) {
  .stage { grid-template-columns: 400px minmax(0, 1fr); grid-template-areas: "echo echo" "probe side"; }
  .screen { max-height: none; }
}

@media (max-width: 720px) {
  .topbar { gap: 8px; padding: 8px 12px; }
  .brand .sub { display: none; }
  .top-right { margin-left: auto; }
  .chip-btn { max-width: 130px; }
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-areas: "echo" "probe" "task"; padding: 10px 12px; gap: 8px; }
  .side { display: contents; }
  .task-panel { grid-area: task; }
  .panel { padding: 8px; }
  .torso-host { max-width: 340px; margin: 0 auto; }
  .probe-row { grid-template-columns: 118px auto minmax(0, 1fr); }
  .readouts { grid-template-columns: 1fr; }
  .legend { display: none; }
  .phone-code { font-size: 28px; }
  #phoneQR { width: 140px; height: 140px; }
}

.organ.ctx { opacity: .45; }
.organ-lbl.ctx { opacity: .6; }

.organ.balloon { fill: rgba(255,255,255,.55); stroke: #7d848c; stroke-dasharray: none; stroke-width: 1.2; }
.ring-svg .organ.balloon { stroke-width: 2.4; stroke-dasharray: none; }

.img-line { margin: 2px 0 4px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.img-line b { color: var(--ink); }

.case-grp { display: grid; gap: 6px; border-top: 1px dashed var(--line); padding-top: 8px; }
.grp-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grp-h h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink); }
.grp-h .seg button { padding: 3px 9px; }
.sub-lbl { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 2px 0 -2px; }
.side .seg.full button { min-width: 0; white-space: normal; line-height: 1.2; padding: 6px 2px; font-size: 11.5px; }
#volSeg button { font-size: 11px; letter-spacing: -.01em; }
.seg.wrap { flex-wrap: wrap; gap: 1px; background: var(--line); }
.seg.wrap button { flex: 1 1 30%; }
.seg.wrap button + button { border-left: 0; }
.case-line { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.4; }

.echo-panel .probe-row { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.echo-panel .readouts { grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .echo-panel .readouts { grid-template-columns: 1fr; } }
