:root {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111827;
  --surface-raised: #172033;
  --surface-soft: rgba(255, 255, 255, 0.06);
  --text: #f8fafc;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.2);
  --accent: #22c55e;
  --accent-text: #052e16;
  --accent-soft: rgba(34, 197, 94, 0.14);
  --accent-border: rgba(34, 197, 94, 0.48);
  --info: #38bdf8;
  --info-border: rgba(56, 189, 248, 0.42);
  --info-soft: rgba(56, 189, 248, 0.1);
  --warning: #fbbf24;
  --danger: #fb7185;
  --spinner-track: rgba(5, 46, 22, 0.24);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --focus: 0 0 0 3px rgba(56, 189, 248, 0.34);
  --safe-top-offset: max(18px, calc(env(safe-area-inset-top) + 10px));
  --safe-bottom-offset: max(18px, env(safe-area-inset-bottom));
  --player-sticky-offset: var(--safe-top-offset);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #e5e7eb;
  --surface: #ffffff;
  --surface-raised: #f8fafc;
  --surface-soft: rgba(15, 23, 42, 0.05);
  --text: #111827;
  --muted: #64748b;
  --line: rgba(51, 65, 85, 0.16);
  --accent: #059669;
  --accent-text: #ecfdf5;
  --accent-soft: rgba(5, 150, 105, 0.12);
  --accent-border: rgba(5, 150, 105, 0.38);
  --info: #2563eb;
  --info-border: rgba(37, 99, 235, 0.34);
  --info-soft: rgba(37, 99, 235, 0.08);
  --warning: #b45309;
  --danger: #e11d48;
  --spinner-track: rgba(236, 253, 245, 0.34);
  --shadow: 0 20px 56px rgba(15, 23, 42, 0.14);
  --focus: 0 0 0 3px rgba(37, 99, 235, 0.22);
}

[data-theme="midnight"] {
  color-scheme: dark;
  --bg: #09090b;
  --surface: #111113;
  --surface-raised: #18181b;
  --surface-soft: rgba(255, 255, 255, 0.05);
  --text: #fafafa;
  --muted: #a1a1aa;
  --line: rgba(161, 161, 170, 0.18);
  --accent: #a78bfa;
  --accent-text: #1e1b4b;
  --accent-soft: rgba(167, 139, 250, 0.12);
  --accent-border: rgba(167, 139, 250, 0.42);
  --info: #67e8f9;
  --info-border: rgba(103, 232, 249, 0.38);
  --info-soft: rgba(103, 232, 249, 0.08);
  --warning: #facc15;
  --danger: #f87171;
  --spinner-track: rgba(30, 27, 75, 0.28);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.56);
  --focus: 0 0 0 3px rgba(167, 139, 250, 0.36);
}

[data-theme="desert"] {
  color-scheme: light;
  --bg: #f5efe6;
  --surface: #fdfaf6;
  --surface-raised: #faf5ed;
  --surface-soft: rgba(120, 80, 20, 0.06);
  --text: #292116;
  --muted: #8a7055;
  --line: rgba(120, 80, 20, 0.14);
  --accent: #d97706;
  --accent-text: #fffbeb;
  --accent-soft: rgba(217, 119, 6, 0.1);
  --accent-border: rgba(217, 119, 6, 0.36);
  --info: #0369a1;
  --info-border: rgba(3, 105, 161, 0.32);
  --info-soft: rgba(3, 105, 161, 0.08);
  --warning: #b45309;
  --danger: #dc2626;
  --spinner-track: rgba(255, 251, 235, 0.4);
  --shadow: 0 20px 56px rgba(120, 80, 20, 0.12);
  --focus: 0 0 0 3px rgba(217, 119, 6, 0.28);
}

[data-theme="ocean"] {
  color-scheme: dark;
  --bg: #0a1628;
  --surface: #0f2034;
  --surface-raised: #152840;
  --surface-soft: rgba(100, 200, 220, 0.06);
  --text: #e0f2fe;
  --muted: #7cb9cc;
  --line: rgba(100, 200, 220, 0.18);
  --accent: #06b6d4;
  --accent-text: #082f49;
  --accent-soft: rgba(6, 182, 212, 0.12);
  --accent-border: rgba(6, 182, 212, 0.42);
  --info: #38bdf8;
  --info-border: rgba(56, 189, 248, 0.38);
  --info-soft: rgba(56, 189, 248, 0.08);
  --warning: #fbbf24;
  --danger: #fb7185;
  --spinner-track: rgba(8, 47, 73, 0.3);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --focus: 0 0 0 3px rgba(6, 182, 212, 0.36);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), transparent 28rem),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 24rem),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.safe-area-cover {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 12;
  height: env(safe-area-inset-top);
  min-height: 0;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), transparent 28rem),
    radial-gradient(circle at top right, rgba(34, 197, 94, 0.12), transparent 24rem),
    var(--bg);
  pointer-events: none;
}

@media (hover: none) and (pointer: coarse) {
  .app {
    -webkit-user-select: none;
    user-select: none;
  }

  input,
  textarea,
  select,
  [contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
  }
}

.shell {
  width: 100%;
  min-height: 100vh;
  padding: var(--safe-top-offset) 18px var(--safe-bottom-offset);
}

.app {
  width: min(100%, 860px);
  margin: 0 auto;
}

.topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0 18px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  font-size: 1.02rem;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  box-shadow: 0 12px 30px var(--accent-soft);
}

.brand-mark svg {
  display: block;
  width: 27px;
  height: 27px;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

#support-button svg {
  width: 23px;
  height: 23px;
}

.content-grid {
  display: grid;
  gap: 16px;
}

.player-panel,
.library {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.player-panel {
  --player-text: var(--text);
  --player-muted: var(--muted);
  --player-eyebrow: var(--info);
  --player-overlay: rgba(2, 6, 23, 0.76);
  --player-glass: rgba(15, 23, 42, 0.28);
  --station-artwork-primary: var(--accent);
  --station-artwork-secondary: var(--info);
  --station-artwork-accent: var(--accent);
  position: sticky;
  top: var(--player-sticky-offset);
  z-index: 8;
  overflow: hidden;
  padding: clamp(16px, 3.4vw, 24px);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--station-artwork-primary) 24%, var(--surface)), var(--surface));
  isolation: isolate;
  /* Cover the gap above with a solid shadow so scrolling content fades out */
  /* box-shadow: 0 -50px 0 0px var(--bg), var(--shadow); */
}

[data-theme="light"] .player-panel,
[data-theme="desert"] .player-panel {
  --player-text: #111827;
  --player-muted: rgba(17, 24, 39, 0.72);
  --player-eyebrow: #075985;
  --player-overlay: rgba(255, 255, 255, 0.68);
  --player-glass: rgba(255, 255, 255, 0.32);
}

[data-theme="midnight"] .player-panel {
  --player-overlay: rgba(0, 0, 0, 0.78);
  --player-glass: rgba(24, 24, 27, 0.36);
}

[data-theme="ocean"] .player-panel {
  --player-overlay: rgba(8, 47, 73, 0.74);
  --player-glass: rgba(15, 40, 64, 0.34);
}

.player-panel::before,
.player-panel::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
}

.player-panel::before {
  background:
    radial-gradient(circle at 82% 24%, color-mix(in srgb, var(--station-artwork-accent) 44%, transparent), transparent 34%),
    linear-gradient(135deg, color-mix(in srgb, var(--station-artwork-primary) 38%, transparent), transparent 58%);
  opacity: 0.72;
}

.player-panel::after {
  background:
    linear-gradient(90deg, var(--player-overlay), color-mix(in srgb, var(--player-overlay) 72%, transparent)),
    linear-gradient(180deg, color-mix(in srgb, var(--player-glass) 80%, transparent), transparent 62%);
  backdrop-filter: blur(2px);
}

.player-artwork {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background: var(--surface);
}

.player-artwork-layer {
  position: absolute;
  inset: -18px;
  background-position: center;
  background-size: cover;
  filter: blur(18px) saturate(1.2);
  opacity: 0;
  transform: scale(1.08);
  transition:
    opacity 520ms ease,
    transform 900ms ease;
  will-change: opacity, transform;
}

.player-artwork-layer.is-active {
  opacity: 1;
  transform: scale(1.12);
}

.player-panel.is-playing .player-artwork-layer.is-active {
  animation: player-artwork-drift 18s ease-in-out infinite alternate;
}

@keyframes player-artwork-drift {
  from {
    transform: scale(1.1) translate3d(-1%, -1%, 0);
  }

  to {
    transform: scale(1.16) translate3d(1%, 1%, 0);
  }
}

.now-playing {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(16px, 5vw, 34px);
}

.now-playing-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0;
  color: var(--info);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.player-panel .eyebrow {
  color: var(--player-eyebrow);
}

h1 {
  height: 1.02em;
  max-width: 100%;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--player-text);
  font-size: clamp(2.1rem, 6.8vw, 3.9rem);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.02;
  white-space: nowrap;
}

.player-panel h1 {
  margin-top: 0;
}

.current-channel-text {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

h1.is-marquee .current-channel-text {
  max-width: none;
  overflow: visible;
  padding-right: 28px;
  animation: current-channel-marquee var(--marquee-duration, 12s) linear 700ms infinite;
  will-change: transform;
}

@keyframes current-channel-marquee {
  0%,
  14% {
    transform: translateX(0);
  }

  86%,
  100% {
    transform: translateX(calc(-1 * var(--marquee-distance, 0px)));
  }
}

@media (prefers-reduced-motion: reduce) {
  h1.is-marquee .current-channel-text {
    max-width: 100%;
    overflow: hidden;
    padding-right: 0;
    animation: none;
    text-overflow: ellipsis;
  }

  .player-panel.is-playing .player-artwork-layer.is-active {
    animation: none;
  }
}

.status {
  display: inline-flex;
  min-height: 0;
  width: fit-content;
  margin: 0 0 8px;
  padding: 5px 10px;
  overflow: hidden;
  align-items: center;
  gap: 7px;
  border: 1px solid color-mix(in srgb, var(--player-muted) 20%, transparent);
  border-radius: 999px;
  color: var(--player-text);
  background: color-mix(in srgb, var(--player-overlay) 48%, transparent);
  font-size: 0.78rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status::before {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--player-muted);
  content: "";
}

.status[data-state="live"]::before {
  background: var(--accent);
}

.status[data-state="buffering"]::before,
.status[data-state="retrying"]::before {
  background: var(--warning);
}

.status[data-state="unavailable"]::before {
  background: var(--danger);
}

.status[data-state="paused"]::before,
.status[data-state="ready"]::before {
  background: var(--player-muted);
}

.track-info {
  min-height: 1.25em;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--player-text);
  font-size: 0.95rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sleep-countdown {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 72px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  box-shadow: none;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.sleep-countdown-visual {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.sleep-countdown-visual::after {
  position: absolute;
  top: -6px;
  right: -5px;
  color: var(--accent);
  content: "Zz";
  font-size: 0.5rem;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.22);
  transform: rotate(10deg);
}

.sleep-countdown-icon {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sleep-countdown-icon path {
  fill: currentColor;
  stroke: none;
}

.sleep-countdown-text {
  min-width: 0;
  text-align: left;
}

.sleep-countdown[hidden] {
  display: none;
}

.player-controls {
  display: grid;
  grid-template-columns: 46px 68px 46px;
  align-items: center;
  justify-content: end;
  gap: 18px;
  width: max-content;
  padding: 0;
}

.player-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  color: var(--player-muted);
  background: transparent;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .player-button:hover {
    color: var(--player-text);
    background: var(--surface-soft);
  }
}

@media (hover: none) and (pointer: coarse) {
  .player-button {
    background: transparent;
  }
}

.player-button:active {
  color: var(--player-text);
  background: var(--surface-soft);
  transform: scale(0.96);
}

.player-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.player-toggle {
  width: 68px;
  height: 68px;
  border-color: transparent;
  color: var(--accent-text);
  background: linear-gradient(135deg, var(--station-artwork-accent), var(--accent));
  box-shadow: 0 18px 44px var(--accent-soft);
}

.player-toggle-icon {
  width: 0;
  height: 0;
  margin-left: 4px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid currentColor;
}

.player-toggle.is-active .player-toggle-icon {
  width: 16px;
  height: 20px;
  margin-left: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 6px solid currentColor;
  border-right: 6px solid currentColor;
}

.player-toggle.is-buffering .player-toggle-icon {
  width: 20px;
  height: 20px;
  margin-left: 0;
  border: 3px solid var(--spinner-track);
  border-top-color: currentColor;
  border-radius: 999px;
  animation: player-spin 780ms linear infinite;
}

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

.library {
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 16px 10px;
}

.section-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

#station-count {
  text-transform: none;
}

.station-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.station-tool-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

.station-tool-button:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.station-tool-button.is-active {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent-border);
}

.station-tool-button:active {
  transform: scale(0.96);
}

.station-tool-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.station-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
}

.station-view-tab {
  display: grid;
  place-items: center;
  width: 34px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition:
    background 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.station-view-tab:hover {
  color: var(--text);
  background: var(--surface-raised);
}

.station-view-tab.is-active {
  color: var(--accent-text);
  background: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent-border),
    0 8px 18px rgb(0 0 0 / 0.18);
}

.station-view-tab:active {
  transform: scale(0.96);
}

.station-view-tab svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.empty-station-filter {
  margin: 6px 6px 12px;
  padding: 18px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.9rem;
  font-weight: 750;
  text-align: center;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.channels {
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
}

.channel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 2px;
  min-height: 60px;
  padding: 5px 7px 5px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.library-discover {
  display: grid;
  gap: 12px;
  margin: 0 10px 12px;
  padding: 12px 0 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.library-discover[hidden] {
  display: none;
}

.discover-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.discover-form input,
.discover-form select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-raised);
  outline: none;
  text-overflow: ellipsis;
}

.discover-form input:focus,
.discover-form select:focus {
  border-color: var(--info-border);
  box-shadow: var(--focus);
}

.discover-form input::placeholder {
  color: var(--muted);
}

.discover-filters {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.discover-filters label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.discover-filters label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discover-form button,
.discover-result-actions button {
  min-height: 38px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
}

.discover-form button {
  align-self: start;
  padding: 0 16px;
  border: 0;
  color: var(--accent-text);
  background: var(--accent);
}

.discover-form button:disabled,
.discover-result-actions button:disabled {
  cursor: wait;
  opacity: 0.66;
}

.discover-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.discover-results {
  display: grid;
  gap: 8px;
}

.discover-result {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  min-height: 62px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.discover-result.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.discover-result-art {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 8px;
  color: var(--accent-text);
  background: linear-gradient(135deg, var(--accent-soft), var(--accent));
  font-weight: 900;
}

.discover-result-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.discover-result-art.has-image span {
  display: none;
}

.discover-result-art.image-broken img {
  display: none;
}

.discover-result-art.image-broken span {
  display: grid;
}

.discover-result-copy {
  min-width: 0;
}

.discover-result h3 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 0.94rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discover-result p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.discover-result-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.discover-result-actions button {
  min-height: 34px;
  padding: 0 11px;
}

.discover-preview {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface-raised);
}

.discover-result.is-active .discover-preview {
  border-color: var(--accent-border);
  color: var(--accent-text);
  background: var(--accent);
}

.discover-save {
  border: 0;
  color: var(--accent-text);
  background: var(--accent);
}

.discover-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.discover-pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.discover-page-button,
.discover-more {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-raised);
  cursor: pointer;
  font-weight: 850;
}

.discover-page-button {
  min-width: 38px;
  padding: 0 12px;
}

.discover-more {
  padding: 0 18px;
}

.discover-page-button[aria-current="page"],
.discover-page-button:hover,
.discover-more:hover {
  border-color: var(--info-border);
  background: var(--info-soft);
}

.discover-page-button[aria-current="page"] {
  color: var(--accent-text);
  background: var(--accent);
}

.discover-more:disabled {
  cursor: wait;
  opacity: 0.66;
}

.channel:hover {
  background: var(--surface-soft);
}

.channel.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.channel-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 4px 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.channel-copy {
  min-width: 0;
}

.channel-control {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
}

.channel.is-active .channel-control {
  color: var(--accent-text);
  background: var(--accent);
}

.channel-number {
  font-size: 0.84rem;
  font-weight: 850;
}

.channel-control-icon {
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid currentColor;
}

.channel.is-playing .channel-control-icon,
.channel.is-connecting .channel-control-icon {
  position: relative;
  width: 13px;
  height: 14px;
  margin-left: 0;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  border-right: 0;
}

.channel.is-playing .channel-control-icon::before,
.channel.is-playing .channel-control-icon::after,
.channel.is-connecting .channel-control-icon::before,
.channel.is-connecting .channel-control-icon::after {
  position: absolute;
  top: 0;
  width: 4px;
  height: 14px;
  border-radius: 999px;
  background: currentColor;
  content: "";
}

.channel.is-playing .channel-control-icon::before,
.channel.is-connecting .channel-control-icon::before {
  left: 0.5px;
}

.channel.is-playing .channel-control-icon::after,
.channel.is-connecting .channel-control-icon::after {
  right: 0.5px;
}

.channel-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 0.96rem;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-name-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.favorite-mark {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.favorite-mark svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.channel-meta {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-state {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.channel.is-active .channel-state {
  color: var(--accent);
}

.channel.is-playing .channel-state,
.channel.is-connecting .channel-state {
  transform: none;
}

.station-options-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.station-options-button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.station-options-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.button-pulse-bars {
  display: inline-flex;
  align-items: end;
  justify-content: center;
  gap: 2px;
  width: 28px;
  height: 19px;
}

.button-pulse-bars span {
  width: 4px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 10px color-mix(in srgb, currentColor 42%, transparent);
  transform-origin: 50% 100%;
  animation: pulse-bar 720ms ease-in-out infinite;
}

.button-pulse-bars span:nth-child(1) {
  height: 10px;
  animation-delay: -180ms;
}

.button-pulse-bars span:nth-child(2) {
  height: 18px;
  animation-delay: -60ms;
}

.button-pulse-bars span:nth-child(3) {
  height: 13px;
  animation-delay: -300ms;
}

.button-pulse-bars span:nth-child(4) {
  height: 16px;
  animation-delay: -420ms;
}

@keyframes pulse-bar {
  0%,
  100% {
    opacity: 0.72;
    transform: scaleY(0.42);
  }

  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

.site-footer {
  padding: 18px 8px 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  text-align: center;
}

.station-modal[hidden] {
  display: none;
}

.station-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 14px 14px max(28px, env(safe-area-inset-bottom));
}

.station-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(2, 6, 23, 0.52);
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.station-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 480px);
  max-height: min(86vh, 680px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.station-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.station-sheet h2 {
  margin: 6px 0 0;
  font-size: 1.24rem;
  line-height: 1.1;
}

.settings-sheet {
  max-width: 430px;
}

.support-sheet {
  max-width: 430px;
}

.settings-list {
  display: grid;
  gap: 10px;
}

.settings-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.settings-group-stacked {
  grid-template-columns: 1fr;
}

.settings-group-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.settings-group h3 {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.2;
}

.settings-group p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.35;
}

.feature-list {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.45;
}

.feature-list li + li {
  margin-top: 4px;
}

.sleep-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

.sleep-option {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-raised);
  cursor: pointer;
  font-weight: 800;
}

.sleep-option.is-active {
  border-color: transparent;
  color: var(--accent-text);
  background: var(--accent);
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.settings-action-button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-raised);
  cursor: pointer;
  font-weight: 850;
}

.settings-action-button:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.settings-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.feedback-form {
  display: grid;
  gap: 10px;
}

.support-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.support-action-button {
  display: block;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-raised);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 800;
  text-align: left;
  text-decoration: none;
}

.support-action-button:hover {
  border-color: var(--info-border);
  background: var(--info-soft);
}

.feedback-form textarea {
  width: 100%;
  min-height: 90px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-raised);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  resize: vertical;
}

.feedback-form textarea:focus {
  border-color: var(--info-border);
  outline: none;
  box-shadow: var(--focus);
}

.feedback-form textarea::placeholder {
  color: var(--muted);
}

.feedback-form textarea:disabled,
.feedback-form button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.sheet-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  cursor: pointer;
}

.sheet-close svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.station-form {
  display: grid;
  gap: 12px;
}

.form-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 750;
}

.form-field input,
.form-field select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-raised);
  outline: none;
}

.form-field input:focus,
.form-field select:focus {
  border-color: var(--info-border);
  box-shadow: var(--focus);
}

.form-field input::placeholder {
  color: var(--muted);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 700;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 850;
}

.primary-button {
  border: 0;
  color: var(--accent-text);
  background: var(--accent);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
}

.station-actions {
  display: grid;
  gap: 12px;
}

.station-action-group {
  display: grid;
  gap: 8px;
}

.station-action-group-separated {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.station-action-group-title {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.station-action-button {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.station-action-button:hover {
  border-color: var(--info-border);
  background: var(--info-soft);
}

#station-options-modal.is-confirming-delete .station-actions,
#station-options-modal.is-confirming-delete .options-message {
  display: none;
}

.station-action-button.danger {
  color: var(--danger);
}

.options-message {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.delete-confirm {
  margin-top: 0;
  padding: 14px;
  border: 1px solid rgba(251, 113, 133, 0.3);
  border-radius: 8px;
  background: rgba(251, 113, 133, 0.06);
}

.delete-confirm[hidden] {
  display: none;
}

.delete-confirm-text {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.4;
}

.delete-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.danger-button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  cursor: pointer;
  font-weight: 850;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 7px 4px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.theme-swatch:hover {
  background: var(--surface-soft);
}

.theme-swatch.is-active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.theme-swatch-dot {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.theme-swatch.is-active .theme-swatch-dot {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.theme-swatch.is-active .theme-swatch-dot::after {
  position: absolute;
  right: 5px;
  bottom: 7px;
  width: 8px;
  height: 4px;
  border-bottom: 2px solid var(--accent-text);
  border-left: 2px solid var(--accent-text);
  content: "";
  transform: rotate(-45deg);
}

.theme-swatch-label {
  font-size: 0.66rem;
  font-weight: 750;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
}

.theme-swatch.is-active .theme-swatch-label {
  color: var(--text);
}

audio {
  display: none;
}

button:focus-visible,
summary:focus-visible,
.channel:focus-visible,
.channel-main:focus-visible,
.icon-button:focus-visible,
.station-tool-button:focus-visible,
.station-options-button:focus-visible,
.sheet-close:focus-visible,
.primary-button:focus-visible,
.secondary-button:focus-visible,
.danger-button:focus-visible,
.settings-action-button:focus-visible,
.support-action-button:focus-visible,
.station-action-button:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

@media (min-width: 780px) {
  .shell {
    display: grid;
    align-items: center;
    padding: 32px;
  }

  .content-grid {
    gap: 20px;
  }

  .player-panel {
    padding: 32px;
  }

  .section-heading {
    padding-right: 22px;
    padding-left: 22px;
  }

  .library-discover {
    margin-right: 14px;
    margin-left: 14px;
  }

  .channels {
    padding-right: 14px;
    padding-left: 14px;
  }
}

@media (max-width: 560px) {
  :root {
    --safe-top-offset: max(14px, calc(env(safe-area-inset-top) + 10px));
    --safe-bottom-offset: max(14px, env(safe-area-inset-bottom));
  }

  .shell {
    padding: var(--safe-top-offset) 12px var(--safe-bottom-offset);
  }

  .topbar {
    align-items: center;
    padding: 8px 0 14px;
  }

  .player-panel {
    padding: 14px 20px;
  }

  .sleep-countdown {
    top: 12px;
    right: 12px;
  }

  .brand span:last-child {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .now-playing {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .player-controls {
    grid-template-columns: 42px 62px 42px;
    justify-content: center;
    justify-self: center;
    gap: 16px;
  }

  .player-button {
    width: 42px;
    height: 42px;
  }

  .player-toggle {
    width: 62px;
    height: 62px;
  }

  h1 {
    font-size: clamp(2rem, 11vw, 3.1rem);
  }

  .status {
    margin-top: 8px;
  }

  .track-info {
    margin-top: 4px;
    font-size: 0.88rem;
  }

  .channel {
    gap: 8px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .discover-result {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .discover-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .discover-result-actions {
    grid-column: 2;
    justify-content: start;
  }

  .settings-actions {
    grid-template-columns: 1fr;
  }

  .sleep-options {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .sleep-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .station-modal {
    align-items: center;
  }
}
