* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    height: 100dvh;
    background: #1a1a1a;
    color: #ccc;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 14px;
    overflow: hidden;
}

.app {
    display: grid;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    grid-row: 2;
    background: #111;
    border-right: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
    max-height: 100%;
}

.sidebar.collapsed {
    overflow: visible;
    border-right: none;
}

.sidebar.collapsed .sidebar-tabs {
    border-bottom: none;
}

.sidebar.collapsed .sidebar-tab-dropdown-wrap,
.sidebar.collapsed .sidebar-header-label {
    display: none;
}

.sidebar.collapsed .sidebar-panel {
    display: none;
}

.sidebar.collapsed .sidebar-resize-handle {
    display: none;
}

.sidebar.collapsed .sidebar-collapse-btn {
    display: none;
}

.sidebar-collapse-btn {
    flex: 0 0 32px !important;
    font-size: 16px !important;
    padding: 0 !important;
    color: #777;
    border-bottom: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-collapse-btn:hover {
    color: #ddd !important;
}

.sidebar-settings-btn {
    flex: 0 0 36px;
    font-size: 16px;
    padding: 0;
    color: #777;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

.sidebar-settings-btn:hover {
    color: #ddd;
}

.sidebar-settings-btn.active {
    color: #fc8;
    border-bottom-color: #fc8;
}

.sidebar.collapsed .sidebar-settings-btn {
    display: none;
}

.setting-checkbox {
    accent-color: #4a8;
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.sidebar-resize-handle {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 20;
}
.sidebar-resize-handle.hidden {
    display: none;
}

.sidebar-resize-handle:hover,
body.sidebar-resizing .sidebar-resize-handle {
    background: #4a8;
}

body.sidebar-resizing {
    cursor: col-resize !important;
    user-select: none;
}

/* Sidebar tabs */
.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 10px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #777;
    background: #111;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.sidebar-tab:hover {
    color: #bbb;
}

.sidebar-tab.active {
    color: #eee;
    border-bottom-color: #4a8;
}

/* Tab dropdown */
.sidebar-tab-dropdown-wrap {
    flex: 1;
    position: relative;
}

.sidebar-tab-dropdown {
    width: 100%;
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #eee;
    background: #111;
    border: none;
    border-bottom: 2px solid #4a8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.sidebar-tab-dropdown:hover {
    background: #1a1a1a;
}

.dropdown-arrow {
    font-size: 9px;
    color: #777;
}

.sidebar-tab-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid #333;
    border-top: none;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.sidebar-tab-option {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 500;
    color: #999;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    border-left: 2px solid transparent;
}

.sidebar-tab-option:hover {
    background: #222;
    color: #ccc;
}

.sidebar-tab-option.active {
    color: #eee;
    border-left-color: #4a8;
    background: #1f2f25;
}

/* Bit analysis grid */
.bit-grid {
    display: grid;
    gap: 2px;
    padding: 4px 12px;
}

.bit-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3px 2px;
    border-radius: 3px;
    font-size: 9px;
    min-height: 34px;
    cursor: default;
}

.bit-cell.used {
    background: #1a3a25;
    color: #8fc;
}

.bit-cell.used.caution {
    background: #3a3a1a;
    color: #fc8;
}

.bit-cell.used.always1 {
    background: #1a2a3a;
    color: #8cf;
}

.bit-cell.used.full {
    background: #3a1a1a;
    color: #f88;
}

.bit-cell.unused-expected {
    background: #3a1a1a;
    color: #f88;
}

.bit-cell.unused {
    background: #1a1a1a;
    color: #555;
}

.bit-cell.zero-padded {
    background: #2a1212;
    color: #c44;
}

.bit-label {
    font-size: 8px;
    opacity: 0.7;
    font-weight: 600;
}

.bit-value {
    font-size: 10px;
    font-weight: 600;
}


.bit-warning {
    padding: 2px 12px;
    font-size: 10px;
    color: #fc8;
}

.bit-warning-inline {
    color: #fc8;
}

.bit-region-labels {
    display: flex;
    gap: 4px;
    padding: 2px 12px 4px;
    font-size: 9px;
}

.bit-region {
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 600;
}

.bit-region.sign {
    color: #c8f;
    background: #2a1a2a;
}

.bit-region.exponent {
    color: #8cf;
    background: #1a2a3a;
}

.bit-region.mantissa {
    color: #8fc;
    background: #1a3a25;
}

/* Analysis stats grid */
.analysis-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px 12px;
}

.analysis-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #1a1a1a;
    border-radius: 3px;
    padding: 4px 8px;
    min-width: 60px;
    flex: 1;
}

.analysis-stat-value {
    font-size: 12px;
    font-weight: 600;
    color: #ccc;
}

.analysis-stat-label {
    font-size: 9px;
    color: #777;
    margin-top: 1px;
}

.analysis-warning {
    padding: 3px 12px 4px;
    font-size: 10px;
    color: #fc8;
}

/* A note with more detail in its tooltip. */
.has-detail {
    cursor: help;
    text-decoration: underline dotted;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    text-underline-offset: 2px;
}

.metadata-note {
    padding: 3px 12px 4px;
    font-size: 10px;
    color: #999;
}

/* Recorder metadata rows that repeat the GUANO block's values, folded into one
   closed row so each value is on screen once (metadata_panel.rs recorder_section).
   Link colour, as the map links use, so the row reads as something that opens
   rather than a caption. */
.metadata-same > summary {
    padding: 4px 12px;
    font-size: 11px;
    color: #8cf;
    cursor: pointer;
}
.metadata-same > summary:hover {
    text-decoration: underline;
}

.analysis-scope-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
}

.analysis-scope-badge {
    font-size: 10px;
    color: #aaa;
    background: #333;
    padding: 1px 6px;
    border-radius: 3px;
}

.analysis-scope-badge.analysis-scope-full {
    color: #8f8;
    background: #243024;
}

.analysis-full-btn {
    font-size: 10px;
    color: #8cf;
    background: none;
    border: 1px solid #446;
    border-radius: 3px;
    padding: 1px 8px;
    cursor: pointer;
}
.analysis-full-btn:hover {
    background: #223;
    border-color: #668;
}

.privacy-settings-btn {
    font-size: 13px;
    padding: 4px 12px;
}

.bit-sign-header {
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    padding: 6px 12px 2px;
    text-align: left;
}

.bit-grid-mini {
    padding: 2px 0;
}

.bit-grid-mini .bit-cell {
    min-height: 24px;
    padding: 2px 1px;
}

.bit-grid-mini .bit-label {
    font-size: 7px;
}

.bit-grid-mini .bit-value {
    font-size: 8px;
}

.bit-zero-row {
    font-size: 10px;
    color: #999;
    text-align: center;
    padding: 4px 0 2px;
}

.bit-depth-stat {
    padding: 2px 12px;
    font-size: 10px;
    color: #bbb;
}

.bit-depth-stat.bit-depth-primary {
    font-size: 12px;
    font-weight: 600;
    color: #ddd;
    padding-top: 4px;
}

/* wSNR recording quality */
.wsnr-result {
    padding: 4px 12px;
}

.wsnr-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.wsnr-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
}

.wsnr-grade-a { background: #1a3a25; color: #6f6; }
.wsnr-grade-b { background: #1a3a3a; color: #6cf; }
.wsnr-grade-c { background: #3a3a1a; color: #fc6; }
.wsnr-grade-d { background: #3a2a1a; color: #f96; }
.wsnr-grade-e { background: #3a1a1a; color: #f66; }
/* wSNR could not be measured: a grey dash, so the eye goes to the reason
   beside it and not to a grade that was never given. */
.wsnr-grade-none { background: #2a2a2a; color: #777; }

.wsnr-not-measured {
    font-size: 11px;
    color: #888;
}

.wsnr-reason {
    font-size: 12px;
    color: #fc8;
}

.wsnr-grade-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}

.wsnr-snr {
    font-size: 14px;
    font-weight: 600;
    color: #ccc;
}

.wsnr-detail {
    font-size: 11px;
    color: #888;
    padding: 1px 0;
}

.wsnr-comparison {
    font-size: 11px;
    color: #aaf;
    padding: 4px 0 2px;
    font-weight: 600;
}

.wsnr-warnings {
    margin-top: 4px;
}

.wsnr-warning {
    padding: 2px 0;
    font-size: 10px;
    color: #fc8;
}

/* PSD panel */
.psd-controls-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.psd-nfft-select {
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 11px;
}

.psd-filter-toggles {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 12px;
    font-size: 11px;
}

.psd-controls-sep {
    width: 1px;
    height: 14px;
    background: #333;
    margin: 0 2px;
}

.psd-btn-group {
    display: inline-flex;
    gap: 0;
}

.psd-btn-group .psd-btn {
    border-radius: 0;
}

.psd-btn-group .psd-btn:first-child {
    border-radius: 3px 0 0 3px;
}

.psd-btn-group .psd-btn:last-child {
    border-radius: 0 3px 3px 0;
}

.psd-btn-group .psd-btn + .psd-btn {
    margin-left: -1px;
}

.psd-btn {
    font-size: 10px;
    color: #999;
    background: #1a1a1a;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 1px 7px;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.5;
}

.psd-btn:hover {
    background: #252525;
    color: #ccc;
}

.psd-btn-active {
    background: #2a3a4a;
    color: #8cf;
    border-color: #4a6a8a;
}

.psd-btn-active:hover {
    background: #334a5a;
}

.psd-btn-disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.psd-btn-dimmed {
    opacity: 0.6;
}

.psd-status-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 12px;
    min-height: 22px;
}

.psd-status-text {
    font-size: 11px;
    color: #666;
}

.psd-chart-wrap {
    padding: 4px 8px;
}

.psd-meta-text {
    font-size: 10px;
    color: #888;
    padding: 2px 0;
}

.psd-peak-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10px;
    margin: 4px 0;
}

.psd-peak-table th {
    color: #888;
    font-weight: 500;
    text-align: right;
    padding: 2px 4px;
    border-bottom: 1px solid #333;
    white-space: nowrap;
}

.psd-peak-table th:first-child {
    width: 12px;
    text-align: center;
}

.psd-peak-row {
    cursor: default;
}

.psd-peak-row:hover {
    background: #1a2a3a;
}

.psd-peak-idx {
    text-align: center;
    padding: 2px 2px;
}

.psd-peak-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.psd-peak-freq,
.psd-peak-power {
    text-align: right;
    padding: 2px 4px;
    color: #ccc;
    font-variant-numeric: tabular-nums;
}

.psd-peak-bw {
    text-align: right;
    padding: 2px 4px;
    color: #999;
    font-variant-numeric: tabular-nums;
}

/* Call detection panel (the Call detection tab) */
.detection-status {
    padding: 2px 16px 6px;
    font-size: 12px;
    color: #ccc;
}

.detection-status-note {
    font-size: 11px;
    color: #888;
}

/* The flag on a bird unlikely at the recording's place and month. The
   warning colour used elsewhere (.bit-warning); the same shape and colour
   are drawn on the spectrogram's label strip (overlays.rs). */
.unlikely-flag {
    margin-left: 5px;
    color: #fc8;
    font-size: 11px;
    vertical-align: -1px;
}

/* The flag's own column in the results tables: fixed width whether or not
   a row is flagged, so turning the marks on or off moves nothing. */
.detection-table .detection-col-flag {
    width: 14px;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}

/* The "Show" checkbox column: a row above the spectrogram per ticked
   species (score_strips.rs). */
.detection-table .detection-col-strip {
    width: 26px;
    padding-right: 0;
}

.detection-col-strip input {
    margin: 0;
    vertical-align: -2px;
}

/* A 24 px square, so the × is easy to tap on a phone. */
.strip-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    font-size: 14px;
    line-height: 16px;
    padding: 0 4px;
}

.strip-pc-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* "Sound groups" in the Call detection tab: the toggle with the 2 / 3 / 4
   choice beside it, then one legend line per group. The swatch is a square,
   like the species swatches in the lists, in the row's colour. */
.sound-groups-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.sound-groups-swatch {
    display: inline-block;
    vertical-align: -1px;
    margin-right: 6px;
    border-radius: 2px;
}
.sound-groups-hint {
    color: #888;
}
.sound-groups-note {
    padding: 0 16px 2px;
}

.detection-col-flag .unlikely-flag {
    margin-left: 0;
}

.species-map-legend .map-key-flag {
    margin: 0;
    width: 8px;
    line-height: 1;
}

/* How many species are flagged, beside "Mark birds unlikely here". Room for
   "Checking..." is kept whether the value is blank, a count or that, so the
   label wraps the same way in every state and the row keeps its height. */
.detection-marked-count {
    flex: none;
    min-width: 62px;
    white-space: nowrap;
}

/* A checkbox label that shares its row with a value wraps inside the panel
   instead of pushing the value past the panel's edge. */
.setting-row.detection-annotate-row > .setting-label {
    flex-shrink: 1;
    min-width: 0;
}

.detection-status-note > .unlikely-flag {
    margin-left: 0;
}

.detection-progress {
    height: 3px;
    margin-top: 4px;
    background: #2a2a2a;
    border-radius: 2px;
}

.detection-progress-fill {
    height: 100%;
    background: #4a8;
    border-radius: 2px;
}

/* Rows inside the panel that are not setting rows: same side padding. */
.detection-annotate-row {
    padding: 2px 16px;
}

.detection-annotate-row .psd-btn-group {
    flex-wrap: wrap;
}

/* Taller than the PSD panel's buttons: 24 px click targets. */
.detection-annotate-row .psd-btn {
    padding: 4px 8px;
}

.detection-radio-group {
    display: flex;
    flex-direction: column;
}

.detection-radio {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    cursor: pointer;
}

/* Lines up with the option's text, past the radio button. */
.detection-radio-note {
    padding-left: 19px;
}

.detection-add-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

/* Method choice at the top of the tab: each option's description sits under
   its name, so the user reads what a method does before picking it. */
.detection-methods {
    padding-bottom: 6px;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 6px;
}

.detection-method {
    align-items: flex-start;
    padding: 2px 0;
}

.detection-method input {
    margin-top: 2px;
}

.detection-method-text {
    display: flex;
    flex-direction: column;
}

/* Nested under BattyBirdNET: lines up with the option's text. The label sits
   above the drop-down so the options ("Europe: 29 species") fit the sidebar. */
.detection-region {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 2px 0 2px 19px;
}

.detection-region .setting-select {
    width: 100%;
    max-width: none;
    min-height: 24px;
}

/* The one filled button in each state of the BirdNET section. */
.detection-status .detection-primary-btn {
    width: 100%;
    margin: 4px 0;
}

.detection-error {
    color: #f99;
    margin-bottom: 4px;
}

.detection-busy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-variant-numeric: tabular-nums;
}

.detection-stop-btn,
.detection-delete-btn {
    min-height: 24px;
    padding: 4px 8px;
}

.detection-delete-btn {
    margin: 0 16px 4px;
}

.detection-scientific {
    font-style: italic;
    color: #888;
}

.detection-top3 {
    padding: 4px 0;
}

.detection-top3 > .detection-status-note {
    padding: 0 16px 2px;
}

.detection-credit {
    color: #888;
    font-size: 11px;
}

.detection-credit a,
.detection-link-btn {
    color: #8ab;
    text-decoration: none;
}

.detection-credit a:hover,
.detection-link-btn:hover {
    text-decoration: underline;
}

/* 24 px tall click target inside an 11 px line of text. */
.detection-link-btn {
    background: none;
    border: none;
    padding: 0 2px;
    min-height: 24px;
    min-width: 24px;
    font: inherit;
    cursor: pointer;
}

.detection-credits p {
    margin: 4px 0;
}

/* Species map dialog: as large as the window allows, square-ish map. */
.modal-dialog.species-map-dialog {
    max-width: min(96vw, 900px);
    max-height: 94vh;
}

.species-map-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.species-map-actions .psd-btn {
    min-height: 24px;
    padding: 4px 8px;
}

.species-map-actions .modal-close {
    min-width: 24px;
    min-height: 24px;
}

/* The map takes what the header and notes leave, up to 640 px: on a phone
   the notes wrap to several lines and the dialog is capped at 94vh, so the
   map shrinks rather than pushing the notes off the bottom. */
.species-map-dialog .modal-header,
.species-map-notes {
    flex: none;
}

.species-map-body {
    position: relative;
    flex: 0 1 min(70vh, 640px);
    min-height: 200px;
}

.species-map-chart {
    width: 100%;
    height: 100%;
}

.species-map-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 12px;
}

.species-map-notes {
    padding: 8px 18px 12px;
    border-top: 1px solid #333;
    font-size: 12px;
    color: #ccc;
}

.species-map-notes p {
    margin: 2px 0;
}

/* Legend swatches use the same colours and outlines as the map's dots
   (species-map.js), so each key reads as the dot it names. */
.species-map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 16px;
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
}

.species-map-legend li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-key {
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-sizing: border-box;
}

.map-key-species {
    width: 5px;
    height: 5px;
    margin: 0 1.5px;
    background: rgba(170, 170, 170, 0.6);
}

.map-key-found {
    width: 9px;
    height: 9px;
    border: 1.5px solid #dddddd;
}

.map-key-window {
    background: #50dc96;
}

.map-key-selected {
    width: 11px;
    height: 11px;
    margin: 0 -1.5px;
    background: #ffc850;
    border: 2px solid #ffffff;
}

.detection-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 4px 0;
}

/* One row per detection. Narrow padding: the sidebar is about 220 px wide,
   and after the panel's and the list's scrollbars about 190 px is left for
   five columns. Only the kind column wraps. */
.detection-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.detection-table th {
    position: sticky;
    top: 0;
    background: #111;
    color: #888;
    font-weight: normal;
    text-align: left;
    padding: 2px;
}

.detection-table td {
    /* 24 px rows: each row is a click target. */
    padding: 4px 2px;
    line-height: 16px;
    color: #aaa;
    white-space: nowrap;
}

.detection-table th:first-child,
.detection-table td:first-child {
    padding-left: 10px;
}

/* Clear of overlay scrollbars (phones), which sit on top of the content. */
.detection-table th:last-child,
.detection-table td:last-child {
    padding-right: 8px;
}

.detection-table .detection-col-num {
    text-align: right;
}

.detection-table .detection-col-kind {
    white-space: normal;
}

.detection-row {
    cursor: pointer;
}

.detection-row:hover td {
    background: #1a2a20;
    color: #ccc;
}

/* Detections that are not bat calls: muted, like their dashed boxes on the
   spectrogram, but still 4.5:1 against the panel. */
.detection-row-other td {
    color: #888;
}

.detection-row.selected td {
    background: #3a3020;
    color: #eee;
}

/* Species search in "Rows above the spectrogram" (classifier_section.rs,
   strip_search). The matches are listed in the panel under the field, not in
   a popup: the sidebar is about 200 px wide and scrolls, and a popup would be
   clipped. Field colours follow .setting-select; the highlighted match uses
   the Explore Xeno-canto country list's colours (.xc-combobox-option). */
.strip-search {
    padding: 4px 16px;
}

.strip-search-input {
    box-sizing: border-box;
    width: 100%;
    min-height: 24px;
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 12px;
    outline: none;
}

.strip-search-input:hover {
    border-color: #666;
}

.strip-search-input:focus {
    border-color: #6ea8fe;
}

.strip-search-list {
    border: 1px solid #444;
    border-top: none;
    border-radius: 0 0 3px 3px;
    background: #1a1a24;
}

/* 24 px rows or taller: each is a click target. */
.strip-search-option {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-height: 24px;
    padding: 4px 6px;
    box-sizing: border-box;
    font-size: 11px;
    line-height: 14px;
    color: #ccc;
    cursor: pointer;
}

.strip-search-option.highlight {
    background: #3a3a5a;
    color: #fff;
}

.strip-search-names {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.strip-search-added {
    flex: none;
    color: #888;
}

.strip-search-option.highlight .strip-search-added,
.strip-search-option.highlight .detection-scientific {
    color: #bbb;
}

.strip-search-empty {
    padding: 4px 6px;
    font-size: 11px;
    color: #888;
}

/* Settings panel */
.sidebar-panel {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 0;
}

.sidebar-panel-empty {
    padding: 16px;
    color: #555;
    font-size: 13px;
}

.sidebar-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 6px 16px;
    padding: 5px 10px;
    background: #1a3a2a;
    border: 1px solid #3a6a4a;
    border-radius: 4px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
}
.sidebar-btn:hover {
    background: #1a5a3a;
    border-color: #4a8a5a;
}

/* Annotation tree */
.annotation-tree {
    max-height: 300px;
    overflow-y: auto;
}
.annotation-tree-item {
    display: flex;
    align-items: center;
    padding: 3px 8px;
    cursor: pointer;
    gap: 4px;
    border: 1px solid transparent;
    border-radius: 3px;
    margin: 1px 2px;
    transition: background 0.1s;
    user-select: none;
}
.annotation-tree-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.annotation-tree-item.annotation-selected {
    background: rgba(80, 160, 255, 0.12);
    border-color: rgba(80, 160, 255, 0.3);
}
.annotation-tree-item.annotation-drop-target {
    border-color: rgba(120, 200, 80, 0.6);
    background: rgba(120, 200, 80, 0.08);
}
.annotation-tree-item.annotation-group-item {
    font-weight: 600;
}
.annotation-tree-item[draggable="true"] {
    cursor: grab;
}
.annotation-tree-item[draggable="true"]:active {
    cursor: grabbing;
    opacity: 0.6;
}
.annotation-collapse-toggle {
    font-size: 9px;
    color: #888;
    width: 12px;
    text-align: center;
    flex-shrink: 0;
}
.annotation-icon {
    font-size: 10px;
    color: #777;
    width: 14px;
    text-align: center;
    flex-shrink: 0;
}
.annotation-group-children {
    /* Children are indented via padding-left on each item */
}
.wav-marker-item .annotation-time {
    font-size: 11px;
    color: #777;
    flex-shrink: 0;
    margin-left: auto;
}
.annotation-toolbar-btn {
    font-size: 11px;
    padding: 2px 5px;
    width: auto;
    margin: 0;
    background: transparent;
    border-color: rgba(80, 140, 90, 0.3);
    opacity: 0.7;
}
.annotation-toolbar-btn:hover {
    opacity: 1;
    background: rgba(26, 58, 42, 0.6);
}
.annotation-toolbar-btn:disabled {
    opacity: 0.3;
}

.annotation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 16px;
    cursor: pointer;
    gap: 4px;
}
.annotation-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.annotation-label {
    font-size: 12px;
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}
.annotation-label.default {
    font-style: italic;
    color: #666;
}
.annotation-delete {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.annotation-delete:hover {
    color: #e44;
}
.annotation-edit {
    background: none;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}
.annotation-edit:hover {
    color: #8cf;
}
.annotation-lock {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
    transition: opacity 0.15s;
}
.annotation-lock.locked {
    color: #e88;
    opacity: 1.0;
    filter: saturate(2) brightness(1.2);
}
.annotation-lock.unlocked {
    color: #888;
    opacity: 0.45;
    filter: grayscale(1);
}
.annotation-lock.unlocked:hover {
    opacity: 0.7;
}
.annotation-lock.locked:hover {
    filter: saturate(2) brightness(1.4);
}
.annotation-label-input {
    flex: 1;
    background: #1a1a2e;
    border: 1px solid #446;
    color: #ddd;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
    outline: none;
    min-width: 0;
}
.annotation-label-input:focus {
    border-color: #68f;
}
.annotation-edit-fields {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.annotation-tags-input {
    font-size: 11px;
}
.annotation-tags-error {
    font-size: 10px;
    color: #f99;
    white-space: normal;
}
.annotation-tags {
    display: inline-flex;
    gap: 3px;
    margin-left: 4px;
    flex-shrink: 1;
    overflow: hidden;
}
.annotation-tag {
    display: inline-block;
    font-size: 10px;
    padding: 0 4px;
    border-radius: 3px;
    background: rgba(80, 160, 255, 0.15);
    color: #8bf;
    border: 1px solid rgba(80, 160, 255, 0.25);
    white-space: nowrap;
    line-height: 1.4;
    cursor: pointer;
}
.annotation-tag:hover {
    background: rgba(80, 160, 255, 0.3);
    border-color: rgba(80, 160, 255, 0.5);
}

.setting-group {
    padding: 4px 0;
}

.setting-group-title {
    padding: 6px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    /* #888: 5.3:1 on the sidebar (#666 was 3.29:1, under WCAG AA's 4.5:1). */
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 16px;
    gap: 8px;
}

.setting-label {
    font-size: 13px;
    color: #999;
    flex-shrink: 0;
    min-width: 70px;
}

.setting-hint {
    font-size: 10px;
    color: #666;
    padding: 2px 12px 4px;
    line-height: 1.4;
}

.setting-select {
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 12px;
    cursor: pointer;
    min-width: 0;
    flex: 1;
    max-width: 100px;
}

.setting-select:hover {
    border-color: #666;
}

.mic-info {
    padding: 2px 16px 4px;
}

.mic-info-row {
    display: flex;
    align-items: center;
    padding: 1px 0;
    gap: 8px;
    font-size: 11px;
}

.mic-info-label {
    color: #666;
    flex: 0 0 50px;
}

.mic-info-value {
    color: #aaa;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mic-info-refresh {
    margin-top: 4px;
    font-size: 11px;
}
.mic-mode-hint {
    font-size: 10px;
    color: #888;
    padding: 2px 16px 0;
}

/* ── Mic Chooser Modal ─────────────────────────────────────────────────── */
.mic-chooser-group-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
    border-bottom: 1px solid #333;
    margin-bottom: 4px;
}
.mic-chooser-device {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    margin: 2px 0;
    transition: background 0.1s;
}
.mic-chooser-device:hover {
    background: #2a2a3e;
}
.mic-chooser-device.selected {
    background: #1a2a3a;
    border-left: 3px solid #4a9eff;
}
.mic-chooser-device-name {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 500;
}
.mic-chooser-device-badge {
    font-size: 10px;
    color: #4a9eff;
    margin-left: 8px;
    font-weight: 400;
}
.mic-chooser-device-badge.sel {
    color: #4a8;
}
.mic-chooser-device-badge.warn {
    color: #fc8;
}
.mic-chooser-device-caps {
    font-size: 11px;
    color: #888;
    margin-top: 2px;
}

/* ── Debug Log Panel ────────────────────────────────────────────────────── */
.debug-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.debug-panel-toolbar {
    display: flex;
    gap: 6px;
    padding: 6px 8px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}
.debug-panel-log {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.4;
    user-select: text;
    -webkit-user-select: text;
}
.debug-panel-empty {
    color: #666;
    padding: 12px;
    text-align: center;
}
.debug-entry {
    display: flex;
    gap: 4px;
    padding: 1px 0;
    word-break: break-all;
}
.debug-time {
    color: #666;
    flex-shrink: 0;
    min-width: 50px;
}
.debug-level-info { color: #888; flex-shrink: 0; }
.debug-level-warn { color: #cc6; flex-shrink: 0; }
.debug-level-error { color: #e66; flex-shrink: 0; }
.debug-msg { color: #ccc; }

.setting-slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.setting-range {
    flex: 1;
    min-width: 0;
}

.setting-button {
    font-size: 11px;
    padding: 2px 8px;
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 3px;
    cursor: pointer;
}
.setting-button:hover {
    background: #444;
}

/* Google Drive group in Settings (drive_settings.rs). Notes are 11px #999
   (6.3:1 on the sidebar) rather than .setting-hint's 10px #666, which is
   under 4.5:1; the sign-in note is the one fact a first-time reader needs. */
.drive-note {
    font-size: 11px;
    color: #999;
    padding: 2px 16px 4px;
    line-height: 1.4;
}
.drive-note.setting-error {
    color: #f88;
}
/* Drive could not be reached or refused a change: nothing is lost (the
   change is saved on this device), so the warning colour (.bit-warning),
   not the error red. */
.drive-note.drive-warning {
    color: #fc8;
}
/* The account sits where other rows have their label; long addresses are
   cut with an ellipsis and shown in full on hover by the browser title. */
.drive-account {
    font-size: 13px;
    color: #ddd;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Same size and colour as the panel's other notes. Fixed-width digits
   because the count of files waiting to upload changes. */
.drive-status {
    font-size: 11px;
    color: #999;
    font-variant-numeric: tabular-nums;
}
/* 24px tall: the smallest click target the UI checks allow. */
.drive-button {
    min-height: 24px;
    flex-shrink: 0;
}
/* "Signing in…" while the Google window is open: visibly not pressable. */
.drive-button:disabled {
    opacity: 0.6;
    cursor: default;
}
.drive-button:disabled:hover {
    background: #333;
}

/* An error under a settings row, such as "Location permission denied". */
.setting-error {
    color: #f88;
    font-size: 11px;
}

/* "Your location" above the coordinates when the classifier's place is this
   device's position, not the recording's own. Same size as the value so it
   isn't missed. */
.place-source {
    display: block;
    color: #8fc;
}

.setting-value {
    font-size: 11px;
    color: #888;
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.setting-value.metadata-value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}

.metadata-row {
    position: relative;
}

.copy-btn {
    display: none;
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    border: 1px solid #555;
    border-radius: 3px;
    color: #aaa;
    font-size: 11px;
    padding: 1px 4px;
    cursor: pointer;
    line-height: 1;
}

.copy-btn:hover {
    background: #444;
    color: #ddd;
    border-color: #777;
}

.metadata-row:hover .copy-btn {
    display: block;
}

.hash-calc-btn {
    background: #333;
    color: #aaa;
    border: 1px solid #555;
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
}

.hash-calc-btn:hover:not(:disabled) {
    background: #444;
    color: #ddd;
    border-color: #777;
}

.hash-calc-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.hash-note {
    font-style: italic;
    color: #ff9800;
    font-size: 11px;
}

.copy-report-row {
    display: flex;
    justify-content: flex-end;
    padding: 6px 12px 0;
}

.copy-report-btn {
    font-size: 10px;
    padding: 2px 8px;
    background: #2a2a2a;
    color: #888;
    border: 1px solid #444;
    border-radius: 3px;
    cursor: pointer;
}

.copy-report-btn:hover {
    color: #ccc;
    background: #333;
    border-color: #666;
}

.metadata-source-badge {
    font-size: 9px;
    color: #666;
    background: #222;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 0 4px;
    margin-left: 6px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

/* ── Info / Metadata panel ──────────────────────────────────────────────── */
/* Major section headings (File, Xeno-canto, Guano metadata, File Identity,
   Header metadata) — promoted to yellow so they stand out from sub-sections
   like "BatGizmo App" inside GUANO. */
.setting-group-title-major {
    color: #e6c84a;
    font-size: 12px;
}
/* GUANO sub-section headings (kept dim, like the original style). */
.setting-group-title-sub {
    color: #888;
}

/* Formatted/Original toggle at the top of the Info panel. */
.metadata-view-toggle {
    display: flex;
    gap: 0;
    padding: 8px 12px 4px;
}
.metadata-view-toggle .psd-btn {
    flex: 1;
    text-align: center;
    border-radius: 0;
}
.metadata-view-toggle .psd-btn:first-child {
    border-radius: 3px 0 0 3px;
}
.metadata-view-toggle .psd-btn:last-child {
    border-radius: 0 3px 3px 0;
}
.metadata-view-toggle .psd-btn + .psd-btn {
    margin-left: -1px;
}

/* Spacious row — key on its own line, value(s) below. Used everywhere
   except the File summary section. */
.metadata-row-spacious {
    display: block;
    padding: 6px 16px 8px;
    position: relative;
}
.metadata-key-line {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 16px;
}
.metadata-key {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex: 1;
    min-width: 0;
}
.metadata-value-block {
    font-size: 13px;
    color: #ddd;
    word-break: break-word;
    line-height: 1.35;
    padding-top: 2px;
    user-select: text;
    -webkit-user-select: text;
}
.metadata-value-block.metadata-value-lines {
    white-space: pre-line;
}
/* Xeno-canto remarks rendered from Markdown (markdown.rs). Remarks can run to
   several paragraphs and a reference list, so the gaps are small to keep them
   compact in the narrow panel. Long URLs in the text wrap anywhere, so the
   panel never scrolls sideways at 375 px. */
.metadata-markdown {
    overflow-wrap: anywhere;
}
.metadata-markdown p,
.metadata-markdown ul,
.metadata-markdown ol,
.metadata-markdown pre,
.metadata-markdown blockquote,
.metadata-markdown hr {
    margin-bottom: 6px;
}
/* A block quote (lines starting with ">") is indented, as on Xeno-canto, so
   it does not read as ordinary text. Indent only, no bar down the side. */
.metadata-markdown blockquote {
    padding-left: 12px;
    color: #bbb;
}
.metadata-markdown li > p {
    margin-bottom: 3px;
}
.metadata-markdown > :last-child,
.metadata-markdown li > :last-child,
.metadata-markdown blockquote > :last-child {
    margin-bottom: 0;
}
/* The global reset removes list padding, which would put the markers outside
   the row. */
.metadata-markdown ul {
    padding-left: 18px;
}
/* A numbered list's numbers sit in its indent, so the indent grows with the
   widest number: markdown.rs sets --marker-digits to the digit count of the
   last item's number. A remark line starting "2019. " is a list that starts at
   2019, and an 18px indent cut off its first digit at 375 px. 1ch is the width
   of a digit; the extra 1.5ch is for the "." and the gap. One digit gives
   about the same indent as a bullet list. The next rule stops this from the
   fourth list level down. */
.metadata-markdown ol {
    padding-left: calc((var(--marker-digits, 1) + 1.5) * 1ch);
}
/* From the fourth list level down, each level is indented only 8px and its
   markers sit at the start of the item's first line, so the indent no longer
   grows with the marker. markdown.rs keeps up to eight levels, and eight
   levels of "2019." with their own indents need about 320px, which ran off
   the panel's 247px at 375 px. Wrapped lines start under the marker, not
   under the text. When an item starts with a paragraph (markdown.rs sets
   .paragraph-first), the paragraph is inline, so that its text stays on the
   marker's line, and the block after it gets the gap that the paragraph's
   margin gives on the first three levels. */
.metadata-markdown li li li :is(ul, ol) {
    list-style-position: inside;
    padding-left: 8px;
}
.metadata-markdown li li li :is(ul, ol) > li.paragraph-first > p:first-child {
    display: inline;
}
.metadata-markdown li li li :is(ul, ol) > li.paragraph-first > p:first-child + * {
    margin-top: 3px;
}
.metadata-markdown li + li {
    margin-top: 3px;
}
/* Same link style as the map links under GPS positions. */
.metadata-markdown a {
    color: #8cf;
    text-decoration: none;
}
.metadata-markdown a:hover {
    text-decoration: underline;
}
.metadata-markdown code,
.metadata-markdown pre {
    font-family: monospace;
    font-size: 12px;
}
/* Code blocks and raw XML (some recorders' headers) keep their line breaks
   and tabs, and wrap long lines. break-all wraps at the panel edge: without it
   a long tab-indented line breaks after its tab, which looks like a blank line
   followed by an unindented one. Tabs are 2 wide to fit nested XML at 375 px. */
.metadata-markdown pre {
    white-space: pre-wrap;
    word-break: break-all;
    tab-size: 2;
    color: #bbb;
}
.metadata-markdown hr {
    border: 0;
    border-top: 1px solid #333;
}
/* File Identity hash rows (metadata_panel.rs hash_row).
   A hash is on one line: its first and last characters with "…" between.
   The middle characters are in .hash-mid at font size 0, so they take no
   room but are still selected and copied with the rest; the "…" is generated
   content, which is not copied. */
.hash-value {
    font-family: monospace;
    font-size: 11px;
    color: #bbb;
    white-space: nowrap;
}
/* A saved hash that has not been compared with the file is not known to be
   this file's hash: italic and dimmer, as the "Not computed" text is. */
.hash-row[data-state="saved"] .hash-value {
    color: #909090;
    font-style: italic;
}
.hash-mid {
    font-size: 0;
}
.hash-mid::before {
    content: "\2026";
    font-size: 11px;
}
/* Copy is always shown in a hash row, not only on hover: the Check button
   beside it then stays where it is, and Copy can be reached by touch. */
.hash-row .copy-btn-spacious {
    display: inline-block;
}
/* Check and Compute: 24 px high, the smallest size that is easy to press. */
.hash-row .hash-calc-btn {
    padding: 0 8px;
    min-height: 24px;
}
/* The line under a hash: where the hash is from, and whether it was compared
   with a saved one. Grey for the usual states. */
.hash-status {
    font-size: 11px;
    color: #909090;
    padding-top: 2px;
    font-variant-numeric: tabular-nums;
}
.hash-mark {
    margin-right: 4px;
}
.hash-status-match .hash-mark {
    color: #4caf50;
}
.hash-status-failed {
    color: #ff9800;
    overflow-wrap: anywhere;
}
/* A hash that differs from the saved one is the case the group exists for:
   red text, and a red tint over the whole row. */
.hash-status-mismatch {
    color: #ff7b72;
    font-weight: 600;
}
.hash-row[data-state="mismatch"] {
    background: rgba(229, 57, 53, 0.14);
}
/* The two hashes of a mismatch, each after its name. */
.hash-pair {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2px 6px;
    align-items: baseline;
    padding-top: 3px;
}
/* Under the two hashes of a mismatch with saved annotations. */
.hash-save-btn {
    margin-top: 6px;
    min-height: 24px;
}
.hash-pair-label {
    white-space: nowrap;
    font-size: 11px;
    color: #aaa;
}
.hash-not-computed {
    font-size: 11px;
    color: #909090;
    font-style: italic;
}
.hash-others > summary {
    padding: 6px 16px;
}
.metadata-value-relative {
    font-size: 11px;
    color: #888;
    font-style: italic;
    padding-top: 1px;
}
/* A date value that can be clicked to toggle its "Local: ..." line. Subtle
   dotted underline hints at the affordance without shouting. */
.metadata-date-toggle {
    cursor: pointer;
    text-decoration: underline dotted rgba(255, 255, 255, 0.25);
    text-underline-offset: 2px;
}
/* "Local: ..." line beneath a date when the original tz differs from
   the user's local zone. Italic, slightly dimmer than the main value. */
.metadata-value-local {
    font-size: 12px;
    color: #aaa;
    font-style: italic;
    padding-top: 1px;
}
/* Generic "secondary detail" line — used e.g. for the raw license URL
   beneath a shortened "CC BY-NC-SA 4.0" label. */
.metadata-value-subtle {
    font-size: 11px;
    color: #777;
    word-break: break-all;
    padding-top: 1px;
}
/* Fahrenheit conversion next to the primary °C value — dimmer so the
   primary unit reads first. */
.metadata-temp-f {
    color: #888;
}

/* Copy button in spacious rows: sits inline next to the key, fades in
   on row hover (matches the inline-row pattern). */
.copy-btn-spacious {
    display: none;
    position: static;
    transform: none;
    flex-shrink: 0;
}
.metadata-row-spacious:hover .copy-btn-spacious {
    display: inline-block;
}
/* Open-link button beside Copy on URL rows: same box as Copy, and the copy
   button's colour rather than link blue or an underline. A fixed width keeps
   the two the same size, since their glyphs differ in width. */
a.open-link-btn {
    text-decoration: none;
}
.copy-btn-spacious {
    width: 20px;
    padding-left: 0;
    padding-right: 0;
    text-align: center;
    box-sizing: border-box;
}

/* JSON expansion block (e.g. Wildlife Acoustics "Audio settings"). */
.metadata-value-json {
    padding-top: 4px;
}
.metadata-json-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 2px solid #444;
    border-radius: 0 3px 3px 0;
    font-family: monospace;
    font-size: 11px;
}
.metadata-json-line {
    display: flex;
    gap: 0;
    line-height: 1.4;
}
.metadata-json-key { color: #8cf; }
.metadata-json-sep { color: #666; }
.metadata-json-val { color: #ddd; word-break: break-word; }

/* GPS world-map block — equirectangular projection, pin positioned by
   percentage. The world-map.png asset is loaded from the site root. */
.metadata-map-wrap {
    position: relative;
    margin-top: 6px;
    border: 1px solid #333;
    border-radius: 3px;
    overflow: hidden;
    background: #0a0a0a;
    aspect-ratio: 2 / 1;
}
.metadata-map-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
    /* Source PNG is white ocean / grey land; invert so it reads as
       light land on dark ocean against the dark UI. */
    filter: invert(0.9) brightness(0.7);
}
.metadata-map-pin {
    position: absolute;
    width: 10px;
    height: 10px;
    margin-left: -5px;
    margin-top: -5px;
    border-radius: 50%;
    background: #ff4444;
    border: 1.5px solid #fff;
    box-shadow: 0 0 4px rgba(255, 68, 68, 0.8), 0 0 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}
.metadata-map-links {
    display: flex;
    align-items: center;
    gap: 6px;
    padding-top: 4px;
    font-size: 11px;
}
.metadata-map-links a {
    color: #8cf;
    text-decoration: none;
}
.metadata-map-links a:hover {
    text-decoration: underline;
}
.metadata-map-link-sep {
    color: #555;
}

.drop-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-height: 0;
}

.drop-zone.drag-over {
    background: #1a2a1a;
    outline: 2px dashed #4a8;
    outline-offset: -4px;
}

.drop-hint {
    padding: 24px 16px;
    text-align: center;
    color: #666;
    font-style: italic;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-btn {
    padding: 6px 16px;
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-style: normal;
}

.upload-btn:hover {
    background: #444;
    color: #fff;
}

.add-files-btn {
    background: transparent;
    border: 1px dashed #444;
    color: #777;
    font-size: 12px;
    padding: 4px 10px;
    margin-top: 4px;
    width: 100%;
}

.add-files-btn.primary-btn {
    background: #2b3a6a;
    border: 1px solid #3d4f8a;
    color: #e6ecff;
}

.add-files-btn.primary-btn:hover {
    background: #354a85;
    border-color: #4a5fa0;
    color: #fff;
}

.add-files-btn:hover {
    border-color: #666;
    color: #aaa;
    background: #2a2a2a;
}

.file-sort-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-bottom: 1px solid #222;
}

.file-sort-label {
    font-size: 11px;
    color: #666;
}

.file-sort-select {
    background: #222;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 11px;
    padding: 1px 4px;
    cursor: pointer;
    outline: none;
}

.file-sort-select:hover {
    border-color: #666;
    color: #ccc;
}

.file-sort-select:focus {
    border-color: #557;
}

.file-preview-toggle {
    margin-left: auto;
    background: none;
    border: 1px solid #444;
    border-radius: 3px;
    color: #888;
    font-size: 13px;
    padding: 0 4px;
    cursor: pointer;
    line-height: 1.4;
    opacity: 0.7;
}

.file-preview-toggle:hover {
    border-color: #666;
    opacity: 1;
}

.file-preview-toggle.active {
    color: #ccc;
    opacity: 1;
}

.demo-picker {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 4px;
}

.demo-item {
    padding: 5px 10px;
    background: #2a2a2a;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    font-size: 0.85em;
    font-style: normal;
}

.demo-item:hover {
    background: #3a3a3a;
    color: #fff;
    border-color: #666;
}

.bats-for-you {
    margin: 12px 10px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 8px 8px 8px;
    background: #1e1e22;
    border: 1px solid #3a3a44;
    border-radius: 6px;
}

.bats-for-you-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 2px;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    color: #b0a088;
    font-size: 0.82em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bats-for-you-header:hover {
    color: #d0c0a0;
}

.bats-for-you-caret {
    font-size: 0.9em;
    width: 12px;
    display: inline-block;
    text-align: center;
    opacity: 0.8;
}

.bats-for-you-title {
    flex: 1;
}

.bats-for-you-refresh {
    background: transparent;
    color: #9a8a70;
    border: 1px solid #4a4a50;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 0.95em;
    line-height: 1;
}

.bats-for-you-refresh:hover {
    background: #2a2a2e;
    color: #d0c0a0;
    border-color: #6a6a70;
}

.bats-for-you-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bats-for-you-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    width: 100%;
}

.bats-for-you-shuffle {
    background: transparent;
    color: #9a8a70;
    border: 1px solid #4a4a50;
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    font: inherit;
    font-size: 0.78em;
    letter-spacing: 0.03em;
    text-align: center;
}

.bats-for-you-shuffle:hover {
    background: #2a2a2e;
    color: #d0c0a0;
    border-color: #6a6a70;
}

.bats-for-you-empty {
    grid-column: 1 / -1;
    padding: 8px;
    color: #777;
    font-size: 0.8em;
    text-align: center;
    font-style: italic;
}

.bats-for-you-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: left;
    gap: 2px;
    padding: 6px 10px;
    background: #26262a;
    color: #ccc;
    border: 1px solid #3a3a40;
    border-left: 3px solid #8a7048;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
    min-width: 0;
}

.bats-for-you-card:hover {
    background: #2e2e34;
    border-color: #55555c;
    color: #fff;
}

.bats-for-you-card:nth-child(3n+1) { border-left-color: #a88050; }
.bats-for-you-card:nth-child(3n+2) { border-left-color: #5a9088; }
.bats-for-you-card:nth-child(3n+3) { border-left-color: #9070a8; }

.bats-for-you-card:nth-child(3n+1):hover { border-left-color: #d0a060; }
.bats-for-you-card:nth-child(3n+2):hover { border-left-color: #78b8ac; }
.bats-for-you-card:nth-child(3n+3):hover { border-left-color: #b090c8; }

.bats-for-you-card-name {
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.2;
    color: #e0d8c0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bats-for-you-card-species {
    font-size: 0.72em;
    font-style: italic;
    color: #9a9080;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bats-for-you-card-details {
    font-size: 0.7em;
    color: #a89878;
    line-height: 1.2;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bats-for-you-card-placeholder {
    color: #555;
}

.file-list {
    list-style: none;
}

/* Empty state shown above the action footer when no files are loaded:
   faded bat logo, headline, and a short hint. */
.files-empty-state {
    padding: 28px 16px 16px;
    text-align: center;
    user-select: none;
    -webkit-user-select: none;
}

.files-empty-logo {
    width: 96px;
    height: 96px;
    display: block;
    margin: 0 auto 12px auto;
    opacity: 0.35;
    pointer-events: none;
}

.files-empty-title {
    color: #ddd;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.files-empty-sub {
    color: #888;
    font-size: 13px;
}

/* Stack the unified action buttons (Open files / New live recording / Load
   demo / Explore XC). Visible in both empty and populated states. */
.file-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 12px 4px;
}

.file-actions .add-files-btn {
    margin-top: 0;
}

/* Mobile: bump padding so touch targets clear ~44px Apple HIG minimum. */
.app.mobile .file-actions {
    gap: 8px;
    padding: 10px 12px 6px;
}
.app.mobile .file-actions .upload-btn,
.app.mobile .file-actions .add-files-btn {
    padding: 12px 14px;
    font-size: 14px;
    min-height: 44px;
}

.file-item {
    padding: 8px 16px;
    cursor: pointer;
    border-bottom: 1px solid #222;
}

.file-item:hover {
    background: #222;
}

/* A denoised copy, listed directly under the recording it was made from
   (file_groups.rs: place_copies_after_originals). The indent shows that the
   two belong together. */
.file-item.denoised-copy {
    padding-left: 32px;
}

.file-item.active {
    background: #1a3a5a;
    color: #fff;
}

.file-item.selected {
    background: #2a2a3a;
    outline: 1px solid #5577aa;
    outline-offset: -1px;
}

.file-item.active.selected {
    background: #1a3a5a;
    outline: 1px solid #6699cc;
    outline-offset: -1px;
}

/* Timeline creation bar */
.timeline-create-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: #1a2a3a;
    border: 1px solid #335;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #8ab;
}

.timeline-create-btn {
    background: #2a5a8a;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
}

.timeline-create-btn:hover {
    background: #3a6a9a;
}

/* Timeline active banner */
.timeline-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: #1a3a2a;
    border: 1px solid #3a6a4a;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 11px;
    color: #8cb8a0;
}

.timeline-banner-label {
    flex: 1;
}

.timeline-exit-btn {
    background: none;
    border: none;
    color: #8cb8a0;
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px;
    line-height: 1;
}

.timeline-exit-btn:hover {
    color: #f88;
}

/* Main area */
.main {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
}

.toolbar {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 8px 6px 8px;
    background: #181818;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
    /* Grid items default to min-width: auto (min-content). Without this,
       a long filename forces the whole toolbar wider than the viewport,
       pushing the right-side overflow button off-screen on mobile. */
    min-width: 0;
}

/* Shared layout for every main chart host (spectrogram, chromagram,
   waveform, ZC chart). Outer flex-column with [chart-row: stage + band
   gutter] over [view-bottom-row: time gutter + corner]. Per-view sizing
   modifiers live below and only override flex weight / heights / bg. */
.spectrogram-container,
.waveform-container {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chart-row {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: row;
}

.chart-stage {
    flex: 1 1 auto;
    position: relative;
    min-width: 0;
    min-height: 0;
}

.chart-stage > canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Spectrogram + chromagram take three parts of the main flex. */
.spectrogram-container {
    flex: 3;
    background: #000;
}

/* Waveform + ZC chart sit as a short sub-strip by default; the
   .main-waveform-full wrapper lifts the height cap when they're the
   primary view. */
.waveform-container {
    flex: 1;
    min-height: 80px;
    max-height: 170px;
    background: #0a0a0a;
    border-top: 1px solid #333;
}

.band-gutter {
    /* Width = LABEL_COL_WIDTH (22) + one 20px fog cell = 42px of canvas,
       plus ~2px visual breathing room. Must stay in sync with
       gutter_renderer::BAND_GUTTER_WIDTH. One cell, not two, on desktop:
       a mouse needs no 40px drag surface, and the second cell took width
       from the recording. Phones keep the wide gutter (rule below). */
    flex: 0 0 44px;
    position: relative;
    /* Visible gap between the gutter and the wave canvas so the scale
       distinction (frequency vs. amplitude) reads at a glance. */
    margin-right: 3px;
    background: #0d0d0d;
    border-right: 2px solid #2a2a2a;
    overflow: hidden;
    touch-action: none;
}

.band-gutter canvas {
    width: 100%;
    /* Full-height canvas so the gutter's tick positions line up 1:1 with
       the host view's y-axis — any header/footer reservation would offset
       the mapping. */
    height: 100%;
    display: block;
    /* Thick-cross `cell` cursor matches the spectrogram's y-axis so the
       two surfaces read as one continuous frequency-selection control. */
    cursor: cell;
}

/* Subtle top/bottom vignette — detaches the gutter visually from the
   flat-black wave background so it reads as a distinct "strip". */
.band-gutter::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to bottom,
        rgba(0, 0, 0, 0.35) 0%,
        rgba(0, 0, 0, 0) 12%,
        rgba(0, 0, 0, 0) 88%,
        rgba(0, 0, 0, 0.35) 100%);
}

/* Bottom-row layout shared by every gutter-equipped view: the time gutter
   claims the remaining width beside the corner spacer that sits under the
   band gutter. Keeps the time ticks aligned with the main canvas data
   region and leaves a clean empty square in the corner. */
.view-bottom-row {
    flex: 0 0 24px;
    /* Without min-height:0 + overflow:hidden, the inner <canvas>'s 150px
       intrinsic height becomes the row's min-content floor and overrides
       the 24px flex-basis, letting the gutter swallow the main view. */
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    align-items: stretch;
}

.view-bottom-corner {
    /* Matches .band-gutter total occupation: flex-basis 44px (border-box,
       so includes the 2px border) + 3px margin-left = 47px. Kept in sync
       manually so the corner perfectly aligns with the column above. */
    flex: 0 0 47px;
    background: #0a0a0a;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Rows above the spectrogram (score_strips.rs): one 18 px row per picked
   species or component, over the spectrogram's own columns. The corner
   spacer is a .view-bottom-corner, so it keeps the band gutter's width on
   phones too. Height is set inline from the number of rows. */
.score-strips-row {
    flex: 0 0 auto;
    min-height: 0;
    overflow: hidden;
    flex-direction: row;
    align-items: stretch;
    border-bottom: 1px solid #333;
}

.score-strips-corner {
    border-top: none;
}

.score-strips-stage {
    flex: 1 1 auto;
    min-width: 0;
    position: relative;
    overflow: hidden;
    background: #0a0a0a;
}

.score-strips-stage canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: pointer;
}

.score-strips-tip {
    position: absolute;
    z-index: 5;
    padding: 2px 6px;
    background: rgba(20, 20, 20, 0.92);
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 11px;
    line-height: 15px;
    color: #ddd;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

.time-gutter {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #0a0a0a;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    touch-action: none;
}

.time-gutter canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: cell;
}

/* Mobile: widen the frequency gutter and deepen the time gutter so they
   present fat-finger drag surfaces. Canvas content auto-adapts (the
   renderer draws to the actual container size), so only the CSS flex
   basis needs to grow. The bottom-corner spacer must track the band
   gutter's total occupation (width + 3px margin) so the corner stays
   aligned with the column above it. */
.app.mobile .band-gutter {
    /* 22px of labels + two 20px fog cells. 84px (three cells) was a sixth
       of a phone's width. */
    flex: 0 0 64px;
}
.app.mobile .view-bottom-row {
    flex: 0 0 40px;
}
.app.mobile .view-bottom-corner {
    flex: 0 0 67px;
}
/* The phone layout in a narrow window with a mouse (a small desktop window,
   a side pane): no finger to make room for, so the desktop width. */
@media (pointer: fine) {
    .app.mobile .band-gutter {
        flex: 0 0 44px;
    }
    .app.mobile .view-bottom-corner {
        flex: 0 0 47px;
    }
}

.band-gutter-tooltip {
    position: absolute;
    /* Float the tooltip to the right of the gutter (over the waveform) so
       it doesn't spill outside the container now that the gutter is the
       leftmost element. */
    left: 100%;
    margin-left: 4px;
    transform: translateY(-50%);
    padding: 2px 6px;
    background: rgba(20, 20, 20, 0.92);
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 11px;
    color: #eee;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10;
}

/* ── Playhead overlays (DOM-based for smooth animation) ──────────────── */

.playhead-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: rgba(255, 80, 80, 0.9);
    pointer-events: none;
    will-change: transform;
    z-index: 2;
}

.playhead-dot {
    position: absolute;
    bottom: 2px;
    left: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 80, 80, 0.9);
    pointer-events: none;
    will-change: transform;
    z-index: 2;
    margin-left: -3px;
}

.analysis-panel {
    padding: 8px 16px;
    background: #181818;
    border-top: 1px solid #333;
    font-size: 13px;
    color: #999;
    flex-shrink: 0;
    min-height: 32px;
}

.analysis-panel span {
    margin-right: 20px;
}

/* ── Bottom toolbar ── */
.bottom-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    padding-top: 0;
    background: #1a1a1a;
    border-top: 1px solid #333;
    flex-shrink: 0;
    overflow: visible;
    position: relative;
    z-index: 15;
    flex-wrap: wrap;
}

/* When a combo dropdown is open, lift toolbar above .main-overlays (z-index: 20)
   so the panel isn't hidden behind floating overlay buttons like Spec|View.
   The .panel-open class is driven reactively from state.layer_panel_open — more
   reliable than :has(), which browsers sometimes fail to re-invalidate when
   descendant classes flip during rapid mode changes. */
.bottom-toolbar.panel-open,
.bottom-toolbar:has(.combo-btn-row.open) {
    z-index: 25;
}

.bottom-toolbar-drag-handle {
    width: 100%;
    height: 10px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    touch-action: none;
}

.bottom-toolbar-drag-grip {
    width: 40px;
    height: 3px;
    border-radius: 2px;
    background: #444;
    transition: background 0.15s;
}

.bottom-toolbar-drag-handle:hover .bottom-toolbar-drag-grip,
.bottom-toolbar-drag-handle:active .bottom-toolbar-drag-grip {
    background: #777;
}

.bottom-toolbar-sep {
    width: 1px;
    height: 24px;
    background: #333;
    margin: 0 4px;
    flex-shrink: 0;
}

/* Toolbar elements */
.toolbar button {
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    padding: 4px 12px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 13px;
}

.toolbar button:hover {
    background: #444;
}

.toolbar button.active {
    background: #1a5a3a;
    border-color: #4a8;
}

.toolbar label {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #999;
    font-size: 13px;
}

.toolbar input[type="range"] {
    width: 100px;
}

.toolbar-sep {
    width: 1px;
    height: 20px;
    background: #444;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    color: #555;
    font-size: 18px;
    position: relative;
}

/* Toolbar brand */
.toolbar-brand {
    font-weight: 700;
    font-size: 15px;
    color: #eee;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Title center area — two-row layout: row 1 = status + filename, row 2 = info/CC */
.toolbar-title-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-width: 0; /* allow shrinking */
    overflow: visible;
    gap: 1px;
}

.toolbar-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    width: 100%;
    overflow: hidden;
}

/* The heading's badge row: one text size (12px) for every fact and control.
   See "File badges" for the facts and controls in it. */
.toolbar-badge-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px 6px;
    position: relative;
    flex-wrap: wrap;
    font-size: 12px;
    color: #aaa;
}

.toolbar-status-icons {
    flex-shrink: 0;
    font-size: 14px;
    line-height: 1;
    min-width: 20px; /* reserve space so filename doesn't shift */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

/* CSS-rendered recording dot for the heading (cross-platform, pulsing) */
.toolbar-rec-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #e44;
    flex-shrink: 0;
    animation: toolbar-rec-pulse 1.2s ease-in-out infinite;
}

@keyframes toolbar-rec-pulse {
    0%, 100% { opacity: 1.0; }
    50% { opacity: 0.4; }
}

.toolbar-title-filename {
    color: #bbb;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    direction: ltr;
    text-align: center;
}

.toolbar-info-btn {
    flex-shrink: 0;
    background: none !important;
    border: none !important;
    color: #888;
    font-size: 16px;
    padding: 2px 4px !important;
    cursor: pointer;
    line-height: 1;
    border-radius: 3px;
}

.toolbar-info-btn:hover {
    color: #ccc;
    background: rgba(255, 255, 255, 0.1) !important;
}

/* The heading's licence button. Its box comes from .badge-btn ("File
   badges"); this rule lays out the icon and label.
   The button goes on the same line as the badges before it whenever 6em
   (72px) is left on that line, and then widens to its full label or to the
   end of the line, whichever is narrower. A label longer than that is cut
   off with an ellipsis. On a phone this keeps the heading at two badge lines
   for a heterodyne file with a long licence ("Public Domain Mark 1.0") or a
   [~] badge, where a licence that moved to a line of its own made the
   heading 16px taller than before badge style option A. With room to spare,
   as on a desktop, the whole label shows.
   The label clips itself, so the button does not clip and the touch strip
   in .badge-btn::before stays tappable. */
.toolbar-cc-badge {
    flex: 1 1 6em;
    min-width: 0;
    max-width: max-content;
    display: flex;
    align-items: center;
    gap: 3px;
}

.toolbar-cc-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    vertical-align: middle;
    background-color: currentColor;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='9' stroke='white' stroke-width='1.5' fill='none'/%3E%3Ctext x='10' y='13.5' text-anchor='middle' font-size='10' font-weight='700' font-family='Arial,sans-serif' fill='white'%3ECC%3C/text%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='9' stroke='white' stroke-width='1.5' fill='none'/%3E%3Ctext x='10' y='13.5' text-anchor='middle' font-size='10' font-weight='700' font-family='Arial,sans-serif' fill='white'%3ECC%3C/text%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

/* 14em is 168px at the badge row's 12px: the longest Creative Commons
   labels ("Public Domain Mark 1.0", "BY-NC-SA 2.5 SCOTLAND") fit, and a
   longer licence name that is not Creative Commons is cut off. */
.toolbar-cc-label {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 14em;
}

/* Document icon for licences that are not Creative Commons (GFDL, Fair use),
   so their badge reads as a button like the CC one. Same box as the CC icon;
   the icon would otherwise be 1em, which is 12px in the badge row. */
.toolbar-license-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* The same icon in the licence dialog title, sized like the CC icon there. */
.cc-modal-license-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-right: 6px;
}

/* Mode group — radio-style buttons */
.mode-group {
    display: flex;
    gap: 0;
}

.mode-btn {
    background: #2a2a2a !important;
    border: 1px solid #444 !important;
    border-radius: 0 !important;
    padding: 4px 14px !important;
    font-size: 12px !important;
    font-weight: 600;
    color: #888 !important;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.mode-btn:first-child {
    border-radius: 3px 0 0 3px !important;
}

.mode-btn:last-child {
    border-radius: 0 3px 3px 0 !important;
}

.mode-btn:not(:first-child) {
    border-left: none !important;
}

.mode-btn:hover {
    background: #383838 !important;
    color: #bbb !important;
}

.mode-btn.active {
    background: #1a5a3a !important;
    border-color: #4a8 !important;
    color: #fff !important;
}

/* Mode-specific parameter controls */
.mode-param {
    color: #aaa !important;
    font-variant-numeric: tabular-nums;
    min-width: 120px;
}

.mode-param-value {
    display: inline-block;
    min-width: 52px;
    text-align: right;
}

.mode-hint {
    color: #666;
    font-size: 12px;
    font-style: italic;
}

/* File item details */
.file-item-header {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.file-item-name {
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.file-item-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 3px;
}

.file-item:hover .file-item-close {
    color: #999;
}

.file-item.active .file-item-close {
    color: #88a;
}

.file-item-close:hover {
    background: #c33;
    color: #fff;
}

/* A file row's badge line: one text size (11px) for every fact and control.
   The 14px line height is the height the bordered sample rate chip gave each
   line before the badges became plain text, so a row whose badges wrap onto
   a second line (heterodyne badge, CC icon) is no taller than it was.
   The Files sidebar can be narrowed to 140px, so the spacing is tight: a 4px
   gap between badges, 3px before each middle dot ("File badges") and 3px
   side padding in each control. Checked at sidebar widths from 140 to 200px
   with seven sample rows (192 kHz sequence and track files, a 384 kHz 32-bit
   float file, a heterodyne file with a licence icon, an unsaved recording),
   no row was taller than before badge style option A, except the heterodyne
   row at 164 to 169px: the "Heterodyne recording" text is 11px, where it was
   10px. Rows with [~] or other badge mixes were not checked.
   See "File badges" for the facts and controls in it. */
.file-item-info {
    font-size: 11px;
    line-height: 14px;
    color: #999;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.file-item.active .file-item-info {
    color: #c0cfe0;
}

.file-preview-canvas {
    display: block;
    width: 100%;
    height: 40px;
    border-radius: 2px;
    margin-bottom: 4px;
    image-rendering: pixelated;
}

/* Loading indicator */
.file-item.loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #888;
    font-size: 12px;
    cursor: default;
}

.loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid #444;
    border-top-color: #4a8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}
.loading-name {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.loading-stage {
    font-size: 11px;
    color: #888;
}
.loading-bar {
    height: 3px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 1px;
}
.loading-bar-fill {
    height: 100%;
    background: #4a8;
    transition: width 0.3s ease;
}

/* Inline loading indicator inside a file item */
.file-item-loading {
    padding: 2px 8px 4px;
    font-size: 11px;
    color: #888;
}
.file-item-loading .loading-bar {
    margin-top: 2px;
}

/* Filter panel */
.filter-band-mode {
    display: flex;
    gap: 0;
    padding: 4px 16px;
}

.filter-band-mode .mode-btn {
    flex: 1;
    padding: 4px 8px !important;
    font-size: 12px !important;
}

.filter-set-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 4px 16px;
    padding: 5px 8px;
    background: #2a2a2a;
    color: #aaa;
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
}

.filter-set-btn:hover:not(:disabled) {
    background: #383838;
    color: #ccc;
}

.filter-set-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.filter-freq-display {
    padding: 3px 16px;
    font-size: 12px;
    color: #777;
    font-variant-numeric: tabular-nums;
}

.filter-mode-info {
    padding: 4px 16px;
    font-size: 12px;
    color: #777;
}

/* About dialog */
.about-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.about-dialog {
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 8px;
    padding: 24px 28px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.about-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 12px;
}

.about-title {
    font-size: 22px;
    font-weight: 700;
    color: #eee;
    letter-spacing: 0.5px;
}

.about-version {
    font-size: 13px;
    color: #666;
}

.about-desc {
    font-size: 13px;
    color: #999;
    margin-bottom: 18px;
    line-height: 1.5;
}

.about-modes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.about-mode {
    font-size: 12px;
    color: #888;
    line-height: 1.4;
}

.about-mode-tag {
    display: inline-block;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #aaa;
    margin-right: 6px;
    vertical-align: middle;
}

.about-close {
    display: block;
    margin-left: auto;
    background: #333;
    color: #ccc;
    border: 1px solid #555;
    border-radius: 4px;
    padding: 5px 18px;
    font-size: 13px;
    cursor: pointer;
}

.about-close:hover {
    background: #444;
    color: #fff;
}

/* ── Reusable modal ────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-dialog {
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 8px;
    max-width: min(90vw, 420px);
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px 12px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.modal-title {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
    display: flex;
    align-items: center;
}

.modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal-close:hover {
    color: #fff;
}

.modal-body {
    padding: 16px 18px 18px;
    overflow-y: auto;
    flex: 1;
}

/* ── CC license modal ──────────────────────────────────────────────── */

.cc-species {
    font-size: 15px;
    font-weight: 600;
    color: #e0e0e0;
    margin-bottom: 14px;
}

.cc-sci-name {
    font-weight: 400;
    font-style: italic;
    color: #aaa;
}

.cc-fields {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 5px 12px;
    margin-bottom: 14px;
    font-size: 12px;
}

.cc-row {
    display: contents;
}

.cc-label {
    color: #888;
    white-space: nowrap;
}

.cc-value {
    color: #ccc;
    word-break: break-word;
}

.cc-attribution {
    font-size: 11px;
    color: #999;
    background: #252530;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 12px;
    line-height: 1.5;
    user-select: all;
}

.cc-license-link {
    margin-bottom: 14px;
    font-size: 12px;
}

.cc-license-link a {
    color: #8cf;
    text-decoration: none;
}

.cc-license-link a:hover {
    text-decoration: underline;
}

.cc-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.cc-link-btn {
    display: inline-block;
    background: #2a2a35;
    border: 1px solid #444;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    color: #bbb;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.cc-link-btn:hover {
    background: #353545;
    color: #eee;
}

.cc-demo-notice {
    font-size: 11px;
    color: #777;
    border-top: 1px solid #333;
    padding-top: 10px;
    line-height: 1.5;
}

.cc-demo-notice a {
    color: #8cf;
    text-decoration: none;
}

.cc-demo-notice a:hover {
    text-decoration: underline;
}

/* ── Overview strip ─────────────────────────────────────────────────────── */

.overview-strip {
    height: clamp(50px, 9vh, 100px);
    flex-shrink: 0;
    position: relative;
    background: #000;
    border-bottom: 10px solid #000;
    touch-action: none;
    /* overflow: visible so the View panel can extend upward into the toolbar area */
    overflow: visible;
    cursor: crosshair;
    /* z-index creates stacking context so the panel paints above the toolbar */
    z-index: 5;
}

.overview-strip canvas {
    width: 100%;
    height: 100%;
    display: block;
    image-rendering: pixelated;
}

/* ── Overview toolbar — owns the spectrogram/waveform toggle, sits flush
   beneath the overview (shared black) so it reads as part of it. ────────── */
.overview-toolbar {
    display: flex;
    align-items: center;
    height: 24px;
    flex-shrink: 0;
    padding: 0 8px;
    background: #000;
    border-bottom: 1px solid #161616;
    gap: 8px;
}
.overview-toolbar-label {
    font-size: 9px;
    letter-spacing: 0.1em;
    color: #4a4a4a;
    margin-right: auto; /* push the toggle to the right end */
    user-select: none;
}
.overview-layer-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    padding: 2px 9px;
    color: #b0b0b0;
    background: #161616;
    border: 1px solid #2c2c2c;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
}
.overview-layer-btn:hover {
    color: #e6e6e6;
    background: #232323;
    border-color: #3a3a3a;
}
.overview-layer-btn .ov-preview {
    font-size: 13px;
    line-height: 1;
    color: #7fd0c0; /* subtle teal so the preview glyph reads as an icon */
}

/* ── HFR Bar (between Overview and main view) ──────────────────────────── */

/* ── Bar primitives — shared between .hearing-bar and .view-bar ──────────
   These let the two bars stay structurally identical so adding new
   buttons later is a one-liner. New bars can reuse the same primitives. */

.hearing-bar,
.view-bar {
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
    gap: 8px;
    padding: 4px 8px;
    background: #181818;
    border-bottom: 1px solid #333;
    position: relative;
    z-index: 6;
}

/* flex-wrap: wrap lets Gain/NR/Notch drop to a second row on narrow
   viewports rather than forcing the band-affected group to break up
   internally. */
.hearing-bar {
    gap: 0;
    align-items: stretch;
    min-height: 44px;
    flex-wrap: wrap;
}

/* The view-bar is a half-step lighter and a touch thinner to signal a
   different conceptual category (visualization, not audio). */
.view-bar {
    background: #1d1d1d;
    padding: 3px 8px;
    align-items: center;
}

/* When any combo dropdown is open, lift the bar above .main-overlays
   (z-index: 20) so the panel renders on top of canvas overlays.
   Matches the .bottom-toolbar.panel-open pattern. */
.hearing-bar.panel-open,
.view-bar.panel-open,
.hearing-bar:has(.combo-btn-row.open),
.view-bar:has(.combo-btn-row.open),
.hearing-bar:has(.switch-btn.open),
.view-bar:has(.switch-btn.open) {
    z-index: 25;
}

/* Tiny uppercase label at the start of each bar identifying its
   conceptual group. Hidden on narrow viewports where vertical space is
   precious. */
.bar-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    /* #8c8c8c: 5.2:1 on the bars (#666 was 3.1:1, under 4.5:1). */
    color: #8c8c8c;
    text-transform: uppercase;
    flex-shrink: 0;
    padding: 0 4px 0 0;
}

/* The hearing bar stretches its children, so centre the "HEAR" label. */
.hearing-bar > .bar-label {
    align-self: center;
}

/* Mute-blink: blinks the selected mode radio button's label when
   listening with the output muted. step-end snaps the color (no fade). */
@keyframes mute-blink-flash {
    0%, 49.99%  { color: #ffffff; }
    50%, 100%   { color: #f0c050; }
}
.mute-blink .mode-radio-label,
.mute-blink .layer-btn-value {
    animation: mute-blink-flash 1s step-end infinite;
    font-weight: 700;
}

/* Bandpass popup range readout — was 10px and gray, now legible. */
.bandpass-range-readout {
    padding: 4px 8px 6px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: #ddd;
    display: flex;
    align-items: center;
}
.bandpass-lock-icon {
    font-size: 13px;
    line-height: 1;
    filter: saturate(2) brightness(1.2);
    margin-left: 2px;
}

/* Main row of buttons inside a bar. Wraps on narrow viewports so new
   buttons don't shove existing ones off-screen. */
.bar-controls {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex-wrap: wrap;
    row-gap: 4px;
}

/* Hearing-bar's controls sit after the BAND cell (which provides its
   own border separator), so add a touch of breathing room and keep
   buttons centered vertically since the bar uses align-items: stretch. */
.hearing-bar .bar-controls {
    padding: 0 0 0 8px;
}

/* Thin vertical divider between button sub-groups. */
.bar-sep {
    width: 1px;
    height: 22px;
    background: #2c2c2c;
    flex-shrink: 0;
    margin: 0 4px;
}

/* Flex spacer that pushes subsequent items to the right end of the bar. */
.bar-spacer {
    flex: 1 1 auto;
    min-width: 0;
}

.hearing-bar .layer-btn,
.view-bar .layer-btn {
    padding: 2px 8px;
    font-size: 11px;
    line-height: 1.1;
}

/* ── Band-affected row ────────────────────────────────────────────────
   Wraps the HFR cell + Range dropdown + Mode radio group + PASS combo.
   A single horizontal overline above them communicates "all of these
   are slaved to the active band". The overline turns green when HFR is
   on, grey when off; the slice above PASS additionally goes grey when
   PASS is locked (range not following the band). */
.band-affected-row {
    display: flex;
    align-items: stretch;
    position: relative;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    margin-right: 10px;
    /* Pin the *used* width (not just a min-width floor) to the intrinsic
       content size. Firefox doesn't reliably propagate a nested flex
       container's max-content up to this row's border box, so with only
       `min-width: max-content` the border-top (the amber HFR overline)
       stopped partway across the PASS combo. `width: max-content` makes the
       row's border box equal its content in both engines. */
    width: max-content;
    min-width: max-content;
    /* Overline is a real border on the row — extends exactly the box's
       width (including all flex children) without depending on
       absolute-positioning math or min-width propagation. */
    border-top: 2px solid rgba(120, 120, 120, 0.28);
    transition: border-top-color 0.2s;
}
/* The green of a switch that is on (.switch-mark), so HFR on has one colour. */
.band-affected-row.band-on {
    border-top-color: rgba(51, 170, 136, 0.75);
}
/* When the bandpass range is locked (not following the active band),
   paint a grey patch over the section of border-top above PASS to
   signal that the PASS filter is *not* tracking the rest of the group.
   The patch is an absolutely-positioned ::before pinned to top:-2px so
   it sits exactly where the row's border-top is drawn. */
.band-affected-row.pass-locked .band-affected-controls > :last-child {
    position: relative;
}
.band-affected-row.pass-locked .band-affected-controls > :last-child::before {
    content: '';
    position: absolute;
    top: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(120, 120, 120, 0.45);
    pointer-events: none;
}
/* Inner controls row — like .bar-controls but never wraps. Keeping
   Range / Mode radios / PASS on a single line is the whole point of
   the band-affected group; if the viewport is too narrow, the entire
   hearing bar wraps as a unit instead (see .hearing-bar below). */
.band-affected-controls {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    padding: 0 0 0 6px;
    /* Override .bar-controls' min-width: 0 — we want intrinsic width so the
       parent row knows how wide it needs to be (and the overline above can
       span all the way to PASS). `width: max-content` (not just min-width)
       makes Firefox include this nested flex row's full size in the parent's
       border box. */
    width: max-content;
    min-width: max-content;
}
/* Children of band-affected-controls must never flex-shrink — otherwise
   the PASS combo's right half (AUTO) can be allocated less space than
   its content needs, the inner buttons (which are lock-grow locked at
   their high-water-mark widths) overflow visually, and the border-top
   overline ends short of where the visible AUTO text ends. */
.band-affected-controls > * {
    flex-shrink: 0;
}


/* ── Mode radio group — 5 joined buttons.
   The group is a single outlined container with thin internal dividers
   between buttons (no per-button borders), making it visually obvious
   that the five buttons are one cohesive picker rather than five loose
   buttons that happen to sit side-by-side. Inactive buttons are
   transparent; the selected one fills with the "active" tint and
   shows a corner ◢ when it has additional settings. */
.mode-radio-group {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
    position: relative;
    background: rgba(20, 20, 20, 0.85);
    border: 1px solid rgba(80, 80, 80, 0.45);
    border-radius: 6px;
    overflow: hidden;
}
.mode-radio-btn {
    border: none;
    border-right: 1px solid rgba(80, 80, 80, 0.45);
    border-radius: 0;
    background: transparent;
    margin: 0;
    position: relative;
    min-width: 40px;
    min-height: 30px;
    padding: 4px 8px 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
}
.mode-radio-btn:last-child {
    border-right: none;
}
.mode-radio-btn:hover:not(.selected) {
    background: rgba(255, 255, 255, 0.04);
    color: #ddd;
}
.mode-radio-btn.selected {
    background: rgba(26, 60, 40, 0.92);
    color: #8fc;
}
.mode-radio-btn.selected:hover {
    background: rgba(32, 72, 50, 0.95);
}
.mode-radio-btn.open {
    background: rgba(32, 72, 50, 0.95);
}
.mode-radio-btn.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}
/* Inaudible-band warning — amber wavy underline on the 1:1 label when
   the active band sits entirely above human hearing (so playing in
   Normal mode would produce nothing audible). Matches the underline
   the Play button gets in the same situation. */
.mode-radio-btn.inaudible-warning .mode-radio-label {
    text-decoration: underline wavy rgba(240, 160, 60, 0.9);
    text-underline-offset: 2px;
    text-decoration-thickness: 1.5px;
}
/* Same treatment on the Play button's ▶ glyph when current playback
   mode is 1:1 with an ultrasound-only band. Applied via a wrapping div
   with the .inaudible-warning class. */
.inaudible-warning .combo-btn-left .layer-btn-value,
.layer-btn.play-mode-extra.inaudible-warning .layer-btn-value {
    /* border, not text-decoration: the play glyph is an inline SVG */
    border-bottom: 2px dotted rgba(240, 160, 60, 0.9);
    padding-bottom: 1px;
}

/* Multi-selected (but not the live mode) — the bucket appears in the
   user's ctrl-click selection but isn't what's currently playing.
   Lighter green tint than .selected.active-mode so the live mode
   stays the obvious focal point. */
.mode-radio-btn.multi-selected:not(.active-mode) {
    background: rgba(26, 60, 40, 0.45);
    color: #9d9;
}
.mode-radio-btn.multi-selected:not(.active-mode):hover {
    background: rgba(32, 72, 50, 0.6);
}

/* Per-mode Play button (rendered before the main Play combo when the
   user has ctrl-clicked extra modes). Uses the same stacked face as the
   main Play combo's left half — mode label (small) over the ▶ glyph — so
   the whole play cluster reads as one consistent set of buttons. */
.layer-btn.play-mode-extra {
    padding: 4px 9px 5px;
    min-height: 38px;
}
/* Don't uppercase the mode label, matching .combo-btn-left. */
.layer-btn.play-mode-extra .layer-btn-category {
    text-transform: none;
    color: #c8c8c8;
}
.layer-btn.play-mode-extra .layer-btn-value {
    font-size: 13px;
    line-height: 1;
}
.layer-btn.play-mode-extra.active {
    background: rgba(26, 60, 40, 0.92);
    border-color: rgba(80, 180, 130, 0.6);
    color: #8fc;
}
.layer-btn.play-mode-extra.active .layer-btn-category {
    color: #8fc;
}
.mode-radio-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
}
/* Corner indicator — hidden by default, shown on the selected button
   when it has additional settings (HET/TE/PS/ZC). */
.mode-radio-corner {
    display: none;
    position: absolute;
    right: 1px;
    bottom: -1px;
    font-size: 9px;
    line-height: 1;
    opacity: 0.7;
    color: #8fc;
    pointer-events: none;
}
.mode-radio-btn.selected.has-settings .mode-radio-corner {
    display: block;
}

/* ── Main view area ─────────────────────────────────────────────────────── */

.main-view {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    /* overflow: visible so layer-panels can extend above this container */
    overflow: visible;
    min-height: 0;
}

/* VU meter — red level indicator on right edge during recording/listening */
.vu-meter {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 3px;
    background: #f44;
    z-index: 25;
    pointer-events: none;
    transition: height 0.05s linear;
    border-radius: 1px 1px 0 0;
}

/* When waveform is the main panel (not the sub-strip below spectrogram),
   wrap it in this to override the max-height cap */
.main-waveform-full {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.main-waveform-full .waveform-container {
    max-height: none;
    flex: 1;
    min-height: 0;
}

.main-overlays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Floating controls/panels must render above the bottom toolbar without
       lifting the entire main view above it. */
    z-index: 20;
    /* Allow panels to overflow upward into the overview strip area */
    overflow: visible;
}

/* ── Layer buttons (shared pattern) ────────────────────────────────────── */

.layer-btn {
    pointer-events: auto;
    background: rgba(20, 20, 20, 0.85);
    border: 1px solid rgba(80, 80, 80, 0.45);
    border-radius: 6px;
    color: #bbb;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 9px 5px;
    backdrop-filter: blur(4px);
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
    letter-spacing: 0.2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.combo-btn-text {
    display: grid;
    grid-template-rows: 10px 14px;
    align-items: end;
    justify-items: center;
    min-height: 24px;
}

.layer-btn-category {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: #c8c8c8;
    opacity: 0.8;
    line-height: 1;
    min-height: 10px;
}

.layer-btn-value {
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: #c8c8c8;
}

/* Don't force uppercase on combo-left categories (e.g. "with" for DSP) */
.combo-btn-left .layer-btn-category {
    text-transform: none;
}

/* Compact icon-only tool selector (Hand / Selection). The icon replaces the
   word so the button stays small; the dropdown keeps the full labels. */
.tool-combo-btn {
    min-width: 0;
    padding-left: 9px;
    padding-right: 9px;
}
.tool-combo-icon {
    font-size: 15px;
}

/* Stacked overlay checkboxes (Annotations / Bat book) in the View Bar. */
.overlay-toggles {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 0 6px;
}
.overlay-check {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    line-height: 1.1;
    color: #c8c8c8;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.overlay-check input {
    accent-color: #4a8;
    width: 13px;
    height: 13px;
    margin: 0;
    cursor: pointer;
}
.overlay-check.disabled {
    color: #666;
    cursor: default;
}
.overlay-check.disabled input {
    cursor: default;
}

/* ── Switch button (see switch_button.rs) ──────────────────────────────
   The bar control for something that is on or off and has settings: XForm,
   PASS, Gain, Noise. Top row: name + switch, pressing it only turns the
   control on or off. Bottom row: the setting in use + caret, pressing it
   only opens the settings menu.
   The width is fixed per control (inline style) and the bottom row keeps
   its text while the control is off, so toggling moves nothing.
   No overflow:hidden on the root: the PASS-locked overline patch is drawn
   2px above it (.band-affected-row.pass-locked). */
.switch-btn {
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    box-sizing: border-box;
    background: rgba(20, 20, 20, 0.85);
    border: 1px solid rgba(80, 80, 80, 0.45);
    border-radius: 6px;
    user-select: none;
}
.switch-btn.open {
    z-index: 60;
    border-color: #4a8;
}
/* !important: the inline style sets pointer-events for the label-area rule. */
.switch-btn.disabled {
    opacity: 0.35;
    pointer-events: none !important;
}
.switch-btn-top,
.switch-btn-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    /* 24px rows: each row is its own press target (WCAG 2.2 target size). */
    min-height: 24px;
    margin: 0;
    padding: 2px 7px;
    border: none;
    background: none;
    font-family: inherit;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
}
.switch-btn-top {
    border-radius: 5px 5px 0 0;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #bbb;
}
.switch-btn-top:hover {
    background: rgba(255, 255, 255, 0.05);
}
/* On: the same fill and text colour as a selected mode or view button. */
.switch-btn.on .switch-btn-top {
    background: rgba(26, 60, 40, 0.92);
    color: #8fc;
}
.switch-btn.on .switch-btn-top:hover {
    background: rgba(32, 72, 50, 0.95);
}
.switch-btn-top.locked {
    cursor: default;
}
.switch-btn-top.locked .switch-mark {
    opacity: 0.45;
}
.switch-btn-value {
    border-top: 1px solid rgba(80, 80, 80, 0.45);
    border-radius: 0 0 5px 5px;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    /* Off: dimmed but still readable, #888 on the button is 5.6:1. */
    color: #888;
}
.switch-btn.on .switch-btn-value {
    color: #ddd;
}
.switch-btn-value:hover,
.switch-btn.open .switch-btn-value {
    background: rgba(255, 255, 255, 0.07);
    color: #eee;
}
/* HFR off: the band on its bottom row is the band HFR would use, not one
   in effect, so it is dimmer than other switched-off values (owner,
   2026-11-20: "very dimmed"). 3.3:1, under 4.5:1 on purpose. */
.hfr-switch:not(.on) .switch-btn-value:not(:hover) .switch-btn-value-text {
    color: #666;
}
.switch-btn-value-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-align: left;
}
.switch-btn-caret {
    flex: none;
    font-size: 10px;
    color: #999;
}
/* The switch itself, shared by the bar control and menu section rows. */
.switch-mark {
    flex: none;
    position: relative;
    width: 22px;
    height: 12px;
    border-radius: 6px;
    background: #484848;
    transition: background 0.12s;
}
.switch-mark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #b0b0b0;
    transition: left 0.12s, background 0.12s;
}
.switch-btn.on .switch-btn-top .switch-mark,
.switch-row.on .switch-mark {
    background: #3a8;
}
.switch-btn.on .switch-btn-top .switch-mark::after,
.switch-row.on .switch-mark::after {
    left: 12px;
    background: #eafff5;
}
/* A section heading inside a settings menu, with the section's switch. */
.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 5px 8px;
    background: none;
    border: none;
    border-radius: 4px;
    color: #ccc;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
/* A group heading in the Noise menu ("Denoised copy"), the same size and
   weight as the switch rows ("Notch filter") above it. */
.noise-group-title {
    padding: 5px 8px;
    color: #ccc;
    font-size: 12px;
    font-weight: 600;
}
.switch-row:hover {
    background: #202020;
}
.switch-row.on {
    color: #6da;
}
@media (pointer: coarse), (max-width: 640px) {
    .switch-row {
        min-height: 40px;
    }
}

/* ── Combo button (split toggle + dropdown) ──────────────────────────── */

.combo-btn-row {
    position: relative;
    display: flex;
}

.combo-btn-row.open {
    z-index: 60;
}

.combo-btn-left {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    min-height: 38px;
}

.combo-btn-right {
    position: relative;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 4px 18px 5px 7px;
    min-width: 0;
    min-height: 38px;
}

.combo-btn-right.dim .layer-btn-value {
    opacity: 0.55;
}

.combo-btn-right .combo-btn-text {
    justify-items: end;
}

.combo-btn-arrow {
    position: absolute;
    right: 1px;
    bottom: -1px;
    font-size: 10px;
    opacity: 0.55;
    line-height: 1;
}

.layer-btn:hover {
    background: rgba(45, 45, 45, 0.95);
    border-color: rgba(130, 130, 130, 0.6);
    color: #eee;
}

.layer-btn.active, .layer-btn.open {
    background: rgba(26, 60, 40, 0.92);
    border-color: rgba(80, 180, 130, 0.6);
    color: #8fc;
}

.layer-btn.mic-armed {
    background: rgba(40, 40, 20, 0.92);
    border-color: rgba(200, 180, 60, 0.6);
    color: #fc8;
}

.layer-btn.mic-recording {
    background: rgba(60, 20, 20, 0.92);
    border-color: rgba(220, 60, 60, 0.6);
    color: #f66;
    animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { border-color: rgba(220, 60, 60, 0.6); }
    50% { border-color: rgba(220, 60, 60, 1.0); }
}

/* Record button circle — CSS-rendered dot replaces Unicode ● for cross-platform consistency */
.rec-btn:not(.mic-recording) .layer-btn-value {
    font-size: 0; /* hide the Unicode ● character */
    position: relative;
}
.rec-btn:not(.mic-recording) .layer-btn-value::before {
    content: '';
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #e44;
}
.rec-btn.mic-recording .layer-btn-value {
    color: #f66;
}

/* Show "?" text next to the CSS red dot when mic selection is needed */
.rec-btn.mic-ask:not(.mic-recording) .layer-btn-value {
    font-size: 12px;
    color: #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.layer-btn.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Mobile: slightly larger record dot */
.bottom-toolbar.mobile .rec-btn:not(.mic-recording) .layer-btn-value::before {
    width: 20px;
    height: 20px;
}

/* ── Capture group: Mic | Record | Listen | + New ───────────────────────
   Frames the four capture-related buttons together so Mic on the left
   and "+ New" on the right read as bookends — the prerequisite steps
   that gate Record / Listen in the middle. */
.capture-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 3px 4px;
    border: 1px dashed rgba(120, 120, 120, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.015);
}

/* When any capture-group descendant is active (recording / listening / armed),
   the dashed frame brightens to confirm "yes, capture is hot". */
.capture-group:has(.mic-recording),
.capture-group:has(.mic-armed),
.capture-group:has(.mic-select-btn.active) {
    border-color: rgba(200, 180, 60, 0.45);
    background: rgba(40, 40, 20, 0.18);
}
.capture-group:has(.mic-recording) {
    border-color: rgba(220, 60, 60, 0.45);
    background: rgba(60, 20, 20, 0.18);
}

/* Mic select button — left bookend of the capture group.
   Pill-shaped, single horizontal row: [icon] [led] [name]. Fixed width
   prevents the chip from shifting size when the device name or label
   changes; the inner value text auto-shrinks via .fit-text. */
.mic-select-btn {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    min-height: 0;
    height: 30px;
    padding: 0 12px;
    border-radius: 15px;
    flex-shrink: 0;
    width: 158px;
    box-sizing: border-box;
}
.mic-select-btn .layer-btn-value {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    text-align: left;
    white-space: nowrap;
    line-height: 1;
}

/* "Chosen" — a mic is selected and we're idle. Reads as a low-key info
   capsule rather than a primary action: muted border, no hover lift,
   lighter weight on the name. */
.mic-select-btn.mic-chosen {
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(110, 110, 110, 0.3);
    color: #aaa;
}
.mic-select-btn.mic-chosen:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(140, 140, 140, 0.42);
    color: #c8c8c8;
}
.mic-select-btn.mic-chosen .layer-btn-value {
    font-weight: 500;
    color: #c0c0c0;
}
.mic-select-btn.mic-chosen .mic-icon {
    opacity: 0.55;
}

/* "Empty" state — no mic chosen yet: amber/dim border to nudge the user. */
.mic-select-btn.mic-empty {
    border-color: rgba(200, 160, 60, 0.5);
    color: #d9b86b;
}
.mic-select-btn.mic-empty .layer-btn-value {
    color: #e9c878;
    font-style: italic;
    font-weight: 500;
}
/* "Off" state — mic strategy is explicitly None. Dimmer than empty. */
.mic-select-btn.mic-off {
    opacity: 0.55;
}
/* Tiny chevron inside the mic name signals "click to open chooser". */
.mic-select-btn .mic-chevron {
    font-size: 9px;
    opacity: 0.5;
    margin-left: 3px;
}

/* Right half of the Mic combo: narrow caret-only button hosting the
   options popup. Visually lighter than the left identity chip.
   Matches the pill-shaped mic chip: flat where it joins the chip,
   rounded on the outer (right) edge. */
.mic-options-btn {
    min-width: 20px;
    padding: 0 10px 0 6px;
    height: 30px;
    min-height: 0;
    border-radius: 0 15px 15px 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mic-options-btn .combo-btn-arrow {
    position: static;
    font-size: 9px;
    opacity: 0.6;
}
.mic-options-btn.open .combo-btn-arrow {
    opacity: 1;
    color: #6da;
}

/* Joint highlight when listening / recording — match left half's tint. */
.mic-options-btn.active {
    border-color: rgba(200, 180, 60, 0.45);
}

/* Mic icon — inline SVG silhouette. Small and dim so the chip stays
   less prominent than Record / Listen. Uses currentColor so it inherits
   the chip text colour (mic-chosen / mic-empty / mic-off variants
   recolour the whole chip). */
.mic-select-btn .mic-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    opacity: 0.7;
    display: block;
}

/* LED dot — small status pip rendered next to the mic icon. Color tells
   the user whether the mic is ready, listening, or recording, without
   any text label changing. */
.mic-led {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #555;
    margin-right: 4px;
    vertical-align: middle;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3) inset;
    flex-shrink: 0;
}
/* Inside the mic chip the LED sits in a flex row with gap, so cancel
   the legacy margin-right and let `gap` handle spacing. */
.mic-select-btn .mic-led {
    margin-right: 0;
}
.mic-led.ready {
    background: #2ec46b;
    box-shadow: 0 0 4px rgba(46, 196, 107, 0.55);
}
.mic-led.listening {
    background: #38d6ff;
    box-shadow: 0 0 4px rgba(56, 214, 255, 0.6);
    animation: mic-led-pulse 1.4s ease-in-out infinite;
}
.mic-led.rec {
    background: #e44;
    box-shadow: 0 0 4px rgba(228, 68, 68, 0.7);
    animation: mic-led-pulse 0.9s ease-in-out infinite;
}
.mic-led.off,
.mic-led.idle {
    background: #555;
    opacity: 0.55;
}
@keyframes mic-led-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* "Mic detected" chip in the file panel — appears when a USB mic is
   plugged in but not yet selected. Subtle, dismissable, clickable. */
.mic-detected-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    margin: 6px 8px 4px;
    background: rgba(46, 196, 107, 0.08);
    border: 1px solid rgba(46, 196, 107, 0.35);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #cfe;
    user-select: none;
    transition: background 0.12s ease;
}
.mic-detected-chip:hover {
    background: rgba(46, 196, 107, 0.14);
}
.mic-detected-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.mic-detected-hint {
    opacity: 0.7;
    font-size: 11px;
}
.mic-detected-close {
    background: transparent;
    border: none;
    color: #cfe;
    opacity: 0.6;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
.mic-detected-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

/* On mobile the capture-group flattens into the 3-col grid so its children
   land in their own cells, otherwise the whole group would occupy a single
   1fr slot and bunch the buttons together. */
.bottom-toolbar.mobile .capture-group {
    display: contents;
}

/* Portrait packs 5 buttons into 3 columns, which auto-flows as
   [Play][Channel][Mic] / [Record][Listen] — stranding the Mic chip up on
   the Play/Channel row, away from the Record/Listen actions it gates.
   Force the Mic chip (first capture-group child) onto a fresh grid row so
   the three capture buttons share the bottom row: [Play][Channel][·] /
   [Mic][Record][Listen]. Record + Listen auto-flow into the cells beside
   it. Landscape/desktop use the wrapping flex layout (no .mobile), so this
   only affects the narrow portrait grid. */
.bottom-toolbar.mobile .mic-combo-row {
    grid-column-start: 1;
}

/* Mobile mic chip — stay pill-shaped, single row. Match touch target
   height of other mobile buttons (48px) but keep the rounded radius. */
.bottom-toolbar.mobile .mic-select-btn {
    height: 40px;
    min-height: 0;
    border-radius: 20px;
    padding: 0 12px;
    width: auto;
    flex-direction: row;
    align-items: center;
}
/* The chip is about 77 px wide at 375 px, which left 23 px for the
   microphone's name on one line ("Bro..."). The name gets two lines and
   less padding; fit-text (index.html) still shrinks it when one word is
   wider than the chip. */
.bottom-toolbar.mobile .mic-select-btn {
    padding: 0 8px;
    gap: 4px;
}
.bottom-toolbar.mobile .mic-select-btn .layer-btn-value {
    font-size: 12px;
    line-height: 1.15;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    /* No "..." in the middle of the first line: fit-text shrinks a word
       that is too wide, and the line clamp marks a cut after line two. */
    text-overflow: clip;
}
.bottom-toolbar.mobile .mic-options-btn {
    height: 40px;
    min-height: 0;
    border-radius: 0 20px 20px 0;
    padding: 0 10px 0 6px;
}

/* ── Mobile bottom toolbar ─────────────────────────────────────────────── */

.bottom-toolbar.mobile {
    display: grid;
    /* minmax(0, 1fr) prevents grid tracks from expanding to fit min-content of
       nowrap button text (e.g. "🎤 Listen" + "HET"). Without this, cells exceed
       their fractional share, making the toolbar wider than the viewport —
       which cascades up the layout and clips right-edge content on iOS. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
}

.bottom-toolbar.mobile .layer-btn {
    padding: 6px 8px 7px;
    min-height: 48px;
    font-size: 13px;
    justify-content: center;
    overflow: hidden;
}

/* Combo buttons fill their grid cell */
.bottom-toolbar.mobile .combo-btn-row {
    min-width: 0;
}

.bottom-toolbar.mobile .combo-btn-left {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.bottom-toolbar.mobile .combo-btn-text {
    grid-template-rows: 10px 17px;
    min-height: 27px;
}

.bottom-toolbar.mobile .layer-btn-category {
    font-size: 9px;
}

.bottom-toolbar.mobile .layer-btn-value {
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: nowrap;
}

.bottom-toolbar.mobile .combo-btn-right {
    /* 16px on the right clears the corner arrow (12px, 2px in). At 20px,
       "Listen" had 2px too few at 375 px wide and was cut to "List...". */
    padding: 6px 16px 7px 8px;
    min-height: 48px;
    /* The right half holds the label that changes (ALL, HERE, Mem); it
       keeps its width and the left half gives way. */
    flex: 0 0 auto;
}

/* Each grid cell has a fixed width here, so the lock-grow width lock
   (index.html) has nothing to hold still. Its inline min-widths, taken from
   the widest label each half has shown, added up to more than a cell: after
   "HERE" the Play button reached over "CH Mono". */
.bottom-toolbar.mobile .lock-grow {
    min-width: 0 !important;
}

.bottom-toolbar.mobile .combo-btn-arrow {
    right: 2px;
    bottom: 0px;
    font-size: 12px;
}

/* Hide separators on mobile — grid handles row layout */
.bottom-toolbar.mobile .bottom-toolbar-sep {
    display: none;
}

/* Drag handle spans full grid width */
.bottom-toolbar.mobile .bottom-toolbar-drag-handle {
    grid-column: 1 / -1;
    height: 14px;
}

.bottom-toolbar.mobile .bottom-toolbar-drag-grip {
    width: 50px;
    height: 4px;
}

/* Bar labels (HEARING / VIEW) are hidden on narrow viewports to reclaim
   horizontal space — the bars themselves carry the conceptual grouping. */
@media (max-width: 640px) {
    .bar-label {
        display: none;
    }
    /* Tighten bar padding too — every pixel counts on phone screens. */
    .hearing-bar,
    .view-bar {
        padding-left: 4px;
        padding-right: 4px;
    }

    /* ── Mobile: horizontal-scroll the dense button rows ──────────────
       On phones the hearing bar (HFR · Range · modes · PASS · Gain · NR
       · Notch) and the view radio row are wider than the viewport. Rather
       than wrap (which eats vertical space the spectrogram needs) or clip
       (PASS scrolling off-screen), let each row scroll sideways. */
    .hearing-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox — hide the bar, swipe to scroll */
    }
    .hearing-bar::-webkit-scrollbar { height: 0; width: 0; }
    /* Gain/NR/Notch group rides the same horizontal scroll. */
    .hearing-bar .bar-controls {
        flex-wrap: nowrap;
    }
    /* The band-affected group no longer needs its trailing margin to
       separate from Gain on a wrapped row — the sep handles it inline. */
    .band-affected-row {
        margin-right: 6px;
    }

    .view-bar .bar-controls {
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .view-bar .bar-controls::-webkit-scrollbar { height: 0; width: 0; }
    /* The flex spacer that right-aligns the Tool combo on desktop would
       expand oddly inside a scroll container — neutralise it on mobile. */
    .view-bar .bar-spacer {
        flex: 0 0 6px;
        min-width: 6px;
    }

    /* Bigger touch targets for the radio buttons on phones. */
    .mode-radio-btn {
        min-height: 38px;
        min-width: 44px;
    }

    /* Horizontal drag anywhere in these rows — including starting on a
       button — pans the scroller. Without `touch-action: pan-x` the
       browser treats a drag that begins on a button (or inside the
       mode-radio-group, whose `overflow: hidden` makes it a scroll
       boundary) as a tap-in-progress and the row feels "sticky" /
       refuses to scroll. pan-x keeps taps working (a stationary touch
       still fires click) while routing horizontal drags to the parent
       scroll container. Popups are portalled to <body>, so their
       sliders are unaffected by this. */
    .hearing-bar,
    .view-bar .bar-controls,
    .band-affected-row,
    .band-affected-controls,
    .mode-radio-group,
    .hearing-bar .layer-btn,
    .hearing-bar .mode-radio-btn,
    .view-bar .bar-controls .layer-btn,
    .view-bar .mode-radio-btn,
    .switch-btn,
    .switch-btn button {
        touch-action: pan-x;
    }
}

/* ── Touch-friendly mode menus ─────────────────────────────────────────────
 * On touch devices (coarse pointer) and narrow viewports, the layer-panel
 * popups (Mode, Listen, Gain, etc.) need larger tap targets. Defaults are
 * tuned for mouse precision — too small for fingers in the field.
 *
 * Apple HIG recommends 44pt minimum; Material 48dp. We aim ~40px height on
 * options, ~32px on small inline preset/auto-toggle controls, since the
 * popups themselves have limited vertical space on phones.
 */
@media (pointer: coarse), (max-width: 640px) {
    /* Wider gap between rows so fingers don't fat-finger neighbors. */
    .layer-panel {
        padding: 10px 6px;
    }
    .layer-panel hr {
        margin: 8px 0;
    }
    .layer-panel-opt {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 40px;
        box-sizing: border-box;
    }
    .layer-panel-title {
        font-size: 12px;
        padding: 4px 10px;
    }
    .layer-panel-slider-row {
        padding: 6px 10px 6px 12px;
        gap: 8px;
        min-height: 40px;
    }
    .layer-panel-slider-row label {
        font-size: 13px;
        min-width: 70px;
    }
    .layer-panel-slider-row span {
        font-size: 13px;
        min-width: 52px;
    }
    .layer-panel-slider-row input[type="range"] {
        height: 28px; /* taller hit zone for the thumb */
    }
    /* Carriers row, factor preset row, etc. — small inline buttons. */
    .factor-preset {
        font-size: 13px;
        padding: 8px 6px;
        min-height: 32px;
        min-width: 32px;
    }
    .factor-presets {
        gap: 4px;
        padding: 4px 10px 6px 12px;
    }
    .auto-toggle {
        width: 32px;
        height: 32px;
        font-size: 13px;
        margin-left: 6px;
    }
    .factor-input {
        font-size: 13px;
        padding: 6px 6px;
        min-height: 32px;
        width: 44px;
        min-width: 44px;
    }
}

/* Popups positioned above multi-row toolbar on mobile */
/* Panel uses JS-computed bottom via toolbar height; fallback to safe estimate */
.bottom-toolbar.mobile .layer-panel {
    position: fixed !important;
    bottom: calc(120px + env(safe-area-inset-bottom, 0px)) !important;
    left: 8px !important;
    right: auto !important;
    z-index: 1000 !important;
}

/* Toolbar listen/record controls */
.toolbar-listen-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-listen-btn {
    background: transparent;
    color: #bbb;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.toolbar-listen-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #eee;
}

.toolbar-listen-btn.active {
    background: rgba(200, 180, 60, 0.15);
    color: #fc8;
}

.toolbar-het-slider {
    width: 80px;
    accent-color: #fc8;
}

.toolbar-record-btn {
    background: transparent;
    color: #bbb;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 13px;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.toolbar-record-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #eee;
}

.toolbar-record-btn.active {
    background: rgba(220, 60, 60, 0.15);
    color: #f66;
    animation: rec-pulse 1s ease-in-out infinite;
}

@keyframes rec-pulse {
    0%, 100% { background: rgba(220, 60, 60, 0.1); }
    50% { background: rgba(220, 60, 60, 0.22); }
}

/* File badges: the heading's badge row (.toolbar-badge-row) and each file
   list row (.file-item-info, and the [.batm] toggle in .file-item-name).
   Badge style option A, chosen by the user on 2026-11-14: anything that can
   be pressed is a solid box (.badge-btn), and every fact is plain text
   (.badge-fact). Before, a fill did not show whether a badge could be
   pressed: the filled heterodyne badge was a button, but the filled sequence,
   track and streaming badges in rows were not. */
.file-badge {
    flex-shrink: 0;
}
.badge-fact {
    white-space: nowrap;
}

/* A middle dot between sample rate, bit depth and duration
   ("192kHz · 24 bit · 0.9s"). The dot ends the fact before it, so when a row
   wraps between two facts, the dot stays at the end of the upper line and no
   line starts with one. Every sample rate and bit depth has a fact after it,
   since the duration is always shown. There is no dot before the sequence
   and track labels ("#59 [3]"), which have their own marks: a dot there made
   a 192 kHz row wrap at the default sidebar width. The second content line
   gives the dot empty alternative text, so screen readers skip it; a browser
   without that syntax uses the first line. 6px matches the heading's gap
   between badges, so the dot is centred; file rows use less (.file-item-info). */
.badge-sample-rate::after,
.badge-bit-depth::after {
    content: "\00B7";
    content: "\00B7" / "";
    margin-left: 6px;
    opacity: 0.6;
}
.file-item-info :is(.badge-sample-rate, .badge-bit-depth)::after {
    margin-left: 3px;
}

/* "* File unsaved" in the heading: amber text, no box. */
.badge-fact.unsaved {
    color: #fc8;
}

/* A control is a box: solid fill, no border. The :is() list gives these
   rules more weight than `.toolbar button`, which would otherwise draw the
   heading's controls as full-size 13px toolbar buttons. */
:is(.toolbar-badge-row, .file-item-info, .file-item-name) .badge-btn {
    font: inherit;
    line-height: inherit;
    padding: 0 5px;
    border: none;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.13);
    color: #e6e6e6;
    cursor: pointer;
    white-space: nowrap;
}
/* A file row's controls: the row's 11px text and 3px side padding (see
   .file-item-info). The [.batm] toggle sits in the name line, whose text is
   13px; at 13px the toggle cut off more of the file name than the old 10px
   label did. */
:is(.file-item-info, .file-item-name) .badge-btn {
    padding: 0 3px;
}
.file-item-name .badge-btn {
    font-size: 11px;
}
:is(.toolbar-badge-row, .file-item-info, .file-item-name) .badge-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}
/* Amber means only "this file needs attention", in the warning amber of
   .analysis-warning: the "Heterodyne recording" badge (heterodyne.rs; the
   file is a heterodyne bat detector's output, so its frequencies are not the
   bat's, and the badge opens the Info panel at the note), and Download or
   Save for an unsaved recording. The same colours on the selected row, since
   it is a warning about the file and not a selection state. */
:is(.toolbar-badge-row, .file-item-info) .badge-btn:is(.badge-warn, .unsaved) {
    background: #3a2700;
    color: #fc8;
}
:is(.toolbar-badge-row, .file-item-info) .badge-btn:is(.badge-warn, .unsaved):hover {
    background: #4d3400;
}
/* The row download sits at the right end of the row. */
.badge-download-btn {
    margin-left: auto;
    flex-shrink: 0;
}
/* Space between the [.batm] toggle and the file name after it. */
.file-badge-batm {
    margin-right: 4px;
}
/* Keyboard focus. The same blue as the tutorial's ring round its target
   (.driver-active-element). */
.badge-btn:focus-visible {
    outline: 2px solid #7f9cf5;
    outline-offset: 1px;
}
/* .file-item-name clips its overflow for the name's ellipsis, which would
   cut off the [.batm] toggle's focus ring and touch strip. Padding moves the
   clip edge 5px further out, and the negative margin keeps the row height. */
.file-item-name:has(> .badge-btn) {
    padding-block: 5px;
    margin-block: -5px;
}
/* On a touch screen every control gets an invisible strip above and below,
   so it is 24px tall to a finger without changing how it looks. */
@media (pointer: coarse) {
    .badge-btn {
        position: relative;
    }
    .badge-btn::before {
        content: "";
        position: absolute;
        inset: -5px -3px;
    }
}

/* The notes under the Info panel's Sample rate row (src/rate_notes.rs, drawn by
   file_sidebar/rate_notes_view.rs): the time-expansion note, then the
   heterodyne note or the species call-range note. Each note is a
   .metadata-note, with one div per line, and each line's class is its role.
   A line can contain text from the recording's metadata (a quoted remark, a
   detector or species name), which can be one long word such as a URL, so a
   line may break anywhere to stay in the panel. */
.rate-note {
    overflow-wrap: anywhere;
}
/* Each line is one statement and most wrap in the panel, so a small gap shows
   where one ends and the next begins. */
.rate-note > div + div {
    margin-top: 2px;
}
/* A finding or its consequence: the .analysis-warning amber. A species note
   has one only for a probable x10 time expansion: all 10 Xeno-canto records
   at a x10 header rate were time-expanded (2 of them the app corrects from
   their GUANO, so they show no note). */
.rate-note-warning {
    color: #fc8;
}
/* How to read the file's frequencies when the detector's tuning is known. It
   is a reading rule, not a second warning, so it takes the app's normal text
   colour (body #ccc) instead of amber or the muted grey. */
.rate-note-plain {
    color: #ccc;
}
/* .rate-note-muted (supporting detail and possibilities) and .rate-note-quote
   (the line that quotes the recording's metadata) have no rule of their own:
   they inherit the .metadata-note grey, so a change to that colour reaches
   them too. */

/* A note's button ("Correct for x10 time expansion", "Remove x10
   correction"), after the note's lines, so the claim and its evidence come
   first. It has the look of .hash-calc-btn
   ("Calculate all hashes"): grey and outlined, not filled, because changing
   a file's rate is a rare action. That class is about 19 px tall, so this
   one sets the 24 px minimum click target, and 36 px in the phone layout,
   where it is pressed with a finger. */
.rate-note-action {
    display: block;
    min-height: 24px;
    margin: 4px 0 3px;
    text-align: left;
}
.app.mobile .rate-note-action {
    min-height: 36px;
    padding: 4px 12px;
}

/* Sequence gap indicators */
.seq-gap-row {
    font-size: 10px;
    color: #666;
    text-align: center;
    padding: 1px 8px;
    border-left: 2px solid #2a4a2a;
    margin-left: 8px;
}
.seq-gap-row.continuous {
    color: #4a8;
    border-left-color: #4a8;
}
.seq-gap-row.large-gap {
    color: #a86;
    border-left-color: #6a4a2a;
}
.seq-gap-row.unknown {
    color: #555;
    border-left-color: #333;
}

/* Unsaved asterisk indicator */
.file-unsaved-asterisk {
    color: #f80;
    font-weight: bold;
    margin-right: 2px;
    flex-shrink: 0;
}

/* CC mini badge (file menu, non-clickable) */
.badge-cc-mini {
    display: inline-flex;
    align-items: center;
    color: #999;
    margin-left: 2px;
    flex-shrink: 0;
}
.badge-cc-icon {
    width: 12px;
    height: 12px;
}

/* Sequence/track dropdown panels. On a phone, an open Files or Info sidebar
   (.sidebar.mobile-overlay, z-index 200) lies under the heading, and at
   z-index 50 it covered the menu. 201 draws the menu above the sidebars and
   below modal dialogs (1000). */
.badge-dropdown-panel {
    position: absolute;
    z-index: 201;
    background: rgba(16, 16, 16, 0.97);
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 6px 0;
    min-width: 180px;
    max-width: 320px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
}
.badge-dropdown-item {
    padding: 4px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #ccc;
    display: flex;
    gap: 6px;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.badge-dropdown-item:hover {
    background: #2a2a2a;
}
.badge-dropdown-item.active {
    color: #fff;
    background: #1a3a5a;
}
/* The sequence and track labels ("#58", "[1-2]") in these menus. */
.badge-dropdown-item .badge-fact {
    color: #999;
}
.badge-dropdown-item.active .badge-fact {
    color: #cde;
}

.unsaved-banner {
    position: absolute;
    top: 4px;
    right: 60px;
    background: rgba(180, 130, 0, 0.85);
    color: #fff;
    font-size: 11px;
    padding: 2px 10px;
    border-radius: 3px;
    z-index: 20;
    pointer-events: auto;
    cursor: pointer;
}

.unsaved-banner:hover {
    background: rgba(200, 150, 0, 0.95);
}

/* Debug-build banner — only rendered when cfg!(debug_assertions) is true at
   compile time. Pinned to bottom-center of the viewport so it overlays whatever
   view is active without stealing toolbar space. Striking yellow/black stripes
   to make sure the user can't mistake a debug build for a release build. */
.debug-build-banner {
    position: fixed;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    color: #1a1a00;
    background: repeating-linear-gradient(
        45deg,
        #ffd23a,
        #ffd23a 10px,
        #1a1a1a 10px,
        #1a1a1a 20px
    );
    background-clip: padding-box;
    border: 2px solid #1a1a1a;
    text-shadow: 0 0 3px #ffd23a, 0 0 3px #ffd23a, 0 0 3px #ffd23a;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.debug-build-banner code {
    background: rgba(0, 0, 0, 0.7);
    color: #ffd23a;
    text-shadow: none;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 10px;
    margin-left: 4px;
}

.app-toast-container {
    position: absolute;
    top: 44px;
    left: 50%;
    transform: translateX(-50%);
    /* max-content: an absolute box at left 50% otherwise shrinks to half the
       window, so a wrapping notice would be squeezed and sit off-centre. */
    width: max-content;
    max-width: 92vw;
    z-index: 200;
    pointer-events: none;
}
.app-toast-container .status-toast {
    pointer-events: auto;
}

.status-toast {
    padding: 4px 10px;
    background: rgba(180, 60, 40, 0.9);
    border: 1px solid rgba(220, 80, 60, 0.6);
    border-radius: 4px;
    color: #fcc;
    font-size: 12px;
    white-space: nowrap;
}
.status-toast.status-toast-info {
    background: rgba(180, 150, 40, 0.9);
    border: 1px solid rgba(220, 190, 60, 0.6);
    color: #ffe;
}

/* Shown while recording or listening on Android with Oversample's
   notifications off. Amber like the info toast (amber marks warnings), but it
   stays until capture stops or the user acts, so it wraps and has controls. */
.capture-notice {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 440px;
    margin-top: 4px;
    padding: 4px 4px 4px 10px;
    background: rgba(132, 105, 20, 0.97);
    border: 1px solid rgba(220, 190, 60, 0.6);
    border-radius: 4px;
    color: #fff;
    font-size: 12px;
    line-height: 1.35;
}
.capture-notice-text {
    flex: 1;
}
.capture-notice-btn {
    flex: none;
    min-height: 28px;
    padding: 4px 8px;
    border: 0;
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.capture-notice-close {
    flex: none;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

/* ── Layer panels (shared popover style) ────────────────────────────────── */

.layer-panel {
    pointer-events: auto;
    position: absolute;
    z-index: 50;
    background: rgba(16, 16, 16, 0.97);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 8px 6px;
    backdrop-filter: blur(10px);
    min-width: 170px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
    max-height: 70vh;
    overflow-y: auto;
}

.layer-panel-divider {
    height: 1px;
    background: #333;
    margin: 4px 0;
}

/* Floating annotation label editor (appears on double-click) */
.annotation-inline-label-editor {
    z-index: 30;
    pointer-events: auto;
    min-width: 80px;
    max-width: 260px;
    padding: 1px 4px;
    background: rgba(15, 20, 15, 0.92);
    border: 1px solid rgba(100, 230, 160, 0.8);
    border-radius: 2px;
    color: #e0ffe8;
    font: 11px monospace;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
.annotation-inline-label-editor:focus {
    border-color: rgba(255, 220, 120, 1.0);
    background: rgba(20, 18, 10, 0.95);
}

.layer-panel-title {
    font-size: 10px;
    font-weight: 600;
    /* #808080 on the panel's #101010 is 4.8:1, above the 4.5:1 minimum; the
       caps, size and spacing keep headings quieter than the values. */
    color: #808080;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 2px 8px 5px;
}

/* Tabs at the top of the View menu: the spectrogram kinds (Spectrogram,
   Flow, Chromagram, Resonators). The selected tab is underlined in the
   selection colour, as tabs are elsewhere, and the row's bottom rule joins
   it to the settings under it. */
.view-kind-tabs {
    display: flex;
    gap: 2px;
    margin: 0 4px 6px;
    border-bottom: 1px solid #2c2c2c;
}
.view-kind-tab {
    flex: 1 1 auto;
    padding: 6px 8px 5px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    color: #999;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}
.view-kind-tab:hover {
    color: #ddd;
}
.view-kind-tab.sel {
    color: #6da;
    border-bottom-color: #6da;
}

.layer-panel hr {
    border: none;
    border-top: 1px solid #2a2a2a;
    margin: 5px 2px;
}

.layer-panel-opt {
    display: block;
    width: 100%;
    text-align: left;
    padding: 5px 10px;
    background: none;
    border: none;
    border-radius: 4px;
    color: #999;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.layer-panel-opt:hover {
    background: #202020;
    color: #ddd;
}

.layer-panel-opt.sel {
    color: #6da;
    font-weight: 600;
}

.layer-panel-opt.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Two-line band-preset entries: species/range on top, the metadata source
   ("Xeno-Canto: species", "GUANO: …", "Bat book: current page") indented and
   dimmed beneath. The sub-line stays dim/regular weight even when the entry is
   selected (.sel). */
.layer-panel-opt .preset-main {
    display: block;
}
.layer-panel-opt .preset-sub {
    display: block;
    font-size: 10px;
    font-weight: 400;
    /* #808080 on the panel's #101010 is 4.8:1, above the 4.5:1 minimum. */
    color: #808080;
    margin-top: 1px;
    padding-left: 10px;
}
.layer-panel-opt.sel .preset-sub {
    color: #8a8a8a;
}

.layer-panel-slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 10px;
}

.layer-panel-slider-row label {
    font-size: 11px;
    /* 4.8:1 on the panel's #101010 (#777 was 4.2:1). */
    color: #808080;
    min-width: 70px;
}

.layer-panel-slider-row input[type="range"] {
    flex: 1;
    min-width: 0;
}

.layer-panel-slider-row span {
    font-size: 11px;
    color: #888;
    min-width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Noise menu (src/components/noise_button.rs). Each filter's settings sit
   under its switch, indented, so it is clear which switch they belong to.
   .noise-row is a row with a value and buttons; its label is the same width
   as a slider row's label, so the two kinds of row line up. */
.noise-settings {
    padding: 0 0 6px 8px;
}
.noise-note {
    padding: 0 8px 4px 10px;
    font-size: 11px;
    /* 5.6:1 on the panel's #101010. */
    color: #8a8a8a;
}
.noise-row {
    display: flex;
    /* On a screen narrower than the menu's 340px, buttons go to a second
       line and nothing is cut off. */
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 3px 8px 3px 10px;
    font-size: 11px;
}
.noise-row-label {
    color: #808080;
    min-width: 70px;
}
.noise-row-value {
    flex: 1;
    min-width: 0;
    color: #bbb;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
/* A value that is not there yet ("not learned", "none yet"). */
.noise-row-value.none {
    color: #808080;
    font-style: italic;
}
/* Small bordered button inside a row. 24px tall for a mouse, 36px for a
   finger. */
.noise-btn {
    min-height: 24px;
    padding: 2px 8px;
    background: none;
    border: 1px solid #444;
    border-radius: 4px;
    color: #bbb;
    font-family: inherit;
    font-size: 11px;
    white-space: nowrap;
    cursor: pointer;
}
.noise-btn:hover:not(:disabled) {
    background: #202020;
    color: #eee;
}
.noise-btn:disabled {
    color: #666;
    border-color: #333;
    cursor: default;
}
.noise-bands {
    max-height: 220px;
    overflow-y: auto;
}
.noise-band {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px 2px 10px;
    font-size: 11px;
    color: #bbb;
}
.noise-band input {
    margin: 0;
}
.noise-band-freq {
    flex: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.noise-band-level {
    color: #8a8a8a;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.noise-band-remove {
    min-width: 24px;
    min-height: 24px;
    background: none;
    border: none;
    border-radius: 4px;
    color: #8a8a8a;
    font-size: 14px;
    cursor: pointer;
}
.noise-band-remove:hover {
    background: #202020;
    color: #eee;
}
.noise-band-actions {
    justify-content: flex-end;
}
/* The Denoised copy group's Strength choice (Normal or Heavy): the Peak from
   control's look (.peak-src-btn), at the right of its row like the other
   rows' buttons, and 24px tall like .noise-btn. While a copy is made the
   options are disabled but keep the pick's colours, so they show the
   strength in use. */
.denoise-strength {
    display: flex;
    margin-left: auto;
}
.denoise-strength .peak-src-btn {
    min-height: 24px;
    font-family: inherit;
    /* A double-click makes the copy; it must not select the option's text. */
    user-select: none;
}
.denoise-strength .peak-src-btn:disabled {
    opacity: 0.6;
    cursor: default;
}
.denoise-strength .peak-src-btn:disabled:not(.sel) {
    background: #1a1a1a;
    color: #999;
}
/* Two lines of room for the line under Strength (Heavy's has a sentence on
   each line), so the menu keeps its height when the pick changes. */
.denoise-strength-line {
    /* Two lines at line-height 1.3, and the 2px bottom padding, since
       .denoise-note is border-box. */
    min-height: calc(2.6em + 2px);
}
@media (pointer: coarse), (max-width: 640px) {
    .noise-btn,
    .noise-band-remove,
    .denoise-strength .peak-src-btn {
        min-height: 36px;
    }
    .noise-band-remove {
        min-width: 36px;
    }
}

/* Peak source segmented radio buttons */
.peak-source-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 4px 10px;
}
.peak-source-label {
    font-size: 11px;
    color: #777;
    margin-right: 6px;
    white-space: nowrap;
}
.peak-src-btn {
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid #444;
    background: #1a1a1a;
    color: #999;
    cursor: pointer;
    margin-left: -1px;
}
.peak-src-btn:first-of-type {
    border-radius: 3px 0 0 3px;
    margin-left: 0;
}
.peak-src-btn:last-of-type {
    border-radius: 0 3px 3px 0;
}
.peak-src-btn:hover {
    background: #252525;
    color: #ddd;
}
.peak-src-btn.sel {
    background: #234;
    color: #6da;
    border-color: #6da;
    z-index: 1;
    position: relative;
}
/* "measuring…" after the Peak from buttons while the DSP peak runs. */
.peak-source-status {
    margin-left: 6px;
    font-size: 10px;
    color: #999;
    font-style: italic;
}

.peak-src-btn.disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* Boost slider label */
.slider-label {
    font-size: 11px;
    color: #666;
    margin-right: 2px;
}

.het-text-row {
    cursor: pointer;
}
.het-text-row:hover .het-value {
    color: #0cf;
}
.het-value {
    font-size: 11px;
    color: #aaa;
    font-variant-numeric: tabular-nums;
}

/* Per-parameter auto toggle */
.auto-toggle {
    all: unset;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    color: #666;
    background: rgba(255,255,255,0.06);
    cursor: pointer;
    margin-left: 4px;
    flex-shrink: 0;
}
.auto-toggle:hover {
    color: #aaa;
    background: rgba(255,255,255,0.12);
}
.auto-toggle.on {
    color: #0cf;
    background: rgba(0,200,255,0.15);
}

/* Factor text input (editable value next to slider) */
.factor-input {
    all: unset;
    width: 36px;
    min-width: 36px;
    font-size: 11px;
    color: #ccc;
    text-align: right;
    font-variant-numeric: tabular-nums;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    padding: 1px 4px;
    cursor: text;
}
.factor-input:focus {
    outline: 1px solid rgba(0,200,255,0.4);
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Factor preset buttons row */
.factor-presets {
    display: flex;
    gap: 2px;
    padding: 2px 8px 4px 10px;
}
.factor-preset {
    all: unset;
    font-size: 10px;
    color: #888;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(255,255,255,0.06);
    cursor: pointer;
    text-align: center;
    flex: 1;
}
.factor-preset:hover {
    color: #ccc;
    background: rgba(255,255,255,0.12);
}
.factor-preset.sel {
    color: #0cf;
    background: rgba(0,200,255,0.15);
}

/* Frequency summary (Input/Output display) */
.freq-summary {
    padding: 2px 10px 4px;
    font-size: 10px;
    color: #888;
    line-height: 1.4;
}
.freq-summary-output {
    cursor: default;
}
.freq-summary-output:hover {
    color: #6cf;
}

/* Layer panel container: wraps button + panel for positioning */
.layer-anchor {
    position: absolute;
    pointer-events: none;
}

.layer-anchor > * {
    pointer-events: auto;
}

/* ── Play controls (floating) ───────────────────────────────────────────── */

.play-controls {
    position: absolute;
    top: 10px;
    right: 12px;
    display: flex;
    gap: 5px;
    pointer-events: auto;
    z-index: 10;
}

/* ── Bookmark popup ─────────────────────────────────────────────────────── */

.bookmark-popup {
    position: absolute;
    bottom: 50px;
    right: 12px;
    background: rgba(16, 16, 16, 0.97);
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 10px;
    pointer-events: auto;
    z-index: 20;
    min-width: 160px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7);
}

.bookmark-popup-title {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.bookmark-item {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 4px;
    color: #aaa;
    font-size: 12px;
    padding: 4px 6px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

.bookmark-item:hover {
    background: #222;
    color: #eee;
}

.bookmark-popup-close {
    display: block;
    width: 100%;
    text-align: center;
    margin-top: 6px;
    padding: 4px;
    background: none;
    border: 1px solid #333;
    border-radius: 4px;
    color: #666;
    font-size: 11px;
    cursor: pointer;
}

.bookmark-popup-close:hover {
    color: #aaa;
    border-color: #555;
}

/* ── Mobile / Android ──────────────────────────────────────────────── */

.toolbar-overflow-wrap {
    position: relative;
}

button.toolbar-overflow-btn {
    width: 28px;
    height: 28px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    letter-spacing: 2px;
}

.toolbar-overflow-btn:hover {
    color: #bbb;
    background: #252525;
    border-color: #444;
}

/* Toolbar buttons that open the Files and Info sidebars. Each has its name
   beside the icon: the bare 28 px icons were easy to miss, most of all on
   phones and tablets, where they are also taller (36 px) for a finger. */
.toolbar-sidebar-tab {
    flex-shrink: 0;
    height: 28px;
    background: #2e2e2e;
    border: 1px solid #666;
    border-radius: 4px;
    font-size: 16px;
    color: #e8e8e8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
}
.toolbar-sidebar-tab-label {
    font-size: 13px;
    font-weight: 600;
}
.app.mobile .toolbar-sidebar-tab {
    height: 36px;
    padding: 0 10px;
}
.app.mobile .toolbar-sidebar-tab-label {
    font-size: 14px;
}
/* Phones: the name without the icon, so the file name and badges between
   the two buttons keep enough width (a heterodyne badge and a licence
   still share one line at 375 px; e2e/badges.spec.ts checks it). */
@media (max-width: 480px) {
    .app.mobile .toolbar-sidebar-tab {
        padding: 0 7px;
    }
    .app.mobile .toolbar-sidebar-tab svg {
        display: none;
    }
}

.toolbar-sidebar-tab:hover {
    color: #ddd;
    background: #333;
}

.toolbar-sidebar-tab.active {
    background: #1a3a2a;
    border-color: #4a8;
    color: #e8e8e8;
}

.toolbar-right-group {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.toolbar-overflow-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.toolbar-overflow-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 120px;
    padding: 4px 0;
}

.toolbar-overflow-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: none;
    color: #ddd;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}

.toolbar-overflow-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

.toolbar-overflow-item:disabled {
    opacity: 0.3;
    cursor: default;
}

.toolbar-overflow-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.toolbar-overflow-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 4px 0;
}

.sidebar.mobile-overlay {
    position: fixed;
    top: var(--toolbar-h, 44px);
    left: 0;
    width: 280px;
    height: calc(100% - var(--toolbar-h, 44px));
    z-index: 200;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    transition: transform 0.2s ease;
}

.sidebar.mobile-overlay.collapsed {
    transform: translateX(-100%);
    pointer-events: none;
    box-shadow: none;
}

.sidebar.mobile-overlay .sidebar-tabs {
    padding-top: 4px;
}

.sidebar-backdrop {
    display: none;
    grid-row: 2;
    grid-column: 1 / -1;
}

.sidebar-backdrop.open {
    display: block;
    position: fixed;
    top: var(--toolbar-h, 44px);
    left: 0;
    width: 100%;
    height: calc(100% - var(--toolbar-h, 44px));
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
}

/* ── Left sidebar header tab labels ────────────────────────────────── */
.sidebar-header-label {
    flex: 1;
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #777;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.sidebar-header-label:hover {
    color: #bbb;
}

.sidebar-header-label.active {
    color: #eee;
    border-bottom-color: #4a8;
}

/* ── Project panel ────────────────────────────────────────────────── */
.project-panel {
    padding: 12px 10px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.project-panel-empty {
    color: #888;
    font-size: 12px;
    text-align: center;
    padding-top: 24px;
}

.project-panel-hint {
    color: #666;
    font-size: 11px;
    margin-top: 8px;
}

.project-panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    justify-content: center;
}

.project-btn {
    padding: 5px 12px;
    font-size: 11px;
    background: #2a5a3a;
    color: #cec;
    border: 1px solid #3a6a4a;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.project-btn:hover { background: #3a6a4a; }
.project-btn:disabled { opacity: 0.4; cursor: default; }
.project-btn-secondary {
    background: #2a2a3a;
    color: #aac;
    border-color: #3a3a5a;
}
.project-btn-secondary:hover { background: #3a3a5a; }
.project-btn-danger {
    background: #3a2222;
    color: #daa;
    border-color: #5a3333;
}
.project-btn-danger:hover { background: #5a3333; }

.project-view {
    font-size: 12px;
}

.project-name-row {
    margin-bottom: 8px;
}
.project-name-input {
    width: 100%;
    padding: 4px 6px;
    font-size: 12px;
    font-weight: 600;
    background: #1a1a1a;
    color: #eee;
    border: 1px solid #333;
    border-radius: 3px;
    box-sizing: border-box;
}
.project-name-input:focus {
    border-color: #4a8;
    outline: none;
}

.project-meta {
    color: #888;
    font-size: 11px;
    margin-bottom: 6px;
}
.project-meta-sep { margin: 0 4px; }
.project-unsaved { color: #da5; }

.project-tauri-hint {
    font-size: 10px;
    color: #886;
    background: #1a1a10;
    border: 1px solid #332;
    border-radius: 3px;
    padding: 4px 6px;
    margin-bottom: 8px;
}

.project-section-header {
    font-size: 10px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 0 3px;
}
.project-section-hint {
    font-weight: 400;
    text-transform: none;
    color: #555;
    font-size: 9px;
}

.project-file-list {
    border-top: 1px solid #333;
    margin-top: 6px;
}

.project-file-item {
    padding: 4px 0;
    border-bottom: 1px solid #222;
    cursor: pointer;
}
.project-file-item:hover:not(.missing) {
    background: #1a1a2a;
}
.project-file-item.selected {
    background: #1a2a3a;
    border-left: 2px solid #4a8;
    padding-left: 4px;
}
.project-file-item.missing {
    opacity: 0.5;
    cursor: default;
}
.project-file-name {
    color: #ccc;
    font-size: 11px;
    word-break: break-all;
}
.project-file-status {
    color: #555;
    font-size: 9px;
}
.project-file-status.loaded {
    color: #4a8;
}
.project-file-info {
    color: #777;
    font-size: 10px;
    margin-top: 1px;
    padding-left: 14px;
}

.project-timeline-delete {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 13px;
    padding: 0 4px;
    margin-left: 6px;
}
.project-timeline-delete:hover {
    color: #f66;
}

.project-save-status {
    color: #888;
    font-style: italic;
}
.project-save-status.saved {
    color: #4a8;
}
.project-timeline-item {
    padding: 4px 0;
    border-bottom: 1px solid #222;
}
.project-timeline-item.clickable {
    cursor: pointer;
}
.project-timeline-item.clickable:hover {
    background: #282828;
}
.project-timeline-name {
    color: #aad;
    font-size: 11px;
}
.project-timeline-icon {
    color: #68a;
    font-size: 8px;
    margin-right: 4px;
}
.project-tab-dot {
    color: #4a8;
    font-size: 7px;
    margin-left: 3px;
    vertical-align: super;
}
.project-timelines-section {
    border-top: 1px solid #333;
    margin-top: 6px;
}

.project-meta-warn {
    color: #da5;
}

.project-groupings {
    font-size: 11px;
    color: #7a7;
    margin-bottom: 4px;
}

.project-new-files-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: #aad;
    background: #1a1a2a;
    border: 1px solid #2a2a4a;
    border-radius: 3px;
    padding: 4px 6px;
    margin-bottom: 6px;
}
.project-btn-inline {
    font-size: 10px;
    padding: 2px 8px;
    background: #2a3a5a;
    color: #aac;
    border: 1px solid #3a4a6a;
    border-radius: 3px;
    cursor: pointer;
    flex-shrink: 0;
    margin-left: 6px;
}
.project-btn-inline:hover { background: #3a4a6a; }

.project-notes-section {
    margin-top: 8px;
}
.project-notes-input {
    width: 100%;
    min-height: 48px;
    padding: 4px 6px;
    font-size: 11px;
    background: #1a1a1a;
    color: #ccc;
    border: 1px solid #333;
    border-radius: 3px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}
.project-notes-input:focus {
    border-color: #4a8;
    outline: none;
}

.project-merge-section {
    margin-top: 8px;
}
.project-merge-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.project-merge-count {
    font-size: 10px;
    color: #666;
}
.project-merge-status {
    font-size: 10px;
    color: #8a8;
    margin-top: 2px;
}

.project-list-picker {
    margin-top: 8px;
    border: 1px solid #333;
    border-radius: 3px;
    overflow: hidden;
}
.project-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 6px 8px;
    font-size: 11px;
    color: #ccc;
    background: #1a1a1a;
    border: none;
    border-bottom: 1px solid #222;
    cursor: pointer;
    text-align: left;
}
.project-list-item:last-child { border-bottom: none; }
.project-list-item:hover { background: #252530; }
.project-list-item-name {
    font-size: 11px;
    color: #ccc;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.project-list-item-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10px;
    color: #777;
    white-space: nowrap;
}
.project-list-item-date {
    color: #666;
}
.project-list-item-delete {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 11px;
    padding: 0 2px;
    line-height: 1;
}
.project-list-item-delete:hover {
    color: #f66;
}

/* "T" after a project file's name: its metadata came from the desktop app.
   A fact, so plain text (see "File badges"), in the grey of the file rows'
   facts so it doesn't read as part of the name. */
.file-badge-tauri {
    margin-left: 4px;
    color: #999;
}

/* ── Right sidebar overrides ───────────────────────────────────────── */
.right-sidebar {
    border-right: none;
    border-left: 1px solid #333;
}

.right-sidebar.collapsed {
    border-left: none;
}

.right-sidebar .sidebar-collapse-btn {
    display: none;
}

.right-sidebar .sidebar-resize-handle {
    right: auto;
    left: -3px;
}

.right-sidebar.mobile-overlay {
    left: auto;
    right: 0;
    top: var(--toolbar-h, 44px);
    height: calc(100% - var(--toolbar-h, 44px));
    box-shadow: -4px 0 20px rgba(0,0,0,0.5);
}

.right-sidebar.mobile-overlay.collapsed {
    transform: translateX(100%);
}

/* ── XC Browser Modal ───────────────────────────────────────────── */

.xc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.xc-modal {
    background: #1e1e2e;
    border: 1px solid #444;
    border-radius: 8px;
    width: min(90vw, 700px);
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.xc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #333;
}

.xc-modal-title {
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}

.xc-modal-close {
    background: none;
    border: none;
    color: #888;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.xc-modal-close:hover {
    color: #fff;
}

/* ── Privacy Settings Modal ─────────────────────────────────────── */

.privacy-section {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a3a;
}

.privacy-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.privacy-section-desc {
    font-size: 11px;
    color: #888;
    line-height: 1.5;
    margin-bottom: 12px;
}

.privacy-status-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #1a1a2a;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 12px;
}

.privacy-refresh-btn {
    margin-left: auto;
    font-size: 11px;
    color: #8cf;
    background: none;
    border: 1px solid #446;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    white-space: nowrap;
}

.privacy-refresh-btn:hover {
    background: #223;
    border-color: #668;
}

.privacy-btn {
    font-size: 13px;
    color: #8cf;
    background: none;
    border: 1px solid #446;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    margin-bottom: 8px;
}

.privacy-btn:hover {
    background: #223;
    border-color: #668;
}

.privacy-btn:disabled {
    color: #666;
    border-color: #333;
    cursor: default;
}

.privacy-btn.danger {
    color: #f88;
    border-color: #644;
}

.privacy-btn.danger:hover {
    background: #322;
    border-color: #866;
}

.privacy-ssid-list {
    font-size: 12px;
    color: #aaa;
    padding: 4px 0;
    margin-bottom: 8px;
}

.privacy-ssid-item {
    padding: 6px 8px;
    background: #252535;
    border-radius: 4px;
    margin-bottom: 4px;
}

.xc-section {
    padding: 10px 16px;
    border-bottom: 1px solid #2a2a3a;
}

/* Which XC source is active (own key or Oversample's proxy), with text-link
   controls beside it: changing the source is rare, so it gets no filled button
   and sits right under the title, next to what it changes. */
.xc-source-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 6px 16px;
    border-bottom: 1px solid #2a2a3a;
    color: #888;
    font-size: 11px;
}

.xc-source-text {
    margin-right: auto;
}

.xc-link-btn {
    background: none;
    border: none;
    padding: 2px 0;
    min-height: 24px;
    color: #6ea8fe;
    font-size: 11px;
    cursor: pointer;
}

.xc-link-btn:hover {
    text-decoration: underline;
}

.xc-key-note {
    margin: 6px 0 0;
}

.xc-info {
    color: #aaa;
    font-size: 12px;
    margin: 0 0 10px;
    line-height: 1.5;
}

.xc-info a {
    color: #6ea8fe;
}

.xc-key-form {
    display: flex;
    gap: 8px;
}

.xc-input {
    background: #2a2a3a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 6px 10px;
    font-size: 12px;
    outline: none;
}

.xc-input:focus {
    border-color: #6ea8fe;
}

.xc-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.xc-search-input {
    flex: 1;
}

.xc-btn {
    background: #3a3a4a;
    border: 1px solid #555;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 6px 12px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.xc-btn:hover {
    background: #4a4a5a;
}

.xc-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.xc-btn-small {
    padding: 3px 8px;
    font-size: 11px;
}

.xc-btn-back {
    margin-bottom: 8px;
}

.xc-btn-load {
    padding: 3px 10px;
}

.xc-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.xc-filters label {
    color: #aaa;
    font-size: 12px;
}

.xc-select {
    background: #2a2a3a;
    border: 1px solid #444;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 5px 8px;
    font-size: 12px;
}

.xc-country-input {
    width: 120px;
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.xc-combobox {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.xc-combobox-toggle {
    background: #2a2a3a;
    border: 1px solid #444;
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: #888;
    padding: 6px 6px;
    font-size: 10px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
}

.xc-combobox-toggle:hover {
    color: #e0e0e0;
    background: #3a3a4a;
}

.xc-combobox-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    /* Wide enough for a long country name and its recording count. */
    width: 240px;
    max-height: 240px;
    overflow-y: auto;
    background: #2a2a3a;
    border: 1px solid #444;
    border-radius: 0 0 4px 4px;
    z-index: 50;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.xc-combobox-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 5px 10px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.xc-combobox-option:hover,
.xc-combobox-option.highlight {
    background: #3a3a5a;
    color: #fff;
}

.xc-combobox-option.sel {
    color: #6ea8fe;
    font-weight: 600;
}

/* Country picker row: name on the left, the group's recording count for
   that country right-aligned and muted, so the names stay easy to scan.
   Every option is a flex row (no :has()), for older WebKitGTK. */
.xc-combobox-option {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.xc-country-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xc-country-count {
    flex-shrink: 0;
    color: #888;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.xc-combobox-option:hover .xc-country-count,
.xc-combobox-option.highlight .xc-country-count {
    color: #bbb;
}

.xc-cache-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.xc-cache-age {
    color: #888;
    font-size: 11px;
}

.xc-error {
    background: #3a1a1a;
    color: #ff8888;
    padding: 8px 16px;
    font-size: 12px;
    border-bottom: 1px solid #5a2a2a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.xc-error-dismiss {
    background: none;
    border: none;
    color: #ff8888;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    opacity: 0.7;
    flex-shrink: 0;
}
.xc-error-dismiss:hover {
    opacity: 1;
}

/* Status that is not an error ("API key removed.", "Species list stopped"). */
.xc-notice {
    background: #1a2a3a;
    color: #9cc4f0;
    padding: 8px 16px;
    font-size: 12px;
    border-bottom: 1px solid #2a3a5a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.xc-notice .xc-error-dismiss {
    color: #9cc4f0;
}

/* A question with buttons: remove the key (desktop), or start a long
   species list (own key). */
.xc-confirm {
    background: #2a2a1a;
    color: #e0d8a0;
    padding: 8px 16px;
    font-size: 12px;
    line-height: 1.5;
    border-bottom: 1px solid #4a4a2a;
}
.xc-confirm-buttons {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

/* First screen: a heading that states the choice, then one block per option. */
.xc-choose-heading {
    color: #ddd;
    font-size: 13px;
    margin: 0 0 10px;
}
.xc-option + .xc-option {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #2a2a3a;
}
.xc-option-heading {
    color: #ccc;
    font-size: 12px;
    font-weight: 600;
    margin: 0 0 4px;
}
.xc-field-label {
    display: block;
    color: #aaa;
    font-size: 11px;
    margin-bottom: 4px;
}

.xc-downloading {
    color: #8ac;
    padding: 8px 16px;
    font-size: 12px;
    border-bottom: 1px solid #334;
    animation: xc-pulse 1.5s ease-in-out infinite;
}

@keyframes xc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.xc-loading {
    color: #aaa;
    padding: 16px;
    text-align: center;
    font-size: 12px;
}

/* Species list */

.xc-species-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.xc-list-header, .xc-species-row {
    display: grid;
    grid-template-columns: 1fr 1fr 60px;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    align-items: center;
}

.xc-list-header {
    color: #888;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    background: #1e1e2e;
}

.xc-species-row {
    background: none;
    border: none;
    border-bottom: 1px solid #2a2a3a;
    color: #ccc;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.xc-species-row:hover {
    background: #2a2a4a;
}

.xc-col-sci {
    color: #999;
    font-style: italic;
}

.xc-col-count {
    text-align: right;
    color: #888;
}

/* Species found by name: adds a Group column, since the results come from
   every group. Under a species name (.xc-name-note): the English name when
   the name shown is in the user's language, and the name that matched. */
.xc-list-header.xc-named, .xc-species-row.xc-named {
    grid-template-columns: 1fr 1fr 90px 60px;
}

/* #a0a0a0 rather than the list's #888: the note must stay readable (4.5:1)
   on the highlighted row's #2a2a4a too. */
.xc-col-group {
    color: #a0a0a0;
}

.xc-name-note {
    display: block;
    color: #a0a0a0;
    font-size: 11px;
}

/* On a phone the Group column squeezes the names into many lines; the
   species and scientific names already say what kind of animal it is. */
@media (max-width: 500px) {
    .xc-list-header.xc-named, .xc-species-row.xc-named {
        grid-template-columns: 1fr 1fr 44px;
    }
    .xc-named .xc-col-group {
        display: none;
    }
}

/* Recordings list */

.xc-recordings-header {
    padding: 8px 16px;
    color: #ccc;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid #333;
}

.xc-recordings-list {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.xc-rec-header, .xc-rec-main {
    display: grid;
    grid-template-columns: 70px 1fr 24px 42px 1fr 56px;
    gap: 6px;
    padding: 5px 16px;
    font-size: 11px;
    align-items: center;
}

.xc-rec-header {
    color: #888;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    background: #1e1e2e;
}

.xc-rec-row {
    border-bottom: 1px solid #2a2a3a;
    color: #ccc;
}

.xc-rec-row:hover {
    background: #2a2a4a;
}

.xc-rec-id {
    font-size: 11px;
}

.xc-rec-link {
    color: #6ea8fe;
    text-decoration: none;
}

.xc-rec-link:hover {
    text-decoration: underline;
}

.xc-rec-quality {
    text-align: center;
}

.xc-q-a { color: #4caf50; font-weight: 600; }
.xc-q-b { color: #8bc34a; }
.xc-q-c { color: #ffc107; }
.xc-q-d { color: #ff9800; }
.xc-q-e { color: #f44336; }

.xc-rec-length {
    text-align: right;
}

.xc-rec-loc {
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xc-rec-action {
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.xc-rec-cached {
    color: #4caf50;
    font-size: 12px;
}

.xc-rec-detail {
    display: flex;
    gap: 6px;
    padding: 0 16px 4px 16px;
    flex-wrap: wrap;
}

.xc-rec-tag {
    font-size: 10px;
    color: #888;
    background: #2a2a3a;
    padding: 1px 6px;
    border-radius: 3px;
}

.xc-rec-smp {
    color: #9d8aef;
}

.xc-rec-recordist {
    color: #7aa;
}

.xc-result-count {
    color: #888;
    font-size: 11px;
    font-weight: 400;
}

.xc-result-summary {
    color: #888;
    font-size: 11px;
    padding: 4px 16px;
}

.xc-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 16px;
    border-top: 1px solid #333;
}

.xc-page-info {
    color: #888;
    font-size: 11px;
}

/* ── Find recordings (combined species search) ─────────────────────────────
   One dialog for every source: species list on the left, the selected
   entry's recordings on the right. Reuses the .xc-* controls so it looks like
   the Xeno-canto browser it replaces. Below 760 px the panes show one at a
   time (.show-detail swaps them). */

.find-modal {
    width: min(96vw, 1100px);
    height: min(88vh, 900px);
    max-height: none;
}

.find-controls {
    padding: 10px 16px 8px;
    border-bottom: 1px solid #333;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.find-search {
    width: 100%;
    font-size: 14px;
    padding: 7px 10px;
}

.find-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
}

.find-filters label {
    color: #aaa;
    font-size: 12px;
    white-space: nowrap;
}

.find-filters .xc-select {
    max-width: 220px;
}

.find-locating {
    color: #aaa;
    font-size: 12px;
}

.find-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(240px, 340px) 1fr;
}

.find-species {
    overflow-y: auto;
    border-right: 1px solid #333;
    min-height: 0;
}

.find-detail {
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 8px;
}

/* Column labels over the species list, so its numbers read as recordings.
   They sort the list (.find-sort). */
.find-list-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    min-height: 24px;
    color: #a0a0a0;
    font-size: 11px;
    border-bottom: 1px solid #333;
}

/* Column headings that sort their list, the usual way for a table: plain text
   like the other headings, the sorted one brighter with an arrow. The server
   sorts, since the lists arrive a page at a time. 24 px tall for the minimum
   target size. */
.find-sort {
    background: none;
    border: none;
    padding: 0;
    min-height: 24px;
    color: inherit;
    font: inherit;
    text-align: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.find-sort:hover {
    color: #ddd;
    text-decoration: underline;
}

.find-sort.active {
    color: #e8e8e8;
}

.find-sort-arrow {
    margin-left: 3px;
    font-size: 8px;
    vertical-align: 1px;
}

/* A faint two-way mark on the headings that sort but are not sorted, so they
   can be told from the plain ones (Place, Source). */
.find-sort:not(.active)::after {
    content: "\21C5";
    margin-left: 3px;
    opacity: 0.45;
}

/* "Sort by" shows only on a phone, where the column headings are hidden and
   the sortable ones stand alone. */
.find-sort-label {
    display: none;
}

/* End of a list, where the next page loads as it scrolls into view: how many
   rows are listed of how many, and the next page's state. */
.find-list-end {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 10px;
    padding: 10px 16px;
    color: #a0a0a0;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.find-list-end .find-more {
    margin: 0;
}

.find-more-error {
    color: #e8a0a0;
}

/* Starts the name matches that have no recordings, after those that have some. */
.find-list-subhead {
    padding: 10px 16px 4px;
    color: #a0a0a0;
    font-size: 11px;
    border-bottom: 1px solid #2a2a3a;
}

/* Species rows: name and count on the first line, scientific name and group
   under the name. The selected row gets a background, not bold, so text
   doesn't rewrap. */
.find-species-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 8px;
    width: 100%;
    padding: 6px 16px;
    background: none;
    border: none;
    border-bottom: 1px solid #2a2a3a;
    color: #ddd;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}

.find-species-row:hover {
    background: #2a2a4a;
}

.find-species-row.selected {
    background: #33335a;
}

.find-fixed-row {
    color: #e8e8e8;
    background: #222233;
}

.find-sp-name {
    overflow-wrap: anywhere;
}

.find-sp-count {
    color: #a0a0a0;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.find-sp-sci {
    grid-column: 1 / -1;
    color: #a0a0a0;
    font-size: 11px;
}

/* A species found by name with no recordings: its name is muted and its
   count is 0; the row still opens its Wikipedia and BeastieBot links. */
.find-no-recordings .find-sp-name {
    color: #a0a0a0;
}

/* #a8a8a8 keeps 4.5:1 on the selected row's #33335a. */
.find-zero {
    color: #a8a8a8;
}

.find-link-row {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: #2a3a5a;
    border: none;
    border-bottom: 1px solid #333;
    color: #e8e8e8;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
}

.find-link-row:hover {
    background: #34466a;
}

.find-notice {
    padding: 12px 16px;
    color: #ccc;
    font-size: 12px;
    line-height: 1.5;
}

.find-notice-small {
    padding: 8px 16px;
    background: #2a2a1e;
    color: #d8d0a0;
    border-bottom: 1px solid #333;
}

.find-notice-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.find-empty {
    padding: 10px 16px;
    color: #a0a0a0;
    font-size: 12px;
    font-style: italic;
}

/* "Clear filters": 24 px tall, like Load, so it is easy to tap. */
.find-empty .xc-btn {
    min-height: 24px;
    font-style: normal;
}

.find-more {
    display: block;
    margin: 8px auto;
    background: none;
    border: 1px solid #555;
    border-radius: 4px;
    color: #ccc;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
}

.find-more:hover {
    background: #2a2a4a;
}

.find-detail-head {
    padding: 10px 16px 8px;
    border-bottom: 1px solid #333;
}

.find-detail-head h3 {
    font-size: 15px;
    font-weight: 600;
    color: #e8e8e8;
}

.find-detail-sci {
    font-weight: 400;
    color: #a0a0a0;
    font-size: 13px;
}

.find-detail-sub {
    margin-top: 3px;
    color: #aaa;
    font-size: 12px;
}

.find-detail-sub a, .find-rec-source {
    color: #6ea8fe;
    text-decoration: none;
}

.find-detail-sub a:hover, .find-rec-source:hover {
    text-decoration: underline;
}

/* 24 px tall so the link meets the minimum target size. */
.find-rec-source {
    white-space: nowrap;
    display: inline-block;
    line-height: 24px;
}

.find-modal .xc-modal-close {
    min-width: 28px;
    min-height: 28px;
}

.find-detail-head .demo-random-bat {
    margin-top: 8px;
}

/* Recordings: one grid row per recording, recordist and licence on a second
   line. Numbers are right-aligned with tabular figures so a column can be
   scanned. */
.find-rec-head, .find-rec-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 84px 52px 72px 64px 84px 92px;
    gap: 2px 8px;
    padding: 5px 16px;
    font-size: 12px;
    align-items: center;
}

.find-rec-head.with-species, .find-rec-row.with-species {
    grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr) 84px 52px 72px 64px 84px 92px;
}

.find-rec-head {
    color: #888;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    background: #1e1e2e;
    font-size: 11px;
    padding-top: 0;
    padding-bottom: 0;
    min-height: 24px;
}

.find-rec-row {
    border-bottom: 1px solid #2a2a3a;
    color: #ccc;
}

.find-rec-row:hover {
    background: #26263e;
}

/* Distance (the sort order when Near is set) comes first; the place text is
   held to two lines, with the full text in its tooltip. */
.find-rec-place-cell {
    display: flex;
    gap: 6px;
    min-width: 0;
}

.find-rec-place {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.find-rec-dist {
    color: #e0e0e0;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.find-rec-date, .find-rec-num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.find-rec-num {
    text-align: right;
}

.find-rec-detail {
    grid-column: 1 / -1;
    color: #999;
    font-size: 11px;
}

.find-rec-load {
    justify-self: end;
    min-height: 24px;
}

/* Preview and Load share the last column (92px: a 30px preview button, a gap
   and the 58px Load button). Rows with no preview (ultrasonic recordings,
   which play silent at their own speed) keep Load at the right edge. */
.find-rec-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
}

.find-rec-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    min-height: 24px;
    font-size: 12px;
}

/* Playing marks the row like a selection, in the species list's selected colour. */
.find-rec-preview.playing {
    background: #33335a;
    border-color: #6a6aa0;
}

.find-rec-preview.loading .icon {
    animation: find-preview-wait 0.8s ease-in-out infinite alternate;
}

@keyframes find-preview-wait {
    from { opacity: 1; }
    to { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
    .find-rec-preview.loading .icon {
        animation: none;
        opacity: 0.6;
    }
}

/* Failed: the app's warning amber (.analysis-warning); the reason is in the
   dialog's error bar. */
.find-rec-preview.failed {
    color: #fc8;
    border-color: #6b5320;
}

.find-demo-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0 8px;
    padding: 6px 16px;
    border-bottom: 1px solid #2a2a3a;
    font-size: 13px;
    align-items: center;
}

.find-demo-row .find-sp-sci {
    grid-column: 1;
    grid-row: 2;
}

.find-demo-row .find-rec-load {
    grid-row: 1 / span 2;
    grid-column: 2;
}

.find-back {
    display: none;
}

.find-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    border-top: 1px solid #333;
    color: #888;
    font-size: 11px;
}

@media (max-width: 760px) {
    .find-modal {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }

    .find-body {
        grid-template-columns: 1fr;
    }

    .find-species {
        border-right: none;
    }

    .find-body.show-detail .find-species,
    .find-body:not(.show-detail) .find-detail {
        display: none;
    }

    .find-back {
        display: inline-block;
        margin: 8px 16px 0;
    }

    /* Group and Country fit side by side at 375 px. */
    .find-filters .xc-select {
        max-width: 140px;
    }

    /* Wide enough for "96 kHz or more (11,230)"; it sits on a line of its own. */
    .find-filters .find-rate-select {
        max-width: 200px;
    }

    /* Phone: place takes the first line; date, length, rate, quality and
       source share the second; preview and Load stay at the right of the
       first line.
       The heading row keeps only its sort buttons, after "Sort by". */
    .find-rec-head {
        display: none;
    }

    .find-rec-head.sortable {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0 14px;
    }

    .find-rec-head .find-head-plain {
        display: none;
    }

    .find-rec-head .find-sort-label {
        display: inline;
    }

    /* Six columns: four for date, length, rate and quality, a 1fr column
       for the source, and one for preview and Load. The species and place
       lines span the 1fr column too, so a long place name wraps instead of
       widening the four data columns (which spread one row's data line
       apart from the others'). */
    .find-rec-row, .find-rec-row.with-species {
        grid-template-columns: repeat(4, auto) 1fr auto;
        justify-content: start;
    }

    .find-rec-row .find-rec-species {
        grid-column: 1 / -2;
        font-weight: 600;
    }

    .find-rec-row .find-rec-place-cell {
        grid-column: 1 / -2;
    }

    /* The data line starts on a line of its own, under the place, also when
       the species takes the first line. */
    .find-rec-row .find-rec-date {
        grid-column: 1;
    }

    .find-rec-row .find-rec-actions {
        grid-column: -2 / -1;
        grid-row: 1;
    }

    .find-rec-row .find-rec-num {
        text-align: left;
    }
}

/* ── Bat Book ─────────────────────────────────────────────────────────────── */

/* Tab handle on the right edge; hidden while strip is open */
/* Strip (horizontal scrolling area) */
.bat-book-strip {
    flex-shrink: 0;
    background: #141414;
    border-top: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    overflow: visible;
    position: relative;
}

.bat-book-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-bottom: 1px solid #222;
    min-height: 22px;
}

/* #888: 5.3:1 on the strip (#555 was 2.5:1). */
.bat-book-title {
    font-size: 10px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}

.bat-book-region-label {
    font-size: 10px;
    color: #4a8;
    user-select: none;
}

.bat-book-config-wrap {
    position: relative;
}

/* 24 x 24 px touch targets (WCAG 2.2); the negative margin keeps the header
   row at its old height. #888 is 5.3:1 on the strip's background. */
.bat-book-config-btn,
.bat-book-close-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 13px;
    padding: 0 4px;
    line-height: 1;
    min-width: 24px;
    min-height: 24px;
    margin: -3px 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s;
}

/* Region label when the region comes from the recording's own place: a map
   pin before it, with the source (GPS or Xeno-Canto) in the tooltip. */
.bat-book-region-label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.bat-book-config-btn:hover,
.bat-book-close-btn:hover {
    color: #ccc;
}

/* More info: opens the species card. A grey box, the app's plain button
   (badge style A); amber when the drawn calls are out of view. */
.bat-book-info-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    margin: -3px 4px;
    padding: 0 8px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.bat-book-info-btn:hover {
    background: #333;
    color: #eee;
}
.bat-book-info-btn.warn {
    border-color: #a87a1e;
}
.bat-book-info-warn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #d9a23a;
    color: #1a1a1a;
    font-size: 10px;
    font-weight: 700;
}

/* Invisible full-screen backdrop to dismiss region menu on outside click */
.bat-book-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 29;
}

/* Region dropdown menu */
.bat-book-region-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    /* Wide enough for "This recording: United Kingdom" on one line. */
    min-width: 230px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: rgba(16, 16, 16, 0.97);
    backdrop-filter: blur(10px);
    border: 1px solid #444;
    border-radius: 6px;
    padding: 4px 0;
    z-index: 30;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.bat-book-region-opt {
    display: block;
    width: 100%;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    color: #aaa;
    font-size: 12px;
    padding: 5px 12px;
    text-align: left;
    cursor: pointer;
    transition: background 0.1s;
}

.bat-book-region-opt:hover {
    background: #222;
    color: #eee;
}

.bat-book-region-opt.active {
    border-left-color: #4a8;
    background: #1f2f25;
    color: #8fc;
}

/* The open recording's own region (from its GPS or Xeno-Canto country). It is
   information, not an option: the recording's place always wins. */
.bat-book-region-recording {
    padding: 5px 12px 5px 14px;
    font-size: 12px;
    color: #8fc;
}
.bat-book-region-recording-src {
    color: #999;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
/* Heading over the options that apply to recordings without a place. */
.bat-book-region-heading {
    padding: 4px 12px 2px 14px;
    font-size: 11px;
    color: #888;
}
.bat-book-region-locate {
    display: flex;
    align-items: center;
    gap: 6px;
}
.bat-book-region-locate:disabled {
    cursor: progress;
    color: #888;
}
.bat-book-region-error {
    padding: 2px 12px 6px 14px;
    max-width: 220px;
    font-size: 11px;
    color: #f88;
}

/* Scrollable chip area */
.bat-book-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
    -webkit-overflow-scrolling: touch;
}

.bat-book-scroll::-webkit-scrollbar {
    height: 4px;
}

.bat-book-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.bat-book-scroll::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 2px;
}

/* Bat family chip */
.bat-book-chip {
    flex-shrink: 0;
    background: rgba(25, 25, 25, 0.9);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 80px;
    min-height: 36px;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
}

.bat-book-chip:hover {
    background: #2a2a2a;
    border-color: #555;
}

.bat-book-chip.selected {
    background: rgba(26, 60, 40, 0.92);
    border-color: rgba(80, 180, 130, 0.6);
}

.bat-book-chip-name {
    font-size: 11px;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
}

.bat-book-chip.selected .bat-book-chip-name {
    color: #8fc;
}

/* #888: 4.5:1 or better on the chip background (#777 was 3.95:1). */
.bat-book-chip-freq {
    font-size: 9px;
    color: #888;
    white-space: nowrap;
}

/* On the selected chip's green or blue fill, #888 is 3.6:1; #a8a8a8 is 5.6:1. */
.bat-book-chip.selected .bat-book-chip-freq {
    color: #a8a8a8;
}

/* Divider between echolocating and non-echolocating entries */
.bat-book-divider {
    flex-shrink: 0;
    width: 1px;
    height: 24px;
    background: #444;
    margin: 0 6px;
    align-self: center;
}

/* Auto-matched species chip — distinct styling */
.bat-book-chip.auto-matched {
    border-color: rgba(100, 200, 255, 0.5);
    background: rgba(20, 40, 60, 0.9);
}
.bat-book-chip.auto-matched:hover {
    background: rgba(30, 55, 80, 0.95);
}
.bat-book-chip.auto-matched.selected {
    border-color: rgba(100, 200, 255, 0.7);
    background: rgba(20, 50, 70, 0.95);
}

/* Vertical divider between auto-matched species and regional book */
.bat-book-auto-divider {
    flex-shrink: 0;
    width: 2px;
    background: rgba(100, 200, 255, 0.25);
    margin: 4px 6px;
    align-self: stretch;
    border-radius: 1px;
}

/* Star toggle in region dropdown */
/* Empty stars at #888 (5.3:1 on the menu) rather than 30% opacity (1.8:1). */
.bat-book-star {
    cursor: pointer;
    margin-right: 4px;
    color: #888;
    font-size: 11px;
    transition: color 0.15s;
}
.bat-book-star:hover { color: #ddd; }
.bat-book-star.active { color: #fc0; }

/* Separator in region dropdown */
.bat-book-region-separator {
    height: 1px;
    background: rgba(255,255,255,0.08);
    margin: 3px 0;
}

/* ── DSP Display Filter Panel ──────────────────────────────────────────────── */

/* The XForm menu's grid (src/components/display_filter_button.rs): a row for
   each Hear bar control, a column for each choice. Every row is its own grid
   with the same columns, so the cells line up under the header. */
.dsp-filter-row {
    display: grid;
    grid-template-columns: 104px repeat(4, minmax(0, 1fr));
    gap: 3px;
    align-items: center;
    padding: 2px 8px;
}

.dsp-filter-header {
    padding-bottom: 0;
}

.dsp-filter-col {
    font-size: 10px;
    /* 5.6:1 on the panel's #101010. */
    color: #8a8a8a;
    text-align: center;
    white-space: nowrap;
}

.dsp-filter-label {
    font-size: 11px;
    color: #ccc;
    white-space: nowrap;
}

/* One choice in a row. Empty until selected, except "As heard", which
   always shows what the Hear bar is set to. 24px tall for a mouse, 36px for
   a finger. */
.dsp-cell {
    min-height: 24px;
    padding: 2px;
    background: rgba(40, 40, 40, 0.9);
    color: #9a9a9a;
    border: 1px solid rgba(70, 70, 70, 0.5);
    border-radius: 3px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.dsp-cell:hover {
    background: rgba(60, 60, 60, 0.9);
    color: #ddd;
}
.dsp-cell.sel {
    background: rgba(40, 80, 60, 0.9);
    color: #6da;
    border-color: rgba(100, 200, 160, 0.4);
    font-weight: 700;
}
@media (pointer: coarse), (max-width: 640px) {
    .dsp-cell {
        min-height: 36px;
    }
}

.dsp-filter-seg {
    display: flex;
    gap: 1px;
}

.dsp-filter-seg button {
    flex: 1;
    font-size: 10px;
    padding: 3px 4px;
    background: rgba(40, 40, 40, 0.9);
    /* 5.3:1 on the button's background (#777 was 3.4:1). */
    color: #9a9a9a;
    border: 1px solid rgba(70, 70, 70, 0.5);
    border-radius: 3px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    line-height: 1;
    transition: background 0.1s, color 0.1s;
}

.dsp-filter-seg button:hover {
    background: rgba(60, 60, 60, 0.9);
    color: #ccc;
}

.dsp-filter-seg button.sel {
    background: rgba(40, 80, 60, 0.9);
    color: #6da;
    border-color: rgba(100, 200, 160, 0.4);
    font-weight: 700;
}

.dsp-filter-seg button.disabled {
    opacity: 0.25;
    pointer-events: none;
    cursor: default;
}

.dsp-custom-section {
    padding: 6px 8px 4px;
    border-top: 1px solid rgba(80, 80, 80, 0.3);
    margin-top: 4px;
}

.dsp-custom-title {
    font-size: 9px;
    text-transform: uppercase;
    /* 4.8:1 on the panel background, like .layer-panel-title. */
    color: #808080;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

/* XForm popup help blurb: a short dynamic description of what the
   transformed spectrogram is currently showing. */
.xform-blurb {
    font-size: 11px;
    line-height: 1.35;
    color: #9aa;
    padding: 2px 8px 6px;
    border-bottom: 1px solid #2a2a2a;
    margin-bottom: 4px;
}

.dsp-custom-slider-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dsp-custom-slider-row .setting-range {
    flex: 1;
}

.dsp-custom-value {
    font-size: 10px;
    color: #aaa;
    min-width: 40px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* On/off toggle beside the value it sets (Range Auto, Waveform Gain Auto).
   Fixed width and normal weight when selected, so toggling it doesn't move
   the slider. */
.layer-panel-opt.opt-toggle {
    display: inline-block;
    flex: none;
    width: 36px;
    height: 24px;
    padding: 0;
    font-size: 9px;
    text-align: center;
    /* A solid fill when off too, so it reads as a button and not a label. */
    background: #262626;
    color: #aaa;
}

.layer-panel-opt.opt-toggle:hover {
    background: #303030;
}

.layer-panel-opt.opt-toggle.sel {
    font-weight: normal;
    background: #1f2b27;
    color: #6da;
}

/* Small secondary action at the end of a section, such as Reset. */
.layer-panel-opt.opt-small-action {
    display: inline;
    width: auto;
    padding: 2px 8px;
    font-size: 9px;
}

/* Rows without a toggle keep the same space and height, so the sliders in a
   section line up and the rows stay evenly spaced. */
.dsp-custom-section:has(.opt-toggle) .dsp-custom-slider-row {
    min-height: 24px;
}

.dsp-custom-section:has(.opt-toggle) .dsp-custom-slider-row:not(:has(.opt-toggle))::after {
    content: "";
    flex: none;
    width: 36px;
}

/* Phones: the option buttons grow to 40 px for fingers; the rows in a
   section with a toggle grow with them so the spacing stays even. */
@media (pointer: coarse), (max-width: 640px) {
    .dsp-custom-section:has(.opt-toggle) .dsp-custom-slider-row {
        min-height: 40px;
    }
    .layer-panel-opt.opt-toggle {
        height: 40px;
        width: 44px;
        font-size: 12px;
    }
    .dsp-custom-section:has(.opt-toggle) .dsp-custom-slider-row:not(:has(.opt-toggle))::after {
        width: 44px;
    }
}

.dsp-slider-label {
    font-size: 9px;
    color: #888;
    min-width: 42px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Export section ──────────────────────────────────────────────── */
.export-section {
    margin: 4px 0;
}

.export-section-header {
    padding: 6px 16px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.export-section-header:hover {
    color: #bbb;
}

.export-toggle-arrow {
    display: inline-block;
    font-size: 11px;
    transition: transform 0.15s ease;
}
.export-toggle-arrow.open {
    transform: rotate(90deg);
}

.export-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease;
}
.export-section-body.open {
    max-height: 400px;
}

.export-format-row {
    padding: 4px 16px;
    gap: 10px;
    justify-content: flex-start;
}
.export-format-label {
    font-size: 11px;
    color: #999;
    margin-right: 2px;
}
.export-radio {
    font-size: 11px;
    color: #ccc;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    /* 24 px: the smallest touch target WCAG 2.2 allows. */
    min-height: 24px;
}
.export-radio.disabled {
    color: #666;
    cursor: not-allowed;
}
.export-radio input[type="radio"],
.export-radio input[type="checkbox"] {
    margin: 0;
    accent-color: #4a8a5a;
}

.export-mp4-options {
    padding: 2px 0;
}
.export-option-label {
    font-size: 11px;
    color: #999;
    min-width: 70px;
}
.export-mp4-options .sidebar-select {
    flex: 1;
    min-width: 0;
}
/* Radios, one per line: the panel is too narrow for a select to show
   "32-bit float, for further processing" without cutting it off. */
.export-wav-options {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 2px 16px;
}

.export-tooltip {
    font-size: 10px;
    color: #888;
    cursor: help;
}

/* The line under the NR menu's denoise button: what the press does, why it
   can't be pressed, or an error. Same size and tone as the menu's other
   status lines. */
.denoise-note {
    padding: 0 8px 2px;
    font-size: 11px;
    opacity: 0.6;
    line-height: 1.3;
    /* Wrap inside the menu's own width: a long line must not widen the menu,
       which would move every control in it when the line changes. */
    width: 0;
    min-width: 100%;
    box-sizing: border-box;
    /* A refusal is two lines with a line break between them. */
    white-space: pre-line;
}
/* Room for three lines of note (the model, what the button does, and the
   download before the model is stored) or the progress bar with its text, so
   the notch controls below stay where they are while the status changes. */
.denoise-status {
    min-height: 49px;
}
.denoise-note.denoise-error {
    color: #e88;
    opacity: 1;
}
.export-progress {
    padding: 4px 16px;
}
.export-progress-bar {
    height: 6px;
    background: #1a2a1a;
    border: 1px solid #3a5a3a;
    border-radius: 3px;
    overflow: hidden;
}
.export-progress-fill {
    height: 100%;
    background: #4a8a5a;
    transition: width 0.15s ease;
}
.export-progress-text {
    font-size: 10px;
    color: #888;
    margin-top: 2px;
    text-align: center;
}
.export-progress-text.export-error {
    color: #e88;
}
.export-panel {
    padding-top: 8px;
}
.export-detail {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 4px 16px;
    font-size: 11px;
    color: #ccc;
}
.export-detail-label {
    font-size: 10px;
    color: #888;
}
.export-file-name {
    overflow-wrap: anywhere;
}

/* ── Zoom-out button (shown when viewport is pinch-zoomed) ─────────────── */
/* Uses position:absolute with JS-computed top/left from visualViewport
   so it stays in the visible area when the layout viewport is scrolled. */
.zoom-out-btn {
    position: absolute;
    z-index: 10000;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(30, 30, 30, 0.9);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
    touch-action: manipulation;
}
.zoom-out-btn:active {
    background: rgba(80, 80, 80, 0.95);
    transform: scale(0.92);
}
.zoom-out-btn svg {
    pointer-events: none;
}

/* When viewport is pinch-zoomed, allow native pinch on elements with static
   touch-action: none so the user can zoom back out */
body.viewport-zoomed .overview-strip,
body.viewport-zoomed .bottom-toolbar-drag-handle {
    touch-action: pinch-zoom !important;
}

/* ── Canvas overflow menus (selection / annotation "..." buttons) ── */

.canvas-overflow-anchor {
    position: absolute;
}

button.canvas-overflow-btn {
    width: 22px;
    height: 22px;
    background: rgba(30, 30, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    pointer-events: auto;
    backdrop-filter: blur(4px);
}

button.canvas-overflow-btn:hover {
    color: #ddd;
    background: rgba(50, 50, 50, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

.canvas-overflow-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

.canvas-overflow-menu {
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    background: rgba(26, 26, 26, 0.97);
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    min-width: 160px;
    padding: 4px 0;
    backdrop-filter: blur(10px);
}

.canvas-overflow-anchor.menu-opens-left .canvas-overflow-menu {
    left: auto;
    right: 0;
}

.canvas-overflow-anchor.menu-opens-up .canvas-overflow-menu {
    top: auto;
    bottom: calc(100% + 4px);
}

.canvas-overflow-info {
    padding: 6px 10px;
    font-size: 11px;
    color: #aaa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Tabular figures: the delay changes as the user moves between selections, and
   these values get compared with each other. */
.channel-delay {
    font-variant-numeric: tabular-nums;
    /* Keeps the menu's width steady when the reading changes from "measuring" to a
       result. Under the 220 px at which overflow_anchor opens menus leftward, so a
       right-opening menu stays on the canvas. */
    min-width: 210px;
    box-sizing: border-box;
}

/* A phone has too little room beside the selection for the wider menu. */
.app.mobile .channel-delay {
    min-width: 0;
}

.canvas-overflow-btn-row {
    display: flex;
    gap: 4px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Freq range row: text on the left, buttons right-aligned in a fixed position. */
.canvas-overflow-freq-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    color: #aaa;
}
.canvas-overflow-freq-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.canvas-overflow-btn-group {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

button.canvas-overflow-action-btn {
    width: 28px;
    height: 24px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    color: #ccc;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

button.canvas-overflow-action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

button.canvas-overflow-action-btn:disabled,
button.canvas-overflow-action-btn.disabled {
    opacity: 0.25;
    cursor: default;
}

.canvas-overflow-item {
    display: block;
    width: 100%;
    padding: 6px 12px;
    background: none;
    border: none;
    color: #ddd;
    font-size: 13px;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
}

.canvas-overflow-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.canvas-overflow-item.danger {
    color: #e66;
}

.canvas-overflow-item.danger:hover {
    background: rgba(220, 60, 60, 0.15);
}

.canvas-overflow-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 2px 0;
}

/* ── "Fine output adjustment" (fine_output.rs) ─────────────────────────
   A section of the HET, TE, PS and ZC settings panels. The diagram's left
   column is the recording and its right column is what is heard.
   Colours: the recording's band is the amber of the HFR band's text, heard
   values are #8fc, the green of heard values on the spectrogram's axes
   (HEARD_RGB in heard_axis.rs). */
.fine-out {
    margin-top: 6px;
    border-top: 1px solid #2a2a2a;
    padding-top: 4px;
}
.fine-out-head {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-height: 24px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #ccc;
    cursor: pointer;
    border-radius: 4px;
}
.fine-out-head:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.fine-out-head:focus-visible { outline: 1px solid rgba(0, 200, 255, 0.6); }
.fine-out-head svg {
    width: 12px;
    height: 12px;
    color: #808080;
    transition: transform 0.12s;
}
.fine-out-head.open svg { transform: rotate(90deg); }
/* The diagram is drawn 330 units wide; the panel grows to fit it, and on a
   narrow screen the diagram scales down with the panel. */
.fine-out-body { width: 330px; max-width: 100%; }
.fine-out-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 11px;
    color: #aaa;
}
.fine-out-gap { flex: 1; }
.fine-out-dim { color: #808080; }
.fine-out-seg {
    display: inline-flex;
    flex-shrink: 0;
    border: 1px solid #444;
    border-radius: 4px;
    overflow: hidden;
}
.fine-out-seg button {
    all: unset;
    padding: 5px 8px;
    font-size: 11px;
    color: #999;
    cursor: pointer;
    white-space: nowrap;
}
.fine-out-seg button:hover { color: #ddd; background: rgba(255, 255, 255, 0.06); }
.fine-out-seg button.sel { color: #0cf; background: rgba(0, 200, 255, 0.15); }
.fine-out-seg button:focus-visible { outline: 1px solid rgba(0, 200, 255, 0.6); outline-offset: -1px; }
.fine-out-snap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #808080;
}
.fine-out-snap select {
    font: inherit;
    color: #ddd;
    background: #1c1c1c;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 2px 4px;
    width: 86px;
    min-height: 24px;
}
.fine-out-num { width: 48px; min-width: 48px; }
.fine-out-range { flex: 1; min-width: 80px; }
/* Fixed width: the text changes between "Off" and "÷2.5" as the slider moves. */
.fine-out-post { width: 30px; text-align: right; color: #8fc; font-variant-numeric: tabular-nums; }
.fine-out-diagram { padding: 2px 0; }
.fine-out-svg {
    display: block;
    width: 100%;
    height: auto;
    font-variant-numeric: tabular-nums;
    user-select: none;
    -webkit-user-select: none;
}
.fine-out-svg text { font-size: 10px; fill: #ddd; pointer-events: none; }
.fine-out-svg text.fine-out-col { font-size: 9px; fill: #808080; letter-spacing: 0.5px; }
.fine-out-svg text.fine-out-tick { font-size: 9px; fill: #808080; }
.fine-out-svg text.fine-out-in { fill: #e8b458; }
.fine-out-svg text.fine-out-value { font-size: 11px; font-weight: 600; fill: #8fc; }
/* 13px: at 11px the division sign reads as a plus. */
.fine-out-svg text.fine-out-factor { font-size: 13px; font-weight: 600; fill: #8fc; }
.fine-out-svg text.fine-out-shift { fill: #8fc; }
.fine-out-band {
    fill: rgba(136, 255, 204, 0.16);
    stroke: rgba(136, 255, 204, 0.6);
    cursor: grab;
    touch-action: none;
}
.fine-out-band:hover { fill: rgba(136, 255, 204, 0.24); }
.fine-out-band:active { cursor: grabbing; }
.fine-out-band.still { cursor: default; pointer-events: none; }
/* The ribbon runs from the recording's amber to the heard green; one flat
   colour between the two reads as joining them. */
.fine-out-ribbon { fill: #b8d890; opacity: 0.32; pointer-events: none; }
.fine-out-grip { pointer-events: none; }
.fine-out-grip line { stroke: #cfeee0; stroke-width: 1.5; stroke-linecap: round; }
.fine-out-handle { cursor: ns-resize; touch-action: none; }
.fine-out-hit { fill: transparent; }
.fine-out-knob { fill: #cfeee0; }
.fine-out-handle:hover .fine-out-knob { fill: #fff; }
.fine-out-carriers { fill: transparent; cursor: ns-resize; touch-action: none; }
.fine-out-carriers.locked { cursor: default; }

/* ── Wikimedia Commons import ───────────────────────────────────────── */

.wiki-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 10px;
    align-items: center;
    padding: 6px 16px;
    font-size: 12px;
    border-bottom: 1px solid #2a2a3a;
}

.wiki-row:hover {
    background: #262636;
}

.wiki-row-main {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.wiki-row-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Declared time expansion factor (P14424) — corrected on load. */
.wiki-te-badge {
    flex: none;
    padding: 1px 5px;
    border-radius: 3px;
    background: #3a5f3a;
    color: #b6e5b6;
    font-size: 10px;
    font-weight: 600;
}

.wiki-row-detail {
    color: #888;
    font-size: 11px;
    white-space: nowrap;
}

.wiki-row-link {
    color: #7aa7d8;
    font-size: 11px;
    text-decoration: none;
}

.wiki-row-link:hover {
    text-decoration: underline;
}

/* Inline stroke-SVG icons (src/components/icons.rs). Sized by font-size. */
.icon {
    display: inline-block;
    vertical-align: -0.15em;
    flex: none;
}

/* ── Hear chip + sheet (phones) ─────────────────────────────────────────
   On narrow viewports the hearing bar's mode radio group collapses to one
   chip showing the mode in effect; the sheet lists every mode with a full
   name. The bar's other controls stay in the bar beside the chip.
   z-order: backdrop 44 < sheet 45 < .layer-panel 50, so a mode's settings
   popup opened from the sheet still renders above it. */
.hear-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
    min-height: 38px;
    padding: 4px 12px 5px;
    line-height: 1.15;
}

.hear-chip .layer-btn-value {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    color: #ddd;
}

.hear-chip-abbr {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: #999;
    padding: 0 4px;
    border: 1px solid #444;
    border-radius: 3px;
}

.hear-chip.open {
    border-color: #4a8;
    color: #dff5ea;
}

.hear-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 44;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.hear-sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.hear-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 72vh;
    overflow-y: auto;
    background: rgba(22, 22, 22, 0.98);
    border: 1px solid #3a3a3a;
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.7);
    padding: 0 8px calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 45;
    transform: translateY(105%);
    transition: transform 0.2s ease;
}

.hear-sheet.open {
    transform: translateY(0);
}

.hear-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #444;
    margin: 10px auto 4px;
}

.hear-sheet-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 6px 2px;
    font-size: 15px;
    font-weight: 700;
    color: #eee;
}

.hear-mode-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hear-mode-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 48px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #ddd;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.hear-mode-row.sel {
    background: #244f3b;
}

.hear-mode-row.multi-selected {
    background: #1e2e26;
}

.hear-mode-row.disabled {
    opacity: 0.45;
    cursor: default;
}

.hear-mode-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.hear-mode-name {
    font-size: 14px;
}

.hear-mode-row.sel .hear-mode-name {
    color: #dff5ea;
    font-weight: 600;
}

.hear-mode-desc {
    font-size: 12px;
    color: #888;
}

.hear-mode-row.sel .hear-mode-desc {
    color: #9c9;
}

.hear-mode-abbr {
    flex: none;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #999;
    padding: 2px 6px;
    border: 1px solid #444;
    border-radius: 4px;
}

.hear-mode-row.sel .hear-mode-abbr {
    color: #dff5ea;
    border-color: #4a8;
}

/* Annota-JSON export form (Export section). Label/field pairs share a grid so
   the fields line up. */
.annota-export {
    margin: 4px 16px 8px;
    padding: 8px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #181818;
}
.annota-heading {
    font-size: 12px;
    color: #ccc;
    margin-bottom: 6px;
}
/* One column: the right sidebar is often under 260 px wide, too narrow for
   labels beside the fields. */
.annota-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px;
}
.annota-grid .annota-label:not(:first-child) {
    margin-top: 4px;
}
.annota-label {
    font-size: 12px;
    color: #999;
}
.annota-input {
    background: #222;
    color: #ccc;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 12px;
    min-width: 0;
}
.annota-help {
    font-size: 10px;
    color: #888;
    margin-top: -2px;
}
.annota-check {
    display: flex;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: #bbb;
    margin-top: 6px;
}
.annota-summary {
    font-size: 12px;
    color: #ccc;
    margin-top: 8px;
    font-variant-numeric: tabular-nums;
}
.annota-issues {
    font-size: 11px;
    color: #cc9;
    margin-top: 4px;
}
/* Red only for what XC rejects outright. */
.annota-issues.blocking {
    color: #f99;
}
.annota-issues-title {
    font-weight: 600;
}
.annota-issues ul {
    margin: 2px 0 0;
    padding-left: 16px;
}
.annota-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}
.annota-btn {
    width: auto;
    flex: 1;
    margin: 0;
}
.annota-btn-quiet {
    background: transparent;
    border-color: #444;
}

.annota-scope {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 6px;
}
.annota-scope .annota-check {
    margin-top: 0;
}

/* The species count line holds the names menu at its right; the menu wraps
   under the count on narrow screens. */
.xc-result-summary:has(.xc-names-menu) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 4px 12px;
}

.xc-names-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.xc-names-menu .xc-select {
    max-width: 220px;
    min-height: 24px;   /* WCAG 2.2 minimum target size */
    padding: 2px 6px;
    font-size: 11px;
}

/* ── 3D spectrogram dialog ("View in 3D" in the selection menu) ───── */

/* Wide and tall: the surface needs room to rotate, and the default
   .modal-dialog width (420px) is sized for forms. */
.modal-dialog.surface-3d-dialog {
    max-width: min(96vw, 1100px);
    height: min(88vh, 760px);
    max-height: 88vh;
}

.surface-3d-dialog .modal-header {
    gap: 12px;
}

.surface-3d-summary {
    flex: 1;
    min-width: 0;
    display: flex;
    gap: 10px;
    align-items: baseline;
    font-size: 12px;
    color: #999;
    overflow: hidden;
}

.surface-3d-file {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* On a phone the file name would be cut to a few letters; the main view's
   title bar already shows it. */
@media (max-width: 600px) {
    .surface-3d-file {
        display: none;
    }
    /* Plotly's toolbar buttons are 22 px tall; touch targets need at least 24. */
    .surface-3d-plot.js-plotly-plot .plotly .modebar-btn {
        height: 30px;
        padding: 7px 6px;
    }
}

.surface-3d-range {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #ccc;
}

.surface-3d-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    padding: 8px 18px;
    border-bottom: 1px solid #333;
    font-size: 12px;
    color: #bbb;
}

.surface-3d-floor {
    display: flex;
    align-items: center;
    gap: 8px;
}

.surface-3d-floor input {
    width: 140px;
    accent-color: #4a8;
}

/* Fixed width so the slider doesn't shift as the value changes length. */
.surface-3d-floor-value {
    min-width: 4.5em;
    font-variant-numeric: tabular-nums;
}

.surface-3d-note {
    color: #e0b060;
}

.surface-3d-hint {
    margin-left: auto;
    color: #888;
}

.surface-3d-plot-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
}

/* touch-action: none lets a finger drag rotate the surface instead of
   scrolling the page on phones. */
.surface-3d-plot {
    position: absolute;
    inset: 0;
    touch-action: none;
}

.surface-3d-status {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 13px;
    padding: 16px;
    text-align: center;
    pointer-events: none;
}

.surface-3d-status.error {
    color: #e88;
}

/* ── Species panel ─────────────────────────────────────────────────────────
   The selected bat book species' typical calls, drawn at the left of the
   spectrogram on the recording's own time and frequency scale, with the
   species text in a column over the drawing. A clear window in the column
   sits over the drawn calls; the drawing stays put while the text scrolls
   over it, so scrolling covers the calls and scrolling back shows them.
   Its own colour scheme and the dashed edge keep the drawing apart from the
   recording. */
.species-calls {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 6;
    border-right: 1px dashed rgba(255, 255, 255, 0.45);
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.5);
}
/* Placed after the end of the recording: framed on both sides. */
.species-calls.species-calls-floating {
    border-left: 1px dashed rgba(255, 255, 255, 0.45);
}
/* Text is in the species card: the drawing alone lets clicks through. */
.species-calls.species-calls-drawing-only {
    pointer-events: none;
}
.species-calls-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.species-scroll {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #555 transparent;
}
/* The text blocks are opaque so text scrolled over the drawing covers it. */
.species-text {
    background: #141414;
    color: #ddd;
    font-size: 12px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
}
.species-scroll .species-text {
    padding: 6px 10px;
}
/* SpeciesCalls measures its height to place the window, so a long name
   may wrap here. */
.species-top {
    box-sizing: border-box;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.species-top .species-name,
.species-top .species-sci {
    white-space: normal;
}
/* One row of kinds of call, scrolling sideways, so many kinds don't push
   the calls' window down. */
.species-top .species-forms {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.species-top .species-form-btn {
    flex-shrink: 0;
}
/* Pinned: once scrolled to the top of the column the name and kinds of
   call stay there, so the text scrolling under them always says which
   species and which kind of call it is about. It starts at the top of the
   column, or under the window when it doesn't fit above the calls. */
.species-scroll .species-top {
    position: sticky;
    top: 0;
    z-index: 1;
}
.species-bottom {
    border-top: 1px solid #2a2a2a;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.species-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    color: #999;
    font-size: 11px;
}
.species-pos {
    flex: 1;
    text-align: center;
    white-space: nowrap;
}
.species-step,
.species-close {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    min-width: 24px;
    min-height: 24px;
    padding: 0;
    border-radius: 4px;
}
.species-step:hover,
.species-close:hover {
    color: #fff;
    background: #2a2a2a;
}
.species-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.species-sci {
    color: #aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Kinds of call: one choice at a time; the chosen one is filled. */
.species-forms {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.species-form-btn {
    background: #222;
    color: #ccc;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    padding: 3px 8px;
    min-height: 24px;
    cursor: pointer;
}
.species-form-btn:hover {
    background: #2e2e2e;
    color: #fff;
}
.species-form-btn.sel {
    background: #2a4a6a;
    color: #fff;
}
/* A kind with no drawable shape: listed, its text muted. */
.species-form-btn.undrawn {
    color: #888;
    font-style: italic;
}
.species-facts {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.species-muted {
    color: #888;
    font-size: 11px;
}
.species-warn {
    color: #cc9;
}
.species-desc {
    color: #bbb;
}
.species-details-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: #9ab;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 0;
    min-height: 24px;
}
.species-details-btn:hover {
    color: #cde;
}
.species-details {
    color: #aaa;
    font-size: 11px;
}
.species-details p {
    margin: 0 0 6px;
}
.species-sources {
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.species-sources a {
    color: #9ab;
    text-decoration: none;
    overflow-wrap: anywhere;
}
.species-sources a:hover {
    text-decoration: underline;
}
.species-draft {
    font-style: italic;
}
/* Species card (SpeciesInfoCard): a sheet from the bottom of the screen,
   opened by the bat book's More info button. Same sheet as the Hear sheet,
   narrower on wide screens. */
.species-card-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 44;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.species-card-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.species-card {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-width: 560px;
    margin: 0 auto;
    max-height: 80vh;
    overflow-y: auto;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #161616;
    border: 1px solid #3a3a3a;
    border-bottom: 0;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.7);
    padding: 6px 12px calc(14px + env(safe-area-inset-bottom, 0px));
    font-size: 13px;
    z-index: 45;
    transform: translateY(105%);
    transition: transform 0.2s ease;
}
.species-card.open {
    transform: translateY(0);
}
/* Pinned head: species, step buttons and kinds of call stay while the
   rest scrolls under them. */
.species-card-head {
    position: sticky;
    top: -6px;
    z-index: 1;
    background: #161616;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 4px;
}
.species-card .species-name {
    font-size: 15px;
}
.species-card .species-forms {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}
.species-card .species-form-btn {
    flex-shrink: 0;
}
/* Height matches CARD_SKETCH_H in species_panel.rs. */
.species-card-sketch {
    display: block;
    width: 100%;
    height: 150px;
    flex-shrink: 0;
}

/* ── HFR tutorial (src/components/hfr_tour.rs, js/hfr-tour.js) ─────────────
   driver.js ships a white popover; these rules give it the app's dark panel
   look (.layer-panel colours) so it reads as part of the app. The class is
   doubled to win over driver.css, which loads later. */
.driver-popover.oversample-tour.oversample-tour {
    background: rgba(22, 22, 22, 0.98);
    color: #ddd;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    padding: 12px 14px;
    min-width: 220px;
    /* Narrow enough on a phone to sit beside the 64px frequency gutter. */
    max-width: min(300px, calc(100vw - 96px));
}
/* White, not the amber that marks HFR as on. */
.driver-popover.oversample-tour .driver-popover-title {
    font-size: 15px;
    color: #fff;
}
.driver-popover.oversample-tour .driver-popover-description {
    font-size: 13px;
    color: #ccc;
}
.driver-popover.oversample-tour .driver-popover-progress-text {
    color: #999;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
/* Same fill as the app's primary button (.add-files-btn.primary-btn). 32px
   tall so it is an easy tap on a phone. */
.driver-popover.oversample-tour .driver-popover-footer-btn {
    background: #2b3a6a;
    border: 1px solid #3d4f8a;
    color: #e6ecff;
    font-size: 13px;
    padding: 6px 14px;
    min-height: 32px;
    border-radius: 4px;
    text-shadow: none;
}
.driver-popover.oversample-tour .driver-popover-footer-btn:hover,
.driver-popover.oversample-tour .driver-popover-footer-btn:focus-visible {
    background: #354a85;
    border-color: #4a5fa0;
    color: #fff;
}
.driver-popover.oversample-tour .driver-popover-close-btn {
    color: #888;
    width: 32px;
    height: 32px;
    font-size: 20px;
}
.driver-popover.oversample-tour .driver-popover-close-btn:hover,
.driver-popover.oversample-tour .driver-popover-close-btn:focus-visible {
    color: #fff;
}
/* The arrow takes its colour from the border on the popover's side. */
.driver-popover.oversample-tour .driver-popover-arrow {
    border-color: rgba(22, 22, 22, 0.98);
}
.driver-popover.oversample-tour .driver-popover-arrow-side-left {
    border-top-color: transparent; border-bottom-color: transparent; border-right-color: transparent;
}
.driver-popover.oversample-tour .driver-popover-arrow-side-right {
    border-top-color: transparent; border-bottom-color: transparent; border-left-color: transparent;
}
.driver-popover.oversample-tour .driver-popover-arrow-side-top {
    border-bottom-color: transparent; border-left-color: transparent; border-right-color: transparent;
}
.driver-popover.oversample-tour .driver-popover-arrow-side-bottom {
    border-top-color: transparent; border-left-color: transparent; border-right-color: transparent;
}

/* ── Card above Play: "playing at 1:1 without HFR" ─────────────────────────
   A PopupPanel (portalled, position: fixed) anchored to .hfr-nudge-anchor:
   an empty box at the toolbar's top edge, in line with Play's left edge
   (the toolbar's 12px padding). Absolute, so it takes no room in the
   toolbar's wrapping flex rows and Play does not move. */
.hfr-nudge-anchor {
    position: absolute;
    left: 12px;
    top: 0;
    width: 0;
    height: 0;
}
.layer-panel.hfr-nudge {
    /* Under the phone Hear sheet (45) and its backdrop (44), so opening Hear
       covers the card; menus (50) still open over it. */
    z-index: 43;
    padding: 10px 12px 10px;
    /* 12px from each edge on a phone: the anchor is 12px from the left. */
    width: min(400px, calc(100vw - 24px));
    white-space: normal;
    /* The card opens while sound is playing and was easy to miss (owner,
       2026-11-19): a blue border, and two pulses of a blue ring as it opens,
       then it stays still. Only box-shadow moves: PopupPanel measures the
       panel's box to place it. */
    border-color: #4a5fa0;
    animation: hfr-nudge-ring 0.9s ease-out 0.15s 2;
}
.hfr-nudge-body {
    animation: hfr-nudge-fade 0.2s ease-out;
}
@keyframes hfr-nudge-ring {
    0% { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7), 0 0 0 0 rgba(127, 156, 245, 0.85); }
    100% { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7), 0 0 0 16px rgba(127, 156, 245, 0); }
}
@keyframes hfr-nudge-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* "HFR is on": the card moves to just under the HFR button (owner,
   2026-11-20: put it near the button and highlight it). The anchor is an
   empty fixed box that hfr_tour.rs keeps over the button. The card is
   filled with the primary-button blue, so it reads as joined to the ring
   on the button. */
.hfr-nudge-btn-anchor {
    position: fixed;
    pointer-events: none;
}
.layer-panel.hfr-nudge.hfr-nudge-under-btn {
    width: min(340px, calc(100vw - 24px));
    background: #2b3a6a;
    border-color: #7f9cf5;
    backdrop-filter: none;
}
.hfr-nudge-under-btn .hfr-nudge-text {
    color: #fff;
}
.hfr-nudge-under-btn .hfr-nudge-close {
    color: #c5d0f5;
}
.hfr-nudge-under-btn .hfr-nudge-close:hover {
    background: #354a85;
}
/* While the card says "press the HFR button", the HFR control has a blue
   ring, which pulses twice at the start. Drawn inside the control's edge,
   because the Hear bar scrolls sideways on phones and would clip a ring
   outside it. */
body.hfr-nudge-on .hfr-switch {
    outline: 2px solid #7f9cf5;
    outline-offset: -1px;
    animation: hfr-nudge-cell 0.9s ease-out 2;
}
@keyframes hfr-nudge-cell {
    0% { outline-width: 4px; }
    100% { outline-width: 2px; }
}
@media (prefers-reduced-motion: reduce) {
    .layer-panel.hfr-nudge,
    .hfr-nudge-body,
    body.hfr-nudge-on .hfr-switch {
        animation: none;
    }
}
.hfr-nudge-text {
    margin: 0 28px 10px 0;
    text-wrap: balance;
    font-size: 13px;
    line-height: 1.4;
    color: #ddd;
}
.hfr-nudge-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}
.hfr-nudge-btn {
    font: inherit;
    font-size: 13px;
    min-height: 32px;
    padding: 5px 12px;
    border-radius: 4px;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #ddd;
    cursor: pointer;
}
.hfr-nudge-btn:hover {
    background: #333;
    color: #fff;
}
.hfr-nudge-btn.primary {
    background: #2b3a6a;
    border-color: #3d4f8a;
    color: #e6ecff;
}
.hfr-nudge-btn.primary:hover {
    background: #354a85;
    border-color: #4a5fa0;
    color: #fff;
}
/* The rare choice: plain text, pushed to the far end of the row. */
.hfr-nudge-link {
    font: inherit;
    font-size: 12px;
    min-height: 32px;
    margin-left: auto;
    padding: 0 2px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
}
.hfr-nudge-link:hover {
    color: #ddd;
    text-decoration: underline;
}
.hfr-nudge-close {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 4px;
    color: #888;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.hfr-nudge-close:hover {
    color: #fff;
    background: #2a2a2a;
}
/* Ring round the control a tutorial step points at: the dimming alone left
   small grey targets such as HFR hard to find. Same blue as the primary
   buttons in the popover. */
.driver-active .driver-active-element {
    outline: 2px solid #7f9cf5;
    outline-offset: 2px;
}

/* The hand that acts out a tutorial step's drag (js/hfr-tour.js): it presses
   the strip, drags along it, lifts off, and starts again. Large on purpose, so the
   step reads as "drag here" before the text is read. Above driver's overlay
   (10000) and below its popover, so it never covers the instructions. It
   takes no pointer events: the user drags the strip under it. */
.tour-gesture {
    position: fixed;
    z-index: 100000;
    width: 0;
    height: 0;
    pointer-events: none;
    /* Here and not on .tour-hand, so a flipped hand keeps its shadow below. */
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6));
}
.tour-gesture[hidden] {
    display: none;
}
/* The fingertip sits on .tour-gesture's point; the hand leans to the right
   so it lies over the recording and leaves the strip in view. On the time
   strip in a window with no room under it, the hand is flipped to reach down
   from above (.tour-gesture-above). */
.tour-hand {
    position: absolute;
    left: var(--tour-hand-left);
    top: var(--tour-hand-top);
    width: var(--tour-hand-size);
    height: calc(var(--tour-hand-size) * 1.3);
    overflow: visible;
    fill: #fff;
    stroke: #111;
    stroke-width: 4;
    stroke-linejoin: round;
    stroke-linecap: round;
    --tour-hand-lean: rotate(-24deg);
    transform-origin: 46% 4.6%;
    transform: var(--tour-hand-lean);
}
.tour-gesture-above .tour-hand {
    --tour-hand-lean: scaleY(-1) rotate(-24deg);
}
.tour-hand-lines {
    fill: none;
    stroke-width: 3;
}
/* The drag and the press are animated from js/hfr-tour.js, which knows how
   far the hand travels. With reduced motion it starts neither, and the hand
   rests on the strip. */

/* Settings: a checkbox label long enough to wrap. Wrapping keeps the box at
   the right edge, in line with the other Settings checkboxes. */
.setting-label.wraps {
    flex-shrink: 1;
    min-width: 0;
    text-wrap: balance;
}
/* Settings: a value shown just left of its checkbox ("This recording only"). */
.setting-value-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Live BirdNET view (Call detection tab, BirdNET only). Experimental. */
.live-emb {
    padding: 4px 16px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.live-emb-switch {
    display: flex;
    align-items: center;
    gap: 6px;
}
/* A plain grey box, like the other badges (badge style A). */
.live-emb-tag {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 3px;
    background: #3a3a3a;
    color: #ccc;
}
.live-emb-readout {
    /* Room for the name and two lines below it, so the charts under it do
       not jump as the text changes. */
    min-height: 52px;
    font-size: 12px;
    color: #ccc;
    font-variant-numeric: tabular-nums;
}
.live-emb-name {
    font-size: 14px;
    color: #50dc96;
}
.live-emb-score {
    color: #ddd;
}
.live-emb-none {
    color: #aaa;
}
/* The part of the file a paused reading is of ("12.4s to 15.4s"), in
   front of the species name. */
.live-emb-range {
    font-size: 11px;
    color: #64a0ff;
}
.live-emb-next {
    font-size: 11px;
    color: #999;
}
.live-emb-strip {
    width: 100%;
}
/* Above the map: the layout choice (the app's segmented buttons,
   .peak-src-btn) and Full screen. */
.live-emb-tools {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin: 4px 0;
}
.live-emb-seg {
    display: flex;
    align-items: center;
}
/* 24 px tall: the smallest size that is easy to press. */
.live-emb-tools button {
    white-space: nowrap;
    min-height: 24px;
}
.live-emb-full-btn {
    padding: 2px 8px;
    font-size: 11px;
    border: 1px solid #444;
    border-radius: 3px;
    background: #1a1a1a;
    color: #999;
    cursor: pointer;
}
.live-emb-full-btn:hover {
    background: #252525;
    color: #ddd;
}
/* Square, so the map is not stretched. */
.live-emb-map {
    width: 100%;
    aspect-ratio: 1;
    max-height: 340px;
    border: 1px solid #2c2c2c;
    border-radius: 3px;
}
/* Overlays on the species map: names, the ring on the nearest species, the
   list of species near the pointer and the colour key. They do not take the
   pointer, so panning and zooming the map still work through them. A kept
   list (.kept) does take it, for its Close and find-recordings buttons. */
.live-emb-map {
    position: relative;
}
/* The species, on a canvas under the chart's own layers. */
.live-emb-species {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}
.live-emb-labels,
.live-emb-near-ring,
.live-emb-near,
.live-emb-key {
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
    z-index: 2;
}
.live-emb-near-ring {
    display: none;
    width: 12px;
    height: 12px;
    margin: -7px 0 0 -7px;
    border: 1.5px solid #fff;
    border-radius: 50%;
}
.live-emb-near {
    display: none;
    z-index: 3;
    max-width: 200px;
    padding: 4px 7px;
    background: #262626;
    border: 1px solid #444;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.3;
    color: #ddd;
}
.live-emb-near.kept {
    pointer-events: auto;
}
.live-emb-near-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
    font-size: 11px;
    color: #9a9a9a;
}
.live-emb-near-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.live-emb-near-row + .live-emb-near-row {
    margin-top: 3px;
}
.live-emb-near-name {
    display: block;
}
.live-emb-near-sci {
    display: block;
    font-size: 11px;
    font-style: italic;
    color: #9a9a9a;
}
/* 28 px square: large enough to press with a finger. */
.live-emb-near-close,
.live-emb-near-find {
    flex: none;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 3px;
    background: transparent;
    color: #bbb;
    cursor: pointer;
}
.live-emb-near-close {
    margin-right: -5px;
    font-size: 16px;
    line-height: 1;
}
.live-emb-near-close:hover,
.live-emb-near-find:hover {
    background: #3a3a3a;
    color: #fff;
}
/* Colour key on the large map while a component colours it. */
.live-emb-key {
    display: none;
    left: 4px;
    top: auto;
    bottom: 4px;
    align-items: center;
    gap: 3px;
    padding: 1px 5px;
    border-radius: 3px;
    background: rgba(26, 26, 26, 0.85);
    font-size: 10px;
    color: #bbb;
}
.live-emb-key span:first-child {
    margin-right: 3px;
    color: #ddd;
}
.live-emb-key i {
    width: 9px;
    height: 9px;
}

/* Component maps under the species map: four or more to a row (the
   column count is set by live-embedding.js, pcColumns). Each is a button
   that colours the large map; the selected one has a light border. */
.live-emb-pcs {
    position: relative;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-top: 4px;
}
.live-emb-pc {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.live-emb-pc canvas {
    display: block;
}
.live-emb-pc-map {
    border: 1px solid #2c2c2c;
    border-radius: 3px;
}
.live-emb-pc:hover .live-emb-pc-map {
    border-color: #555;
}
.live-emb-pc.selected .live-emb-pc-map {
    border-color: #ddd;
}
.live-emb-pc.selected .live-emb-pc-label {
    color: #ddd;
}
.live-emb-pc-graph {
    margin-top: 2px;
}
.live-emb-pc-label {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 9px;
    overflow: hidden;
    color: #9a9a9a;
    white-space: nowrap;
}
.live-emb-pie {
    flex: none;
}
.live-emb-pc-tip {
    max-width: 100%;
    font-size: 11px;
}
.live-emb-tip-line {
    margin-top: 2px;
}
.live-emb-swatch {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 4px;
}

/* Full screen: the view fills the window, the map on the right as large as
   the window's height allows, the text, strip and component maps in a
   column on the left. z-index 900: above the sidebars (200), below the
   dialogs (1000). */
.live-emb-chart.live-emb-full {
    position: fixed;
    inset: 0;
    z-index: 900;
    box-sizing: border-box;
    padding: 12px 16px;
    overflow: auto;
    background: #1a1a1a;
    display: grid;
    grid-template-columns: minmax(240px, 440px) 1fr;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
        "readout tools"
        "strip map"
        "pcs map";
    gap: 6px 16px;
    align-content: start;
}
.live-emb-full .live-emb-readout { grid-area: readout; }
.live-emb-full .live-emb-strip { grid-area: strip; }
.live-emb-full .live-emb-tools { grid-area: tools; align-self: end; }
.live-emb-full .live-emb-pcs { grid-area: pcs; align-self: start; }
.live-emb-full .live-emb-map {
    grid-area: map;
    justify-self: center;
    width: min(100%, calc(100vh - 90px));
    max-height: none;
}
/* Narrow windows (phones): one column, the map first. */
@media (max-width: 700px) {
    .live-emb-chart.live-emb-full {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: none;
        grid-template-areas: "tools" "map" "readout" "strip" "pcs";
    }
    .live-emb-full .live-emb-map {
        width: 100%;
    }
}

/* Live explorer tab (experimental). */
.live-exp {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 12px 12px;
}
.live-exp-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.live-exp-download {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}
.live-exp-panel {
    margin-top: 8px;
}
.live-exp-title {
    font-size: 12px;
    color: #ddd;
}
.live-exp-note,
.live-exp-empty,
.live-exp-mapinfo {
    font-size: 11px;
    color: #999;
}
.live-exp-empty:empty {
    display: none;
}
.live-exp-empty {
    padding: 12px 0;
    font-style: italic;
}
.live-exp-chart-spectrum { height: 150px; }
.live-exp-chart-top { height: 60px; }
.live-exp-chart-map { width: 100%; aspect-ratio: 1; max-height: 360px; }
.live-exp-chart-sim { width: 100%; height: 200px; }
.live-exp-chart-emb { height: 200px; }
.live-exp-mapbar {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin: 4px 0;
}
/* The selected mode, as the app marks other selected buttons. */
.live-exp-mapbar .psd-btn.active {
    background: #2f5f47;
    color: #fff;
}

/* Where the open file's annotations are saved (annotation_storage.rs), under
   the Annotations heading and in an annotation's menu. Same size and colour
   as the panel's notes. Row 2 (Google Drive) is a grey button that opens the
   Drive settings; it keeps one height through every upload state so the
   list below does not move after each save. */
.annotation-storage {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 0 16px 6px;
    font-size: 11px;
    color: #999;
    line-height: 1.4;
}
.canvas-overflow-info .annotation-storage {
    padding: 0;
}
/* The menu sizes to its content: hold the width of the longest Drive state
   ("Waiting to upload to Google Drive") so the menu does not shrink when an
   upload finishes. */
.canvas-overflow-info .annotation-storage:has(.annotation-storage-drive) {
    min-width: 200px;
}
.annotation-storage-row {
    max-width: 100%;
}
/* "Also saved in NAME.batm beside the recording": the name shrinks first. */
.annotation-storage-row.with-name {
    display: flex;
    white-space: pre;
}
/* A long recording name is cut; the row's tooltip names the file in full. */
.annotation-storage-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #ccc;
}
/* A link to the Google Drive settings (its text is a state, so not a grey
   button). Full row width and 24px tall: the smallest click target the UI
   checks allow, and no size change when the state text changes. */
.annotation-storage-drive {
    align-self: stretch;
    max-width: 100%;
    min-height: 24px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: #8cf;
    cursor: pointer;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.annotation-storage-drive:hover,
.annotation-storage-drive:focus-visible {
    text-decoration: underline;
}
.annotation-storage .drive-warning,
.annotation-storage-drive.drive-warning {
    color: #fc8;
}
/* After a merge of this browser's copy with the Google Drive copy
   (merge_notice.rs): same size and grey as the storage line above, so it
   reads as part of it. Amber only for the lines where this browser's version
   was dropped; no box or border, the heading and the Dismiss button set it
   apart. */
.merge-notice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    margin-top: 4px;
    padding: 0 16px 10px;
    font-size: 11px;
    color: #999;
    line-height: 1.4;
}
.merge-notice-heading {
    color: #ccc;
}
.merge-notice-count {
    margin-top: 2px;
}
.merge-notice-row.lost {
    color: #fc8;
}
.merge-notice a {
    color: #8cf;
    text-decoration: none;
}
.merge-notice a:hover,
.merge-notice a:focus-visible {
    text-decoration: underline;
}
/* "Show all N conflicts": a link-style toggle, 24px tall for the click
   target checks. */
.merge-notice-more {
    min-height: 24px;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: #8cf;
    cursor: pointer;
}
.merge-notice-more:hover,
.merge-notice-more:focus-visible {
    text-decoration: underline;
}
/* Grey and small like Group and Ungroup below: dismissing is not the
   panel's main action. 24px tall for the click target checks. */
.merge-notice-dismiss {
    margin-top: 2px;
    min-height: 24px;
    padding: 2px 8px;
}
/* Desktop: "Keep .batm beside recordings in this folder" (the folder's
   .oversample file). A checkbox row in the storage line's grey. */
.annotation-storage-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    cursor: pointer;
}
.annotation-storage-toggle input {
    margin: 0;
}

/* The Show checkbox's cell: the whole cell is the tap target. */
.detection-strip-hit {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    min-height: 24px;
    cursor: pointer;
}
