:root {
  --ink: #162423;
  --muted: #5d6968;
  --soft: #65716f;
  --paper: #fff;
  --surface: #fff;
  --surface-2: #f6f7f7;
  --line: #e3e8e7;
  --line-strong: #bcc9c6;
  --teal: #b93d49;
  --accent: #b93d49;
  --ochre: #855011;
  --radius: 16px;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html { scroll-padding-top: 100px; scrollbar-gutter: stable; }
body { font-family: var(--sans); font-size: 14px; line-height: 1.65; background: var(--paper); }
button, input, select { font: inherit; }
a, button, input, select, [tabindex] { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}
.skip-link {
  position: fixed; top: 8px; left: 12px; z-index: 100; padding: 8px 16px;
  background: var(--ink); color: white; border-radius: 8px; transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }
.topbar, .viewer-topbar, .casebank-topbar, .temporal-topbar {
  min-height: 66px; padding: 12px clamp(16px, 3vw, 44px); gap: 10px 24px;
  background: rgb(255 255 255 / 97%); border-bottom: 1px solid var(--line);
  font-size: 13px; flex-wrap: wrap;
}
.brand { font-size: 17px; letter-spacing: -.04em; font-weight: 800; }
.audit-nav { display: flex; align-items: center; flex-shrink: 0; gap: 4px; }
.audit-nav a {
  display: flex; align-items: center; justify-content: center;
  min-height: 42px; padding: 8px 10px; border-bottom: 2px solid transparent;
  border-radius: 6px; color: var(--muted); text-decoration: none;
  font-size: 13px; font-weight: 600; line-height: 1.5; white-space: nowrap;
}
.audit-nav a:hover { color: var(--accent); background: #f6f7f7; }
.audit-nav a[aria-current] { color: var(--accent); background: #fdeef0; border-bottom-color: var(--accent); }
.audit-topbar .case-select-wrap { flex: 1 1 180px; max-width: 560px; font-size: 12px; }
.audit-topbar .case-select-wrap select { flex: 1; width: 0; }
.gallery-shell, .temporal-gallery-shell {
  width: min(1200px, calc(100% - 40px)); padding: 54px 0 72px;
}
.gallery-intro, .intro { margin-bottom: 28px; }
.gallery-intro h1, .intro h1 { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.055em; line-height: 1.12; }
.gallery-intro p, .intro p { max-width: 760px; font-size: 16px; line-height: 1.75; }
.gallery-intro .kicker, .intro .kicker, .kicker { font-size: 11px; color: var(--teal); letter-spacing: .1em; }
.intro-copy { margin-top: 14px; }
.summary-strip { border-radius: var(--radius); background: var(--surface-2); }
.filter-panel { padding: 20px; border-radius: var(--radius); background: var(--surface-2); align-items: end; }
.filter-field { font-size: 12px; font-weight: 600; gap: 8px; min-width: 0; }
.filter-field input, .filter-field select, .case-select-wrap select {
  min-height: 42px; border-radius: 9px; background: #fff; padding: 8px 10px; min-width: 0;
}
.reset-filters {
  justify-self: start; border: 0; background: transparent; color: var(--teal);
  font-weight: 600; padding: 4px 0; cursor: pointer; min-height: 32px;
}
.case-list-panel { border: 0; background: transparent; overflow: visible; }
.case-list-panel > .panel-header { padding: 18px 2px; }
.case-list-panel > .panel-header h2 { font-size: 20px; letter-spacing: -.035em; }
.case-list { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.case-card {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  background: #fff; gap: 14px; transition: border-color .18s, box-shadow .18s, transform .18s;
  min-width: 0; align-content: start;
}
.case-card:hover { border-color: #e6a9af; box-shadow: 0 8px 26px rgb(22 36 35 / 5%); transform: translateY(-2px); background: #fff; }
.case-card h3 { font-size: 16px; line-height: 1.5; letter-spacing: -.025em; }
.case-card p { font-size: 13px; line-height: 1.7; }
.tag, .chip { border-radius: 6px; font-size: 11px; overflow-wrap: anywhere; }
.case-select-wrap { min-width: 0; }
.case-select-wrap select { max-width: 100%; font-size: 12px; }
.viewer-shell { height: calc(100vh - 66px); }
.compact-panel { border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.compact-panel h1 { font-size: 23px; line-height: 1.3; letter-spacing: -.035em; }
.compact-panel h2, .slice-toolbar h2, .transcript-toolbar h2 { font-size: 15px; }
.metadata-list { font-size: 12px; gap: 8px 10px; }
.metadata-list dt { font-size: 11px; }
.metadata-list dd, .metadata-list dt, .score-list dd { min-width: 0; overflow-wrap: anywhere; }
.case-subtitle { font-size: 12px; }
.jump-link { color: var(--teal); font-size: 12px; font-weight: 600; text-underline-offset: 3px; }
.temporal-layout { min-height: calc(100vh - 66px); grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.25fr) minmax(280px, 1fr); }
.timeline-panel, .report-panel { top: 82px; max-height: calc(100vh - 98px); }
.slice-card { padding: 16px; border-radius: 12px; background: #fafbfb; }
.heat-row { border: 0; background: transparent; width: 100%; text-align: left; color: inherit; font: inherit; min-height: 42px; }
.heat-label { font-size: 11px; }
.transcript-toolbar, .focus-window { background: #f8faf9; }
.token-navigation { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.token-navigation button { border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 12px; background: white; cursor: pointer; }
.small-note { font-size: 12px; line-height: 1.65; }
.status { border-radius: 12px; background: var(--surface-2); }
.retry-load { margin-top: 10px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 14px; background: #fff; color: var(--ink); cursor: pointer; }
.retry-load:disabled { cursor: wait; opacity: .7; }
.transcript-sticky { position: sticky; top: 0; z-index: 10; background: var(--surface); }
.transcript-sticky .transcript-toolbar, .transcript-sticky .focus-window { position: static; }
.noscript-note { display: block; padding: 18px; margin: 20px; background: var(--surface-2); }

@media (max-width: 1100px) {
  .temporal-layout { display: block; width: calc(100% - 24px); }
  .timeline-panel, .report-panel { position: static; max-height: none; margin-bottom: 16px; }
  .connector { display: none; }
  .report-panel { margin-top: 16px; }
}
@media (max-width: 820px) {
  .topbar, .viewer-topbar, .casebank-topbar, .temporal-topbar, .viewer-page .casebank-topbar { position: static; gap: 8px 16px; font-size: 12px; }
  .transcript-sticky { position: static; }
  .audit-nav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .audit-nav a { min-height: 44px; padding: 6px 4px; font-size: 12px; text-align: center; white-space: normal; }
  .audit-topbar .case-select-wrap { flex-basis: 100%; max-width: none; margin-left: 0; }
  .gallery-shell, .temporal-gallery-shell { width: calc(100% - 32px); padding-top: 32px; }
  .filter-panel { padding: 16px; }
  .case-card { padding: 20px; }
  .viewer-shell { height: auto; overflow: visible; }
  .case-select-wrap { width: 100%; }
  .case-select-wrap select { flex: 1; width: 0; }
  .slice-toolbar, .slice-toolbar-controls { min-width: 0; width: 100%; flex-wrap: wrap; }
  .slice-toolbar { flex-direction: column; align-items: flex-start; }
  .slice-toolbar-controls { justify-content: flex-start; }
  .active-slice { text-align: left; }
  .transcript-toolbar { position: static; flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Keep unscored context readable without changing the scientific score colors. */
.focus-tok.is-context, .tok.is-context { color: #555f5d; }
