/* BODYBAND / OP-BIO.1 — light hardware-console look */
:root {
  --base: #F5F5F3;
  --muted: #ECECE9;
  --card: #FFFFFF;
  --hairline: #D8D8D3;
  --border: #E5E5E2;
  --ink: #111111;
  --charcoal: #222222;
  --dim: #555552;
  --subtle: #6A6A66;      /* small labels: 4.5:1 or better on every panel colour */
  --cyan: #00A3FF;        /* lines, arcs and lights */
  --cyan-text: #0070C4;   /* the same blue, darkened so small text reads on white */
  --led: #10B981;
  --warn: #E11D48;
  --sans: Inter, -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --display: "Space Grotesk", Inter, "Segoe UI", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--base);
  background-image:
    linear-gradient(to right, rgba(0, 0, 0, 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--sans);
  font-feature-settings: "tnum" 1, "zero" 1;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.4; }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.dim { color: var(--subtle); }
.strong { color: var(--charcoal); font-weight: 500; }
.accent { color: var(--cyan-text); font-weight: 700; letter-spacing: 0.08em; }
.sep { width: 1px; height: 14px; background: var(--hairline); flex: none; }

/* ---- small parts ---- */
.led {
  width: 8px; height: 8px; border-radius: 1px; flex: none;
  background: var(--led); box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
}
.led.off { background: var(--subtle); box-shadow: none; }
.led.red { background: var(--warn); box-shadow: 0 0 4px rgba(225, 29, 72, 0.6); }
.sq { display: inline-block; width: 6px; height: 6px; background: var(--cyan); flex: none; }
.sq.dark { background: var(--ink); }
.sq.cy { background: var(--cyan); }
.sq.green { width: 4px; height: 4px; background: var(--led); }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 9px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--charcoal); background: var(--muted); border: 1px solid var(--border);
  padding: 4px 6px; white-space: nowrap;
}
.chip .led { width: 6px; height: 6px; }

/* ---- header ---- */
.bar.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--card); border-bottom: 1px solid var(--hairline); padding: 8px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo { font: 700 14px/1 var(--display); letter-spacing: -0.02em; }
.model { font: 400 10px/1 var(--mono); letter-spacing: 0.08em; color: var(--subtle); }
.specs { display: flex; align-items: center; gap: 10px; font: 400 10px/1 var(--mono); color: var(--dim); }
.specs b { color: var(--ink); font-weight: 500; }
.bars { display: flex; align-items: flex-end; gap: 2px; height: 12px; }
.bars i { width: 2px; background: var(--ink); height: 6px; }
.bars i:nth-child(2) { height: 10px; }
.bars i.cy { height: 12px; background: var(--cyan); }

/* segmented control */
.seg {
  display: flex; align-items: center; padding: 2px; border-radius: 2px;
  background: var(--muted); border: 1px solid var(--hairline);
}
.seg.light { background: var(--base); border-radius: 1px; }
.seg button {
  border: 0; background: transparent; color: var(--dim);
  font: 500 11px/1 var(--mono); letter-spacing: 0.04em; padding: 6px 14px; white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.seg button:hover:not(:disabled) { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.seg button[aria-pressed="true"]:disabled { opacity: 1; } /* the active source stays readable while locked */

/* ---- telemetry strip ---- */
.strip {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-bottom: 1px solid var(--hairline);
}
.cell { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 24px; }
.cell + .cell { border-left: 1px solid var(--hairline); }
.cell.col { flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; }
.cell-head { display: flex; align-items: center; gap: 8px; font-family: var(--mono); }
.cell-head.spread { justify-content: space-between; font-size: 10px; }
.ch { font: 700 9px/1 var(--mono); letter-spacing: 0.12em; color: var(--subtle); margin-right: 8px; }
.ch.strong { color: var(--ink); margin: 0 0 0 6px; }
.name { font: 700 10px/1 var(--mono); letter-spacing: 0.08em; }
.big { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.num { font: 700 36px/1 var(--display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.num.mid { font-size: 24px; width: 64px; }
.unit { font: 500 12px/1 var(--mono); color: var(--dim); }
.cell-side { text-align: right; display: grid; gap: 6px; justify-items: end; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 9px/1 var(--mono); letter-spacing: 0.12em; color: var(--charcoal);
  background: var(--base); border: 1px solid var(--border); padding: 4px 8px; white-space: nowrap;
}
#beatLed { background: var(--hairline); transition: background 0.25s; }
#beatLed.on { background: var(--warn); transition: none; }
.small { font: 400 9px/1.2 var(--mono); color: var(--dim); white-space: nowrap; }
.small b { color: var(--ink); }
.depth { display: flex; align-items: center; gap: 12px; }
.ladder {
  flex: 1; display: flex; gap: 2px; padding: 4px;
  background: var(--base); border: 1px solid var(--hairline);
}
.ladder i { flex: 1; height: 7px; border-radius: 0.5px; background: #E2E2DE; }
.ladder i.on { background: var(--ink); }
.ladder i.tip { background: var(--cyan); }

/* ---- main stage ---- */
.stage {
  flex: 1; min-height: 340px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 48px; overflow: hidden;
}

.module {
  flex: none; width: 192px; display: grid; gap: 14px; padding: 14px;
  background: var(--card); border: 1px solid var(--hairline); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  font-family: var(--mono);
}
.mod-cam { width: clamp(256px, 26vw, 380px); gap: 10px; padding: 12px; }
.mod-head {
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--hairline); padding-bottom: 8px;
}
.mod-head .ch { margin: 0; }
.mini-chip { font-size: 8px; letter-spacing: 0.08em; color: var(--subtle); background: var(--base); border: 1px solid var(--hairline); padding: 1px 4px; }
.mod-title { font-size: 12px; font-weight: 700; letter-spacing: -0.01em; }
.mod-sub { font-size: 10px; color: var(--dim); margin-top: 2px; }
.mod-sub.tiny { font-size: 8px; }
.mod-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  border-top: 1px solid var(--hairline); padding-top: 8px;
  font-size: 9px; letter-spacing: 0.08em; color: var(--dim);
}
.mod-foot.split > * { flex: 1; justify-content: center; text-align: center; }
.key {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 9px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); background: var(--base); border: 1px solid var(--hairline); padding: 5px 9px;
}
button.key:hover:not(:disabled) { background: var(--muted); }
.key.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.key.dark.off { background: var(--base); color: var(--charcoal); border-color: var(--hairline); }
.key.state .led { width: 6px; height: 6px; }
.key.state.live { background: var(--ink); color: #fff; border-color: var(--ink); }

/* rotary knob */
.knob-wrap { display: grid; justify-items: center; gap: 4px; }
.knob {
  position: relative; width: 80px; height: 80px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--base); border: 1px solid var(--hairline); box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
  --turn: -135deg;
}
.knob::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 1px dashed var(--border); }
.knob-mark { position: absolute; inset: 0; transform: rotate(var(--turn)); }
.knob-mark::after { content: ""; position: absolute; left: calc(50% - 1px); top: -4px; width: 2px; height: 12px; background: var(--ink); }
.knob-cap {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--hairline); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  font-size: 8px; font-weight: 700; white-space: nowrap;
}
.knob-scale { display: flex; justify-content: space-between; width: 96px; font-size: 8px; color: var(--subtle); }

/* note meter */
.meter { display: grid; gap: 6px; }
.meter-head { display: flex; justify-content: space-between; font-size: 8px; color: var(--subtle); }
.meter-head b { color: var(--ink); font-size: 10px; }
.meter-bar { height: 8px; background: var(--base); border: 1px solid var(--hairline); }
.meter-bar i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.12s; }
.meter-scale { display: flex; justify-content: space-between; font-size: 7px; color: var(--subtle); }

/* camera module */
.viewfinder {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 1px;
  display: grid; place-items: center;
  background: #0E1015; border: 1px solid var(--hairline); color: rgba(255, 255, 255, 0.22);
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 16px 16px;
}
.viewfinder svg { width: 96px; height: 96px; }
.viewfinder canvas {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transform: scaleX(-1);   /* mirrored, like looking in a mirror */
  filter: saturate(0.7);   /* slightly muted so the readouts stay the focus */
}
.viewfinder.live svg { display: none; } /* the outline figure gives way to the real picture */
/* keep the labels readable on top of a bright picture */
.viewfinder.live .vf-hint { background: rgba(14, 16, 21, 0.7); }
.viewfinder.live .vf-tag { color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.corner { position: absolute; width: 8px; height: 8px; border: 0 solid var(--cyan); }
.corner.tl { top: 4px; left: 4px; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: 4px; right: 4px; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: 4px; left: 4px; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: 4px; right: 4px; border-bottom-width: 2px; border-right-width: 2px; }
.vf-hint {
  position: absolute; left: 12px; right: 12px; top: 12px; padding: 4px 6px; text-align: center;
  font-size: 8px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--cyan); border: 1px dashed var(--cyan); background: rgba(0, 163, 255, 0.1);
}
.vf-tag { position: absolute; left: 18px; bottom: 4px; font-size: 7px; color: rgba(255, 255, 255, 0.5); }
.rows { display: grid; gap: 3px; border-top: 1px solid var(--border); padding-top: 6px; font-size: 8px; }
.rows div { display: flex; justify-content: space-between; }
.rows span { color: var(--subtle); }

/* camera check dialog */
.cc {
  width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0;
  border: 1px solid var(--hairline); border-radius: 2px;
  background: var(--card); color: var(--ink); font-family: var(--mono);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}
.cc::backdrop { background: rgba(245, 245, 243, 0.7); backdrop-filter: blur(3px); }
.cc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--hairline);
}
.cc-body { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; padding: 14px; }
.cc-view {
  position: relative; aspect-ratio: 4 / 3; overflow: hidden;
  background: #0E1015; border: 1px solid var(--hairline);
}
.cc-view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cc-guide {
  position: absolute; inset: 0; width: 100%; height: 100%;
  fill: none; stroke: var(--cyan); stroke-width: 0.8; stroke-dasharray: 3 2; opacity: 0.85;
}
.cc-msg {
  position: absolute; left: 8px; right: 8px; bottom: 8px; padding: 5px 6px; text-align: center;
  font-size: 9px; font-weight: 600; letter-spacing: 0.1em; color: #fff; background: rgba(14, 16, 21, 0.78);
}
.cc-msg.ok { color: #34D399; }
.cc-msg.bad { color: #FF8BA0; }
.cc-side h2 { margin: 0 0 8px; font: 600 16px/1.2 var(--display); letter-spacing: -0.01em; }
.cc-side ul { margin: 0 0 10px; padding-left: 16px; font: 400 11px/1.5 var(--sans); color: var(--charcoal); user-select: text; }
.cc-side li { margin-bottom: 6px; }
.cc-side .rows { font-size: 9px; }
.cc-tip { margin: 8px 0 0; font: 400 10px/1.4 var(--sans); color: var(--dim); }
.cc-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--hairline); background: var(--base);
}
.cc-foot .key { padding: 9px 14px; }
#ccFps.ok, #ccLight.ok { color: var(--led); }
#ccFps.bad, #ccLight.bad, #camFeed.bad { color: var(--warn); }
@media (max-width: 640px) { .cc-body { grid-template-columns: 1fr; } }

/* ---- dial ---- */
.dial-wrap { flex: 1; min-width: 0; display: grid; place-items: center; }
.dial {
  position: relative; display: grid; place-items: center;
  width: clamp(250px, min(46vw, calc(100vh - 300px)), 480px);
  aspect-ratio: 1; max-width: 100%;
}
.ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-text text { font: 600 9px var(--mono); fill: var(--subtle); }
#needle { transform-origin: 250px 250px; }
.plate {
  position: relative; width: 60%; aspect-ratio: 1;
  display: flex; flex-direction: column; justify-content: space-between; align-items: center;
  padding: 5%; text-align: center;
  background: var(--card); border: 1px solid var(--hairline); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  will-change: transform;
  container-type: inline-size;
}
.plate-row {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  font: 400 9px/1 var(--mono); color: var(--subtle);
}
.plate-row.top { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.plate-row.bottom { border-top: 1px solid var(--border); padding-top: 6px; font-size: 10px; color: var(--dim); }
.box { background: var(--base); border: 1px solid var(--hairline); padding: 3px 8px; font-weight: 700; color: var(--ink); }
.directive { font: 600 clamp(7px, 3.6cqw, 10px)/1 var(--mono); letter-spacing: 0.2em; color: var(--dim); }
.plate h1 {
  margin: 4px 0 0; font: 700 clamp(18px, 15cqw, 46px)/1 var(--sans); letter-spacing: -0.03em;
}
.wave { width: 100%; height: 28px; padding: 0 8px; overflow: visible; }

/* ---- footer ---- */
.deck { background: var(--card); border-top: 1px solid var(--hairline); }
.deck-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 10px 16px; }
.transport { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 1px;
  background: var(--card); border: 1px solid var(--hairline); transition: border-color 0.15s;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn:active { background: var(--muted); }
.icon-btn svg { width: 14px; height: 14px; fill: currentColor; }
.timer { display: flex; align-items: baseline; gap: 6px; font-family: var(--mono); font-size: 10px; color: var(--dim); }
.timer b { font-size: 12px; color: var(--ink); }
.cta {
  display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 2px;
  background: var(--ink); color: #fff; padding: 9px 16px;
  font: 600 11px/1 var(--mono); letter-spacing: 0.08em;
}
.cta:hover { background: var(--charcoal); }
.sub-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--base); border-top: 1px solid var(--hairline); padding: 5px 16px;
  font: 400 9px/1.2 var(--mono); color: var(--dim); text-transform: uppercase;
}
.sub-row > div { display: flex; align-items: center; gap: 8px; }
.bar-sep { color: var(--hairline); }
#subNotice { color: var(--ink); font-weight: 600; }

/* ---- smaller windows ---- */
@media (max-width: 1440px) { .mod-r { display: none; } } /* make room for the bigger camera */
@media (max-width: 1080px) { .mod-cam { display: none; } .stage { padding: 16px 24px; } }
@media (max-width: 820px) {
  .mod-l, .wide { display: none; }
  .strip { grid-template-columns: 1fr; }
  .cell + .cell { border-left: 0; border-top: 1px solid var(--hairline); }
  .cell { padding: 10px 16px; }
  .num { font-size: 28px; }
  .stage { padding: 16px; }
  .dial { width: clamp(240px, 80vw, 420px); }
  .seg { overflow-x: auto; max-width: 100%; }
}


/* ---- entrance and button feel ---- */

/* The console arrives once on load: readings first, then the dial and panels, then the controls.
   Only opacity and transform move, nothing pushes a neighbour. */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.bar.top, .strip, .stage > *, .deck { animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.strip { animation-delay: 0.08s; }
.stage > * { animation-delay: 0.18s; }
.stage > .dial-wrap { animation-delay: 0.26s; }
.deck { animation-delay: 0.34s; }

/* Buttons: step up 1px on hover (mouse only), sink 1px and shrink a touch when pressed. */
.cta, button.key, .icon-btn {
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
@media (hover: hover) and (pointer: fine) {
  .cta:hover, button.key:hover:not(:disabled), .icon-btn:hover { transform: translateY(-1px); }
}
.cta:active, button.key:active:not(:disabled), .icon-btn:active {
  transform: translateY(1px) scale(0.985);
  transition-duration: 0.09s;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Dark theme: easy on the eyes, less glare on the face while the camera reads it */
:root {
  --base: #0F1115;
  --muted: #181B21;
  --card: #14171C;
  --hairline: #2A2E36;
  --border: #22262D;
  --ink: #E6E7EA;
  --charcoal: #C9CBD1;
  --dim: #9BA0AA;
  --subtle: #8A8F99;
  --cyan-text: #4DB8FF;
  color-scheme: dark;
}
.seg button[aria-pressed="true"],
.key.dark,
.key.state.live,
.cta { color: #0F1115; }
.ladder i { background: #2A2E36; }
.ladder i.on { background: var(--ink); }
.cc::backdrop { background: rgba(0, 0, 0, 0.6); }
