/* ─── Variables ─────────────────────────────────────────────────────────────── */
/* Dark is the default palette (applies with no data-theme attribute, so the
   first paint is dark with no flash). Light is opt-in via the theme toggle. */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0f;
  --surface: #18181b;
  --surface-2: #1f1f23;
  --border: #2a2a30;
  --text: #f4f4f5;
  --text-primary: #ffffff;
  --text-muted: #a1a1aa;
  --accent: #3b82f6;
  --accent-bg: #172554;
  --accent-hover: #60a5fa;
  --danger: #ef4444;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.5);
  --scrollbar-thumb: #3f3f46;
  --scrollbar-thumb-hover: #52525b;
  --hero-glow:
    radial-gradient(900px 540px at 12% -8%, rgba(59,130,246,0.22), transparent 60%),
    radial-gradient(760px 500px at 94% 0%, rgba(139,92,246,0.16), transparent 58%),
    radial-gradient(1200px 760px at 50% 120%, rgba(20,184,166,0.12), transparent 62%);
  --grid: radial-gradient(rgba(255,255,255,0.028) 1px, transparent 1.4px);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --border: #e4e4e7;
  --text: #18181b;
  --text-primary: #09090b;
  --text-muted: #71717a;
  --accent: #2563eb;
  --accent-bg: #eff6ff;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --scrollbar-thumb: #c4c4c8;
  --scrollbar-thumb-hover: #a1a1aa;
  --hero-glow:
    radial-gradient(900px 540px at 12% -8%, rgba(37,99,235,0.12), transparent 60%),
    radial-gradient(760px 500px at 94% 0%, rgba(139,92,246,0.08), transparent 58%),
    radial-gradient(1200px 760px at 50% 120%, rgba(20,184,166,0.07), transparent 62%);
  --grid: radial-gradient(rgba(0,0,0,0.04) 1px, transparent 1.4px);
}


/* ─── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Scrollbars (theme-aware) ──────────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.full-width { width: 100%; }
.danger { color: var(--danger) !important; }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
button { cursor: pointer; font-size: 14px; font-family: inherit; border: none; background: none; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  transition: background 0.15s;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline {
  background: transparent;
  color: var(--text);
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.btn-outline:hover { background: var(--bg); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 18px;
  transition: background 0.12s, color 0.12s;
}
.btn-icon:hover { background: var(--bg); color: var(--text); }

/* ─── Form fields ───────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text-muted); }

input[type="text"],
input[type="url"],
input[type="password"],
select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input { padding-right: 40px; }
.input-wrap .btn-icon { position: absolute; right: 2px; }

.error-msg { font-size: 12px; color: var(--danger); }

/* ─── Dropdown ──────────────────────────────────────────────────────────────── */
.dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 100;
  min-width: 140px;
  overflow: hidden;
}
.dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  color: var(--text);
  transition: background 0.1s;
}
.dropdown button:hover { background: var(--bg); }
.dropdown hr { border: none; border-top: 1px solid var(--border); }

/* ─── Auth screen ───────────────────────────────────────────────────────────── */
#auth-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  overflow-y: auto;
  background: var(--grid), var(--hero-glow), var(--bg);
  background-repeat: repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: 24px 24px, auto, auto, auto, auto;
}

/* ─── Landing nav ───────────────────────────────────────────────────────────── */
.landing-nav {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  padding: 12px 24px 0;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}
.landing-nav-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 6px;
}
.landing-nav-link:hover {
  color: var(--text-primary);
  background: var(--surface);
}

/* ─── Landing section ───────────────────────────────────────────────────────── */
.landing-section {
  width: 100%;
  max-width: 940px;
  padding: 72px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 64px;
  position: relative;
}

/* Brand wave motif behind the hero */
.hero-waves {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: auto;
  color: var(--accent);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: radial-gradient(62% 95% at 50% 92%, #000 34%, transparent 78%);
  mask-image: radial-gradient(62% 95% at 50% 92%, #000 34%, transparent 78%);
}
.landing-hero,
.web-showcase,
.steps-section { position: relative; z-index: 1; }

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 22px;
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  max-width: 720px;
}

.hero-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-brand {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.hero-tagline {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -1px;
  margin-top: 4px;
  background: linear-gradient(180deg, var(--text-primary), color-mix(in srgb, var(--accent) 45%, var(--text-primary)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 560px;
}

.hero-cta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-demo-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: -8px;
}

.hero-btn {
  padding: 12px 24px;
  font-size: 15px;
}
.hero-demo-btn {
  font-size: 17px;
  font-weight: 700;
  padding: 14px 32px;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5);
  animation: demo-pulse 2s ease-in-out infinite;
}

@keyframes demo-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.45); }
  60%  { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

/* Platform availability badges */
.hero-platforms {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
  justify-content: center;
}

.platform-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.platform-badge {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}

.platform-badge-link {
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.platform-badge-link:hover {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--text);
}

.platform-badge.pwa-badge {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(37,99,235,0.06);
  cursor: pointer;
  transition: background 0.15s;
}

.platform-badge.pwa-badge:hover {
  background: rgba(37,99,235,0.12);
}

/* Web app showcase — three equal-sized screenshots */
.web-showcase {
  max-width: 940px;
  margin: 0 auto;
  width: 100%;
  text-align: center;
}
.web-showcase-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text-primary);
  margin-bottom: 24px;
}
.web-shots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.web-shot-fig {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.web-shot {
  width: 100%;
  aspect-ratio: 1104 / 1368;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}
.web-shot-cap {
  font-size: 13px;
  color: var(--text-muted);
}
@media (max-width: 640px) {
  .web-shots { grid-template-columns: 1fr; max-width: 340px; margin: 0 auto; }
}

/* Android screenshots */
/* Steps */
.steps-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.steps-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
  text-align: center;
}

.steps-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}

.step-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 20px;
  transition: border-color 0.15s, transform 0.15s;
}
.step-item:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); transform: translateY(-2px); }

.step-num {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-body { display: flex; flex-direction: column; gap: 5px; }
.step-label { font-size: 15px; font-weight: 700; color: var(--text); }
.step-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

.step-arrow { display: none; }

/* Divider between landing and auth card */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0 24px 48px;
}

/* Responsive landing */
@media (max-width: 640px) {
  .landing-section { padding: 48px 20px 32px; gap: 44px; }
  .steps-row { grid-template-columns: 1fr; }
}

.brand-logo { display: flex; justify-content: center; margin-bottom: -8px; }
.brand { font-size: 24px; font-weight: 700; color: var(--accent); text-align: center; }
.brand-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: -14px; }
.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: -8px;
}
.feature-list li {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
  line-height: 1.4;
}
.feature-list li::before {
  content: '·';
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}
.hint { font-size: 13px; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }

.auth-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  transition: background 0.12s, color 0.12s;
}
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-tab:not(.active):hover { background: var(--bg); }

.tab-panel { display: flex; flex-direction: column; gap: 12px; }

.key-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.key-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.key-text-row { display: flex; align-items: flex-start; gap: 4px; }
.key-text-row code { flex: 1; }
.key-copy-inline { width: 30px; height: 30px; flex-shrink: 0; font-size: 14px; color: var(--text-muted); }
.key-copy-inline:hover { color: var(--accent); background: var(--accent-bg); }
.key-card code {
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  color: var(--text);
  line-height: 1.6;
}
.key-warning { font-size: 12px; color: var(--danger); line-height: 1.5; }
.key-saved-label { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; margin: 4px 0; }

/* ─── Keyboard shortcuts modal ──────────────────────────────────────────────── */
.shortcuts-card { max-width: 480px; }
.shortcuts-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 4px 0 8px;
}
.shortcuts-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 3px 0;
  font-size: 13px;
}
.shortcut-row span { color: var(--text-muted); }
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  flex-shrink: 0;
}

/* ─── About / FAQ ───────────────────────────────────────────────────────────── */
.about-card { max-width: 520px; }
.about-body { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
.about-body details { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.about-body details + details { border-top: none; border-radius: 0; }
.about-body details:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.about-body details:last-child { border-radius: 0 0 var(--radius) var(--radius); border-top: none; }
.about-body summary { padding: 12px 14px; font-weight: 500; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.about-body summary::after { content: '+'; font-size: 16px; color: var(--text-muted); }
.about-body details[open] summary::after { content: '−'; }
.about-body summary::-webkit-details-marker { display: none; }
.about-body details p { padding: 0 14px 14px; color: var(--text-muted); line-height: 1.6; }

/* ─── App screen layout ─────────────────────────────────────────────────────── */
#app-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* ─── Header ────────────────────────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-right { display: flex; align-items: center; gap: 4px; }
.header-logo { flex-shrink: 0; border-radius: 8px; }
.app-title { font-size: 16px; font-weight: 700; color: var(--text); }
.app-title-beta {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ─── Demo banner ───────────────────────────────────────────────────────────── */
.demo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: #fef3c7;
  border-bottom: 1px solid #fde68a;
  font-size: 13px;
  color: #92400e;
  flex-shrink: 0;
}
.demo-banner-text { flex: 1; }
.demo-banner-btn {
  padding: 5px 12px !important;
  font-size: 12px !important;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ─── Demo section (auth screen) ────────────────────────────────────────────── */
.demo-or-row {
  width: 100%;
  max-width: 400px;
  padding: 0 24px;
  margin-bottom: 8px;
}
.demo-or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 13px;
}
.demo-or-divider::before,
.demo-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.demo-try-btn {
  font-size: 14px;
  font-weight: 600;
}
.demo-or-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
}
.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-text:hover { color: var(--accent); }

#share-menu { top: 52px; right: 8px; }

/* ─── Search bar ────────────────────────────────────────────────────────────── */
#search-bar {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  gap: 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#search-input { flex: 1; }

/* ─── Playlist tabs ─────────────────────────────────────────────────────────── */
#playlist-tabs {
  display: flex;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  scrollbar-width: none;
}
#playlist-tabs::-webkit-scrollbar { display: none; }

.ptab-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.ptab {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
}
.ptab:hover { color: var(--text); }
.ptab.active { color: var(--accent); border-bottom-color: var(--accent); }
.ptab-add { font-size: 20px; padding: 6px 14px; color: var(--text-muted); }
.ptab-add:hover { color: var(--accent); }

.ptab-dots {
  padding: 0 6px 0 2px;
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
}
.ptab-dots:hover { color: var(--text); }

.ptab-dropdown { min-width: 120px; }

.pl-public-badge { font-size: 10px; margin-left: 4px; vertical-align: middle; }

.share-notice-banner {
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.open-in-app-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 2px;
}
.open-in-app-btn:hover { opacity: 0.9; }

/* ─── Main content / Station list ───────────────────────────────────────────── */
#main-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

#station-list { padding: 4px 0; }

.dev-credit {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 20px 16px 24px;
}
.dev-credit a { color: var(--text-muted); text-decoration: none; }
.dev-credit a:hover { color: var(--accent); }

.station-item {
  display: flex;
  align-items: center;
  padding: 10px 10px 10px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.station-item:hover { background: var(--bg); }
.station-item.current { background: var(--accent-bg); }
.station-item.dragging { opacity: 0.4; }
.station-item.drag-over { border-top: 2px solid var(--accent); }

.drag-handle {
  color: var(--border);
  font-size: 20px;
  margin-right: 6px;
  cursor: grab;
  flex-shrink: 0;
  padding: 0 2px;
}
.drag-handle:hover { color: var(--text-muted); }

.station-play-area {
  width: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  flex-shrink: 0;
  font-size: 15px;
  color: var(--text-muted);
}
.station-item.current .station-play-area { color: var(--accent); }

.playing-anim {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 16px;
}
.playing-anim span {
  display: block;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: bar 0.8s ease-in-out infinite alternate;
}
.playing-anim span:nth-child(2) { animation-delay: 0.15s; }
.playing-anim span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bar {
  from { height: 4px; }
  to   { height: 14px; }
}

.station-info { flex: 1; min-width: 0; }
.station-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.station-url {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.station-menu-wrap { position: relative; flex-shrink: 0; }
.station-dropdown { top: 100%; right: 0; min-width: 120px; }

/* ─── Empty state ───────────────────────────────────────────────────────────── */
#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 60px 24px;
  text-align: center;
}
.empty-icon { font-size: 48px; opacity: 0.3; }
#empty-text { font-size: 15px; color: var(--text-muted); }
#empty-sub { font-size: 13px; color: var(--text-muted); opacity: 0.7; }

/* ─── Player bar ────────────────────────────────────────────────────────────── */
#player-bar {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
}
.player-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.player-art-wrap {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.player-art {
  width: 40px;
  height: 40px;
  border-radius: 5px;
  object-fit: cover;
}
.player-icon { font-size: 22px; flex-shrink: 0; }
.player-text { flex: 1; min-width: 0; }
#player-station-name {
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-song-title {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-status-row { display: flex; align-items: center; gap: 5px; margin-top: 1px; }
#player-status { font-size: 12px; }
.stream-info-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: 3px;
  padding: 0 4px;
  line-height: 16px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.player-volume {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.volume-icon {
  font-size: 18px;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}
#volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 100%, var(--border) 100%);
  outline: none;
  cursor: pointer;
}
#volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--surface);
}
#volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  cursor: pointer;
}
#volume-slider::-moz-range-progress {
  background: var(--accent);
  border-radius: 2px;
}
@media (max-width: 480px) {
  #volume-slider { display: none; }
}
#player-visualizer {
  width: 80px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  border: 1px solid var(--border);
  box-sizing: border-box;
}
#player-visualizer:hover {
  border-color: var(--accent);
}
@media (max-width: 480px) {
  #player-visualizer { display: none; }
}

/* Expand-to-visualizer button */
.viz-expand-btn {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.viz-expand-btn:hover { opacity: 1; }

/* ─── Full Visualizer Overlay ───────────────────────────────────────────────── */
#viz-overlay {
  position: fixed;
  inset: 0;
  background: #050505;
  z-index: 300;
  display: flex;
  flex-direction: column;
}
#viz-overlay.hidden { display: none; }

#viz-canvas {
  flex: 1;
  width: 100%;
  display: block;
  min-height: 0;
}

.viz-info {
  position: absolute;
  top: 14px;
  left: 18px;
  pointer-events: none;
  z-index: 1;
  max-width: calc(100% - 240px);
}
#viz-station-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  text-shadow: 0 1px 5px rgba(0,0,0,0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#viz-song-overlay {
  font-size: 11px;
  color: rgba(0,255,200,0.65);
  text-shadow: 0 1px 5px rgba(0,0,0,0.9);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viz-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
  z-index: 1;
}
.viz-controls button {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.72);
  border-radius: 6px;
  padding: 6px 11px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.viz-controls button:hover {
  background: rgba(255,255,255,0.15);
  color: #fff;
}
#viz-close-btn { padding: 6px 10px; font-size: 15px; }

.viz-mode-label {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.88);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 20px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  pointer-events: none;
  letter-spacing: 0.05em;
  opacity: 0;
  transition: opacity 0.3s;
}
.viz-mode-label.visible { opacity: 1; }

.player-controls { display: flex; gap: 2px; flex-shrink: 0; align-items: center; }
.player-btn { width: 40px; height: 40px; font-size: 18px; }
.pause-icon { display: block; margin: 0 auto; }
#sleep-timer-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 7px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-muted);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
}
#sleep-timer-btn:hover { background: var(--bg); color: var(--text); }
#sleep-timer-btn.sleep-active { color: var(--accent); background: var(--accent-bg); }
#cast-btn svg { fill: currentColor; display: block; }
#cast-btn.casting { color: var(--accent); background: var(--accent-bg); }

/* ─── Equalizer ──────────────────────────────────────────────────────────────── */
#eq-btn {
  height: 40px;
  min-width: 40px;
  padding: 0 9px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
#eq-btn:hover { background: var(--bg); color: var(--text); border-color: var(--text-muted); }
#eq-btn.eq-open { color: var(--accent); background: var(--accent-bg); border-color: var(--accent); }

.eq-panel {
  position: fixed;
  right: 12px;
  bottom: 72px;
  z-index: 200;
  width: min(360px, calc(100vw - 24px));
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.eq-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.eq-panel-title { font-weight: 600; font-size: 14px; }
.eq-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.eq-switch input { accent-color: var(--accent); cursor: pointer; }
.eq-preset {
  width: 100%;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.eq-bands {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  transition: opacity 0.15s;
}
.eq-panel.eq-off .eq-bands { opacity: 0.4; }
.eq-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex: 1;
}
.eq-band-val {
  font-size: 10px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.eq-band-freq { font-size: 10px; color: var(--text-muted); }
.eq-band input[type="range"] {
  writing-mode: vertical-lr;
  direction: rtl;
  -webkit-appearance: slider-vertical;
  width: 20px;
  height: 110px;
  accent-color: var(--accent);
  cursor: pointer;
}
.eq-reset { align-self: flex-end; padding: 6px 14px; font-size: 13px; }

/* ─── FAB ───────────────────────────────────────────────────────────────────── */
#add-station-fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(37,99,235,0.4);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.12s;
}
#add-station-fab:hover { background: var(--accent-hover); transform: scale(1.06); }

/* ─── Add-station tip bubble ────────────────────────────────────────────────── */
.add-tip {
  position: fixed;
  bottom: 148px;
  right: 16px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 18px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 21;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
  animation: tip-pop 0.25s cubic-bezier(0.34,1.56,0.64,1) both;
}
/* tail pointing down-right toward the FAB */
.add-tip::after {
  content: '';
  position: absolute;
  bottom: -7px;
  right: 22px;
  border: 7px solid transparent;
  border-top-color: var(--text);
  border-bottom: 0;
  border-right: 0;
}
@keyframes tip-pop {
  from { opacity: 0; transform: scale(0.8) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ─── Modals ────────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.16);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

/* ─── Spinner ───────────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #18181b;
  color: #fff;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 13px;
  z-index: 300;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow);
}

/* ─── Station Modal Tabs ────────────────────────────────────────────────────── */
.station-tabs {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}
.station-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}
.station-tab.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.station-tab:hover:not(.active) { color: var(--text); }
.station-tab-panel { display: flex; flex-direction: column; gap: 12px; }

/* ─── Radio Browser Search ───────────────────────────────────────────────────── */
#station-modal .modal-card { max-width: 480px; }

.rb-search-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.rb-action-row { display: flex; gap: 8px; }
.rb-action-row button { flex: 1; }

.rb-results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}
.rb-result-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
  gap: 10px;
}
.rb-result-item:hover { background: var(--accent-bg); border-color: var(--accent); }

.rb-favicon {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.rb-favicon-fallback {
  font-size: 22px;
  flex-shrink: 0;
  width: 32px;
  text-align: center;
  line-height: 32px;
}

.rb-result-body { flex: 1; min-width: 0; }
.rb-result-name { font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.rb-result-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  flex-shrink: 0;
}
.rb-badge-ok {
  font-size: 10px;
  font-weight: 700;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1.4;
}
.rb-result-votes {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.rb-load-more {
  width: 100%;
  margin-top: 4px;
  font-size: 13px;
}
.rb-status { text-align: center; margin-top: 2px; }
.rb-attribution {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--radius);
  padding: 7px 10px;
  line-height: 1.5;
}
.rb-attribution a { color: var(--accent); text-decoration: none; }
.rb-attribution a:hover { text-decoration: underline; }

/* ─── Browse directory ──────────────────────────────────────────────────────── */
.browse-cat-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}
.browse-cat-btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.browse-cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.browse-cat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.browse-sort-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.browse-sort-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 2px;
}
.browse-sort-btn {
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.browse-sort-btn:hover { border-color: var(--accent); color: var(--accent); }
.browse-sort-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.browse-back-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.browse-back-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.browse-back-btn:hover { border-color: var(--accent); color: var(--accent); }
.browse-back-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.browse-items {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 4px;
}
/* A–Z mode: full-width sticky separator that forces a new flex line. */
.browse-letter {
  flex: 0 0 100%;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 4px 2px 3px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.browse-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
}
.browse-item:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
.browse-item-name { font-weight: 500; }
.browse-item-count { font-size: 10px; color: var(--text-muted); }
.browse-item:hover .browse-item-count { color: var(--accent); opacity: 0.7; }

/* ─── Genre chips ────────────────────────────────────────────────────────────── */
.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.genre-chip {
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.12s;
}
.genre-chip:hover {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Station icons in list ─────────────────────────────────────────────────── */
.station-icon-img {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
}
.station-icon-fallback { font-size: 20px; }

/* ─── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .auth-card { padding: 24px 18px; }
  .modal-card { padding: 20px 16px; }
}
