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

: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 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: #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;
}
.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 ============= */
.stack-wrap {
  position: relative;
  background: #000;
  width: 100%;
  margin: 0 auto;
  /* stacked aspect = eye width / (2 * eye height). 1280x972 eye → 1280/1944 */
  aspect-ratio: 1280 / 1944;
  max-height: 78vh;
  max-width: calc(78vh * 1280 / 1944);
  overflow: hidden;
}
.stack-wrap video#vstack {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.stack-wrap canvas#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;     /* covers LEFT eye (top half) */
  pointer-events: none;
}
.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;
  z-index: 3;
  pointer-events: none;
}
.eye-badge.eye-left  { top: 10px; }
.eye-badge.eye-right { top: calc(50% + 10px); background: var(--teal); }

.depth-pip {
  position: absolute;
  right: 10px;
  bottom: calc(50% + 10px);  /* sit on the bottom of LEFT eye region */
  width: 26%;
  border: 1px solid rgba(14, 111, 183, 0.7);
  background: #000;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  z-index: 3;
}
.depth-pip video {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 320 / 240;
  object-fit: cover;
}
.pip-label {
  position: absolute;
  bottom: 100%;
  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;
}

/* 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; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--rule); }
  .annotation { border-left: 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: 16px 18px; }
  .stat-h    { font-size: 11px; }
  .coverage  { padding: 16px 18px; }
  .cov-total { font-size: 22px; }
  .cov-bar-track { height: 22px; }
  .cov-seg   { font-size: 9px; }
  .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; }

  /* player: show only LEFT eye on phone (cleaner; the right eye reads as 'duplicate' to a phone user) */
  .stack-wrap {
    aspect-ratio: 1280 / 972;
    max-height: 55vh;
    max-width: 100%;
  }
  .stack-wrap video#vstack {
    height: 200%;
    object-fit: cover;
    object-position: top center;
  }
  .eye-badge.eye-left  { font-size: 9.5px; padding: 3px 6px; }
  .eye-badge.eye-right { display: none; }
  .depth-pip          { bottom: 8px; right: 8px; width: 32%; }
  .pip-label          { font-size: 8.5px; padding: 2px 4px; }

  /* 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; }
}
