/*! © 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;
  --probe-dark: #353a42; --probe-light: #717985; --wheel: #2a2e35; --wheel-line: #8b929c; --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;
    --probe-dark: #262a31; --probe-light: #5a616c; --wheel: #1b1e23; --wheel-line: #6f7782; --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;
  --probe-dark: #262a31; --probe-light: #5a616c; --wheel: #1b1e23; --wheel-line: #6f7782; --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; }
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(--amber); }
.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 14px; 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: 250px minmax(0, 1fr) 360px; grid-template-areas: "probe echo side"; align-items: start; max-width: 1600px; margin: 0 auto; }
.probe-panel { grid-area: probe; position: relative; }
.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: 6px; }
.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; }

.probe-host { touch-action: none; user-select: none; -webkit-user-select: none; }
.probe-svg { width: 100%; height: auto; display: block; max-height: 640px; }
.probe-svg .cable { fill: none; stroke: var(--probe-dark); stroke-width: 12; stroke-linecap: round; }
.probe-svg .hbody { stroke: rgba(0,0,0,.35); stroke-width: 1; cursor: ew-resize; }
.probe-svg .dial-face { fill: var(--pill); stroke: var(--pill-line); }
.probe-svg .needle { stroke: var(--amber); stroke-width: 3; stroke-linecap: round; }
.probe-svg .wheel { cursor: grab; }
.probe-svg .wheel-rim { fill: var(--wheel); stroke: rgba(0,0,0,.5); }
.probe-svg .wheel-rim2 { fill: #3a3f47; stroke: rgba(0,0,0,.6); }
.probe-svg .knurl { stroke: var(--wheel-line); stroke-width: 2; }
.probe-svg .wheel-dot { fill: var(--amber); }
.probe-svg .hub { fill: #5b626c; stroke: rgba(0,0,0,.4); }
.probe-svg .btn-svg { cursor: pointer; }
.probe-svg .btn-svg .hit, .probe-svg .shaft .hit { fill: transparent; }
.probe-svg .pill { fill: var(--pill); stroke: var(--pill-line); }
.probe-svg .btn-svg:hover .pill, .probe-svg .btn-svg:focus .pill { stroke: var(--accent); }
.probe-svg .btn-svg:active .pill { fill: var(--accent); }
.probe-svg .omni-key { fill: #1f2328; stroke: var(--amber); stroke-width: 1.5; }
.probe-svg .omni .lbl { fill: #ffd27a; }
.probe-svg .btn-svg:active .omni-key { fill: var(--amber); }
.probe-svg .arrow { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; }
.probe-svg .arrowhead { fill: var(--muted); }
.probe-svg .btn-svg:hover .arrow { stroke: var(--accent); } .probe-svg .btn-svg:hover .arrowhead { fill: var(--accent); }
.probe-svg .lbl { font-size: 12px; font-weight: 600; fill: var(--ink); }
.probe-svg .lbl.strong { font-size: 13px; }
.probe-svg .tiny { font-size: 9.5px; fill: var(--muted); }
.probe-svg .shaft { cursor: ns-resize; }
.probe-svg .shaft-tube { fill: #2b2f36; }
.probe-svg .mark { stroke: #c9ced6; stroke-width: 1; } .probe-svg .mark.major { stroke: #fff; stroke-width: 1.6; }
.probe-svg .biteblock { fill: #6f5a3a; }
.probe-svg .depthtag { font-size: 12px; font-weight: 700; fill: var(--amber); }
.probe-svg :focus { outline: none; } .probe-svg :focus-visible .pill, .probe-svg :focus-visible .wheel-rim { stroke: var(--accent); stroke-width: 3; }
.readouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 4px; margin: 6px 0 0; }
.readouts div { background: var(--panel2); border-radius: 8px; padding: 4px 6px; }
.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: 13px; }
.lockveil { position: absolute; inset: 36px 0 0 0; background: color-mix(in srgb, var(--panel) 72%, transparent); display: grid; place-items: center; border-radius: var(--r); text-align: center; padding: 20px; font-weight: 600; color: var(--muted); }

.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; } .scr-tl span:first-child { color: #ffd27a; font-size: 15px; }
.scr-tr { top: 8px; right: 10px; display: grid; justify-items: center; pointer-events: auto !important; cursor: grab; touch-action: none; }
.scr-tr svg { width: 72px; height: 45px; }
.scr-tr span { font-size: 18px; color: #ffd27a; margin-top: -4px; }
.omni-arc { fill: none; stroke: #7f8894; stroke-width: 3; } .omni-needle { stroke: #ffd27a; stroke-width: 3; stroke-linecap: round; } .omni-hub { fill: #ffd27a; }
.scr-bl { left: 12px; bottom: 10px; max-width: 70%; }
.scr-bl .nv { color: #7ee2a8; } .scr-bl .nv.none { color: #8a929c; }
.scr-br { right: 12px; bottom: 10px; color: #8a929c !important; }
.freeze { top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(227,154,18,.9); color: #111 !important; padding: 4px 10px; border-radius: 6px; letter-spacing: .1em; }
.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; }
.stage:not([data-mode="acquire"]) .bz.store { display: none; }

.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; }
.veil { position: absolute; inset: 0; display: grid; place-items: center; background: var(--panel2); border-radius: 8px; color: var(--muted); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--panel2); padding: 3px 7px; font-size: 11.5px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { background: var(--pill); }
.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.lh { background: #d65454; } .sw.rh { background: #547cce; } .sw.ao { background: #c43440; } .sw.pa { background: #7868c8; } .sw.sc { background: var(--amber); }

.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; } .tc-v.small { font-size: 14px; font-weight: 600; }
.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; }
.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); }
.dots { display: flex; gap: 4px; flex-wrap: wrap; } .dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.dots i.ok { background: var(--good); } .dots i.no { background: var(--bad); } .dots i.cur { background: var(--amber); }
.choices { display: grid; gap: 6px; }
.choices .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
.choices .opts { display: flex; flex-wrap: wrap; gap: 4px; }
.choices button { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 4px 9px; font-size: 12.5px; cursor: pointer; }
.choices button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.choices button.right { background: var(--good); color: #fff; border-color: var(--good); }
.choices button.wrong { background: var(--bad); color: #fff; border-color: var(--bad); }
.dial-row { display: flex; gap: 10px; align-items: center; }
.id-dial { width: 180px; max-width: 55%; touch-action: none; cursor: grab; flex: none; }
.dial-arc { fill: none; stroke: var(--line); stroke-width: 10; stroke-linecap: round; }
.dial-needle { stroke: var(--amber); stroke-width: 4; stroke-linecap: round; } .dial-hub { fill: var(--ink); }
.id-dial .tick { stroke: var(--muted); stroke-width: 1.5; } .id-dial text { font-size: 10px; fill: var(--muted); }
.id-dial .truth { stroke: var(--good); stroke-width: 3; stroke-dasharray: 4 3; }
.dial-read { display: grid; } .dial-read .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.dial-read .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; } .dial-read .hint-s { font-size: 11.5px; color: var(--muted); }

.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); }

.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; }

@media (max-width: 1180px) {
  .stage { grid-template-columns: 230px 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; }
  .modes { order: 3; width: 100%; margin-left: 0; justify-content: space-between; }
  .modes button { flex: 1; }
  .top-right { margin-left: auto; }
  .chip-btn { max-width: 130px; }
  .stage { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "echo echo" "probe v3d" "task task"; padding: 10px 12px; gap: 8px; }
  .side { display: contents; }
  .view3d-panel { grid-area: v3d; align-self: start; }
  .task-panel { grid-area: task; }
  .view3d-panel .panel-head { flex-wrap: wrap; }
  .seg { flex-wrap: wrap; } .seg button { padding: 3px 5px; font-size: 11px; }
  .panel { padding: 8px; }
  .readouts { grid-template-columns: 1fr 1fr; }
  .legend { display: none; }
  .probe-svg { max-height: 460px; }
  .bz.store { margin-left: 0; flex: 1 1 100%; }
  .scr-tr svg { width: 56px; height: 35px; } .scr-tr span { font-size: 14px; }
  .dial-row { flex-direction: column; align-items: stretch; } .id-dial { max-width: 100%; width: 100%; }
}

.numpad { margin-top: 8px; background: var(--panel2); border-radius: 10px; padding: 7px; }
.np-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin-bottom: 5px; }
.np-head > span:first-child { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.np-shift { font-size: 10px; color: var(--amber); font-weight: 600; white-space: nowrap; }
.np-shift kbd { font-size: 9.5px; padding: 0 3px; color: var(--amber); }
.np-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.np-key { display: grid; justify-items: center; align-content: center; gap: 1px; min-height: 50px; padding: 4px 2px; border: 1px solid var(--pill-line); border-bottom-width: 3px; border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; line-height: 1.1; user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: background .08s, transform .08s; }
.np-key b { font-size: 17px; font-variant-numeric: tabular-nums; }
.np-key span { font-size: 10px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.np-key em { font-style: normal; font-size: 10px; font-weight: 700; color: var(--amber); }
.np-key.off { cursor: default; opacity: .35; border-bottom-width: 1px; }
.np-key:not(.off):hover { border-color: var(--accent); }
.np-key.lit { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: translateY(1px); }
.np-key.lit span, .np-key.lit em { color: var(--accent-ink); }
.numpad.shift .np-key em { background: var(--amber); color: #111; border-radius: 4px; padding: 0 4px; }
.numpad.shift .np-key[data-k="2"] span, .numpad.shift .np-key[data-k="8"] span { opacity: .45; }
@media (max-width: 720px) { .np-key { min-height: 44px; } .np-key b { font-size: 15px; } .np-key span { font-size: 9px; } .np-shift { display: none; } }

.screen.xp { aspect-ratio: 2.25 / 1; }
.screen.xp .scr-tr { right: calc(50% + 10px); }
.screen.xp .scr-br { right: calc(50% + 12px); }
.scr-x { top: 10px; right: 12px; display: grid; justify-items: end; text-align: right; }
.scr-x .xl { color: #40d2e6; font-size: 13px; letter-spacing: .08em; }
.scr-x #scrXnear { color: #7ee2a8; } .scr-x #scrXnear.none { color: #8a929c; }
.screen.xp canvas { cursor: crosshair; }
.bz.xp-toggle[aria-pressed="true"] { background: #1a8a98; border-color: #1a8a98; color: #fff; }
.stage[data-mode="identify"] #btnXplane, .stage[data-mode="identify"] #xpControls { display: none !important; }
@media (max-width: 720px) { .screen.xp { aspect-ratio: 1.8 / 1; } .scr-x .xl { font-size: 11px; } .screen.xp .scr-tr svg { width: 44px; height: 28px; } }

.stage.hide-params .scr-tl, .stage.hide-params .scr-tr, .stage.hide-params .readouts dd { visibility: hidden; }
.stage.hide-params .lockveil { background: color-mix(in srgb, var(--panel) 94%, transparent); }
