/* Replay Lab — dashboard shell.
   Visual language: near-black canvas, slate cards with 1px borders and a
   gradient top rule, gold primary, Manrope display type, monospace eyebrows.
   Fonts are self-hosted under /fonts (OFL, see credits.txt) because the CSP
   only allows same-origin assets. */

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/manrope-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #0d0f11;
  --bg-top: #1c2027;
  --card: #282c34;
  --card-soft: rgba(40, 44, 52, .55);
  --card-softer: rgba(40, 44, 52, .32);
  --secondary: #1f2328;
  --input: #171a1f;
  --line: #3a4049;
  --line-soft: #2c3138;
  --ink: #ebedef;
  --muted: #a7acb4;
  --subtle: #7d838c;
  --gold: #e7b840;
  --gold-bright: #f2cd5f;
  --gold-deep: #bf9222;
  --on-gold: #0d0f11;
  --red: #e64337;
  --red-soft: #f87f77;
  --pink: #fa429e;
  --purple: #a855f7;
  --green: #1ae680;
  --warning: #f5a105;
  --radius: 10px;
  --radius-lg: 14px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Manrope", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, .35), 0 12px 32px -18px rgba(0, 0, 0, .8);
  --glow-gold: 0 0 18px rgba(231, 184, 64, .45);
  --glow-gold-soft: 0 0 10px rgba(231, 184, 64, .32);
  --gradient-page: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 520px);
  --gradient-warm: linear-gradient(135deg, var(--gold) 0%, var(--red-soft) 100%);
  --gradient-rule: linear-gradient(90deg, var(--pink) 0%, var(--purple) 100%);
  --gradient-rule-gold: linear-gradient(90deg, var(--gold-deep) 0%, var(--gold-bright) 50%, var(--gold-deep) 100%);
  --gradient-rule-cool: linear-gradient(90deg, var(--green) 0%, var(--purple) 100%);
  font-family: var(--font-sans);
  font-size: 15px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 280px;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg) var(--gradient-page) no-repeat;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-offset: 3px; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, label:focus-visible {
  outline: 2px solid var(--gold);
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease;
}
button:hover:not(:disabled) { border-color: #59606a; background: rgba(40, 44, 52, .6); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .42; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink); }
p { margin: 6px 0 0; color: var(--muted); }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 800; letter-spacing: -.02em; }
h1 { font-size: clamp(34px, 4.2vw, 52px); line-height: 1.05; letter-spacing: -.03em; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 16px; }
small { font-size: 12px; }
code, pre, .eyebrow, .stage-meta, .stage-footer, .required, .header-state, .step, .kicker {
  font-family: var(--font-mono);
}
code { font-size: .92em; }

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 64px;
  padding: 0 max(24px, calc((100vw - 1720px) / 2));
  border-bottom: 1px solid var(--line-soft);
  background: rgba(13, 15, 17, .82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.wordmark {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .06em;
  white-space: nowrap;
}
.wordmark { color: var(--muted); font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.brand-mark {
  display: inline-grid;
  width: 26px;
  height: 26px;
  margin-right: 10px;
  place-items: center;
  border-radius: 7px;
  background: var(--gradient-warm);
  color: var(--on-gold);
  font-family: var(--font-mono);
  font-size: 16px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  box-shadow: var(--glow-gold-soft);
}
.site-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.site-nav a, .site-nav button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.site-nav a:hover, .site-nav button:hover:not(:disabled) { background: rgba(40, 44, 52, .6); color: var(--ink); }
.site-nav .nav-active { color: var(--ink); }
.site-nav #show-guide {
  margin-left: 4px;
  background: var(--gold);
  border-color: var(--gold);
  color: var(--on-gold);
  font-weight: 600;
}
.site-nav #show-guide:hover:not(:disabled) { background: var(--gold-bright); border-color: var(--gold-bright); color: var(--on-gold); box-shadow: var(--glow-gold-soft); }
.header-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--card-softer);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.local-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(26, 230, 128, .7); }
.shared-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: var(--glow-gold-soft); }

/* ---- Page frame ---- */
.workspace { width: min(100%, 1720px); margin: 0 auto; padding: 0 24px 40px; }
.section-rule {
  height: 1px;
  margin: 44px 0 40px;
  background: var(--gradient-rule);
  opacity: .8;
}
.section-rule.gold { background: var(--gradient-rule-gold); }
.section-rule:has(+ .loaded-match[hidden]) { display: none; }

/* ---- Replay + notes side by side ---- */
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 20px; align-items: start; margin-top: 40px; }
.review-layout:has(.loaded-match[hidden]) { display: none; }
.review-layout > .notes-section { position: sticky; top: 84px; display: flex; flex-direction: column; max-height: calc(100vh - 104px); min-height: 0; }
.review-layout .notes-grid { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.review-layout .notes-list { flex: 1; min-height: 160px; max-height: none; }
.notes-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.section-rule.cool { background: var(--gradient-rule-cool); }

.review-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 56px 0 28px;
}
.review-header > div { min-width: 0; }
.review-header p { max-width: 62ch; margin-top: 14px; font-size: 17px; line-height: 1.55; }
.review-header button { min-width: 130px; }
.eyebrow {
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.status {
  margin: 0 0 14px;
  padding: 11px 16px;
  border: 1px solid rgba(231, 184, 64, .28);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(231, 184, 64, .07);
  color: #f0dfae;
  font-size: 14px;
}
.error {
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid rgba(230, 67, 55, .4);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  background: rgba(230, 67, 55, .1);
  color: #ffd1cc;
  font-size: 14px;
}

/* ---- Cards ---- */
.card, .import-panel, .empty-stage, .match-strip, .notes-list, .evidence, .data-notes, .note-form-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--card-soft);
  box-shadow: var(--shadow-card);
}
.card-rule::before, .import-panel::before, .empty-stage::before, .match-strip::before, .note-form-card::before {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--gradient-rule-gold);
  content: "";
  pointer-events: none;
}
.empty-stage::before { background: var(--gradient-rule); }
.match-strip::before { background: var(--gradient-rule-cool); }

/* ---- Import panel + empty stage ---- */
.import-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
.import-panel { padding: 26px 24px 24px; overflow: hidden; }
.section-heading { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.section-heading h2 { font-size: 20px; }
.step {
  color: var(--gold);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1;
  text-shadow: var(--glow-gold-soft);
}
#map-field { margin-bottom: 16px; }
#map-field > label, .import-panel > label:not(.file-drop) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.required { color: var(--subtle); font-size: 10px; font-weight: 600; letter-spacing: .16em; }
select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--ink);
  font-size: 14px;
}
select:hover { border-color: #59606a; }
.field-help { margin: 8px 0 18px; font-size: 13px; line-height: 1.55; }
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 16px 22px;
  border: 1px dashed #4a515c;
  border-radius: var(--radius-lg);
  background: rgba(13, 15, 17, .45);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}
.file-drop:hover, .file-drop.dragging { border-color: var(--gold); background: rgba(231, 184, 64, .06); box-shadow: inset 0 0 0 1px rgba(231, 184, 64, .25); }
.import-panel:has(#replay-files:focus-visible) .file-drop { outline: 2px solid var(--gold); outline-offset: 3px; }
.file-drop.disabled { opacity: .45; cursor: not-allowed; }
.upload-symbol {
  display: grid;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 12px;
  background: rgba(231, 184, 64, .12);
  color: var(--gold);
  font-size: 22px;
  line-height: 1;
}
.file-drop strong { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.file-drop > span:not(.upload-symbol) { margin-top: 4px; color: var(--muted); font-size: 13px; }
.file-drop small { margin-top: 12px; color: var(--subtle); font-size: 12px; line-height: 1.7; }
#replay-files {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  white-space: nowrap;
}
.file-list { margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; }
.file-list li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--card-softer);
  color: var(--ink);
}
.file-list li + li { margin-top: 5px; }
.file-list li span:last-child { color: var(--subtle); font-family: var(--font-mono); font-size: 11px; }
.raw-controls { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(13, 15, 17, .45); }
.consent-row { display: flex; align-items: flex-start; gap: 12px; color: var(--ink); font-size: 13px; line-height: 1.55; cursor: pointer; }
.consent-row input { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; accent-color: var(--gold); }
.upload-progress { display: block; width: 100%; height: 6px; margin: 10px 0; border-radius: 999px; accent-color: var(--gold); }
.upload-progress::-webkit-progress-bar { border-radius: 999px; background: var(--line-soft); }
.upload-progress::-webkit-progress-value { border-radius: 999px; background: var(--gold); }
.import-actions { display: flex; align-items: stretch; gap: 8px; margin-top: 16px; }
.import-actions .primary { flex: 1; margin-top: 0; }
.import-actions #cancel-import { min-width: 96px; }
.primary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  border-color: var(--gold);
  background: var(--gold);
  color: var(--on-gold);
  font-size: 14px;
  font-weight: 600;
}
.primary:hover:not(:disabled) { border-color: var(--gold-bright); background: var(--gold-bright); color: var(--on-gold); box-shadow: var(--glow-gold); }
.privacy-note { margin-top: 12px; color: var(--subtle); font-size: 12.5px; line-height: 1.65; }
.raw-help { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.raw-help strong { font-family: var(--font-display); font-size: 14px; font-weight: 700; }
.raw-help p { font-size: 13px; line-height: 1.6; }
.raw-help #raw-availability { margin-top: 8px; padding: 6px 10px; border-radius: 8px; background: var(--card-softer); font-size: 12.5px; }
.raw-help #raw-availability[data-state="available"] { color: var(--green); background: rgba(26, 230, 128, .1); }
.raw-help #raw-availability[data-state="unavailable"] { color: var(--warning); background: rgba(245, 161, 5, .1); }
.raw-help button:not(.text-button) { min-height: 34px; margin-top: 10px; padding: 6px 12px; font-size: 13px; }
.text-button { min-height: 32px; padding: 6px 0; border: 0; border-radius: 0; background: none; color: var(--gold); font-size: 13px; font-weight: 500; }
.text-button:hover:not(:disabled) { background: none; color: var(--gold-bright); }

.empty-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 600px;
  overflow: hidden;
  background:
    radial-gradient(60% 55% at 18% 8%, rgba(168, 85, 247, .16), transparent 70%),
    radial-gradient(50% 45% at 88% 96%, rgba(250, 66, 158, .1), transparent 70%),
    var(--card-softer);
}
.empty-stage::after {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 40px 40px;
  content: "";
  pointer-events: none;
}
.stage-meta, .stage-footer {
  position: absolute;
  right: 22px;
  left: 22px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--subtle);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.stage-meta { top: 20px; }
.stage-footer { bottom: 20px; }
#map-preview { position: absolute; inset: 8%; z-index: 0; width: 84%; height: 84%; object-fit: contain; opacity: .18; filter: grayscale(.4) contrast(1.1); }
.empty-content { position: relative; z-index: 1; max-width: 460px; padding: 24px; text-align: center; }
.empty-crosshair {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(13, 15, 17, .7);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 24px;
  box-shadow: var(--glow-gold-soft);
}
.empty-content h2 { font-size: 28px; }
.empty-content p { margin-top: 10px; font-size: 15px; line-height: 1.6; }

/* ---- Loaded match ---- */
.loaded-match { min-width: 0; }
.match-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px 24px;
  padding: 18px 22px;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}
.match-name { min-width: 200px; }
.match-name .eyebrow { margin-bottom: 6px; }
.match-strip h2 { font-size: 22px; }
.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  flex: 1 1 640px;
  gap: 8px;
  margin-left: auto;
  color: var(--muted);
}
.summary-fact {
  display: grid;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(13, 15, 17, .45);
  line-height: 1.2;
}
.summary-label, .summary-detail { overflow-wrap: anywhere; font-family: var(--font-mono); text-transform: uppercase; }
.summary-label { color: var(--subtle); font-size: 10px; font-weight: 600; letter-spacing: .16em; }
.summary-value { margin: 4px 0 2px; color: var(--ink); font-family: var(--font-mono); font-size: 18px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.summary-detail { color: var(--subtle); font-size: 10px; letter-spacing: .04em; }
#viewer-host {
  width: 100%;
  height: 900px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--bg);
  box-shadow: var(--shadow-card);
}
#viewer-host iframe { display: block; width: 100%; height: 100%; border: 0; }
.review-support { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
#telemetry-panel[hidden] + .evidence { grid-column: 1 / -1; }
.evidence { min-width: 0; color: var(--muted); font-size: 12px; }
.evidence summary { padding: 14px 18px; border-radius: var(--radius-lg); color: var(--gold); font-family: var(--font-display); font-size: 14px; font-weight: 700; cursor: pointer; }
.evidence summary span { padding-left: 10px; color: var(--subtle); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.evidence-body { padding: 4px 18px 16px; border-top: 1px solid var(--line-soft); }
.evidence-body > label { display: block; margin: 14px 0 6px; color: var(--ink); font-size: 13px; font-weight: 600; }
.evidence li { margin: 5px 0; }
.evidence ul { padding-left: 18px; }
.evidence p { font-size: 13px; line-height: 1.6; }

/* ---- Notes ---- */
.notes-section { padding: 0; }
.notes-heading { display: flex; align-items: flex-end; flex-wrap: wrap; justify-content: space-between; gap: 14px 12px; margin-bottom: 16px; }
.notes-heading > div { flex: 1 1 360px; min-width: 0; }
.notes-heading h2 { font-size: 26px; }
.notes-heading p { max-width: 64ch; margin-top: 6px; font-size: 14px; }
.notes-heading button { font-size: 14px; }
.notes-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .85fr); gap: 20px; align-items: stretch; }
.note-form-card { padding: 18px; }
.notes-grid label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.notes-grid label span { color: var(--subtle); font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: .04em; }
textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
textarea:hover:not(:disabled) { border-color: #59606a; }
textarea::placeholder { color: var(--subtle); }
textarea:disabled { opacity: .5; }
.note-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.note-actions span { color: var(--subtle); font-size: 12.5px; }
.note-actions button { width: auto; min-width: 120px; margin-top: 0; }
.notes-list { display: flex; flex-direction: column; max-height: min(64vh, 620px); overflow-y: auto; padding: 8px; scrollbar-width: thin; }
.notes-empty { display: grid; flex: 1; place-items: center; }
.notes-empty { padding: 32px 20px; color: var(--subtle); font-size: 14px; line-height: 1.6; text-align: center; }
.note { padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: rgba(13, 15, 17, .45); transition: border-color .15s ease; }
.note + .note { margin-top: 8px; }
.note:hover { border-color: var(--line); }
.note-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.note-jump {
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid rgba(231, 184, 64, .35);
  border-radius: 999px;
  background: rgba(231, 184, 64, .1);
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
}
.note-jump:hover:not(:disabled) { border-color: var(--gold); background: rgba(231, 184, 64, .18); color: var(--gold-bright); }
.note-remove { min-height: 28px; padding: 0 10px; border-color: transparent; color: var(--subtle); font-size: 12.5px; }
.note-remove:hover:not(:disabled) { border-color: rgba(230, 67, 55, .5); background: rgba(230, 67, 55, .1); color: var(--red-soft); }
.note p { margin-top: 10px; color: var(--ink); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.annotation-count { align-self: center; margin-right: 6px; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }
.import-notes-label { align-self: center; padding: 0 12px; cursor: pointer; }

/* ---- Sharing ---- */
.share-result {
  margin: 0 0 20px;
  padding: 16px 18px;
  border: 1px solid rgba(231, 184, 64, .35);
  border-radius: var(--radius-lg);
  background: rgba(231, 184, 64, .06);
}
.share-result label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.share-token-label { margin-top: 14px; }
.share-row { display: flex; gap: 8px; }
.share-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--input);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.share-row button { min-width: 84px; }
.open-blockers { margin: 10px 0 0; color: var(--warning); font-size: 13px; }

.share-manage { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.share-manage button { flex: 1 1 auto; }
button.danger { border-color: rgba(230, 67, 55, .5); color: var(--red-soft); }
button.danger:hover:not(:disabled) { background: rgba(230, 67, 55, .12); border-color: var(--red); }
.share-existing { margin: 0 0 16px; }
.share-existing summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.share-existing summary:hover { color: var(--ink); }
.share-existing-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; }
.share-existing-form input { min-width: 0; min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input); color: var(--ink); font-family: var(--font-mono); font-size: 12.5px; }
@media (max-width: 720px) { .share-existing-form { grid-template-columns: 1fr; } }

/* ---- Data notes ---- */
.data-notes {
  margin-top: 14px;
  padding: 16px 20px;
  border-color: rgba(245, 161, 5, .35);
  background: rgba(245, 161, 5, .06);
}
.data-notes h3 { margin: 0 0 8px; color: var(--warning); font-size: 15px; }
.data-notes ul { margin: 0; padding-left: 18px; }
.data-notes li { margin: 4px 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }

.field-help code, .file-drop code, .privacy-note code { padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .06); color: var(--muted); }

.error-summary { margin: 0; color: inherit; font-size: inherit; }
.error-technical { margin-top: 8px; }
.error-technical summary { color: #ffb3ab; font-size: 12.5px; cursor: pointer; }
.error-technical pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  overflow-x: auto;
  border-radius: 8px;
  background: rgba(0, 0, 0, .35);
  color: #ffd1cc;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---- Footer ---- */
footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(100%, 1400px);
  margin: 0 auto;
  padding: 36px 24px 44px;
  border-top: 1px solid var(--line-soft);
  color: var(--subtle);
  font-size: 12.5px;
  text-align: center;
}
footer span { max-width: 80ch; color: var(--subtle); font-size: 12px; line-height: 1.6; }

/* ---- Guide dialog ---- */
dialog {
  width: min(680px, calc(100% - 24px));
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #1b1f25;
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9);
}
dialog::backdrop { background: rgba(8, 9, 11, .78); backdrop-filter: blur(6px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line-soft); }
.dialog-head .eyebrow { margin-bottom: 8px; }
.dialog-head h2 { font-size: 26px; }
.dialog-head button { width: 40px; min-height: 40px; padding: 0; font-size: 22px; line-height: 1; }
.guide-body { padding: 4px 24px 26px; overflow-wrap: anywhere; }
.guide-body > p { margin-top: 18px; font-size: 15px; }
.guide-body p { font-size: 14px; line-height: 1.65; }
.guide-body ol { margin: 8px 0 0; padding-left: 0; list-style: none; counter-reset: guide; }
.guide-body li { position: relative; padding: 14px 0 14px 54px; border-top: 1px solid var(--line-soft); font-size: 15px; counter-increment: guide; }
.guide-body li:first-child { border-top: 0; }
.guide-body li::before {
  position: absolute;
  top: 12px;
  left: 0;
  color: var(--gold);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  content: "0" counter(guide);
}
.guide-body li strong { font-family: var(--font-display); font-weight: 700; }
.guide-body code { padding: 1px 5px; border-radius: 5px; background: rgba(255, 255, 255, .06); font-size: 12.5px; }
.guide-body > a { display: inline-flex; align-items: center; min-height: 40px; margin-top: 12px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-size: 14px; font-weight: 500; }
.guide-body > a:hover { border-color: #59606a; background: rgba(40, 44, 52, .6); }
[hidden] { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 1180px) {
  .import-layout { grid-template-columns: 340px minmax(0, 1fr); }
  .review-support, .notes-grid { grid-template-columns: 1fr; }
  .review-layout { grid-template-columns: 1fr; }
  .review-layout > .notes-section { position: static; max-height: none; }
}

@media (max-width: 860px) {
  .site-header { gap: 12px; }
  .header-state > span:not(.local-dot):not(.shared-dot) { display: none; }
  .header-state { padding: 8px; }
  .import-layout { grid-template-columns: 1fr; }
  .empty-stage { min-height: 420px; }
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  html { scroll-behavior: auto; }
  .site-header {
    position: static;
    flex-wrap: wrap;
    gap: 8px 12px;
    min-height: 0;
    padding: 10px 16px;
  }
  .wordmark { min-height: 36px; }
  .site-nav { order: 3; width: 100%; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .site-nav a, .site-nav button { flex: 1 0 auto; justify-content: center; }
  .workspace { padding: 0 16px 32px; }
  .review-header { flex-direction: column; align-items: stretch; gap: 16px; padding: 32px 0 20px; }
  .review-header p { font-size: 15px; }
  .review-header button { width: 100%; }
  .section-rule { margin: 32px 0 28px; }
  .import-panel { padding: 20px 18px; }
  .step { font-size: 28px; }
  .empty-stage { min-height: 360px; }
  .stage-meta, .stage-footer { right: 14px; left: 14px; }
  .stage-footer { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .empty-content h2 { font-size: 24px; }
  .empty-content p { max-width: 320px; font-size: 14px; }
  .match-strip { padding: 16px; }
  .match-name { width: 100%; min-width: 0; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); flex-basis: 100%; width: 100%; margin-left: 0; }
  #viewer-host { height: 1040px; }
  .notes-heading { align-items: stretch; flex-direction: column; }
  .notes-heading > div { flex: 0 0 auto; }
  .note-form-card { padding: 18px 16px; }
  .notes-grid label { align-items: flex-start; flex-direction: column; gap: 4px; }
  .note-actions { align-items: stretch; flex-direction: column; }
  .note-actions button { width: 100%; }
  .share-row { flex-direction: column; }
  footer { padding: 28px 16px 36px; }
}

@media (max-width: 420px) {
  .dialog-head { padding: 18px 16px 14px; }
  .guide-body { padding: 0 16px 20px; }
  .guide-body li { padding-left: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
