:root {
    --bg: #fdfcfa;
    --card: #ffffff;
    --line: #ece4d7;
    --line-strong: #ddd2c1;
    --ink: #1f1a14;
    --muted: #6d6458;
    --accent: #b0542b;
    --accent-strong: #97481f;
    --accent-soft: rgba(176, 84, 43, 0.1);
    --accent-soft2: var(--accent-soft2);
    --accent-border: rgba(176, 84, 43, 0.3);
    --on-accent: #ffffff;
    --shadow: 0 1px 2px rgba(31, 26, 20, 0.05);
    --radius: 12px;
    --radius-sm: 8px;
    --font-sans:
        "IBM Plex Sans", "Avenir Next", "Segoe UI Variable",
        "Segoe UI", "Noto Sans", sans-serif;
    --font-display:
        "Iowan Old Style", "Palatino Linotype", "Book Antiqua",
        Georgia, serif;
}

:root[data-theme="dark"] {
    --bg: #1a1a1d;
    --card: #202023;
    --line: #2c2c30;
    --line-strong: #3a3a40;
    --ink: #e8e8ea;
    --muted: #9a9aa0;
    --accent: #e0894f;
    --accent-strong: #f0a06a;
    --accent-soft: rgba(224, 137, 79, 0.12);
    --accent-soft2: rgba(224, 137, 79, 0.18);
    --accent-border: rgba(224, 137, 79, 0.35);
    --on-accent: #1a1a1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .error {
    color: #ee6666;
    border-color: rgba(238, 102, 102, 0.3);
    background: rgba(238, 102, 102, 0.1);
}

:root[data-theme="dark"] .info-result.is-error {
    color: #ee6666;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-sans);
    background: var(--bg);
}

main {
    width: min(1480px, calc(100% - 32px));
    margin: 20px auto 56px;
}

.site-footer {
    margin-top: 40px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8rem;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    width: min(1480px, calc(100% - 32px));
    margin-inline: auto;
    height: 4.25rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 1.5rem);
}

.brand {
    justify-self: start;
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    color: var(--ink);
    font-weight: 680;
    font-size: 1.35rem;
    letter-spacing: -0.01em;
}

.brand-logo {
    display: block;
    height: 52px;
    width: auto;
    image-rendering: pixelated;
    flex: 0 0 auto;
}

.brand-word {
    white-space: nowrap;
}

/* Controls a table has no use for are hidden with the attribute; layout
   rules that set display would otherwise show them. */
.toolbar[hidden],
.control[hidden] {
    display: none;
}

.header-controls {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Order the settings cluster: upload / reload, then theme toggle, then
the language select, then the GitHub link. */
.header-controls #theme-toggle {
    order: 1;
}

#lang-select {
    order: 2;
    font-size: 0.85rem;
    padding: 5px 8px;
}

.header-controls .gh-link {
    order: 3;
}

.header-btn {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--accent);
    background: var(--accent);
    color: var(--on-accent);
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.header-btn:hover:not(:disabled) {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

.header-btn.secondary {
    background: var(--card);
    border-color: var(--line-strong);
    color: var(--ink);
}

.header-btn.secondary:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--muted);
}

.header-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

@media (max-width: 30rem) {
    .header-btn {
        display: none;
    }
}

.source-actions {
    display: none;
}

@media (max-width: 30rem) {
    .source-actions {
        display: flex;
        gap: 16px;
        flex-basis: 100%;
    }
}

.gh-link {
    display: inline-flex;
    align-items: center;
    padding: 6px;
    color: var(--muted);
    border-radius: var(--radius-sm);
    transition: color 0.15s ease;
}

.gh-link:hover {
    color: var(--ink);
}

.gh-link svg {
    display: block;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    padding: 6px;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--ink);
}

.theme-toggle svg {
    display: block;
}

.theme-toggle .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
    display: block;
}

/* Narrow screens: the mode tabs take a row of their own under the brand. */
@media (max-width: 52rem) {
    .header-inner {
        height: auto;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "brand controls"
            "modes modes";
        row-gap: 0;
        padding-top: 4px;
    }
    .brand {
        grid-area: brand;
    }
    .header-controls {
        grid-area: controls;
    }
    .site-header .mode-switch {
        grid-area: modes;
        justify-self: stretch;
        justify-content: space-around;
    }
    .mode-tab,
    .mode-tab:hover:not(:disabled) {
        padding: 4px 2px 6px;
    }
}

.intro {
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--line);
}

.intro-title {
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 2.6vw, 2.4rem);
    line-height: 1.08;
    letter-spacing: -0.01em;
    margin: 4px 0 12px;
}

.intro-lede {
    max-width: 70ch;
    margin: 0 0 14px;
    color: var(--muted);
    line-height: 1.55;
    white-space: pre-line;
}

.intro-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag {
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 3px 11px;
    white-space: nowrap;
}

.tag-accent {
    color: var(--accent);
    border-color: var(--accent-border);
    background: var(--accent-soft);
    font-weight: 600;
}

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

h2 {
    font-family: var(--font-display);
}

[id^="section-"],
[id^="species-"],
#controls-panel,
#top {
    scroll-margin-top: calc(var(--sticky-h, 5.25rem) + 12px);
}

.panel p,
.status {
    color: var(--muted);
    line-height: 1.55;
}

.stack {
    display: grid;
    gap: 18px;
    margin-top: 20px;
}

/* A row of cards whose cards are all hidden (Time's pair, in other modes)
   would still take a gap in the stack. */
.stack > .grid:not(:has(> :not(.hidden))) {
    display: none;
}
/* With a table open, the upload section holds only its notes and errors;
   with none to show it would leave a gap under the table's line. */
.has-table #section-upload:not(:has(> .reload-note:not(.hidden), > #error[style*="block"])) {
    display: none;
}
/* A mode made of several cards (Species) sits in the page's stack without
   adding a gap of its own. */
.stack .stack {
    margin-top: 0;
}

.grid {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.grid.two {
    grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
}

.panel {
    padding: 18px;
    min-width: 0;
}

.panel h2 {
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.panel-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: start;
    gap: 12px;
}

.panel-head .panel-copy {
    min-width: 0;
    flex: 1 1 360px;
}

.panel-head .panel-copy p {
    margin-bottom: 0;
}

.panel-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 0 0 auto;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: end;
}

.control {
    min-width: 190px;
    display: grid;
    gap: 7px;
}

label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

select,
button {
    font: inherit;
}

/* Checkboxes, radios and progress bars in the page's one accent, not the
   browser's blue. */
input[type="checkbox"],
input[type="radio"],
progress {
    accent-color: var(--accent);
}

select {
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--ink);
}

/* Until a table is open the page is the intro and the opener. After, one
   line under the header names the table, and the intro steps aside. */
.has-table .intro,
.has-table .opener,
body:not(.has-table) .stack > :not(#section-upload, #current-source) {
    display: none;
}

.source-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
    margin: 0;
    padding: 0 2px 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.9rem;
}

/* With a table open its line stays under the header, holding the links to
   the mode's cards. */
.source-bar {
    min-width: 0; /* its links scroll; they do not widen the page */
}

/* On a phone the line takes four rows, too much to keep on screen; the
   back-to-top button leads back to it instead. */
@media (min-width: 48.01rem) {
    .has-table .source-bar {
        position: sticky;
        top: var(--header-h, 4.4rem);
        z-index: 40;
        margin: -16px 0 0;
        padding-top: 12px;
        background: var(--bg);
    }
}

.section-nav {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

.section-nav a {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.section-nav a:hover {
    color: var(--ink);
    background: var(--line);
}

.section-nav a[aria-current] {
    color: var(--accent);
}

.section-nav:empty {
    display: none;
}

@media (max-width: 48rem) {
    .section-nav {
        flex-basis: 100%;
        margin-left: -8px;
        overflow-x: auto;
        scrollbar-width: none;
    }
}

.to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 45;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: var(--card);
    color: var(--ink);
}

.to-top:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--card);
}

.to-top[hidden] {
    display: none;
}

.source-name {
    color: var(--ink);
    font-weight: 600;
    word-break: break-all;
}

.source-facts {
    display: inline-flex;
    flex-wrap: wrap;
}

.source-facts > span {
    white-space: nowrap;
}

/* After each fact, so a wrapped line does not start with one. */
.source-facts > span:not(:last-child)::after {
    content: "·";
    margin: 0 8px;
}

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    outline: 2px dashed var(--accent);
    outline-offset: -12px;
    pointer-events: none;
}

.drop-overlay[hidden] {
    display: none;
}

.drop-overlay span {
    padding: 14px 22px;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 600;
}

.reload-note {
    margin: 12px 0 0;
    max-width: 70ch;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

.filedrop:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.filedrop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    text-align: center;
    min-height: 140px;
    cursor: pointer;
    padding: 22px 24px;
    border: 1.5px dashed var(--accent);
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--accent);
    text-transform: none;
    letter-spacing: normal;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.filedrop:hover {
    background: var(--accent-soft2);
    border-color: var(--accent-strong);
}

.filedrop-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.filedrop-hint {
    font-size: 0.86rem;
    font-weight: 400;
    color: var(--muted);
}

.help {
    position: relative;
    display: inline-flex;
    vertical-align: middle;
    margin-left: 9px;
}

.help-btn {
    width: 21px;
    height: 21px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 0.74rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition:
        color 0.15s ease,
        border-color 0.15s ease;
}

.help-btn:hover {
    color: var(--ink);
    border-color: var(--muted);
}

.help-bubble {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 20;
    display: none;
    width: min(340px, 72vw);
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    box-shadow: 0 6px 20px rgba(31, 26, 20, 0.1);
    color: var(--muted);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 400;
    line-height: 1.5;
    text-transform: none;
    letter-spacing: normal;
}

.help:hover .help-bubble,
.help:focus-within .help-bubble {
    display: block;
}

/* Transparent bridge across the 8px gap so the pointer can move from the
trigger onto the bubble (and its link) without dropping :hover. */
.help-bubble::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

.help-bubble a {
    color: var(--accent);
    font-weight: 500;
}

.help-bubble code {
    font-family: monospace;
    font-size: 0.85em;
}

button {
    cursor: pointer;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 9px 15px;
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

button.secondary {
    background: var(--card);
    border-color: var(--line-strong);
    color: var(--ink);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    background: var(--accent-strong);
    border-color: var(--accent-strong);
}

button.secondary:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--muted);
    color: var(--ink);
}

.chart-frame {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    overflow: auto;
    min-height: 200px;
    position: relative;
    min-width: 0;
    max-width: 100%;
}

.frame-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 6;
    padding: 8px 10px;
    margin: 0 0 10px;
    background: var(--card);
    border-bottom: 1px solid var(--line);
}

.frame-tools.is-fullscreen {
    top: 0;
    margin: 0 0 6px;
    padding: 8px 10px;
    gap: 10px;
}

.tool-button {
    border: 1px solid var(--line-strong);
    background: var(--card);
    color: var(--ink);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: none;
}

.tool-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.tool-save {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.tool-heading {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin-right: 2px;
}

.svg-stage {
    min-width: 100%;
    position: relative;
    width: 100%;
}

.chart-frame.is-compact .svg-stage {
    min-width: 0;
    margin: 0 auto;
}

.chart-frame svg {
    display: block;
    max-width: 100%;
    height: auto;
}

.chart-frame.is-zoomable {
    cursor: default;
}

.chart-frame.is-zoomable .svg-stage {
    touch-action: none;
    transform-origin: top left;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.chart-frame.is-zoomed .svg-stage {
    cursor: grab;
}

.chart-frame.is-panning .svg-stage {
    cursor: grabbing;
}

/* A chart frame with nothing to draw yet: one line, not an empty box. */
.chart-frame:has(> .frame-note) {
    min-height: 0;
}

.frame-note {
    margin: 4px 0 0;
    color: var(--muted);
}

.placeholder {
    min-height: 180px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.caption {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
}

table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
}

th,
td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background: var(--bg);
}

tbody tr:hover {
    background: var(--accent-soft);
}

.mono {
    font-family:
        ui-monospace, "SFMono-Regular", "SF Mono", Consolas,
        "Liberation Mono", Menlo, monospace;
    word-break: break-word;
}

.status,
.error {
    margin-top: 12px;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg);
}

.error {
    display: none;
    color: #b42318;
    border-color: rgba(180, 35, 24, 0.22);
    background: #fef3f2;
    white-space: pre-wrap;
}

.muted {
    color: var(--muted);
}

.hidden {
    display: none;
}

.fullscreen-shell {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: stretch;
    justify-content: center;
    background: rgba(17, 18, 23, 0.55);
    padding: 18px;
}

.fullscreen-shell.is-open {
    display: flex;
}

.fullscreen-panel {
    width: min(96vw, 1800px);
    height: min(94vh, 1200px);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 34px rgba(20, 21, 26, 0.18);
    display: block;
    overflow: hidden;
}

.fullscreen-frame {
    margin: 10px;
    height: calc(94vh - 20px);
    min-width: 0;
}
/* The modes, in the header's middle: quiet text tabs, the current one
   underlined in the accent. */
.mode-switch {
    justify-self: center;
    display: flex;
    align-self: stretch;
    gap: clamp(0.75rem, 2.5vw, 2rem);
}
.mode-tab,
.mode-tab:hover:not(:disabled) {
    font: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0 2px;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
}
.mode-tab:hover:not(:disabled) {
    color: var(--ink);
}
.mode-tab.is-active,
.mode-tab.is-active:hover:not(:disabled) {
    color: var(--ink);
    border-bottom-color: var(--accent);
}
.mode-tab:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
/* maze-stats: species analysis */
.chip-multiselect {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 104px;
    overflow: auto;
    padding: 4px 0;
}
.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 400;
    cursor: pointer;
    white-space: nowrap;
}
.checkbox-inline input {
    margin: 0;
}
.ms {
    position: relative;
    min-width: 160px;
}
.ms-btn {
    width: 100%;
    text-align: left;
    font: inherit;
    padding: 7px 26px 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ms-btn::after {
    content: "▾";
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}
.ms-btn.is-active {
    border-color: var(--accent);
}
.ms-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-width: 320px;
    max-height: 260px;
    overflow: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    padding: 6px;
}
.ms-actions {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 2px 4px 6px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 4px;
}
.ms-actions button {
    font: inherit;
    font-size: 0.8rem;
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 2px 4px;
}
.ms-opt {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}
.ms-opt:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.ms-opt input {
    margin: 0;
}
.ms-empty {
    color: var(--muted);
    font-size: 0.85rem;
    padding: 6px;
}
.chip {
    font: inherit;
    font-size: 0.82rem;
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
    cursor: pointer;
}
.chip.is-on {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.filter-hint {
    color: var(--muted);
    font-weight: 400;
    font-size: 0.78rem;
}
.species-stat-line {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 4px 0 12px;
}
/* Deployments and taxonomy: one line until opened, so the analysis comes
   first. Open, one row each: what is known and what to do. */
.info-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 16px;
    cursor: pointer;
    list-style: none;
}

.info-summary::-webkit-details-marker {
    display: none;
}

.panel .info-summary h2 {
    margin: 0;
    font-size: 1.15rem;
}

.info-glance {
    flex: 1 1 20rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.info-card[open] .info-glance {
    visibility: hidden;
}

.info-toggle {
    margin-left: auto;
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.info-toggle::after {
    content: " ▸";
}

.info-card[open] .info-toggle::after {
    content: " ▾";
}

.info-card:not([open]) {
    padding-top: 12px;
    padding-bottom: 12px;
}

.info-card[open] .info-summary {
    margin-bottom: 8px;
}

.info-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 16px;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.info-row[hidden] {
    display: none;
}

.info-label {
    flex: 0 0 5.5rem;
    font-weight: 600;
}

.info-status {
    flex: 1 1 18rem;
    color: var(--muted);
}

.info-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 14px;
}

.info-actions [hidden] {
    display: none;
}

.info-result {
    margin: 4px 0 0;
    color: var(--muted);
    max-width: 80ch;
}

.info-result:empty {
    display: none;
}

.info-result.is-error {
    color: #b42318;
}

.segmented button:not(:first-child):not(:last-child) {
    margin-left: -1px;
}

.activity-compared {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-self: end;
    padding-bottom: 6px;
}

.activity-compared button {
    padding: 3px 9px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--card);
    border-color: var(--line-strong);
    color: var(--ink);
}

.activity-compared button::after {
    content: " ×";
    color: var(--muted);
}

.activity-tools[hidden] {
    display: none;
}

/* Quiet in every row; the row under the pointer shows it in the accent. */
.link-button.species-exclude {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
}

tr:hover .link-button.species-exclude,
.link-button.species-exclude:focus-visible {
    color: var(--accent);
}

.species-excluded {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.species-excluded[hidden] {
    display: none;
}

.species-excluded button {
    padding: 2px 9px;
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--card);
    border-color: var(--line-strong);
    color: var(--ink);
}

.species-excluded .why {
    color: var(--muted);
    font-weight: 400;
}

.species-excluded button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--card);
}

/* The summary: how many taxa at each rank, then the protected ones. */
.summary-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 36px;
    margin: 4px 0 6px;
}

.summary-count {
    display: grid;
}

.summary-number {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.summary-label {
    color: var(--muted);
    font-size: 0.9rem;
}

.summary-note {
    margin: 4px 0 0;
    font-size: 0.85rem;
}

.summary-lists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    gap: 8px 28px;
    margin-top: 18px;
}

.summary-lists h3 {
    margin: 0 0 6px;
    font-size: 0.95rem;
}

.summary-lists section {
    min-width: 0;
}

.summary-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.summary-table th,
.summary-table td {
    padding: 5px 8px 5px 0;
    border-top: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.summary-table th {
    width: 5.5rem;
    background: none;
    color: var(--ink);
    font-size: inherit;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    white-space: nowrap;
}

.summary-table td.n {
    width: 2.5rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
    padding-right: 12px;
}

.summary-table td.names {
    color: var(--muted);
}

.map-note {
    margin: 8px 0 0;
    color: var(--muted);
}

.map-note:empty {
    display: none;
}

#species-map[hidden] {
    display: none;
}

.species-table-head {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0 8px;
}
.species-table-head input {
    flex: 1 1 14rem;
    min-width: 0;
    font: inherit;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink);
}
#species-table-wrap {
    max-height: 340px;
    overflow: auto;
}
#species-table-wrap table {
    min-width: 0;
}
#species-table-wrap thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}
#species-table-wrap th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
#species-table-wrap th.sorted-asc::after {
    content: " ▲";
    color: var(--accent);
}
#species-table-wrap th.sorted-desc::after {
    content: " ▼";
    color: var(--accent);
}
#species-table-wrap tbody tr {
    cursor: pointer;
}
#species-table-wrap tbody tr:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}
#species-table-wrap tbody tr.selected {
    background: color-mix(in srgb, var(--accent) 18%, transparent);
}
#species-table-wrap td.sci {
    font-style: italic;
    color: var(--muted);
}
/* The base-map switch: Leaflet's stylesheet points at a layers.png we do
   not ship, so the same stacked-layers icon is drawn here. */
#species-map .leaflet-control-layers-toggle {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' stroke-width='1.6' stroke-linejoin='round'%3E%3Cpath d='M12 3 2.5 8 12 13l9.5-5z'/%3E%3Cpath d='m2.5 12 9.5 5 9.5-5'/%3E%3Cpath d='m2.5 16 9.5 5 9.5-5'/%3E%3C/svg%3E");
    background-size: 22px 22px;
}

/* The page's form labels are small caps; the map's choices are names. */
#species-map .leaflet-control-layers label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--ink);
}

#species-map {
    height: 480px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    z-index: 0;
}
.rai-legend {
    background: var(--card);
    color: var(--ink);
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.6;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2);
}
.rai-legend .bar {
    display: block;
    height: 10px;
    width: 130px;
    border-radius: 3px;
    margin-bottom: 4px;
}
.rai-legend .ends {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
}

/* ---- Review ------------------------------------------------------------ */

.rv-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 12px 20px;
    margin: 4px 0 6px;
}
.rv-summary {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}
.rv-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 8px;
}
.rv-order {
    display: grid;
    gap: 5px;
}
.rv-hint {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}
.rv-note {
    margin: 8px 0 0;
    padding: 9px 12px;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
}
.link-button,
.link-button:hover:not(:disabled) {
    padding: 0;
    border: none;
    background: none;
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.rv-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-top: 14px;
}
@media (min-width: 60rem) {
    .rv-layout {
        grid-template-columns: 250px minmax(0, 1fr);
    }
    /* The files decide the row's height; the filters fill it and scroll
       within it rather than running on below the files. */
    .rv-filters {
        contain: size;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-gutter: stable;
        padding-right: 6px;
    }
}
.rv-main {
    min-width: 0;
}

.rv-filters {
    display: grid;
    align-content: start;
    gap: 14px;
}
.rv-filter-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.rv-filter-title {
    font-weight: 600;
}
.rv-facet {
    margin: 0;
    padding: 0;
    border: none;
    min-width: 0;
    display: grid;
    gap: 4px;
}
.rv-facet legend {
    padding: 0 0 6px;
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}
.rv-facet-list {
    display: grid;
}
.rv-facet-more {
    justify-self: start;
    margin-top: 2px;
    font-size: 0.85rem;
}
.rv-facet-search,
.rv-level,
.rv-dates input,
.rv-add-input,
.rv-add-species,
.rv-batch-species {
    font: inherit;
    padding: 6px 9px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--card);
    color: var(--ink);
    min-width: 0;
}
.rv-check {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 3px 2px;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}
.rv-check input {
    margin: 0;
}
.rv-check-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rv-check.is-none .rv-check-label {
    color: var(--muted);
}
.rv-count {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 0.82rem;
}
.rv-dates {
    display: grid;
    gap: 6px;
}
.rv-dates label {
    display: grid;
    grid-template-columns: 3.2em minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    font-size: 0.85rem;
}
.rv-facet-note {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}
.rv-changed-only {
    font-size: 0.9rem;
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
}

.rv-batch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    min-height: 54px;
    margin-bottom: 10px;
    padding: 9px 12px;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
}
/* Nothing selected: the same box, quiet, saying how selecting works. */
.rv-batch.is-empty {
    border-color: var(--line);
    background: transparent;
    color: var(--muted);
    font-size: 0.9rem;
}
.rv-batch-count {
    font-weight: 600;
}
.rv-batch-group {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}
.rv-batch-label {
    color: var(--muted);
    font-size: 0.85rem;
    margin-right: 2px;
}
.rv-batch-rate {
    padding: 4px 10px;
}

.rv-table {
    min-width: 900px;
    font-size: 0.9rem;
}
.rv-table th {
    position: sticky;
    top: 0;
    background: var(--card);
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    z-index: 1;
}
.rv-table td,
.rv-table th {
    padding: 7px 10px;
    vertical-align: middle;
}
.rv-table tr.is-focus td {
    background: var(--accent-soft);
}
.rv-table tr.is-selected td:first-child {
    box-shadow: inset 3px 0 0 var(--accent);
}
.rv-table tr.is-out td {
    opacity: 0.45;
}
.rv-col-select {
    width: 34px;
}
.rv-time {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.rv-file {
    max-width: 280px;
}
.rv-name {
    font-weight: 600;
    margin-right: 6px;
}
.rv-folder {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rv-file .tag {
    padding: 1px 7px;
    margin-right: 4px;
}
.rv-chips {
    min-width: 150px;
}
.rv-chip {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 2px 4px 2px 0;
    padding: 2px 4px 2px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    white-space: nowrap;
}
.rv-chip button,
.rv-add {
    padding: 0 5px;
    border: none;
    background: none;
    color: var(--muted);
    font-weight: 600;
    line-height: 1.3;
}
.rv-chip button:hover:not(:disabled),
.rv-add:hover:not(:disabled) {
    background: none;
    color: var(--accent);
}
.rv-add {
    border: 1px dashed var(--line-strong);
    border-radius: 999px;
    padding: 1px 9px;
}
.rv-add-box {
    display: inline-flex;
    gap: 4px;
}
.rv-add-input {
    width: 12em;
}
.rv-rating {
    white-space: nowrap;
}
.rv-star,
.rv-star:hover:not(:disabled) {
    padding: 0 1px;
    border: none;
    background: none;
    color: var(--line-strong);
    font-size: 1.15rem;
    line-height: 1;
}
.rv-star.is-on {
    color: var(--accent);
}
.rv-star:hover:not(:disabled) {
    color: var(--accent-strong);
}
.rv-rejected {
    margin-left: 6px;
    color: var(--muted);
    font-size: 0.8rem;
}
.rv-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
}
/* These set display above, which would otherwise beat .hidden. */
.rv-batch.hidden,
.rv-pager.hidden,
.rv-note.hidden {
    display: none;
}

/* Review: media folder, view switch, grid and viewer */

.rv-media {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 4px 0 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}
/* No media yet: the row is a prompt at the top of the files. */
.rv-media.is-prompt {
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--card);
}
.rv-media.is-prompt .rv-media-status {
    flex: 1 1 18rem;
}
.rv-media-status {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}
.rv-media-status.is-problem {
    color: var(--accent-strong);
}
.rv-media-keep {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
}
.rv-copy {
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--card);
}
.rv-copy.hidden {
    display: none;
}
.rv-copy p {
    margin: 0 0 8px;
}
.rv-copy-names {
    margin: 0 0 8px;
    padding-left: 18px;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}
.rv-copy progress {
    display: block;
    width: 100%;
    margin: 0 0 10px;
}
.rv-export-choices {
    display: grid;
    gap: 6px;
    margin: 0 0 8px;
}
.rv-export-choice {
    display: flex;
    align-items: baseline;
    gap: 8px;
    cursor: pointer;
    /* a sentence, not a form caption */
    font-size: 0.95rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
}
.rv-export-choice.is-none {
    color: var(--muted);
    cursor: default;
}
.rv-hint-inline {
    color: var(--muted);
    font-size: 0.85rem;
}
.rv-copy-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.rv-views,
.segmented {
    display: inline-flex;
}
.rv-views button,
.segmented button {
    border-radius: 0;
}
.rv-views button:first-child,
.segmented button:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.rv-views button:last-child,
.segmented button:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-left: -1px;
}
.rv-views button[aria-pressed="true"],
.segmented button[aria-pressed="true"] {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    position: relative;
}

.rv-grid {
    height: min(76vh, 980px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--bg);
}
.rv-grid:focus-visible {
    outline: 2px solid var(--accent-border);
}
.rv-grid-spacer {
    position: relative;
    margin: 12px;
}
.rv-grid-rows {
    position: absolute;
    left: 0;
    right: 0;
    display: grid;
}
.rv-tile {
    display: grid;
    grid-template-rows: auto 1fr;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--card);
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}
.rv-tile.is-selected {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}
.rv-tile.is-focus {
    border-color: var(--accent);
    outline: 1px solid var(--accent);
}
.rv-tile.is-out {
    opacity: 0.45;
}
/* Photos are letterboxed, not cropped: a reviewer must see the whole frame.
   Dark bars, in both themes, read as the edge of a picture. */
.rv-thumb {
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
    background: #1d1d20;
    overflow: hidden;
}
.rv-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.rv-thumb {
    position: relative;
}
.rv-thumb-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #1d1d20;
}
.rv-thumb-badge {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.62);
    color: #ffffff;
    font-size: 0.72rem;
}
.rv-thumb-note {
    display: grid;
    gap: 2px;
    padding: 8px;
    color: #a6a6ad;
    font-size: 0.78rem;
    text-align: center;
    word-break: break-all;
}
.rv-thumb-note b {
    color: #ececf0;
    font-weight: 600;
}
.rv-thumb-note.is-pending {
    opacity: 0.55;
}
.rv-thumb-note.is-missing b {
    color: #f0a06a;
}
.rv-tile-meta {
    height: 64px;
    padding: 5px 9px;
    display: grid;
    align-content: start;
    font-size: 0.82rem;
    line-height: 1.35;
}
.rv-tile-labels,
.rv-tile-sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rv-tile-labels {
    font-weight: 600;
}
.rv-tile-labels.is-none,
.rv-tile-sub {
    color: var(--muted);
    font-weight: 400;
}
.rv-tile-sub {
    font-variant-numeric: tabular-nums;
}
.rv-tile-edited {
    color: var(--accent);
    font-weight: 600;
}
.rv-tile-stars .rv-star {
    font-size: 1rem;
}

.rv-viewer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    background: var(--bg);
}
.rv-viewer.hidden {
    display: none;
}
.rv-viewer-media {
    height: 100vh;
    display: grid;
    place-items: center;
    padding: 12px;
    background: #111113;
    min-width: 0;
}
.rv-viewer-media img,
.rv-viewer-media video {
    max-width: 100%;
    max-height: calc(100vh - 24px);
    object-fit: contain;
}
.rv-viewer-note {
    display: grid;
    gap: 10px;
    max-width: 40em;
    color: #d8d8dc;
    text-align: center;
}
.rv-viewer-note code {
    color: #ffffff;
    word-break: break-all;
}
.rv-viewer-side {
    overflow: auto;
    padding: 16px 18px;
    border-left: 1px solid var(--line);
    background: var(--card);
    display: grid;
    align-content: start;
    gap: 12px;
}
.rv-viewer-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.rv-viewer-pos {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.rv-viewer-nav {
    display: flex;
    gap: 6px;
}
.rv-viewer-nav button {
    padding: 6px 10px;
}
.rv-viewer-name {
    margin: 0;
    font-size: 1.1rem;
    word-break: break-all;
}
.rv-viewer-fields {
    display: grid;
    gap: 12px;
}
.rv-viewer-row {
    display: grid;
    gap: 4px;
}
.rv-viewer-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}
.rv-path {
    font-size: 0.85rem;
    word-break: break-all;
}
.rv-viewer-row .link-button {
    justify-self: start;
}
/* The sidebar is narrow: an add box puts its species choice under the
   input instead of beside it, so nothing runs past the edge. */
.rv-viewer-side .rv-add-box {
    display: grid;
    gap: 6px;
}
.rv-viewer-side .rv-add-input,
.rv-viewer-side .rv-add-species {
    width: 100%;
    min-width: 0;
}
/* The page behind the viewer does not scroll. */
html.rv-viewer-open {
    overflow: hidden;
}
@media (max-width: 52rem) {
    .rv-viewer {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: 55vh auto;
        overflow: auto;
    }
    .rv-viewer-media {
        height: 55vh;
    }
    .rv-viewer-media img,
    .rv-viewer-media video {
        max-height: calc(55vh - 24px);
    }
    .rv-viewer-side {
        border-left: none;
        border-top: 1px solid var(--line);
    }
}

/* Review benchmark (?bench) */
.rv-bench {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-sm);
}
.rv-bench-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}
.rv-bench-out {
    max-height: 320px;
    overflow: auto;
    margin: 10px 0 0;
    font-size: 0.78rem;
    white-space: pre-wrap;
}
.rv-bench-out.hidden {
    display: none;
}
