:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --surface-3: #e6ecf2;
  --ink: #1d2733;
  --muted: #687586;
  --line: #d7e0e8;
  --line-strong: #b6c4d2;
  --blue: #2368b8;
  --blue-strong: #174f91;
  --blue-soft: #e7f0fb;
  --green: #20834f;
  --green-soft: #e7f6ee;
  --red: #b83d3d;
  --red-soft: #fae8e8;
  --amber: #9a621d;
  --amber-soft: #fbf0dd;
  --violet: #6953a2;
  --violet-soft: #eeeafd;
  --shadow: 0 18px 50px rgba(28, 40, 54, 0.15);
  --nav-w: 276px;
  --topbar-h: 62px;
  --crumb-h: 38px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 0; background: var(--bg); }
body { margin: 0; min-width: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
body.panel-open { overflow: hidden; }
button, input, select { font: inherit; }
button, a, select, input, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--blue); }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p, figure, dl, dd { margin: 0; }
pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

:focus-visible {
  outline: 3px solid rgba(35, 104, 184, 0.5);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 8px;
  transform: translateY(-150%);
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
}
.skip-link:focus { transform: translateY(0); }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) var(--crumb-h) minmax(0, 1fr);
  grid-template-areas:
    "top top"
    "crumb crumb"
    "nav main";
}

.topbar {
  grid-area: top;
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(200px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
}
.brand-block { display: flex; align-items: center; min-width: 0; gap: 10px; }
.brand-block h1 { font-size: 17px; line-height: 1.1; letter-spacing: -0.015em; }
.brand-block h1 span { color: var(--blue); }
.eyebrow {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}
.workspace-nav {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  gap: 4px;
}
.workspace-nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.workspace-nav a:hover { color: var(--ink); background: var(--surface-2); }
.workspace-nav a.active { color: var(--blue); border-bottom-color: var(--blue); }
.top-actions { justify-self: end; display: flex; gap: 6px; }
.text-button, .primary-button, .danger-button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}
.text-button:hover { border-color: var(--blue); color: var(--blue); }
.primary-button { border-color: var(--blue); background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-strong); }
.primary-button:disabled, .text-button:disabled { cursor: not-allowed; opacity: 0.48; }
.danger-button { border-color: #e3b4b4; color: var(--red); background: var(--red-soft); }

.breadcrumbs {
  grid-area: crumb;
  position: sticky;
  top: var(--topbar-h);
  z-index: 45;
  display: flex;
  align-items: center;
  min-width: 0;
  overflow-x: auto;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245,247,249,0.96);
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--blue); }
.crumb-sep { padding: 0 7px; color: var(--line-strong); }

.navigator {
  grid-area: nav;
  position: sticky;
  top: calc(var(--topbar-h) + var(--crumb-h));
  height: calc(100vh - var(--topbar-h) - var(--crumb-h));
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.navigator-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.navigator-head h2 { margin-top: 2px; font-size: 15px; }
.field { display: grid; gap: 5px; }
.field > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.field select, .field input, .toolbar select, .toolbar input, .epoch-select, .filter-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
}
.navigator-cases {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 6px;
  padding-top: 2px;
}
.nav-case {
  width: 100%;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.nav-case:hover { border-color: var(--line); background: var(--surface-2); }
.nav-case.active { border-color: #a9c6e8; background: var(--blue-soft); }
.nav-case img, .nav-thumb-empty { width: 40px; height: 34px; border-radius: 4px; object-fit: cover; background: var(--surface-3); }
.nav-case strong, .nav-case small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-case strong { font-size: 11px; }
.nav-case small { margin-top: 2px; color: var(--muted); font-size: 9px; }

.workspace { grid-area: main; min-width: 0; padding: 18px; }
.workspace-content { min-width: 0; max-width: 1780px; margin: 0 auto; }
.state-card {
  min-height: 300px;
  display: grid;
  place-content: center;
  gap: 8px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}
.state-card h2 { font-size: 20px; }
.state-card p:last-child { color: var(--muted); font-size: 13px; }
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
.page-head h2 { margin-top: 3px; font-size: clamp(20px, 2vw, 28px); letter-spacing: -0.025em; }
.page-head .lede { max-width: 780px; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.head-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

.toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 1.5fr) repeat(4, minmax(112px, 0.8fr)) auto;
  gap: 7px;
  margin-bottom: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.mode-switch { display: flex; gap: 3px; padding: 3px; border-radius: 7px; background: var(--surface-2); }
.mode-switch button { min-height: 28px; padding: 4px 9px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; }
.mode-switch button.active { background: var(--surface); color: var(--blue); box-shadow: 0 1px 3px rgba(28,40,54,0.12); }

.result-meta { margin-bottom: 10px; color: var(--muted); font-size: 11px; }
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 11px;
}
.case-card, .panel, .status-card, .epoch-detail, .compare-column, .replay-frame, .replay-list-panel, .replay-inspector {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}
.case-card { min-width: 0; overflow: hidden; }
.case-card-visuals { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; height: 164px; background: var(--line); }
.case-card-visuals figure { position: relative; min-width: 0; overflow: hidden; background: var(--surface-2); }
.case-card-visuals img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.case-card-visuals figcaption {
  position: absolute;
  bottom: 5px;
  left: 5px;
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(20,31,43,0.78);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}
.missing-visual { height: 100%; display: grid; place-content: center; padding: 12px; color: var(--muted); font-size: 10px; text-align: center; }
.case-card-body { padding: 10px; }
.case-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.case-card h3 { font-size: 13px; }
.case-card-subtitle { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.status-row, .metric-row, .tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.status-row { margin-top: 8px; }
.metric-row { margin-top: 8px; color: var(--muted); font-size: 10px; }
.metric-row span { padding-right: 7px; border-right: 1px solid var(--line); }
.metric-row span:last-child { border-right: 0; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
}
.badge.success, .badge.pass, .badge.complete, .badge.full { border-color: #a9d8bd; background: var(--green-soft); color: var(--green); }
.badge.error, .badge.reject, .badge.missing, .badge.timeout { border-color: #e5b8b8; background: var(--red-soft); color: var(--red); }
.badge.partial, .badge.aggregate-only, .badge.warning { border-color: #e7ca9e; background: var(--amber-soft); color: var(--amber); }
.badge.derived { border-color: #c6b9eb; background: var(--violet-soft); color: var(--violet); }

.matrix-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.matrix { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; font-size: 10px; }
.matrix th, .matrix td { min-width: 135px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: top; }
.matrix th { position: sticky; top: 0; z-index: 2; background: #f9fbfc; text-align: left; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; z-index: 3; min-width: 170px; background: #f9fbfc; }
.matrix th:first-child { z-index: 4; }
.matrix-cell { display: grid; gap: 5px; min-height: 82px; }
.matrix-cell button { justify-self: start; }
.matrix-target { display: flex; align-items: center; gap: 7px; }
.matrix-target img { width: 42px; height: 34px; border-radius: 4px; object-fit: cover; }

.comparison-tray {
  position: fixed;
  z-index: 80;
  left: calc(var(--nav-w) + 20px);
  right: 20px;
  bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #9bbce0;
  border-radius: 10px;
  background: rgba(255,255,255,0.97);
  box-shadow: var(--shadow);
}
.tray-runs { min-width: 0; display: flex; flex-wrap: wrap; gap: 5px; }
.tray-actions { flex: 0 0 auto; display: flex; gap: 6px; }

.dossier-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.72fr);
  gap: 12px;
  margin-bottom: 12px;
}
.visual-comparator { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-size: 12px; }
.visual-toolbar { display: flex; flex-wrap: wrap; gap: 4px; }
.visual-toolbar button { min-height: 27px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 9px; font-weight: 700; }
.visual-toolbar button.active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.visual-toolbar .focus-toggle { border-color: #9bbce0; color: var(--blue-strong); background: var(--blue-soft); }
.visual-toolbar .focus-toggle.active { border-color: var(--blue); background: var(--blue); color: #fff; }
.visual-stage { min-height: 420px; height: min(52vh, 560px); display: grid; grid-template-columns: 1fr 1fr; gap: 1px; overflow: hidden; background: var(--line); }
.visual-stage.single { grid-template-columns: 1fr; }
.visual-pane { position: relative; min-width: 0; min-height: 0; overflow: auto; background: var(--surface-2); }
.visual-image-wrap { position: relative; width: 100%; }
.visual-pane img { width: 100%; height: auto; object-fit: contain; object-position: top center; }
.visual-stage.fit-height .visual-image-wrap { height: 100%; }
.visual-stage.fit-height .visual-pane img { height: 100%; width: 100%; object-fit: contain; }
.visual-pane-label { position: absolute; z-index: 3; top: 7px; left: 7px; width: fit-content; padding: 4px 6px; border-radius: 5px; background: rgba(20,31,43,0.82); color: #fff; font-size: 9px; font-weight: 800; }
.overlay-pane { position: relative; background: #dfe6ed; }
.overlay-pane img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.overlay-pane img:last-child { opacity: var(--overlay-opacity, 0.5); }
.bbox-layer { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.bbox {
  position: absolute;
  min-width: 12px;
  min-height: 10px;
  padding: 0;
  border: 2px solid #ef4f60;
  border-radius: 2px;
  background: rgba(239,79,96,0.08);
  color: #fff;
  pointer-events: auto;
}
.bbox:hover, .bbox:focus-visible { z-index: 3; border-width: 3px; background: rgba(239,79,96,0.22); }
.bbox span { position: absolute; top: -17px; left: -2px; min-width: 16px; padding: 1px 3px; border-radius: 3px 3px 0 0; background: #d52f43; font-size: 8px; font-weight: 800; }
.overlay-range { display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }

body.image-focus .app-shell {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "top"
    "crumb"
    "main";
}
body.image-focus .navigator,
body.image-focus .workspace-content > .page-head,
body.image-focus .run-facts,
body.image-focus .section-tabs,
body.image-focus .dossier-section { display: none; }
body.image-focus .workspace { padding: 12px 18px 18px; }
body.image-focus .workspace-content { max-width: none; }
body.image-focus .dossier-hero { display: block; margin: 0; }
body.image-focus .visual-stage {
  min-height: 560px;
  height: calc(100vh - var(--topbar-h) - var(--crumb-h) - 76px);
}

.run-facts { display: grid; gap: 8px; align-content: start; }
.identity-card { padding: 12px; }
.identity-card h3 { margin-top: 4px; font-size: 18px; }
.identity-code { margin-top: 8px; padding: 8px; border-radius: 6px; background: var(--surface-2); color: #435368; font: 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.axis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.status-card { padding: 9px; }
.status-card dt { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.status-card dd { margin-top: 4px; font-size: 12px; font-weight: 750; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { padding: 8px; border-radius: 7px; background: var(--surface-2); }
.stat strong, .stat span { display: block; }
.stat strong { font-size: 13px; }
.stat span { margin-top: 2px; color: var(--muted); font-size: 9px; }

.section-tabs { position: sticky; z-index: 8; top: calc(var(--topbar-h) + var(--crumb-h)); display: flex; gap: 4px; overflow-x: auto; margin: 0 0 10px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,0.96); }
.section-tabs button { flex: 0 0 auto; min-height: 30px; padding: 5px 10px; border: 0; border-radius: 5px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; }
.section-tabs button.active { background: var(--blue-soft); color: var(--blue); }
.dossier-section { display: grid; gap: 10px; }
.panel { min-width: 0; padding: 12px; }
.panel > h3 { font-size: 14px; }
.panel-note { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.warning-list, .evidence-list { display: grid; gap: 6px; margin: 9px 0 0; padding: 0; list-style: none; }
.warning-list li, .evidence-item { padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #fafcfd; font-size: 11px; line-height: 1.5; }
.evidence-item { width: 100%; color: var(--ink); text-align: left; }
.evidence-item:hover { border-color: var(--blue); }
.raw-details { margin-top: 9px; border-top: 1px solid var(--line); padding-top: 8px; }
.raw-details summary { cursor: pointer; color: var(--blue); font-size: 11px; font-weight: 700; }
.raw-details pre, .raw-block { max-height: 420px; overflow: auto; margin-top: 8px; padding: 10px; border-radius: 6px; background: #18222f; color: #d9e7f4; font: 10px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }

.epoch-strip { display: flex; gap: 7px; overflow-x: auto; padding: 2px 0 10px; }
.epoch-pill { flex: 0 0 auto; min-width: 92px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); text-align: left; }
.epoch-pill.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 0 0 2px rgba(35,104,184,0.12); }
.epoch-pill strong, .epoch-pill span { display: block; }
.epoch-pill strong { font-size: 11px; }
.epoch-pill span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.epoch-detail { overflow: hidden; }
.epoch-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 11px; border-bottom: 1px solid var(--line); }
.epoch-detail-head h3 { font-size: 15px; }
.epoch-nav { display: flex; gap: 5px; }
.epoch-grid { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr); gap: 1px; background: var(--line); }
.epoch-grid > section { min-width: 0; padding: 11px; background: var(--surface); }
.epoch-image { min-height: 320px; max-height: 600px; display: grid; place-items: center; overflow: auto; border-radius: 7px; background: var(--surface-2); }
.epoch-image img { max-height: 600px; object-fit: contain; }
.tool-groups { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.compare-grid { display: grid; grid-template-columns: repeat(var(--compare-cols, 4), minmax(220px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.compare-column { min-width: 220px; overflow: hidden; }
.compare-column.target { position: sticky; left: 0; z-index: 4; border-color: #a8bdd4; }
.compare-column-head { min-height: 122px; padding: 10px; border-bottom: 1px solid var(--line); }
.compare-column-head h3 { margin-top: 3px; font-size: 13px; }
.compare-column-head p { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.compare-image { height: 420px; overflow: auto; background: var(--surface-2); }
.compare-image img { width: 100%; height: auto; object-position: top center; }
.compare-image.fit-height img { width: 100%; height: 100%; object-fit: contain; }
.compare-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 9px; }
.compare-metrics div { padding: 6px; border-radius: 5px; background: var(--surface-2); }
.compare-metrics strong, .compare-metrics span { display: block; }
.compare-metrics strong { font-size: 11px; }
.compare-metrics span { color: var(--muted); font-size: 8px; }
.compare-controls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.pair-overlay { margin-top: 10px; }
.pair-overlay-stage { height: min(68vh, 720px); position: relative; overflow: hidden; background: var(--surface-2); }
.pair-overlay-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.pair-overlay-stage img:last-child { opacity: var(--overlay-opacity, 0.5); }

.replay-layout { display: grid; grid-template-columns: minmax(280px, 0.85fr) minmax(340px, 1.15fr) minmax(300px, 0.9fr); gap: 9px; min-height: calc(100vh - 240px); }
.replay-frame, .replay-list-panel, .replay-inspector { min-width: 0; overflow: hidden; }
.replay-frame { display: flex; flex-direction: column; }
.replay-frame-stage { flex: 1; min-height: 420px; display: grid; place-items: center; overflow: auto; background: var(--surface-2); }
.replay-frame-stage img { max-height: 75vh; object-fit: contain; }
.frame-provenance { padding: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.45; }
.replay-list-panel { display: flex; flex-direction: column; min-height: 560px; }
.replay-filterbar { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.event-count { padding: 7px 9px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.event-list { flex: 1; min-height: 0; overflow: auto; padding: 6px; }
.event-window-note { padding: 6px; color: var(--muted); font-size: 9px; text-align: center; }
.event-row {
  width: 100%;
  display: grid;
  grid-template-columns: 44px 72px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: start;
  padding: 7px 6px;
  border: 0;
  border-bottom: 1px solid #e8edf2;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.event-row:hover { background: var(--surface-2); }
.event-row.active { border-radius: 5px; background: var(--blue-soft); box-shadow: inset 3px 0 var(--blue); }
.event-index, .event-time { color: var(--muted); font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.event-type { color: var(--violet); font-size: 9px; font-weight: 800; }
.event-summary { overflow: hidden; color: #3b4b5c; font-size: 10px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.replay-inspector { padding: 11px; overflow: auto; }
.replay-inspector h3 { margin-top: 4px; font-size: 15px; }
.explanation-card { margin-top: 10px; padding: 10px; border: 1px solid #bdd0e4; border-radius: 7px; background: var(--blue-soft); color: #254566; font-size: 12px; line-height: 1.6; }
.method-line { margin-top: 6px; color: var(--muted); font: 9px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.replay-player {
  position: sticky;
  z-index: 12;
  bottom: 8px;
  display: grid;
  grid-template-columns: auto auto minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
  padding: 9px;
  border: 1px solid #a9bfd8;
  border-radius: 9px;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 12px 35px rgba(28,40,54,0.12);
}
.player-actions { display: flex; gap: 4px; }
.player-actions button { min-width: 34px; }
.scrubber-wrap { display: grid; gap: 4px; }
.scrubber { width: 100%; }
.scrubber-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 9px; }
.speed-control { min-width: 110px; }

.evidence-panel {
  position: fixed;
  z-index: 110;
  top: 0;
  right: 0;
  width: min(470px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  transform: translateX(102%);
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 160ms ease;
}
.evidence-panel.open { transform: translateX(0); }
.evidence-panel header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.evidence-panel h2 { margin-top: 2px; font-size: 16px; }
.evidence-body { flex: 1; overflow: auto; padding: 14px; }
.evidence-body img { width: 100%; margin: 10px 0; border: 1px solid var(--line); border-radius: 7px; }
.panel-scrim { position: fixed; z-index: 100; inset: 0; display: none; border: 0; background: rgba(15,24,34,0.35); }
.panel-scrim.visible { display: block; }

.toast {
  position: fixed;
  z-index: 140;
  left: 50%;
  bottom: 18px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  padding: 8px 12px;
  border-radius: 7px;
  background: #18222f;
  color: #fff;
  font-size: 11px;
  transition: opacity 120ms ease, transform 120ms ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.mobile-only { display: none; }
.mobile-replay-tabs { display: none; }

@media (max-width: 1180px) {
  :root { --nav-w: 242px; }
  .topbar { grid-template-columns: 1fr auto; backdrop-filter: none; }
  .workspace-nav { position: fixed; z-index: 46; left: var(--nav-w); right: 0; bottom: 0; height: 48px; justify-content: center; border-top: 1px solid var(--line); background: rgba(255,255,255,0.98); }
  .workspace-nav a { flex: 1; justify-content: center; border-top: 3px solid transparent; border-bottom: 0; }
  .workspace-nav a.active { border-top-color: var(--blue); }
  .workspace, .navigator { padding-bottom: 64px; }
  .toolbar { grid-template-columns: 1.5fr repeat(2, 1fr); }
  .dossier-hero { grid-template-columns: 1fr; }
  .run-facts { grid-template-columns: 1.1fr 1fr; }
  .replay-layout { grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr); }
  .replay-inspector { grid-column: 1 / -1; min-height: 240px; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 58px; --crumb-h: 34px; }
  .app-shell { display: block; padding-top: calc(var(--topbar-h) + var(--crumb-h)); }
  .topbar { position: fixed; inset: 0 0 auto; height: var(--topbar-h); grid-template-columns: minmax(0, 1fr) auto; padding: 0 10px; }
  .brand-block h1 { font-size: 14px; }
  .brand-block .eyebrow { display: none; }
  .top-actions #languageToggle { display: none; }
  .breadcrumbs { position: fixed; top: var(--topbar-h); left: 0; right: 0; height: var(--crumb-h); padding: 0 10px; }
  .workspace-nav { left: 0; }
  .workspace { padding: 10px 10px 68px; }
  .navigator {
    position: fixed;
    z-index: 110;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(330px, 90vw);
    height: 100vh;
    transform: translateX(-102%);
    box-shadow: var(--shadow);
    transition: transform 160ms ease;
  }
  .navigator.open { transform: translateX(0); }
  .mobile-only { display: inline-flex; }
  .page-head { display: grid; gap: 10px; }
  .head-actions { justify-content: flex-start; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar input:first-child { grid-column: 1 / -1; }
  .gallery { grid-template-columns: 1fr; }
  .case-card-visuals { height: 184px; }
  .comparison-tray { left: 8px; right: 8px; bottom: 56px; display: grid; }
  .tray-actions { justify-content: stretch; }
  .tray-actions button { flex: 1; }
  .dossier-hero { display: block; }
  .run-facts { margin-top: 9px; grid-template-columns: 1fr; }
  .visual-stage { height: 56vh; min-height: 360px; }
  .visual-stage:not(.single) { grid-template-columns: 1fr; overflow: auto; }
  .visual-stage:not(.single) .visual-pane { min-height: 330px; }
  body.image-focus .workspace { padding: 8px 10px 58px; }
  body.image-focus .visual-stage {
    min-height: 420px;
    height: calc(100vh - var(--topbar-h) - var(--crumb-h) - 112px);
  }
  .axis-grid { grid-template-columns: 1fr 1fr; }
  .section-tabs { top: calc(var(--topbar-h) + var(--crumb-h)); }
  .epoch-grid { grid-template-columns: 1fr; }
  .epoch-detail-head { display: grid; }
  .compare-column.target { position: static; }
  .compare-image { height: 380px; }
  .replay-layout { display: block; min-height: 0; }
  .replay-frame, .replay-list-panel, .replay-inspector { display: none; }
  .replay-layout[data-mobile-tab="visual"] .replay-frame,
  .replay-layout[data-mobile-tab="events"] .replay-list-panel,
  .replay-layout[data-mobile-tab="evidence"] .replay-inspector { display: flex; min-height: 58vh; }
  .replay-layout[data-mobile-tab="evidence"] .replay-inspector { display: block; }
  .replay-frame-stage { min-height: 54vh; }
  .replay-list-panel { min-height: 58vh; }
  .replay-player { bottom: 54px; grid-template-columns: 1fr; }
  .player-actions { justify-content: center; }
  .speed-control { width: 100%; }
  .mobile-replay-tabs { display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 7px; padding: 4px; border-radius: 7px; background: var(--surface-3); }
  .mobile-replay-tabs button { border: 0; border-radius: 5px; padding: 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; }
  .mobile-replay-tabs button.active { background: var(--surface); color: var(--blue); }
}

@media (max-width: 430px) {
  .top-actions #copyLink { padding: 6px 8px; }
  .page-head h2 { font-size: 20px; }
  .toolbar { grid-template-columns: 1fr; }
  .toolbar input:first-child { grid-column: auto; }
  .card-actions { grid-template-columns: 1fr; }
  .axis-grid, .stat-grid { grid-template-columns: 1fr 1fr; }
  .event-row { grid-template-columns: 39px 65px minmax(0,1fr); }
  .event-time { display: none; }
}

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