:root {
  --bg: #07080b;
  --panel: #0f1117;
  --panel-2: #151821;
  --panel-3: #1a1d26;
  --line: rgba(255,255,255,.08);
  --line-strong: rgba(255,255,255,.15);
  --text: #f7f8fb;
  --muted: #9298a7;
  --gold: #d8b15e;
  --gold-soft: rgba(216,177,94,.14);
  --red: #ff4057;
  --green: #42d392;
  --radius: 18px;
  --sidebar: 260px;
  --header-h: 76px;
  --audio-dock-h: 82px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: radial-gradient(circle at 75% -20%, rgba(216,177,94,.10), transparent 34%), var(--bg);
  color: var(--text);
}
body.has-audio-dock { padding-bottom: calc(var(--audio-dock-h) + env(safe-area-inset-bottom)); }
button, input, select { font: inherit; }
button, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; }

.topbar {
  position: fixed; z-index: 50; top: 0; left: 0; right: 0;
  min-height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: calc(12px + env(safe-area-inset-top)) 20px 12px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(7,8,11,.88);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.icon-btn { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.035); cursor: pointer; transition: .2s ease; }
.icon-btn:hover { border-color: var(--line-strong); background: rgba(255,255,255,.07); }
.menu-btn { display: none; font-size: 20px; }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; flex: 0 0 auto; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: linear-gradient(145deg, #f0ce80, #9b7430); color: #111; font-weight: 900; font-size: 20px; box-shadow: inset 0 1px rgba(255,255,255,.5), 0 8px 24px rgba(216,177,94,.12); }
.brand-copy { display: flex; flex-direction: column; line-height: 1; gap: 5px; }
.brand-copy strong { font-size: 15px; letter-spacing: .15em; }
.brand-copy small { color: var(--muted); font-size: 9px; letter-spacing: .19em; }
.top-actions { margin-left: auto; flex: 0 0 auto; }
.mode-switch { margin-left: auto; display: flex; gap: 5px; padding: 5px; border: 1px solid var(--line); background: rgba(255,255,255,.025); border-radius: 14px; }
.mode-btn { min-width: 88px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .04em; cursor: pointer; }
.mode-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.mode-btn.is-active { color: #15120b; background: linear-gradient(145deg, #f0ce80, #b58b3e); box-shadow: inset 0 1px rgba(255,255,255,.4); }

.sidebar { position: fixed; z-index: 40; top: calc(var(--header-h) + env(safe-area-inset-top)); bottom: 0; left: 0; width: var(--sidebar); border-right: 1px solid var(--line); background: rgba(10,11,15,.94); }
.sidebar-inner { height: 100%; overflow: auto; padding: 22px 16px calc(24px + env(safe-area-inset-bottom)); }
.country-box label, .sidebar-label { display: block; margin: 0 0 8px 4px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.country-box select { width: 100%; height: 46px; padding: 0 12px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.genre-box { margin-top: 18px; }
.genre-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.genre-chip { height: 30px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 10px; cursor: pointer; }
.genre-chip.is-active { border-color: rgba(216,177,94,.35); color: var(--gold); background: var(--gold-soft); }
.nav-list { margin-top: 24px; display: grid; gap: 6px; }
.nav-item { width: 100%; height: 46px; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; text-align: left; border: 0; border-radius: 12px; padding: 0 12px; background: transparent; cursor: pointer; color: #c7cbd4; }
.nav-item:hover { background: rgba(255,255,255,.04); }
.nav-item.is-active { color: var(--text); background: var(--gold-soft); }
.nav-item b { min-width: 26px; padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,.06); font-size: 10px; text-align: center; }
.sidebar-note { margin-top: 26px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; display: flex; gap: 10px; color: var(--muted); }
.sidebar-note p { margin: 0; font-size: 11px; line-height: 1.45; }
.dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px rgba(66,211,146,.5); flex: 0 0 auto; }

.main-content { margin-left: var(--sidebar); padding: calc(var(--header-h) + env(safe-area-inset-top) + 26px) 28px 34px; max-width: 1500px; }
.player-card { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--panel); box-shadow: 0 28px 80px rgba(0,0,0,.25); }
.player-stage { position: relative; aspect-ratio: 16/9; max-height: 62vh; background: #020203; overflow: hidden; }
.player-stage video { width: 100%; height: 100%; display: block; object-fit: contain; background: #000; }
.player-empty, .player-loading { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; padding: 30px; }
.player-empty { background: radial-gradient(circle, #13151a 0, #06070a 68%); }
.player-empty h1 { margin: 14px 0 7px; font-size: clamp(22px, 3vw, 36px); }
.player-empty p { margin: 0; color: var(--muted); }
.signal-icon { margin: auto; width: 66px; height: 66px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--gold); font-size: 28px; }
.player-loading { gap: 12px; background: rgba(0,0,0,.55); backdrop-filter: blur(5px); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--gold); margin: auto; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.live-badge { position: absolute; top: 16px; left: 16px; padding: 7px 10px; border-radius: 8px; background: rgba(7,8,11,.8); border: 1px solid var(--line-strong); font-size: 11px; font-weight: 800; letter-spacing: .08em; backdrop-filter: blur(8px); }
.live-badge span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; background: var(--red); box-shadow: 0 0 10px rgba(255,64,87,.7); }
.now-playing { min-height: 78px; display: grid; grid-template-columns: 48px 1fr 44px; gap: 13px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.now-logo, .radio-hero-art, .audio-dock-logo { background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-weight: 800; }
.now-logo { width: 48px; height: 48px; border-radius: 12px; font-size: 11px; }
.now-logo img, .radio-hero-art img, .audio-dock-logo img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.now-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.now-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now-copy span { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.favorite-now { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: transparent; font-size: 23px; cursor: pointer; }
.favorite-now.is-favorite, .secondary-action.is-favorite, .audio-fav-btn.is-favorite { color: var(--gold); background: var(--gold-soft); }
.favorite-now:disabled { opacity: .35; cursor: default; }
.player-notice { margin: 0 18px 16px; padding: 12px 14px; border: 1px solid rgba(255,191,71,.23); background: rgba(255,191,71,.07); color: #e8c987; border-radius: 12px; font-size: 12px; line-height: 1.45; }

.radio-hero { min-height: 260px; display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 30px; padding: 30px; border: 1px solid var(--line); border-radius: 22px; background: radial-gradient(circle at 14% 30%, rgba(216,177,94,.14), transparent 38%), linear-gradient(135deg, #12151c, #090a0e); box-shadow: 0 28px 80px rgba(0,0,0,.22); }
.radio-hero-art { width: 190px; aspect-ratio: 1; border-radius: 24px; background: linear-gradient(145deg, #1d212c, #0b0c10); color: var(--gold); font-size: 20px; letter-spacing: .08em; }
.radio-hero-copy { min-width: 0; }
.radio-hero-copy h1 { margin: 3px 0 10px; font-size: clamp(30px, 4vw, 54px); line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-hero-copy > p:not(.eyebrow) { margin: 0; color: var(--muted); }
.radio-hero-actions { display: flex; gap: 10px; margin-top: 24px; }
.primary-action, .secondary-action { min-height: 44px; padding: 0 17px; border-radius: 12px; cursor: pointer; font-weight: 800; }
.primary-action { border: 0; background: linear-gradient(145deg, #f0ce80, #b58b3e); color: #15120b; }
.secondary-action { border: 1px solid var(--line); background: rgba(255,255,255,.035); }
.primary-action:disabled, .secondary-action:disabled { opacity: .35; cursor: default; }

.browser-section { padding-top: 30px; }
.browser-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.browser-head h2 { margin: 0; font-size: 28px; }
.channel-total { color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 10px; align-items: center; margin: 18px 0 12px; }
.search-box { min-width: 0; flex: 1; height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.search-box span { color: var(--muted); font-size: 20px; }
.search-box input { width: 100%; color: var(--text); background: transparent; border: 0; outline: 0; }
.search-box input::placeholder { color: #686e7a; }
.compat-toggle { height: 46px; display: flex; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); color: #c4c8d0; font-size: 12px; white-space: nowrap; cursor: pointer; }
.compat-toggle input { accent-color: var(--gold); }
.status-bar { min-height: 25px; color: var(--muted); font-size: 11px; }
.channel-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.channel-card { position: relative; min-width: 0; min-height: 92px; display: grid; grid-template-columns: 58px 1fr; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); cursor: pointer; transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.channel-card:hover { transform: translateY(-2px); border-color: var(--line-strong); background: #13161d; }
.channel-card.is-active { border-color: rgba(216,177,94,.48); box-shadow: inset 0 0 0 1px rgba(216,177,94,.12); }
.channel-card.is-radio { background: linear-gradient(145deg, #10131a, #0d0f14); }
.card-logo { width: 58px; height: 58px; display: grid; place-items: center; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: #090a0d; color: #777e8c; font-size: 10px; font-weight: 800; }
.card-logo img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.card-copy { min-width: 0; padding-right: 22px; }
.card-copy strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.card-copy span { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-fav { position: absolute; right: 9px; top: 9px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: transparent; color: #707683; cursor: pointer; font-size: 17px; }
.card-fav.is-favorite { color: var(--gold); }
.compat-pill { width: fit-content; max-width: 100%; padding: 3px 6px; border-radius: 6px; background: rgba(66,211,146,.08); color: #78d5aa !important; font-size: 8px !important; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.compat-pill.is-blocked { color: #e4a886 !important; background: rgba(255,128,80,.08); }
.empty-state { padding: 60px 20px; display: grid; justify-items: center; gap: 8px; text-align: center; color: var(--muted); }
.empty-state div { font-size: 30px; }
.empty-state strong { color: var(--text); }
.empty-state span { font-size: 12px; }
.site-footer { margin-left: var(--sidebar); padding: 20px 28px calc(22px + env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 6px 16px; border-top: 1px solid var(--line); color: #666d79; font-size: 10px; }
.site-footer a { color: #9b8353; text-decoration: none; }
.drawer-backdrop { display: none; }

.audio-dock { position: fixed; z-index: 70; left: var(--sidebar); right: 0; bottom: 0; min-height: calc(var(--audio-dock-h) + env(safe-area-inset-bottom)); padding: 12px 22px calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 52px minmax(0,1fr) 48px minmax(90px,180px) 42px; align-items: center; gap: 13px; border-top: 1px solid var(--line-strong); background: rgba(10,11,15,.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 -20px 60px rgba(0,0,0,.28); }
.audio-dock-logo { width: 52px; height: 52px; border-radius: 13px; font-size: 10px; }
.audio-dock-copy { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.audio-dock-copy strong, .audio-dock-copy span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-dock-copy span { color: var(--muted); font-size: 11px; }
.audio-main-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--gold); color: #17130b; font-weight: 900; cursor: pointer; }
.audio-volume { width: 100%; accent-color: var(--gold); }
.audio-fav-btn { width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--line); background: rgba(255,255,255,.025); font-size: 20px; cursor: pointer; }

@media (max-width: 1180px) {
  .channel-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .mode-btn { min-width: 74px; }
}

@media (max-width: 900px) {
  :root { --header-h: 68px; }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .menu-btn { display: block; flex: 0 0 auto; }
  .brand-copy small { display: none; }
  .mode-switch { margin-left: auto; }
  .mode-btn { min-width: 46px; padding: 0 9px; }
  .mode-btn span { display: none; }
  .sidebar { transform: translateX(-104%); width: min(84vw, 310px); transition: transform .23s ease; box-shadow: 20px 0 60px rgba(0,0,0,.35); }
  .sidebar.is-open { transform: translateX(0); }
  .drawer-backdrop { position: fixed; z-index: 35; inset: 0; background: rgba(0,0,0,.52); backdrop-filter: blur(2px); }
  .drawer-backdrop:not([hidden]) { display: block; }
  .main-content { margin-left: 0; padding: calc(var(--header-h) + env(safe-area-inset-top) + 16px) 14px 28px; }
  .site-footer { margin-left: 0; padding-left: 14px; padding-right: 14px; }
  .channel-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  body.drawer-open { overflow: hidden; }
  .audio-dock { left: 0; padding-left: 14px; padding-right: 14px; }
}

@media (max-width: 620px) {
  :root { --audio-dock-h: 76px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: 12px; }
  .top-actions .icon-btn { display: none; }
  .mode-switch { gap: 2px; padding: 4px; }
  .mode-btn { min-width: 38px; height: 34px; padding: 0 7px; }
  .player-card { border-radius: 16px; }
  .player-stage { aspect-ratio: 16/10; max-height: none; }
  .now-playing { grid-template-columns: 42px 1fr 42px; min-height: 68px; padding: 11px 12px; }
  .now-logo { width: 42px; height: 42px; }
  .player-notice { margin: 0 12px 12px; }
  .radio-hero { grid-template-columns: 92px 1fr; gap: 16px; padding: 18px; min-height: 160px; border-radius: 16px; }
  .radio-hero-art { width: 92px; border-radius: 18px; font-size: 12px; }
  .radio-hero-copy h1 { font-size: 24px; }
  .radio-hero-copy > p:not(.eyebrow) { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .radio-hero-actions { margin-top: 15px; gap: 7px; }
  .primary-action, .secondary-action { min-height: 38px; padding: 0 11px; font-size: 11px; }
  .browser-section { padding-top: 24px; }
  .browser-head h2 { font-size: 23px; }
  .filters { align-items: stretch; flex-direction: column; }
  .compat-toggle { height: 40px; width: fit-content; }
  .channel-grid { grid-template-columns: 1fr; gap: 9px; }
  .channel-card { min-height: 80px; grid-template-columns: 52px 1fr; padding: 10px; }
  .card-logo { width: 52px; height: 52px; }
  .audio-dock { grid-template-columns: 44px minmax(0,1fr) 44px 38px; gap: 9px; min-height: calc(var(--audio-dock-h) + env(safe-area-inset-bottom)); padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .audio-dock-logo { width: 44px; height: 44px; }
  .audio-main-btn { width: 44px; height: 44px; }
  .audio-volume { display: none; }
  .audio-fav-btn { width: 38px; height: 38px; }
}

@media (max-width: 390px) {
  .brand-copy { display: none; }
  .mode-btn { min-width: 36px; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: calc(14px + env(safe-area-inset-top)); }
}
