:root {
      --bg: #0d1116;
      --bg-soft: #131922;
      --surface: rgba(20, 27, 38, 0.88);
      --surface-strong: rgba(13, 19, 27, 0.96);
      --surface-alt: rgba(255, 255, 255, 0.04);
      --line: rgba(255, 255, 255, 0.1);
      --line-strong: rgba(255, 255, 255, 0.18);
      --text: #eef3ff;
      --muted: #9ca8c3;
      --accent: #f36f32;
      --accent-2: #2fc7b9;
      --good: #42c37c;
      --warn: #f4b740;
      --bad: #ff6f7d;
      --radius-xl: 28px;
      --radius-lg: 20px;
      --radius-md: 16px;
      --radius-sm: 12px;
      --shadow: 0 28px 70px rgba(0, 0, 0, 0.3);
      --font-ui: "Aptos", "Segoe UI Variable", "Trebuchet MS", "Segoe UI", sans-serif;
    }

    [data-theme="light"] {
      --bg: #f4eee4;
      --bg-soft: #ece4d7;
      --surface: rgba(255, 251, 245, 0.9);
      --surface-strong: rgba(255, 248, 240, 0.98);
      --surface-alt: rgba(87, 58, 34, 0.05);
      --line: rgba(73, 48, 28, 0.12);
      --line-strong: rgba(73, 48, 28, 0.22);
      --text: #1f1711;
      --muted: #6b5d50;
      --accent: #c65a22;
      --accent-2: #158c83;
      --shadow: 0 26px 60px rgba(97, 68, 40, 0.16);
    }

    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      min-height: 100vh;
      font-family: var(--font-ui);
      color: var(--text);
      background:
        radial-gradient(circle at 0% 0%, rgba(243, 111, 50, 0.22) 0%, rgba(243, 111, 50, 0.12) 18%, rgba(243, 111, 50, 0.04) 34%, transparent 52%),
        radial-gradient(circle at 100% 12%, rgba(47, 199, 185, 0.18) 0%, rgba(47, 199, 185, 0.1) 16%, rgba(47, 199, 185, 0.03) 30%, transparent 48%),
        radial-gradient(circle at 50% 100%, rgba(255, 255, 255, 0.035) 0%, transparent 42%),
        linear-gradient(180deg, var(--bg) 0%, #111722 48%, var(--bg-soft) 100%);
      background-attachment: fixed;
    }

    body::before,
    body::after {
      content: "";
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: -1;
    }

    body::before {
      background:
        radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.03) 0%, transparent 34%),
        radial-gradient(circle at 82% 18%, rgba(255, 255, 255, 0.025) 0%, transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0));
      opacity: 0.9;
    }

    body::after {
      background:
        radial-gradient(circle at 50% 120%, rgba(0, 0, 0, 0.2) 0%, transparent 42%),
        linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.06) 100%);
      opacity: 0.85;
    }

    a { color: inherit; text-decoration: none; }
    button, input, select { font: inherit; }
    button { color: inherit; }

    .skip-link {
      position: absolute;
      left: 16px;
      top: -48px;
      z-index: 1000;
      padding: 10px 14px;
      border-radius: 999px;
      background: var(--surface-strong);
      border: 1px solid var(--line-strong);
      transition: top 0.2s ease;
    }

    .skip-link:focus { top: 16px; }

    .app-shell {
      width: min(1240px, calc(100% - 28px));
      margin: 0 auto;
      padding: 20px 0 176px;
    }

    .hero,
    .panel-card,
    .player-panel,
    .donate-card,
    .toast {
      border: 1px solid var(--line);
      background: var(--surface);
      box-shadow: var(--shadow);
      backdrop-filter: blur(14px);
    }

    .hero {
      border-radius: var(--radius-xl);
      padding: 12px 16px;
      margin-bottom: 10px;
      display: grid;
      grid-template-columns: auto 1fr;
      align-items: center;
      gap: 10px;
    }

    .hero-brand {
      display: inline-flex;
      align-items: center;
      gap: 12px;
      margin: 0;
      min-width: 0;
    }

    .hero-logo {
      display: block;
      width: min(54px, 100%);
      height: auto;
      object-fit: contain;
    }

    .hero-wordmark {
      font-size: clamp(1.2rem, 2.2vw, 1.8rem);
      font-weight: 800;
      letter-spacing: 0.02em;
      line-height: 1;
      color: var(--text);
      text-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
      white-space: nowrap;
    }

    .hero-copy p,
    .metric p,
    .section-copy,
    .helper,
    .station-note,
    .empty-state p,
    .legal { color: var(--muted); }

    .hero-actions,
    .toolbar-row,
    .filter-row,
    .quick-chips,
    .player-controls,
    .volume-row,
    .donate-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      align-items: center;
    }

    .metric-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      align-content: start;
    }

    .metric {
      padding: 18px;
      border-radius: var(--radius-lg);
      background: var(--surface-alt);
      border: 1px solid var(--line);
    }

    .metric strong {
      display: block;
      font-size: 1.7rem;
      margin-bottom: 6px;
    }

    .layout {
      display: grid;
      grid-template-columns: 320px minmax(0, 1fr);
      gap: 16px;
      align-items: start;
    }

    .panel-card {
      border-radius: var(--radius-xl);
      padding: 18px;
    }

    .section-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 12px;
      margin-bottom: 14px;
    }

    .compact-head {
      margin-bottom: 10px;
      align-items: center;
    }

    .small-badge,
    .station-badge,
    .pill,
    .tab-btn,
    .chip-btn {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid var(--line);
      background: var(--surface-alt);
      color: var(--muted);
      white-space: nowrap;
    }

    .toolbar { display: grid; gap: 12px; margin-bottom: 14px; }
    .search-box, .select-wrap { position: relative; flex: 1 1 220px; }
    .stations-head { display: flex; align-items: center; gap: 10px; }
    .back-button { display: none; min-height: 36px; padding: 0 12px; }

    .search-box input,
    .select-wrap select {
      width: 100%;
      min-height: 46px;
      border-radius: 999px;
      border: 1px solid var(--line-strong);
      background: rgba(255, 255, 255, 0.04);
      color: var(--text);
      padding: 0 44px;
      outline: none;
    }

    .select-wrap select {
      appearance: none;
      -webkit-appearance: none;
      color-scheme: dark;
    }

    .select-wrap select option,
    .select-wrap select optgroup {
      color: var(--text);
      background: #111722;
    }

    [data-theme="light"] .search-box input,
    [data-theme="light"] .select-wrap select {
      background: rgba(75, 47, 26, 0.04);
    }

    [data-theme="light"] .select-wrap select {
      color-scheme: light;
    }

    [data-theme="light"] .select-wrap select option,
    [data-theme="light"] .select-wrap select optgroup {
      color: var(--text);
      background: #fff8f0;
    }

    .search-box .icon,
    .select-wrap .icon {
      position: absolute;
      top: 50%;
      left: 16px;
      transform: translateY(-50%);
      color: var(--muted);
      pointer-events: none;
    }

    .search-clear {
      position: absolute;
      top: 50%;
      right: 8px;
      transform: translateY(-50%);
      width: 32px;
      height: 32px;
      border-radius: 50%;
      border: none;
      background: transparent;
      cursor: pointer;
      color: var(--muted);
    }

    .button,
    .icon-button,
    .genre-btn,
    .station-card,
    .favorite-btn,
    .copy-btn,
    .close-btn {
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, 0.04);
      color: inherit;
      transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    }

    [data-theme="light"] .button,
    [data-theme="light"] .icon-button,
    [data-theme="light"] .genre-btn,
    [data-theme="light"] .station-card,
    [data-theme="light"] .favorite-btn,
    [data-theme="light"] .copy-btn,
    [data-theme="light"] .close-btn {
      background: rgba(75, 47, 26, 0.04);
    }

    .button,
    .icon-button,
    .copy-btn,
    .close-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      min-height: 44px;
      padding: 0 16px;
      border-radius: 999px;
      cursor: pointer;
    }

    .button:hover,
    .icon-button:hover,
    .genre-btn:hover,
    .station-card:hover,
    .favorite-btn:hover,
    .copy-btn:hover,
    .close-btn:hover {
      transform: translateY(-1px);
      border-color: var(--line-strong);
    }

    .button.primary {
      background: linear-gradient(135deg, rgba(243, 111, 50, 0.95), rgba(47, 199, 185, 0.75));
      border-color: transparent;
      color: #fff;
    }

    .button.ghost.active,
    .tab-btn.active,
    .chip-btn.active {
      color: var(--text);
      border-color: rgba(243, 111, 50, 0.55);
      background: rgba(243, 111, 50, 0.12);
    }

    .genre-list, .station-list { display: grid; gap: 10px; }
    .genre-btn { width: 100%; text-align: left; border-radius: var(--radius-lg); padding: 12px 14px; cursor: pointer; }
    .genre-btn.active { border-color: rgba(243, 111, 50, 0.5); background: linear-gradient(135deg, rgba(243, 111, 50, 0.12), rgba(47, 199, 185, 0.1)); }
    .genre-top, .station-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
    .genre-icon { width: 44px; height: 44px; border-radius: 15px; display: inline-flex; align-items: center; justify-content: center; background: linear-gradient(135deg, rgba(243, 111, 50, 0.22), rgba(47, 199, 185, 0.18)); font-size: 1.35rem; }
    .genre-name, .station-title { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0; }
    .station-card { width: 100%; border-radius: var(--radius-lg); padding: 16px; cursor: pointer; text-align: left; }
    .station-card.active { border-color: rgba(47, 199, 185, 0.55); background: linear-gradient(135deg, rgba(47, 199, 185, 0.14), rgba(255, 255, 255, 0.03)); }
    .station-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
    .favorite-btn { width: 36px; height: 36px; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
    .favorite-btn.active { color: #ffd37a; border-color: rgba(255, 211, 122, 0.38); background: rgba(255, 211, 122, 0.12); }
    .station-meta, .player-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
    .station-badge { padding: 6px 10px; font-size: 0.82rem; }
    .station-note { margin-top: 10px; font-size: 0.9rem; }
    .quick-area { display: grid; gap: 12px; margin-bottom: 14px; }
    .quick-area[hidden] { display: none; }
    .chip-btn { cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
    .empty-state { border-radius: var(--radius-lg); border: 1px dashed var(--line-strong); padding: 24px; text-align: center; background: rgba(255, 255, 255, 0.03); }
    [data-theme="light"] .empty-state { background: rgba(75, 47, 26, 0.03); }
    .status-banner { border-radius: var(--radius-lg); padding: 12px 14px; margin-bottom: 12px; border: 1px solid transparent; font-size: 0.95rem; }
    .status-banner.good { background: rgba(66, 195, 124, 0.12); border-color: rgba(66, 195, 124, 0.3); }
    .status-banner.warn { background: rgba(244, 183, 64, 0.12); border-color: rgba(244, 183, 64, 0.32); }
    .status-banner.bad { background: rgba(255, 111, 125, 0.12); border-color: rgba(255, 111, 125, 0.28); }
    .player-wrap { position: fixed; inset: auto 0 0; padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
    .player-panel { max-width: 1240px; margin: 0 auto; border-radius: 30px; padding: 14px; pointer-events: auto; background: var(--surface-strong); display: grid; grid-template-columns: minmax(0, 1.2fr) auto auto; gap: 12px; align-items: center; }
    .player-main { min-width: 0; display: grid; gap: 8px; }
    .player-title-row { display: flex; align-items: flex-start; gap: 10px; }
    .player-title { font-size: 1rem; font-weight: 800; line-height: 1.2; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .player-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.92rem; }
    .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
    .dot.good { background: var(--good); }
    .dot.warn { background: var(--warn); }
    .dot.bad { background: var(--bad); }
    .player-controls .button, .volume-row .button { min-height: 42px; }
    .volume-row { min-width: 220px; justify-content: flex-end; }
    .volume-row input[type="range"] { width: 140px; accent-color: var(--accent); }
    body[data-player="collapsed"] .player-panel { grid-template-columns: minmax(0, 1fr) auto; }
    body[data-player="collapsed"] .volume-row,
    body[data-player="collapsed"] #btnStop,
    body[data-player="collapsed"] #btnNext,
    body[data-player="collapsed"] #btnDonate { display: none; }
    .donate-modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 0, 0, 0.58); z-index: 20; }
    .donate-modal[aria-hidden="false"] { display: flex; }
    .donate-card { width: min(560px, 100%); border-radius: var(--radius-xl); padding: 22px; background: var(--surface-strong); }
    .donate-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
    .donate-item { border-radius: var(--radius-lg); border: 1px solid var(--line); padding: 14px; background: var(--surface-alt); margin-bottom: 12px; }
    .donate-item code { display: block; word-break: break-all; padding: 10px 0; color: var(--text); }
    .toast { position: fixed; right: 18px; bottom: 114px; z-index: 30; border-radius: 16px; padding: 12px 14px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease; }
    .toast.show { opacity: 1; transform: translateY(0); }
    .helper { font-size: 0.9rem; }
    .subtle:empty { display: none; }
    .legal { margin-top: 16px; font-size: 0.84rem; }
    .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; }

    button:focus-visible,
    input:focus-visible,
    select:focus-visible {
      outline: 2px solid rgba(243, 111, 50, 0.75);
      outline-offset: 2px;
    }

    @media (max-width: 760px) {
      .hero,
      .layout,
      .player-panel { grid-template-columns: 1fr; }
      .hero { padding: 10px 12px; gap: 8px; }
      .hero-actions { width: 100%; }
      .back-button { display: inline-flex; }
      body[data-mobile-pane="stations"] .genres-panel { display: none; }
      body[data-mobile-pane="genres"] .stations-panel { display: none; }
      .volume-row { justify-content: flex-start; min-width: 0; }
    }

    @media (max-width: 720px) {
      .app-shell { width: min(100% - 20px, 1240px); padding-bottom: 194px; }
      .hero, .panel-card, .player-panel, .donate-card { border-radius: 22px; }
      .hero { padding: 8px 10px; }
      .hero-logo { width: min(42px, 18vw); }
      .hero-brand { gap: 10px; }
      .hero-wordmark { font-size: 1.05rem; }
      .hero-actions {
        gap: 8px;
        justify-content: flex-end;
      }
      .hero-actions .button { flex: 0 0 auto; min-height: 34px; padding: 0 10px; font-size: 0.88rem; }
      .metric-grid { grid-template-columns: 1fr; }
      .toolbar { gap: 8px; padding: 12px; }
      .toolbar-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 6px;
      }
      .search-box, .select-wrap {
        min-width: 0;
        flex: initial;
      }
      .search-box input,
      .select-wrap select {
        min-height: 42px;
      }
      .filter-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        overflow: visible;
        padding-bottom: 0;
        gap: 8px;
      }
      .filter-row .button {
        width: 100%;
        min-height: 34px;
        padding: 0 12px;
        font-size: 0.88rem;
      }
      .filter-row .filter-reset {
        position: static;
        background: rgba(255, 255, 255, 0.04);
        border-color: var(--line);
      }
      #themeToggle { grid-column: 1 / -1; }
      .stations-head h2 { font-size: 1.05rem; }
      .player-controls { width: 100%; justify-content: stretch; }
      .player-controls .button, .player-controls .icon-button { flex: 1 1 0; }
      .volume-row { width: 100%; }
      .volume-row input[type="range"] { width: 100%; }
      .toast { right: 10px; left: 10px; bottom: 126px; }
    }
    .genres-panel,
    .stations-panel {
      display: block;
    }
