/* =================================================================
   RIDERCAM · Bimanual Teleoperation Dataset
   Layout & visual language adapted from sampledata.synjuku.ai
   ================================================================= */

:root {
  --bg:         #2b3a53;   /* sea foam — cool off-white */
  --surface:    #34455f;   /* slight lift */
  --rule:       rgba(215,214,210,0.16);   /* hairline dividers */
  --rule-2:     rgba(215,214,210,0.30);   /* heavier rule */
  --ink:        #d7d6d2;   /* deep navy text */
  --ink-2:      #a4b1bc;   /* muted slate */
  --ink-3:      rgba(164,177,188,0.62);   /* dim cool gray */
  --accent:     #7a9ec1;   /* primary ocean blue (was red) */
  --accent-2:   #4d81b0;   /* deeper hover */
  --accent-soft:rgba(122,158,193,0.20);   /* soft wash for active rows */
  --teal:       #67b3c2;   /* secondary accent — used for ACTION line */
  --annot-bg:   #222f44;   /* deep ocean — annotation panel */
  --annot-rule: rgba(215,214,210,0.12);
  --mono: 'DM Mono', ui-monospace, SF Mono, Menlo, monospace;
  --sans: 'DM Sans', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --display: 'Bricolage Grotesque', 'Noto Sans SC', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

/* ============= Access gate ============= */
html.access-locked body { overflow: hidden; }
html.access-locked body > *:not(#accessGate) { visibility: hidden; }
.access-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--annot-bg);
  background-image:
    radial-gradient(ellipse at 20% 30%, rgba(14, 111, 183, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(14, 157, 142, 0.12) 0%, transparent 50%);
  transition: opacity 0.32s ease;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
.access-gate.fade-out { opacity: 0; pointer-events: none; }
.access-gate-card {
  width: 100%;
  max-width: 420px;
  padding: 48px 40px;
  text-align: center;
  color: #fff;
}
.access-logo {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  margin-bottom: 8px;
}
.access-sub {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: #5C7186;
  text-transform: uppercase;
  margin-bottom: 36px;
}
.access-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.access-form.shake { animation: gateShake 0.35s ease; }
@keyframes gateShake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.access-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  letter-spacing: 1px;
  text-align: center;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.access-input::placeholder {
  color: #5C7186;
  letter-spacing: 0.5px;
}
.access-input:focus {
  border-color: #0E6FB7;
  background: rgba(14, 111, 183, 0.08);
}
.access-submit {
  width: 100%;
  padding: 13px 16px;
  background: var(--accent);
  color: #fff;
  border: 0;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.access-submit:hover { background: var(--accent-2); }
.access-error {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #E07856;
  height: 16px;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.access-error.show { opacity: 1; }
.access-hint {
  font-size: 12px;
  color: #5C7186;
  margin-top: 18px;
}
.access-hint a {
  color: #0E6FB7;
  text-decoration: none;
}
.access-hint a:hover { text-decoration: underline; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button { font-family: inherit; cursor: pointer; background: none; border: 0; padding: 0; color: inherit; }
ol, ul { margin: 0; padding: 0; list-style: none; }

.mono { font-family: var(--mono); }

/* ============= ① Header ============= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.logo {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  display: inline-block;
}
.logo .dot { color: var(--accent); }
.logo:hover { text-decoration-color: var(--accent); }
.contact {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 18px;
  letter-spacing: 0.5px;
  transition: background 0.15s ease;
}
.contact:hover { background: var(--accent-2); }

/* ============= ② Stats strip (4 columns) ============= */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}
.stat {
  padding: 22px 24px 24px;
  border-right: 1px solid var(--rule);
}
.stat:last-child { border-right: 0; }
.stat-h {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
}
.stat p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.5;
}

/* ============= Scene coverage donut ============= */
.coverage {
  display: grid;
  grid-template-columns: 1.1fr 200px 1.4fr 1.5fr;
  gap: 28px;
  align-items: center;
  padding: 22px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.cov-left { min-width: 0; }
.cov-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.cov-total {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.cov-note {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
}
.cov-chart {
  display: flex;
  justify-content: center;
}
.donut { width: 160px; height: 160px; }
.donut path {
  transition: opacity 0.18s ease;
}
.donut path:hover { opacity: 0.78; cursor: pointer; }
.donut .donut-h {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  fill: var(--ink);
}
.donut .donut-sub {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  fill: var(--ink-2);
  letter-spacing: 1.2px;
}
.cov-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 12.5px;
}
.cov-legend li {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: 10px;
  align-items: center;
  padding: 3px 0;
  border-bottom: 1px solid var(--rule);
}
.cov-legend li:last-child { border-bottom: 0; }
.leg-swatch {
  width: 14px;
  height: 14px;
  display: inline-block;
}
.leg-name { color: var(--ink); font-weight: 500; }
.leg-pct {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 12px;
  min-width: 48px;
  text-align: right;
}
.leg-h {
  font-family: var(--mono);
  color: var(--ink-2);
  font-size: 12px;
  min-width: 56px;
  text-align: right;
}
.cov-meta {
  border-left: 1px solid var(--rule);
  padding-left: 22px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cov-meta-h {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.cov-meta-list {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.6;
}

/* ============= 3-col layout ============= */
.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 320px;
  min-height: calc(100vh - 60px - 130px);
}

/* ============= ③ ④ ⑤ Sidebar ============= */
.sidebar {
  border-right: 1px solid var(--rule);
  padding: 16px 0 28px;
  display: flex;
  flex-direction: column;
}
.toc {
  margin-bottom: 28px;
}
.toc-item {
  border-bottom: 1px solid var(--rule);
}
.toc-item:first-child { border-top: 1px solid var(--rule); }
.toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease;
}
.toc-head:hover { background: var(--surface); }
.chev {
  font-family: var(--mono);
  font-size: 18px;
  color: var(--ink-3);
  font-weight: 400;
  line-height: 1;
  transition: transform 0.18s ease;
}
.toc-item.expanded .chev { transform: rotate(90deg); color: var(--accent); }
.toc-item.expanded .toc-head { background: var(--surface); color: var(--accent); }
.toc-body {
  display: none;
  padding: 6px 18px 18px;
  background: var(--surface);
  border-top: 1px solid var(--rule);
}
.toc-item.expanded .toc-body { display: block; }

/* manifest inside What's Inside */
.manifest { display: grid; gap: 14px; }
.m-section {}
.m-h {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--accent);
  margin: 8px 4px 4px;
}
.m-section ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.m-section li {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  padding: 4px 6px;
  border-left: 2px solid var(--rule-2);
  font-size: 11px;
  line-height: 1.35;
}
.m-key {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  color: var(--ink);
  word-break: break-all;
}
.m-meta {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-2);
}
.m-p {
  margin: 4px 4px 0;
  font-size: 11.5px;
  color: var(--ink);
  line-height: 1.55;
}
.m-p:last-child { margin-bottom: 0; }
.m-section code {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--accent);
  background: var(--bg);
  padding: 0 3px;
}

.btn-secondary {
  margin: 0 24px;
  border: 1px solid var(--rule-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  background: transparent;
  transition: background 0.15s ease;
}
.btn-secondary:hover { background: var(--surface); }
.btn-icon {
  font-size: 14px;
  font-weight: 700;
}

.snippet-block {
  margin-top: auto;
  padding: 28px 24px 0;
  border-top: 1px solid var(--rule);
}
.btn-primary {
  width: 100%;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-start;
  border: 1px solid var(--ink);
  transition: background 0.15s ease;
}
.btn-primary:hover { background: var(--accent-2); }
.snippet-note {
  margin: 12px 2px 0;
  font-size: 11.5px;
  color: var(--ink-2);
  font-style: italic;
  line-height: 1.45;
}

/* ============= ⑥ ⑦ Tab rows ============= */
.content {
  padding: 0 28px 28px;
  min-width: 0;
}
.tab-row {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 0 14px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-row::-webkit-scrollbar { display: none; }
.tab-row:first-of-type { padding-top: 22px; }
.tab-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.tab {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  white-space: nowrap;
  color: var(--ink);
  border: 1.5px solid transparent;
  transition: all 0.12s ease;
}
.tab:hover { color: var(--accent); }
.tab.active {
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 600;
}
.tab.disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}
.tab.disabled:hover { color: var(--ink-3); }

/* ============= ⑧ Player grid ============= */
.player {
  margin-top: 18px;
}
.grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  grid-template-rows: 1fr 1fr;
  grid-template-areas:
    "head left"
    "head right";
  gap: 6px;
  background: var(--ink);
  padding: 6px;
  aspect-ratio: 16 / 9;
  max-height: 62vh;
}
.cell {
  position: relative;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cell.c-head  { grid-area: head; }
.cell.c-left  { grid-area: left; }
.cell.c-right { grid-area: right; }
.cell.c-depth { display: none; }

.cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cell-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.badge {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: var(--accent);
  padding: 4px 8px;
  text-transform: uppercase;
}

/* ============= proprio sparkline ============= */
.proprio {
  position: relative;
  margin-top: 6px;
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.proprio-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  background: var(--annot-bg);
  align-items: stretch;
  min-height: 56px;
}
.proprio-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  padding: 8px 12px;
  border-right: 1px solid var(--rule);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.3;
}
.proprio-sub {
  font-weight: 500;
  font-size: 10px;
  color: var(--ink-2);
  letter-spacing: 0.5px;
  text-transform: lowercase;
  margin-top: 2px;
}
.proprio-svg {
  width: 100%;
  height: 56px;
  display: block;
  background: var(--annot-bg);
}
.proprio-svg .arm-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
}
.proprio-svg .grip-pos {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}
.proprio-svg .grip-force {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  stroke-dasharray: 3 2;
  vector-effect: non-scaling-stroke;
  opacity: 0.55;
}
.proprio-svg .grid-line {
  stroke: var(--rule);
  stroke-width: 1;
}
.proprio-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--accent);
  left: 110px;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(14, 111, 183, 0.18);
}
.proprio-playhead::before {
  content: '';
  position: absolute;
  top: -3px; left: -3px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

/* ============= streams meta line ============= */
.streams-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 0 8px;
  border-bottom: 1px solid var(--rule);
}
.streams-key {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--accent);
}
.stream {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  border: 1px solid var(--rule-2);
  padding: 3px 8px;
  background: var(--surface);
}

/* ============= ⑨ Controls ============= */
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 0 4px;
}
.btn-pause {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 8px 16px;
  border: 1px solid var(--rule-2);
  color: var(--ink);
  background: transparent;
  min-width: 78px;
}
.btn-pause:hover { background: var(--surface); }

.scrub-wrap {
  flex: 1;
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}
.scrub-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--rule-2);
}
.scrub-fill {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: 0;
  background: var(--accent);
}
.scrub-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 111, 183, 0.22);
  pointer-events: none;
}
.span-marks {
  position: absolute;
  top: -4px;
  left: 0;
  right: 0;
  height: 12px;
  pointer-events: none;
}
.span-marks .mark {
  position: absolute;
  top: 0;
  height: 12px;
  width: 1px;
  background: var(--ink);
  opacity: 0.35;
}
.scrub {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
input#scrub {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 24px;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.time {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  min-width: 92px;
  text-align: right;
}

/* ============= Episode meta caption ============= */
.ep-meta {
  margin-top: 16px;
  padding: 14px 0 0;
  display: grid;
  gap: 6px;
}
.ep-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 18px;
  align-items: baseline;
  font-size: 13px;
  line-height: 1.5;
}
.ep-key {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-transform: uppercase;
}
.ep-val { color: var(--ink); }
.ep-val.mono { font-family: var(--mono); font-size: 12px; }

/* ============= ⑩ ⑪ ⑫ Annotation panel ============= */
.annotation {
  background: var(--annot-bg);
  color: #fff;
  border-left: 1px solid var(--annot-rule);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.annot-head {
  position: relative;
  padding: 22px 22px 18px 28px;
  border-bottom: 1px solid var(--annot-rule);
}
.annot-head::before {
  content: '';
  position: absolute;
  left: 16px; top: 22px;
  width: 3px; height: 18px;
  background: var(--accent);
}
.annot-title {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.annot-task {
  font-size: 14px;
  font-weight: 400;
  color: #D6E2EE;
  line-height: 1.5;
  margin-bottom: 10px;
}
.annot-count {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #5C7186;
}

/* span list */
.spans {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.spans::-webkit-scrollbar { width: 4px; }
.spans::-webkit-scrollbar-thumb { background: var(--annot-rule); }

.span {
  display: grid;
  grid-template-columns: 38px 60px 1fr;
  gap: 10px;
  padding: 9px 22px 9px 28px;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease;
  align-items: baseline;
}
.span:hover { background: #0F2740; }
.span-id {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.span-time {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  color: #D6E2EE;
}
.span-text {
  font-size: 12.5px;
  color: #90A4B5;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ⑫ active span — full styling */
.span.active {
  background: #102B47;
  border-left-color: var(--accent);
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  padding-top: 14px;
  padding-bottom: 16px;
}
.span.active .span-id { color: var(--accent); }
.span.active .span-time {
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}
.span.active .span-text {
  color: #fff;
  font-weight: 500;
  white-space: normal;
  font-size: 13px;
}
.span.active .span-text::before {
  content: 'LABEL: ';
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #918979;
  margin-right: 4px;
  display: inline;
}
.span-skill {
  display: none;
}
.span.active .span-skill {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 1px 6px;
  margin-right: 6px;
  vertical-align: middle;
  text-transform: uppercase;
}

/* ============= instruction stack panel (right rail bottom) ============= */
.instr-stack {
  border-top: 1px solid var(--annot-rule);
  padding: 18px 22px 22px 28px;
  background: #07172A;
  position: relative;
}
.instr-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.instr-head > span:first-child {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #fff;
  text-transform: uppercase;
}
.instr-head::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 22px;
  width: 3px;
  height: 14px;
  background: var(--teal);
}
.instr-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: #5C7186;
  letter-spacing: 0.5px;
}
.instr-levels {
  display: grid;
  gap: 8px;
}
.ilv {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.45;
}
.ilv-key {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #5C7186;
  text-transform: uppercase;
  white-space: nowrap;
}
.ilv-num {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 1px 5px;
  margin-right: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.ilv-val {
  color: #D6E2EE;
  font-size: 12.5px;
}
.ilv-val.mono {
  font-family: var(--mono);
  font-size: 11px;
  color: #90A4B5;
  word-break: break-all;
}
.ilv-skill {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--teal);
  border: 1px solid var(--teal);
  display: inline-block;
  padding: 2px 8px;
  width: fit-content;
}

/* highlight all key labels when a span is active */
.instr-stack.has-active .ilv-key { color: var(--accent-soft); }

/* ============= proprio dual-layer (state vs action) styles ============= */
.proprio-svg .arm-line.action {
  stroke: var(--teal);
  stroke-width: 0.7;
  opacity: 0.75;
  stroke-dasharray: 2 1.5;
}
.proprio-svg .arm-line.state {
  stroke: var(--accent);
  stroke-width: 0.9;
  opacity: 0.85;
}
.proprio-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--ink-2);
  text-transform: lowercase;
  margin-top: 4px;
}
.proprio-legend .lg {
  display: inline-block;
  width: 10px;
  height: 2px;
  margin-right: 2px;
  vertical-align: middle;
}
.proprio-legend .lg-state { background: var(--accent); }
.proprio-legend .lg-action {
  background: var(--teal);
  border-bottom: 1px dashed var(--teal);
  height: 0;
  border-bottom-style: dashed;
  border-bottom-width: 2px;
}

/* ============= Sidebar reference robot ============= */
.sidebar-robot {
  margin: 18px 24px 0;
  padding: 18px 4px 0;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sidebar-robot img {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  filter: drop-shadow(0 6px 16px rgba(11, 42, 72, 0.10));
  margin-bottom: 10px;
}
.sidebar-robot-note {
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--ink-3);
  text-align: center;
  letter-spacing: 0.2px;
}

/* ============= ego_stereo: coverage bar (replaces donut) ============= */
.coverage {
  grid-template-columns: 1.1fr 2.2fr 1.4fr;
}
.cov-bar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cov-bar-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-transform: uppercase;
}
.cov-bar-track {
  display: flex;
  height: 26px;
  width: 100%;
  background: var(--rule);
  border: 1px solid var(--rule-2);
  overflow: hidden;
}
.cov-seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0,0,0,0.15);
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s ease;
}
.cov-seg:hover { opacity: 0.78; cursor: default; }
.cov-bar-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 11px;
}
.cov-bar-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}
.cov-bar-legend .leg-swatch {
  width: 10px;
  height: 10px;
  display: inline-block;
}
.cov-bar-legend .leg-name { font-weight: 500; }
.cov-bar-legend .leg-pct {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 11px;
}

/* ============= ego_stereo: stacked stereo player ============= */
/* ============ RGBD player stage ============
   Two layouts, toggled per-episode by app.js on #stackWrap:
   .layout-sbs     → three-panel row  [ left eye | right eye | depth ]
   .layout-stacked → legacy top/bottom stereo video + depth PiP */
.rgbd-stage {
  position: relative;
  width: 100%;
  margin: 0 auto;
  background: #000;
}
.rgbd-cell { position: relative; background: #000; overflow: hidden; }
.rgbd-cell video { display: block; width: 100%; height: 100%; object-fit: cover; }

.eye-badge {
  position: absolute;
  left: 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  background: var(--accent);
  padding: 4px 8px;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 3;
  pointer-events: none;
}
.pip-label {
  position: absolute;
  left: 0;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #fff;
  background: rgba(14, 111, 183, 0.92);
  padding: 3px 6px;
  text-transform: uppercase;
  white-space: nowrap;
  z-index: 3;
}
.eye-divider { display: none; }

/* ---- Side-by-side episodes → RGBD triptych ----
   The single side-by-side stereo.mp4 (left|right) sits in one cell; depth is a
   third cell. Widths are tuned so all three panels share the same height:
   stereo 1896/756 ≈ 2.508 wide, depth 240/320 = 0.75 wide → 76.98% / 23.02%. */
.rgbd-stage.layout-sbs {
  display: flex;
  gap: 6px;
  background: transparent;
  align-items: stretch;        /* depth panel matches the eyes' height */
  justify-content: center;
}
.rgbd-stage.layout-sbs .stereo-cell {
  flex: none;
  width: calc((100% - 6px) * 0.7698);
  aspect-ratio: 1896 / 756;    /* drives the row height */
}
.rgbd-stage.layout-sbs .depth-cell {
  flex: none;
  width: calc((100% - 6px) * 0.2302);
  border: 1px solid rgba(14, 111, 183, 0.6);
}
/* depth aspect varies per rig (portrait 240×320 fisheye vs landscape 320×240 HMD) —
   contain so it's never distorted or cropped; portrait fills the cell exactly. */
.rgbd-stage.layout-sbs .depth-cell video { object-fit: contain; }
.rgbd-stage.layout-sbs .eye-badge.eye-left  { top: 10px; left: 10px; }
.rgbd-stage.layout-sbs .eye-badge.eye-right { top: 10px; left: calc(50% + 10px); }
.rgbd-stage.layout-sbs .eye-divider {
  display: block;
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 2px; margin-left: -1px;
  background: rgba(0, 0, 0, 0.85); z-index: 2; pointer-events: none;
}
.rgbd-stage.layout-sbs .pip-label { top: 0; }

/* ---- Legacy stacked episodes → top/bottom stereo + depth PiP ---- */
.rgbd-stage.layout-stacked {
  display: block;
  aspect-ratio: 1280 / 1944;     /* eye 1280×972 stacked */
  max-height: 78vh;
  max-width: calc(78vh * 1280 / 1944);
  overflow: hidden;
}
.rgbd-stage.layout-stacked .stereo-cell { position: absolute; inset: 0; }
.rgbd-stage.layout-stacked .eye-badge.eye-left  { top: 10px; }
.rgbd-stage.layout-stacked .eye-badge.eye-right { top: calc(50% + 10px); background: var(--teal); }
.rgbd-stage.layout-stacked .depth-cell {
  position: absolute;
  right: 10px;
  bottom: calc(50% + 10px);
  width: 26%;
  aspect-ratio: 320 / 240;
  border: 1px solid rgba(14, 111, 183, 0.7);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 3;
}
.rgbd-stage.layout-stacked .pip-label { bottom: 100%; }

/* sparkline colors for ego_stereo */
.proprio-svg .spark-line {
  fill: none;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}
.proprio-svg .spark-near { stroke: var(--teal); }
.proprio-svg .spark-med  { stroke: var(--accent); }
.proprio-svg .spark-far  { stroke: var(--ink-2); stroke-dasharray: 3 2; opacity: 0.7; }
.proprio-svg .spark-x    { stroke: #d44a4a; opacity: 0.85; }
.proprio-svg .spark-y    { stroke: #1ab07a; opacity: 0.85; }
.proprio-svg .spark-z    { stroke: var(--accent); opacity: 0.9; }
.proprio-svg .spark-accel { stroke: var(--accent); opacity: 0.75; }
.proprio-svg .spark-gyro  { stroke: var(--teal); opacity: 0.65; stroke-dasharray: 2 1.5; }

.proprio-legend .lg-near    { background: var(--teal); }
.proprio-legend .lg-med     { background: var(--accent); }
.proprio-legend .lg-far     { background: var(--ink-2); }
.proprio-legend .lg-imu-a   { background: var(--accent); }
.proprio-legend .lg-imu-g   { background: var(--teal); }
.proprio-legend .lg-x       { background: #d44a4a; }
.proprio-legend .lg-y       { background: #1ab07a; }
.proprio-legend .lg-z       { background: var(--accent); }

/* ============= responsive (basic) ============= */
@media (max-width: 1280px) {
  .coverage { grid-template-columns: 1fr 160px 1fr; gap: 20px; padding: 18px 24px; }
  .cov-meta { display: none; }
  .layout { grid-template-columns: 220px minmax(0, 1fr) 280px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--rule); }
}
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  /* mobile reading order: player/content first, then annotations, then the
     reference TOC last (so the video is reachable with far less scrolling). */
  .content    { order: 1; }
  .annotation { order: 2; border-left: 0; border-top: 1px solid var(--rule); }
  .sidebar    { order: 3; border-right: 0; border-top: 1px solid var(--rule); }
  .stats { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--rule); }

  /* coverage drops to a single column; episodes-in-catalog list is hidden — too noisy at this width */
  .coverage { grid-template-columns: 1fr; gap: 16px; padding: 18px 22px; }
  .cov-meta { display: none; }
  .cov-bar { gap: 6px; }
}

@media (max-width: 640px) {
  /* tighter chrome */
  .topbar    { padding: 12px 16px; }
  .logo      { font-size: 16px; }
  .contact   { font-size: 12px; padding: 8px 14px; }
  .stat      { padding: 13px 16px; }
  .stat-h    { font-size: 10.5px; margin-bottom: 5px; }
  .stat p    { font-size: 12.5px; line-height: 1.45; }
  .coverage  { padding: 16px 18px; }
  .cov-total { font-size: 22px; }
  .cov-bar-track { height: 18px; }
  /* 10 segments can't fit text on a phone-width bar — rely on the legend below */
  .cov-seg   { font-size: 0; }
  .content   { padding: 0 16px 22px; }

  /* tabs: tap-friendly + condensed */
  .tab-row     { gap: 12px; padding: 12px 0; }
  .tab-row:first-of-type { padding-top: 16px; }
  .tab-label   { font-size: 10px; letter-spacing: 1.2px; }
  .tab         { padding: 8px 12px; font-size: 12.5px; }

  /* compact badges so the LEFT/RIGHT labels don't collide on a narrow stereo panel */
  .eye-badge { font-size: 8px; padding: 2px 5px; letter-spacing: 0.4px; }
  .rgbd-stage.layout-sbs .eye-badge.eye-left  { top: 7px; left: 7px; }
  .rgbd-stage.layout-sbs .eye-badge.eye-right { top: 7px; left: calc(50% + 7px); }
  .pip-label { font-size: 8px; padding: 2px 5px; }

  /* Side-by-side episodes on phone: stack the full L|R pair over the depth panel
     (a 3-column row is too cramped on a narrow viewport). */
  .rgbd-stage.layout-sbs {
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }
  .rgbd-stage.layout-sbs .stereo-cell {
    flex: 0 0 auto;
    width: 100%;
    aspect-ratio: 1896 / 756;
  }
  .rgbd-stage.layout-sbs .depth-cell {
    flex: 0 0 auto;
    width: 42%;
    aspect-ratio: 240 / 320;
  }

  /* Legacy stacked episodes on phone: show only the LEFT (top) eye. */
  .rgbd-stage.layout-stacked {
    aspect-ratio: 1280 / 972;
    max-height: 55vh;
    max-width: 100%;
  }
  .rgbd-stage.layout-stacked .stereo-cell video {
    height: 200%;
    object-fit: cover;
    object-position: top center;
  }
  .rgbd-stage.layout-stacked .eye-badge.eye-right { display: none; }
  .rgbd-stage.layout-stacked .depth-cell { bottom: 8px; right: 8px; width: 32%; }

  /* sparkline labels narrower so the chart has room */
  .proprio-row    { grid-template-columns: 90px 1fr; min-height: 50px; }
  .proprio-label  { padding: 6px 8px; font-size: 9.5px; }
  .proprio-sub    { font-size: 9px; }
  .proprio-legend { font-size: 9px; }
  .proprio-playhead { left: 90px; }
  .proprio-svg    { height: 50px; }

  /* streams pills wrap two-per-row max */
  .streams-line { gap: 6px 10px; padding: 10px 0 6px; }
  .streams-key  { font-size: 10px; }
  .stream       { font-size: 10.5px; padding: 2px 6px; }

  /* controls — make scrub thumb easier to grab */
  .controls   { gap: 10px; padding: 10px 0 4px; }
  .btn-pause  { font-size: 11px; padding: 9px 14px; min-width: 70px; }
  .scrub-thumb { width: 18px; height: 18px; box-shadow: 0 0 0 3px rgba(14,111,183,0.28); }
  .time       { font-size: 12px; min-width: 84px; }

  /* episode meta: stack key over value (the long episode id needed somewhere to wrap) */
  .ep-meta { padding: 12px 0 0; }
  .ep-row  { grid-template-columns: 1fr; gap: 2px; padding-bottom: 4px; }
  .ep-key  { font-size: 10.5px; }
  .ep-val  { font-size: 12.5px; }
  .ep-val.mono { font-size: 11.5px; word-break: break-all; }

  /* annotation panel: a bit more readable on mobile */
  .annot-head    { padding: 18px 18px 14px 22px; }
  .annot-task    { font-size: 13.5px; }
  .span          { grid-template-columns: 32px 56px 1fr; padding-left: 22px; padding-right: 16px; }
  .span-id       { font-size: 11.5px; }
  .span-time     { font-size: 11.5px; }
  .span-text     { font-size: 12px; }
  .instr-stack   { padding: 16px 18px 18px 22px; }
  .ilv           { grid-template-columns: 78px 1fr; gap: 8px; font-size: 11.5px; }
  .ilv-key       { font-size: 9.5px; }
  .ilv-val       { font-size: 12px; }

  /* sidebar TOC tighter */
  .toc-head { padding: 12px 18px; font-size: 13px; }
  .toc-body { padding: 4px 14px 14px; }
}

/* dark-Mat retheme: display face on big headings */
.logo, .access-logo, .cov-total, .donut .donut-h { font-family: var(--display); font-weight: 700; letter-spacing: -0.015em; }

/* =================================================================
   SIX-CAMERA RIG — rig switcher + 3x2 grid stage + camera-visibility
   roll + metric 3D trajectory canvas + reprojection verification band.
   Everything here is additive; the stereo rig's markup is untouched.
   ================================================================= */

/* ---- rig switcher ---- */
.rig-switch {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 32px; border-bottom: 1px solid var(--rule); background: var(--surface);
}
.rig-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-3);
}
.rig-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em;
  padding: 7px 15px; border: 1px solid var(--rule-2); background: transparent;
  color: var(--ink-2); cursor: pointer; transition: all .18s;
}
.rig-btn:hover { color: var(--accent); border-color: var(--accent); }
.rig-btn.active { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.rig-note { font-size: 12px; color: var(--ink-3); margin-left: auto; }

/* rig visibility — driven by data-rig on <body> */
body[data-rig="stereo"] [data-rig="six"] { display: none !important; }
body[data-rig="six"] [data-rig="stereo"] { display: none !important; }

/* ---- 3x2 six-camera grid stage ---- */
.sixstage { position: relative; background: #000; border: 1px solid var(--rule); }
.sixstage video { display: block; width: 100%; height: auto; }
.sixstage-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; color: var(--ink);
  background: rgba(15,22,35,0.74); padding: 3px 8px; border: 1px solid var(--rule-2);
}
.sixstage-note {
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  padding: 6px 2px 0; letter-spacing: 0.03em;
}

/* ---- per-camera 2D observation visibility roll ---- */
.camvis { border: 1px solid var(--rule); border-top: none; background: var(--annot-bg); padding: 10px 12px; }
.camvis-h {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--ink-3);
  display: flex; justify-content: space-between; gap: 10px 18px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.camvis-row { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.camvis-name {
  font-family: var(--mono); font-size: 9px; color: var(--ink-2);
  width: 104px; flex: none; text-align: right;
}
.camvis-track { flex: 1; height: 13px; position: relative; background: rgba(122,158,193,0.07); }
.camvis-track canvas { display: block; width: 100%; height: 100%; }
.camvis-legend { font-family: var(--mono); font-size: 9px; color: var(--ink-3); margin-top: 7px; }

/* ---- metric 3D trajectory canvas ---- */
.traj3d { border: 1px solid var(--rule); border-top: none; background: var(--annot-bg); padding: 10px 12px 12px; }
.traj3d-h {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; color: var(--ink-3);
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px;
}
.traj3d-h b { color: var(--ink-2); font-weight: 600; }
.traj3d-canvas-wrap { position: relative; background: #0c1420; border: 1px solid var(--annot-rule); }
.traj3d-canvas-wrap canvas { display: block; width: 100%; height: 260px; cursor: grab; }
.traj3d-canvas-wrap canvas:active { cursor: grabbing; }
.traj3d-hint {
  position: absolute; right: 8px; bottom: 6px; font-family: var(--mono);
  font-size: 9px; color: var(--ink-3); pointer-events: none;
}
.traj3d-read {
  display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px;
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
}
.traj3d-read b { color: var(--ink); font-weight: 500; }
.tr-l { color: #67b3c2; } .tr-r { color: #e0a45c; }

/* ---- semantic segment chips in the right rail ---- */
.seg-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.seg-chip {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.04em;
  padding: 2px 6px; border: 1px solid var(--annot-rule); color: var(--ink-3);
}
.span.active .seg-chip { border-color: var(--accent-soft); color: var(--accent); }
.seg-zh { display: block; font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.span.active .seg-zh { color: var(--ink); }

/* ---- reprojection verification band ---- */
.verify-band { padding: 34px 32px 42px; border-top: 1px solid var(--rule); }
.verify-h { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.verify-t { font-size: 14px; color: var(--ink-2); max-width: 780px; margin-bottom: 20px; line-height: 1.6; }
.verify-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 26px; align-items: start; }
.verify-code {
  font-family: var(--mono); font-size: 11px; line-height: 1.7; color: var(--ink-2);
  background: var(--annot-bg); border: 1px solid var(--rule); padding: 14px 16px;
  overflow-x: auto; white-space: pre;
}
.vtable { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
.vtable th {
  text-align: right; color: var(--ink-3); font-weight: 500; padding: 5px 8px;
  border-bottom: 1px solid var(--rule-2); letter-spacing: 0.06em;
}
.vtable th:first-child { text-align: left; }
.vtable td { text-align: right; color: var(--ink); padding: 5px 8px; border-bottom: 1px solid var(--rule); }
.vtable td:first-child { text-align: left; color: var(--ink-2); }
.vtable tr.hi td { color: var(--accent); }
.verify-note { font-size: 12px; color: var(--ink-3); margin-top: 12px; line-height: 1.6; }

@media (max-width: 1100px) {
  .verify-grid { grid-template-columns: 1fr; }
  .rig-switch { padding: 12px 18px; }
  .rig-note { margin-left: 0; width: 100%; }
  .camvis-name { width: 78px; }
}

/* =================================================================
   SEMANTIC BIMANUAL — additions
   Everything above is ego_stereo's stylesheet, unchanged, so the
   chrome is identical. The only genuinely new component is the
   per-arm role track: two .proprio rows whose lanes carry labelled
   segment blocks instead of a signal trace, because the two arms
   hold different roles at the same time and a single track cannot
   show that overlap.
   ================================================================= */

.lane-track {
  position: relative;
  height: 56px;
  background: var(--annot-bg);
  cursor: pointer;
  overflow: hidden;
}
.lane-seg {
  position: absolute;
  top: 8px;
  height: 40px;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: var(--accent);
  border: 0;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.12s ease;
}
.lane-seg.anchor { background: var(--teal, #0E9D8E); color: #04241F; }
.lane-seg.ghost {
  opacity: 0.5;
  justify-content: center;
  padding-left: 0;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.5px;
}
.lane-seg:hover { filter: brightness(1.1); }
.lane-seg.active { outline: 2px solid #fff; outline-offset: -2px; }
.lane-scoop {
  position: absolute;
  bottom: 8px;
  height: 4px;
  background: #7FD4CC;
  pointer-events: none;
  z-index: 2;
}
.lane-handover {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(14, 157, 142, 0.15);
  border-left: 1px solid var(--teal, #0E9D8E);
  border-right: 1px solid var(--teal, #0E9D8E);
  pointer-events: none;
  z-index: 1;
}
.lane-legend {
  display: flex;
  gap: 22px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0 0 110px;
}
.lane-legend div { display: flex; gap: 7px; align-items: center; }
.lane-legend i { display: block; width: 20px; height: 4px; background: #7FD4CC; }
.lane-legend i.band {
  width: 12px; height: 12px; background: rgba(14, 157, 142, 0.15);
  border-left: 1px solid var(--teal, #0E9D8E); border-right: 1px solid var(--teal, #0E9D8E);
}
.lane-legend span { font-family: var(--mono); font-size: 10px; color: var(--ink-2); letter-spacing: 0.5px; }
.lane-legend .note { color: var(--ink-3); }

.span.overlap-hint { border-left-color: var(--teal, #0E9D8E); }
.ilv-val.derived { color: #90A4B5; font-size: 11.5px; line-height: 1.5; }

@media (max-width: 1180px) {
  .lane-legend { padding-left: 0; }
}

/* Three equal 4:3 camera panels — the head camera and one per wrist.
   The flex/sizing rules live with the subtitle block below, because the
   caption and the frame are one column now. */
.rgbd-stage.layout-tri .rgbd-cell.is-acting { outline: 2px solid var(--accent); outline-offset: -2px; }
.cell-foot {
  position: absolute;
  left: 10px; bottom: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.5px;
  color: #fff; background: rgba(11, 42, 72, 0.78); padding: 3px 7px;
  z-index: 2;
}

/* =================================================================
   Primitive subtitles — ABOVE each frame, not over it.
   The wrist cameras are small; an overlaid caption covered most of
   the picture it was describing, so each camera is now a column of
   [caption][video] and the caption costs no image area at all.
   ================================================================= */
.cam-col { display: flex; flex-direction: column; min-width: 0; }
.rgbd-stage.layout-tri { display: flex; gap: 6px; background: transparent; align-items: stretch; }
.rgbd-stage.layout-tri .cam-col { flex: 1 1 0; }
.rgbd-stage.layout-tri .rgbd-cell { width: 100%; aspect-ratio: 4 / 3; }

.prim-sub {
  display: none;
  flex-direction: column; gap: 2px;
  background: var(--annot-bg);
  border-bottom: 2px solid var(--accent);
  padding: 7px 9px 6px;
}
.prim-sub.show { display: flex; }
.prim-sub.ps-pre_pick         { border-bottom-color: #9FC0DE; }
.prim-sub.ps-pick             { border-bottom-color: #0E9D8E; }
.prim-sub.ps-transport        { border-bottom-color: #7A9EC1; }
.prim-sub.ps-place_and_return { border-bottom-color: #5C7186; }
/* a camera with nothing to say keeps the column height aligned */
.prim-sub.idle { display: flex; visibility: hidden; }

.ps-line {
  font-size: 11.5px; font-weight: 600; color: #fff; line-height: 1.35;
  letter-spacing: 0.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.7em;
}
/* one line, always — a caption that wraps to two pushes its own frame down and
   the three videos stop sharing a top edge */
.ps-meta {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: nowrap; overflow: hidden; white-space: nowrap;
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.4px; color: #90A4B5;
  /* fixed, not min: the bordered confidence/contact chips are taller than
     plain text, so a content-sized row makes the three frames start at
     different heights */
  height: 16px;
}
.ps-group { color: #9FC0DE; }
.ps-conf { border: 1px solid; padding: 1px 5px; letter-spacing: 0.7px; }
.ps-conf-measured { color: #9FE1CB; border-color: #1D9E75; }
.ps-conf-derived  { color: #F0C987; border-color: #B98A3C; }
.ps-conf-implicit { color: #90A4B5; border-color: #2F5578; }
.ps-contact {
  font-family: var(--mono); font-size: 8px; letter-spacing: .5px; color: #C8B8E8;
  border: 1px dashed rgba(200, 184, 232, .5); padding: 1px 5px;
}
.ps-ext { color: #0A1F36; background: #7a9ec1; padding: 1px 5px; letter-spacing: 0.7px; }
.ps-track { width: 100%; height: 2px; background: rgba(255, 255, 255, 0.16); margin-top: 3px; }
.ps-fill  { height: 2px; width: 0; background: #fff; }

.cam-col[data-cam="front"] .prim-sub { border-bottom-color: var(--accent); }

@media (max-width: 900px) {
  .rgbd-stage.layout-tri { flex-wrap: wrap; }
  .rgbd-stage.layout-tri .cam-col { flex: 1 1 100%; }
  .ps-line { font-size: 12.5px; -webkit-line-clamp: 3; min-height: 0; }
  .ps-meta { font-size: 9px; flex-wrap: wrap; white-space: normal; height: auto; min-height: 16px; }
}

/* =================================================================
   Inventory band — what stands behind the sample.
   ================================================================= */
.inventory {
  padding: 30px 32px 34px;
  border-top: 1px solid var(--rule);
  background: var(--surface);
}
.inv-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 28px; flex-wrap: wrap; margin-bottom: 22px;
}
.inv-total {
  font-family: var(--display, var(--sans)); font-size: 34px; font-weight: 700;
  color: var(--ink); line-height: 1; letter-spacing: -0.02em;
}
.inv-total span { font-size: 15px; font-weight: 500; color: var(--ink-2); margin-left: 8px; }
.inv-lede { font-size: 13.5px; color: var(--ink-2); line-height: 1.6; max-width: 620px; }
.inv-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
}
.inv-cell { background: var(--surface); padding: 16px 16px 18px; min-width: 0; }
.inv-num {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: var(--ink-3); letter-spacing: 1px;
}
.inv-name {
  font-size: 14px; font-weight: 600; color: var(--ink);
  margin: 5px 0 7px; letter-spacing: -0.01em;
}
.inv-zones { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin: 0; }
.inv-foot {
  margin-top: 16px; font-size: 12px; color: var(--ink-3); line-height: 1.6;
}

@media (max-width: 1180px) { .inv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .inv-grid { grid-template-columns: 1fr; }
  .inventory { padding: 24px 16px 28px; }
  .inv-total { font-size: 28px; }
}

/* the role-split headline is a duration, not a share */
.cov-unit { font-size: 0.5em; font-weight: 500; color: var(--ink-2); margin-left: 3px; }

/* inventory: share bar + per-family figures */
.inv-bar { height: 22px; margin-bottom: 20px; }
.inv-bar .cov-seg { font-size: 9.5px; }
.inv-head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.inv-share { font-family: var(--mono); font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.inv-share b { color: var(--ink); font-size: 13px; font-weight: 700; }
.inv-name i {
  display: inline-block; width: 9px; height: 9px; margin-right: 7px;
  vertical-align: baseline;
}

/* ---- unified RICH LABELS subtitle bar (richsub.js) ---- */
#richSub.rich-sub-above {
  position: static; transform: none;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin: 0 0 10px; min-height: 30px; pointer-events: none;
}
#richSub .rs-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(8, 16, 26, 0.85); border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 7px; padding: 6px 13px;
  font-family: var(--mono);
  font-size: 13px; letter-spacing: 0.06em; color: #fff; white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
#richSub .rs-hand {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.55);
}
#richSub .rs-text { text-transform: none; }
@media (max-width: 720px) {
  #richSub.rich-sub-above { gap: 5px; }
  #richSub .rs-chip { font-size: 10px; padding: 3px 8px; }
}

/* superseded by the unified subtitle bar above the stage */
.prim-sub { display: none !important; }

/* ============= Parcel-line tab row ============= */
/* A second tab row for the policy-rollout clips. Wrapping, not scrolling: a
   hidden horizontal scrollbar is how tabs go missing without anyone noticing. */
.tab-row-line { padding-top: 10px; flex-wrap: wrap; overflow: visible; }
.tab-row-line .tabs { flex-wrap: wrap; }
.tab-row-line .tab-label { display: flex; flex-direction: column; gap: 2px; }
.tab-note {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 400;
  letter-spacing: 0.4px;
  color: var(--ink-3);
  text-transform: none;
}

/* ============= Primitive track + legend ============= */
/* These rows were built by app.js from the start but never styled, so every
   sample showed two empty PRIMITIVES lanes. One block per primitive, coloured
   by phase group; zero-length rows stay as a 0.25% sliver so nothing is hidden. */
.prim-track {
  position: relative;
  height: 56px;
  background: var(--annot-bg);
  cursor: pointer;
  overflow: hidden;
}
.prim {
  position: absolute;
  top: 18px;
  height: 20px;
  border: 0;
  padding: 0;
  cursor: pointer;
  opacity: 0.9;
  background: #4d81b0;
  border-right: 1px solid rgba(0, 0, 0, 0.35);
  transition: filter 0.12s ease;
}
.prim.g-pre_pick         { background: #4d81b0; }
.prim.g-pick             { background: #0E9D8E; }
.prim.g-transport        { background: #7a9ec1; }
.prim.g-place_and_return { background: #5C7186; }
.prim.is-extension {
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.35) 0 3px, transparent 3px 6px);
}
.prim:hover { opacity: 1; filter: brightness(1.15); }
.prim.active { outline: 2px solid #fff; outline-offset: -2px; opacity: 1; z-index: 2; }
.prim-legend {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  padding: 6px 0 0 110px;
}
.prim-legend div { display: flex; gap: 7px; align-items: center; }
.prim-legend i { display: block; width: 14px; height: 10px; }
.prim-legend i.hatch {
  background: #7a9ec1;
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.35) 0 3px, transparent 3px 6px);
}
.prim-legend span { font-family: var(--mono); font-size: 10px; color: var(--ink-2); letter-spacing: 0.5px; }
@media (max-width: 1180px) { .prim-legend { padding-left: 0; } }

/* =================================================================
   Hand UMI additions
   ================================================================= */
.tab-row .tab-note { font-weight: 500; font-size: 10px; color: var(--ink-3); letter-spacing: 0.5px; margin-left: 8px; text-transform: none; }

/* stage: ego view + wrist stack */
.umi-stage { display: grid; grid-template-columns: 60fr 40fr; gap: 6px; background: transparent; }
.umi-stage .rgbd-cell { aspect-ratio: 4 / 3; }
.umi-stack { display: grid; grid-template-rows: 1fr 1fr; gap: 6px; }
.umi-stack .rgbd-cell { aspect-ratio: auto; }
.umi-stage .rgbd-cell.is-acting { outline: 2px solid var(--accent); outline-offset: -2px; }
.cell-foot {
  position: absolute; right: 8px; bottom: 8px; z-index: 3;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.8px;
  color: #fff; background: rgba(0,0,0,0.55); padding: 3px 7px; text-transform: uppercase; pointer-events: none;
}
.badge.teal { background: var(--teal); color: #04241F; }
.badge.dim { background: rgba(0,0,0,0.6); }

/* tactile strip */
.tact-head {
  display: flex; align-items: center; gap: 14px; padding: 12px 0 6px; margin-top: 6px;
}
.tact-title { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--accent); }
.tact-sub { font-size: 12px; color: var(--ink-3); }
.tact-modes { margin-left: auto; display: flex; gap: 4px; }
.tact-mode {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 1px;
  color: var(--ink-2); border: 1px solid var(--rule-2); padding: 5px 10px; background: var(--surface);
}
.tact-mode.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tact-strip { position: relative; background: #000; aspect-ratio: 1536 / 288; overflow: hidden; }
.tact-strip video { display: block; width: 100%; height: 100%; object-fit: cover; }
.tact-labels { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(4, 1fr); pointer-events: none; z-index: 3; }
.tact-label { position: relative; border-left: 1px solid rgba(255,255,255,0.18); }
.tact-label:first-child { border-left: 0; }
.tact-label .badge { position: absolute; top: 8px; left: 8px; }
.tact-label .tl-force {
  position: absolute; right: 8px; bottom: 8px; font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: #fff; background: rgba(0,0,0,0.55); padding: 3px 7px; letter-spacing: 0.5px;
}
.tact-label .tl-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.08); }
.tact-label .tl-fill { height: 100%; width: 0; background: var(--teal); transition: width 60ms linear; }
.tact-label.right .tl-fill { background: var(--accent); }
.tact-label.hot .tl-force { background: var(--accent); }
.tact-label.left.hot .tl-force { background: var(--teal); color: #04241F; }

/* signal rows */
.proprio-svg .sig-left  { fill: none; stroke: var(--teal); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.proprio-svg .sig-right { fill: none; stroke: var(--accent); stroke-width: 1.3; vector-effect: non-scaling-stroke; }
.proprio-svg .sig-left.pad2  { stroke-dasharray: 3 2; opacity: 0.85; }
.proprio-svg .sig-right.pad2 { stroke-dasharray: 3 2; opacity: 0.85; }
.proprio-svg .band-left  { fill: rgba(103,179,194,0.16); }
.proprio-svg .band-right { fill: rgba(122,158,193,0.18); }
.proprio-svg .task-win { fill: none; stroke: var(--rule-2); stroke-width: 1; stroke-dasharray: 2 3; }
.proprio-svg .axis-txt { font-family: var(--mono); font-size: 8px; fill: var(--ink-3); }
.sig-legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 8px 0 0 110px; }
.sig-legend div { display: flex; gap: 7px; align-items: center; }
.sig-legend i { display: block; width: 20px; height: 3px; background: var(--accent); }
.sig-legend i.teal { background: var(--teal); }
.sig-legend i.dash { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); color: var(--accent); }
.sig-legend i.dash.teal { color: var(--teal); background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.sig-legend i.band { width: 20px; height: 10px; background: rgba(122,158,193,0.25); }
.sig-legend span { font-family: var(--mono); font-size: 10px; color: var(--ink-2); letter-spacing: 0.5px; }

/* event lane */
.lane-track { position: relative; height: 34px; background: var(--annot-bg); cursor: pointer; overflow: hidden; }
.lane-seg {
  position: absolute; top: 5px; bottom: 5px; background: var(--accent); color: #fff;
  font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.5px;
  padding: 0 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; line-height: 24px;
}
.lane-seg.teal { background: var(--teal); color: #04241F; }
.lane-seg:hover { filter: brightness(1.1); }
.lane-seg.active { outline: 2px solid #fff; outline-offset: -2px; }

/* right rail: trajectory map + live readouts */
.traj-wrap { padding: 14px 18px 6px; border-bottom: 1px solid var(--annot-rule); }
.traj-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.traj-title { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 1.5px; color: var(--accent); }
.traj-sub { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); }
.traj-svg { width: 100%; aspect-ratio: 1 / 1; display: block; background: #1b2638; border: 1px solid var(--annot-rule); }
.traj-svg .tr-left  { fill: none; stroke: var(--teal); stroke-width: 1; opacity: 0.45; vector-effect: non-scaling-stroke; }
.traj-svg .tr-right { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0.55; vector-effect: non-scaling-stroke; }
.traj-svg .tr-head  { fill: none; stroke: var(--ink-3); stroke-width: 1; opacity: 0.5; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.traj-svg .tr-dot-left  { fill: var(--teal); }
.traj-svg .tr-dot-right { fill: var(--accent); }
.traj-svg .tr-dot-head  { fill: var(--ink-2); }
.traj-svg .tr-wall { stroke: var(--rule-2); stroke-width: 1; }
.traj-svg .tr-txt { font-family: var(--mono); font-size: 7px; fill: var(--ink-3); letter-spacing: 0.5px; }
.traj-legend { display: flex; gap: 14px; margin-top: 8px; }
.traj-legend div { display: flex; gap: 6px; align-items: center; font-family: var(--mono); font-size: 9.5px; color: var(--ink-2); }
.traj-legend i { width: 8px; height: 8px; border-radius: 50%; display: block; }

.live { padding: 12px 18px 16px; border-bottom: 1px solid var(--annot-rule); }
.live-h { font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: 1.5px; color: var(--accent); margin-bottom: 8px; display: flex; justify-content: space-between; }
.live-h span { color: var(--ink-3); font-weight: 500; }
.live-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.live-cell { background: #1b2638; padding: 8px 10px; border-left: 2px solid var(--accent); }
.live-cell.l { border-left-color: var(--teal); }
.live-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: 1px; color: var(--ink-3); text-transform: uppercase; }
.live-v { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--ink); margin-top: 2px; }
.live-v small { font-size: 10px; color: var(--ink-2); font-weight: 500; margin-left: 3px; }
.live-state { font-family: var(--mono); font-size: 9.5px; font-weight: 700; letter-spacing: 1px; margin-top: 3px; color: var(--ink-3); }
.live-state.on { color: var(--teal); }
.live-cell.r .live-state.on { color: var(--accent); }
.live-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; margin-top: 8px; }
.live-mini { background: #1b2638; padding: 6px 8px; }
.live-mini .live-v { font-size: 11.5px; }

.spans .span-force { font-family: var(--mono); font-size: 10px; color: var(--ink-2); margin-top: 3px; white-space: normal; display: none; }
.spans .span.active .span-force { display: block; }
.spans .span.active .span-text::before { content: none; }
.spans .span .span-skill { display: inline-block; font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 1px; color: var(--accent); border: 1px solid var(--accent); padding: 0 5px; margin-right: 6px; vertical-align: middle; }
.spans .span.active .span-skill { font-size: 9.5px; padding: 1px 6px; }
.sample-note { padding: 10px 18px 0; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

@media (max-width: 900px) {
  .umi-stage { grid-template-columns: 1fr; }
  .umi-stack { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  .umi-stack .rgbd-cell { aspect-ratio: 16 / 9; }
}
.spans .span { grid-template-columns: 30px 78px 1fr; padding-left: 22px; padding-right: 16px; }
.spans .span-time { white-space: nowrap; }
