:root {
    /* Theme palette (Tactical). Each theme below redefines the same base colours. */
    --bg: #05070b;
    --panel-solid: #080c13;
    --accent: #00ff88;      /* UI accent and city-level dots */
    --accent-2: #00e5ff;    /* links, focus, secondary highlights */
    --approx: #ffb703;      /* approximate-location dots */
    --accent-3: #b388ff;    /* a fourth data colour (border controls, refugee sites, sea routes); must stay a plain colour */
    --on-accent: #03140b;   /* text on accent-filled buttons */
    --text: #eef3f8;
    --text-dim: #8b9bb4;
    --text-faint: #5f6d82;
    --red: #ff4d6d;
    --sky: radial-gradient(ellipse at 50% 45%, #0b1622 0%, #05070b 62%);
    /* Derived from the palette */
    --panel: color-mix(in srgb, var(--panel-solid) 80%, transparent);
    --line: rgba(255, 255, 255, 0.07);
    --line-accent: color-mix(in srgb, var(--accent) 22%, transparent);
    --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-glow: color-mix(in srgb, var(--accent) 35%, transparent);
    --approx-soft: color-mix(in srgb, var(--approx) 12%, transparent);
    --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --shadow: 0 14px 40px rgba(0, 0, 0, 0.6);
    --blur: blur(16px) saturate(140%);
    --player-h: 110px; /* updated from JS with the player's real height */
    --rail-w: 232px;   /* right column: theme menu and shortcuts panel share it */
}
/* [data-preview] scopes a palette to one element (the swatches in the theme menu). */
:root[data-theme="satellite"], [data-preview="satellite"] {
    --bg: #02040a; --panel-solid: #0a1220; --accent: #ffd60a; --accent-2: #7ec8ff; --approx: #ff7b54; --on-accent: #1a1400; --accent-3: #c792ea;
    --text-dim: #93a4bd; --text-faint: #5d6b80;
    --sky: radial-gradient(ellipse at 50% 50%, #0a1830 0%, #02040a 60%);
}
:root[data-theme="neon"], [data-preview="neon"] {
    --bg: #0a0214; --panel-solid: #14072a; --accent: #00f0ff; --accent-2: #ff2bd6; --approx: #fff200; --on-accent: #001418; --accent-3: #7dff5a;
    --text-dim: #a99bc7; --text-faint: #6e5f8f;
    --sky: radial-gradient(ellipse at 50% 115%, #4a0b6e 0%, transparent 55%), radial-gradient(ellipse at 50% -15%, #06303f 0%, transparent 50%), #0a0214;
}
:root[data-theme="synthwave"], [data-preview="synthwave"] {
    --bg: #12002a; --panel-solid: #1e0740; --accent: #ff6ec7; --accent-2: #a46bff; --approx: #ffd319; --on-accent: #2a0018; --accent-3: #2de2e6;
    --text-dim: #b39ddb; --text-faint: #7a5fa8;
    --sky: radial-gradient(circle at 50% 64%, #ff2e88 0%, #a1207f 14%, transparent 42%), linear-gradient(#0d0022 0%, #2b0547 58%, #12002a 100%);
}
:root[data-theme="netrunner"], [data-preview="netrunner"] {
    --bg: #000807; --panel-solid: #021412; --accent: #00ffd5; --accent-2: #39ff14; --approx: #ff3864; --on-accent: #00140f; --accent-3: #b388ff;
    --text-dim: #7fb3a9; --text-faint: #4b7a72;
    --sky: radial-gradient(ellipse at 50% 50%, #012a24 0%, #000807 62%);
}
:root[data-theme="replicant"], [data-preview="replicant"] {
    --bg: #0d0602; --panel-solid: #1c0e05; --accent: #ff9e00; --accent-2: #00e0c6; --approx: #ff3c3c; --on-accent: #1a0d00; --accent-3: #7aa2ff;
    --text-dim: #c2a383; --text-faint: #806449;
    --sky: radial-gradient(ellipse at 50% 105%, #6b2a00 0%, transparent 58%), radial-gradient(ellipse at 15% 0%, #2e1406 0%, transparent 45%), #0d0602;
}

/* Theme scenery behind the (transparent) globe canvas, and the netrunner scanlines over it. */
body::before, body::after { content: ''; position: fixed; inset: 0; pointer-events: none; }
body::before { z-index: 0; }
body::after { z-index: 2; }
:root[data-theme="satellite"] body::before {
    opacity: .75;
    background-image:
        radial-gradient(1px 1px at 23px 41px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 157px 13px, #cfe3ff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 91px 177px, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 211px 109px, #ffe9c4 50%, transparent 51%),
        radial-gradient(1px 1px at 61px 229px, #fff 50%, transparent 51%),
        radial-gradient(1.2px 1.2px at 263px 251px, #dfe9ff 50%, transparent 51%);
    background-size: 280px 280px;
}
:root[data-theme="neon"] body::before {
    background-image:
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--accent) 7%, transparent) 0 1px, transparent 1px 48px),
        repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent-2) 7%, transparent) 0 1px, transparent 1px 48px);
    -webkit-mask-image: radial-gradient(ellipse at 50% 50%, transparent 25%, #000 75%); mask-image: radial-gradient(ellipse at 50% 50%, transparent 25%, #000 75%);
}
:root[data-theme="synthwave"] body::before {
    top: 62%;
    background-image:
        repeating-linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, transparent) 0 1px, transparent 1px 64px),
        repeating-linear-gradient(0deg, color-mix(in srgb, var(--accent) 45%, transparent) 0 1px, transparent 1px 36px);
    transform: perspective(260px) rotateX(58deg); transform-origin: 50% 0;
    -webkit-mask-image: linear-gradient(transparent, #000 45%); mask-image: linear-gradient(transparent, #000 45%);
}
:root[data-theme="netrunner"] body::after {
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px);
}
:root[data-theme="replicant"] body::before {
    background: radial-gradient(ellipse at 50% 50%, transparent 40%, color-mix(in srgb, var(--accent) 6%, transparent) 100%);
}

/* Theme menu */
.theme-picker { position: relative; }
.theme-menu { position: absolute; top: calc(100% + 8px); right: 0; width: var(--rail-w); padding: 6px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-accent); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; z-index: 70; }
.theme-menu:not([hidden]) { animation: menuIn .22s cubic-bezier(.2, .8, .2, 1); }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px); } }
.theme-option { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 10px; border: 1px solid transparent; background: transparent; text-align: left; transition: background .12s, border-color .12s; }
.theme-option:hover, .theme-option:focus-visible { background: rgba(255, 255, 255, 0.05); }
.theme-option[aria-checked="true"] { background: var(--accent-soft); border-color: var(--line-accent); }
.theme-swatch { flex-shrink: 0; display: flex; padding: 4px 5px; border-radius: 999px; background: var(--bg); border: 1px solid rgba(255, 255, 255, 0.14); }
.theme-swatch i { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 6px currentColor; }
.theme-swatch i + i { margin-left: -2px; }
.theme-swatch i:nth-child(1) { background: var(--accent); color: var(--accent); }
.theme-swatch i:nth-child(2) { background: var(--accent-2); color: var(--accent-2); }
.theme-swatch i:nth-child(3) { background: var(--approx); color: var(--approx); }
.theme-text { display: flex; flex-direction: column; min-width: 0; }
.theme-text b { font-size: 12px; font-weight: 650; }
.theme-text small { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

* { box-sizing: border-box; margin: 0; padding: 0; user-select: none; }
html, body { height: 100%; min-height: 100dvh; }
body { background: var(--sky); background-color: var(--bg); color: var(--text); font-family: var(--font); overflow: hidden; width: 100vw; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
button:disabled { opacity: .35; cursor: not-allowed; }
[hidden] { display: none !important; }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 30%, transparent) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Globe ---------- */
#globeViz { position: absolute; inset: 0; z-index: 1; touch-action: none; }
.point-tooltip { position: fixed; pointer-events: none; z-index: 80; padding: 7px 11px; border: 1px solid var(--line-accent); border-radius: 10px; background: color-mix(in srgb, var(--panel-solid) 94%, transparent); font-size: 12px; line-height: 1.45; white-space: pre-line; box-shadow: var(--shadow); }
.globe-notice { position: absolute; left: 20px; top: 116px; max-width: min(440px, 85vw); z-index: 5; color: var(--text-dim); background: var(--panel); border: 1px solid var(--line); padding: 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; }

.reticle-container { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 110px; height: 110px; pointer-events: none; z-index: 5; display: flex; align-items: center; justify-content: center; }
.reticle-ring { width: 74px; height: 74px; border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 50%; animation: spin 30s linear infinite; }
.reticle-dot { position: absolute; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 10px var(--accent); }
.reticle-crosshair { position: absolute; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 40%, transparent), transparent); }
.reticle-crosshair.h { width: 100px; height: 1px; }
.reticle-crosshair.v { width: 1px; height: 100px; background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--accent) 40%, transparent), transparent); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.35); opacity: .55; } }

/* ---------- Shared HUD ---------- */
.hud-overlay { position: absolute; z-index: 10; pointer-events: none; }
.panel, .brand-pill, .search-input, .search-results, .hud-btn, .zoom-btn, .sidebar-panel, .country-drawer, .bottom-player {
    background: var(--panel); border: 1px solid var(--line-accent); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow);
}

/* ---------- Top bar ---------- */
.top-header { z-index: 40; top: 18px; left: 20px; right: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.brand-pill { position: relative; z-index: 3; /* above the search and buttons, for the layer menu */ padding: 9px 16px; border-radius: 16px; display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: pulse 2.2s infinite; }
.brand-title { font: 800 14px var(--mono); letter-spacing: 1.5px; }
.brand-title span { color: var(--accent); }
.brand-stats { font: 10.5px var(--mono); color: var(--text-dim); font-variant-numeric: tabular-nums; margin-top: 1px; }

.search-wrapper { position: relative; pointer-events: auto; width: 440px; display: flex; flex-direction: column; gap: 6px; }
.search-tabs { display: flex; gap: 5px; }
.search-tab { background: color-mix(in srgb, var(--panel-solid) 60%, transparent); border: 1px solid var(--line); color: var(--text-dim); padding: 4px 10px; border-radius: 999px; font: 700 9.5px var(--mono); letter-spacing: .06em; transition: color .15s, border-color .15s, background .15s; }
.search-tab:hover { color: var(--text); border-color: var(--line-accent); }
.search-tab.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--accent); }
.search-input-container { position: relative; }
.search-input { width: 100%; padding: 10px 16px 10px 38px; border-radius: 14px; color: #fff; font-size: 13px; outline: none; user-select: text; transition: border-color .2s, box-shadow .2s; }
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent), var(--shadow); }
.search-icon { position: absolute; z-index: 1; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.search-input:focus + .search-icon, .search-input-container:focus-within .search-icon { color: var(--accent); }
.search-results { position: absolute; top: 72px; left: 0; right: 0; border-radius: 14px; max-height: min(440px, 52dvh); overflow-y: auto; display: none; z-index: 60; overscroll-behavior: contain; }
.search-cat-header { padding: 7px 14px; background: color-mix(in srgb, var(--panel-solid) 92%, transparent); border-bottom: 1px solid var(--line); font: 800 9.5px var(--mono); letter-spacing: .08em; color: var(--accent); position: sticky; top: 0; z-index: 2; }
.search-item { width: 100%; padding: 9px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; transition: background .12s; }
.search-item:hover, .search-item:focus-visible { background: var(--accent-soft); }
.search-item.search-item-station:hover { background: color-mix(in srgb, var(--accent-2) 10%, transparent); }
.search-item-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.search-item-city { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-country { font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-badge { font: 10px var(--mono); color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.search-empty { padding: 12px 14px; }

.action-btns { display: flex; gap: 8px; pointer-events: auto; }
.hud-btn { color: var(--text); padding: 9px 14px; border-radius: 14px; font: 600 11.5px var(--mono); letter-spacing: .03em; display: flex; align-items: center; gap: 6px; transition: border-color .15s, background .15s, color .15s; }
.hud-btn:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.hud-btn.active { color: var(--accent); border-color: var(--accent); }

/* ---------- Sidebar ---------- */
/* Slides down under the open theme menu (--menu-push) and always stops above the zoom buttons:
   256px = 88px header area + 168px zoom column above the player. */
.sidebar-panel { top: calc(88px + var(--menu-push, 0px)); right: 20px; width: var(--rail-w); border-radius: 16px; padding: 12px 14px; pointer-events: auto; display: flex; flex-direction: column; min-height: 48px; max-height: calc(100dvh - var(--player-h) - 256px - var(--menu-push, 0px)); overflow-y: auto; overscroll-behavior: contain; transition: top .28s cubic-bezier(.2, .8, .2, 1), max-height .28s cubic-bezier(.2, .8, .2, 1); }
/* Collapsible body: animating grid rows lets the height follow the content. */
.sidebar-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .28s cubic-bezier(.2, .8, .2, 1); }
.sidebar-panel.collapsed .sidebar-body { grid-template-rows: 0fr; }
.sidebar-inner { min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: 10px; }
.sidebar-inner > :first-child { margin-top: 10px; }
.panel-toggle { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text-dim); transition: color .15s, border-color .15s; }
.panel-toggle:hover { color: var(--accent); border-color: var(--line-accent); }
.panel-toggle svg { transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.panel-toggle[aria-expanded="false"] svg { transform: rotate(180deg); }
.sidebar-title { font: 700 10.5px var(--mono); color: var(--accent); letter-spacing: .1em; text-transform: uppercase; display: flex; align-items: center; justify-content: space-between; }
.capitals-grid { display: flex; flex-direction: column; gap: 4px; }
.capital-pill { width: 100%; display: flex; align-items: center; justify-content: space-between; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); padding: 7px 11px; border-radius: 10px; text-align: left; transition: background .15s, border-color .15s; }
.capital-pill:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.capital-name { font-size: 12px; font-weight: 500; }
.capital-count { font: 10px var(--mono); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-direction: column; gap: 5px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--text-dim); }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.legend-dot.approx { background: var(--approx); box-shadow: 0 0 6px color-mix(in srgb, var(--approx) 40%, transparent); }
.legend-sources { margin-top: 3px; font-size: 9.5px; line-height: 1.45; color: var(--text-faint); }
.legend-sources a { color: var(--text-dim); text-decoration: none; }
.legend-sources a:hover { color: var(--accent-2); text-decoration: underline; }

/* ---------- Zoom ---------- */
.zoom-widget { bottom: calc(var(--player-h) + 30px); right: 20px; display: flex; flex-direction: column; gap: 6px; pointer-events: auto; z-index: 20; }
.zoom-btn { width: 38px; height: 38px; border-radius: 12px; color: var(--accent); font: 700 18px var(--mono); display: grid; place-items: center; transition: background .15s, border-color .15s; }
.zoom-btn:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); }

/* ---------- Country drawer ---------- */
.country-drawer { top: 96px; left: 20px; bottom: calc(var(--player-h) + 50px); min-height: 150px; width: clamp(300px, 24vw, 380px); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; pointer-events: auto; z-index: 25; animation: slideIn .22s ease-out; }
@keyframes slideIn { from { transform: translateX(-24px); opacity: 0; } }
.country-drawer-header { padding: 13px 15px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.country-drawer-title { font: 800 14px var(--mono); }
.country-drawer-sub { font: 10.5px var(--mono); color: var(--accent); margin-top: 2px; }
.country-drawer-close { background: none; border: none; color: var(--text-dim); font-size: 15px; padding: 4px 6px; border-radius: 8px; }
.country-drawer-close:hover { color: var(--red); }
.country-cities-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.country-city-item { width: 100%; padding: 8px 11px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; transition: background .15s, border-color .15s; }
.country-city-item:hover { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.country-city-name { font-size: 12px; font-weight: 600; display: flex; align-items: baseline; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-city-name.approx { color: var(--approx); }
.country-city-name small { font: 9px var(--mono); color: var(--text-faint); text-transform: uppercase; letter-spacing: .06em; }
.country-city-badge { font: 10px var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.load-more { justify-content: center; margin-top: 4px; }

/* ---------- Bottom player (compact) ---------- */
.bottom-player {
    bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
    width: min(760px, calc(100vw - 32px)); border-radius: 18px; padding: 9px 12px 9px 9px;
    pointer-events: auto; display: flex; flex-direction: column; gap: 6px;
    transition: border-color .3s, box-shadow .3s;
}
.bottom-player.is-live { border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--shadow), 0 0 26px color-mix(in srgb, var(--accent) 12%, transparent); }
.player-row { display: flex; align-items: center; gap: 12px; }
.controls-group { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.btn-play { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--on-accent); border: 0; display: grid; place-items: center; font-size: 15px; box-shadow: 0 0 18px var(--accent-glow); transition: transform .15s, box-shadow .15s; }
.btn-play:hover:not(:disabled) { transform: scale(1.06); box-shadow: 0 0 26px var(--accent); }
.btn-icon { width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); display: grid; place-items: center; font-size: 10px; transition: border-color .15s, color .15s; }
.btn-icon:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

.station-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.station-header { display: flex; align-items: center; gap: 8px; min-width: 0; }
.station-title { font-size: 15px; font-weight: 650; letter-spacing: -0.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status-badge { flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; font: 700 9px/1 var(--mono); letter-spacing: .08em; padding: 4px 7px; border-radius: 999px; color: var(--text-dim); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-badge.live { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.status-badge.live .status-dot { animation: pulse 1.2s infinite; }
.status-badge.buffering { color: var(--approx); background: var(--approx-soft); border-color: color-mix(in srgb, var(--approx) 35%, transparent); }
.status-badge.buffering .status-dot { animation: pulse .7s infinite; }
.status-badge.error { color: var(--red); background: rgba(255, 77, 109, 0.1); border-color: rgba(255, 77, 109, 0.35); }
.station-location { font-size: 12px; color: var(--text-dim); display: flex; align-items: baseline; gap: 5px; min-width: 0; white-space: nowrap; overflow: hidden; }
.station-location-city { color: var(--accent); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.station-location-city.approx { color: var(--approx); }
.station-location-city.approx::after { content: " ≈"; }
.station-tech { font: 10px var(--mono); color: var(--text-faint); margin-left: 4px; }
.station-tech:empty { display: none; }

.right-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.playback-indicator { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.playback-indicator i { width: 3px; height: 3px; border-radius: 1px; background: var(--text-faint); transition: height .2s; }
.playback-indicator.active i { background: var(--accent); animation: eq .9s ease-in-out infinite alternate; }
.playback-indicator.active i:nth-child(2) { animation-delay: -.3s; }
.playback-indicator.active i:nth-child(3) { animation-delay: -.6s; }
.playback-indicator.active i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { from { height: 3px; } to { height: 14px; } }
.volume-control { display: flex; align-items: center; gap: 6px; width: 96px; font-size: 12px; cursor: pointer; }
.volume-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 3px; background: rgba(255, 255, 255, 0.18); border-radius: 2px; outline: none; cursor: pointer; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.volume-slider::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--accent); }
.btn-mini { width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03); color: var(--text-dim); display: inline-grid; place-items: center; font-size: 13px; text-decoration: none; transition: color .15s, border-color .15s; }
.btn-mini:hover { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 50%, transparent); }

.player-detail { font-size: 11px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; user-select: text; }
.audio-consent { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 10px; border-radius: 11px; background: color-mix(in srgb, var(--accent) 5%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); }
.audio-consent span { font-size: 11px; line-height: 1.35; color: var(--text-dim); flex: 1; }
.consent-btn { flex-shrink: 0; background: var(--accent); color: var(--on-accent); border: 0; border-radius: 8px; padding: 7px 12px; font: 700 10px var(--mono); letter-spacing: .06em; }
.consent-btn:hover { box-shadow: 0 0 16px var(--accent-glow); }

.stations-drawer { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 7px; min-width: 0; }
.station-filter { flex: 0 0 150px; min-width: 0; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); font-size: 11px; outline: none; user-select: text; }
.station-filter:focus { border-color: var(--accent); }
.station-chips { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; overscroll-behavior: contain; padding: 1px 18px 1px 2px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.station-chips::-webkit-scrollbar { display: none; }
.station-tag { flex-shrink: 0; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); color: var(--text-dim); transition: color .12s, border-color .12s, background .12s; }
.station-tag:hover { color: #fff; border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.station-tag.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); font-weight: 650; }
.station-tag.more { color: var(--accent-2); }
.station-empty { font-size: 11px; color: var(--text-faint); padding: 5px 0; }

/* ---------- Layer picker (radio, SDR, repeaters, navigation, OSINT) ---------- */
.mode-picker { position: relative; flex-shrink: 0; margin-left: 4px; }
.mode-current { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-accent); background: var(--accent-soft); color: var(--accent); font: 700 10px var(--mono); letter-spacing: .06em; white-space: nowrap; }
.mode-current:hover { border-color: var(--accent); }
#modeIcon { font-size: 14px; }
.mode-caret { font-size: 9px; opacity: .7; }
/* Nested inside the blurred title bar, where a second backdrop blur has no effect: use a solid panel. */
.mode-menu { left: 0; right: auto; width: 270px; max-height: min(72dvh, 620px); overflow-y: auto; background: color-mix(in srgb, var(--panel-solid) 97%, transparent); }
.mode-menu .dir-sub:first-child { margin-top: 2px; }
.mode-icon { flex-shrink: 0; width: 30px; text-align: center; font-size: 17px; }
/* Live loads in the side panel */
/* Live loads sit in the list panel, which every screen size shows (the right panel is hidden on small screens). */
.dir-live { display: flex; flex-direction: column; gap: 5px; padding: 6px 10px; border-bottom: 1px solid var(--line); }
.live-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.live-row .live-btn { flex: 0 1 auto; max-width: 62%; padding: 6px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-row .live-status { flex: 1; min-width: 0; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-info { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--text-dim); font: italic 700 11px Georgia, serif; }
.live-info:hover, .live-info[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.live-note { font-size: 10px; line-height: 1.4; color: var(--text-faint); }
.dir-live[hidden] { display: none; }
.dir-live .live-status { color: var(--accent); font-family: var(--mono); }
.dir-live .live-status:empty { display: none; }
.live-btn { justify-content: center; font-size: 10.5px; padding: 8px 10px; }
.live-status { color: var(--text-dim); }
/* Search tabs in SDR mode carry the colour of their receiver type. */
.search-tab[style*="--type-color"]::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--type-color); vertical-align: 1px; }
.dir-badge { color: var(--type-color); background: color-mix(in srgb, var(--type-color) 14%, transparent); }
.capital-pill.active { border-color: var(--line-accent); background: var(--accent-soft); }
.capital-name .legend-dot { display: inline-block; margin-right: 7px; vertical-align: 0; }

/* Directory explorer (SDR, repeaters): the left drawer shows the selected item, then the list. */
.dir-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; margin-bottom: 8px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--type-color) 40%, transparent); background: color-mix(in srgb, var(--type-color) 7%, transparent); }
.dir-card-head { display: flex; align-items: center; gap: 8px; }
.dir-type { font: 700 9px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--type-color); border: 1px solid color-mix(in srgb, var(--type-color) 45%, transparent); padding: 2px 7px; border-radius: 999px; }
.dir-star { font: 700 9px var(--mono); letter-spacing: .06em; color: var(--approx); }
.dir-card-title { font-size: 14px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; user-select: text; }
.dir-card-place { font-size: 11.5px; color: var(--text-dim); }
.dir-facts { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 11px; }
.dir-facts dt { font: 10px var(--mono); color: var(--text-faint); text-transform: uppercase; letter-spacing: .05em; }
.dir-facts dd { overflow-wrap: anywhere; }
.dir-open { display: block; margin-top: 4px; padding: 9px 12px; border-radius: 10px; text-align: center; text-decoration: none; background: var(--type-color); color: var(--bg); font: 700 11px var(--mono); letter-spacing: .08em; }
.dir-open.secondary { background: transparent; color: var(--type-color); border: 1px solid color-mix(in srgb, var(--type-color) 45%, transparent); padding: 7px 12px; }
.dir-open:hover { filter: brightness(1.12); box-shadow: 0 0 18px color-mix(in srgb, var(--type-color) 45%, transparent); }
.dir-note { font-size: 10px; line-height: 1.4; color: var(--text-faint); }
.dir-sub { margin: 6px 2px 2px; font: 700 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.dir-item { width: 100%; display: flex; align-items: flex-start; gap: 9px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.025); text-align: left; transition: background .15s, border-color .15s; }
.dir-item:hover, .dir-item.active { border-color: color-mix(in srgb, var(--type-color) 50%, transparent); background: color-mix(in srgb, var(--type-color) 9%, transparent); }
.dir-dot { flex-shrink: 0; width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--type-color); box-shadow: 0 0 6px color-mix(in srgb, var(--type-color) 60%, transparent); }
.dir-item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dir-item-name { font-size: 12px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.dir-item-sub { font-size: 10.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dir-footer { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.dir-link { padding: 3px 2px; font-size: 11px; color: var(--accent-2); text-decoration: none; }
.dir-link:hover { text-decoration: underline; }

/* ---------- Loader ---------- */
.loader-splash { position: absolute; inset: 0; background: var(--bg); z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; }
.loader-radar { width: 76px; height: 76px; border: 2px solid var(--accent); border-radius: 50%; position: relative; box-shadow: 0 0 25px var(--accent-glow); animation: spin 2s linear infinite; }
.loader-radar::before { content: ''; position: absolute; top: 50%; left: 50%; width: 36px; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); transform-origin: left center; }
.loader-text { font: 12px var(--mono); letter-spacing: 2px; color: var(--accent); text-transform: uppercase; max-width: 85vw; text-align: center; line-height: 1.6; }

/* ---------- Responsive ---------- */
@media (max-width: 1050px) {
    .top-header { flex-wrap: wrap; }
    .search-wrapper { width: min(440px, 48vw); }
    .sidebar-panel { display: none; }
    .action-btns { position: absolute; left: 0; top: 66px; }
    .country-drawer { top: 130px; }
    .globe-notice { top: 170px; }
}
@media (max-width: 640px) {
    .top-header { top: max(10px, env(safe-area-inset-top)); left: 8px; right: 8px; gap: 8px; }
    .brand-pill { width: 100%; justify-content: center; gap: 9px; padding: 7px 10px; }
    /* The title and the layer button share one row on phones. */
    .brand-title { letter-spacing: .5px; white-space: nowrap; } .mode-picker { margin-left: 0; } .mode-current { padding: 5px 8px; }
    /* The layer menu spans the title bar (its containing block once the picker is static). */
    .mode-picker { position: static; } .mode-menu { left: 0; right: 0; width: auto; top: calc(100% + 6px); max-height: 68dvh; }
    .brand-title { font-size: 12.5px; } .brand-stats { font-size: 9.5px; }
    .search-wrapper { width: 100%; margin-top: 34px; }
    /* Up to six tabs (repeater modes): they scroll sideways instead of squeezing. */
    .search-tabs { gap: 4px; overflow-x: auto; scrollbar-width: none; } .search-tabs::-webkit-scrollbar { display: none; } .search-tab { flex: 1 0 auto; font-size: 8.5px; padding: 5px 8px; }
    .action-btns { top: 52px; right: 0; justify-content: center; } .hud-btn { font-size: 10px; padding: 6px 11px; }
    .bottom-player { width: calc(100vw - 16px); padding: 8px 10px 8px 8px; border-radius: 16px; bottom: max(8px, env(safe-area-inset-bottom)); }
    .player-row { gap: 9px; }
    .btn-play { width: 40px; height: 40px; } .btn-icon { width: 27px; height: 27px; }
    .station-title { font-size: 13.5px; } .station-location { font-size: 11px; }
    .station-tech, .volume-control, .playback-indicator { display: none; }
    .player-detail { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .audio-consent span { font-size: 10px; }
    .station-filter { flex-basis: 108px; }
    .zoom-widget { right: 8px; bottom: calc(var(--player-h) + 34px); gap: 5px; } .zoom-btn { width: 34px; height: 34px; }
    /* Bottom sheet above the player: the globe stays visible in the upper half. */
    .country-drawer { left: 8px; right: 8px; width: auto; top: auto; bottom: calc(var(--player-h) + 16px); height: min(46dvh, calc(100dvh - var(--player-h) - 200px)); min-height: 150px; }
    .globe-notice { top: 210px; font-size: 11px; }
    .reticle-container { width: 80px; height: 80px; } .reticle-ring { width: 52px; height: 52px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Live TV dock ---------- */
.tv-btn[aria-pressed="true"] { border-color: color-mix(in srgb, var(--red) 70%, transparent); color: var(--text); box-shadow: 0 0 16px color-mix(in srgb, var(--red) 25%, transparent); }
.tv-dock { right: 20px; bottom: calc(var(--player-h) + 30px + var(--ticker-h, 0px)); width: min(460px, 36vw); z-index: 30; pointer-events: auto;
    display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-accent);
    backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow), 0 0 40px color-mix(in srgb, var(--red) 8%, transparent); }
.tv-dock[hidden] { display: none; }
.tv-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tv-title { display: flex; align-items: center; gap: 6px; font: 800 10.5px var(--mono); letter-spacing: .12em; color: var(--red); flex-shrink: 0; }
.tv-live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 10px var(--red); animation: tv-pulse 1.6s ease-in-out infinite; }
@keyframes tv-pulse { 50% { opacity: .35; box-shadow: 0 0 2px var(--red); } }
.tv-now { flex: 1; min-width: 0; font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-tools { display: flex; gap: 3px; flex-shrink: 0; }
.tv-tool { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text); font-size: 12px; display: grid; place-items: center; }
.tv-tool:hover { border-color: var(--accent); color: var(--accent); }
.tv-tool[hidden] { display: none; }
.tv-wall { display: grid; gap: 6px; }
.tv-dock.grid .tv-wall { grid-template-columns: 1fr 1fr; }
.tv-wall[hidden], .tv-consent[hidden] { display: none; }
.tv-screen { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 11px; overflow: hidden; outline: 1px solid var(--line); }
.tv-screen[hidden] { display: none; }
.tv-dock.grid .tv-screen { cursor: pointer; }
.tv-screen.focus { outline: 2px solid var(--accent); box-shadow: 0 0 18px var(--accent-glow); }
.tv-screen video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tv-label { position: absolute; top: 7px; left: 7px; max-width: calc(100% - 14px); padding: 2px 8px; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff;
    font: 700 10px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.tv-label:empty { display: none; }
.tv-msg { position: absolute; inset: auto 0 0 0; padding: 18px 10px 9px; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); color: #dfe6ee; font-size: 11px; text-align: center; pointer-events: none; }
.tv-screen[data-state="live"] .tv-msg, .tv-screen[data-state="idle"] .tv-msg { display: none; }
.tv-screen[data-state="error"] .tv-msg { color: #ffb3c0; }
.tv-consent { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 14px; border-radius: 12px; border: 1px dashed var(--line-accent); text-align: center; font-size: 12px; color: var(--text-dim); }
.tv-langs, .tv-channels { display: flex; gap: 5px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.tv-langs::-webkit-scrollbar, .tv-channels::-webkit-scrollbar { display: none; }
.tv-lang { flex: 0 0 auto; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--text-dim); font: 700 9.5px var(--mono); }
.tv-lang.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.tv-channels { max-height: 92px; flex-wrap: wrap; overflow-y: auto; }
.tv-chan { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 5px 9px; border-radius: 10px; border: 1px solid var(--line);
    background: rgba(255, 255, 255, .03); color: var(--text); font-size: 11px; text-align: left; }
.tv-chan small { font: 9px var(--mono); color: var(--text-dim); }
.tv-chan:hover { border-color: var(--accent); }
.tv-chan.on { border-color: color-mix(in srgb, var(--red) 70%, transparent); background: color-mix(in srgb, var(--red) 10%, transparent); }
.tv-note { font-size: 9.5px; line-height: 1.4; color: var(--text-faint); }
.tv-dock.small { width: min(320px, 36vw); }
.tv-dock.small .tv-wall, .tv-dock.small .tv-langs, .tv-dock.small .tv-channels, .tv-dock.small .tv-note, .tv-dock.small .tv-consent { display: none; }
.tv-dock:fullscreen { width: 100vw; height: 100vh; border-radius: 0; padding: 14px; background: #000; }
.tv-dock:fullscreen .tv-wall { flex: 1; min-height: 0; }
.tv-dock:fullscreen .tv-screen { aspect-ratio: auto; height: 100%; }
.tv-dock:fullscreen.grid .tv-screen { height: auto; }
.tv-dock:fullscreen .tv-channels { max-height: 54px; }
/* The zoom buttons, the right panel and the list make room for the dock and the ticker. */
body:has(#tvDock:not([hidden])) .zoom-widget { right: calc(min(460px, 36vw) + 32px); }
body:has(#tvDock.small:not([hidden])) .zoom-widget { right: calc(min(320px, 36vw) + 32px); }
body:has(#tvDock:not([hidden])) .sidebar-panel { max-height: calc(100dvh - var(--player-h) - var(--tv-h, 0px) - var(--ticker-h, 0px) - 136px - var(--menu-push, 0px)); }
body:has(#newsTicker:not([hidden])) { --ticker-h: 44px; }
body:has(#newsTicker:not([hidden])) .zoom-widget { bottom: calc(var(--player-h) + 30px + var(--ticker-h)); }
body:has(#newsTicker:not([hidden])) .country-drawer { bottom: calc(var(--player-h) + 50px + var(--ticker-h)); }

/* ---------- News ticker ---------- */
.news-ticker { bottom: calc(var(--player-h) + 22px); left: 50%; transform: translateX(-50%); width: min(760px, calc(100vw - 32px)); height: 34px; z-index: 12;
    display: flex; align-items: center; gap: 8px; padding: 0 6px 0 12px; border-radius: 999px; pointer-events: auto; overflow: hidden;
    background: var(--panel); border: 1px solid var(--line-accent); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow); }
.news-ticker[hidden] { display: none; }
.ticker-label { display: flex; align-items: center; gap: 6px; flex-shrink: 0; font: 800 10px var(--mono); letter-spacing: .12em; color: var(--red); }
.ticker-track { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); mask-image: linear-gradient(90deg, transparent, #000 3%, #000 97%, transparent); }
.ticker-move { display: flex; gap: 26px; width: max-content; animation: ticker var(--ticker-s, 60s) linear infinite; }
.ticker-track:hover .ticker-move, .ticker-track:focus-within .ticker-move { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-50%); } }
.ticker-item { display: inline-flex; align-items: baseline; gap: 7px; padding: 4px 0; background: none; border: 0; color: var(--text); font-size: 12px; white-space: nowrap; cursor: pointer; }
.ticker-item:hover .ticker-text { color: var(--accent); }
.ticker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--type-color, var(--accent)); align-self: center; box-shadow: 0 0 8px var(--type-color, var(--accent)); }
.ticker-src { color: var(--text-dim); font: 9.5px var(--mono); }
@media (prefers-reduced-motion: reduce) { .ticker-track { overflow-x: auto; scrollbar-width: none; } }

@media (max-width: 640px) {
    .tv-dock { left: 8px; right: 8px; width: auto; bottom: calc(var(--player-h) + 16px + var(--ticker-h, 0px)); padding: 8px; border-radius: 16px; }
    .tv-dock.small { width: auto; }
    .tv-channels { max-height: 70px; }
    .tv-now { display: none; }
    body:has(#tvDock:not([hidden])) .zoom-widget { display: none; }
    /* One panel at a time above the player on phones: the TV hides the list until it is closed. */
    body:has(#tvDock:not([hidden])) .country-drawer { display: none; }
    .news-ticker { width: calc(100vw - 16px); bottom: calc(var(--player-h) + 14px); height: 30px; }
    .ticker-item { font-size: 11px; }
    body:has(#newsTicker:not([hidden])) { --ticker-h: 38px; }
    body:has(#newsTicker:not([hidden])) .zoom-widget { bottom: calc(var(--player-h) + 34px + var(--ticker-h)); }
    body:has(#newsTicker:not([hidden])) .country-drawer { bottom: calc(var(--player-h) + 16px + var(--ticker-h)); }
}

/* ---------- List panel: tools, sections, chips, phone sheet ---------- */
.country-drawer { transition: width .25s cubic-bezier(.2, .8, .2, 1), height .25s cubic-bezier(.2, .8, .2, 1); }
.country-drawer.wide { width: min(560px, calc(100vw - var(--rail-w) - 80px)); }
#countryDrawer.folded { bottom: auto !important; min-height: 0; } /* over the ticker rule, whose :has(#id) outranks plain ids */
.country-drawer.folded > :not(.country-drawer-header) { display: none !important; }
.country-drawer-header { gap: 8px; }
.drawer-heading { flex: 1; min-width: 0; }
.country-drawer-title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-tools { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.drawer-tool { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text-dim); font-size: 12px; display: grid; place-items: center; }
.drawer-tool:hover, .drawer-tool[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
.sheet-handle { display: none; }
.country-cities-list { position: relative; }
.dir-section { position: sticky; top: -8px; z-index: 2; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 4px -8px 0; padding: 7px 12px 6px;
    font: 700 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
    background: color-mix(in srgb, var(--panel-solid) 94%, transparent); border-bottom: 1px solid var(--line); }
.dir-section:first-child { margin-top: -8px; }
.dir-section small { font: 600 9.5px var(--mono); color: var(--text-faint); letter-spacing: 0; }
.dir-item-text { flex: 1; }
.dir-badge { flex-shrink: 0; align-self: center; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 6px; border-radius: 999px;
    font: 700 8.5px var(--mono); letter-spacing: .05em; color: var(--type-color); border: 1px solid color-mix(in srgb, var(--type-color) 40%, transparent); }
.dir-badge:empty { display: none; }
.dir-item-snippet { margin-top: 2px; font-size: 10.5px; line-height: 1.35; color: var(--text-faint); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.country-drawer.wide .dir-item-snippet { -webkit-line-clamp: 2; }
.country-drawer.wide .dir-item-name { font-size: 12.5px; }
.dir-item.fresh .dir-dot { animation: tv-pulse 1.6s ease-in-out infinite; }
.list-top { position: absolute; right: 14px; bottom: 14px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-accent);
    background: var(--panel-solid); color: var(--accent); font-size: 15px; box-shadow: var(--shadow); }
.list-top:hover { border-color: var(--accent); }
/* One row of compact filter menus (phones and tablets). */
.dir-chips { display: flex; align-items: center; gap: 6px; padding: 6px 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.dir-chips::-webkit-scrollbar { display: none; }
.chip-select { position: relative; flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 22px 0 9px; border-radius: 999px;
    border: 1px solid var(--line); background: rgba(255, 255, 255, .03); cursor: pointer; }
.chip-select span { flex-shrink: 0; font: 700 8.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.chip-select select { appearance: none; -webkit-appearance: none; max-width: 150px; padding: 0; border: 0; background: none; color: var(--text); text-overflow: ellipsis; cursor: pointer; outline: none; font-size: 11px; font-family: inherit; }
.chip-select select option { background: var(--panel-solid); color: var(--text); }
.chip-select::after { content: '▾'; position: absolute; right: 8px; font-size: 10px; color: var(--text-dim); pointer-events: none; }
.chip-select:focus-within { border-color: var(--accent-2); }
.chip-select.active { border-color: var(--accent); background: var(--accent-soft); }
.chip-select.active select, .chip-select.active::after { color: var(--accent); }
.chip-reset { flex: 0 0 auto; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--red) 50%, transparent); background: none; color: var(--red); font: 700 9.5px var(--mono); letter-spacing: .06em; }

@media (max-width: 1050px) {
    .country-drawer.wide { width: min(520px, calc(100vw - 40px)); }
}
@media (max-width: 640px) {
    /* A bottom sheet: drag or tap the handle (peek: the title only, half, full: up to the header). */
    .country-drawer { height: min(46dvh, calc(100dvh - var(--player-h) - 200px)); }
    .country-drawer[data-sheet="peek"] { height: 76px; min-height: 0; }
    .country-drawer[data-sheet="full"] { height: calc(100dvh - var(--header-bottom, 170px) - var(--player-h) - var(--ticker-h, 0px) - 30px); }
    .country-drawer.dragging { transition: none; }
    .country-drawer[data-sheet="peek"] > :not(.country-drawer-header):not(.sheet-handle) { display: none !important; }
    .country-drawer[data-sheet="peek"] .country-drawer-header { cursor: pointer; border-bottom: 0; }
    .sheet-handle { display: block; flex-shrink: 0; width: 100%; height: 20px; padding: 0; border: 0; background: none; position: relative; touch-action: none; cursor: grab; }
    .sheet-handle::before { content: ''; position: absolute; left: 50%; top: 8px; width: 46px; height: 4px; border-radius: 2px; background: var(--text-faint); transform: translateX(-50%); }
    .sheet-handle:active::before { background: var(--accent); }
    .country-drawer-header { padding: 2px 12px 9px; }
    #drawerWide { display: none; }
    .country-drawer.wide { width: auto; }
    .dir-item { padding: 10px 11px; }
    .dir-item-name { font-size: 13px; }
    .dir-item-snippet { -webkit-line-clamp: 2; }
    .chip-select, .chip-reset { height: 32px; } .chip-select select { font-size: 12px; max-width: 170px; }
    /* The zoom buttons sit above the sheet when it shows only its title, and step aside otherwise. */
    body:has(#countryDrawer:not([hidden])) .zoom-widget { bottom: calc(var(--player-h) + var(--ticker-h, 0px) + var(--drawer-h, 0px) + 26px); }
    body:has(#countryDrawer:not([hidden]):not([data-sheet="peek"])) .zoom-widget { display: none; } /* pinch to zoom meanwhile */
    .list-top { right: 12px; bottom: 12px; }
}

/* ---------- Guide (ⓘ) ---------- */
.guide-btn { width: 37px; padding: 0; justify-content: center; font: italic 800 15px Georgia, serif; }
.guide-btn.pulse { border-color: var(--accent-2); color: var(--accent-2); animation: guidePulse 2.4s ease-in-out 6; }
@keyframes guidePulse { 50% { box-shadow: var(--shadow), 0 0 0 6px color-mix(in srgb, var(--accent-2) 22%, transparent); } }
.guide { width: min(760px, calc(100vw - 32px)); height: min(720px, calc(100dvh - 48px)); max-height: none; /* fixed: the tabs do not resize it */ padding: 0; border-radius: 20px; border: 1px solid var(--line-accent);
    background: color-mix(in srgb, var(--panel-solid) 94%, transparent); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
    color: var(--text); box-shadow: var(--shadow), 0 0 60px color-mix(in srgb, var(--accent) 10%, transparent); overflow: hidden; flex-direction: column; }
.guide[open] { display: flex; margin: auto; inset: 0; animation: menuIn .25s cubic-bezier(.2, .8, .2, 1); } /* margin: the page reset removes the centring */
.guide-head, .guide-tabs { flex-shrink: 0; }
.guide::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
.guide-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 10px 22px; }
.guide-head h2 { margin: 0; font: 800 15px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.guide-head h2::before { content: ''; display: inline-block; width: 9px; height: 9px; margin-right: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); vertical-align: 1px; }
.guide-close { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: none; color: var(--text-dim); }
.guide-close:hover { color: var(--text); border-color: var(--accent); }
.guide-tabs { display: flex; gap: 5px; padding: 0 18px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.guide-tabs::-webkit-scrollbar { display: none; }
.guide-tab { flex-shrink: 0; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: none; color: var(--text-dim); font: 700 10.5px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.guide-tab:hover { color: var(--text); border-color: var(--line-accent); }
.guide-tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.guide-body { flex: 1; min-height: 0; user-select: text; overflow-y: auto; overscroll-behavior: contain; padding: 6px 22px 22px; font-size: 13.5px; line-height: 1.55; }
.guide-section h3 { margin: 18px 0 8px; font: 800 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.guide-section p { margin: 0 0 8px; color: var(--text-dim); }
.guide-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.guide-list li { position: relative; padding-left: 16px; color: var(--text-dim); }
.guide-list li::before { content: ''; position: absolute; left: 2px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: var(--accent-2); }
.guide-list b { color: var(--text); font-weight: 650; }
.guide-group { margin: 14px 0 6px !important; font: 700 9.5px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint) !important; }
.guide-layers { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.guide-layers .guide-group { grid-column: 1 / -1; }
.guide-layer { display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); text-align: left; transition: border-color .15s, background .15s; }
.guide-layer:hover { border-color: var(--line-accent); background: var(--accent-soft); }
.guide-layer-icon { font-size: 18px; line-height: 1.2; }
.guide-layer span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.guide-layer b { font: 700 11px var(--mono); letter-spacing: .06em; color: var(--text); }
.guide-layer small { font-size: 11.5px; line-height: 1.4; color: var(--text-dim); }
.guide-keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; align-items: center; }
.guide-keys dt { justify-self: start; min-width: 30px; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line-accent); border-bottom-width: 2px; background: rgba(255, 255, 255, .03); font: 700 11.5px var(--mono); text-align: center; color: var(--text); }
.guide-keys dd { margin: 0; color: var(--text-dim); }
.guide-sources { margin: 0 0 12px; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.guide-sources a, .guide-body p a { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.guide-sources a:hover, .guide-body p a:hover { text-decoration: underline; }
.guide-sources b { color: var(--text); font-weight: 600; }
.guide-sources em { font-style: normal; color: var(--text-faint); }
@media (max-width: 640px) {
    .guide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; }
    .guide-head { padding: max(12px, env(safe-area-inset-top)) 12px 8px 16px; }
    .guide-tabs { padding: 0 12px 10px; }
    .guide-body { padding: 4px 16px max(18px, env(safe-area-inset-bottom)); font-size: 13px; }
    .guide-layers { grid-template-columns: 1fr; }
}

/* ---------- Links ---------- */
.dir-share { width: 100%; }
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(var(--player-h) + 30px + var(--ticker-h, 0px)); transform: translateX(-50%); margin: 0; padding: 8px 16px; border-radius: 999px;
    background: var(--accent); color: var(--on-accent); font: 700 11px var(--mono); letter-spacing: .06em; box-shadow: var(--shadow); pointer-events: none; animation: toastIn .2s ease-out; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- Compact player (layers other than RADIO) ---------- */
.bottom-player.mini { width: min(480px, calc(100vw - 32px)); padding: 5px 8px 5px 5px; gap: 0; }
.bottom-player.mini :is(.player-detail, .audio-consent, .stations-drawer, .station-location, #btnPrevStation, #btnNextStation, .volume-control, .btn-mini:not(.player-size)) { display: none; }
.bottom-player.mini .btn-play { width: 34px; height: 34px; font-size: 12px; }
.bottom-player.mini .station-title { font-size: 13px; }
.bottom-player.mini .player-row { gap: 10px; }
@media (max-width: 640px) { .bottom-player.mini { width: calc(100vw - 16px); } }

/* ---------- Mirror notice (IPFS gateways that block streams) ---------- */
.mirror-notice { position: fixed; z-index: 45; top: calc(var(--header-bottom, 90px) + 10px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px);
    display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 14px; border-radius: 12px; font-size: 12.5px; line-height: 1.4; color: var(--text);
    background: color-mix(in srgb, var(--panel-solid) 92%, transparent); border: 1px solid color-mix(in srgb, var(--approx) 55%, transparent); box-shadow: var(--shadow); }
.mirror-notice a { color: var(--accent-2); font-weight: 650; text-decoration: none; margin: 0 .25em; }
.mirror-notice a:hover { text-decoration: underline; }
.mirror-close { flex-shrink: 0; margin-left: 8px; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: none; color: var(--text-dim); }
@media (max-width: 640px) { .mirror-notice { width: calc(100vw - 16px); font-size: 11.5px; } }
