:root {
  --bg: #0b1016;
  --panel: #121a23;
  --line: #233142;
  --text: #dbe4ee;
  --muted: #8797a8;
  --accent: #4fb3ff;
  --ok: #4fd18b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1 { font-size: 18px; margin: 0 0 12px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
p { margin: 4px 0; }
a { color: var(--accent); }
.small { font-size: 12.5px; color: var(--muted); }
.center { text-align: center; padding: 0 16px 24px; }
.status { color: #e7b85a; }
.status.ok, .ok { color: var(--ok); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; }

button {
  background: #1a2532; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font: inherit; cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.active { background: var(--accent); color: #04121f; border-color: var(--accent); }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }

/* Monitor */
.layout { display: grid; grid-template-columns: 1fr 340px; height: 100vh; }
.screen { display: flex; flex-direction: column; min-width: 0; background: #000; }
.views { flex: 1; min-height: 0; display: flex; }
.us-wrap { position: relative; flex: 1; min-width: 0; }
.anat-wrap { position: relative; flex: 1; min-width: 0; border-left: 1px solid var(--line); background: #05080c; }
.anat-wrap[hidden], .anat-wrap [hidden] { display: none; }
#anat, #anat3d { position: absolute; inset: 0; width: 100%; height: 100%; }
#anat3d { background: #1b222b; cursor: grab; }
.anat3d-tip { position: absolute; pointer-events: none; padding: 3px 8px; border-radius: 4px; background: rgba(10,14,20,.85); color: #fff; font-size: 12px; font-weight: 600; }
.anat3d-tip[hidden] { display: none; }
.anat3d-tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; padding: 6px 12px;
  font-size: 12px; background: rgba(12,17,24,.72); border: 1px solid rgba(255,255,255,.08); border-radius: 8px; backdrop-filter: blur(6px); }
.anat3d-tools summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 2px 0; }
.anat3d-tools[open] summary { margin-bottom: 6px; }
.anat3d-tools .layers { display: flex; flex-direction: column; gap: 4px; padding-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,.1); }
.anat3d-tools .check { margin: 0; font-size: 12px; }
.anat3d-tools button { padding: 4px 8px; font-size: 12px; }
.anat3d-pin { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 14px)); padding: 4px 10px; border-radius: 4px;
  background: #fff; color: #111; font-size: 13px; font-weight: 700; box-shadow: 0 2px 10px rgba(0,0,0,.4); white-space: nowrap; }
.anat3d-pin::after { content: ''; position: absolute; left: 50%; top: 100%; width: 1px; height: 14px; background: #fff; }
.anat3d-pin[hidden] { display: none; }
.anat-title { position: absolute; left: 12px; top: 8px; margin: 0; font-size: 12px; color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13.5px; margin-top: 6px; }
.tag-list { padding-left: 16px; font-size: 12.5px; }
.tag-list li { margin: 6px 0; }
.tag-list code { font-size: 11px; color: var(--muted); word-break: break-all; }
.tag-list button { padding: 2px 8px; font-size: 12px; }
.us-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#us { image-rendering: auto; }
#overlay { cursor: grab; touch-action: none; }
.loading[hidden] { display: none; }
.hold-tip { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); width: min(600px, calc(100% - 32px)); z-index: 5;
  display: grid; grid-template-columns: minmax(0, 230px) 1fr; column-gap: 14px;
  background: rgba(18, 26, 35, 0.96); border: 1px solid var(--accent); border-radius: 10px; padding: 12px 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); }
.hold-tip[hidden] { display: none; }
.hold-tip h3 { margin: 0 0 6px; font-size: 15px; grid-column: 1 / -1; }
.hold-tip > :not(h3):not(img) { grid-column: 2; }
.hold-tip img { grid-column: 1; grid-row: 2 / span 4; display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #05080d; border-radius: 6px; }
.hold-tip ul { margin: 0 0 8px; padding-left: 18px; line-height: 1.45; }
.hold-tip .buttons { margin-top: 8px; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); pointer-events: none; }
.readout { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 8px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); background: var(--bg); }
.panel { overflow-y: auto; padding: 16px; border-left: 1px solid var(--line); }
.pair { display: flex; gap: 12px; align-items: center; }
.qr { width: 132px; height: 132px; flex: none; background: #fff; border-radius: 6px; }
.qr svg { width: 100%; height: 100%; display: block; }
.code { font: 600 22px/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.body { width: 100%; max-height: 200px; }
.torso { fill: #1a2532; stroke: var(--line); stroke-width: 2; }
.sternum { stroke: var(--line); stroke-width: 3; }
#spots circle { fill: #2b3c50; stroke: var(--accent); stroke-width: 2; cursor: pointer; }
#spots circle.active { fill: var(--accent); }
.findings label { display: block; padding: 2px 0; }
.slider { display: grid; grid-template-columns: 48px 1fr 56px; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; }
.help p { font-size: 13px; color: var(--muted); }
.help summary { cursor: pointer; color: var(--muted); }
.fatal { padding: 32px; }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .views { height: 70vh; flex: none; }
  .panel { border-left: 0; }
}

/* Handy */
body.probe { padding: 0 12px; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.probe-head { display: flex; justify-content: space-between; padding: 10px 4px calc(10px + env(safe-area-inset-bottom)); font-weight: 600; }
.pair-form { display: flex; gap: 8px; }
.pair-form input { flex: 1; min-width: 0; background: #0b1016; color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 600 18px ui-monospace, monospace; }
.big { width: 100%; padding: 16px; font-size: 17px; margin-bottom: 12px; }
.grid2, .grid3, .grid4 { display: grid; gap: 6px; }
.grid2 { grid-template-columns: 1fr 1fr; }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.grid4 { grid-template-columns: repeat(4, 1fr); }
.probe button { padding: 12px 6px; }
.cam-preview { width: 100%; max-height: 40vh; object-fit: contain; border-radius: 8px; background: #000; display: block; margin: 6px 0; }
.probe-view { display: block; width: 100%; flex: 1; min-height: 0; touch-action: none; user-select: none; }
.probe-label { fill: #8797a8; font-size: 10px; font-family: system-ui, sans-serif; }
.probe-label.dark { fill: #2c3a48; }
.probe-label.tiny { font-size: 8.5px; }
.probe-label.strong { fill: #1c2631; font-size: 13px; font-weight: 600; }
.power { cursor: pointer; }
.power.on circle { filter: drop-shadow(0 0 6px #4fd18b); }
.face-hint { margin: 0 0 4px; padding: calc(6px + env(safe-area-inset-top)) 0 6px; text-align: center; font-size: 12px; color: var(--accent); border-bottom: 2px solid var(--accent); }
.probe-types { margin: 0 0 4px; }
.probe-types button { padding: 8px 4px; }
.probe-name { text-align: center; font-weight: 600; margin: 0 0 12px; }
.huge { width: 100%; padding: 28px 16px; font-size: 22px; font-weight: 600; margin-bottom: 12px; }
.pad { height: 150px; border: 1px dashed var(--line); border-radius: 10px; display: grid; place-items: center; text-align: center; padding: 16px; color: var(--muted); font-size: 13px; touch-action: none; user-select: none; }

.fan-src { position: absolute; left: 10px; top: 28px; margin: 0; }
.fan-src[hidden] { display: none; }
.fan-src button { padding: 4px 9px; font-size: 12.5px; }
.experimental h3 { font-size: 13px; margin: 14px 0 4px; }
.experimental summary { cursor: pointer; color: var(--muted); }
