/* CNNeoDB public site. System fonts only; no external resources. */

:root {
  --canvas: #ffffff;
  --panel: #f5f6f8;          /* name panel, toolbars, status bar */
  --panel-2: #eceef2;
  --row-open: #fafbfc;       /* expanded Search row: a step lighter than --panel */
  --ink: #1d1d1f;
  --ink-hover: #000000;      /* primary button hover */
  --ink-pressed: #333336;    /* primary button active (ink tonal ramp) */
  --ink-2: #474a52;          /* secondary text, 8.9:1 on white */
  --ink-3: #62666f;          /* NA, hints, track labels, 5.9:1 on white */
  --rule: #d5d8de;
  --rule-2: #e8eaee;
  --control: #868b94;        /* form control borders, 3.5:1 */
  --mut: #d3363c;            /* the single accent: differing residues (white text 4.9:1) */
  --cursor-veil: rgba(52, 64, 88, 0.12); /* column cursor: blue-grey veil, #e7e8eb on white */
  --focus: #2c5be0;
  --error: #a3262b;
  --select: #cbd8f8;

  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  --res-size: 15px;          /* residue font size in lists */
  --pitch: 1.7ch;            /* fixed residue cell width (in the residue font) */
  --lbl-w: 3.25rem;          /* sequence name panel width inside a band */

  --page: 1240px;
  --gutter: clamp(1rem, 3vw, 2rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  caret-color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; outline: none; }

::selection { background: var(--select); color: var(--ink); }

h1, h2, h3 { line-height: 1.25; margin: 0; text-wrap: balance; }
h1 { font-size: 1.875rem; font-weight: 650; letter-spacing: -0.012em; }
h2 { font-size: 1.375rem; font-weight: 650; }
h3 { font-size: 1.125rem; font-weight: 650; }
p { margin: 0 0 0.85em; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--control);
}
a:hover { text-decoration-color: var(--ink); text-decoration-thickness: 2px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-size: 0.93em; }
.na, .seq-none { color: var(--ink-3); }
.hint { color: var(--ink-3); font-size: 0.875rem; }
.lede { color: var(--ink-2); }
.empty-note { color: var(--ink-2); }

/* Prose justification (R13). Continuous sans prose only: never tables, residue grids, mono
   data, figures, headings, navigation, controls, labels, tags or the showcase change notes.
   Hyphenation (needs <html lang="en">) is switched on below 640px only, where a short
   measure would otherwise open wide word gaps; wide measures justify cleanly without it.
   No text-justify: the default lets the same rule justify CJK text in the admin. */
:is(
  .lede,
  .lead-text p,
  .dataset > p:not(.bignum):not(.more),
  .arch-intro,
  .page-read p:not(.read-next),
  .plate figcaption,
  .gate-modules,
  .viewer-empty > p:not(.actions),
  .submit-intro p,
  .history .empty-note,
  .dl-desc,
  .citation p:not(.citation-ref),
  .admin-intro
) {
  text-align: justify;
  -webkit-hyphens: var(--prose-hyphens, manual);
  hyphens: var(--prose-hyphens, manual);
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 0.75rem; top: -3rem; z-index: 20;
  background: var(--ink); color: #fff; padding: 0.5rem 0.75rem;
}
.skip:focus { top: 0.5rem; }

/* ------------------------------------------------------------ Masthead */

.masthead { border-bottom: 1px solid var(--rule); background: var(--canvas); }
.masthead-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 56px;
  display: flex;
  align-items: center;
  gap: 2rem;
}
.page-wide-shell .masthead-inner { max-width: none; }

.wordmark {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark span { font-weight: 450; color: var(--ink-2); }

.modules { margin-left: auto; }
.modules ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.25rem; }
.modules a {
  display: block;
  padding: 0 0.75rem;
  line-height: 55px;
  text-decoration: none;
  color: var(--ink-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.modules a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.modules a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

.userarea {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  padding-left: 1.25rem;
  border-left: 1px solid var(--rule);
  white-space: nowrap;
}
.userarea form { margin: 0; }
.userarea a { text-decoration: none; color: var(--ink-2); }
.userarea a:hover, .userarea a[aria-current="page"] { color: var(--ink); text-decoration: underline; }
.userarea .who { font-weight: 600; color: var(--ink); }

.linkbtn {
  font: inherit; color: var(--ink-2); background: none; border: 0; padding: 0; cursor: pointer;
}
.linkbtn:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 0.2em; }

.modebar { background: var(--panel); border-top: 1px solid var(--rule-2); }
.modebar-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.3rem var(--gutter);
  display: flex;
  gap: 0.75rem;
  font-size: 0.8125rem;
  color: var(--ink-2);
}
.modebar .mode { font-weight: 600; color: var(--ink); }
.modebar .count::before { content: "\00b7"; margin-right: 0.75rem; color: var(--ink-3); }

/* ------------------------------------------------------------ Page shells */

.page { max-width: var(--page); margin: 0 auto; padding: 2rem var(--gutter) 3.5rem; }
.page-wide { max-width: 1680px; padding-top: 1.25rem; }
.page-narrow { max-width: 40rem; }
.page-read { max-width: calc(72ch + 2 * var(--gutter)); font-size: 1rem; line-height: 1.65; }
.page-read h1 { margin-bottom: 1rem; }
.page-read h2 { margin: 2.5rem 0 0.75rem; }

.flashes { max-width: var(--page); margin: 1rem auto 0; padding: 0 var(--gutter); }
.flash {
  margin: 0 0 0.5rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--rule);
  background: var(--panel);
  font-size: 0.9375rem;
}
.flash-success { border-color: var(--ink-3); }

.sitefoot {
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-align: center;
  padding: 1.25rem var(--gutter);
}
.sitefoot p { margin: 0; }

/* ------------------------------------------------------------ Controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 38px;
  padding: 0.4rem 1rem;
  border: 1px solid var(--control);
  border-radius: 3px;
  background: var(--canvas);
  color: var(--ink);
  font: inherit;
  font-weight: 550;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--panel); border-color: var(--ink-2); }
.btn:active { background: var(--panel-2); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); }
.btn-primary:active { background: var(--ink-pressed); }
.btn-quiet { border-color: transparent; background: none; color: var(--ink-2); }
.btn-quiet:hover { background: var(--panel); border-color: transparent; color: var(--ink); }

.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 1rem; min-width: 0; }
.field label, .field legend { font-size: 0.875rem; font-weight: 600; color: var(--ink); padding: 0; }
.req, .opt { font-weight: 400; color: var(--ink-3); font-size: 0.8125rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input:not([type]), select, textarea {
  font: inherit;
  font-size: 0.9375rem;
  color: var(--ink);
  background: var(--canvas);
  border: 1px solid var(--control);
  border-radius: 3px;
  min-height: 38px;
  padding: 0.4rem 0.6rem;
  width: 100%;
  min-width: 0;
}
textarea { min-height: 6rem; resize: vertical; line-height: 1.5; }
select { padding-right: 1.75rem; }
input.mono { font-family: var(--mono); letter-spacing: 0.04em; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; letter-spacing: 0; }
input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus);
}
.has-error input, .has-error textarea, input[aria-invalid="true"] { border-color: var(--error); }
.field-error { margin: 0; color: var(--error); font-size: 0.8125rem; }
.field-error::before { content: "Error: "; font-weight: 600; }
.field-help { margin: 0; color: var(--ink-3); font-size: 0.8125rem; }
.form-error {
  border: 1px solid var(--error);
  color: var(--error);
  padding: 0.6rem 0.9rem;
  margin: 0 0 1rem;
  font-size: 0.9375rem;
}
.check { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; margin: 0 0 1.25rem; }
.check input { width: 16px; height: 16px; accent-color: var(--ink); }

/* ------------------------------------------------------------ Tags and glyphs */

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 3px 4px 2px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  vertical-align: 0.15em;
  white-space: nowrap;
}
.tag-val { background: var(--ink); color: #fff; }
.tag-pred { border-style: dashed; color: var(--ink); background: var(--canvas); }

.resp { white-space: nowrap; }
.resp b {
  display: inline-block;
  width: 1.15em;
  font-family: var(--mono);
  font-weight: 700;
  text-align: center;
  margin-right: 0.2em;
}
.resp-neg { color: var(--ink-2); }

/* ------------------------------------------------------------ Residue grid */

.seq, .ruler, .dtrack {
  font-family: var(--mono);
  font-size: var(--res-size);
  display: inline-flex;
  white-space: nowrap;
  line-height: 1;
}
.seq > *, .ruler > *, .dtrack > * {
  flex: none;
  width: var(--pitch);
  text-align: center;
}
.seq > * {
  display: inline-block;
  height: 1.55em;
  line-height: 1.55em;
  background: none;
  color: inherit;
  font-weight: 450;
  padding: 0;
}
.seq > *:focus { outline: none; }
/* Residue focus is shown by the active-cell mark below (viewer.js keeps it on the focused cell). */
.seq > *:focus-visible { outline: none; }
.seq-wt { color: var(--ink-2); }

/* Mutation only (default scheme) */
.seq-mut > mark { background: var(--mut); color: #fff; font-weight: 700; }
.seq-wt > mark { box-shadow: inset 0 0 0 1.5px var(--mut); color: var(--ink); }

/* Clustal scheme: residues coloured by physico-chemical class */
[data-scheme="clustal"] .seq > :is(.a-A, .a-I, .a-L, .a-M, .a-F, .a-W, .a-V) { background-color: #c4d3f8; }
[data-scheme="clustal"] .seq > :is(.a-K, .a-R) { background-color: #f6c6cf; }
[data-scheme="clustal"] .seq > :is(.a-D, .a-E) { background-color: #e0cdf3; }
[data-scheme="clustal"] .seq > :is(.a-N, .a-Q, .a-S, .a-T) { background-color: #c6e8c9; }
[data-scheme="clustal"] .seq > .a-C { background-color: #f9d4b4; }
[data-scheme="clustal"] .seq > .a-G { background-color: #fbe39c; }
[data-scheme="clustal"] .seq > .a-P { background-color: #ede6a2; }
[data-scheme="clustal"] .seq > :is(.a-H, .a-Y) { background-color: #bfe5ec; }
[data-scheme="clustal"] .seq > mark { color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); font-weight: 700; }

/* None: plain ink, differences only on the difference track */
[data-scheme="none"] .seq > mark { background: none; color: inherit; box-shadow: none; font-weight: inherit; }
[data-scheme="none"] .dtrack > .on { background: var(--ink); }

/* Column cursor (instant, no transition). The column is a veil painted over each cell's own
   fill, so Clustal colours keep their hue; in Mutation only the differing residue stays pure
   red. The active cell (pointer or keyboard focus) is the only ink-filled cell; a differing
   residue in Mutation only keeps its red and takes an ink outline instead. [data-viewer]
   lifts these rules above the Clustal class fills. */
.seq > .cur, .dtrack > .cur:not(.on) { background-image: linear-gradient(var(--cursor-veil), var(--cursor-veil)); }
.seq-mut > mark.cur { background-image: none; }
[data-scheme] .seq > mark.cur { background-image: linear-gradient(var(--cursor-veil), var(--cursor-veil)); }
.ruler > .cur::after { background: var(--ink) !important; height: 100% !important; width: 2px !important; }
[data-viewer] .seq > .act { position: relative; z-index: 1; background-color: var(--ink); background-image: none; color: #fff; box-shadow: none; }
[data-viewer] .seq-mut > mark.act { background-color: var(--mut); outline: 2px solid var(--ink); outline-offset: 2px; }
[data-scheme] [data-viewer] .seq-mut > mark.act { background-color: var(--ink); outline: none; }

/* Ruler: tick every 5 positions, number every 10 */
.ruler { height: 20px; align-items: flex-end; color: var(--ink-3); }
.ruler > * { position: relative; height: 100%; display: block; }
.ruler > *::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 1px;
  height: 3px;
  background: var(--rule);
}
.ruler > .t5::after { height: 6px; background: var(--ink-3); }
.ruler > .t10::after { height: 8px; background: var(--ink-2); }
.ruler b {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-2);
}

/* Difference track */
.dtrack { height: 8px; align-items: center; }
.dtrack > * { height: 6px; display: block; }
.dtrack > .on { background: var(--mut); }

/* Track rows (bands) */
.band { display: inline-grid; gap: 2px; position: relative; max-width: 100%; }
.trk { display: flex; align-items: center; gap: 0; min-height: 1.55em; }
.trk .lbl, .ln .lbl {
  flex: none;
  width: var(--lbl-w);
  padding-right: 0.6rem;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.trk-ruler { min-height: 0; }
/* No column gap: the difference track must start exactly where the residues do. */
.trk-diff { min-height: 0; flex-wrap: wrap; gap: 0; }
.trk-diff .dnote { margin-left: 0.75rem; }
.dnote { font-size: 0.8125rem; color: var(--ink-3); }
.dnote-pin { display: contents; }

.band-lg { --res-size: 30px; --pitch: 1.6ch; --lbl-w: 3.75rem; }
.band-lg .seq > * { height: 1.45em; line-height: 1.45em; }
.band-lg .ruler { height: 26px; }
.band-lg .ruler b { font-size: 12px; }
.band-lg .dtrack { height: 12px; }
.band-lg .dtrack > * { height: 9px; }

.readout {
  display: block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--ink-2);
  min-height: 1.4em;
}
.readout.is-data { font-family: var(--mono); color: var(--ink); }

/* ------------------------------------------------------------ Home */

.page-home { padding-top: 2.25rem; }
/* Lead: the title across the content width, the intro stacked below it. */
.lead h1 { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; text-wrap: wrap; }
/* The intro runs the full content width, flush with the showcase below it. */
.lead-text { color: var(--ink-2); line-height: 1.7; margin-top: 0.9rem; }
/* Desktop (R2): the title is one line whose ends sit on the showcase edges, at any
   viewport from 960px (laptops at 125-150% scaling are ~1100-1250px wide). The size follows
   the column width through a container query unit: the line is 42.5 x font-size wide in
   Arial (Helvetica Neue's metrics, the widest system face in the stack), so 100cqi / 44.3
   leaves a ~4% margin and justify spreads the rest over the word gaps. At the full 1176px
   column this is 26.5px. If the line wraps anyway (an unexpected font, text-only zoom),
   viewer.js adds .is-wrapped and the title falls back to plain left alignment, so a
   stretched last line never shows. Narrower viewports wrap naturally. */
@media (min-width: 960px) {
  .lead { container-type: inline-size; }
  .lead h1 { font-size: min(26.5px, 100cqi / 44.3); text-align: justify; text-align-last: justify; }
  .lead h1.is-wrapped { text-align: left; text-align-last: auto; }
}
@supports not (width: 1cqi) {
  @media (min-width: 960px) and (max-width: 1279px) {
    .lead h1 { font-size: 2rem; text-align: left; text-align-last: auto; }
  }
}
.lead-text p { margin: 0 0 0.5rem; }
.lead-text p:last-child { margin-bottom: 0; }

.showcase {
  margin: 2rem 0 2.5rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--canvas);
}
.showcase-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.55rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--rule-2);
  font-size: 0.875rem;
}
.recid { font-weight: 600; }
.meta-k { color: var(--ink-3); margin-right: 0.15em; }
.showcase-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 3rem;
  padding: 1.5rem 1.25rem 1.25rem 0.5rem;
  flex-wrap: wrap;
}
.showcase .readout {
  border-top: 1px solid var(--rule-2);
  padding: 0.45rem 1rem;
  background: var(--panel);
}
/* The featured band outweighs the headline: residue cells of ~42-52px at desktop. */
.showcase .band-lg { --res-size: clamp(30px, 3.1vw, 42px); --pitch: 2.1ch; --lbl-w: 4rem; }
.showcase .band-lg .seq > * { font-weight: 500; }
.showcase .band-lg .ruler { height: 30px; }
.showcase .band-lg .ruler b { font-size: 13px; }
.showcase .band-lg .ruler > .t5::after { height: 8px; }
.showcase .band-lg .ruler > .t10::after { height: 11px; }
.showcase .band-lg .dtrack { height: 14px; }
.showcase .band-lg .dtrack > * { height: 10px; }
/* The change note hangs from a 1px leader under the centre of the first differing column.
   Grid, not wrapping flex: the note row must not add to the band's max-content width. */
.showcase .trk-diff { display: grid; grid-template-columns: var(--lbl-w) max-content; gap: 0; }
.showcase .dnote-pin {
  display: block;
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: var(--res-size);
  line-height: 1;
  padding-left: calc(var(--lbl-w) + (var(--at, 0) + 0.5) * var(--pitch));
}
.showcase .dnote-pin .dnote {
  display: block;
  font-family: var(--sans);
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--ink-2);
  margin-left: 0;
  border-left: 1px solid var(--mut);
  padding: 0.35rem 0 0 0.45rem;
  white-space: nowrap;
}
/* Difference in the right half: the note hangs to the left of its leader, inside the band. */
.showcase .dnote-pin.is-end { padding-left: 0; padding-right: calc((var(--after, 0) + 0.5) * var(--pitch)); }
.showcase .dnote-pin.is-end .dnote { text-align: right; border-left: 0; border-right: 1px solid var(--mut); padding: 0.35rem 0.45rem 0 0; }
.quicksearch { flex: 0 1 25rem; margin-left: auto; }
.quicksearch label { display: block; font-size: 0.875rem; font-weight: 600; margin-bottom: 0.3rem; }
.quicksearch-row { display: flex; gap: 0.5rem; }
.quicksearch input { font-family: var(--mono); letter-spacing: 0.04em; }
.quicksearch .field-help { margin-top: 0.35rem; }

/* One authored moment: the ruler is scanned once, then the differing column lights up.
   The scan line is painted, not positioned: a fixed overlay over the residue area whose
   2px line moves by background-position, so no frame changes layout. */
@media (prefers-reduced-motion: no-preference) {
  .page-home .band-lg::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--lbl-w);
    right: 0;
    background: linear-gradient(var(--focus), var(--focus)) 0 0 / 2px 100% no-repeat;
    opacity: 0;
    pointer-events: none;
    animation: scan 1.1s var(--ease-out) 0.15s;
  }
  .page-home .band-lg .seq-mut > mark,
  .page-home .band-lg .dtrack > .on {
    animation: light 0.5s var(--ease-out) 0.95s backwards;
  }
  .page-home .band-lg .seq-wt > mark { animation: light-wt 0.5s var(--ease-out) 0.95s backwards; }
}
@keyframes scan {
  0% { background-position: 0 0; opacity: 0.9; }
  85% { opacity: 0.9; }
  100% { background-position: 100% 0; opacity: 0; }
}
@keyframes light { from { background-color: transparent; color: var(--ink); } }
@keyframes light-wt { from { box-shadow: inset 0 0 0 1.5px transparent; } }

.datasets { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.dataset { display: flex; flex-direction: column; border-top: 2px solid var(--ink); padding-top: 1rem; }
.dataset-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.bignum { margin: 0.5rem 0 0.75rem; color: var(--ink-2); font-size: 0.9375rem; }
.bignum .num { font-family: var(--sans); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; font-size: 3rem; line-height: 1; color: var(--ink); letter-spacing: -0.03em; margin-right: 0.35rem; }
.dataset > p:not(.bignum) { color: var(--ink-2); }
.dataset .more { margin: auto 0 0; padding-top: 0.75rem; display: flex; flex-wrap: wrap; gap: 0.35rem 1.5rem; font-weight: 600; }

table.stat { border-collapse: collapse; width: 100%; font-size: 0.875rem; margin: 0.25rem 0 0.5rem; }
table.stat caption { text-align: left; font-weight: 650; font-size: 0.875rem; padding-bottom: 0.4rem; }
table.stat th, table.stat td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--rule-2); text-align: right; }
table.stat thead th { border-bottom: 1px solid var(--ink); font-weight: 600; color: var(--ink-2); vertical-align: bottom; }
table.stat th:first-child { text-align: left; padding-left: 0; }
table.stat tbody th { font-weight: 500; }
table.stat td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.stat td:last-child { font-weight: 650; }

.arch { margin-top: 4rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.arch-intro { color: var(--ink-2); margin: 0.75rem 0 1.75rem; }  /* full content width, justified */
.arch-sets { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-bottom: 2.5rem; }
.arch-sets h3 { margin-bottom: 0.75rem; }

.fields { margin: 0; display: grid; gap: 0.5rem; }
.fields > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--rule-2); }
.fields dt { color: var(--ink-3); font-size: 0.875rem; }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.fields-grid { grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); column-gap: 2rem; gap: 0 2rem; }
.fields-grid > div { grid-template-columns: 8.5rem minmax(0, 1fr); }

.tracks { margin: 0 0 2.25rem; }
.tracks figcaption { font-weight: 650; margin-bottom: 0.75rem; }
.track { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); align-items: end; gap: 0.75rem; margin-bottom: 0.4rem; }
.track-name { font-size: 0.8125rem; color: var(--ink-3); padding-bottom: 2px; }
.bars {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  height: 84px;
  align-items: end;
  border-bottom: 1px solid var(--ink-3);
}
.bars li { display: flex; flex-direction: column-reverse; align-items: stretch; height: 100%; }
.bars .bar { display: block; height: calc(var(--v, 0) * 64px); background: var(--ink); }
.bars .has .bar { min-height: 2px; }
.bar-count { font-size: 11px; color: var(--ink-2); text-align: center; line-height: 1; padding-bottom: 3px; }
.track-axis .bars { height: auto; border: 0; }
.track-axis li { text-align: center; font-size: 11px; color: var(--ink-3); }
.track-table { margin: 0.75rem 0 0 7.25rem; font-size: 0.875rem; }
.track-table summary { cursor: pointer; color: var(--ink-2); }
.track-table table { max-width: 24rem; }

.stack {
  display: flex;
  height: 16px;
  border: 1px solid var(--ink-3);
  align-self: center;
}
.seg { flex-grow: var(--w); flex-basis: 0; }
.seg-pos { background: var(--ink); }
.seg-neg { background: repeating-linear-gradient(135deg, var(--canvas) 0 3px, var(--ink-3) 3px 4px); }
.stack-legend { grid-column: 2; margin: 0.2rem 0 0.5rem; font-size: 0.8125rem; color: var(--ink-2); }
.stack-legend { display: flex; flex-wrap: wrap; gap: 0.2rem 1.25rem; }
.stack-legend a { color: inherit; text-underline-offset: 3px; }
.stack-legend a:hover { color: var(--ink); }

.fields-title { margin: 0.5rem 0 0.75rem; }
.fieldtable { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
.fieldtable th, .fieldtable td { text-align: left; padding: 0.45rem 0.75rem 0.45rem 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.fieldtable thead th { border-bottom: 1px solid var(--ink); color: var(--ink-2); font-weight: 600; }
.fieldtable tbody th { font-weight: 600; white-space: nowrap; }
.fieldtable td:nth-child(3), .fieldtable td:nth-child(4) { white-space: nowrap; }

/* ------------------------------------------------------------ Login / Register */

.gate-layout {
  max-width: var(--page);
  margin: 0 auto;
  padding: 3rem var(--gutter) 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 26rem);
  gap: 4rem;
  align-items: start;
}
.gate-facts h1 { font-size: 1.875rem; letter-spacing: -0.02em; max-width: 26ch; }
.gate-sizes { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; margin: 2rem 0; }
.gate-sizes div { border-top: 2px solid var(--ink); padding-top: 0.6rem; min-width: 12rem; }
.gate-sizes dt { font-size: 0.875rem; color: var(--ink-2); }
.gate-sizes dd { font-family: var(--sans); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; margin: 0.35rem 0 0; font-size: 2.5rem; line-height: 1; letter-spacing: -0.03em; }
.gate-band { margin: 0 0 1.5rem; padding: 1rem 1rem 0.75rem 0; border: 1px solid var(--rule); border-radius: 4px; --res-size: 22px; --pitch: 1.6ch; }
.gate-band figcaption { padding: 0.6rem 0 0 1rem; font-size: 0.8125rem; color: var(--ink-2); }
.gate-band .readout { padding: 0.3rem 0 0 1rem; }
.gate-modules { color: var(--ink-2); }
.gate-form {
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.75rem 1.75rem 1.5rem;
  background: var(--canvas);
}
.gate-form h2 { font-size: 1.375rem; margin-bottom: 1.25rem; }
.gate-form .lede { margin-top: -0.75rem; font-size: 0.9375rem; }
.gate-form .btn-primary { width: 100%; }
.gate-alt { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule-2); }
.gate-alt p { font-size: 0.9375rem; margin-bottom: 0.6rem; }
.gate-alt .btn { width: 100%; }
.gate-form > .hint { margin: 1rem 0 0; }

/* ------------------------------------------------------------ Search */

.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}
.toolbar .export { margin-left: auto; }

.dsswitch { display: inline-flex; border: 1px solid var(--control); border-radius: 3px; overflow: hidden; background: var(--canvas); }
.dsswitch a {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.8rem;
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--ink-2);
  border-left: 1px solid var(--rule);
  min-height: 34px;
}
.dsswitch a:first-child { border-left: 0; }
.dsswitch a:hover { background: var(--panel); color: var(--ink); }
.dsswitch a[aria-current="true"] { background: var(--ink); color: #fff; font-weight: 600; }
.dsswitch a[aria-current="true"] .tag-val { background: #fff; color: var(--ink); border-color: #fff; }
.dsswitch a[aria-current="true"] .tag-pred { background: var(--ink); color: #fff; border-color: #fff; }

.scheme { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--ink-2); }
.scheme select { width: auto; min-height: 34px; padding-top: 0.25rem; padding-bottom: 0.25rem; }

.filters {
  border: 1px solid var(--rule);
  border-bottom: 0;
  padding: 1rem 0.75rem 0.25rem;
}
.filters-main {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(12rem, 1.2fr) auto auto;
  gap: 0 1rem;
  align-items: end;
}
.segmented { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; }
.segmented legend { margin-bottom: 0.3rem; }
.seg-group { display: inline-flex; border: 1px solid var(--control); border-radius: 3px; overflow: hidden; }
.seg-group label { position: relative; }
.seg-group input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-group span {
  display: inline-flex; align-items: center; gap: 0.3rem;
  min-height: 36px; padding: 0 0.8rem;
  font-size: 0.875rem; font-weight: 500;
  border-left: 1px solid var(--rule);
  white-space: nowrap;
  color: var(--ink-2);
}
.seg-group label:first-child span { border-left: 0; }
.seg-group b { font-family: var(--mono); }
.seg-group input:hover + span { background: var(--panel); color: var(--ink); }
.seg-group input:checked + span { background: var(--ink); color: #fff; font-weight: 600; }
.seg-group input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.filters-actions { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.filters-more { border-top: 1px solid var(--rule-2); padding: 0.6rem 0 0.4rem; }
.filters-more summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--ink-2); width: max-content; }
.filters-more summary:hover { color: var(--ink); }
.filters-more[open] summary { margin-bottom: 0.75rem; }
.filters-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0 1rem; }

.viewer { border: 1px solid var(--rule); border-radius: 0 0 4px 4px; }
.aln-scroll { overflow-x: auto; scrollbar-color: var(--control) var(--panel); scrollbar-width: thin; }
.aln { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 0.875rem; }
.aln th, .aln td { padding: 0.45rem 0.65rem; border-bottom: 1px solid var(--rule-2); text-align: left; vertical-align: middle; }
.aln thead th {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
  vertical-align: bottom;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
  background: var(--canvas);
}
.aln thead .c-seq { padding-bottom: 0.25rem; }
.sorter { display: inline-flex; align-items: center; gap: 0.25rem; text-decoration: none; color: inherit; }
.sorter:hover { color: var(--ink); text-decoration: underline; }
.sorter.is-sorted { color: var(--ink); }
.sort-ic { width: 8px; height: 10px; fill: var(--ink-3); flex: none; }
.is-sorted .sort-ic { fill: var(--ink); }

/* name panel */
.aln .c-rec, .aln .c-allele, .aln .c-gene, .aln .c-resp { background: var(--panel); white-space: nowrap; }
.aln thead :is(.c-rec, .c-allele, .c-gene, .c-resp) { background: var(--panel); }
.aln .c-resp { border-right: 1px solid var(--rule); }
.aln .c-rec .recid { margin-right: 0.45rem; text-decoration: none; }
.aln .c-rec .recid:hover { text-decoration: underline; }
.aln .c-allele small { display: block; font-size: 0.75rem; color: var(--ink-3); }

.aln .c-seq { white-space: nowrap; padding-left: 0; }
.ln { display: flex; align-items: center; }
.ln .lbl { width: 2.75rem; }
.ln-ruler .lbl { visibility: hidden; }
.lnote { margin: 0.1rem 0 0 2.75rem; font-size: 0.75rem; color: var(--ink-3); }
.c-len { text-align: right !important; color: var(--ink-2); }
.c-ann { color: var(--ink); }
.m-label { display: none; }
.clip { display: block; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-assay .clip { max-width: 24ch; }
.c-reference_pmid { white-space: nowrap; }
.pmid { font-family: var(--mono); font-size: 0.93em; }
.aln .c-more { width: 2.5rem; padding-left: 0; padding-right: 0.5rem; text-align: right; }

.expand {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 3px;
  background: none; color: var(--ink-2); cursor: pointer;
}
.expand svg { width: 16px; height: 16px; transition: transform 160ms var(--ease-out); }
.expand:hover { background: var(--panel); border-color: var(--rule); color: var(--ink); }
.expand[aria-expanded="true"] svg { transform: rotate(180deg); }

.rec.is-open > td { border-bottom-color: transparent; }
.rec.is-open > td:not(.c-rec):not(.c-allele):not(.c-gene):not(.c-resp) { background: var(--row-open); }
.rec-detail > td { background: var(--row-open); padding: 0.5rem 1rem 1.25rem; border-bottom: 1px solid var(--rule); }
.detail { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem 3rem; align-items: start; }
.detail .band { --res-size: 17px; padding-top: 0.25rem; }
.detail .fields-grid { font-size: 0.875rem; }
.detail .more { grid-column: 1 / -1; font-weight: 600; font-size: 0.875rem; }

.statusbar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--panel);
  border-top: 1px solid var(--rule);
  font-size: 0.8125rem;
}
.statusbar .showing { margin: 0; font-weight: 600; }
.statusbar .readout { flex: 1 1 18rem; }
.pager { display: flex; align-items: center; gap: 0.2rem; flex-wrap: wrap; }
.pager a, .pager span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; min-height: 32px; padding: 0 0.5rem;
  border-radius: 3px; text-decoration: none; color: var(--ink-2);
}
.pager a:hover { background: var(--canvas); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.pager a[aria-current="page"] { background: var(--ink); color: #fff; font-weight: 600; }
.pager .is-disabled { color: var(--ink-3); opacity: 0.6; }
.pager .gap { min-width: 1rem; padding: 0; }

.viewer-empty { padding: 1.5rem 1.25rem 0; }
.viewer-empty h2 { margin: 1rem 0 0.5rem; }
.viewer-empty p { color: var(--ink-2); }
.viewer-empty .statusbar { margin: 1.25rem -1.25rem 0; border-radius: 0 0 4px 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* ------------------------------------------------------------ Entry */

.crumbs { display: flex; gap: 0.5rem; font-size: 0.875rem; color: var(--ink-3); margin-bottom: 1rem; }
.crumbs a { color: var(--ink-2); }
.entry-head h1 { font-family: var(--mono); font-weight: 600; font-size: 1.75rem; letter-spacing: 0.02em; }
.entry-head h1 .num { font-size: 1rem; color: var(--ink-3); letter-spacing: 0; margin-right: 0.5rem; vertical-align: 0.2em; }
.entry-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.1rem; margin: 0.6rem 0 1.75rem; color: var(--ink-2); }
.entry-aln { border: 1px solid var(--rule); border-radius: 4px; margin-bottom: 2.25rem; }
.toolbar-slim { border: 0; border-bottom: 1px solid var(--rule-2); justify-content: space-between; }
.toolbar-slim h2 { font-size: 0.9375rem; }
.entry-aln .band { margin: 1.25rem 1rem 1rem 0; }
.entry-aln .readout { padding: 0.45rem 0.75rem; background: var(--panel); border-top: 1px solid var(--rule-2); }
.entry-fields h2 { margin-bottom: 0.75rem; }

/* ------------------------------------------------------------ Background */

.plate { margin: 1.75rem 0 2rem; }
.plate img { display: block; max-width: 100%; height: auto; border: 1px solid var(--rule); background: #fff; }
.plate-wide { margin-left: calc(-1 * min(8vw, 9rem)); margin-right: calc(-1 * min(8vw, 9rem)); }
/* Captions follow the image width (no ch cap) so each one stays on one line on desktop (R3);
   a wide plate's caption is inset back to the reading column. */
.plate figcaption { font-size: 0.875rem; color: var(--ink-2); margin-top: 0.6rem; }
.plate-wide figcaption { margin-left: min(8vw, 9rem); margin-right: min(8vw, 9rem); }
.plate-no { font-weight: 650; color: var(--ink); }
.models { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.models li { padding: 0.75rem 0; border-top: 1px solid var(--rule-2); }
.models li p { margin: 0; }
.read-next { margin-top: 2rem; font-weight: 600; }

/* ------------------------------------------------------------ Submit */

.submit-intro { margin-bottom: 1.5rem; }
.submit-intro h1 { margin-bottom: 0.75rem; }
.submit-intro p:not(.hint) { color: var(--ink-2); }
.submit-tools { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.submit-tools .hint { margin: 0; }
.group { border: 0; border-top: 2px solid var(--ink); margin: 0 0 1.5rem; padding: 0.9rem 0 0; min-width: 0; }
.group legend { font-weight: 650; font-size: 1rem; padding: 0 0.75rem 0 0; float: left; width: 100%; margin-bottom: 0.9rem; }
.group-fields { clear: both; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; }
.field-wide, .field-peptide { grid-column: span 1; }
.field-wide { grid-column: 1 / -1; }
.seqpreview { min-height: 1.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.seqpreview:empty { min-height: 0; margin-top: -0.3rem; }
.seqpreview .seq { --res-size: 15px; border: 1px solid var(--rule-2); }
.seqpreview .seq > * { border-right: 1px solid var(--rule-2); }
.seqpreview .seq > *:last-child { border-right: 0; }
.seqpreview .seq > .bad { color: var(--error); background: #fff; text-decoration: underline wavy var(--error); text-underline-offset: 3px; font-weight: 700; }
.seqpreview-note { font-size: 0.8125rem; color: var(--ink-3); font-family: var(--mono); }
.seqpreview-note.is-bad { color: var(--error); }
.submit-actions { padding-top: 0.25rem; display: flex; justify-content: center; }
.submit-actions .btn { min-width: 10rem; }

.history { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.history h2 { margin-bottom: 0.9rem; }
.table-scroll { overflow-x: auto; }
table.plain { border-collapse: collapse; width: 100%; font-size: 0.875rem; }
table.plain th, table.plain td { text-align: left; padding: 0.45rem 0.9rem 0.45rem 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
table.plain thead th { border-bottom: 1px solid var(--ink); color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.status { display: inline-block; font-size: 0.8125rem; padding: 1px 6px; border: 1px solid var(--ink-3); border-radius: 2px; white-space: nowrap; }
.status-pending { border-style: dashed; }
.status-approved { background: var(--ink); border-color: var(--ink); color: #fff; }
.status-rejected { text-decoration: line-through; text-decoration-thickness: 1px; }

/* ------------------------------------------------------------ Download */

.page-download h1 { margin-bottom: 0.75rem; }
.downloads { border-collapse: collapse; width: 100%; margin: 1.75rem 0 1rem; }
.downloads th, .downloads td { text-align: left; padding: 1rem 1.25rem 1rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.downloads thead th { font-size: 0.8125rem; color: var(--ink-2); font-weight: 600; border-bottom: 1px solid var(--ink); padding-top: 0; padding-bottom: 0.5rem; }
.downloads td.num { font-size: 1.125rem; padding-top: 1.05rem; }
.dl-name { display: block; font-size: 1.0625rem; font-weight: 650; }
.dl-desc { display: block; font-weight: 400; color: var(--ink-2); margin-top: 0.2rem; }
.dl-cols { margin-top: 0.5rem; font-weight: 400; font-size: 0.8125rem; }
.dl-cols summary { cursor: pointer; color: var(--ink-2); }
.dl-cols p { margin: 0.4rem 0 0; color: var(--ink-2); }
.dl-files { white-space: nowrap; }
.dl-files .btn { margin: 0 0.5rem 0.5rem 0; font-family: var(--mono); font-size: 0.875rem; }
.citation { margin-top: 2.5rem; padding: 1.25rem 1.5rem; background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; }
.citation h2 { font-size: 1rem; margin-bottom: 0.5rem; }
.citation p:last-child { margin-bottom: 0; }
.citation-ref { font-family: var(--mono); font-size: 0.875rem; }

/* ------------------------------------------------------------ Account / errors */

.page-narrow h1 { margin-bottom: 1.25rem; }
.formblock { margin-top: 2.25rem; padding-top: 1.25rem; border-top: 2px solid var(--ink); }
.formblock h2 { margin-bottom: 1rem; }
.formblock form { max-width: 24rem; }
.errorpage { padding-top: 4rem; }
.errcode { font-family: var(--sans); font-weight: 600; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -0.02em; font-size: 3.5rem; line-height: 1; margin: 0 0 0.5rem; color: var(--ink-3); }
.errorpage h1 { margin-bottom: 0.75rem; }
.errorpage .actions { margin-top: 1.5rem; }

/* ------------------------------------------------------------ Responsive */

@media (max-width: 1100px) {
  .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .gate-layout { gap: 2.5rem; }
}

@media (max-width: 860px) {
  .masthead-inner { height: auto; flex-wrap: wrap; gap: 0; padding-top: 0.6rem; }
  .wordmark { order: 1; }
  .userarea { order: 2; margin-left: auto; border-left: 0; padding-left: 0; gap: 0.85rem; }
  .modules { order: 3; flex-basis: 100%; margin: 0.35rem calc(-1 * var(--gutter)) 0; overflow-x: auto; scrollbar-width: none; }
  .modules ul { padding: 0 calc(var(--gutter) - 0.6rem); gap: 0; }
  .modules a { line-height: 44px; padding: 0 0.6rem; white-space: nowrap; }

  .datasets, .arch-sets { grid-template-columns: 1fr; }
  .gate-layout { grid-template-columns: 1fr; padding-top: 1.5rem; }
  .filters-main { grid-template-columns: 1fr 1fr; }
  .filters-actions { grid-column: 1 / -1; }
  .detail { grid-template-columns: 1fr; }
  .plate-wide { margin-left: 0; margin-right: 0; }
  .plate-wide figcaption { margin-left: 0; margin-right: 0; }
}

@media (max-width: 640px) {
  :root { --prose-hyphens: auto; }
  body { font-size: 15px; }
  .modules a { padding: 0 0.42rem; font-size: 0.875rem; }
  h1 { font-size: 1.625rem; }
  .page { padding-top: 1.25rem; }
  .lead h1 { font-size: 1.5rem; }
  .band-lg { --res-size: 22px; --lbl-w: 3rem; }
  .showcase .band-lg { --res-size: 23px; --pitch: 2ch; --lbl-w: 3rem; overflow-x: auto; }
  .showcase .dnote-pin, .showcase .dnote-pin.is-end { padding: 0 0 0 0.75rem; }
  .showcase .dnote-pin .dnote, .showcase .dnote-pin.is-end .dnote { text-align: left; border: 0; padding: 0.2rem 0 0; white-space: normal; }
  /* Gate band: the change note gets its own line, inset like the status bar below it. */
  .gate-band .dnote-pin { display: block; flex-basis: 100%; padding: 0.15rem 0 0 1rem; }
  .gate-band .dnote-pin .dnote { margin-left: 0; }
  .showcase-body { padding: 1rem 0.75rem 1rem 0; }
  .quicksearch { flex-basis: 100%; margin-left: 0.75rem; }
  .bignum .num { font-size: 2.25rem; }
  .gate-facts h1 { font-size: 1.375rem; }
  .gate-sizes { gap: 1rem 2rem; margin: 1.25rem 0; }
  .gate-sizes dd { font-size: 1.875rem; }
  .gate-sizes div { min-width: 0; }
  .gate-modules { display: none; }
  .gate-form { padding: 1.25rem; }
  .fieldtable thead { display: none; }
  .fieldtable, .fieldtable tbody, .fieldtable tr, .fieldtable th, .fieldtable td { display: block; }
  .fieldtable tr { padding: 0.55rem 0 0.6rem; border-bottom: 1px solid var(--rule-2); }
  .fieldtable th, .fieldtable td { border: 0; padding: 0; }
  .fieldtable tbody th { white-space: normal; }
  .fieldtable td:nth-child(2) { color: var(--ink-2); }
  .fieldtable td:nth-child(3), .fieldtable td:nth-child(4) { display: inline; font-size: 0.8125rem; }
  .fieldtable td:nth-child(3)::after { content: "\00b7" / ""; margin: 0 0.45rem; color: var(--ink-3); }
  .fieldtable .m-label { margin-right: 0.3rem; }
  .fields > div, .fields-grid > div { grid-template-columns: 7rem minmax(0, 1fr); }
  .track { grid-template-columns: 3.25rem minmax(0, 1fr); gap: 0.4rem; }
  .bar-count { display: none; }
  .track-axis li:nth-child(even) span { visibility: hidden; }
  .track-table { margin-left: 0; }
  .group-fields { grid-template-columns: 1fr; }
  .filters-main, .filters-grid { grid-template-columns: 1fr; }
  .seg-group { display: flex; }
  .seg-group label { flex: 1; }
  .seg-group span { justify-content: center; width: 100%; padding: 0 0.4rem; }
  .toolbar .export { margin-left: 0; }
  .downloads thead { display: none; }
  .downloads, .downloads tbody, .downloads tr, .downloads th, .downloads td { display: block; }
  .downloads tr { border-bottom: 1px solid var(--rule); padding: 0.9rem 0; }
  .downloads th, .downloads td { border: 0; padding: 0.15rem 0; }
  .downloads td.num { display: inline-block; font-size: 0.9375rem; padding: 0.3rem 1.25rem 0.5rem 0; }
  .downloads td.num:nth-of-type(1)::after { content: " records"; font-family: var(--sans); color: var(--ink-2); }
  .downloads td.num:nth-of-type(2)::after { content: " columns"; font-family: var(--sans); color: var(--ink-2); }

  /* Search: each record becomes name row + scrollable residue strip + key annotations */
  .aln-scroll { overflow: visible; }
  .aln, .aln tbody { display: block; }
  .aln thead { display: none; }
  .aln tr.rec {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.75rem;
    row-gap: 0.15rem;
    background: var(--panel);
    border-top: 1px solid var(--rule);
    padding: 0.4rem 0.75rem 0.6rem;
  }
  .aln tr.rec > td { border: 0; padding: 0; background: none !important; }
  .aln .c-rec { grid-column: 1; grid-row: 1; }
  .aln .c-allele { grid-column: 2; grid-row: 1; }
  .aln .c-allele small { display: none; }
  .aln .c-gene { grid-column: 3; grid-row: 1; overflow: hidden; text-overflow: ellipsis; }
  .aln .c-more { grid-column: 4; grid-row: 1; width: auto; }
  .aln .c-resp { grid-column: 1 / -1; grid-row: 2; border: 0; font-size: 0.8125rem; }
  .aln .c-seq {
    grid-column: 1 / -1;
    grid-row: 3;
    overflow-x: auto;
    background: var(--canvas) !important;
    margin: 0.35rem -0.75rem;
    padding: 0.35rem 0.75rem 0.35rem 0 !important;
    border-top: 1px solid var(--rule-2) !important;
    border-bottom: 1px solid var(--rule-2) !important;
  }
  .aln .c-len { display: none; }
  .aln .c-ann { grid-column: 1 / -1; font-size: 0.8125rem; }
  /* Expanded: the field list below repeats these lines. */
  .aln tr.rec.is-open > .c-ann { display: none; }
  .m-label { display: inline; color: var(--ink-3); margin-right: 0.35rem; }
  .clip { display: inline; max-width: none; white-space: normal; }
  .aln tr.rec-detail, .aln tr.rec-detail > td { display: block; }
  .aln tr.rec-detail[hidden] { display: none; }
  .detail .band { overflow-x: auto; max-width: 100%; }
  .statusbar { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .masthead, .modebar, .toolbar, .filters, .statusbar, .sitefoot, .expand { display: none; }
}
