/* =========================================================================
   3D Track Review

   Dark surround because the subject is a point cloud: anything lighter and the
   geometry stops reading. The accent is #00d7ff, which is not an arbitrary
   pick -- it is the first colour in the pipeline's own object-identity ramp, so
   the interface and the rendered overlays agree on what cyan means.

   Data is always set in mono: ids, frame counts, scores, dimensions. Prose is
   always set in Archivo. That split is the type system.
   ========================================================================= */

:root {
  --void: #08090c;
  --panel: #10141a;
  --raise: #171d26;
  --line: #232b36;
  --line-soft: #191f28;
  --text: #eaeff6;
  --muted: #808c9d;
  --accent: #00d7ff;
  --accent-soft: rgba(0, 215, 255, 0.12);
  --pending: #6b7787;

  --font-display: 'Archivo', 'Helvetica Neue', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --gap: clamp(1rem, 2.5vw, 2rem);
  --pad-x: clamp(1.15rem, 5vw, 4.5rem);
  --radius: 3px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p, figure { margin: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skiplink {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #05252c;
  font-weight: 600;
  z-index: 50;
}
.skiplink:focus { left: 0; }

/* --- top bar ----------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 3vw, 2.2rem);
  padding: 0 var(--pad-x);
  height: 60px;
  background: rgba(8, 9, 12, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex: none;
}
.mark-glyph { width: 21px; height: 21px; color: var(--accent); }
.mark-glyph svg { width: 100%; height: 100%; }
.mark-text {
  font-weight: 700;
  font-size: 0.94rem;
  letter-spacing: -0.015em;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  overflow: hidden;
  font-size: 0.8rem;
}
.crumb {
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.16s var(--ease);
}
.crumb:hover { color: var(--text); }
.crumb.is-current { color: var(--text); font-weight: 500; }
.crumb.mono { font-family: var(--font-mono); font-size: 0.76rem; }
.crumb-sep { color: #39424f; }

/* --- shell ------------------------------------------------------------- */

.main {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: clamp(2.2rem, 6vw, 4.5rem) var(--pad-x) 5rem;
  outline: none;
}

.footer {
  padding: 1.6rem var(--pad-x) 2.4rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 0.76rem;
  font-family: var(--font-mono);
}

/* --- lede -------------------------------------------------------------- */

.lede { max-width: 62ch; margin-bottom: clamp(2.4rem, 5vw, 3.8rem); }

.lede-split {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.display {
  font-size: clamp(2.1rem, 6vw, 3.9rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.display em {
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}
.mono-display {
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 4.6vw, 2.9rem);
  letter-spacing: -0.03em;
  font-weight: 500;
}

.lede-text {
  margin-top: 1.15rem;
  color: var(--muted);
  font-size: 1rem;
  max-width: 58ch;
}

.note {
  margin-top: 1.15rem;
  padding-left: 0.95rem;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.lede-figure {
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}
.lede-figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.sep { margin: 0 0.5em; color: #39424f; }

/* Section titles carry a short accent tick -- a scale mark, not decoration:
   it points at where the section's content starts. */
.section-title {
  position: relative;
  margin: 0 0 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-title::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 42px;
  height: 2px;
  background: var(--accent);
}

/* --- dataset cards ----------------------------------------------------- */

.dataset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: var(--gap);
}

.dataset-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.dataset-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.mosaic {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 84px;
  gap: 1px;
  background: var(--line-soft);
}
.mosaic-cell {
  background-size: cover;
  background-position: center;
  filter: saturate(0.75) brightness(0.72);
  transition: filter 0.3s var(--ease);
}
.dataset-card:hover .mosaic-cell { filter: saturate(1) brightness(0.92); }

.dataset-body { padding: 1.5rem 1.5rem 1.35rem; }
.dataset-name {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.dataset-desc {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line-soft);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.fineprint {
  margin-top: 1.1rem;
  color: #5f6a79;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}
.cta-arrow { transition: transform 0.18s var(--ease); }
.dataset-card:hover .cta-arrow,
.pipeline-card:hover .cta-arrow { transform: translateX(4px); }

/* --- clip gallery ------------------------------------------------------ */

.clip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: var(--gap);
}

.clip-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.clip-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* One aspect for every card, so a portrait clip and a landscape clip still
   line up in the grid. */
.clip-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #05070a;
  overflow: hidden;
}
.clip-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.clip-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.14);
}
.clip-bar {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.clip-body {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.05rem 1.15rem 1.15rem;
}
.clip-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.clip-id {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.clip-dur {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}
.clip-meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.qc-grade {
  display: inline-flex;
  width: fit-content;
  padding: 0.18rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.qc-grade.is-good { color: #64d98b; border-color: rgba(100, 217, 139, 0.42); }
.qc-grade.is-mixed { color: #f7c65d; border-color: rgba(247, 198, 93, 0.45); }
.qc-grade.is-poor { color: #ff7c86; border-color: rgba(255, 124, 134, 0.5); }
.pc-evidence { max-width: min(90%, 700px); }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips-tight { margin-top: 1rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raise);
  font-size: 0.73rem;
  color: #c3ccd8;
}
.chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.chip-count {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--muted);
}

/* margin-top:auto keeps the pill row on the card's bottom edge, so cards with
   an extra line of chips still line up across a row. */
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: auto; padding-top: 0.15rem; }
.pill {
  padding: 0.16rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 500;
  border: 1px solid transparent;
}
.pill.is-ready {
  color: var(--accent);
  border-color: rgba(0, 215, 255, 0.35);
  background: var(--accent-soft);
}
.pill.is-pending {
  color: var(--pending);
  border-color: var(--line);
}

/* --- pipeline picker --------------------------------------------------- */

.pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: var(--gap);
}

.pipeline-card {
  display: flex;
  flex-direction: column;
  padding: 1.6rem 1.6rem 1.5rem;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease);
}
.pipeline-card.is-ready:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.pipeline-card.is-pending {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.pipeline-tagline {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.pipeline-name {
  margin-top: 0.5rem;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.028em;
}
.pipeline-what {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.pipeline-depth {
  margin-top: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #5f6a79;
}
.pipeline-variants {
  margin-top: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.pipeline-blocked {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.2rem;
  font-size: 0.84rem;
  color: #98a3b2;
}
.dot-pending {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pending);
  flex: none;
}

/* --- viewer ------------------------------------------------------------ */

.viewer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.viewer-meta {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}

/* transport bar */
.transport {
  position: sticky;
  top: 60px;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.4rem;
  margin-bottom: 1.8rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  background: rgba(16, 20, 26, 0.94);
  backdrop-filter: blur(10px);
}
.seg-group { display: flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: 500 0.78rem var(--font-display);
  padding: 0.42rem 0.85rem;
  cursor: pointer;
}
.seg:last-child { border-right: 0; }
.seg:hover { color: var(--text); }
.seg.is-active { background: var(--accent); color: #04222a; font-weight: 600; }

.transport-auto,
.transport-frame { display: flex; align-items: center; gap: 0.7rem; }
/* Only the controls that apply to the active mode are shown -- a speed
   selector that does nothing is worse than no speed selector. */
.transport.is-frame .transport-auto { display: none; }
.transport:not(.is-frame) .transport-frame { display: none; }

.ctl {
  border: 1px solid var(--line);
  background: var(--raise);
  color: var(--text);
  font: 500 0.78rem var(--font-display);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  cursor: pointer;
  min-width: 2.6rem;
}
.ctl:hover { border-color: var(--accent); }
.ctl-play { min-width: 4.6rem; }
.ctl-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.ctl-select {
  border: 1px solid var(--line);
  background: var(--raise);
  color: var(--text);
  font: 500 0.78rem var(--font-mono);
  padding: 0.34rem 0.5rem;
  border-radius: var(--radius);
}
.ctl-hint { font-size: 0.72rem; color: #5f6a79; }

.frame-slider { width: clamp(140px, 32vw, 400px); accent-color: var(--accent); }
.frame-readout {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
}

/* two columns: box prompt and point prompt, shared items span both */
.viz-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.col-head {
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--line);
}
.col-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.col-hint { display: block; margin-top: 0.2rem; font-size: 0.76rem; color: var(--muted); }

.viz-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 1rem 1rem 1.1rem;
}
.viz-card.is-shared { grid-column: 1 / -1; }
.viz-card.is-absent {
  border-style: dashed;
  background: transparent;
  align-items: center;
  justify-content: center;
  min-height: 160px;
}
.viz-absent-text { color: var(--muted); font-size: 0.85rem; }

.viz-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}
.viz-title { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.02em; }
.viz-sub { margin-top: 0.15rem; font-size: 0.82rem; color: var(--muted); }
.viz-rate {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  border: 1px solid rgba(0, 215, 255, 0.3);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}

.viz-stage {
  position: relative;
  margin: 0 auto;          /* the stage is aspect-sized, so centre it */
  width: 100%;
  background: #05070a;
  border: 1px solid var(--line-soft);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.viz-video,
.viz-still {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.viz-stage .viz-still { display: none; }
.viz-stage.is-frame .viz-video { display: none; }
.viz-stage.is-frame .viz-still { display: block; }
.viz-stage.is-empty .viz-still { display: none; }

.viz-fallback {
  padding: 2.5rem 1.2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.viz-fallback:empty { display: none; }

.viz-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text);
  background: rgba(6, 8, 11, 0.82);
  border: 1px solid var(--line);
  padding: 0.15rem 0.42rem;
}
.viz-badge:empty { display: none; }

.viz-note {
  margin-top: 0.75rem;
  font-size: 0.76rem;
  color: #6d7889;
  line-height: 1.5;
}

/* --- 4D point cloud ---------------------------------------------------- */

.pc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 1rem;
  align-items: stretch;
}
.pc-stage {
  position: relative;
  min-height: 420px;
  height: 58vh;
  background: #05070a;
  border: 1px solid var(--line-soft);
  overflow: hidden;
}
.pc-canvas { display: block; width: 100%; height: 100%; touch-action: none; }

.pc-controls {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.85rem;
  border: 1px solid var(--line-soft);
  background: var(--raise);
  overflow-y: auto;
  max-height: 58vh;
}
.pc-group-title {
  margin: 0.35rem 0 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}
.pc-group-title:first-child { margin-top: 0; }

.pc-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-size: 0.8rem;
  cursor: pointer;
}
.pc-row:hover { color: var(--accent); }
.pc-check { accent-color: var(--accent); margin: 0; flex: none; }
.pc-row-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-empty, .pc-hint {
  font-size: 0.72rem;
  color: #5f6a79;
  line-height: 1.45;
}
.pc-hint { margin-top: 0.5rem; }

.pc-size-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  font-size: 0.75rem;
  color: var(--muted);
}
.pc-size { flex: 1; accent-color: var(--accent); min-width: 0; }
.pc-controls .ctl { margin-top: 0.6rem; }

@media (max-width: 900px) {
  .pc-body { grid-template-columns: minmax(0, 1fr); }
  .pc-controls { max-height: none; }
  .pc-stage { height: 46vh; min-height: 300px; }
}

@media (max-width: 900px) {
  .viz-grid { grid-template-columns: minmax(0, 1fr); }
  .viz-card.is-shared { grid-column: auto; }
  .transport { position: static; }
}

/* --- viewer placeholder ------------------------------------------------ */

.panel {
  padding: clamp(1.4rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  background: var(--panel);
}
.inventory {
  display: grid;
  gap: 0.9rem;
  margin-top: 1.6rem;
}
.inventory-item {
  display: grid;
  grid-template-columns: minmax(0, 210px) minmax(0, 1fr);
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line-soft);
}
.inventory-item:last-child { border-bottom: 0; padding-bottom: 0; }
.inventory-title { font-weight: 600; font-size: 0.9rem; }
.inventory-detail { color: var(--muted); font-size: 0.88rem; }

/* --- status ------------------------------------------------------------ */

.status { padding: 4rem 0; max-width: 52ch; }
.status-title { font-size: 1.4rem; font-weight: 600; letter-spacing: -0.02em; }
.status-detail { margin-top: 0.7rem; color: var(--muted); font-size: 0.9rem; }

/* --- responsive -------------------------------------------------------- */

@media (max-width: 860px) {
  .lede-split { grid-template-columns: minmax(0, 1fr); }
  .lede-figure { max-width: 320px; }
  .inventory-item { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; }
}

@media (max-width: 560px) {
  .topbar { height: 54px; gap: 0.75rem; }
  .mark-text { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.pc-buttons { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.pc-buttons .ctl { flex: 1; margin-top: 0; padding: 0.4rem 0.5rem; min-width: 0; }

/* --- load gate --------------------------------------------------------- */

.loading {
  margin-bottom: 1.8rem;
  padding: 0.95rem 1.1rem 1.05rem;
  border: 1px solid var(--line);
  background: var(--panel);
}
.load-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
}
.load-label { font-size: 0.85rem; font-weight: 500; }
.load-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.load-pct {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  min-width: 3.2em;
  text-align: right;
}
.load-track {
  height: 3px;
  background: var(--line);
  overflow: hidden;
}
.load-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.15s linear;
}
.load-hint {
  margin-top: 0.55rem;
  font-size: 0.74rem;
  color: #5f6a79;
}
.load-warn {
  font-size: 0.74rem;
  color: #ffd166;
  flex-basis: 100%;
}

.transport-diag { margin-left: auto; }
.ctl-diag { font-family: var(--font-mono); font-size: 0.72rem; }

.pc-value {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  min-width: 3em;
  text-align: right;
}

.pc-swatch { width: 14px; height: 3px; flex: none; border-radius: 1px; }

/* --- data caveats ------------------------------------------------------ */

.banner {
  margin-bottom: 1.4rem;
  padding: 0.9rem 1.1rem 1rem;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-left-width: 3px;
  background: rgba(255, 209, 102, 0.07);
}
.banner-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #ffd166;
}
.banner-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  background: #ffd166;
  color: #241c05;
  font-size: 0.72rem;
  font-weight: 700;
}
.banner-detail {
  margin-top: 0.45rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #c8cfd9;
  max-width: 80ch;
}

.banner.is-info {
  border-color: rgba(0, 215, 255, 0.4);
  background: rgba(0, 215, 255, 0.06);
}
.banner.is-info .banner-title { color: var(--accent); }
.banner.is-info .banner-mark { background: var(--accent); color: #04222a; }

/* --- SpatialVID paired depth + seeding audit -------------------------- */

.special-review {
  margin-top: var(--gap);
  padding: 1.5rem;
  border: 1px solid var(--line);
  background: linear-gradient(110deg, var(--panel), rgba(0, 215, 255, 0.06));
}
.special-review .eyebrow { margin-bottom: 0.45rem; }
.special-review-link { display: inline-flex; margin-top: 1rem; }
.special-review-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.section-heading { font-size: 1.35rem; line-height: 1.2; letter-spacing: -0.02em; }

.depth-lede { max-width: 74ch; margin-bottom: 1.7rem; }
.depth-clip-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 2rem;
}
.depth-clip {
  min-width: 0;
  display: grid;
  gap: 0.22rem;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--panel);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.depth-clip:hover, .depth-clip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.depth-clip-id { overflow: hidden; text-overflow: ellipsis; font-size: 0.78rem; }
.depth-gate {
  width: max-content;
  padding: 0.04rem 0.35rem;
  border-radius: 999px;
  font: 600 0.58rem/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.depth-gate.is-pass { color: #66f0ad; background: rgba(73, 255, 154, 0.1); }
.depth-gate.is-fail { color: #ff8c93; background: rgba(255, 73, 91, 0.1); }
.depth-clip-strata { color: var(--muted); font-size: 0.67rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }

.depth-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  gap: var(--gap);
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--panel);
}
.depth-current .eyebrow { margin-bottom: 0.35rem; }
.depth-unit { font-size: clamp(1rem, 2.5vw, 1.45rem); font-weight: 500; }
.depth-strata { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.7rem; }
.depth-strata dt { color: var(--muted); font: 0.62rem var(--font-mono); text-transform: uppercase;
  letter-spacing: 0.08em; }
.depth-strata dd { margin-top: 0.3rem; font-size: 0.78rem; }

.depth-provenance {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-top: 0;
}
.depth-provenance > div { padding: 1.05rem 1.25rem; }
.depth-provenance > div + div { border-left: 1px solid var(--line); }
.depth-source-name { font-size: 1rem; font-weight: 600; }
.depth-source-detail { color: var(--muted); font: 0.74rem var(--font-mono); margin-top: 0.2rem; }
.depth-gate-line { margin-top: 0.7rem; font: 600 0.7rem var(--font-mono); }
.depth-gate-line.is-pass { color: #66f0ad; }
.depth-gate-line.is-fail { color: #ff8c93; }

.depth-section, .mask-section { margin-top: 3.2rem; }
.depth-section-head { display: flex; justify-content: space-between; gap: 2rem; align-items: end;
  margin-bottom: 1rem; }
.depth-section-head .eyebrow { margin-bottom: 0.3rem; }
.depth-primary-note { max-width: 48ch; color: var(--muted); font-size: 0.78rem; text-align: right; }
.depth-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.78rem;
  border: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 60px;
  z-index: 10;
}
.depth-controls .frame-slider { flex: 1 1 220px; }
.depth-controls .frame-readout { flex: 1 1 100%; }
.depth-control-label { display: flex; align-items: center; gap: 0.45rem;
  color: var(--muted); font-size: 0.72rem; }
.depth-ceiling { width: 130px; accent-color: var(--accent); }
.depth-scale-value { color: var(--text); font: 0.69rem var(--font-mono); }

.depth-pair { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.8rem;
  margin-top: var(--gap); }
.depth-card { min-width: 0; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.depth-card-head { padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); }
.depth-card-head h3 { font-size: 0.92rem; }
.depth-card-head p { margin-top: 0.2rem; color: var(--muted); font-size: 0.7rem; }
.depth-canvas, .mask-canvas { display: block; width: 100%; aspect-ratio: 16 / 9;
  image-rendering: auto; background: #040609; }
.depth-rgb { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain;
  background: #040609; }
.depth-frame-stats, .mask-status { min-height: 2.8rem; padding: 0.62rem 0.85rem;
  border-top: 1px solid var(--line-soft); color: var(--muted); font: 0.68rem var(--font-mono); }
.depth-legend { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.65rem;
  margin-top: 0.7rem; color: var(--muted); font: 0.65rem var(--font-mono); }
.depth-gradient { height: 8px; border-radius: 2px;
  background: linear-gradient(90deg, rgb(7,5,27), rgb(92,32,111), rgb(192,64,81),
    rgb(246,153,33), rgb(249,211,61)); }

.mask-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.8rem;
  margin-top: var(--gap); }
.mask-audit { margin-top: 0.8rem; padding: 1rem; border: 1px solid var(--line); background: var(--panel); }
.mask-audit h3 { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); }
.mask-audit ul { margin-top: 0.7rem; display: grid; gap: 0.35rem; }
.mask-audit-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 0.7rem;
  color: var(--muted); font-size: 0.7rem; }
.mask-audit-row .mono { color: var(--text); }
.depth-footer-note { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.cloud-section { margin-top: 3.2rem; }
.spatialvid-cloud-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  min-height: 530px;
  margin-top: var(--gap);
  border: 1px solid var(--line);
  background: var(--panel);
}
.spatialvid-cloud-stage { min-width: 0; min-height: 530px; position: relative; overflow: hidden; }
.spatialvid-cloud-canvas { display: block; width: 100%; height: 100%; }
.spatialvid-cloud-controls { padding: 1rem; border-left: 1px solid var(--line); }
.cloud-branch-toggle { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0;
  color: var(--text); font-size: 0.75rem; }
.cloud-coordinate-note { padding: 0.78rem 1rem; border: 1px solid var(--line);
  border-top: 0; color: var(--muted); font-size: 0.74rem; }
.cloud-provenance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem; margin-top: 0.8rem; }
.cloud-provenance { padding: 0.9rem 1rem; border: 1px solid var(--line); background: var(--panel); }
.cloud-provenance h3 { font-size: 0.8rem; }
.cloud-provenance > p:not(.fineprint) { margin-top: 0.35rem; color: var(--muted); font-size: 0.72rem; }
.cloud-provenance .fineprint { margin-top: 0.55rem; }
.depth-mask-link { display: flex; justify-content: flex-end; margin-top: 1.4rem; }

.spatialvid-mask-player { margin-top: 1rem; }
.spatialvid-mask-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #040609;
}
.spatialvid-mask-video, .spatialvid-video-mask {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.spatialvid-mask-video { object-fit: contain; }
.spatialvid-video-mask { pointer-events: none; image-rendering: auto; }
.spatialvid-mask-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--panel);
}
.spatialvid-mask-opacity { margin-left: auto; min-width: 245px; }
.mask-video-readout {
  padding: 0.72rem 1rem;
  border: 1px solid var(--line);
  border-top: 0;
  color: var(--text);
  font-size: 0.7rem;
}

@media (max-width: 1200px) {
  .depth-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .depth-clip-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mask-grid { grid-template-columns: minmax(0, 1fr); }
  .depth-current { grid-template-columns: minmax(0, 1fr); }
  .depth-controls { position: static; }
  .depth-pair { grid-template-columns: minmax(0, 1fr); }
  .spatialvid-cloud-body { grid-template-columns: minmax(0, 1fr); }
  .spatialvid-cloud-controls { border-left: 0; border-top: 1px solid var(--line); }
  .spatialvid-mask-opacity { margin-left: 0; }
}

@media (max-width: 640px) {
  .depth-pair, .depth-provenance { grid-template-columns: minmax(0, 1fr); }
  .depth-provenance > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .depth-section-head { display: block; }
  .depth-primary-note { margin-top: 0.5rem; text-align: left; }
  .depth-strata { grid-template-columns: minmax(0, 1fr); }
  .cloud-provenance-grid { grid-template-columns: minmax(0, 1fr); }
  .mask-audit-row { grid-template-columns: minmax(0, 1fr); }
}

/* --- per-tile download ------------------------------------------------- */

.viz-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: none;
}
.viz-dl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.9rem;
  padding: 0.14rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raise);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}
.viz-dl:hover { color: var(--accent); border-color: rgba(0, 215, 255, 0.45); }
.viz-dl[data-busy] { color: var(--accent); cursor: progress; }

/* --- stage 4.5 depth rescale ------------------------------------------- */

.rs-warn {
  display: none;
  margin: 0 0 0.8rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid rgba(255, 209, 102, 0.45);
  border-left-width: 3px;
  background: rgba(255, 209, 102, 0.07);
  color: #c8cfd9;
  font-size: 0.8rem;
  line-height: 1.5;
}
.rs-warn.is-on { display: block; }

.rs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  max-height: 92px;
  overflow-y: auto;
  padding: 2px 0;
}
.rs-tick {
  width: 9px;
  height: 14px;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: transparent;
  padding: 0;
  cursor: pointer;
  opacity: 0.45;
}
.rs-tick.is-measured { opacity: 1; border-color: #4b5563; }
.rs-tick:hover { outline: 1px solid var(--accent); }

.rs-meta { margin-top: 0.9rem; }
.rs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 0.25rem 1.2rem;
}
.rs-item {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.76rem;
}
.rs-k { color: var(--muted); }
.rs-v { font-family: var(--font-mono); color: var(--text); text-align: right; }
