:root {
  color-scheme: light;
  --font-sans: "Pretendard Variable", "Pretendard", -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  --bg: #f4f3ee;
  --bg-glow-1: rgba(37, 88, 232, 0.065);
  --bg-glow-2: rgba(12, 122, 107, 0.055);
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --surface-3: #eeece4;
  --surface-glass: rgba(244, 243, 238, 0.84);

  --ink: #10171a;
  --ink-2: #43535b;
  --muted: #667780;
  --line: #e2dfd5;
  --line-strong: #cbc7b9;

  --ag2: #2558e8;
  --ag2-soft: #e8efff;
  --ag2-border: #bfd2ff;
  --ag1: #0c7a6b;
  --ag1-soft: #e2f4ef;
  --ag1-border: #b3e2d6;
  --accent-hot: #d94b26;
  --hot-soft: #ffefe9;
  --hot-border: #f7c3b2;
  --pos: #0f7b58;
  --pos-soft: #e1f5ec;
  --pos-border: #b4e4cf;
  --neg: #c43d3d;
  --neg-soft: #fdecec;

  --base-a-fg: #0d7352;
  --base-a-bg: #e1f5ec;
  --base-c-fg: #1d50c2;
  --base-c-bg: #e6eeff;
  --base-g-fg: #a45d09;
  --base-g-bg: #fdf1d9;
  --base-t-fg: #be3434;
  --base-t-bg: #fceaea;

  --shadow-sm: 0 1px 2px rgba(16, 23, 26, 0.04), 0 1px 3px rgba(16, 23, 26, 0.03);
  --shadow-md: 0 12px 30px -12px rgba(16, 23, 26, 0.12), 0 2px 6px rgba(16, 23, 26, 0.04);
  --shadow-lg: 0 22px 46px -14px rgba(16, 23, 26, 0.19), 0 4px 12px rgba(16, 23, 26, 0.06);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080c12;
  --bg-glow-1: rgba(92, 158, 255, 0.1);
  --bg-glow-2: rgba(46, 230, 184, 0.085);
  --surface: #101620;
  --surface-2: #151e2c;
  --surface-3: #1d283a;
  --surface-glass: rgba(8, 12, 18, 0.84);

  --ink: #eef3f7;
  --ink-2: #b3c2cf;
  --muted: #7d90a2;
  --line: #212c3e;
  --line-strong: #32435b;

  --ag2: #66a3ff;
  --ag2-soft: rgba(102, 163, 255, 0.15);
  --ag2-border: rgba(102, 163, 255, 0.36);
  --ag1: #2ee6b8;
  --ag1-soft: rgba(46, 230, 184, 0.13);
  --ag1-border: rgba(46, 230, 184, 0.34);
  --accent-hot: #ff7452;
  --hot-soft: rgba(255, 116, 82, 0.14);
  --hot-border: rgba(255, 116, 82, 0.4);
  --pos: #3be0a4;
  --pos-soft: rgba(59, 224, 164, 0.14);
  --pos-border: rgba(59, 224, 164, 0.34);
  --neg: #ff7a7a;
  --neg-soft: rgba(255, 122, 122, 0.14);

  --base-a-fg: #44e2a9;
  --base-a-bg: rgba(68, 226, 169, 0.15);
  --base-c-fg: #75acff;
  --base-c-bg: rgba(117, 172, 255, 0.16);
  --base-g-fg: #f8ba53;
  --base-g-bg: rgba(248, 186, 83, 0.16);
  --base-t-fg: #ff7c7c;
  --base-t-bg: rgba(255, 124, 124, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 16px 36px -14px rgba(0, 0, 0, 0.58);
  --shadow-lg: 0 24px 52px -12px rgba(0, 0, 0, 0.74);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.56;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(960px 480px at 10% -10%, var(--bg-glow-1), transparent 70%),
    radial-gradient(840px 460px at 92% 0%, var(--bg-glow-2), transparent 68%);
  background-attachment: fixed;
  transition: background-color 200ms var(--ease), color 200ms var(--ease);
}

[hidden] { display: none !important; }
h1, h2, h3, p, dl, dt, dd, ul { margin: 0; }
a { color: var(--ag2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
:focus-visible { outline: 2px solid var(--ag2); outline-offset: 2px; }

.wrap { width: min(1240px, calc(100% - 48px)); margin-inline: auto; }

/* ── Masthead ─────────────────────────────────────────────────────── */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
}
.brand-group { display: flex; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; opacity: 0.9; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 0.98rem; font-weight: 780; letter-spacing: -0.025em; }
.brand-sub { font-family: var(--font-mono); font-size: 0.69rem; color: var(--muted); }
.assembly-pill {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.masthead-actions { position: relative; display: flex; align-items: center; gap: 9px; }
.byok-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.77rem;
  font-weight: 650;
  list-style: none;
  white-space: nowrap;
  cursor: pointer;
}
.byok-trigger::-webkit-details-marker { display: none; }
.byok-trigger:hover, .byok-settings[open] .byok-trigger { border-color: var(--ag2); color: var(--ink); }
.byok-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.byok-settings[data-key-set] .byok-dot { background: var(--pos); box-shadow: 0 0 0 3px var(--pos-soft); }
.byok-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 55;
  width: min(365px, calc(100vw - 24px));
  padding: 14px;
  box-shadow: var(--shadow-lg);
}
.byok-editor { display: grid; gap: 8px; min-width: 0; }
.byok-editor p { margin: 0; }
.byok-editor a, .site-footer a { text-decoration: underline; text-underline-offset: 2px; }
.byok-inline { padding: 12px; margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); }
.byok-field { display: grid; gap: 5px; font-size: 0.79rem; font-weight: 650; }
.byok-field .byok-key-input { width: 100%; min-width: 0; }
.byok-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.byok-actions .primary-btn { width: auto; }
.byok-policy { color: var(--ink-2); }
.byok-error { color: var(--neg); }

.status-pill, .api-pill, .icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.status-pill, .icon-btn { cursor: pointer; transition: all 140ms var(--ease); }
.status-pill:hover, .icon-btn:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.api-pill.live { color: var(--pos); border-color: var(--pos-border); background: var(--pos-soft); }
.api-pill.offline { color: var(--muted); }
.queue-quiet-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.77rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.queue-quiet-btn:hover { background: var(--surface-2); color: var(--ink); }
.queue-quiet-btn.busy { background: var(--hot-soft); color: var(--accent-hot); border-color: var(--hot-border); }

.pulse-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--ag2); box-shadow: 0 0 0 3px var(--ag2-soft); }
.queue-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--pos); opacity: 0.75; }
.queue-dot.busy { background: var(--accent-hot); opacity: 1; box-shadow: 0 0 0 3px var(--hot-soft); }

.theme-picker { position: relative; display: inline-flex; align-items: center; }
.theme-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.theme-trigger:hover,
.theme-trigger[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--ink);
}
.theme-icon { display: none; }
html[data-theme-mode="light"] .theme-trigger .icon-light { display: block; }
html[data-theme-mode="dark"] .theme-trigger .icon-dark { display: block; }
html:not([data-theme-mode]) .theme-trigger .icon-system,
html[data-theme-mode="system"] .theme-trigger .icon-system { display: block; }

.theme-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.theme-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 130ms var(--ease), color 130ms var(--ease);
}
.theme-option:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.theme-option[aria-checked="true"] {
  background: var(--surface-3);
  color: var(--ink);
}

/* ── Main Shell & Command Query Studio ────────────────────────────── */
.main-shell { padding-top: 22px; padding-bottom: 44px; }
.studio-hero { margin-bottom: 16px; max-width: 720px; }
.studio-hero.compact { display: none; }
.studio-hero h1 {
  font-size: clamp(1.75rem, 3.2vw, 2.35rem);
  font-weight: 780;
  line-height: 1.14;
  letter-spacing: -0.035em;
}
.lede { margin-top: 8px; font-size: 0.92rem; color: var(--ink-2); line-height: 1.55; }
.mono-inline {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink);
  white-space: nowrap;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.query-card { padding: 12px 14px; }
.query-studio.has-result .query-subrow { display: none; }
.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-field-wrap { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.search-icon { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }

#query-input {
  width: 100%;
  height: 44px;
  padding: 0 64px 0 40px;
  font: inherit;
  font-size: 0.94rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  transition: border-color 150ms var(--ease), background 150ms var(--ease), box-shadow 150ms var(--ease);
}
#query-input:focus { outline: none; background: var(--surface); border-color: var(--ag2); box-shadow: 0 0 0 4px var(--ag2-soft); }
#query-input::-webkit-search-cancel-button { -webkit-appearance: none; }

.kbd-hint {
  position: absolute;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  pointer-events: none;
}
.clear-btn {
  position: absolute;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: none;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 1rem;
  cursor: pointer;
}
.clear-btn:hover { background: var(--line-strong); color: var(--ink); }

.primary-btn {
  height: 48px;
  padding: 0 22px;
  border: 1px solid var(--ag2);
  border-radius: var(--radius-md);
  background: var(--ag2);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 140ms var(--ease), transform 110ms var(--ease);
}
.primary-btn:hover:not(:disabled) { filter: brightness(1.06); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: 0.5; cursor: default; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.ghost-btn:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }

/* ── Suggest Box (Genes, rsIDs, Instant GRCh38 Locus Resolver) ────── */
.suggest-box {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 35;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.suggest-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  cursor: pointer;
  text-align: left;
}
.suggest-item:hover { background: var(--surface-2); }
.suggest-locus-card { padding: 8px 10px; }
.suggest-locus-title { font-size: 0.77rem; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.alt-pick-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.alt-pick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
.alt-pick-btn:hover { border-color: var(--ag2); background: var(--ag2-soft); color: var(--ag2); }

.condition-select {
  height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 660;
  cursor: pointer;
  flex-shrink: 0;
}
.condition-select:focus-visible {
  outline: none;
  border-color: var(--ag2);
  box-shadow: 0 0 0 3px var(--ag2-soft);
}
.condition-custom-input {
  height: 44px !important;
  width: 156px !important;
  border-radius: var(--radius-md) !important;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.query-subrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.example-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ex-label { font-size: 0.76rem; font-weight: 660; color: var(--muted); margin-right: 4px; }
.ex-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 640;
  cursor: pointer;
  transition: all 130ms var(--ease);
}
.ex-chip:hover { border-color: var(--ag2-border); background: var(--ag2-soft); color: var(--ag2); }
.ex-chip.hot { border-color: var(--hot-border); background: var(--hot-soft); color: var(--accent-hot); }
.ex-chip.live-demo { border-style: dashed; border-color: var(--ag2-border); color: var(--ag2); }
.ex-chip .chip-sub { font-family: var(--font-sans); font-weight: 500; opacity: 0.82; }

.auto-live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.auto-live-toggle input { accent-color: var(--ag2); margin: 0; }
.auto-live-toggle:has(input:disabled) { cursor: default; opacity: 0.7; }

/* ── Server Cache Drawer ──────────────────────────────────────────── */
.cache-drawer { margin-top: 14px; padding: 18px 20px; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.drawer-head h2 { font-size: 1rem; font-weight: 760; }
.drawer-actions { display: flex; align-items: center; gap: 6px; }
.policy-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.policy-stat { padding: 9px 11px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); }
.policy-stat-k { display: block; font-size: 0.7rem; font-weight: 680; color: var(--muted); }
.policy-stat-v { display: block; font-family: var(--font-mono); font-size: 0.96rem; font-weight: 760; margin-top: 2px; font-variant-numeric: tabular-nums; }
.queue-jobs-wrap { display: flex; flex-direction: column; gap: 7px; }
.queue-job-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}
.stage-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.stage-step {
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.75rem;
  font-weight: 660;
  color: var(--muted);
  text-align: center;
}
.stage-step.active { border-color: var(--ag2); background: var(--ag2-soft); color: var(--ag2); }
.stage-step.done { border-color: var(--pos-border); background: var(--pos-soft); color: var(--pos); }
.cache-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.cache-item-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.cache-item-btn:hover { border-color: var(--ag2); background: var(--ag2-soft); }

/* ── Feedback / Cache-Miss Live Preview / Gene Picker ─────────────── */
#feedback-area { margin-top: 18px; }
.feedback-card { padding: 22px 24px; }
.feedback-card.error-card { border-color: var(--hot-border); background: var(--hot-soft); }
.feedback-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.feedback-title { font-size: 1.08rem; font-weight: 780; }
.feedback-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.rpc-plan-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 15px;
  margin-top: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.rpc-plan-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.rpc-plan-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.gene-match-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 9px; margin-top: 12px; }
.gene-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.gene-pager-controls { display: inline-flex; align-items: center; gap: 8px; }
.gene-match-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.gene-match-btn:hover { border-color: var(--ag2); background: var(--surface); }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--ag2-border);
  border-top-color: var(--ag2);
  border-radius: 999px;
  animation: spin 0.75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── DNA Sequence Ribbon & Allele Pills ───────────────────────────── */
.seq-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  overflow-x: auto;
  max-width: 100%;
}
.seq-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 22px;
  border-radius: 4px;
  opacity: 0.85;
}
.seq-base.b-A { color: var(--base-a-fg); }
.seq-base.b-C { color: var(--base-c-fg); }
.seq-base.b-G { color: var(--base-g-fg); }
.seq-base.b-T { color: var(--base-t-fg); }
.seq-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-inline: 5px;
  padding: 3px 5px;
  border-radius: 7px;
  background: var(--surface);
  border: 1.5px solid var(--ag2);
  box-shadow: var(--shadow-sm);
}
.seq-center.seq-center-stacked {
  flex-direction: column;
  gap: 1px;
  padding: 3px 4px;
  line-height: 1;
}
.seq-center.seq-center-stacked .nt {
  min-width: 20px;
  height: 18px;
  padding: 0 4px;
  font-size: 0.74rem;
}
.seq-stack-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  line-height: 1;
  color: var(--muted);
  padding: 1px 0;
}

.allele-pair { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 0.78rem; font-weight: 760; }
.allele-arrow { color: var(--muted); }
.nt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
}
.nt-A { color: var(--base-a-fg); background: var(--base-a-bg); }
.nt-C { color: var(--base-c-fg); background: var(--base-c-bg); }
.nt-G { color: var(--base-g-fg); background: var(--base-g-bg); }
.nt-T { color: var(--base-t-fg); background: var(--base-t-bg); }

/* ── Telemetry Banner ─────────────────────────────────────────────── */
#workspace { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.telemetry-banner { padding: 16px 20px; }
.telemetry-top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.telemetry-title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.telemetry-title { font-family: var(--font-mono); font-size: clamp(1.3rem, 2.5vw, 1.75rem); font-weight: 780; letter-spacing: -0.03em; }
.telemetry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 6px; color: var(--ink-2); font-size: 0.82rem; }
.telemetry-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.telemetry-seq-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }

.gene-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.77rem;
  font-weight: 680;
}

/* ── Badges ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.badge.ag2 { background: var(--ag2-soft); color: var(--ag2); border-color: var(--ag2-border); }
.badge.ag1 { background: var(--ag1-soft); color: var(--ag1); border-color: var(--ag1-border); }
.badge.positive { background: var(--pos-soft); color: var(--pos); border-color: var(--pos-border); }
.badge.warn { background: var(--hot-soft); color: var(--accent-hot); border-color: var(--hot-border); }
.badge.clickable { cursor: pointer; }
.badge.clickable:hover { filter: brightness(0.95); }

/* ── Workspace Sections ───────────────────────────────────────────── */
.workspace-section { padding: 22px 24px; scroll-margin-top: 78px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-kicker { font-family: var(--font-mono); font-size: 0.7rem; font-weight: 720; letter-spacing: 0.09em; color: var(--ag2); margin-bottom: 3px; }
.hot-kicker { color: var(--accent-hot); }
.section-head h2 { font-size: 1.16rem; font-weight: 780; letter-spacing: -0.02em; }

/* ── AG2 200 bp First-Screen Summary ──────────────────────────────── */
.summary-section { border-color: var(--line); }
.summary-head-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.summary-callout {
  padding: 9px 13px;
  margin-bottom: 14px;
  border-radius: 9px;
  background: var(--surface-2);
  border-left: 2.5px solid var(--ag2);
  font-size: 0.84rem;
  color: var(--ink);
  font-weight: 540;
  line-height: 1.5;
}
.summary-callout.muted-shift { border-left-color: var(--muted); color: var(--ink-2); }
.ag2-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.ag2-sum-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: border-color 140ms var(--ease);
}
.ag2-sum-card.focused { border-color: var(--ag2); box-shadow: 0 0 0 2px var(--ag2-soft); }
.ag2-sum-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ag2-sum-mark { font-family: var(--font-mono); font-size: 0.96rem; font-weight: 780; color: var(--ink); }
.ag2-sum-vals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.ag2-sum-cell { min-width: 0; }
.ag2-sum-k { display: block; font-size: 0.64rem; font-weight: 660; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ag2-sum-v { display: block; font-family: var(--font-mono); font-size: 0.79rem; font-weight: 740; font-variant-numeric: tabular-nums; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag2-sum-rel { display: block; font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); margin-top: 2px; }
.evidence-jump-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 640;
  cursor: pointer;
  transition: all 130ms var(--ease);
}
.evidence-jump-btn:hover { background: var(--ag2-soft); color: var(--ag2); border-color: var(--ag2-border); }
.summary-footnote { font-size: 0.76rem; color: var(--muted); line-height: 1.5; }

.focused-evidence-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  background: var(--ag2-soft);
  border: 1px solid var(--ag2-border);
}
.focused-evidence-bar.warning-bar {
  background: var(--hot-soft);
  border-color: var(--hot-border);
}
.focused-ev-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.focused-ev-note { font-size: 0.72rem; color: var(--muted); }
.focused-ev-metrics { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 0.81rem; font-variant-numeric: tabular-nums; }
.focused-ev-metrics strong { color: var(--ink); }

.boundary-note {
  padding: 9px 13px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--surface-2);
  border-left: 3px solid var(--ag2);
  font-size: 0.8rem;
  color: var(--ink-2);
}

/* ── AG2 Chromatin Score Cards ────────────────────────────────────── */
.score-cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.score-card {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.score-card.has-disc { border-color: var(--hot-border); box-shadow: inset 0 3px 0 var(--accent-hot); }
.score-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.score-card h3 { font-size: 0.93rem; font-weight: 760; }
.score-card-code { font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }

.score-metrics-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric-box {
  padding: 8px 9px;
  border-radius: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.metric-k { font-size: 0.69rem; font-weight: 680; color: var(--muted); display: block; }
.metric-v { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 760; font-variant-numeric: tabular-nums; display: block; margin-top: 2px; }
.metric-call { font-size: 0.68rem; font-weight: 700; display: block; margin-top: 2px; }
.metric-call.pos { color: var(--pos); }
.metric-call.neg { color: var(--muted); }
.delta-pos { color: var(--pos); }
.delta-neg { color: var(--accent-hot); }

.track-svg-wrap { padding: 8px 10px 6px; border-radius: 9px; background: var(--surface); border: 1px solid var(--line); }
.track-svg-bar { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; font-size: 0.7rem; color: var(--muted); }
.track-svg { display: block; width: 100%; height: 48px; overflow: visible; }
.scale-btn {
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 660;
  cursor: pointer;
}
.scale-btn.active { background: var(--ag2-soft); border-color: var(--ag2-border); color: var(--ag2); }

/* ── Top Perturbed Waterfall ──────────────────────────────────────── */
.waterfall-box {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.waterfall-box.waterfall-below { margin-top: 16px; margin-bottom: 0; }
.waterfall-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sub-label { font-size: 0.8rem; font-weight: 740; color: var(--ink); }
.waterfall-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 7px; }
.wf-item {
  display: grid;
  grid-template-columns: 72px 1fr 68px;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms var(--ease);
}
.wf-item:hover { border-color: var(--ag2); }
.wf-mark { font-family: var(--font-mono); font-size: 0.76rem; font-weight: 740; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-imp { font-size: 0.62rem; color: var(--muted); display: block; font-family: var(--font-sans); font-weight: 500; }
.wf-bar-svg { width: 100%; height: 14px; display: block; }
.wf-val { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 720; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Multi-Track Genome Browser ───────────────────────────────────── */
.seg-control {
  display: inline-flex;
  padding: 2px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  gap: 2px;
}
.seg-btn {
  padding: 5px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 660;
  cursor: pointer;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--line);
}

.browser-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.browser-control-left, .browser-control-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mini-input {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
  width: 210px;
}
.mini-input:focus { outline: none; border-color: var(--ag2); background: var(--surface); }

.tracks-canvas-shell {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
}
#tracks-canvas { display: block; width: 100%; cursor: crosshair; }
.tracks-footer-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.hint { font-size: 0.79rem; color: var(--muted); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ── Conditional AG1 Discrepancy Inspector ────────────────────────── */
.discrepancy-section {
  border-color: var(--hot-border);
  box-shadow: inset 4px 0 0 var(--accent-hot), var(--shadow-sm);
}
.discrepancy-summary {
  padding: 10px 14px;
  margin-bottom: 16px;
  border-radius: 10px;
  background: var(--hot-soft);
  border: 1px solid var(--hot-border);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 600;
}
.disc-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.disc-panel { padding: 14px 16px; border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); }
.disc-subtitle { font-size: 0.88rem; font-weight: 760; margin-bottom: 10px; }
.disc-track-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.disc-track-head .disc-subtitle { margin-bottom: 0; }
.sort-select {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 640;
}
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.score-table { width: 100%; border-collapse: collapse; font-size: 0.81rem; }
.score-table th, .score-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.score-table thead th { font-size: 0.71rem; font-weight: 740; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.score-table tbody tr:last-child > * { border-bottom: none; }
.score-table tbody tr.row-hot { background: var(--hot-soft); }

.ag1-overlay-wrap { border-radius: 10px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; height: 220px; }
#ag1-overlay-canvas { display: block; width: 100%; height: 100%; }
.ag1-overlay-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 0.78rem; color: var(--ink-2); }

/* ── Provenance & ClinVar Panel ───────────────────────────────────── */
.provenance-panel { padding: 16px 20px; }
.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.prov-box h3 { font-size: 0.84rem; font-weight: 760; margin-bottom: 6px; }
.prov-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 0.8rem; }
.prov-dl dt { color: var(--muted); font-weight: 640; }
.prov-dl dd { color: var(--ink); overflow-wrap: anywhere; }

/* ── Footer ───────────────────────────────────────────────────────── */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}
.footer-meta kbd {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

@media (max-width: 960px) {
  .score-cards-grid { grid-template-columns: 1fr; }
  .disc-grid { grid-template-columns: 1fr; }
  .policy-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .assembly-pill { display: none; }
}
@media (max-width: 780px) {
  .ag2-summary-grid { grid-template-columns: 1fr; }
  .epistemic-strip { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .wrap { width: calc(100% - 24px); }
  .assembly-pill, .api-pill { display: none; }
  .policy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-row { flex-direction: column; }
  .primary-btn { width: 100%; }
  .kbd-hint { display: none; }
}
@media (max-width: 460px) {
  .masthead-actions { gap: 4px; }
  #queue-pill-text { display: none; }
}
