/* =====================================================================
   Myna Radio — design system
   One action color (amber orange), "device" panels that follow the theme (LED displays on a dark inset), neutral surfaces.
   Type: Space Grotesk (UI) · JetBrains Mono (labels/data) · Doto (numerals)
   ===================================================================== */

/* Fonts, served from this site (PRELAUNCH-1 #3: no request to Google). Variable fonts: one file per script covers every
   weight used. Latin and Latin Extended only (Romanian, Swedish, …); other scripts fall back to the system font. */
/* Doto, latin-ext */ @font-face { font-family: 'Doto'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/doto-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Doto, latin */ @font-face { font-family: 'Doto'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/doto-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Doto, latin-ext */ @font-face { font-family: 'Doto'; font-style: normal; font-weight: 900; font-display: swap; src: url(fonts/doto-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Doto, latin */ @font-face { font-family: 'Doto'; font-style: normal; font-weight: 900; font-display: swap; src: url(fonts/doto-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* JetBrains Mono, latin-ext */ @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/jetbrains-mono-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* JetBrains Mono, latin */ @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url(fonts/jetbrains-mono-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* JetBrains Mono, latin-ext */ @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/jetbrains-mono-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* JetBrains Mono, latin */ @font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url(fonts/jetbrains-mono-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
/* Space Grotesk, latin-ext */ @font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(fonts/space-grotesk-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
/* Space Grotesk, latin */ @font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(fonts/space-grotesk-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }


:root {
  /* Surfaces (light) */
  --bg: #ecece9;
  --surface: #f7f7f4;
  --surface-2: #e5e5e1;
  --line: #d6d6d0;
  --line-strong: #b9b9b2;
  --line-control: #80807a; /* interactive borders: >= 3:1 on bg, surface and surface-2 (UX-2 #11) */
  --text: #1a1a1c; /* UX-4b2 #4: softer than near-black */
  --muted: #5f5f66;
  --logo-light-ink: var(--night); /* ART-1: white-ink transparent logos fill their frame with night in light only */
  --chip-on: #ffffff;     /* selected chip: a slightly lighter fill than --surface-2 */

  /* Action color */
  --green: #ffb020;          /* the accent (amber by default, ACCENT-1): fills, lit states, glows on black */
  --accent-ink: #8f5200;     /* the accent's darker ink, for text/icons on light backgrounds */
  --green-ink: var(--accent-ink); /* accent text: the ink in light, the accent itself in dark */
  /* The brand mark and the wordmark dot stay amber whatever the accent (ACCENT-1) */
  --brand: #ffb020; --brand-ink: #8f5200;
  /* The six accents a listener can pick in Settings › Appearance (ACCENT-1), fill and ink, in picker order: about 60° apart
     on the hue wheel so no two read alike (owner, 24 Nov), with red left out for errors. Like system colours, each has a
     light value (deeper, saturated, for the pale page) and a dark one (brighter, in the dark blocks below). Contrast, all
     six, tested: black on the fill >= 5.5:1, the fill on a dark card >= 6:1, the ink on the light background >= 4.5:1.
     Applied by :root[data-accent] below (amber is the default and needs no attribute). */
  --accent-amber: #ffb020; --accent-amber-ink: #8f5200;
  --accent-green: #1fc24a; --accent-green-ink: #08732a;
  --accent-teal: #12b8c8; --accent-teal-ink: #00727d;
  --accent-blue: #2f86ff; --accent-blue-ink: #0052cc;
  --accent-purple: #b064f0; --accent-purple-ink: #8a2bc9;
  --accent-pink: #ff3d7f; --accent-pink-ink: #c4125a;
  /* Amber state tints (UX-4b2 #6, docs/design/amber-states.html): a1…a5 of #FFB020, one job per step (UX-10 #6):
     a1 the faint end of a gradient (playing card) and the start of the connecting breathe;
     a2 a selected or playing fill (selected chip, nav tab, segmented option, playing row, live hero buttons);
     a3 one step up on an a2 surface (ON AIR badge in a playing row, pressed chip, the live hero's corner wash);
     a4 the globe's hot bubble only; a5 lines and glows, never behind text. No halos round buttons. */
  --accent-a1: rgba(255, 176, 32, 0.08); --accent-a2: rgba(255, 176, 32, 0.14); --accent-a3: rgba(255, 176, 32, 0.22);
  --accent-a4: rgba(255, 176, 32, 0.32); --accent-a5: rgba(255, 176, 32, 0.56);
  /* The same strengths for a picked accent (ACCENT-1), mixed from --green below; dark has its own */
  --k1: 8%; --k2: 14%; --k3: 22%; --k4: 32%; --k5: 56%; --k-bubble: 22%; --k-bubble-hot: 32%;
  --on-green: #0a0a0b;
  /* Off states inside amber surfaces (UX-10 #4): faded amber, not grey — the live hero's unlit band, its un-pressed
     heart and info icon, the HD badge's outline in a playing row. --dim-k is the lowest mix that keeps ≥ 3:1 against
     the surface in each theme. --accent-dim sits on device panels, --accent-ink-dim on page surfaces. */
  --dim-k: 75%;
  --accent-dim: color-mix(in srgb, var(--device-accent) var(--dim-k), var(--device));
  --accent-ink-dim: color-mix(in srgb, var(--green-ink) var(--dim-k), var(--surface));
  --danger: #ff3b30;
  /* Red text on light surfaces (POLISH-2 #2, "Off air"): danger darkened toward night to keep 4.5:1; danger itself in dark */
  --danger-ink: color-mix(in srgb, var(--danger) 75%, var(--night));
  /* Monogram letters (UX-5 #0): neutral, amber stays for live/selected. Light = --text at 64% on --surface-2
     (#636363, 4.7:1; 60% would be 4.2:1, below AA for the small list tiles); dark = --muted. */
  --mono-ink: #636363;

  /* Night: the near-black of the dark device and of LED displays (same in both themes) */
  --night: #0a0a0b;
  --night-2: #17171a;
  --night-line: #29292e;
  --night-tick: #45454c;
  --night-text: #f2f2ee;
  --night-dim: #83838b;
  --night-peak-off: #2a1413; /* unlit red VU cells */
  /* Level meter (POLISH-2 #1), on the night inset in both themes: unlit dots a step brighter than a2, so the grid reads
     as an instrument when quiet; the row under the red one is orange, amber mixed with red (not a new hue) */
  --vu-off: rgba(255, 176, 32, 0.24);
  --vu-warm: color-mix(in srgb, var(--danger) 45%, var(--brand)); /* stays orange whatever the accent (ACCENT-1) */
  /* Device panels (player, tuner, globe controls) follow the theme (UX-7 C2). Light: a light device —
     surface body, text numerals, muted labels, a hairline; amber text uses the ink. Dark: near-black. LED displays
     (LIVE, VU) stay on a dark inset in both themes so amber still reads as lit. */
  --device: var(--surface);
  --device-2: var(--surface-2);
  --device-line: var(--line);
  --device-text: var(--text);
  --device-dim: var(--muted);
  --device-edge: var(--line);         /* the panel's hairline */
  --device-tick: var(--line-strong);  /* minor dial ticks */
  --device-accent: var(--green-ink);  /* amber text and icons on the panel */
  /* LED accents (TYPE-1 #3): the unlit dots of a dot-matrix display, on its dark inset */
  --led-off: var(--night-line);
  --led-grid: radial-gradient(circle, var(--led-off) 0.9px, transparent 1.2px) 0 0 / 3px 3px;

  /* Globe */
  --globe-bg: radial-gradient(circle at 50% 45%, #fbfbf9 0%, #e6e6e2 75%);
  /* Solid land (UX-5b): flat ocean, land mixed over it from --globe-land, coastline from --globe-border.
     --globe-coast-k is the coastline strength: the lowest that keeps the edge ≥ 3:1 against the ocean. */
  --globe-ocean: var(--surface-2);
  --globe-land: #c4c4bd;
  /* The ground under a picked accent (ACCENT-1): a neutral base with the accent mixed in, as amber's is */
  --globe-land-base: #c4c4bd; --globe-ocean-base: var(--surface-2); --k-land: 12%; --k-ocean: 0%;
  --globe-border: #6d6d73;
  --globe-coast-k: 0.85;
  --globe-atmo: #ffffff;
  /* Station dots and count bubbles. Dark (owner, 10 Oct): the same dots and bubbles as light, in solid amber with
     a soft glow, and bubbles with a stronger fill and a brighter outline so they read on the near-black ocean. */
  --globe-dot: color-mix(in srgb, var(--text) 80%, transparent);
  --globe-dot-glow: none;
  --globe-dot-ink: var(--surface); /* a count inside a dot */
  --globe-halo: var(--surface);    /* around labels on the land */
  --globe-bubble: var(--accent-a3);
  --globe-bubble-hot: var(--accent-a4);
  --globe-bubble-line: var(--accent-a5);
  --quiet-dot: 10px; /* a cluster under 50 stations seen from space (GLOBE-2 #2): a plain dot this size */
  /* Amber tint strength for glows (UX-5 #2): the globe atmosphere mixes toward --green by this much.
     Light keeps a neutral atmosphere (amber haze on white reads as dirt), dark gets a warm halo. */
  --tint-k: 0;
  /* Motion (UX-5 #3): cluster split/merge, camera flights */
  --dur-1: 120ms; /* icon state changes (UX-8 #2) */
  --dur-2: 240ms;
  --dur-3: 600ms;
  --dur-bar: 160ms; /* the phone top bar sliding away and back (TOPBAR-1 #2) */

  --shadow: 0 12px 32px -14px rgba(10, 10, 11, 0.28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.12);
  --shadow-pop: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-sheet: 0 -10px 40px rgba(0, 0, 0, 0.25);
  --shadow-pin: 0 6px 18px rgba(0, 0, 0, 0.35);
  --scrim: rgba(0, 0, 0, 0.5);         /* behind dialogs and sheets */
  --scrim-soft: rgba(10, 10, 11, 0.3); /* hover wash over artwork */
  --scrim-badge: rgba(10, 10, 11, 0.6); /* HD pills on artwork (UI-4 #2): 0.6 keeps --night-text at 4.5:1 even over a white logo */
  --on-danger: #ffffff;

  /* Type */
  /* TYPE-2 #1: the platform UI face for the interface (SF Pro on Apple, Roboto on Android, Segoe UI on Windows);
     Space Grotesk only for the device readouts and the wordmark. */
  --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-device: "Space Grotesk", var(--font);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --dot: "Doto", var(--mono);
  /* Type scale (UX-10 #1): sizes and line-heights on a 4 px grid. Body 15/20; reading text on the legal pages 15/24.
     Readouts (the hero's big numerals) are display sizes, not UI text, and keep their clamp(). */
  --fs-xs: 11px;  --lh-xs: 16px;
  --fs-sm: 13px;  --lh-sm: 16px;
  --fs-md: 15px;  --lh-md: 20px;
  --fs-lg: 17px;  --lh-lg: 24px;  /* group headings: one step above body */
  --fs-xl: 20px;  --lh-xl: 24px;
  --fs-2xl: 24px; --lh-2xl: 28px;
  --fs-3xl: 28px; --lh-3xl: 32px;
  --lh-read: 24px; /* reading text (legal pages) */
  --fs-art-max: 44px;
  /* Weights (TYPE-2 #2; the system face draws heavier than Grotesk): 400 body, sublines, labels and other small text;
     500 is the ceiling for interface text (names, controls, chips, tabs, headings, titles), and a current or selected
     state is carried by colour and the icon fill, not weight. 600 only on the Space Grotesk wordmark, 700 only in the
     LED and data faces (Doto, JetBrains Mono).
     Tracking: tight only on Space Grotesk (readouts, wordmark), caps for mono uppercase kickers and badges, 0 on the
     system face (it applies its own optical tracking). */
  --track-tight: -0.015em;
  --track-normal: 0;
  --track-caps: 0.08em; /* monogram letters are 36 % of their tile, at most this */
  --fs-page: var(--fs-2xl); /* page titles: Browse, Favourites, Recent, Settings, search results (UX-9 #4); 28 px on phones */
  --lh-page: var(--lh-2xl);
  --fs-input: max(16px, 1rem); /* text fields on touch screens: iOS Safari zooms into anything smaller on focus */

  /* Spacing (UX-10 #5): one rhythm on a 4 px grid. Page gutters are 16 px on phones, 24 px on desktop. */
  --text-read: color-mix(in srgb, var(--text) 72%, var(--muted)); /* LEGAL-MIN-2: legal body text, one step below the section titles */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --flag-gap: 6px; /* country flag → its name in a text line (FLAGS-1 #2) */

  /* Shape */
  --r-sm: 10px;
  --vu-px: 3px; --vu-gap: 1.6px; /* one dot of the level meter and the gap between dots (POLISH-2 #1) */
  --r-md: 16px;
  --r-lg: 24px;
  --r-key: 4px; /* a keyboard hint, the search field's "/" (TOPBAR-1 #1) */
  --bar-h: 40px; /* the top bar's search field and country pill (TOPBAR-1 #1; 44 px on phones, #2) */

  --player-h: 80px; /* POLISH-2 #3 */
  --nav-w: 224px;
  --tabs-h: 62px;

  /* Xmas season mode (XMAS-1, docs/DECISIONS.md XMAS-1): red for its button and markers, only while the mode is on, and
     a dark-only snow-globe scene. Same in both themes (the mode is dark only). Used by xmas.js and the .xmas-* rules. */
  --xmas-red: #d5293b;                    /* the pressed button; white on it is 4.99:1 */
  --xmas-on-red: #ffffff;
  --xmas-red-tint: rgba(213, 41, 59, 0.16); /* the button off: a dark red tint… */
  --xmas-red-ring: #ff8a95;               /* …with a light red ring (8.7:1 on the page) */
  --xmas-red-text: #ffd6da;
  --xmas-red-ink: #a3192a;                /* the off button's text and ring on the light page (6:1) */
  --xmas-marker: #ff4d5e;                 /* station dots: red with a dark outline, ≥ 3:1 on frosted land through the outline */
  --xmas-marker-line: #3a0a10;
  --xmas-bubble: #4a0f17;                 /* dark red count bubbles; white count 14:1 */
  --xmas-bubble-line: #ff6b78;
  --xmas-ink: #ffffff;
  --fs-xmas-count: 12px;                  /* counts and labels on the Xmas globe: at least 12 px (XMAS-1 #7) */
  --xmas-night: #07090f;                  /* the card behind the globe */
  --xmas-sea: #0a1426;                    /* the sphere: dark in the middle… */
  --xmas-sea-edge: #1d3358;               /* …slightly lighter at the edge */
  --xmas-land: #dfe7f2;                   /* frosted land */
  --xmas-land-quiet: #c9d4e4;             /* land with no Xmas station */
  --xmas-land-edge: #ffffff;
  --xmas-rim: rgba(255, 255, 255, 0.14);  /* the sphere's hairline */
  --xmas-glow: #3d7bff;                   /* the outer halo */
  --xmas-star: #ffd77a;
  --xmas-star-far: #c8d3f0;
  --xmas-snow: #ffffff;
  --xmas-aurora-1: #39ffa8; --xmas-aurora-1b: #36e3ff; /* four curtains: green to cyan, */
  --xmas-aurora-2: #4b7dff;                            /* blue, */
  --xmas-aurora-3: #b35cff; --xmas-aurora-3b: #ff9e5e; /* magenta to violet with a warm base, */
  --xmas-aurora-4: #ff6fc0;                            /* pink */
  --xmas-tree: #1f8a4c; --xmas-trunk: #7a4a24; --xmas-gold: #ffcf4a;
  --xmas-sleigh: #d83a3a; --xmas-deer: #c89a6a; --xmas-santa: #ffffff;
  --xmas-metal: #d9dde6; --xmas-panel: #4aa8ff; --xmas-ufo-glow: #5dffa0;
  --xmas-fw-1: #ffd36b; --xmas-fw-2: #ff7b8a; --xmas-fw-3: #8fd3ff; --xmas-fw-4: #b9ff9a;
  color-scheme: light;
}

@media (max-width: 820px) { :root { --fs-page: var(--fs-3xl); --lh-page: var(--lh-3xl); } } /* page titles on phones (UX-9 #4) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0c; --surface: #141416; --surface-2: #1c1c1f; --line: #26262a; --line-strong: #38383e; --line-control: #6e6e76;
    --text: #ecece8; --muted: #8c8c93; --green-ink: var(--green); --brand-ink: var(--brand); --mono-ink: var(--muted); --dim-k: 55%;
    --accent-a1: rgba(255, 176, 32, 0.06); --accent-a2: rgba(255, 176, 32, 0.10); --accent-a3: rgba(255, 176, 32, 0.16);
    --accent-a4: rgba(255, 176, 32, 0.24); --accent-a5: rgba(255, 176, 32, 0.40);
    --k1: 6%; --k2: 10%; --k3: 16%; --k4: 24%; --k5: 40%; --k-bubble: 34%; --k-bubble-hot: 50%;
    --logo-light-ink: transparent; --chip-on: #2c2c31;
    --globe-bg: var(--bg); /* UX-5c: the dark planet sits on the page background */
    --globe-ocean: #0e0b08; --globe-land: #241d16; --globe-coast-k: 0.7; /* UX-5c: dark planet, land ~5 % lighter */
    --globe-land-base: #161515; --globe-ocean-base: #090808; --k-land: 6%; --k-ocean: 2%; /* amber at these strengths ≈ the land and ocean above (ACCENT-1) */
    /* The accents' dark-theme fills (ACCENT-1): softer, they glow on black */
    --accent-green: #34d25a; --accent-teal: #40d0de; --accent-blue: #4c9dff; --accent-purple: #c584ff; --accent-pink: #ff5c93;
    --globe-border: #8c8c93; --globe-atmo: #2b2b31; --tint-k: 0.55;
    --globe-dot: var(--green); --globe-dot-glow: 0 0 6px var(--accent-a5); --globe-dot-ink: var(--on-green); --globe-halo: var(--night);
    --globe-bubble: rgba(255, 176, 32, 0.34); --globe-bubble-hot: rgba(255, 176, 32, 0.5); --globe-bubble-line: var(--green);
    --shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.8);
    --device: var(--night); --device-2: var(--night-2); --device-line: var(--night-line); --device-text: var(--night-text); --device-dim: var(--night-dim);
    --device-edge: rgba(255, 255, 255, 0.06); --device-tick: var(--night-tick); --device-accent: var(--green); --danger-ink: var(--danger);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0c; --surface: #141416; --surface-2: #1c1c1f; --line: #26262a; --line-strong: #38383e; --line-control: #6e6e76;
  --text: #ecece8; --muted: #8c8c93; --green-ink: var(--green); --brand-ink: var(--brand); --mono-ink: var(--muted); --dim-k: 55%;
    --accent-a1: rgba(255, 176, 32, 0.06); --accent-a2: rgba(255, 176, 32, 0.10); --accent-a3: rgba(255, 176, 32, 0.16);
    --accent-a4: rgba(255, 176, 32, 0.24); --accent-a5: rgba(255, 176, 32, 0.40);
    --k1: 6%; --k2: 10%; --k3: 16%; --k4: 24%; --k5: 40%; --k-bubble: 34%; --k-bubble-hot: 50%;
  --logo-light-ink: transparent; --chip-on: #2c2c31;
  --globe-bg: var(--bg); /* UX-5c: the dark planet sits on the page background */
  --globe-ocean: #0e0b08; --globe-land: #241d16; --globe-coast-k: 0.7; /* UX-5c: dark planet, land ~5 % lighter */
    --globe-land-base: #161515; --globe-ocean-base: #090808; --k-land: 6%; --k-ocean: 2%; /* amber at these strengths ≈ the land and ocean above (ACCENT-1) */
    /* The accents' dark-theme fills (ACCENT-1): softer, they glow on black */
    --accent-green: #34d25a; --accent-teal: #40d0de; --accent-blue: #4c9dff; --accent-purple: #c584ff; --accent-pink: #ff5c93;
  --globe-border: #8c8c93; --globe-atmo: #2b2b31; --tint-k: 0.55;
  --globe-dot: var(--green); --globe-dot-glow: 0 0 6px var(--accent-a5); --globe-dot-ink: var(--on-green); --globe-halo: var(--night);
  --globe-bubble: rgba(255, 176, 32, 0.34); --globe-bubble-hot: rgba(255, 176, 32, 0.5); --globe-bubble-line: var(--green);
  --shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.8);
  --device: var(--night); --device-2: var(--night-2); --device-line: var(--night-line); --device-text: var(--night-text); --device-dim: var(--night-dim);
  --device-edge: rgba(255, 255, 255, 0.06); --device-tick: var(--night-tick); --device-accent: var(--green); --danger-ink: var(--danger);
  color-scheme: dark;
}

/* The listener's accent (ACCENT-1). Amber, the default, keeps the literal tokens above; a picked accent replaces
   --green and its ink, and its tints are mixed from --green at the same per-theme strengths (--k1…). After the theme
   blocks on purpose: same specificity, so these win. */
:root[data-accent="green"] { --green: var(--accent-green); --accent-ink: var(--accent-green-ink); }
:root[data-accent="teal"] { --green: var(--accent-teal); --accent-ink: var(--accent-teal-ink); }
:root[data-accent="blue"] { --green: var(--accent-blue); --accent-ink: var(--accent-blue-ink); }
:root[data-accent="purple"] { --green: var(--accent-purple); --accent-ink: var(--accent-purple-ink); }
:root[data-accent="pink"] { --green: var(--accent-pink); --accent-ink: var(--accent-pink-ink); }
:root[data-accent] {
  --accent-a1: color-mix(in srgb, var(--green) var(--k1), transparent); --accent-a2: color-mix(in srgb, var(--green) var(--k2), transparent);
  --accent-a3: color-mix(in srgb, var(--green) var(--k3), transparent); --accent-a4: color-mix(in srgb, var(--green) var(--k4), transparent);
  --accent-a5: color-mix(in srgb, var(--green) var(--k5), transparent); --vu-off: color-mix(in srgb, var(--green) 24%, transparent);
  --globe-bubble: color-mix(in srgb, var(--green) var(--k-bubble), transparent); --globe-bubble-hot: color-mix(in srgb, var(--green) var(--k-bubble-hot), transparent);
  /* The ground follows the accent too: dark tints land and ocean the way amber's are tinted today, light warms the land */
  --globe-land: color-mix(in srgb, var(--green) var(--k-land), var(--globe-land-base));
  --globe-ocean: color-mix(in srgb, var(--green) var(--k-ocean), var(--globe-ocean-base));
}

/* LED displays, the ON AIR badge and the brand mark: a dark inset in both themes — the device tokens re-scoped to
   night (UX-7 C2) */
:is(.vu, .brand-mark, .card.playing .art, .card.connecting .art) {
  --device: var(--night); --device-2: var(--night-2); --device-line: var(--night-line); --device-text: var(--night-text);
  --device-dim: var(--night-dim); --device-tick: var(--night-tick); --device-accent: var(--green);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
/* FIX-14 B: no double-tap zoom on iOS (a quick second tap on a heart or a chip scaled the app); pinch zoom stays
   (WCAG 1.4.4), so the viewport meta has no user-scalable / maximum-scale */
html { touch-action: manipulation; }
body {
  background: var(--bg); color: var(--text);
  font: 400 var(--fs-md)/var(--lh-md) var(--font);
  /* TYPE-2 #3: proportional lining figures by default; tabular only on values that change while you watch */
  font-variant-numeric: lining-nums proportional-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
/* Icons (UX-8 #2): Phosphor from the sprite in index.html. One rule everywhere: the regular (outline) weight when off,
   the fill weight when on — a button that is pressed, expanded (its panel or dialog open), the current tab or .on. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic > .f { display: none; }
:is([aria-pressed="true"], [aria-expanded="true"], [aria-current="page"], .active, .on) > .ic > use:not(.f) { display: none; }
:is([aria-pressed="true"], [aria-expanded="true"], [aria-current="page"], .active, .on) > .ic > .f { display: inline; }
/* A favourite's heart settles from 0.9 when it changes (UX-8 #2) */
@keyframes ic-pop { from { transform: scale(0.9); } to { transform: scale(1); } }
[data-fav].pop > .ic { animation: ic-pop var(--dur-1) ease-out; }
@media (prefers-reduced-motion: reduce) { [data-fav].pop > .ic { animation: none; } }
.toggle { display: inline-flex; align-items: center; gap: var(--sp-2); }
.toggle .ic { width: 18px; height: 18px; }
a { color: var(--muted); }
h1, h2, h3 { font-weight: 500; letter-spacing: var(--track-normal); }
b, strong { font-weight: 500; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--green-ink); outline-offset: 2px; border-radius: var(--r-sm); }

/* Shared text styles */
/* One label voice per surface (UX-10 #8): mono caps only for true data (badges, LED readouts, band data);
   section headings and kickers above lists ("Trending in Sweden now", "Top pick", "Genre") are system-UI sentence case */
.mono {
  font: 500 var(--fs-xs)/var(--lh-xs) var(--mono); letter-spacing: var(--track-caps); text-transform: uppercase;
}
.label, .t-kicker, .gp-kicker, .d-row dt {
  font: 400 var(--fs-sm)/var(--lh-sm) var(--font); letter-spacing: var(--track-normal); text-transform: none; color: var(--muted);
}
.link { color: var(--green-ink); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.live-dot {
  display: inline-block; width: 7px; height: 7px; margin-right: var(--sp-2); border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green); vertical-align: 1px;
  animation: pulse 1.4s infinite;
}
@keyframes pulse { 50% { opacity: 0.4; } }

/* ---------- Layout ---------- */
.app {
  display: grid; grid-template-columns: var(--nav-w) 1fr;
  min-height: 100vh; padding-bottom: var(--player-h);
}
.main { min-width: 0; padding: var(--sp-5) var(--sp-6) var(--sp-8); } /* 24 px gutters on desktop, 16 on phones (UX-10 #5) */

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; height: calc(100vh - var(--player-h));
  display: flex; flex-direction: column; gap: var(--sp-1);
  padding: var(--sp-6) var(--sp-4); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-3) var(--sp-6); }
/* The app icon's mark (icons/icon.svg), drawn in CSS: amber ring and dot on the night square, the same symbol in both
   themes (DEEPTEST-1 #15). In dark the square is near the page colour, so a --night-line hairline keeps its edge. */
.brand-mark {
  position: relative; width: 30px; height: 30px; border-radius: 7px; background: var(--device);
  box-shadow: inset 0 0 0 1px var(--device-line);
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; border-radius: 50%; }
.brand-mark::before { inset: 5px; border: 2.4px solid var(--brand); }
.brand-mark::after { inset: 11.6px; background: var(--brand); }
.brand-name { font-family: var(--font-device); font-size: var(--fs-xl); font-weight: 600; letter-spacing: var(--track-tight); }
/* Wordmark (RENAME-1), two options for the owner to pick from (data-wordmark on .brand):
   (a) the amber-ring tile, "myna" in --text and "radio" lighter in --muted;
   (b) "myna" alone, closed by a small amber dot (--device-accent: amber ink in light, amber in dark). */
.wm { display: inline-flex; align-items: baseline; gap: 0.26em; }
.wm-myna { font-family: var(--font-device); font-weight: 600; letter-spacing: var(--track-tight); color: var(--text); }
.wm-radio { font-weight: 400; color: var(--muted); }
.wm-dot { display: none; width: 0.28em; height: 0.28em; border-radius: 50%; background: var(--brand-ink); }
[data-wordmark="b"] :is(.brand-mark, .wm-radio) { display: none; }
[data-wordmark="b"] .wm { gap: 0.08em; }
[data-wordmark="b"] .wm-dot { display: inline-block; }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3); border-radius: var(--r-sm);
  color: var(--muted); font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-a2); color: var(--green-ink); } /* UX-4b2 #6, a2 since UX-10 #6 */
.nav-item:active { background: var(--accent-a3); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; gap: var(--sp-2); align-items: center;
  padding: var(--sp-3) 0 var(--sp-4);
  background: linear-gradient(var(--bg) 72%, transparent);
}
/* The pills are 40 px to look at, the fields in them 44 px to hit (TOPBAR-1 #1): each input overflows its pill by 2 px
   above and below, invisibly */
.search, .cpick {
  height: var(--bar-h); background: var(--surface-2); border: 1px solid var(--line-control); border-radius: 999px;
  transition: border-color 0.15s;
}
.search {
  flex: 1; min-width: 0; max-width: 480px; display: flex; align-items: center; gap: var(--sp-2); padding: 0 var(--sp-4); color: var(--muted);
}
.search:focus-within, .cpick:focus-within { border-color: var(--text); }
.search input {
  flex: 1; min-width: 0; height: 44px; background: none; border: 0; outline: 0; color: var(--text); font: inherit;
}
/* The "/" shortcut, shown at the field's end until it's in use (TOPBAR-1 #1); touch screens have no key to press */
.search-key {
  flex: none; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 var(--sp-1);
  font: 500 var(--fs-xs) / 1 var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: var(--r-key);
}
.search:focus-within .search-key, .search:has(input:not(:placeholder-shown)) .search-key { display: none; }
@media (pointer: coarse) { .search-key { display: none; } }

/* Xmas season mode (XMAS-1 #2): the top-bar button, only in the page while the season switch is on. Off: a dark red
   tint with a light red ring; on: solid red, white text and a check, so the state doesn't rely on colour. */
.xmas-btn {
  flex: none; display: inline-flex; align-items: center; gap: var(--sp-2); height: 44px; padding: 0 var(--sp-4);
  border-radius: 999px; background: var(--xmas-red-tint); box-shadow: inset 0 0 0 1px var(--xmas-red-ring);
  color: var(--xmas-red-text); font-weight: 500; transition: background var(--dur-1), color var(--dur-1);
}
:root[data-theme="light"] .xmas-btn:not([aria-pressed="true"]) { color: var(--xmas-red-ink); box-shadow: inset 0 0 0 1px var(--xmas-red-ink); }
.xmas-btn .ic { width: 20px; height: 20px; }
.xmas-btn .xmas-check { display: none; width: 18px; height: 18px; }
.xmas-btn[aria-pressed="true"] { background: var(--xmas-red); color: var(--xmas-on-red); box-shadow: none; }
.xmas-btn[aria-pressed="true"] .xmas-check, .xmas-btn[aria-pressed="true"] .xmas-check > use { display: inline; } /* the check has no fill weight */
.xmas-btn:focus-visible { outline: 2px solid var(--xmas-red-ring); outline-offset: 2px; }
.xmas-btn.compact { padding: 0; width: 44px; justify-content: center; }
.xmas-btn.compact .xmas-lbl, .xmas-btn.compact .xmas-check { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (prefers-reduced-motion: reduce) { .xmas-btn { transition: none; } }

/* Country search. On the right edge of the bar (UI-3), search keeps its place and width; DOM order is the visual order */
.cpick { position: relative; width: 250px; flex: none; margin-left: auto; }
.cpick input {
  position: absolute; left: -1px; right: -1px; top: 50%; height: 44px; transform: translateY(-50%);
  padding: 0 38px 0 46px; background: none; border: 0; border-radius: 999px; color: var(--text); font: inherit; outline: 0; text-overflow: ellipsis;
}
.cpick-flag { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); display: flex; color: var(--muted); pointer-events: none; }
.cpick-flag .ic { width: 20px; height: 20px; }
.cpick-caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: transform 0.2s; }
.cpick input[aria-expanded="true"] ~ .cpick-caret { transform: translateY(-50%) rotate(180deg); }
/* Phones only (TOPBAR-1 #2): the country's ISO code in the chip, the search button and Cancel */
.cpick-code, .cpick-btn, .search-open, .search-cancel { display: none; }
.cpick-list {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 40;
  width: 320px; max-height: min(420px, 60vh); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: var(--sp-1) 0; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow);
}
/* Rows (UX-11 B2): roomier through height, flag and spacing, not an off-grid size. 48 px in the dropdown, 56 px in the
   phone sheet, a hairline between rows; the count is the number only (the row's name says "stations"). */
.cpick-list li { display: flex; align-items: center; gap: var(--sp-3); min-height: 48px; padding: var(--sp-3) var(--sp-4); border-radius: 0; cursor: pointer; }
.cpick-list li + li { border-top: 1px solid var(--line); }
.cpick-list li[aria-selected="true"], .cpick-list li:active { background: var(--surface-2); }
.cpick-list li.current .co-name { color: var(--green-ink); font-weight: 500; }
.co-flag { display: grid; place-items: center; flex: none; width: 28px; height: 28px; }
.co-check { display: flex; flex: none; color: var(--green-ink); }
.co-check .ic { width: 20px; height: 20px; }
.co-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* "Use my location" (GLOBE-2 #3): the picker's first row, the Phosphor outline icon where a flag would be, a line under it */
.co-locate .ic { width: 20px; height: 20px; color: var(--muted); }
.co-locate .co-name { font-weight: 500; }
.co-empty { color: var(--muted); cursor: default !important; }

/* Settings (UX-8 #4): the theme choice, out of the header. A gear button with the footer links; its small menu opens
   above it. */

/* ---------- Buttons ---------- */
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  color: var(--muted); transition: color 0.15s, background 0.15s;
}
.icon-btn:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.btn {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 44px; padding: 0 var(--sp-5); border-radius: 999px;
  background: var(--green); color: var(--on-green); font-weight: 500;
  transition: transform 0.15s, filter 0.15s;
}
.btn svg { width: 20px; height: 20px; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(0.97); }
.btn .i-stop { display: block; }

/* ---------- Hero: tuner + tiles ---------- */
.hero {
  display: grid; gap: var(--sp-3); margin-bottom: var(--sp-5); align-items: stretch; /* + the chips' 4 px = 24 to the first chip */
  /* UX-4b L2: the hero is the one now-playing surface; Trending sits beside it */
  grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr);
  grid-template-areas: "tuner trend";
}
.device {
  background: var(--device); color: var(--device-text);
  border: 0; border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--device-edge);
}
.tuner { grid-area: tuner; display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-5); min-width: 0; }
/* One hero at both widths (UX-10 #9): logo, kicker + name + genre line, then the readout beside info / favourite / play.
   Width goes to whitespace and the readout, not more widgets: no channel scale, counter, Stereo or format line. */
.t-kicker { display: block; margin: 0 0 var(--sp-1); color: var(--device-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-main { display: flex; align-items: flex-start; gap: var(--sp-4); min-width: 0; }
.t-art { width: 96px; height: 96px; --art-r: var(--r-md); flex: none; }
/* Fixed text block (UX-4b3 #4): kicker + 2 title lines + the genre line, so its height never changes; the genre line
   follows the title directly (a 1-line name leaves the space below) */
.t-read {
  --tn: var(--fs-3xl); --tln: var(--lh-3xl); flex: 1; min-width: 0; display: flex; flex-direction: column;
  height: calc(var(--lh-sm) + var(--sp-1) + var(--tln) * 2 + var(--sp-1) + var(--lh-md));
}
.t-name {
  margin: 0; font-size: var(--tn); line-height: var(--tln); font-weight: 500; letter-spacing: var(--track-normal); flex: none;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: balance;
}
.t-sub { margin: var(--sp-1) 0 0; height: var(--lh-md); font-size: var(--fs-md); line-height: var(--lh-md); color: var(--device-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Readout (TYPE-1 #1, TYPE-2 #3): the band pair over Space Grotesk Light numerals, proportional figures, dimmed leading zeros, a quiet
   unit; sized from the footer's width (40 px on a 326 px phone footer, up to 56 px on desktop). No data = the format. */
.t-foot { display: flex; flex-wrap: nowrap; align-items: flex-end; gap: var(--sp-1); min-height: 56px; container-type: inline-size; color: var(--device-dim); }
.t-ph { --t-big: clamp(24px, 37.7cqi - 71px, 56px); display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; margin-right: auto; } /* --t-big: the readout's size and line, so the format label keeps the same height */
.t-big { display: flex; align-items: baseline; gap: var(--sp-1); color: var(--device-text); }
.t-place { gap: var(--sp-2); } /* "Stockholm 14:32": the place, then the time (UX-10 #10) */
.t-num { font: 300 var(--t-big)/var(--t-big) var(--font-device); letter-spacing: var(--track-tight); font-variant-numeric: lining-nums proportional-nums; }
.t-clock { font-variant-numeric: lining-nums tabular-nums; } /* the place readout's clock ticks: tabular, so it doesn't jitter */
.t-zero { color: var(--device-dim); opacity: 0.55; }
.t-unit { font: 400 var(--fs-sm)/1 var(--font-device); color: var(--device-dim); }
.t-big.idle .t-num { color: var(--device-dim); } /* nothing playing: dimmed (UX-7 B2) */
.t-fmt { font: 500 var(--fs-md)/var(--t-big) var(--font); color: var(--device-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 40 px = the readout's line */
/* Info and favourite: 44 px icon buttons; play: the 56 px amber disc. Their labels are the aria-labels */
.tuner .t-info, .tuner #hero-fav { flex: none; width: 44px; height: 44px; padding: 0; display: inline-grid; place-items: center; border-radius: 50%; background: transparent; color: var(--device-dim); }
.tuner .t-info:hover:not(:disabled), .tuner #hero-fav:hover { background: var(--device-2); color: var(--device-text); }
.tuner #hero-fav svg { width: 22px; height: 22px; }
.tuner #hero-fav.on { color: var(--device-accent); }
.tuner #hero-play { display: inline-flex; flex: none; width: 56px; height: 56px; padding: 0; justify-content: center; border-radius: 50%; }
.tuner .btn-text { display: none; }

/* Tiles */
.tile {
  position: relative; display: flex; flex-direction: column; gap: var(--sp-1); min-width: 0; overflow: hidden;
  padding: var(--sp-4) var(--sp-4); border-radius: var(--r-lg);
  background: var(--surface); border: 0;
}
.tile .label { color: var(--muted); }
.tile .mono { opacity: 0.7; }
.tile-trend { grid-area: trend; }
/* Beside the top card (UX-9 #7): the top card alone sets the row's height and the tile fills it; app.js shows as many
   rows as fit (up to 6) and spreads them over the height, so there is no empty band at the bottom */
@media (min-width: 1101px) {
  .tile-trend { contain: size; }
  .tile-trend .tile-rows { flex: 1; min-height: 0; overflow: hidden; align-content: space-between; }
}
.tile-rows { display: grid; gap: 2px; margin: var(--sp-1) calc(-1 * var(--sp-2)) -6px; }
.row.mini { padding: var(--sp-1) var(--sp-2); gap: var(--sp-2); min-height: 44px; }
.row.mini .row-art { width: 32px; height: 32px; }
.row.mini .row-name { font-size: var(--fs-sm); }

/* Level meter (POLISH-2 #1): an 8 × 7 dot matrix on the night inset. Columns are bands, low on the left; rows 1–5
   light amber, row 6 orange, row 7 red. The top lit dot fades in by fraction (app.js sets its opacity), the peak dot
   is night-text (rows 6–7 keep their colour). Unlit dots stay visible. */
/* Columns by the bar's room (UI-2 #1; app.js reads --vu-cols): 16 on a narrow desktop, 32 from 1200 px, 14 on a phone
   (1.5 times the old 8 at 390 px), 10 below 360 px so the name keeps its room */
.vu { --vu-cols: 16; display: inline-flex; align-items: flex-end; gap: var(--vu-gap); padding: 6px 8px; border-radius: var(--r-sm); background: var(--night); flex: none; }
@media (min-width: 1200px) { .vu { --vu-cols: 32; } }
@media (max-width: 820px) { .vu { --vu-cols: 14; } }
@media (max-width: 359px) { .vu { --vu-cols: 10; } }
.vu-band { display: flex; flex-direction: column-reverse; gap: var(--vu-gap); }
.vu i { width: var(--vu-px); height: var(--vu-px); border-radius: 50%; background: var(--vu-off); }
.vu i.warm { background: color-mix(in srgb, var(--vu-warm) 30%, var(--night)); }
.vu i.hot { background: color-mix(in srgb, var(--danger) 30%, var(--night)); }
.vu i.on { background: var(--green); box-shadow: 0 0 4px color-mix(in srgb, var(--green) 55%, transparent); }
.vu i.warm.on { background: var(--vu-warm); box-shadow: 0 0 4px color-mix(in srgb, var(--vu-warm) 55%, transparent); }
.vu i.hot.on { background: var(--danger); box-shadow: 0 0 4px color-mix(in srgb, var(--danger) 55%, transparent); }
.vu i.pk { background: var(--night-text); box-shadow: none; }
.vu i.warm.pk { background: var(--vu-warm); }
.vu i.hot.pk { background: var(--danger); }
/* The meter moves with the state (POLISH-2 #2): connecting and rebuffering light dim amber, no glow; rebuffering
   breathes; off air is a flatline with the bottom row dim red */
/* (a5 at its light-theme strength in both themes: the meter is always on night, where dark's a5 sits too close to --vu-off) */
.vu:is([data-state="conn"], [data-state="buf"]) i.on { background: color-mix(in srgb, var(--green) 56%, transparent); box-shadow: none; }
.vu[data-state="buf"] i.on { animation: vu-breathe 1.6s ease-in-out infinite; }
@keyframes vu-breathe { 50% { opacity: 0.75; } }
.vu i.dead { background: color-mix(in srgb, var(--danger) 60%, var(--night)); box-shadow: none; }

/* ---------- Chips, section head, tools ---------- */
.chips {
  display: flex; gap: var(--sp-2); overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(-1 * var(--sp-6)) var(--sp-5); padding: 2px var(--sp-6);
}
.chips::-webkit-scrollbar { display: none; }
/* One treatment for the chip strip, the toolbar and the search field (UX-10 #6): --surface-2 fill and a 1 px --line edge
   (drawn inset, so the select's transparent hit-area border stays). The search field's edge is --line-control: a text
   field needs a 3:1 edge to be found. Sentence case Space Grotesk; selected = a2 fill + amber ink. */
.chip, .toggle, .tools select, .more {
  height: 36px; padding: 0 var(--sp-4); border-radius: 999px;
  background: var(--surface-2); border: 0; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted);
  font: 500 var(--fs-sm) var(--font);
  transition: color 0.15s, background 0.15s;
}
.chip { flex: none; }
/* A count after a label is a quiet number, not a "·" (UX-9 #2, #3) */
.chip .n { color: var(--muted); font-weight: 400; font-variant-numeric: lining-nums proportional-nums; }
.chip[aria-pressed="true"] .n { color: inherit; }
.chip, .toggle, .tools select { white-space: nowrap; } /* "HQ only" on one line, never "HQ / only" (DEEPTEST-1 #7) */
/* Hover stays neutral; selected = a3 fill + accent-ink; pressed = a4 (UX-4b2 #6) */
.chip:hover, .toggle:hover, .more:hover { color: var(--text); background: color-mix(in srgb, var(--surface-2) 85%, var(--text)); }
.chip:active, .toggle:active { background: var(--accent-a3); color: var(--green-ink); }

.section-head { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-4); }
/* One heading scale (UX-9 #4): every page title at --fs-page, group headings inside a page one step down (--fs-lg) */
.section-head h2, .results-title, .settings-h { margin: 0; font-size: var(--fs-page); line-height: var(--lh-page); letter-spacing: var(--track-normal); }
/* One way to show a count (UX-9 #3): "65 stations", sentence case, quiet, no badge */
.count { font: 400 var(--fs-sm)/var(--lh-sm) var(--font); color: var(--muted); font-variant-numeric: lining-nums proportional-nums; letter-spacing: var(--track-normal); text-transform: none; white-space: nowrap; }
.count:empty { display: none; }
.tools { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }
.tools select {
  appearance: none; cursor: pointer; padding-right: 34px; color: var(--text);
  background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2383838b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center / 18px;
}

/* ---------- Station tiles & cards ---------- */
.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art {
  position: relative; display: grid; place-items: center; overflow: hidden; flex: none;
}
.art > *, .t-art > *, .p-art > *, .row-art > *, .gc-art > *, .g-pin-art > * { grid-area: 1 / 1; }
/* Artwork frames (ART-1, ART-2). The frame is the surface (--surface-2 + one --line hairline, the inset shadow) in both
   themes; no logo has a plate behind it, and the frame's rounded corners clip it. One rule for every size (ART-2):
   The logo's kind, flat edge colour and aspect come from the nightly manifest (LOGO-1: /logo/meta, data-logo, data-fill,
   data-shape, --ar), set before the picture loads.
   - Transparent and unclassified logos are contained with a 12 % inset, so wordmarks are never cropped or
     pressed against the edge. White-ink transparent logos would vanish on the light frame, so in light they fill it
     with --night.
   - Logos with their own background (data-logo="opaque") that are roughly square (data-shape="square")
     fill the frame edge to edge; its radius rounds them.
   - Wider or taller ones are contained on their own edge colour when that edge is flat (data-fill, inline background),
     so the tile reads as one rounded shape; otherwise contained with a 6 % inset, the <img> box sized to the picture's
     own aspect (--ar) and rounded concentric with the frame (frame radius minus the inset, at least 4 px).
   The frame radius is --art-r, on the scale: --r-sm for 32 to 56 px tiles, --r-md for 72 to 96 px and grid cards. */
:where(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) { --art-r: var(--r-sm); border-radius: var(--art-r); container-type: inline-size; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img {
  position: relative; width: 100%; height: 100%; object-fit: contain; padding: 12%; border-radius: 0; background: none;
}
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-logo="opaque"] { padding: 0; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-logo="opaque"]:not([data-fill]) { padding: 6%; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-logo="opaque"][data-shape="square"] { padding: 0; object-fit: cover; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-logo="opaque"]:not([data-fill]):is([data-shape="wide"], [data-shape="tall"]) {
  padding: 0; object-fit: fill; aspect-ratio: var(--ar); border-radius: max(4px, calc(var(--art-r) - 6cqi));
}
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-logo="opaque"]:not([data-fill])[data-shape="wide"] { width: 88%; height: auto; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-logo="opaque"]:not([data-fill])[data-shape="tall"] { width: auto; height: 88%; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-logo="light"] { background: var(--logo-light-ink); }
/* Unclassified logos (no manifest entry yet) may have their own background,
   so their picture is rounded too (owner, 19 Oct: "no sharp corners"): the <img> box takes the picture's own aspect
   (--ar) inside the 12 % inset and is rounded concentric with the frame. On a transparent logo the rounding clips
   nothing that shows. */
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img[data-shape]:not([data-logo]) {
  padding: 0; object-fit: fill; aspect-ratio: var(--ar); border-radius: max(4px, calc(var(--art-r) - 12cqi));
}
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img:not([data-logo]):is([data-shape="square"], [data-shape="wide"]) { width: 76%; height: auto; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art) img:not([data-logo])[data-shape="tall"] { width: auto; height: 76%; }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art):has(img.ok) { background: var(--surface-2) !important; box-shadow: inset 0 0 0 1px var(--line); }
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art, .lr-art, .d-art):has(img.ok) .ini { visibility: hidden; } /* the initials stay under a logo */
/* Logo stays invisible (initials show) until undaLogo() has checked it */
:is(.art, .t-art, .p-art, .row-art, .gc-art, .g-pin-art) img:not(.ok) { opacity: 0; }
/* Monogram letters are 36 % of their tile, at most --fs-art-max (UX-10 #1): one rule for every size, no per-tile px */
.ini { font-family: var(--dot); font-weight: 900; font-size: min(36cqi, var(--fs-art-max)); line-height: 1; }
.ini::before { content: attr(data-ini); } /* artwork, not text (FIX-17) */
/* Player and tuner monograms read as a small LED panel: unlit dots behind the initials (TYPE-1 #3) */
:is(.p-art, .t-art):not(:has(img.ok))::before {
  content: ""; grid-area: 1 / 1; align-self: stretch; justify-self: stretch;
  background: radial-gradient(circle, color-mix(in srgb, currentColor 22%, transparent) 1px, transparent 1.4px) 0 0 / 5px 5px;
}

.grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.card {
  position: relative; padding: var(--sp-2); border-radius: var(--r-lg);
  background: var(--surface); border: 0;
  transition: transform 0.2s, box-shadow 0.2s;
}
/* Hover looks only where there is a real hover (UX-11 A6): on touch a tap left the lift, the dimmed art and the play disc
   stuck on a card that wasn't playing. Keyboard focus and the playing/connecting states don't depend on it. */
@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
  .card:hover .art-overlay { opacity: 1; }
  .card:hover .art-overlay > span { transform: none; }
  .card:hover .c-fav { opacity: 1; }
}
.card.playing { background: linear-gradient(180deg, var(--accent-a3), var(--accent-a1) 70%), var(--surface); } /* gradient + ON AIR, no ring (UX-10 #3) */
.art { aspect-ratio: 1; --art-r: var(--r-md); }
.art-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: var(--scrim-soft); opacity: 0; transition: opacity 0.2s;
}
/* The play disc is the overlay's direct child (FIX-16 B1): the spinner inside it is a span too, and must not pick up
   the disc's offset, transition or fill, or its turn slides up and snaps back every 0.8 s */
.art-overlay > span {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green); color: var(--on-green);
  transform: translateY(6px); transition: transform 0.2s;
}
/* Pause/Play shows on hover or keyboard focus only; the playing tile has no grey wash (UX-4b3 #1) */
.card:has(.c-play:focus-visible) .art-overlay { opacity: 1; }
.card.playing .art-overlay { background: none; }
.card:has(.c-play:focus-visible) .art-overlay > span { transform: none; }
.card .i-stop, .card.playing .i-play { display: none; }
.card.playing .i-stop { display: block; }
.card.playing .art::after {
  content: "ON AIR"; position: absolute; left: 8px; bottom: 8px; z-index: 1;
  padding: 2px 8px; border-radius: 999px; font: 500 var(--fs-xs)/var(--lh-xs) var(--mono); letter-spacing: var(--track-caps); /* the artwork pill (UI-4 #2) */
  background: var(--device); color: var(--green);
}
.c-name { margin: 0 2px 2px; font-size: var(--fs-md); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Play is a real button; its ::after stretches over the whole card so the card stays one big target */
.c-play { font: inherit; color: inherit; text-align: left; cursor: pointer; }
.c-play::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.c-play:focus-visible { outline: none; }
.card:has(.c-play:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; } /* the solid amber ring = keyboard focus */
/* Station metadata: cleaned tags / song titles in sentence case (not a data label) */
.c-sub, .row-sub, .gc-sub, .p-sub {
  font: 400 var(--fs-sm)/var(--lh-sm) var(--font);
  color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.c-sub { margin: 0 2px; }
/* Name and subline are one block (UI-4 #1): the subline sits 2 px under the name, and the block is always 1 name line
   (one-line titles, owner 19 Nov) + 2 px + 1 subline tall, so every card in a row keeps one height, art and names lined up */
.c-text { margin-top: var(--sp-2); min-height: calc(var(--lh-md) + 2px + var(--lh-sm)); }
/* ♥ sits above the stretched play target; 44×44 hit area around a 30 px see-through disc, tucked into the artwork's
   corner (ART-1) so it covers less of the logo. The disc is the same in both themes: it sits on artwork, not on the page */
.c-fav {
  position: absolute; z-index: 1; top: 7px; right: 7px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; color: var(--night-text);
  opacity: 0; transition: opacity 0.2s, color 0.2s;
}
.c-fav::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.c-fav svg { position: relative; width: 18px; height: 18px; }
.c-fav.on, .c-fav:focus-visible { opacity: 1; }
.c-fav.on { color: var(--green); }
.c-badges { position: absolute; top: 19px; left: 14px; display: flex; gap: var(--sp-1); pointer-events: none; }
/* HD: neutral in both themes (UX-5 #0) — the solid black badge was the loudest mark in light mode. One pill shape
   everywhere (UI-4 #2) */
.badge { padding: 2px 7px; border-radius: 999px; font: 500 var(--fs-xs)/var(--lh-xs) var(--mono); letter-spacing: var(--track-caps); text-transform: uppercase; background: var(--surface-2); color: var(--muted); }
/* On artwork, HD is a see-through pill, the heart disc's treatment, the same in both themes (it sits on the
   logo, not the page). The pill (20 px) is centred on the disc's centre line, 29 px from the card top (heart 7 + 22),
   and inset 14 px from the left, as the disc is from the right (UI-4 #2) */
.c-badges .badge { padding: 2px 8px; background: var(--scrim-badge); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--night-text); }

.empty { grid-column: 1 / -1; padding: 48px var(--sp-4); text-align: center; color: var(--muted); }
/* Loading placeholders in the shape of what replaces them (PERF-1 #3), so nothing shifts when the list arrives:
   a card (padding, square artwork, name and genre lines) in grid view, a 64 px row in list view */
.skeleton { border-radius: var(--r-lg); background: var(--surface); animation: pulse 1.4s infinite ease-in-out; }
.sk-card { padding: var(--sp-2); }
.sk-art { aspect-ratio: 1; border-radius: var(--r-md); background: var(--surface-2); }
.sk-card .c-name, .sk-card .c-sub { visibility: hidden; } /* inside the same .c-text block as a card (UI-4 #1) */
.sk-card .c-name { line-height: var(--lh-md); } /* the name button's line (.c-play) */
.sk-row { min-height: 68px; border-radius: var(--r-md); }
/* The top card while the first list loads: its real size, text hidden (app.js renders it inert) */
.hero.loading .tuner > *, .hero.loading .tile > * { visibility: hidden; }
.hero.loading .tuner, .hero.loading .tile { animation: pulse 1.4s infinite ease-in-out; }
/* The genre row keeps its height (one 36 px chip) until its chips render */
.chips:empty::before { content: ""; flex: none; width: 1px; height: 36px; }
.more { display: block; margin: var(--sp-6) auto 0; padding: 0 var(--sp-6); color: var(--text); }

/* ---------- Player ---------- */
/* Nothing played yet (UX-8 #3): no player, so the hero and the player never show the same station; the space it
   reserved goes back to the page */
body.no-player { --player-h: 0px; }
body.no-player .player { display: none; }
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: var(--player-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--sp-4);
  padding: 0 24px calc(env(safe-area-inset-bottom) * 0.5);
  background: var(--device); color: var(--device-text); border-top: 1px solid var(--device-line);
}
.p-station { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
/* One station button (POLISH-2 #3): logo + name + meta open the station page; the heart is a separate button after it */
.p-open {
  display: flex; align-items: center; gap: var(--sp-3); min-width: 0; padding: var(--sp-1); margin: calc(-1 * var(--sp-1));
  border-radius: var(--r-sm); color: inherit; text-align: left; font: inherit;
}
.p-open:hover .p-name { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--device-dim); }
.p-open:focus-visible { outline: 2px solid var(--device-accent); outline-offset: 2px; }
.p-art { width: 56px; height: 56px; flex: none; --art-r: 28px; background: var(--device-2); } /* round in the bar, logo and monogram (UI-2 #3): half its size, in px so the logo's own corners stay concentric (ART-2); tiles keep the scale */
.p-meta { display: grid; gap: 2px; min-width: 0; }
.p-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { color: var(--device-dim); display: flex; align-items: center; min-width: 0; }
.p-line { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Status slot (POLISH-2 #2): a 3 × 3 dot glyph (a miniature of the meter) and the word, only when something is off */
.p-state { display: inline-flex; flex: none; align-items: center; margin-right: var(--sp-2); color: var(--device-accent); font-weight: 500; }
.p-state:empty { display: none; }
.p-state.off { color: var(--danger-ink); }
.p-state.stop { color: var(--device-dim); font-weight: 400; }
.glyph { width: 12px; height: 12px; flex: none; margin-right: var(--sp-1); }
.glyph circle { fill: currentColor; }
.glyph circle.off { opacity: 0.22; }
/* Connecting: each column fills bottom-up in turn (1.2 s); Rebuffering: the held level breathes (1.6 s); Off air: still */
.g-conn circle.r1, .g-conn circle.r2 { opacity: 0.22; animation: dot-up 1.2s ease-in-out infinite; }
.g-conn circle.r2 { animation-name: dot-up-2; }
.g-conn circle.c1 { animation-delay: 0.15s; } .g-conn circle.c2 { animation-delay: 0.3s; }
@keyframes dot-up { 0%, 100% { opacity: 0.22; } 30%, 60% { opacity: 1; } }
@keyframes dot-up-2 { 0%, 25%, 100% { opacity: 0.22; } 45%, 55% { opacity: 1; } }
.g-buf circle.on { animation: dot-breathe 1.6s ease-in-out infinite; }
@keyframes dot-breathe { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .g-conn circle.r1 { opacity: 1; } } /* still: two rows lit */
.p-controls { display: flex; align-items: center; gap: var(--sp-5); }
/* Right cluster on a 16 px rhythm (POLISH-2 #3): meter · Sound · volume */
.p-right { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-4); }
.player .icon-btn { width: 44px; height: 44px; flex: none; color: var(--device-dim); }
.player .icon-btn:hover:not(:disabled) { color: var(--device-text); background: var(--device-2); }
.player .p-fav.on, #p-mute.muted { color: var(--device-accent); } /* muted: the filled speaker-slash in amber */

.play-btn {
  position: relative; width: 56px; height: 56px; flex: none; border-radius: 50%;
  display: grid; place-items: center; background: var(--green); color: var(--on-green);
  transition: transform 0.15s, box-shadow 0.2s;
}
.play-btn:hover:not(:disabled) { transform: scale(1.06); }
.play-btn:disabled { background: var(--device-2); color: var(--device-dim); cursor: default; }
/* No halo round the play disc while live (UX-10 #6): the LIVE LED says it */
.play-btn svg { width: 24px; height: 24px; fill: currentColor; }
/* Stop while live or connecting (POLISH-2 #3); no spinner in any state (#2): the status glyph and the meter carry the motion */
.play-btn .i-stop { display: none; }
.player:is([data-state="live"], [data-state="connecting"]) .play-btn .i-play { display: none; }
.player:is([data-state="live"], [data-state="connecting"]) .play-btn .i-stop { display: block; }
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid transparent; border-top-color: currentColor; border-right-color: currentColor;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


input[type="range"] {
  width: 110px; height: 4px; appearance: none; border-radius: 4px; cursor: pointer;
  background: linear-gradient(to right, var(--device-text) var(--fill, 80%), var(--device-line) var(--fill, 80%));
}
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--device-text); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--device-text); }

/* Volume (POLISH-2 #4): the slider is hidden (no width, not focusable) until the speaker group is hovered or has keyboard
   focus inside; then it opens to 96 px with the volume % beside it, and closes 0.5 s after the pointer leaves so it
   doesn't flicker. Touch has no hover: a tap on the speaker mutes, the slider stays hidden (phones use their own keys). */
.p-vol { display: flex; align-items: center; }
.p-vol input[type="range"] { width: 0; margin: 0; opacity: 0; visibility: hidden; transition: width 0.18s ease 0.5s, margin 0.18s ease 0.5s, opacity 0.12s ease 0.5s, visibility 0s linear 0.68s; }
.p-vol-pct { width: 0; overflow: hidden; font: 500 var(--fs-xs)/1 var(--mono); font-variant-numeric: lining-nums tabular-nums; color: var(--device-dim); text-align: right; opacity: 0; transition: opacity 0.12s 0.5s, width 0s 0.62s; }
@media (hover: hover) {
  .p-vol:hover input[type="range"] { width: 96px; margin: 0 var(--sp-1); opacity: 1; visibility: visible; transition-delay: 0s; }
  .p-vol:hover .p-vol-pct { width: 3ch; opacity: 1; transition-delay: 0s; }
}
.p-vol:has(:focus-visible) input[type="range"] { width: 96px; margin: 0 var(--sp-1); opacity: 1; visibility: visible; transition-delay: 0s; }
.p-vol:has(:focus-visible) .p-vol-pct { width: 3ch; opacity: 1; transition-delay: 0s; }
/* Muted: the meter dims and keeps moving, so you can see the station is still on air */
/* (the dots dim, not the night inset, so the light device doesn't show a grey box) */
.player .vu-band { transition: opacity 0.2s; }
.player.muted .vu-band { opacity: 0.45; }

/* ---------- Tooltips on icon buttons (UX-10 #11) ---------- */
/* On the night inset in both themes (like the LED displays), so it reads over any surface; fades in unless reduced motion */
.tip {
  position: fixed; z-index: 60; max-width: 240px; padding: var(--sp-1) var(--sp-2); border-radius: var(--r-sm); pointer-events: none;
  background: var(--night-2); color: var(--night-text); font: 500 var(--fs-sm)/var(--lh-sm) var(--font); box-shadow: inset 0 0 0 1px var(--night-line), var(--shadow);
  opacity: 0; transition: opacity var(--dur-1) ease-out;
}
.tip.in { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .tip { transition: none; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--player-h) + 16px); z-index: 30;
  max-width: calc(100vw - 32px); padding: var(--sp-3) var(--sp-4); border-radius: var(--r-sm);
  background: var(--device); color: var(--device-text); font-weight: 500; font-size: var(--fs-md);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: all 0.25s;
}
/* Visible at once when shown (clickable, readable); hidden only after the fade-out */
.toast { visibility: hidden; display: flex; align-items: center; gap: var(--sp-3); transition: opacity 0.25s, transform 0.25s, visibility 0s linear 0.25s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); visibility: visible; transition-delay: 0s; }
.toast.has-action { pointer-events: auto; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-radius: 999px; }
.toast-btn {
  flex: none; min-width: 44px; min-height: 44px; padding: 0 var(--sp-4); border-radius: 999px;
  background: var(--green); color: var(--on-green); font-weight: 500;
}

/* Visually hidden, still read by screen readers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Connecting (before the stream actually plays) */
.btn .spinner { width: 18px; height: 18px; border-width: 2px; }
.card.connecting { border-color: var(--line-strong); }
.card.connecting .art-overlay { opacity: 1; }
.card.connecting .art-overlay > span { transform: none; } /* centred while connecting, touch included (FIX-16 B2) */
.card.connecting .art::after {
  content: "…"; position: absolute; left: 8px; bottom: 8px; z-index: 1;
  padding: 2px 9px; border-radius: 5px; font: 500 var(--fs-xs)/var(--lh-xs) var(--mono); letter-spacing: var(--track-caps);
  background: var(--device); color: var(--device-text);
}
.card.connecting .i-play { display: none; }
.card.connecting .i-stop { display: block; }

/* ---------- Globe ---------- */
.globe-view {
  display: grid; grid-template-columns: 1fr 340px; gap: var(--sp-4);
  height: calc(100vh - var(--player-h) - 98px); height: calc(100dvh - var(--player-h) - 98px); min-height: 460px;
}
.globe-wrap {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--r-lg); background: var(--globe-bg); border: 1px solid var(--line);
}
.globe { position: absolute; inset: 0; z-index: 0; cursor: grab; touch-action: none; } /* own stacking context: station items never cover the controls */
.globe canvas { touch-action: none; } /* the page never scrolls or zooms while the globe is dragged or pinched (UX-7 A3) */
.globe.dragging { cursor: grabbing; }
.globe-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: var(--sp-2); color: var(--muted); font-size: var(--fs-md); }
/* Poster (UX-7 A2): the planet at the opening view, centred and sized from the globe's height so it lines up with
   the live planet (84cqh = POSTER_K in tests/ux7-poster.mjs), then cross-faded into it */
.globe-wrap { container-type: size; }
.globe-poster { position: absolute; left: 50%; top: 50%; z-index: 1; height: 84cqh; width: auto; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none; transition: opacity var(--dur-2) ease-out; }
.globe-poster[hidden] { display: none; }
.globe-poster.out { opacity: 0; }
.globe-wrap.posted .globe-hint { inset: auto 0 18px; z-index: 1; } /* "Loading the globe…" under the poster */
@media (prefers-reduced-motion: reduce) { .globe-poster { transition: none; } }
.globe-hint .spinner { color: var(--green-ink); }

.globe-ctrls {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  display: flex; flex-direction: column; gap: 2px; padding: var(--sp-1); border-radius: var(--r-md);
}
.g-btn { width: 38px; height: 38px; border-radius: var(--r-sm); display: grid; place-items: center; color: var(--device-dim); transition: background 0.15s, color 0.15s; }
.g-btn svg { width: 20px; height: 20px; }
.g-btn:hover { background: var(--device-2); color: var(--device-accent); }
.g-btn:active { transform: scale(0.94); }
.g-btn[data-g="world"] { margin-top: var(--sp-1); border-top: 1px solid var(--device-line); border-radius: 0 0 var(--r-sm) var(--r-sm); }
.g-lbl { display: none; } /* phones only (UX-7 A3) */
.g-tips { display: none; } /* phones only: the tips "?" in the toolbar (UX-9 #8) */
/* Peek (UX-7 A3): first tap on a country or cluster names it on a 44 px button that does the next step */
.globe-peek {
  position: absolute; z-index: 3; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; max-width: calc(100% - 16px);
  padding: 0 var(--sp-4); border-radius: 999px; color: var(--device-text); font: 400 var(--fs-sm)/var(--lh-sm) var(--font); box-shadow: var(--shadow);
}
.globe-peek[hidden] { display: none; }
.globe-peek b { font-weight: 500; }
.globe-peek:hover b, .globe-peek:focus-visible b { color: var(--device-accent); }
.pk-n { color: var(--muted); }
/* Country focus (GLOBE-1 #12): the way out beside the "?", a legend under the rail */
.globe-exit {
  position: absolute; left: 66px; top: 14px; z-index: 3; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; max-width: calc(100% - 240px);
  padding: 0 var(--sp-3) 0 var(--sp-4); border-radius: 999px; color: var(--device-text); font: 500 var(--fs-sm)/var(--lh-sm) var(--font); box-shadow: var(--shadow);
}
.globe-exit[hidden], .globe-key[hidden] { display: none; }
.globe-wrap:has(.globe-legend[data-open="true"]) .globe-exit { left: 14px; top: 66px; max-width: calc(100% - 28px); } /* under the first-visit tips */
.globe-exit > span:not(.flag) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.globe-exit svg:not(.flag) { flex: none; width: 18px; height: 18px; color: var(--device-dim); }
.globe-exit:hover svg, .globe-exit:focus-visible svg { color: var(--device-accent); }
.globe-exit:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.globe-key {
  position: absolute; right: 14px; top: 246px; z-index: 2; display: grid; gap: var(--sp-2); margin: 0; padding: var(--sp-2) var(--sp-3); list-style: none;
  border-radius: var(--r-sm); color: var(--device-text); font: 400 var(--fs-xs)/var(--lh-xs) var(--font);
}
.globe-key li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: var(--sp-2); }
.globe-key b { font-weight: 500; font-variant-numeric: lining-nums tabular-nums; color: var(--device-dim); }
.globe-key i { justify-self: center; width: 8px; height: 8px; border-radius: 50%; background: var(--device-accent); }
.globe-key .k-city { outline: 1px solid var(--device-accent); outline-offset: 2px; width: 6px; height: 6px; }
.globe-key .k-chip { width: 14px; height: 10px; border-radius: 5px; background: none; box-shadow: inset 0 0 0 1px var(--device-accent); }
/* "Stations in view · N" (UX-7 A3, UX-8 #7): phones only, the bottom sheet's peek row */
.gp-inview, .gp-peekrow { display: none; }
/* Long-press label for the icon-only toolbar on phones (UX-8 #7) */
.g-btn-tip { position: absolute; z-index: 6; padding: var(--sp-2) var(--sp-2); border-radius: var(--r-sm); background: var(--device); color: var(--device-text); font: 500 var(--fs-sm)/var(--lh-sm) var(--font); box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; }
.g-btn-tip[hidden] { display: none; }

.globe-legend {
  position: absolute; left: 14px; top: 14px; z-index: 2;
  display: flex; align-items: center; max-width: calc(100% - 96px); /* clear of the control rail */
  border-radius: 999px; background: var(--device); color: var(--device-text);
  font: 400 var(--fs-sm)/var(--lh-sm) var(--font);
}
/* Tips (UX-5 #4): open = text + ×; folded = a single "?" that reopens them */
.gl-q { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--device-dim); font: 500 var(--fs-md) var(--font); }
.gl-q:hover { color: var(--device-text); background: var(--device-2); }
.gl-text { display: none; align-items: center; gap: var(--sp-2); padding: var(--sp-1) var(--sp-1) var(--sp-1) var(--sp-4); }
.globe-legend[data-open="true"] .gl-q { display: none; }
.globe-legend[data-open="true"] .gl-text { display: flex; }
.gl-close { position: relative; flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--device-dim); }
.gl-close::after { content: ""; position: absolute; inset: -6px; } /* 44px hit area */
.gl-close:hover { color: var(--device-text); background: var(--device-2); }
.gl-close svg { width: 18px; height: 18px; }
.gl-q:focus-visible, .gl-close:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.gl-touch { display: none; }
@media (pointer: coarse) { .gl-desk { display: none; } .gl-touch { display: inline; } }

.gtip {
  display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  background: var(--device); color: var(--device-text); font: 500 var(--fs-sm)/var(--lh-sm) var(--font);
}
.gtip span { font: 400 var(--fs-sm)/var(--lh-sm) var(--font); color: var(--muted); } /* one count style (GLOBE-1 #13, UX-9 #3) */
.gtip-float { position: absolute; z-index: 3; max-width: 260px; pointer-events: none; box-shadow: var(--shadow); }
.gtip-float[hidden] { display: none; }
/* Keyboard: the globe itself is focusable (arrows, + / −, Enter) */
.globe:focus-visible { outline: 2px solid var(--green-ink); outline-offset: -3px; border-radius: var(--r-lg); }

.g-pin { position: relative; transform: translate(-50%, -100%); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.g-pin-art {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid var(--device); box-shadow: 0 0 0 2px var(--green), var(--shadow-pin);
  transition: transform 0.2s;
}
.g-pin.hot .g-pin-art { transform: scale(1.1); }
.g-pin-stem { width: 2px; height: 12px; border-radius: 2px; background: var(--green); }
.g-pin.live .g-pin-art { animation: pinPulse 2s ease-in-out infinite; }
@keyframes pinPulse { 50% { box-shadow: 0 0 0 6px var(--accent-a3), 0 0 0 2px var(--green), var(--shadow-pin); } }

/* Zoom-aware station clusters (UX-5 #3): bubbles (count) and dots; the outer .g-item is positioned by globe.gl.
   They take no pointer events (UX-7 A3): globe.js finds what a tap or hover means by distance, so a drag that
   starts on one still turns the globe. .hot = what a click at the mouse pointer would pick. */
.g-item, .g-pin { pointer-events: none; }
/* Bubbles (aggregates) always sit above station dots: a tap on a country / cluster must not land on a nearby lone
   station's dot, and a small country next to a big one stays reachable. globe.gl sets
   z-index per item by distance, hence !important. Tapping a bubble zooms in, which separates what's inside. */
.g-bubble { z-index: calc(100100 - var(--zb, 0)) !important; } /* smaller bubbles above bigger ones (--zb = size) */
/* The playing station's pin sits above every bubble and dot (FIX-6): a cluster next to it must not cover its logo.
   Same reason for !important, and targetsAt() gives it the tap on its own area to match. */
.g-pin { z-index: 100200 !important; }
.g-b {
  display: grid; place-items: center; width: var(--sz); height: var(--sz); border-radius: 50%;
  background: var(--globe-bubble); box-shadow: inset 0 0 0 1px var(--globe-bubble-line); color: var(--text);
  font: 700 var(--fs-xs)/1 var(--mono);
  transition: transform var(--dur-2) cubic-bezier(0.2, 0, 0, 1), opacity var(--dur-2);
}
.g-b span { pointer-events: none; }
.g-bubble.hot .g-b { background: var(--globe-bubble-hot); }
/* Standing for 2+ stations: the number sits in the mark (GLOBE-1 #8) */
.g-d.g-n {
  display: grid; place-items: center; box-sizing: border-box; width: auto; min-width: var(--sz); padding: 0 var(--sp-1); border-radius: calc(var(--sz) / 2);
  color: var(--globe-dot-ink); font: 700 var(--fs-xs)/1 var(--mono); opacity: 1;
}
.g-dot.on .g-n { color: var(--on-green); }
.g-d {
  position: relative; width: var(--sz, 7px); height: var(--sz, 7px); border-radius: 50%;
  background: var(--globe-dot); box-shadow: var(--globe-dot-glow);
  transition: transform var(--dur-2) cubic-bezier(0.2, 0, 0, 1), opacity var(--dur-2);
}
.g-dot.hot .g-d { transform: scale(1.5); }
.g-dot.on .g-d { background: var(--green); box-shadow: 0 0 8px var(--green); }
/* Fewer bubbles until you zoom (GLOBE-2 #2): below 50 stations a cluster, or a place with a few, is a plain dot from
   space (globe.js sets .g-quiet), the size of a busy station's dot; within a country it gets its number back */
.g-quiet .g-b, .g-quiet .g-d.g-n {
  width: var(--quiet-dot); min-width: 0; height: var(--quiet-dot); padding: 0;
  background: var(--globe-dot); box-shadow: var(--globe-dot-glow);
}
.g-quiet :is(.g-b, .g-n) span { display: none; }
.g-bubble.g-quiet.hot .g-b { transform: scale(1.5); }
.g-item.enter :is(.g-b, .g-d), .g-item.leave :is(.g-b, .g-d) { transform: scale(0.4); opacity: 0; }
@media (pointer: coarse) { .g-d { width: var(--sz, 8px); height: var(--sz, 8px); } }
@media (prefers-reduced-motion: reduce) { .g-b, .g-d { transition: none; } }
/* Precision (GLOBE-1 #3). Solid dot: the station's own position. Dot with a ring: placed by its city's name. Hollow ring: a
   country's stations with no location, at its label point. A place's size follows its count on the bubbles' log scale. */
.g-city .g-d { outline: 1px solid var(--green-ink); outline-offset: 2px; }
.g-r {
  display: grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; box-sizing: border-box; border-radius: 13px;
  box-shadow: inset 0 0 0 1px var(--green-ink); color: var(--text); font: 500 var(--fs-xs)/1 var(--mono);
}
.g-ring.hot .g-r { background: var(--globe-bubble); }
.g-ring.g-off, .g-bubble.g-off { visibility: hidden; }
.g-l {
  position: absolute; top: 50%; left: calc(100% + 6px); transform: translateY(-50%); visibility: hidden; white-space: nowrap;
  max-width: 22ch; overflow: hidden; text-overflow: ellipsis; padding: 1px 2px;
  color: var(--text); font: 500 var(--fs-xs)/1 var(--mono);
  text-shadow: 0 0 2px var(--globe-halo), 0 0 2px var(--globe-halo), 0 0 4px var(--globe-halo); /* readable on any land, both themes */
}
.g-l.on { visibility: visible; }
.g-chip .g-r { transform: translateY(var(--chip-y, 0)); width: max-content; background: var(--globe-halo); padding: 0 10px; font-weight: 500; }

/* Xmas season mode on the globe (XMAS-1 #3, #7). Red markers with a dark outline and dark red count bubbles (Effects
   Off too); counts at least 12 px. With effects the card is the dark snow globe whatever the theme: the device panels
   on it re-scope to night. The scene's canvases (xmas.js) take no pointer events and are hidden from assistive tech. */
html[data-xmas] .globe {
  --globe-dot: var(--xmas-marker); --globe-dot-glow: 0 0 0 1.5px var(--xmas-marker-line); --globe-dot-ink: var(--xmas-ink);
  --globe-bubble: var(--xmas-bubble); --globe-bubble-hot: var(--xmas-bubble); --globe-bubble-line: var(--xmas-bubble-line); --globe-halo: var(--xmas-night);
}
html[data-xmas] .globe :is(.g-b, .g-n, .g-r) { color: var(--xmas-ink); font-size: var(--fs-xmas-count); }
html[data-xmas] .globe .g-b { box-shadow: inset 0 0 0 1.5px var(--globe-bubble-line), 0 0 0 1px var(--xmas-marker-line); }
html[data-xmas] .globe .g-quiet .g-b, html[data-xmas] .globe .g-quiet .g-d.g-n { box-shadow: var(--globe-dot-glow); }
html[data-xmas] .globe .g-l { color: var(--xmas-ink); font-size: var(--fs-xmas-count); }
html[data-xmas]:not([data-xmas-fx="off"]) .globe-wrap {
  background: var(--xmas-night); border-color: var(--night-line);
  --device: var(--night); --device-2: var(--night-2); --device-line: var(--night-line); --device-text: var(--night-text);
  --device-dim: var(--night-dim); --device-edge: rgba(255, 255, 255, 0.06); --device-accent: var(--green); /* allow-colour: the dark device hairline, as in the dark theme */
  --text: var(--night-text); --muted: var(--night-dim); color-scheme: dark;
}
.xmas-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.xmas-pause .ic { width: 20px; height: 20px; }
/* TV (XMAS-1 #7): read from the sofa at 1080p, labels at least 24 px; the remote's arrow keys move between the
   controls (native buttons), each with the visible ring */
@media (min-width: 1800px) and (hover: none) {
  .xmas-btn { height: 56px; padding: 0 var(--sp-6); font-size: var(--fs-2xl); }
  .xmas-btn .ic { width: 28px; height: 28px; }
  html[data-xmas] .globe :is(.g-b, .g-n, .g-r, .g-l) { font-size: var(--fs-2xl); }
  html[data-xmas] .globe-ctrls .g-btn { width: 56px; height: 56px; }
}
.xmas-pause:focus-visible, html[data-xmas] .globe-ctrls .g-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* The wobble (#4) squashes the globe and everything round it; the controls stay still */
.globe.xmas-wobble { will-change: transform; }

/* Station card / chooser on the globe */
.globe-card {
  position: absolute; left: 14px; bottom: 14px; z-index: 3;
  display: flex; flex-direction: column; gap: var(--sp-3);
  width: min(400px, calc(100% - 80px)); padding: var(--sp-3);
  border-radius: var(--r-md); animation: cardIn 0.25s ease-out;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } }
/* Station card (UX-5 #4): select before play */
.gc-top { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.gc-art { width: 56px; height: 56px; --art-r: var(--r-sm); }
.gc-meta { flex: 1; min-width: 0; }
.gc-name { font-size: var(--fs-md); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.globe-card .gc-sub, .globe-card .row-sub { color: var(--device-dim); font-size: var(--fs-sm); }
.gc-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.gc-actions .btn { padding: 0 var(--sp-4); }
.gc-play { min-width: 112px; justify-content: center; }
.gc-play svg { fill: currentColor; }
.gc-play .spinner { width: 18px; height: 18px; border-width: 2px; }
.gc-play:focus-visible, .gc-pick:focus-visible, .gc-close:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.gc-open { margin-left: auto; }
.gc-close { position: relative; flex: none; align-self: flex-start; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--device-dim); }
.gc-close::after { content: ""; position: absolute; inset: -6px; } /* 44px hit area */
.gc-close svg { width: 18px; height: 18px; fill: currentColor; }
.gc-close:hover { background: var(--device-2); color: var(--device-text); }
.globe-card:has(.gc-cluster) { display: block; padding: var(--sp-2); }
.gc-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-2); font-size: var(--fs-md); }
.gc-list { max-height: min(300px, 45vh); overflow-y: auto; overscroll-behavior: contain; }
.globe-card .row:hover { background: var(--device-2); }
.globe-card .row.playing { background: var(--accent-a2); }
.globe-card .row.playing .row-name { color: var(--device-accent); }
.gc-list .row { width: 100%; padding: var(--sp-2) var(--sp-2); text-align: left; color: inherit; font: inherit; }
.gc-pick .row-meta, .gc-pick .row-name, .gc-pick .row-sub { display: block; }
.gc-list .row-art { width: 36px; height: 36px; }

/* Side panel / bottom sheet */
.globe-panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
}
.gp-handle { display: none; }
.gp-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-2); padding: var(--sp-4) var(--sp-4) var(--sp-3); }
.gp-kicker .link { font-size: inherit; letter-spacing: var(--track-normal); text-transform: none; }
.gp-head h2 { margin: 2px 0 0; font-size: var(--fs-xl); line-height: var(--lh-xl); letter-spacing: var(--track-normal); }
.gp-list { flex: 1; overflow-y: auto; padding: 0 var(--sp-2) var(--sp-2); overscroll-behavior: contain; }
.gp-list .empty { padding: var(--sp-8) var(--sp-2); }

.row { position: relative; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) var(--sp-2); border-radius: var(--r-sm); cursor: pointer; transition: background 0.15s; }
/* Row play button covers the row; the pin button sits above it (siblings, never nested) */
.row-play { position: absolute; inset: 0; border-radius: inherit; cursor: pointer; }
.row-play:focus-visible { outline: 2px solid var(--green-ink); outline-offset: -2px; }
.row:hover { background: var(--surface-2); }
.row.playing { background: var(--accent-a2); }
.row.playing .row-name { color: var(--green-ink); }
.row-art { width: 44px; height: 44px; --art-r: var(--r-sm); }
.row-meta { flex: 1; min-width: 0; }
.row-name { font-size: var(--fs-md); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-pin { position: relative; z-index: 1; width: 44px; height: 44px; flex: none; border-radius: 50%; }
.row-pin::after {
  content: ""; position: absolute; inset: 18px; border-radius: 50%;
  background: var(--green-ink); box-shadow: 0 0 0 3px var(--accent-a3); transition: transform 0.15s;
}
.row-pin:hover::after { transform: scale(1.4); }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tuner" "trend"; }
  .globe-view { grid-template-columns: 1fr 290px; }
}

/* SEO-5 A1: the Browse links below the app on the home page (written into the deploy's index.html by
   scripts/build-pages.mjs). After .app, whose min-height is the viewport, so it never shows or shifts on load; quiet
   footer weight, chips as on the country pages, 44 px targets. Hidden on the globe, which fills the screen. */
.home-browse {
  margin-left: var(--nav-w); padding: var(--sp-5) var(--sp-6) calc(var(--player-h) + var(--sp-6));
  border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm);
}
.home-browse h2 { margin: 0; font-size: var(--fs-md); line-height: var(--lh-md); color: var(--text); }
.home-browse h3 { margin: var(--sp-4) 0 var(--sp-2); font-size: var(--fs-sm); line-height: var(--lh-sm); font-weight: 400; color: var(--muted); }
.home-browse ul { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0; padding: 0; list-style: none; }
.home-browse .chip { display: inline-flex; align-items: center; gap: var(--sp-2); height: auto; min-height: 44px; text-decoration: none; white-space: normal; }
.home-browse .chip:hover { color: var(--text); }
.home-browse .flag { border-radius: 50%; }
body[data-view="globe"] .home-browse { display: none; }

/* ---------- Phone ---------- */
@media (max-width: 820px) {
  :root { --player-h: 72px; }
  /* Room for the mini player + tab bar + safe area, and the band below, so the last line (the footer) clears it (UX-8 #8) */
  .app { grid-template-columns: 1fr; padding-bottom: calc(var(--player-h) + var(--tabs-h) + env(safe-area-inset-bottom) + 16px); }
  body[data-view="globe"] .app { padding-bottom: calc(var(--player-h) + var(--tabs-h) + env(safe-area-inset-bottom)); } /* the globe fills the screen: no page scroll */
  /* A page-coloured band behind the mini player (UX-8 #8): list rows no longer show around its rounded ends or in the
     gap above the tab bar (a clipped "HF" monogram read as a stray glyph). Fades in over 16 px at the top. */
  body:not(.no-player)::after {
    content: ""; position: fixed; left: 0; right: 0; z-index: 19; pointer-events: none;
    bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); height: calc(var(--player-h) + 16px);
    background: linear-gradient(transparent, var(--bg) 16px);
  }
  .main { padding: var(--sp-2) var(--sp-4) var(--sp-6); }
  .home-browse { margin-left: 0; padding: var(--sp-5) var(--sp-4) calc(var(--player-h) + var(--tabs-h) + env(safe-area-inset-bottom) + var(--sp-6)); }

  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 21;
    height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    flex-direction: row; justify-content: space-around; gap: 0;
    padding: 6px 8px env(safe-area-inset-bottom);
    background: var(--bg); border-right: 0; border-top: 1px solid var(--line);
  }
  .brand { display: none; }
  /* Five equal tabs (Settings is the fifth, owner 17 Oct): icon above the label, 44 px targets */
  .nav-item { flex: 1 1 0; min-width: 44px; min-height: 44px; justify-content: center; flex-direction: column; gap: 3px; padding: var(--sp-2) 2px; font-size: var(--fs-xs); background: none !important; }
  .nav-item.active { color: var(--green-ink); }

  /* TOPBAR-1 #2: the country chip (flag + ISO code) on the left, a 44 px search button on the right. The country is
     state, so it stays in view; search opens over the bar from the button. The bar slides away on scroll down and back
     on scroll up (app.js), never while search or the picker is open. */
  .topbar { --bar-h: 44px; gap: var(--sp-2); transition: transform var(--dur-bar) ease-out; }
  .topbar.away { transform: translateY(-100%); }
  @media (prefers-reduced-motion: reduce) { .topbar { transition: none; } } /* instant */
  .search { display: none; }
  .cpick { width: auto; margin-left: 0; } /* phones keep TOPBAR-1: the chip on the left, the search button on the right */
  .cpick input { display: none; } /* the chip is a button that opens the country sheet (UX-11 B1) */
  .cpick-btn {
    display: block; position: absolute; left: -1px; right: -1px; top: 50%; height: 44px; transform: translateY(-50%);
    border-radius: 999px; background: none;
  }
  .cpick-btn:focus-visible { outline: 2px solid var(--green-ink); outline-offset: 2px; }
  .cpick-flag { left: 13px; z-index: 1; }
  .cpick-code, .cpick-caret { z-index: 1; pointer-events: none; }
  .cpick-code {
    display: flex; align-items: center; height: 100%; padding: 0 35px 0 40px; font-weight: 500; color: var(--text); white-space: nowrap;
  }
  .cpick-list { position: fixed; top: 76px; left: 16px; right: 16px; width: auto; max-height: 55vh; }
  .search-open {
    display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin-left: auto; border-radius: 50%;
    background: var(--surface-2); border: 1px solid var(--line-control); color: var(--text);
  }
  .search-open .ic { width: 20px; height: 20px; }
  .search-cancel {
    flex: none; min-width: 44px; min-height: 44px; padding: 0 var(--sp-2); border-radius: 999px;
    color: var(--green-ink); font-weight: 500;
  }
  /* Open: the field over the whole bar, the button as its leading glyph (filled: aria-expanded), Cancel at the end */
  body[data-search-open] .topbar :is(.cpick, .xmas-btn) { display: none; }
  body[data-search-open] .search { display: flex; max-width: none; padding-left: 44px; }
  body[data-search-open] .search > .ic { display: none; }
  body[data-search-open] .search-open { position: absolute; left: 0; top: var(--sp-3); margin: 0; background: none; border-color: transparent; }
  body[data-search-open] .search-cancel { display: inline-flex; align-items: center; justify-content: center; }

  .hero { gap: var(--sp-2); grid-template-areas: "tuner"; }
  .tile-trend { display: none; }
  .tuner { padding: var(--sp-4); }
  .tile { padding: var(--sp-3); min-height: 112px; }

  .chips { margin: 0 calc(-1 * var(--sp-4)) var(--sp-4); padding: 2px var(--sp-4); }
  .section-head { flex-wrap: wrap; }
  .tools { margin-left: 0; width: 100%; }
  .grid { gap: var(--sp-3); grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .c-fav { opacity: 1; }

  /* Pill player */
  .player {
    bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    grid-template-columns: 1fr auto; gap: var(--sp-2); height: calc(var(--player-h) - 8px);
    margin: 0 var(--sp-2) var(--sp-2); padding: 0 var(--sp-2); border: 1px solid var(--device-line); border-radius: 999px;
    box-shadow: var(--shadow-pop);
  }
  .p-art { width: 46px; height: 46px; --art-r: 23px; } /* round, as on desktop (UI-2 #3; ART-2 had put it on the tile scale) */
  .p-right, #p-prev, #p-next, .p-fav { display: none; } /* phones: tap the station for its details (UX-8 #6) */
  .player[data-state="failed"] #p-next { display: grid; } /* off air: "Try next station" beside Play (POLISH-2 #2) */
  .play-btn { width: 46px; height: 46px; }
  .toast { bottom: calc(var(--player-h) + var(--tabs-h) + 16px); }

  /* Globe fills the screen; the list is a bottom sheet over it */
  body[data-view="globe"] .main { padding-bottom: 0; }
  .globe-view {
    display: block; position: relative; overflow: hidden; border-radius: 20px;
    height: calc(100dvh - var(--player-h) - var(--tabs-h) - 90px - env(safe-area-inset-bottom)); min-height: 380px;
  }
  .globe-wrap { position: absolute; inset: 0; border-radius: 20px; }
  /* The sheet's peek row covers the bottom of the globe: globe.js centres the planet in the space above it (UX-9 #8),
     and the poster moves up with it */
  .globe-view { --gp-peek: 76px; }
  .globe-poster { top: calc(50% - var(--gp-peek) / 2); }
  /* Toolbar (UX-8 #7): one compact row of 44 px icons, bottom right above the sheet's peek row, so the top of the
     globe stays clear; labels are aria-labels, shown on a long press. The station card takes its place when open. */
  .globe-ctrls { top: auto; left: auto; right: 10px; bottom: 86px; flex-direction: row; gap: 0; padding: 2px; border-radius: 999px; box-shadow: var(--shadow); }
  .globe-key { top: 14px; right: 10px; padding: var(--sp-2) var(--sp-2); gap: var(--sp-1); }
  .globe-ctrls .g-btn { width: 44px; height: 44px; border-radius: 50%; -webkit-touch-callout: none; user-select: none; }
  .g-btn[data-g="world"] { margin: 0; border: 0; border-radius: 50%; }
  .globe-card:not([hidden]) ~ .globe-ctrls { display: none; }
  /* Tips: a banner under the header, shown once (it folds into "?" 8 s after the planet appears, or on the first touch: GLOBE-2 #1) */
  .globe-legend { top: 10px; left: 10px; bottom: auto; max-width: calc(100% - 20px); }
  /* One control surface (UX-9 #8): the "?" lives in the toolbar; folded tips leave nothing floating over the globe */
  .globe-ctrls .g-tips { display: grid; }
  .globe-legend:not([data-open="true"]) { display: none; }
  .globe-card { left: 10px; right: 10px; width: auto; bottom: 86px; }
  /* Bottom sheet (UX-5 #4): peek (country and count) · half · full; drag the handle or tap it */
  .globe-panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; height: 92%;
    border-radius: 20px; box-shadow: var(--shadow-sheet);
    transform: translateY(calc(100% - var(--gp-peek))); transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .globe-panel[data-sheet="half"] { transform: translateY(45%); }
  .globe-panel[data-sheet="full"] { transform: none; }
  .globe-panel.dragging { transition: none; }
  .gp-handle, .gp-head { touch-action: none; }
  .gp-handle { display: grid; place-items: center; flex: none; width: 100%; height: 44px; margin-bottom: -18px; cursor: grab; }
  .gp-handle span { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); }
  .gp-head { padding: var(--sp-1) var(--sp-4) var(--sp-3); cursor: pointer; }
  /* Peek row: "Stations in view · N" (UX-8 #7); the country's list is under it when the sheet opens */
  .gp-inview { display: flex; align-items: center; gap: var(--sp-2); flex: none; min-height: 44px; margin: 0 var(--sp-2) var(--sp-1); padding: 0 var(--sp-2); border-radius: var(--r-sm); color: var(--text); font: 500 var(--fs-md) var(--font); text-align: left; }
  .gp-inview .ic { width: 20px; height: 20px; color: var(--muted); }
  .gp-inview b { font-variant-numeric: lining-nums tabular-nums; }
  .gp-inview:hover { background: var(--surface-2); }
  /* One count (GLOBE-2 #4): the count opens the stations in view; "Stations without a location" is a quiet link beside it */
  .gp-peekrow { display: flex; align-items: center; gap: var(--sp-1); flex: none; margin: 0 var(--sp-2) var(--sp-1); }
  .gp-peekrow .gp-inview { flex: 1 0 auto; margin: 0; white-space: nowrap; } /* the count stays on one line; the link wraps */
  .gp-noloc { flex: 0 1 auto; min-height: 44px; padding: 0 var(--sp-2); color: var(--muted); font: 400 var(--fs-sm)/var(--lh-sm) var(--font); text-align: right; text-decoration-color: var(--line-strong); }
  .gp-noloc[hidden] { display: none; }
  .gp-noloc:hover { color: var(--text); }
  .gp-noloc:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; border-radius: var(--r-sm); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* A frozen quarter arc reads as broken: the 22 px spinner keeps a slow turn (FIX-16 B3) */
  .spinner { animation: spin 2.4s linear infinite !important; }
}
.tile.device { background: var(--device); color: var(--device-text); border-color: var(--device-line); }

@media (max-width: 820px) {
  /* The mini player: station, the meter, then Stop (FIX-16: the Sound button is gone) */
  .player { grid-template-columns: 1fr auto auto; }
  .p-right { display: flex; order: 1; }
  .p-controls { order: 2; }
  .p-right { gap: var(--sp-2); }
  .p-right > :not(.vu) { display: none; } /* the meter stays in the mini player (POLISH-2 #3) */
  /* Room on a phone: while the status slot speaks, it gets the line; off air the flat meter gives way to Try next */
  .p-sub:has(.p-state:not(:empty)) .p-line { display: none; }
  .player[data-state="failed"] .p-right .vu { display: none; }

}

/* ---------- Search results (UX-1 #3) ---------- */
.results-title { margin: var(--sp-2) 0 var(--sp-4); }
.rgroup { margin-bottom: var(--sp-6); }
.rhead { display: flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-3); font-size: var(--fs-lg); line-height: var(--lh-lg); }
.rgroup .more { margin-top: var(--sp-4); }
.rlist { display: grid; gap: var(--sp-2); grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.rrow {
  display: flex; align-items: center; gap: var(--sp-3); min-height: 56px; padding: var(--sp-2) var(--sp-3); text-align: left;
  background: var(--surface); border: 1px solid var(--line-control); border-radius: var(--r-md);
  transition: border-color 0.15s, background 0.15s;
}
.rrow:hover { border-color: var(--text); }
.rrow-name { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rchips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.rchips .chip { min-height: 44px; }
@media (max-width: 820px) {
  #scope-label { display: none; } /* flag + × only on phones; the name stays in the accessible label */
}
.rnote { margin: -6px 0 var(--sp-5); color: var(--muted); }


/* ---------- Phones: now playing as a card (UX-4b2 #2): the same hero on the page surface ---------- */
@media (max-width: 820px) {
  .hero { margin-bottom: var(--sp-5); grid-template-areas: "tuner"; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-auto-rows: auto; }
  .tile-trend { display: none; } /* desktop-only tile */
  /* Filled surface, no outline; the readout block 16 px under the name, its buttons on the readout's baseline */
  .tuner.device { background: var(--surface); color: var(--text); border: 0; box-shadow: none; border-radius: var(--r-lg); padding: var(--sp-4); gap: var(--sp-4); }
  .tuner .t-main { gap: var(--sp-3); }
  .tuner .t-art { width: 88px; height: 88px; }
  /* kicker + 2 title lines + genre: 16 + 4 + 48 + 4 + 16 = the 88 px artwork */
  .tuner .t-read { --tn: var(--fs-xl); --tln: var(--lh-xl); height: calc(var(--lh-sm) + var(--sp-1) + var(--tln) * 2 + var(--sp-1) + var(--lh-sm)); }
  .tuner .t-kicker { color: var(--muted); }
  .tuner .t-name { color: var(--text); }
  .tuner .t-sub { height: var(--lh-sm); color: var(--muted); font-size: var(--fs-sm); line-height: var(--lh-sm); }
  .tuner .t-zero, .tuner .t-unit, .tuner .t-big.idle .t-num, .tuner .t-fmt { color: var(--muted); }
  .tuner .t-big { color: var(--text); }
  .tuner .t-ph { --t-big: clamp(24px, 37.7cqi - 71px, 40px); }
  .tuner .t-info, .tuner #hero-fav { color: var(--muted); }
  .tuner .t-info:hover:not(:disabled), .tuner #hero-fav:hover { background: var(--surface-2); color: var(--text); }
  .tuner #hero-fav.on { color: var(--green-ink); }
}

/* ---------- Station details (UX-2 #6) ---------- */

.details {
  width: min(480px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 48px)); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
}
.details::backdrop { background: var(--scrim); }
/* Sheet header (GENRE-1 A): fixed while the content scrolls under it; the title block takes the row whatever comes
   before it, so Close is always the 44 px button at the top right, inset --sp-3, on the title's first line */
.details { overflow-y: auto; overscroll-behavior: contain; }
.d-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4); background: var(--surface);
}
.d-head h2 { margin: 0; font-size: var(--fs-xl); line-height: var(--lh-xl); letter-spacing: var(--track-normal); }
.d-head h2:focus { outline: none; } /* focused on open so a screen reader announces it; not a control (GENRE-1 A2) */
.d-head > div:not(.d-art) { flex: 1; min-width: 0; padding-top: calc((44px - var(--lh-xl)) / 2); }
.d-head .d-art { margin-top: calc((44px - var(--lh-xl)) / 2); }
.d-close { flex: none; width: 44px; height: 44px; margin-inline-start: auto; }
.d-sub { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-sm); }
.d-art { position: relative; display: grid; place-items: center; overflow: hidden; flex: none; width: 56px; height: 56px; --art-r: var(--r-sm); }
.d-art > * { grid-area: 1 / 1; }
.d-art img:not(.ok) { opacity: 0; }
.d-list { margin: 0; padding: var(--sp-1) var(--sp-4) var(--sp-4); display: grid; gap: 0; }
.d-row { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--line); }
.d-row dt { padding-top: 2px; } /* on the dd's first line */
.d-row dd { margin: 0; overflow-wrap: anywhere; }
.d-row code { font: 500 var(--fs-sm) var(--mono); }
.d-row a { color: var(--green-ink); }
.d-foot { padding: 0 var(--sp-4) var(--sp-4); }
.d-form, .d-done { padding: var(--sp-1) var(--sp-4) var(--sp-4); }
.d-done p { margin: 0 0 var(--sp-4); }

/* ---------- Forms (WEB-LAUNCH-1 #5 and #7): claim page, Report a problem, Send feedback ---------- */
/* Every field has a visible label; hints sit between label and field. An error shows under its field after a send,
   in body text with a red mark (the red is the mark, not the text: --danger is under 4.5:1 on the light surfaces). */
.fm { display: flex; flex-direction: column; gap: var(--sp-4); }
.set-card.fm-card { padding: var(--sp-4); } /* (after .set-card's 0 16px) */
.set-card.fm-card > * + * { border-top: 0; }
.fm-field { display: flex; flex-direction: column; gap: var(--sp-2); margin: 0; padding: 0; border: 0; min-width: 0; }
.fm-label { padding: 0; font-size: var(--fs-md); font-weight: 500; line-height: var(--lh-md); color: var(--text); }
.fm-opt { font-weight: 400; color: var(--muted); }
.fm-hint, .fm-intro { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--muted); }
.fm-input {
  width: 100%; min-height: 44px; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--line-control); border-radius: var(--r-sm);
  background: var(--bg); color: var(--text); font: inherit; font-size: var(--fs-md); line-height: var(--lh-md);
}
textarea.fm-input { resize: vertical; min-height: 88px; }
.fm-input[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.fm-choices { display: flex; flex-direction: column; }
.fm-choice { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; font-size: var(--fs-md); line-height: var(--lh-md); cursor: pointer; }
.fm-choice input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--green); }
.fm-choice input[aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: 2px; }
.fm-error { display: flex; gap: var(--sp-2); align-items: baseline; margin: 0; font-size: var(--fs-sm); font-weight: 500; line-height: var(--lh-sm); color: var(--text); }
.fm-error::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); transform: translateY(-1px); }
.fm-error[hidden] { display: none; }
.fm-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.fm-actions .btn { min-height: 44px; justify-content: center; }
.fm-actions .btn:disabled { opacity: 0.6; cursor: progress; }
.fm-status { margin: 0; font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--muted); }
.fm-status:empty { display: none; }
.fm-status[data-kind="error"], .fm-status[data-kind="ok"] { color: var(--text); font-weight: 500; }
.fm-status[data-kind="error"]::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: var(--sp-2); border-radius: 50%; background: var(--danger); }
.fm-done:focus { outline: none; }
.fm-station { font-size: var(--fs-md); font-weight: 500; }
.fm-switch { margin: var(--sp-3) 0 0; padding: var(--sp-1) var(--sp-4); border-radius: var(--r-md); background: var(--surface); }
.fm-switch .fm-hint { padding-bottom: var(--sp-2); }
.doc .fm { max-width: 520px; margin-top: var(--sp-4); }
@media (max-width: 820px) {
  .details { margin: auto 0 0; width: 100vw; max-width: 100vw; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
  /* Grab handle (decorative): a swipe down on the header closes the sheet (app.js) */
  .d-head { touch-action: none; }
  .d-head::before {
    content: ""; position: absolute; top: var(--sp-2); left: 50%; width: 36px; height: 5px; margin-left: -18px;
    border-radius: 3px; background: var(--line-control);
  }
}
/* Country sheet on phones (UX-11 B1): full height, the list first, the field under the title */
.csheet[open] {
  display: flex; flex-direction: column; height: calc(100dvh - var(--sp-6)); max-height: none; overflow: hidden;
  animation: sheet-up var(--dur-2) cubic-bezier(0.2, 0, 0, 1); transition: transform var(--dur-2) cubic-bezier(0.2, 0, 0, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .csheet[open] { animation: none; transition: none; } }
.csheet .d-head { touch-action: none; } /* the swipe down that closes it */
.csheet .d-head h2 { flex: 1; min-width: 0; }
.csheet .d-close { width: 44px; height: 44px; }
.cs-search {
  display: flex; align-items: center; gap: var(--sp-2); flex: none; height: 44px; margin: 0 var(--sp-4) var(--sp-2); padding: 0 var(--sp-4);
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-control); color: var(--muted);
}
.cs-search:focus-within { border-color: var(--text); }
.cs-search .ic { width: 20px; height: 20px; flex: none; }
.cs-search input { flex: 1; min-width: 0; height: 44px; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
.csheet .cpick-list {
  position: static; flex: 1; width: auto; max-height: none; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 0 env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; background: none;
}
.csheet .cpick-list li { min-height: 56px; }
.tuner { justify-content: space-between; }

/* ---------- Genre chip bar (UX-2 #8) ---------- */
.chipbar { position: relative; margin-bottom: var(--sp-5); }
.chipbar .chips { margin-bottom: 0; scroll-padding-inline: var(--sp-6); }
/* Edge fades only where there is more to scroll */
.chipbar.fade-start .chips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 72px); mask-image: linear-gradient(90deg, transparent 0, #000 72px); }
.chipbar.fade-end .chips { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 72px), transparent); }
.chipbar.fade-start.fade-end .chips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 72px, #000 calc(100% - 72px), transparent); mask-image: linear-gradient(90deg, transparent 0, #000 72px, #000 calc(100% - 72px), transparent); }
.chip-nav {
  position: absolute; top: 50%; z-index: 1; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line-control); color: var(--text); box-shadow: var(--shadow);
}
.chip-nav.prev { left: -8px; }
.chip-nav.next { right: -8px; }
.chip-nav svg { width: 20px; height: 20px; }
@media (pointer: coarse) {
  .chip-nav { display: none; }
  .chips { scroll-snap-type: x mandatory; } /* snap on touch */
  .chip { scroll-snap-align: start; }
}
/* "More genres" is a regular chip with a caret: outline, fill while its sheet is open (UX-9 #6) */
.chip-more { display: inline-flex; align-items: center; gap: var(--sp-1); padding-right: var(--sp-3); }
.chip-more .ic { width: 16px; height: 16px; }
.g-groups { padding: var(--sp-1) var(--sp-4) var(--sp-4); display: grid; gap: var(--sp-4); }
.g-groups h3 { margin: 0 0 var(--sp-2); }
@media (max-width: 820px) {
  .chipbar { margin-bottom: var(--sp-5); }
  .chipbar .chips { scroll-padding-inline: var(--sp-4); }
}

/* ---------- Empty Favorites / Recent (UX-2 #10) ---------- */
/* One shrinkable column: an auto column grew to the widest row's unwrapped subline, and the page scrolled sideways
   on phones (DEEPTEST-1 #1) */
.lib-empty { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); }
.lib-text { margin: 0; color: var(--muted); max-width: 60ch; }
.lib-text strong { color: var(--text); }
.lib-empty .rhead { margin: var(--sp-2) 0 0; }
.btn-sm { height: 44px; padding: 0 var(--sp-4); margin-left: auto; max-width: 100%; }
.btn-sm span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Resume on Recent (FIX-14): a secondary pill on its own row under the heading, never the filled amber of the player.
   One line with an ellipsis, 44 px; the play mark stays solid */
.resume-row { order: 3; flex-basis: 100%; min-width: 0; } /* desktop: under the title row, which keeps the toggle */
.resume-row:has(.btn-resume[hidden]) { display: none; }
@media (max-width: 820px) { .section-head .resume-row { order: 0; } } /* phones: under the title, before the layout toggle */
.btn-resume {
  display: inline-flex; align-items: center; gap: var(--sp-2); max-width: 100%; height: 44px;
  padding: 0 var(--sp-4); border-radius: 999px; border: 1px solid var(--line-control); background: var(--surface); color: var(--text); font-weight: 500;
}
.btn-resume[hidden] { display: none; }
.btn-resume svg { flex: none; width: 20px; height: 20px; fill: currentColor; }
.btn-resume span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-resume:hover { background: var(--surface-2); }
.btn-resume:focus-visible { outline: 2px solid var(--green-ink); outline-offset: 2px; }

/* ---------- Touch targets: every control has a >= 44×44 hit area (UX-2 #12) ----------
   Visual sizes stay; invisible ::after overlays or taller boxes extend the target. */
.icon-btn { width: 44px; height: 44px; }
.g-btn { width: 44px; height: 44px; }
.chips { padding-top: var(--sp-1); padding-bottom: var(--sp-1); }
.chip, .toggle, .more, .gc-close, .gc-open { position: relative; }
.chip::after, .toggle::after, .more::after { content: ""; position: absolute; inset: -4px 0; }      /* 36 → 44 */
.gc-open::after { content: ""; position: absolute; inset: -6px 0; } /* 32 → 44 */
.gc-close::after { content: ""; position: absolute; inset: -8px; }
/* Select can't take ::after: a 44px box with a transparent 4px border, the visible 36px pill drawn inside */
.tools select { height: 44px; border: 4px solid transparent; background-clip: padding-box; } /* 44 px hit box, 36 px pill */
/* Sort on phones (UX-9 #6): a face the size of the other controls (36 px pill in a 44 px hit area, 13 px medium),
   with the short name; the transparent select on top takes the taps and keeps 16 px text so iOS never zooms */
.sort-pick { position: relative; display: inline-flex; flex: none; }
.sort-face { display: none; }
@media (max-width: 820px) {
  .section-head .tools .sort-pick { margin-left: auto; }
  .sort-face { display: inline-flex; align-items: center; gap: var(--sp-1); height: 36px; margin: var(--sp-1) 0; padding: 0 var(--sp-3) 0 var(--sp-3); border-radius: 999px;
    background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text); font: 500 var(--fs-sm) var(--font); white-space: nowrap; transition: background 0.15s; }
  .sort-face .ic { width: 16px; height: 16px; color: var(--muted); }
  .sort-pick select { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; }
  .sort-pick:hover .sort-face { background: color-mix(in srgb, var(--surface-2) 85%, var(--text)); }
  .sort-pick:has(select:focus-visible) .sort-face { outline: 2px solid var(--green-ink); outline-offset: 2px; }
}
/* 320 px phones: the HQ toggle drops its icon (its text and amber fill still say on/off) so the row ends at the gutter */
@media (max-width: 359px) { #hq .ic { display: none; } }
.tools select:hover { color: var(--text); }
.d-row a { display: inline-flex; align-items: center; min-height: 44px; margin: calc(-1 * var(--sp-3)) 0; }
/* Sliders: 44px tall input, the 4px track drawn inside */
input[type="range"] { height: 44px; background: transparent !important; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: var(--track, linear-gradient(to right, var(--device-text) var(--fill, 80%), var(--device-line) var(--fill, 80%)));
}
input[type="range"]::-moz-range-track {
  height: 4px; border-radius: 4px;
  background: var(--track, linear-gradient(to right, var(--device-text) var(--fill, 80%), var(--device-line) var(--fill, 80%)));
}
input[type="range"]::-webkit-slider-thumb { margin-top: -5px; }
@media (max-width: 820px) {
  .g-btn { width: 44px; height: 44px; }
  .gp-handle { height: 44px; padding-top: 0; margin-bottom: -18px; }
}

/* Search "Top match" can hold a country row and a genre row (UX-2 #17, DEEPTEST-1 #13) */
.rlist + .rchips { margin-top: var(--sp-3); }
.rlist + .rlist { margin-top: var(--sp-2); }

/* ---------- Info pages: terms, privacy, licences (LEGAL-1, LEGAL-MIN-1) ---------- */
/* Footer links (LEGAL-MIN-1 #2): even 24 px between words (8 px padding each side + 8 px gap), each ≥ 44 px, the
   first word on the text edge; no underline except on hover and keyboard focus, like the Settings rows */
.legal-links { display: flex; flex-wrap: wrap; gap: 0 var(--sp-2); }
.legal-foot .legal-links { margin: 0 calc(-1 * var(--sp-2)); }
.legal-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--sp-2); border-radius: var(--r-sm); color: var(--muted); text-decoration: none; }
.legal-links a:is(:hover, :focus-visible) { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.doc { max-width: 720px; padding-bottom: var(--sp-8); }
/* Privacy and terms (PRELAUNCH-1 #2): pages of their own, generated by tools/legal-pages.mjs */
body.legal-page::after { display: none; } /* no mini player here, so no band under it */
.legal-page { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.legal-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0 var(--sp-4); }
.legal-top .brand { display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; color: var(--text); text-decoration: none; font-family: var(--font-device); font-weight: 600; font-size: var(--fs-xl); letter-spacing: var(--track-tight); }
.legal-top .btn { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.legal-foot { margin-top: var(--sp-6); padding-top: var(--sp-4); border-top: 1px solid var(--line); font-size: var(--fs-sm); color: var(--muted); }
.legal-foot p { margin: 0 0 var(--sp-2); }
.legal-foot a, .legal-links a[aria-current="page"] { color: var(--muted); }
.legal-links a[aria-current="page"] { color: var(--text); font-weight: 500; }
.doc-table { overflow-x: auto; margin: var(--sp-3) 0; }
.doc table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.doc th, .doc td { text-align: left; vertical-align: top; padding: var(--sp-2) var(--sp-2); border-bottom: 1px solid var(--line); }
.doc th { color: var(--muted); font-weight: 500; }
.doc h1 { margin: var(--sp-2) 0 var(--sp-3); font-size: var(--fs-3xl); line-height: var(--lh-3xl); letter-spacing: var(--track-normal); }
.doc h1:focus { outline: none; }
.doc h2 { margin: var(--sp-6) 0 var(--sp-2); font-size: var(--fs-lg); line-height: var(--lh-lg); }
.doc h3 { margin: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-md); line-height: var(--lh-md); }
.doc p, .doc li { font-size: var(--fs-md); line-height: var(--lh-read); }
.doc p { margin: 0 0 var(--sp-3); }
.doc ul { margin: 0 0 var(--sp-3); padding-left: var(--sp-5); }
.doc a { color: var(--green-ink); text-decoration: underline; text-underline-offset: 2px; }
/* Terms and Privacy (LEGAL-MIN-1 #3, #4): short sections led by a bold heading. "Stations." runs into its text; a
   heading without a full stop ("What we collect") sits on its own line. 16 px between sections. */
.doc-updated { color: var(--muted); font-size: var(--fs-sm) !important; }
.doc .nowrap { white-space: nowrap; }
.doc-sec { margin: 0 0 var(--sp-4); font-size: var(--fs-md); line-height: var(--lh-read); scroll-margin-top: var(--sp-4); }
.doc .doc-sec h2 { margin: 0; font-size: var(--fs-md); line-height: inherit; font-weight: 500; }
.doc-sec p { margin: 0; }
.doc-sec.run-in h2, .doc-sec.run-in p { display: inline; }
/* LEGAL-MIN-2: a section title on its own line leads the section: one size up, full --text, body in --text-read */
.doc .doc-sec:not(.run-in) { margin-top: var(--sp-6); }
.doc .doc-sec:not(.run-in) h2 { margin: 0 0 var(--sp-1); font-size: var(--fs-lg); line-height: var(--lh-lg); color: var(--text); }
.doc .doc-sec:not(.run-in) p { color: var(--text-read); }
.doc .fm-switch { margin-bottom: var(--sp-2); }

/* ---------- Station, country and genre pages (WEB-LAUNCH-1 #2), generated by scripts/build-pages.mjs ----------
   The info-page shell (header, footer) with the app's artwork frame, buttons and chips. No layout shift: every logo
   has its size before it loads, and the Play button keeps its width between Play and Pause. */
.st-page main { padding-bottom: var(--sp-4); }
.st-page h1 { margin: var(--sp-2) 0 var(--sp-2); font-size: var(--fs-3xl); line-height: var(--lh-3xl); letter-spacing: var(--track-normal); overflow-wrap: anywhere; }
.st-page h2 { margin: var(--sp-8) 0 var(--sp-3); font-size: var(--fs-lg); line-height: var(--lh-lg); }
.st-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 var(--sp-2); padding: 0; list-style: none; font-size: var(--fs-sm); color: var(--muted); }
.st-crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.st-crumbs li + li::before { content: "/"; padding: 0 var(--sp-1); color: var(--muted); }
.st-crumbs a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 var(--sp-1); border-radius: var(--r-sm); color: var(--muted); text-decoration: none; }
.st-crumbs li:first-child a { margin-left: calc(-1 * var(--sp-1)); }
.st-crumbs a:is(:hover, :focus-visible) { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.st-crumbs [aria-current] { padding: 0 var(--sp-1); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-art { position: relative; display: grid; place-items: center; flex: none; overflow: hidden; border-radius: var(--r-md);
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); container-type: inline-size; }
.st-art > * { grid-area: 1 / 1; }
.st-art img { position: relative; width: 100%; height: 100%; object-fit: contain; padding: 12%; background: var(--surface-2); }
.st-art-lg { width: 128px; height: 128px; }
.st-art-sm { width: 48px; height: 48px; border-radius: var(--r-sm); }
.st-hero { display: flex; align-items: flex-start; gap: var(--sp-5); margin: var(--sp-2) 0 var(--sp-6); }
.st-head { flex: 1; min-width: 0; }
.st-where { margin: 0 0 var(--sp-4); font-size: var(--fs-md); color: var(--muted); }
.st-actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.st-actions .btn { min-height: 44px; text-decoration: none; }
.st-actions .btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.st-play { min-width: 120px; justify-content: center; }
.st-play svg { fill: currentColor; }
.st-play .i-stop, .st-play:is([data-state="live"], [data-state="connecting"]) .i-play { display: none; }
.st-play:is([data-state="live"], [data-state="connecting"]) .i-stop { display: block; }
.st-status { min-height: 1.5em; margin: var(--sp-2) 0 0; font-size: var(--fs-sm); color: var(--muted); }
.st-play[data-state="failed"] ~ .st-status, .st-actions:has([data-state="failed"]) + .st-status { color: var(--danger); }
.st-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--sp-4) var(--sp-6); margin: 0; padding: var(--sp-4); border-radius: var(--r-md); background: var(--surface); }
.st-facts dt { margin: 0 0 2px; font-size: var(--fs-sm); color: var(--muted); }
.st-facts dd { margin: 0; font-size: var(--fs-md); overflow-wrap: anywhere; }
.st-page main a:not(.btn, .chip, .st-row, .st-crumbs a) { color: var(--green-ink); text-decoration: underline; text-underline-offset: 2px; }
.st-count { margin: 0 0 var(--sp-4); font-size: var(--fs-sm); color: var(--muted); }
.st-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-1) var(--sp-4); margin: 0 calc(-1 * var(--sp-2)); padding: 0; list-style: none; } /* rows inset 8 px for their hover; the list lines up with the text */
.st-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 64px; padding: var(--sp-2); border-radius: var(--r-md); color: var(--text); text-decoration: none; }
.st-row:hover { background: var(--surface); }
.st-row:focus-visible { outline: 2px solid var(--green); outline-offset: 0; }
.st-row-text { display: flex; flex-direction: column; min-width: 0; }
.st-row-name { font-size: var(--fs-md); font-weight: 500; line-height: var(--lh-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-row-meta { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-genres ul { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-5); padding: 0; list-style: none; }
.st-genres .chip { display: inline-flex; align-items: center; height: 44px; text-decoration: none; }
.st-genres .chip:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* SEO-3: the country page's Cities and Genres rows, and a station's "More from <city>" */
.st-genres h2 { margin: var(--sp-5) 0 var(--sp-2); font-size: var(--fs-md); line-height: var(--lh-md); }
.st-more { margin: var(--sp-3) 0 0; }
.st-more a { display: inline-flex; align-items: center; min-height: 44px; color: var(--green-ink); }
.st-note { margin: var(--sp-8) 0 0; font-size: var(--fs-sm); color: var(--muted); }
.st-note a, .st-links a { color: var(--green-ink); }
.st-links { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); margin: var(--sp-2) 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.st-links a { display: inline-flex; align-items: center; min-height: 44px; }
/* Verified (WEB-LAUNCH-1 #5): neutral, not amber, so it never reads as an action or as Sponsored */
.st-badge { display: inline-flex; align-items: center; gap: var(--sp-2); margin: 0 0 var(--sp-3); padding: var(--sp-1) var(--sp-2); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: var(--fs-sm); font-weight: 500; box-shadow: inset 0 0 0 1px var(--line-strong); }
.st-badge svg { width: 16px; height: 16px; fill: currentColor; }
@media (max-width: 520px) {
  .st-hero { flex-direction: column; gap: var(--sp-4); }
  .st-art-lg { width: 96px; height: 96px; }
}
@media (prefers-reduced-motion: reduce) { .st-play { transition: none; } }


/* ---------- Settings (owner, 17 Oct): a tab of its own, route #settings ----------
   Groups top to bottom: Appearance (Theme, Station lists), Legal and contact (with the version under it). Each group is a heading over one
   surface card of 44 px rows with hairlines between them. On the 4 px grid: 24 px between groups, 8 px under a heading. */
body[data-view="settings"] .topbar { display: none; }
.settings-view { max-width: 640px; display: flex; flex-direction: column; gap: var(--sp-6); padding-top: var(--sp-2); }
.settings-h { margin-top: var(--sp-2); }
.settings-h:focus { outline: none; }
.set-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.set-group-h { margin: 0; padding: 0; font-size: var(--fs-lg); font-weight: 500; line-height: var(--lh-lg); color: var(--text); }
.set-card { margin: 0; padding: 0 var(--sp-4); list-style: none; border-radius: var(--r-md); background: var(--surface); }
.set-card > * + * { border-top: 1px solid var(--line); }
.set-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 44px; padding: var(--sp-1) 0; color: var(--text); font-size: var(--fs-md); line-height: var(--lh-md); text-decoration: none; }
.set-ctl { min-height: 56px; flex-wrap: wrap; }
.set-ctl .set-label { flex: 1; min-width: 0; }
/* Link rows fill to the card's edge on hover; the focus ring sits inside so nothing clips it */
.info-rows .set-row { margin: 0 calc(-1 * var(--sp-4)); padding: var(--sp-1) var(--sp-4); border-radius: 0; }
.info-rows li:first-child .set-row { border-radius: var(--r-md) var(--r-md) 0 0; }
.info-rows li:last-child .set-row { border-radius: 0 0 var(--r-md) var(--r-md); }
.info-rows a.set-row:hover { background: var(--surface-2); }
.info-rows .set-row:focus-visible { outline-offset: -2px; }
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-value { font-size: var(--fs-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-chev { width: 16px; height: 16px; flex: none; color: var(--muted); }
/* About: read-only rows (label left, value right) and the licences link (Version 1.0.0, Build 2026.11.08 (abc1234)), read-only rows */
.about-rows div.set-row .set-label { flex: 1; min-width: 0; }
.about-rows div.set-row .set-value { flex: none; font-size: var(--fs-md); font-variant-numeric: lining-nums proportional-nums; }
/* Segmented control (radios): selected = a3 fill + accent ink, like a selected chip (UX-4b2 #6); 44 px tall */
.seg-text .seg-opt { position: relative; display: inline-grid; place-items: center; min-width: 64px; height: 40px; padding: 0 var(--sp-3);
  border-radius: 999px; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.seg-text .seg-opt::after { content: ""; position: absolute; inset: -2px 0; } /* 44 px tall hit area */
.seg-text input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
.seg-text .seg-opt:hover { color: var(--text); }
/* the a3 tint sits on --surface (not the track's --surface-2) so amber ink keeps ≥ 4.5:1 */
.seg-text .seg-opt:has(input:focus-visible) { outline: 2px solid var(--green-ink); outline-offset: 2px; }
/* Focus targets clear the sticky top bar */
.doc [tabindex="-1"] { scroll-margin-top: 96px; }

/* ---------- UX-4a: three playback states, no idle placeholders ---------- */
/* Off air: text says it; the red dot only reinforces it (state never by colour alone) */
.off-dot { display: inline-block; width: 7px; height: 7px; margin-right: var(--sp-2); border-radius: 50%; background: var(--danger); vertical-align: 1px; }
.t-kicker.off { color: var(--device-text); }
.c-sub.off, .row-sub.off { color: var(--text); font-weight: 500; }
.c-sub.off::before, .row-sub.off::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: var(--sp-2); border-radius: 50%; background: var(--danger); vertical-align: 1px;
}
/* Off air (POLISH-2 #2): Next becomes "Try next station", outlined in amber */
.player #p-next.try { color: var(--device-accent); box-shadow: inset 0 0 0 1px var(--device-accent); }
/* Idle player offers the top pick: the art is real, the play button is live */
.player:not(.has-pick)[data-state="idle"] .p-art:empty { visibility: hidden; }

/* Connecting card: the play-button spinner, no cryptic badge (UX-4a S2) */
.card.connecting .art::after { content: none; }
.art-overlay .spinner { display: none; } /* inherits the overlay disc's colour, like the player's play button */
.art-overlay > span .spinner { width: 22px; height: 22px; }
.card.connecting .art-overlay .i-play, .card.connecting .art-overlay .i-stop { display: none; }
.card.connecting .art-overlay .spinner { display: block; }

/* Card titles: one line with an ellipsis, full name in title + details (owner, 19 Nov; was two lines, UX-4a T4). The
   ellipsis sits on an inner span, which WebKit honours on a <button> (UX-11 A1). The name is as tall as its line; the
   .c-text block keeps every card in a row the same height (UI-4 #1). */
.c-name { white-space: nowrap; overflow: hidden; line-height: var(--lh-md); }
.c-play { display: block; width: 100%; line-height: var(--lh-md); }
.c-name-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 820px) {
  /* Phones: .app already reserves tab bar + mini player + safe area, and .main adds 24 px, so nothing
     sits behind the mini player (UX-4a L7; guarded by a test). The compact hero stays one row. */
}

/* ---------- UX-4b: one country control, hero = now playing ---------- */
.hero.solo { grid-template-columns: minmax(0, 1fr); grid-template-areas: "tuner"; }
.tile-trend h2.label { margin: 0 0 var(--sp-1); }
/* The current song sits under the station name (the old "Now playing" card) */
/* While playing the hero's action is Favourite, a quiet button: the player owns pause + LIVE */
.btn-quiet { background: var(--device-2); color: var(--device-text); box-shadow: inset 0 0 0 1px var(--device-line); }
.btn-quiet svg { width: 18px; height: 18px; fill: currentColor; }
.btn-quiet.on svg { color: var(--device-accent); }
.btn-quiet:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
/* Station count is the section subtitle (replaces the Country card and count badge) */
.section-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.section-sub { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.section-sub:empty { display: none; }
/* A reload's inline progress in the count line (UI-2 #2): the list above stays at full strength */
.list-busy { display: inline-flex; align-items: center; gap: var(--sp-2); }
.list-busy .spinner { width: 12px; height: 12px; border-width: 1.5px; color: var(--muted); }
@media (max-width: 820px) {
  /* Phones: title on its own line, then "78 stations" and HQ / sort share one row (UX-4b L8) */
  /* (UX-4b2: the layout toggle joined HQ / sort, so the tools get their own row and the count sits under the title) */
  .section-head { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "sub" "tools"; align-items: center; gap: 0 var(--sp-2); margin-bottom: var(--sp-2); }
  .section-title { display: contents; }
  .section-head h2 { grid-area: title; }
  .section-sub { grid-area: sub; min-width: 0; }
  .section-head .tools { grid-area: tools; margin: 0; }
  /* Layout, HQ only and sort keep their size and the row scrolls when a narrow phone can't fit them (DEEPTEST-1 #7).
     Edge to edge like the genre chips; 4 px of padding keeps focus rings and hit areas inside the scroller. */
  .section-head .tools { margin: var(--sp-1) calc(-1 * var(--sp-4)) 0 !important; padding: var(--sp-1) var(--sp-4); width: auto; overflow-x: auto; scrollbar-width: none; }
  .section-head .tools::-webkit-scrollbar { display: none; }
  .section-head .tools > * { flex: none; }
}

/* ---------- Grid / list view (UX-4b2 #3) ---------- */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); } /* 36 px, like every toolbar pill (UX-10 #5) */
.seg-btn {
  display: inline-grid; place-items: center; width: 44px; height: 32px; border-radius: 999px;
  color: var(--muted); cursor: pointer; position: relative;
}
.seg-btn::after { content: ""; position: absolute; inset: calc(-1 * var(--sp-1) - 2px) 0; } /* 44 px tall hit area */
.seg-btn svg { width: 20px; height: 20px; fill: currentColor; }
.seg-btn:hover { color: var(--text); }
.seg-btn:focus-visible { outline: 2px solid var(--green-ink); outline-offset: 2px; }
/* UI-1 #1: one selected state for chips, the HD toggle, segmented options and the grid/list toggle: the a3 tint on
   --surface and amber ink, no outline (owner, 19 Nov: the ring was too loud; option C). The amber ink and medium weight
   carry the state; the ink keeps 4.5:1 on the tint. */
.chip[aria-pressed="true"], .chip[aria-selected="true"], .toggle[aria-pressed="true"],
.seg-text .seg-opt:has(input:checked), .seg-btn[aria-pressed="true"] {
  background: linear-gradient(var(--accent-a3), var(--accent-a3)), var(--surface); color: var(--green-ink); font-weight: 500;
  box-shadow: none;
}
.results-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.results-head .results-title { margin-bottom: var(--sp-4); }
.results-head .seg { margin-bottom: var(--sp-4); }
#view-favorites .section-head, #view-recent .section-head { flex-wrap: wrap; }

/* List: one column of 64 px rows; two columns on desktop from ~900 px (UX-4b3 #3) */
body[data-layout="list"] .grid { display: flex; flex-direction: column; gap: var(--sp-1); margin-inline: calc(-1 * var(--sp-3)); } /* row art on the column edge (UX-10 #5) */
@media (min-width: 900px) {
  body[data-layout="list"] .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: var(--sp-1) var(--sp-4); }
}
.lrow {
  position: relative; display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3);
  border-radius: var(--r-md); background: transparent;
}
.lrow:hover { background: var(--surface-2); }
.lrow:has(.c-play:focus-visible) { outline: 2px solid var(--green-ink); outline-offset: 0; }
.lr-art { position: relative; display: grid; place-items: center; flex: none; width: 44px; height: 44px; --art-r: var(--r-sm); overflow: hidden; }
.lr-art > * { grid-area: 1 / 1; }
.lr-art img:not(.ok) { opacity: 0; }
.lr-meta { flex: 1; min-width: 0; }
.lr-name { margin: 0; font-size: var(--fs-md); font-weight: 500; line-height: var(--lh-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-name .c-play { display: block; max-width: 100%; height: auto; }
.lr-name .c-name-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .c-sub { margin: 0; }
.lr-state { flex: none; padding: 2px 7px; border-radius: 999px; font: 500 var(--fs-xs)/var(--lh-xs) var(--mono); letter-spacing: var(--track-caps); text-transform: uppercase; background: var(--accent-a3); color: var(--green-ink); }
.lr-state:empty { display: none; }
.lr-top { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; } /* the badges sit on the name line, ON AIR before HD (UX-10 #3) */
.lr-top .lr-name { flex: 0 1 auto; min-width: 0; }
.lrow .badge { flex: none; }
.lrow .c-fav { position: relative; top: auto; right: auto; flex: none; }
/* Playing (UX-10 #3: one signal per surface): the a2 tint, the name in amber ink and the "On air" badge. No leading
   bar, no ring round the logo. */
.lrow.playing { background: var(--accent-a2); }
.lrow.playing .lr-name { color: var(--green-ink); }
.lrow.playing .c-sub { color: var(--text); }
/* Connecting: breathes a1 → a3 + spinner; offline: dimmed, no amber */
.lrow.connecting { background: var(--accent-a1); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { background: var(--accent-a3); } }
/* Reduced motion keeps a slower breathe for loading (a colour change, no movement) */
@media (prefers-reduced-motion: reduce) { .lrow.connecting { animation: breathe 3.2s ease-in-out infinite !important; } }
.lr-spin { display: none; width: 16px; height: 16px; border-width: 2px; color: var(--green); }
.lrow.connecting .lr-spin { display: block; }
.lrow.off-air .lr-name, .lrow.off-air .lr-art { opacity: 0.55; }
.lrow .c-fav { opacity: 1; color: var(--muted); }
.lrow .c-fav::before { content: none; }
.lrow .c-fav svg { width: 20px; height: 20px; }
.lrow .c-fav:hover { color: var(--text); }
.lrow .c-fav.on { color: var(--green-ink); }
/* Mini rows: the logo is positioned (paints above the stretched play button), so let clicks through */
.row.mini .row-art, .row.mini .row-meta { pointer-events: none; }

/* ---------- Now playing when live: amber light from the artwork corner (UX-4b2 #6) ---------- */
.tuner { position: relative; isolation: isolate; }
.tuner::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 90% at 0% 0%, var(--accent-a3), transparent 60%);
  opacity: 0; transition: opacity 320ms cubic-bezier(0.4, 0, 0.2, 1);
}
.tuner.live::before { opacity: 1; }
.tuner .t-info, .tuner #hero-fav { transition: background 320ms; }
/* The 56 px amber play disc is signal enough: no halo or drop shadow while live (UX-10 #3) */
.tuner.live .t-info, .tuner.live #hero-fav { background: var(--accent-a2); }
/* Off states on the live hero are faded amber, not grey (UX-10 #4): the unlit band, the un-pressed heart, the info icon */
.tuner.live .t-info, .tuner.live #hero-fav:not(.on) svg { color: var(--accent-dim); } /* the heart's label keeps its text colour */
@media (max-width: 820px) {
  .tuner.live .t-info, .tuner.live #hero-fav:not(.on) { color: var(--accent-ink-dim); }
}
/* HD in a playing row: a faded-amber outline; its letters keep the amber ink so the text stays ≥ 4.5:1 */
.lrow.playing .badge { background: transparent; box-shadow: inset 0 0 0 1px var(--accent-ink-dim); color: var(--green-ink); }
/* Phones (POLISH-3, owner 12 Nov): a playing row shows ON AIR only, so the name keeps its room; HD comes back when it stops */
@media (max-width: 820px) { .lrow.playing .lr-top .badge { display: none; } }

/* iOS Safari zooms the page into any text field or select under 16px when it takes focus (owner bug, 17 Oct).
   On touch screens every one of them is at least 16px. Pinch zoom stays on: no maximum-scale / user-scalable=no. */
@media (pointer: coarse) {
  :root input:not([type="range"], [type="radio"], [type="checkbox"]), :root select, :root textarea { font-size: var(--fs-input); }
}

/* Country flags (FLAGS-1 #2): circle-flags images (/flags/<cc>.svg), decorative beside the country name. 14 px in text
   lines, 20 px in the country picker. A 1 px ring keeps white flags (Japan) visible on light surfaces; device panels
   ring with their own line. Worldwide is the globe icon; an unknown code gets a neutral circle, no letters. */
:is(img, svg, span).flag {
  display: inline-block; flex: none; width: 14px; height: 14px; margin-inline-end: var(--flag-gap); vertical-align: -0.2em;
  border-radius: 50%; box-shadow: 0 0 0 1px var(--line);
}
.flag-none { background: var(--surface-2); }
.flag-world { box-shadow: none; color: var(--muted); }
.cpick-flag .flag { width: 20px; height: 20px; margin: 0; }
.co-flag .flag { width: 28px; height: 28px; margin: 0; }
.rrow > .flag, .globe-peek > .flag, .globe-exit > .flag { margin: 0; } /* flex rows: their gap spaces it */
.player .flag, .globe-card .flag, .globe-peek .flag, .globe-exit .flag { box-shadow: 0 0 0 1px var(--device-line); }
.player .flag-world, .globe-card .flag-world, .globe-peek .flag-world, .globe-exit .flag-world { box-shadow: none; color: var(--device-dim); }
h1 > .flag { width: 0.8em; height: 0.8em; margin-inline-end: var(--sp-2); vertical-align: -0.05em; } /* country page heading */

/* Settings › Appearance › Accent (ACCENT-1): six swatches, 44 px targets, one row at 390 px. The picked one gets a ring
   in the text colour and a black check, so the choice doesn't rely on colour alone. */
.set-accent .set-value { color: var(--muted); font-size: var(--fs-md); }
.swatches { display: grid; grid-template-columns: repeat(6, 44px); flex-basis: 100%; gap: var(--sp-1); margin: 0 calc(-1 * var(--sp-1)); }
.swatch { position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; }
.swatch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.swatch span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--sw); color: var(--on-green); }
.swatch .ic { width: 18px; height: 18px; visibility: hidden; }
.swatch:has(input:checked) span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.swatch:has(input:checked) .ic { visibility: visible; }
.swatch:has(input:focus-visible) { outline: 2px solid var(--green-ink); outline-offset: 0; }
.set-accent .fm-hint { flex-basis: 100%; padding-bottom: var(--sp-3); }
