/* =================================================================
   RIDERCAM · Outdoor Delivery Annotation Sample (Ego-POV)
   Inherits the teleop-humanoid visual language. Adapts the player
   to a single-camera layout + 2D bbox overlay + ego-state timeline.
   ================================================================= */

:root {
  --bg:         #EEF3F7;   /* sea foam — cool off-white */
  --surface:    #FAFCFE;   /* slight lift */
  --rule:       #D8E0E8;   /* hairline dividers */
  --rule-2:     #B8C4CE;   /* heavier rule */
  --ink:        #0B2A48;   /* deep navy text */
  --ink-2:      #4F6373;   /* muted slate */
  --ink-3:      #8B9BA8;   /* dim cool gray */
  --accent:     #0E6FB7;   /* primary ocean blue (was red) */
  --accent-2:   #0A4E83;   /* deeper hover */
  --accent-soft:#C9DFEF;   /* soft wash for active rows */
  --teal:       #0E9D8E;   /* secondary accent — used for ACTION line */
  --annot-bg:   #0A1F36;   /* deep ocean — annotation panel */
  --annot-rule: #13304B;
  --mono: 'JetBrains Mono', ui-monospace, SF Mono, Menlo, monospace;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, 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: #0E6FB7;
  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: #0A4E83; }
.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 stage (single-cam + bbox overlay) ============= */
.player {
  margin-top: 18px;
}
.stage {
  position: relative;
  background: var(--ink);
  padding: 6px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.stage-inner {
  position: relative;
  width: 100%;
  max-width: 1136px;       /* 2× native 568px */
  aspect-ratio: 568 / 320;
  background: #000;
  overflow: hidden;
}
.stage video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.stage .cell-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  display: flex;
  gap: 6px;
}
.stage .risk-flag {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  display: none;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 4px 8px;
  background: #E07856;
  color: #fff;
  text-transform: uppercase;
}
.stage .risk-flag.show { display: inline-block; }

/* ============= ego state timeline strip ============= */
.ego-timeline {
  position: relative;
  margin-top: 6px;
  display: grid;
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.ego-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  background: #fff;
  align-items: stretch;
  min-height: 44px;
}
.ego-label {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--accent);
  padding: 6px 12px;
  border-right: 1px solid var(--rule);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.25;
}
.ego-label .sub {
  font-weight: 500;
  font-size: 9.5px;
  color: var(--ink-2);
  letter-spacing: 0.4px;
  text-transform: lowercase;
  margin-top: 2px;
}
.ego-track {
  position: relative;
  height: 44px;
  background: #fff;
  overflow: hidden;
}
.ego-segment {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.4px;
  overflow: hidden;
  white-space: nowrap;
}
/* mode colors */
.ego-segment.mode-walking    { background: #5C7186; }
.ego-segment.mode-stationary { background: #4F6373; }
.ego-segment.mode-mounting   { background: #8A5BB8; }
.ego-segment.mode-mounted    { background: #6B7FB0; }
.ego-segment.mode-riding     { background: #0E6FB7; }
/* speed colors (stopped→fast) */
.ego-segment.speed-stopped { background: #D6E2EE; color: #0B2A48; }
.ego-segment.speed-walking { background: #A8DAEB; color: #0B2A48; }
.ego-segment.speed-slow    { background: #5EAFD3; }
.ego-segment.speed-cruise  { background: #0E6FB7; }
.ego-segment.speed-fast    { background: #0A4E83; }
/* brake colors */
.ego-segment.brake-none      { background: #E8EEF3; color: #0B2A48; }
.ego-segment.brake-soft      { background: #F4C66E; color: #0B2A48; }
.ego-segment.brake-medium    { background: #E07856; }
.ego-segment.brake-hard      { background: #C03A2B; }
.ego-segment.brake-emergency { background: #8E1A0C; }
.ego-segment.brake-n_a       { background: #EEF3F7; color: var(--ink-3); }
/* event markers row */
.ego-event-marker {
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 1px;
  z-index: 2;
}
.ego-event-marker.t2 { background: #E07856; }
.ego-event-marker.t3 { background: #D9A93A; }
.ego-event-marker.event { background: #0E9D8E; }
.ego-event-label {
  position: absolute;
  top: 50%;
  transform: translate(6px, -50%);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
  pointer-events: none;
}
.ego-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);
  z-index: 4;
}
.ego-playhead::before {
  content: '';
  position: absolute;
  top: -3px; left: -3px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

.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: #fff;
  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: #fff;
}
.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;
  /* Pin to viewport so the chunks list scrolls internally
     instead of stretching the page. */
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  max-height: 100vh;
}
.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;
}

/* ============= humanoid additions ============= */

/* ----- dex-hand piano-roll strip -----
   6 mini-tracks per side (thumb_swing, thumb_mcp, index, middle, ring, little).
   Each value normalized into a horizontal lane; brighter = more flexed. */
.proprio-svg .hand-track-bg {
  fill: #F2F6FA;
}
.proprio-svg .hand-cell {
  shape-rendering: crispEdges;
}
.proprio-svg .hand-divider {
  stroke: var(--rule);
  stroke-width: 0.5;
}
.proprio-svg .hand-label {
  font-family: var(--mono);
  font-size: 6.5px;
  font-weight: 600;
  fill: var(--ink-2);
  letter-spacing: 0.4px;
}

/* ----- wrench (force/torque) strip -----
   3 force channels (Fx/Fy/Fz) solid, 3 torque (Tx/Ty/Tz) dashed, both on one panel */
.proprio-svg .ft-line.force  { fill: none; stroke: var(--accent); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.85; }
.proprio-svg .ft-line.torque { fill: none; stroke: var(--teal);   stroke-width: 0.9; vector-effect: non-scaling-stroke; stroke-dasharray: 2 1.5; opacity: 0.85; }

/* ----- body strip (head, waist, odom-z) ----- */
.proprio-svg .body-line { fill: none; stroke: var(--accent); stroke-width: 0.9; vector-effect: non-scaling-stroke; opacity: 0.8; }
.proprio-svg .body-line.head  { stroke: var(--accent); }
.proprio-svg .body-line.waist { stroke: var(--teal); }
.proprio-svg .body-line.odom  { stroke: var(--ink); stroke-dasharray: 2 1.5; opacity: 0.5; }

/* ----- cycle dividers in span list ----- */
.cycle-head {
  position: sticky;
  top: 0;
  background: #0A1F36;
  padding: 8px 22px 6px 28px;
  border-top: 1px solid var(--annot-rule);
  border-bottom: 1px solid var(--annot-rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--accent);
  text-transform: uppercase;
}
.cycle-head .cycle-progress {
  color: #5C7186;
  font-weight: 600;
  font-size: 10px;
}
.cycle-head.current {
  background: #102B47;
}
.cycle-head.current { color: #fff; }
.cycle-head.current .cycle-progress { color: var(--accent); }

/* ----- atomic-skill chip colors ----- */
.span-skill[data-skill="detect"]    { color: #D9A93A; border-color: #D9A93A; }
.span-skill[data-skill="grasp"]     { color: #E07856; border-color: #E07856; }
.span-skill[data-skill="lift"]      { color: #0E9D8E; border-color: #0E9D8E; }
.span-skill[data-skill="transport"] { color: #0E6FB7; border-color: #0E6FB7; }
.span-skill[data-skill="place"]     { color: #8A5BB8; border-color: #8A5BB8; }
.span-skill[data-skill="retract"]   { color: #5C7186; border-color: #5C7186; }

/* ----- 6-cam grid badge variant — keep readable on bright fisheye ----- */
.cell.c-stereoR .badge,
.cell.c-fishL   .badge,
.cell.c-fishR   .badge,
.cell.c-waist   .badge,
.cell.c-bodyB   .badge {
  background: rgba(11, 42, 72, 0.86);
}
.cell.c-stereoL .badge {
  background: var(--accent);
}

/* ----- sidebar humanoid SVG ----- */
.sidebar-robot svg {
  width: 100%;
  max-width: 160px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 16px rgba(11, 42, 72, 0.12));
  margin-bottom: 10px;
}

/* ----- proprio rows that are taller (piano-roll needs space) ----- */
.proprio-row.tall { min-height: 88px; }
.proprio-row.tall .proprio-svg { height: 88px; }

/* ============= 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;
    display: flex;             /* lets us reorder via .order */
    flex-direction: column;
  }
  /* Mobile order: video player first, then chunks, then product manifest */
  .content    { order: 1; }
  .annotation { order: 2; border-left: 0; border-top: 1px solid var(--rule); position: static; height: auto; max-height: 70vh; align-self: stretch; }
  .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); }
}

/* ============= mobile (≤ 768px) ============= */
@media (max-width: 768px) {
  /* topbar tighter */
  .topbar { padding: 10px 14px; }
  .logo { font-size: 14px; letter-spacing: 0.5px; }
  .contact { font-size: 11px; padding: 7px 12px; letter-spacing: 0.3px; }

  /* stats: 2x2 grid with compact padding — keeps hero info above the fold
     without forcing the user to scroll through 4 stacked paragraphs */
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 10px 12px; border-right: 1px solid var(--rule); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid var(--rule); }
  .stat:nth-child(3) { border-right: 1px solid var(--rule); border-bottom: 0; }
  .stat:nth-child(4) { border-right: 0; border-bottom: 0; }
  .stat-h { font-size: 10px; margin-bottom: 4px; letter-spacing: 0.5px; }
  .stat p { font-size: 11px; line-height: 1.35; }

  /* coverage: keep summary line only, drop donut + legend + meta to save vertical space */
  .coverage {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 12px 16px;
    text-align: left;
  }
  .cov-chart, .cov-legend, .cov-meta { display: none; }
  .cov-total { font-size: 20px; }
  .cov-note  { font-size: 11.5px; }
  .cov-label { font-size: 10px; }

  /* sidebar — collapse to a compact horizontal-friendly accordion */
  .sidebar { padding: 8px 0 14px; }
  .toc { margin-bottom: 16px; }
  .toc-head { padding: 12px 18px; font-size: 13px; }
  .btn-secondary { margin: 0 16px; font-size: 11px; padding: 10px 14px; }
  .sidebar-robot { margin: 14px 16px 0; padding-top: 14px; }
  .sidebar-robot img { max-width: 140px; }
  .snippet-block { padding: 18px 16px 0; }
  .btn-primary { font-size: 11px; padding: 12px 14px; }

  /* main content padding */
  .content { padding: 0 14px 18px; }

  /* tab rows compact + wrap */
  .tab-row { padding: 10px 0; gap: 10px; }
  .tab-label { font-size: 10px; letter-spacing: 1px; }
  .tabs { flex-wrap: wrap; gap: 3px; }
  .tab { font-size: 11.5px; padding: 5px 9px; }

  /* Player layout: video + controls together, then telemetry below */
  .player { display: flex; flex-direction: column; }
  .player > .grid          { order: 1; }
  .player > .controls      { order: 2; }
  .player > .proprio       { order: 3; }
  .player > .streams-line  { order: 4; }
  .player > .ep-meta       { order: 5; }

  /* Mobile player grid: one big primary (stereo_left) + a 5-cam thumbnail
     strip below. Native mobile pattern — keeps hero camera prominent and
     the other 5 visible at a glance without a 6-tile cramped grid. */
  .grid {
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas:
      "stereoL stereoL stereoL stereoL stereoL"
      "stereoR fishL   fishR   waist   bodyB";
    aspect-ratio: auto;
    max-height: none;
    gap: 4px;
    padding: 4px;
  }
  /* All cells share the source aspect; sizing comes from grid placement. */
  .cell { aspect-ratio: 5 / 4; }
  /* Thumbnails are tappable to promote into the primary slot. */
  .cell:not(.primary) { cursor: pointer; }
  .cell:not(.primary):active { opacity: 0.78; }
  /* Badge sizing is driven by .primary state, not by source camera class. */
  .badge { font-size: 9px; padding: 3px 6px; letter-spacing: 0.5px; }
  .cell:not(.primary) .badge {
    font-size: 8px;
    padding: 2px 4px;
    letter-spacing: 0.3px;
    background: rgba(11, 42, 72, 0.86);
  }
  .cell.primary .badge { background: var(--accent); }

  /* proprio: narrower label, slimmer rows */
  .proprio-row { grid-template-columns: 84px 1fr; min-height: 46px; }
  .proprio-svg { height: 46px; }
  .proprio-row.tall { min-height: 72px; }
  .proprio-row.tall .proprio-svg { height: 72px; }
  .proprio-label { font-size: 9.5px; padding: 6px 8px; }
  .proprio-sub { font-size: 9px; }
  .proprio-legend { font-size: 8.5px; gap: 3px; }
  .proprio-playhead { left: 84px; }

  /* streams chip line — smaller and wraps cleanly */
  .streams-line { gap: 6px 8px; padding: 10px 0 6px; }
  .streams-key { font-size: 10px; }
  .stream { font-size: 10px; padding: 2px 6px; }

  /* controls compact */
  .controls { gap: 10px; padding: 10px 0 4px; }
  .btn-pause { font-size: 11px; padding: 6px 12px; min-width: 60px; }
  .time { font-size: 11px; min-width: 78px; }

  /* episode meta */
  .ep-row { grid-template-columns: 80px 1fr; gap: 10px; font-size: 12px; }
  .ep-key { font-size: 10px; }

  /* annotation panel on mobile — internally scrolling card, doesn't push page */
  .annotation { max-height: 60vh; }
  .annot-head { padding: 14px 14px 12px 20px; }
  .annot-head::before { left: 10px; top: 16px; height: 16px; }
  .annot-title { font-size: 11px; }
  .annot-task { font-size: 13px; line-height: 1.45; }
  .annot-count { font-size: 11px; }
  .span { grid-template-columns: 32px 56px 1fr; gap: 8px; padding: 8px 14px 8px 20px; }
  .span-id { font-size: 11px; }
  .span-time { font-size: 11px; }
  .span-text { font-size: 11.5px; }
  .cycle-head { padding: 6px 14px 5px 20px; font-size: 9.5px; }

  /* instruction stack */
  .instr-stack { padding: 14px 16px 16px 20px; }
  .instr-head::before { left: 10px; top: 18px; }
  .ilv { grid-template-columns: 76px 1fr; gap: 8px; font-size: 11.5px; }
  .ilv-key { font-size: 9.5px; }
  .ilv-num { font-size: 9px; padding: 1px 4px; }
  .ilv-val { font-size: 12px; }
  .ilv-val.mono { font-size: 10.5px; }
}
