:root {
  color-scheme: light dark;
  --bg: #f4f6f9;
  --card: #ffffff;
  --fg: #1b2129;
  --muted: #5a6573;
  --border: #d6dce4;
  --soft: #eef1f5;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --species: #1f9d55;
  --genus: #d99a0b;
  --below: #e08a1e;
  --distant: #d9534f;
  --species-bg: #dcf3e5;
  --genus-bg: #faefcf;
  --distant-bg: #fbe0df;
  --r-species: #1f9d55;
  --r-genus: #5fa31c;
  --r-family: #c99a0a;
  --r-order: #e0801a;
  --r-class: #d9534f;
  --r-phylum: #b8407a;
  --r-domain: #7b4fb0;
  --r-none: #6b7280;
  --r-closest: #2563eb;
  --r-plain: #6b7280;
  --online: #1f9d55;
  --offline: #d9534f;
  --cat-1: #2f6fe4; --cat-2: #e0801a; --cat-3: #1f9d55; --cat-4: #b8407a; --cat-5: #0e9aa7;
  --cat-6: #d9b30b; --cat-7: #7b4fb0; --cat-8: #d9534f; --cat-9: #6f8f1e; --cat-10: #8a6a4f;
  --cat-other: #a3adba;
  --src-1: #5f8ca3; --src-2: #9277ab; --src-3: #9a8a55;
  --nohit: #b45309;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .05);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1217;
    --card: #171d25;
    --fg: #e5e9ee;
    --muted: #96a2b0;
    --border: #2b3441;
    --soft: #1f2732;
    --accent: #5b8def;
    --accent-fg: #0b1220;
    --species: #3ecf7a;
    --genus: #f0b43a;
    --distant: #ef6f6a;
    --below: #f0a040;
    --r-species: #3ecf7a;
    --r-genus: #8ccf4a;
    --r-family: #e8c13a;
    --r-order: #f29a40;
    --r-class: #ef6f6a;
    --r-phylum: #e06aa5;
    --r-domain: #a98ae0;
    --r-none: #98a2b0;
    --r-closest: #5b8def;
    --r-plain: #98a2b0;
    --species-bg: #14352384;
    --genus-bg: #3c2f0f90;
    --distant-bg: #40191890;
    --online: #3ecf7a;
    --offline: #ef6f6a;
    --cat-1: #6b9bf5; --cat-2: #f29a40; --cat-3: #3ecf7a; --cat-4: #e06aa5; --cat-5: #3fc4d1;
    --cat-6: #e8c13a; --cat-7: #a98ae0; --cat-8: #ef6f6a; --cat-9: #9bc24a; --cat-10: #c29a7a;
    --cat-other: #5d6876;
    --src-1: #7fa8bd; --src-2: #ad94c4; --src-3: #b8a670;
    --nohit: #f0b45a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* header */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 22px 0 14px;
}
.header-row {
  display: flex; flex-wrap: wrap; gap: 12px 24px;
  align-items: flex-start; justify-content: space-between;
}
.brand h1 {
  margin: 0; font-size: 2rem; letter-spacing: -.02em; line-height: 1.1;
  display: flex; align-items: center; gap: 10px;
}
.brand h1 a { display: inline-flex; align-items: center; gap: 10px; }
.brand .logo, .brand .logo img { display: block; width: 44px; height: 44px; flex: none; }
.tagline { margin: 4px 0 0; color: var(--muted); max-width: 46em; }
.teaser {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 16px; align-items: center;
  margin: 0 0 18px; padding: 14px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-left: 4px solid var(--accent); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 7%, var(--card));
  color: var(--muted); font-size: .92rem; line-height: 1.5;
}
.teaser-icon { color: var(--accent); }
.teaser strong { display: block; color: var(--fg); font-size: 1.05rem; margin-bottom: 2px; }
.teaser-text span { display: block; max-width: 70em; }
.teaser-link {
  justify-self: end; white-space: nowrap; padding: 7px 16px; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none;
}
.teaser-link:hover, .teaser-link:focus-visible { filter: brightness(1.1); text-decoration: none; }
@media (max-width: 760px) {
  .teaser { grid-template-columns: auto minmax(0, 1fr); }
  .teaser-link { grid-column: 2; justify-self: start; }
}
.species-note { margin: 4px 0 2px; font-size: .9rem; }
.species-note a { font-weight: 600; }
.status {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: .88rem; color: var(--fg);
  background: var(--soft); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px 3px 8px; cursor: pointer;
}
.status .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex-shrink: 0; display: inline-block; }
.status[data-state="online"] {
  background: transparent; border-color: transparent; padding: 4px;
}
.status[data-state="online"]:hover {
  background: color-mix(in srgb, var(--online) 15%, transparent);
  border-radius: 50%;
}
.status[data-state="online"]:focus-visible {
  border-radius: 50%;
}
.status[data-state="online"] .status-text { display: none; }
.status[data-state="online"] .dot { background: var(--online); box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 25%, transparent); }
.status[data-state="offline"] .dot { background: var(--offline); box-shadow: 0 0 0 3px color-mix(in srgb, var(--offline) 25%, transparent); }
.status[data-state="checking"] .dot { animation: pulse 1s ease-in-out infinite; }
.status-detail { margin: 8px 0 0; font-size: .88rem; color: var(--muted); min-height: 1.3em; }
.status-detail code { font-family: var(--mono); font-size: .92em; }
.status-detail .warn { color: var(--distant); }
/* the Details panel: one aligned label/value list, then the databases table */
.sp-facts {
  columns: 2 260px; column-gap: 32px;
  margin: 0; font-size: .88rem;
}
.sp-fact { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 12px; padding: 1px 0; break-inside: avoid; }
.sp-facts dt {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; padding-top: .12em;
}
.sp-facts dd {
  margin: 0; color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; min-width: 0;
}
.sp-catalog { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin: 8px 0 0; font-size: .82rem; }
.sp-table-wrap { min-width: 0; }
.sp-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.sp-table th, .sp-table td {
  text-align: left; vertical-align: baseline; padding: 2px 8px 2px 0;
  overflow-wrap: anywhere; font-weight: 400;
}
.sp-table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border);
}
.sp-table tbody th, .sp-table tbody td { border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.sp-table tbody tr:last-child th, .sp-table tbody tr:last-child td { border-bottom: 0; }
.sp-table .sp-num { text-align: right; font-variant-numeric: tabular-nums; padding-right: 10px; }
.sp-table th.sp-db-name { color: var(--fg); font-weight: 600; cursor: help; }
.sp-sources { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.sp-sources-label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
}
.sp-source-list { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 0; padding: 0; list-style: none; min-width: 0; }
.sp-src { color: var(--fg); font-weight: 600; cursor: help; overflow-wrap: anywhere; }
.sp-note-warn {
  margin: 0; font-size: .82rem;
  border-left: 3px solid color-mix(in srgb, var(--distant) 55%, var(--border));
  padding-left: 8px; cursor: help;
  color: color-mix(in srgb, var(--distant) 80%, var(--fg)); font-weight: 600;
}
.privacy {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 8px 0 0; font-size: .88rem; color: var(--muted);
}
.privacy svg { flex: none; margin-top: 4px; color: var(--species); }
.terms-note svg { color: var(--accent); }
.brand h1 a { color: inherit; text-decoration: none; }

/* cards */
main.wrap { padding-top: 22px; padding-bottom: 36px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card > h2, .card-head h2, .card-head h3 { margin: 0 0 12px; font-size: 1.15rem; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }

/* input */
.drop { position: relative; }
textarea {
  display: block; width: 100%; height: 190px; resize: vertical;
  font: .82rem/1.4 var(--mono); color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
  white-space: pre; overflow: auto;
}
textarea:focus-visible, input:focus-visible, button:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
textarea:disabled { opacity: .5; }
.drop.has-file textarea { height: 64px; resize: none; opacity: .5; pointer-events: none; }
.file-chip {
  position: absolute; inset: 0; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; border-radius: 8px; background: var(--soft);
  border: 1px solid var(--accent); min-width: 0;
}
.file-chip svg { flex: none; color: var(--accent); }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-meta { color: var(--muted); white-space: nowrap; font-size: .9rem; }
.file-chip .link-btn { margin-left: auto; }
.link-btn {
  font: inherit; font-size: .9rem; color: var(--accent); background: none; border: 0;
  padding: 2px 4px; cursor: pointer; text-decoration: underline;
}
.drop-overlay {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  border: 2px dashed var(--accent); border-radius: 8px; font-weight: 600; color: var(--accent);
  background: color-mix(in srgb, var(--card) 85%, var(--accent));
}
.drop.dragging .drop-overlay { display: flex; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.size { margin-left: auto; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.size.over { color: var(--distant); font-weight: 600; }
.input-msg { margin: 8px 0 0; color: var(--distant); font-size: .92rem; }

.btn {
  font: inherit; font-size: .95rem; cursor: pointer; color: var(--fg);
  background: var(--soft); border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 14px; min-height: 38px;
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; padding: 8px 20px; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.options { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: .88rem; color: var(--muted); }
.field input {
  width: 9.5em; font: inherit; font-size: 1rem; color: var(--fg); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; min-height: 38px;
}
.field input:invalid { border-color: var(--distant); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 18px; }
.progress { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) {
  .spinner, .status[data-state="checking"] .dot { animation-duration: 3s; }
}

/* messages */
.notice {
  border-radius: 12px; padding: 14px 18px; margin-bottom: 18px;
  border: 1px solid var(--border); background: var(--card);
}
.notice h3 { margin: 0 0 4px; font-size: 1rem; }
.notice p { margin: 4px 0 0; }
.notice.error { border-color: var(--distant); background: var(--distant-bg); }
.notice.warn { border-color: var(--genus); background: var(--genus-bg); }
.notice.info { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.server-banner .notice { margin-bottom: 18px; }
.server-banner .retry { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.btn-small { min-height: 0; padding: 3px 12px; font-size: .88rem; }
.connect { margin-top: 12px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, currentColor 18%, transparent); }
.connect label { display: block; font-weight: 600; font-size: .92rem; }
.connect-row { display: flex; gap: 8px; margin-top: 6px; }
.connect-row input {
  flex: 1; min-width: 0; font: inherit; font-family: var(--mono); font-size: .9rem;
  padding: 7px 10px; color: var(--fg); background: var(--card);
  border: 1px solid var(--border); border-radius: 8px;
}
.connect-err { color: var(--distant); margin: 6px 0 0; }
.connect-err[hidden] { display: none; }
.submit-hint { font-size: .9rem; color: var(--distant); font-weight: 600; }
.submit-hint[hidden] { display: none; }
.notice ul { margin: 6px 0 0; padding-left: 1.2em; }
.notice .detail { color: var(--muted); font-size: .9rem; }

/* summary */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px 18px; margin: 0; }
.summary div { min-width: 0; }
.summary dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.summary dd { margin: 0; font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.summary dd small { display: block; font-weight: 400; color: var(--muted); font-size: .8rem; }
.summary-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* best hit */
.best > * { min-width: 0; }
.best { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 10px 32px; align-items: center; }
.gauge { width: 100%; height: auto; display: block; }
.gauge { --gauge-track: color-mix(in srgb, var(--muted) 30%, var(--card)); }
.gauge .track { fill: none; stroke-width: 20; stroke: var(--gauge-track); }
.gauge .fill { fill: none; stroke-width: 20; }
.gauge .imprecise { stroke-dasharray: 3 4; }
.gauge .band { fill: none; stroke-width: 4; }
.gauge .tick { stroke: var(--fg); stroke-width: 2; }
.gauge .tick.soft { stroke-width: 1.5; stroke-dasharray: 3 2; opacity: .75; }
.gauge text { fill: var(--muted); font-size: 12px; font-family: inherit; }
.gauge text.thr { fill: var(--fg); font-weight: 600; }
.gauge text.thr.soft { fill: var(--muted); font-weight: 400; }
.gauge text.value, .gauge text.unit { paint-order: stroke; stroke: var(--card); stroke-width: 5px; stroke-linejoin: round; }
.gauge text.value { fill: var(--fg); font-size: 46px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gauge text.unit { font-size: 12px; letter-spacing: .06em; }
.gauge .knob { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.gauge .knob-outer { fill: var(--fg); }
.gauge .knob-ring { fill: var(--card); }
.gauge a { cursor: pointer; }
.gauge a text { pointer-events: auto; }
.gauge a:hover text, .gauge a:focus-visible text {
  fill: var(--species); text-decoration: underline;
}
.verdict { margin: 0; font-size: 1.5rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.verdict .tag { display: inline-block; }
.verdict-species { color: var(--species); }
.verdict-below { color: var(--below); }
.closest { color: var(--fg); font-size: 1.05rem; }
.trail { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .45em; color: var(--muted); font-size: .88rem; }
.trail .sep { opacity: .6; }
.best-meta { margin: 10px 0 0; color: var(--muted); font-size: .95rem; }
.best-meta p { margin: 4px 0 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 14px 0 0; padding: 0; list-style: none; font-size: .82rem; color: var(--muted); }
.legend .legend-head { flex-basis: 100%; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.legend .sw-dash { display: inline-block; width: 0; height: 12px; border-left: 2px dashed var(--fg); margin-right: 8px; vertical-align: -1px; opacity: .7; }

/* relation colours: --c is set by the rank depth */
.rel-species { --c: var(--r-species); }
.rel-genus { --c: var(--r-genus); }
.rel-family { --c: var(--r-family); }
.rel-order { --c: var(--r-order); }
.rel-class { --c: var(--r-class); }
.rel-phylum { --c: var(--r-phylum); }
.rel-domain { --c: var(--r-domain); }
.rel-none { --c: var(--r-none); }
.rel-closest { --c: var(--r-closest); }
.rel-plain { --c: var(--r-plain); }

/* table */
.table-wrap { overflow-x: auto; }
table.hits { width: 100%; border-collapse: collapse; font-size: .92rem; }
.hits th, .hits td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.hits th { white-space: nowrap; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0; }
.hits th button {
  font: inherit; text-transform: inherit; letter-spacing: inherit; color: inherit;
  background: none; border: 0; cursor: pointer; padding: 8px 8px; width: 100%; text-align: left;
}
.hits th button:hover { color: var(--fg); }
.hits th[aria-sort="ascending"] button::after { content: " ▲"; font-size: .7em; }
.hits th[aria-sort="descending"] button::after { content: " ▼"; font-size: .7em; }
.hits th[aria-sort] { color: var(--fg); }
.hits tbody tr:hover { background: var(--soft); }
.hits tr.top-row td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.hits td.num { font-variant-numeric: tabular-nums; }
.hits .rank { color: var(--muted); }
.hits .sub { color: var(--muted); font-size: .84rem; }
.hits .mono { font-family: var(--mono); font-size: .86rem; }
.hits a { text-decoration: none; }
.hits a:hover { text-decoration: underline; }
.dash { color: var(--muted); }

.anibar { display: flex; align-items: center; gap: 8px; min-width: 105px; }
.anibar b { font-variant-numeric: tabular-nums; min-width: 3.6em; }
.bar { position: relative; flex: 1; height: 8px; min-width: 50px; background: var(--soft); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.bar span { position: absolute; left: 0; top: 0; bottom: 0; }
.bar i { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--fg); opacity: .6; }
.bar i.soft { background: none; width: 0; border-left: 1px dashed var(--fg); opacity: .5; }
.bar span { background: var(--c); }

.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem;
  font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.badge-rel { background: color-mix(in srgb, var(--c) 16%, var(--card)); color: color-mix(in srgb, var(--c) 78%, var(--fg)); border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.rel .sub { margin-top: 2px; }
.badge-plain { background: var(--soft); color: var(--muted); border-color: var(--border); font-weight: 500; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }

details.lineage summary { cursor: pointer; list-style: none; }
details.lineage summary::-webkit-details-marker { display: none; }
details.lineage summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .12s; }
details.lineage[open] summary::before { transform: rotate(90deg); }
details.lineage ol { list-style: none; margin: 6px 0 2px 1em; padding: 0; font-size: .82rem; }
details.lineage li { display: flex; gap: 8px; }
details.lineage li b { flex: none; width: 5.2em; color: var(--muted); font-weight: 500; }

.mobile-sort { display: none; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .9rem; color: var(--muted); }
.mobile-sort select {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 8px; min-height: 38px; flex: 1;
}
.hits td .cv { min-width: 0; }
.export { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; padding: 14px 6px; }
.empty h2 { margin-bottom: 6px; }
.empty p { margin: 6px auto; max-width: 42em; color: var(--muted); }
.empty ul { text-align: left; display: inline-block; color: var(--muted); }

/* cite */
.cite { padding-top: 0; padding-bottom: 18px; color: var(--muted); font-size: .85rem; }
.cite h2 { margin: 0 0 2px; font-size: 1rem; color: var(--fg); }
.cite-lead { margin: 0 0 6px; }
.cite-list { margin: 0; padding: 0; list-style: none; }
.cite-list li { padding: 6px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; line-height: 1.5; }
.cite-list li:first-child { border-top: 0; }
.cite-list b { color: var(--fg); font-weight: 600; }
.cite-list cite { font-style: italic; }
.cite-links { white-space: nowrap; margin-left: 4px; }

/* footer */
.site-footer { border-top: 1px solid var(--border); padding: 14px 0 28px; font-size: .85rem; color: var(--muted); }
.site-footer p { margin: 4px 0; }

/* terms page */
.terms h2 { margin: 0 0 10px; font-size: 1.15rem; }
.terms h3 { margin: 18px 0 4px; font-size: .98rem; }
.terms p { margin: 6px 0; }
.terms p:first-of-type { margin-top: 0; }

details.lineage li span { min-width: 0; overflow-wrap: break-word; }
.hits td.num { white-space: nowrap; }
@media (min-width: 901px) { .hits td:nth-child(5) .cv { min-width: 13em; } }
@media (min-width: 901px) and (max-width: 1260px) {
  table.hits { font-size: .85rem; }
  .hits th, .hits td { padding-left: 5px; padding-right: 5px; }
  .hits th button { padding: 8px 5px; }
  .hits td:nth-child(5) .cv { min-width: 0; }
  .hits td .mono { font-size: .8rem; }
  .anibar { min-width: 0; gap: 6px; }
  .bar { min-width: 28px; }
}

@media (max-width: 900px) {
  .mobile-sort { display: flex; }
  .table-wrap { overflow: visible; }
  table.hits, .hits tbody, .hits tr, .hits td { display: block; min-width: 0; width: 100%; }
  .hits thead { display: none; }
  .hits tr { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; padding: 4px 0; background: var(--card); }
  .hits tr.top-row { border-color: var(--accent); }
  .hits td { display: grid; grid-template-columns: 7.2em 1fr; gap: 8px; border-bottom: 0; padding: 5px 12px; }
  .hits td::before { content: attr(data-label); color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; padding-top: .2em; }
  .hits td.rank .cv { font-weight: 600; }
  .anibar { min-width: 0; }
  .hits td.num { white-space: normal; }
  details.lineage li span { overflow-wrap: anywhere; }
}

@media (max-width: 760px) {
  .wrap { padding: 0 14px; }
  .card { padding: 14px; }
  .best { grid-template-columns: minmax(0, 1fr); }
  .verdict { font-size: 1.25rem; }
  textarea { height: 150px; }
  .drop.has-file textarea { height: 92px; }
  .file-chip { flex-wrap: wrap; align-content: center; gap: 0 10px; padding: 6px 12px; }
  .file-name { flex: 1 1 calc(100% - 40px); }
  .size { margin-left: 0; width: 100%; }
  .brand h1 { font-size: 1.7rem; }
  .brand .logo, .brand .logo img { width: 36px; height: 36px; }
}

/* ---------------------------------------------------------------- modes */
.site-header .tabs {
  display: flex; gap: 4px; margin: 14px 0 -15px;
}
.tab {
  display: inline-flex; align-items: center; gap: 8px; position: relative;
  padding: 9px 18px 11px; font-weight: 600; font-size: 1rem; color: var(--muted);
  text-decoration: none; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0;
}
.tab:hover { color: var(--fg); background: var(--soft); text-decoration: none; }
.tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab-busy {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

.landing > h2 { margin: 4px 0 14px; font-size: 1.25rem; }
.mode-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 22px; }
.mode-card {
  display: flex; flex-direction: column; gap: 10px; padding: 24px 26px 22px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); color: var(--fg); text-decoration: none;
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.mode-card:hover, .mode-card:focus-visible {
  border-color: var(--accent); transform: translateY(-2px); text-decoration: none;
  box-shadow: 0 2px 4px rgba(20, 30, 50, .08), 0 10px 28px rgba(37, 99, 235, .14);
}
.mode-icon {
  display: inline-flex; align-items: center; justify-content: center; align-self: flex-start;
  width: 64px; height: 64px; border-radius: 16px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
}
.mode-card h3 { margin: 6px 0 0; font-size: 1.4rem; letter-spacing: -.01em; }
.mode-lead { margin: 0; font-size: 1.02rem; }
.mode-facts { margin: 4px 0 8px; padding: 0; list-style: none; color: var(--muted); font-size: .93rem; }
.mode-facts li { position: relative; padding: 3px 0 3px 22px; }
.mode-facts li::before {
  content: ""; position: absolute; left: 3px; top: .72em; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); opacity: .75;
}
.mode-facts strong { color: var(--fg); }
.mode-facts code { font-family: var(--mono); font-size: .9em; }
.mode-cta {
  margin-top: auto; align-self: flex-start; padding: 9px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-fg); font-weight: 600;
}
.mode-card:hover .mode-cta { filter: brightness(1.08); }
@media (prefers-reduced-motion: reduce) { .mode-card { transition: none; } .mode-card:hover { transform: none; } }
@media (max-width: 760px) {
  .mode-cards { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .mode-card { padding: 18px; }
  .tab { padding: 8px 14px 10px; }
}

/* ---------------------------------------------------------------- reads mode */
.rdrop {
  position: relative; display: flex; align-items: center; gap: 18px; padding: 22px 24px; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 12px; background: var(--bg);
  transition: border-color .12s, background .12s;
}
.rdrop:hover, .rdrop:focus-visible { border-color: var(--accent); }
.rdrop.has-files { padding: 12px 18px; }
.rdrop.has-files .rdrop-private { display: none; }
.rdrop.disabled { opacity: .55; cursor: not-allowed; }
.rdrop.dragging { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.rdrop.dragging .drop-overlay { display: flex; }
.rdrop-icon { flex: none; color: var(--accent); }
.rdrop-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rdrop-text strong { font-size: 1.05rem; }
.rdrop-text span { color: var(--muted); font-size: .92rem; }
.rdrop-text code { font-family: var(--mono); font-size: .9em; }
.rdrop-private { color: var(--species) !important; font-weight: 600; }
.rdrop .drop-overlay { border-radius: 10px; }

.rfiles { list-style: none; margin: 12px 0 0; padding: 0; }
.rfiles:empty { display: none; }
.rfile {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; margin-bottom: 6px;
  background: var(--soft); border: 1px solid var(--border); border-radius: 8px; min-width: 0;
}
.rfile .badge { min-width: 3.4em; text-align: center; }
.rfile-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rfile-size { color: var(--muted); font-size: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rfile-total { color: var(--muted); font-size: .88rem; padding: 0 2px; }
.rlayout { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-top: 8px; }
.rlayout[hidden] { display: none; }
.radio, .check { display: inline-flex; align-items: flex-start; gap: 7px; cursor: pointer; font-size: .95rem; }
.radio input, .check input { margin-top: .3em; accent-color: var(--accent); }
.check { margin-top: 12px; display: flex; font-size: .92rem; color: var(--muted); }
.check strong { color: var(--fg); }
.check code { font-family: var(--mono); font-size: .9em; }
.implied-note { color: var(--accent); font-weight: 600; }
.field-name input { width: min(24em, 100%); }
.field-name { max-width: 100%; }
/* Options that used to sit behind a collapsed section, now always shown */
.pc-consensus-note { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
.opt-checks { margin-top: 4px; }
.opt-checks .check { margin-top: 8px; }
.field-ani > label { display: block; }
.ani-row { display: flex; align-items: center; gap: 10px; }
.ani-row input[type="number"] { width: 6.5em; }
.ani-slide { display: flex; flex-direction: column; gap: 0; width: 12.5em; max-width: 100%; }
.field .ani-slider { width: 100%; min-height: 0; padding: 0; margin: 0; border: 0; background: transparent; accent-color: var(--accent); height: 18px; }
.ani-ends { display: flex; justify-content: space-between; gap: 6px; font-size: .68rem; line-height: 1.1; white-space: nowrap; color: var(--muted); }

/* progress */
.steps { display: flex; list-style: none; margin: 4px 0 16px; padding: 0; gap: 0; }
.steps li { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; position: relative; min-width: 0; }
.steps li:not(:last-child)::after {
  content: ""; flex: 1; height: 2px; margin: 0 10px; background: var(--border); border-radius: 2px; min-width: 8px;
}
.step-dot {
  flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; border: 2px solid var(--border); background: var(--card);
}
.step-label { white-space: nowrap; }
.steps li[data-state="active"] { color: var(--fg); font-weight: 600; }
.steps li[data-state="active"] .step-dot { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.steps li[data-state="done"] .step-dot { border-color: var(--species); background: var(--species); color: transparent; position: relative; }
.steps li[data-state="done"] .step-dot::after {
  content: ""; position: absolute; left: 8px; top: 4px; width: 6px; height: 11px;
  border: solid var(--accent-fg); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
.steps li[data-state="done"]::after { background: var(--species); }
.pbar { height: 12px; border-radius: 6px; background: var(--soft); border: 1px solid var(--border); overflow: hidden; position: relative; }
.pbar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .2s linear; }
.pbar.indeterminate span {
  position: absolute; width: 35%; animation: slide 1.3s ease-in-out infinite;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}
@keyframes slide { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .pbar.indeterminate span { animation-duration: 4s; } }
.pbar-text { margin: 6px 0 14px; color: var(--muted); font-size: .92rem; font-variant-numeric: tabular-nums; }
.pstats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.rsummary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.pwarn:empty { display: none; }
.pwarn { margin-top: 14px; }
.pwarn .notice { margin-bottom: 8px; }
.rprogress .card-head .btn { min-height: 34px; }
.notice .actions { margin-top: 12px; }
.results > .actions { margin: 0 0 18px; }

/* segmented controls */
.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.seg label { position: relative; cursor: pointer; margin: 0; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 6px 12px; font-size: .9rem; color: var(--muted); border-right: 1px solid var(--border); white-space: nowrap; }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.seg label:hover input:not(:checked) + span { background: var(--soft); color: var(--fg); }

/* abundance */
.abund-controls { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-bottom: 14px; }
.ctl { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ctl-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.abund-head { margin: 0 0 8px; font-size: .9rem; }
.stack { display: flex; height: 34px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--soft); }
.stack > span { height: 100%; min-width: 0; border-right: 1px solid color-mix(in srgb, var(--card) 70%, transparent); }
.stack > span:last-child { border-right: 0; }
.alist { list-style: none; margin: 14px 0 0; padding: 0; }
.arow { display: grid; grid-template-columns: 14px minmax(0, 2.2fr) minmax(60px, 3fr) 4.8em; gap: 10px; align-items: center; padding: 4px 0; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.aname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aname small { margin-left: 8px; color: var(--muted); font-size: .78rem; }
.abar { height: 10px; border-radius: 5px; background: var(--soft); overflow: hidden; }
.abar span { display: block; height: 100%; border-radius: 5px; }
.apct { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.abund-note { margin: 14px 0 0; font-size: .88rem; color: var(--muted); }
.seg-cat-1 { background: var(--cat-1); } .seg-cat-2 { background: var(--cat-2); } .seg-cat-3 { background: var(--cat-3); }
.seg-cat-4 { background: var(--cat-4); } .seg-cat-5 { background: var(--cat-5); } .seg-cat-6 { background: var(--cat-6); }
.seg-cat-7 { background: var(--cat-7); } .seg-cat-8 { background: var(--cat-8); } .seg-cat-9 { background: var(--cat-9); }
.seg-cat-10 { background: var(--cat-10); }
/* "Other" is an aggregate of many taxa, not one: vertical lines set it apart from a
   regular gray block (and from the horizontal lines of other sources and the diagonal hatch of "not classified" / "unknown"). */
.seg-cat-other { background: repeating-linear-gradient(90deg, var(--cat-other) 0 2px, transparent 2px 4px); }
.seg-cat-none { background: repeating-linear-gradient(135deg, var(--cat-other) 0 3px, transparent 3px 6px); }
/* Genomes of another taxonomy source (a viral or fungal catalog) in the GTDB / NCBI views:
   horizontal lines, one muted tone per source. */
.seg-src-1 { background: repeating-linear-gradient(0deg, var(--src-1) 0 2px, transparent 2px 4px); }
.seg-src-2 { background: repeating-linear-gradient(0deg, var(--src-2) 0 2px, transparent 2px 4px); }
.seg-src-3 { background: repeating-linear-gradient(0deg, var(--src-3) 0 2px, transparent 2px 4px); }
/* Taxonomy sources as solid bins (sunburst / treemap legend). */
.seg-src-solid-1 { background: var(--src-1); } .seg-src-solid-2 { background: var(--src-2); } .seg-src-solid-3 { background: var(--src-3); }
/* Sunburst / treemap (web/taxtree.js, Apache ECharts loaded on first use). */
.taxtree { width: 100%; }
.taxtree-sunburst { aspect-ratio: 1; max-height: 680px; max-width: 680px; margin: 0 auto; }
.taxtree-treemap { height: clamp(320px, 62vh, 620px); }
.taxtree-host { position: relative; margin-bottom: 14px; }
.taxtree-menu {
  position: absolute; z-index: 5; max-width: min(340px, 90%); padding: 10px 12px; font-size: .88rem;
  background: var(--card); color: var(--fg); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow);
}
.taxtree-menu-name { font-weight: 600; overflow-wrap: anywhere; }
.taxtree-menu-path { margin-top: 2px; overflow-wrap: anywhere; }
.taxtree-menu a { display: block; margin-top: 6px; }
.taxtree-status { margin: 8px 0; font-size: .9rem; }
.taxtree-error { color: var(--offline); }
/* Reads in no database (sylph --estimate-unknown): plain grey, not a taxon and not striped. */
.seg-cat-unknown { background: var(--cat-other); }
.more-rows { margin: 10px 0 0; }
.more-rows:empty { display: none; }

/* genome table of the reads mode */
.reads-hits td:nth-child(5) .cv { min-width: 0; }
.reads-hits .anibar { min-width: 120px; }
.reads-hits .anibar b { min-width: 3.6em; text-align: right; }
@media (min-width: 901px) { .reads-hits td:nth-child(2) .cv { min-width: 12em; } }
@media (min-width: 901px) and (max-width: 1260px) {
  .reads-hits td:nth-child(2) .cv { min-width: 0; }
  .reads-hits .anibar { min-width: 0; }
}

@media (max-width: 760px) {
  .rdrop { flex-direction: column; text-align: center; padding: 18px 14px; }
  .rdrop.has-files { flex-direction: row; text-align: left; }
  .rdrop-text { align-items: center; }
  .rfile { flex-wrap: wrap; }
  .rfile-name { flex-basis: calc(100% - 6em); }
  .steps { flex-wrap: wrap; gap: 8px 0; }
  .steps li { flex: 1 1 50%; }
  .steps li::after { display: none !important; }
  .arow { grid-template-columns: 14px minmax(0, 1fr) 4.8em; }
  .arow .abar { grid-column: 2 / 4; grid-row: 2; }
  .aname small { display: none; }
  .seg span { padding: 6px 9px; }
  .stack { height: 28px; }
}

.mode-unsupported { margin: 0; color: var(--distant); font-weight: 600; font-size: .92rem; }

.steps li[data-state="skipped"] { opacity: .55; }
.steps li[data-state="skipped"] .step-dot { border-style: dashed; color: transparent; position: relative; }
.steps li[data-state="skipped"] .step-dot::after { content: "–"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.steps li[data-state="skipped"] .step-label { text-decoration: line-through; }
.sketch-info { margin: 8px 0 0; font-size: .9rem; color: var(--muted); }

/* ------------------------------------------------------------ server panel */
.server-panel {
  margin: 12px 0 0; padding: 8px 14px 9px; border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--soft) 70%, var(--card));
  max-width: 100%; box-sizing: border-box;
}
.server-panel[data-state="offline"] {
  border-color: color-mix(in srgb, var(--offline) 60%, var(--border));
  background: color-mix(in srgb, var(--offline) 7%, var(--card));
}
.sp-bar { display: flex; flex-direction: column; gap: 4px; }
.sp-main {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 6px 12px; min-width: 0;
}
.sp-summary {
  display: contents;
}
.sp-identity {
  display: contents;
}
.sp-host { font-weight: 700; font-size: .95rem; color: var(--fg); overflow-wrap: anywhere; }
.sp-meta {
  display: inline-flex; align-items: center; gap: 4px 6px; flex-wrap: wrap;
}
.sp-meta::before {
  content: "·"; color: var(--muted); user-select: none; margin-left: -4px;
}
.sp-ver { color: var(--fg); white-space: nowrap; }
.sp-genomes { color: var(--fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-sep { color: var(--muted); user-select: none; }
.sp-meta .sp-usage-chip { vertical-align: baseline; font-size: .82rem; padding: 1px 0; border: 0; background: none; }
.sp-actions {
  display: inline-flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0;
}
.sp-actions .btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 26px; padding: 2px 9px; font-size: .82rem; line-height: 1.2;
  text-decoration: none; box-sizing: border-box;
}
.sp-actions .btn-icon {
  padding: 0; width: 26px; height: 26px; min-height: 26px;
}
.sp-actions .btn-icon svg {
  display: block; pointer-events: none;
}
.sp-retry { padding: 2px 9px; font-size: .82rem; line-height: 1.3; }
.sp-privacy-line {
  display: flex; align-items: baseline; gap: 6px; font-size: .82rem; color: var(--muted);
  line-height: 1.35;
}
.sp-privacy-line svg { flex: none; align-self: center; color: var(--species); }
.sp-privacy-line span { min-width: 0; }
.sp-privacy-line a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.sp-privacy-line a:hover { color: var(--accent); }

.sp-connect { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.sp-connect[hidden] { display: none; }
.sp-connect .connect { margin: 0; padding: 0; border: 0; }
.sp-connect .connect-row .btn { flex: none; }

.sp-details {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px; font-size: .88rem;
}
.sp-details[hidden] { display: none; }
.sp-details .status-detail { margin: 0; min-height: 0; }
.sp-details .status-detail:empty { display: none; }

.sp-about { font-size: .92rem; }
.sp-about[hidden] { display: none; }
.sp-about-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }
.sp-about-body { overflow-wrap: anywhere; }
.sp-about-body > :first-child { margin-top: 0; }
.sp-about-body > :last-child { margin-bottom: 0; }
.sp-about-body p { margin: 0 0 .5em; }
.sp-about-body h1, .sp-about-body h2, .sp-about-body h3,
.sp-about-body h4, .sp-about-body h5, .sp-about-body h6 {
  margin: .6em 0 .25em; font-size: 1rem; font-weight: 700; line-height: 1.3;
}
.sp-about-body ul, .sp-about-body ol { margin: 0 0 .5em; padding-left: 1.4em; }
.sp-about-body blockquote { margin: 0 0 .5em; padding-left: 10px; border-left: 3px solid var(--border); color: var(--muted); }
.sp-about-body code { font-family: var(--mono); font-size: .9em; background: var(--card); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
.sp-about-note { margin: 6px 0 0; font-size: .82rem; color: var(--genus); font-weight: 600; }

.sp-details-legal {
  border-top: 1px solid var(--border); padding-top: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.sp-details-legal .privacy { margin: 0; }

@media (max-width: 760px) {
  .server-panel { padding: 8px 12px 10px; }
  .sp-actions { margin-left: auto; order: 2; }
  .sp-meta { order: 3; width: 100%; font-size: .8rem; gap: 3px 4px; }
  .sp-meta::before { display: none; }
  .sp-meta .sp-usage-chip { font-size: .78rem; }
  .sp-privacy-line { font-size: .78rem; gap: 5px; }
}

/* ------------------------------------------------ operator messages */
.messages { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 2px; }
.messages[hidden] { display: none; }
.msg {
  display: flex; align-items: flex-start; gap: 8px; padding: 5px 8px 5px 10px;
  border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px;
  font-size: .86rem; line-height: 1.4; background: var(--card);
}
.msg-info { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.msg-warning { border-color: var(--genus); background: var(--genus-bg); }
.msg-danger { border-color: var(--distant); background: var(--distant-bg); }
.msg-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.msg-title { margin-right: 2px; }
.msg-body { display: inline; }
.msg-body > p:first-child { display: inline; }
.msg-body p { margin: 0 0 .3em; }
.msg-body > :last-child { margin-bottom: 0; }
.msg-body a { color: inherit; text-decoration: underline; }
.msg-close {
  flex: none; margin: -2px 0 0; padding: 0 6px; border: 0; border-radius: 6px; background: transparent;
  color: inherit; font: inherit; font-size: 1.15rem; line-height: 1.4; cursor: pointer; opacity: .7;
}
.msg-close:hover, .msg-close:focus-visible { opacity: 1; background: color-mix(in srgb, currentColor 14%, transparent); }

/* ------------------------------------------------ per-contig (Assembly) */
.per-contig-bar { margin-top: 16px; }
.pc-toggle { margin-top: 0; }
.pc-toggle input:disabled + span { opacity: .6; }
.pc-options { margin-top: 4px; }
.pc-options .options { margin-top: 10px; }
.pc-bar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 0 0 8px; }
.pc-bar-head .abund-head { margin: 0; font-size: 1rem; }
.pc-hint { margin: 0 0 10px; font-size: .9rem; }
/* one segment per contig: buttons that grow with their weight, small gaps between */
.pc-stack { gap: 2px; }
.stack > button { height: 100%; min-width: 2px; flex: 1 1 0; padding: 0; border: 0; cursor: pointer; }
.stack > button:hover { filter: brightness(1.12); }
.stack > button:focus-visible { outline: 2px solid var(--fg); outline-offset: -2px; }
.pc-stack > span, .pc-stack > button { border-right: 0; flex-basis: 0; min-width: 2px; border-radius: 2px; }
.pc-skip { background-color: var(--soft); }
.pc-skip-short, .sw.pc-skip-short, .abar .pc-skip-short { background: repeating-linear-gradient(45deg, var(--muted) 0 1.5px, transparent 1.5px 4px); }
.pc-skip-few, .sw.pc-skip-few, .abar .pc-skip-few { background: radial-gradient(var(--muted) 1px, transparent 1.6px) 0 0 / 5px 5px; }
.pc-alert {
  padding: 1px 10px; border-radius: 999px; font-size: .82rem; font-weight: 600; cursor: help; white-space: nowrap;
  color: color-mix(in srgb, var(--nohit) 85%, var(--fg));
  background: color-mix(in srgb, var(--nohit) 14%, var(--card));
  border: 1px solid color-mix(in srgb, var(--nohit) 50%, transparent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--nohit) 45%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .pc-alert { animation: pc-glow 2.6s ease-in-out infinite; }
  @keyframes pc-glow { 50% { box-shadow: 0 0 10px 1px color-mix(in srgb, var(--nohit) 60%, transparent); } }
}
/* legend rows: like the Reads abundance list, with a wider text column */
.pc-arow { grid-template-columns: 14px minmax(0, 2fr) minmax(60px, 2fr) minmax(0, 15em); width: 100%; }
.pc-arow .apct { font-weight: 500; font-size: .86rem; color: var(--muted); }
.pc-arow .aname small { margin-left: 8px; }
button.pc-arow { padding: 4px 6px; margin: 0 -6px; width: calc(100% + 12px); border: 1px solid transparent; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
button.pc-arow:hover { background: var(--soft); }
button.pc-arow.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.pc-consensus { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.pc-consensus .sw { flex: none; }
.pc-taxon { overflow-wrap: anywhere; }
.pc-len > span:first-child { min-width: 5.2em; font-variant-numeric: tabular-nums; }
.pc-lenbar { --c: var(--cat-other); }
.pc-gc-off { color: var(--nohit); font-weight: 600; }
.pc-filter {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 12px; margin: 0 0 12px; padding: 8px 10px;
  border: 1px solid var(--accent); border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.pc-caveats { margin-top: 14px; }
.pc-caveats p { margin: 4px 0; }
.pc-contig-cell { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pc-expand {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  text-align: left;
}
.pc-expand .mono { min-width: 0; overflow-wrap: anywhere; }
.pc-expand:hover { color: var(--accent); }
.pc-caret { color: var(--muted); width: .8em; }
table.pc-table td { vertical-align: top; }
table.pc-table tr.pc-detail > td { background: var(--soft); padding: 10px 12px; }
.hits tr.pc-detail[hidden] { display: none; }
.pc-hits { font-size: .86rem; }
.pc-hits th, .pc-hits td { padding: 5px 7px; }
.pc-hits th { font-size: .72rem; }
.pc-best { display: flex; flex-direction: column; gap: 1px; min-width: 10em; }
.pc-best-taxon { overflow-wrap: anywhere; }

/* A contig the database could not place: its own badge colour, readable on both
   the light and the dark theme, and muted "no hit" text in the empty cells. */
.badge.pc-status-no_hit {
  background: color-mix(in srgb, var(--nohit) 16%, var(--card));
  color: color-mix(in srgb, var(--nohit) 80%, var(--fg));
  border-color: color-mix(in srgb, var(--nohit) 50%, transparent);
}
.pc-nohit-badge, .pc-nohit-summary { cursor: help; }
.pc-nohit-text { color: var(--muted); font-style: italic; }
.pc-nohit-detail p { margin: 2px 0; }
.pc-nohit-detail .detail { color: var(--muted); font-size: .88rem; }
@media (max-width: 760px) {
  .pc-arow { grid-template-columns: 14px minmax(0, 1fr); row-gap: 3px; }
  .pc-arow .aname { white-space: normal; }
  .pc-arow .aname small { display: inline; }
  .pc-arow .apct, .pc-arow .abar { grid-column: 2; grid-row: auto; text-align: left; }
}
@media (max-width: 600px) {
  table.pc-table tr.pc-detail { border: 1px solid var(--border); margin-top: -10px; }
  table.pc-table tr.pc-detail > td { display: block; }
}

/* per-contig short-contig modal */
.pc-reset { align-self: flex-end; padding-bottom: 8px; }
body.modal-open { overflow: hidden; }
.pc-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  padding: 18px;
  background: rgba(10, 14, 20, .52);
  backdrop-filter: blur(2px);
}
.pc-modal {
  width: min(34rem, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
}
.pc-modal h3 { margin: 0 0 10px; font-size: 1.15rem; }
.pc-modal p { margin: 0 0 12px; }
.pc-modal-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
.pc-modal:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) {
  .pc-modal { animation: pc-modal-in .14s ease-out; }
  @keyframes pc-modal-in { from { transform: translateY(6px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (max-width: 600px) {
  .pc-modal-backdrop { padding: 12px; }
  .pc-modal { padding: 16px 14px; }
}

/* usage statistics: the status-line chip, modal and its chart */
.fact-link { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.fact-link:hover { border-color: var(--accent); text-decoration: none; }
.fact-link .fact-value { color: var(--accent); font-weight: 500; }
.usage-backdrop { z-index: 1010; }
.usage-modal { width: min(52rem, 100%); background: var(--bg); }
.usage-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.usage-head h2 { margin: 0; font-size: 1.25rem; }
.usage-close { font-size: 1.1rem; line-height: 1; padding: 4px 10px; }
.usage-modal .card > .detail { margin: 10px 0 0; color: var(--muted); font-size: .88rem; }
.usage-summary { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.uchart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; }
.uchart-y {
  display: flex; flex-direction: column; justify-content: space-between; height: 160px;
  font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right;
}
.uchart-plot { min-width: 0; }
.uchart-svg { display: block; width: 100%; height: 160px; border-bottom: 1px solid var(--border); background: var(--bg); border-radius: 6px 6px 0 0; }
.uchart-svg .uc-web { fill: var(--cat-1); }
.uchart-svg .uc-cli { fill: var(--cat-2); }
.uchart-svg .uc-other { fill: var(--cat-other); }
.uchart-hit { fill: transparent; }
.uchart-hit:hover { fill: color-mix(in srgb, var(--accent) 14%, transparent); }
.uchart-x { display: flex; justify-content: space-between; margin-top: 4px; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ulegend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; padding: 0; list-style: none; font-size: .85rem; color: var(--muted); }
.ulegend .sw { margin-right: 6px; vertical-align: -1px; }
.usage-breakdowns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 8px 28px; }
.usage-breakdown h3 { margin: 0; font-size: .95rem; }
.usage-breakdown .alist { margin-top: 6px; }
.usage-statement { margin-bottom: 0; }
.taxtree-reset { display: block; margin: 0 0 6px; font-size: .9rem; }

/* Access token: the key button's state, the chip in the server bar, the panel's message. */
#sp-token-btn[data-state="valid"] { color: var(--species); }
#sp-token-btn[data-state="rejected"], #sp-token-btn[data-state="required"] { color: var(--distant); }
.sp-token-chip { font-size: .82rem; }
.sp-token-chip.warn, .token-state.warn { color: var(--distant); }
