/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:       #FF005E;
  --accent-dim:   #cc004c;
  --accent-glow:  #FF005E44;
  --accent-soft:  #FF005E18;

  --radius-sm:    10px;
  --radius-md:    18px;
  --radius-lg:    24px;
  --radius-xl:    32px;
  --radius-pill:  999px;

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease:   cubic-bezier(0.4, 0, 0.2, 1);
  --dur:    200ms;

  --navbar-h: 72px;

  /* Light */
  --bg:         #f2f2f7;
  --surface:    #ffffff;
  --surface-2:  #e8e8ed;
  --surface-3:  #d8d8df;
  --text:       #111118;
  --text-muted: #6b6b78;
  --shadow:     0 4px 24px rgba(0,0,0,0.10);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.14);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0d0d10;
    --surface:    #1a1a20;
    --surface-2:  #242430;
    --surface-3:  #2e2e3c;
    --text:       #f0f0f5;
    --text-muted: #8888a0;
    --shadow:     0 4px 24px rgba(0,0,0,0.40);
    --shadow-lg:  0 8px 40px rgba(0,0,0,0.55);
  }
}

/* ── Forced theme overrides ─────────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f2f2f7; --surface: #ffffff; --surface-2: #e8e8ed; --surface-3: #d8d8df;
  --text: #111118; --text-muted: #6b6b78;
  --shadow: 0 4px 24px rgba(0,0,0,0.10); --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
}
[data-theme="dark"] {
  --bg: #0d0d10; --surface: #1a1a20; --surface-2: #242430; --surface-3: #2e2e3c;
  --text: #f0f0f5; --text-muted: #8888a0;
  --shadow: 0 4px 24px rgba(0,0,0,0.40); --shadow-lg: 0 8px 40px rgba(0,0,0,0.55);
}
[data-theme="amoled"] {
  --bg: #000000; --surface: #080808; --surface-2: #111118; --surface-3: #1a1a20;
  --text: #f0f0f5; --text-muted: #8888a0;
  --shadow: 0 4px 24px rgba(0,0,0,0.70); --shadow-lg: 0 8px 40px rgba(0,0,0,0.85);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"])[data-dark-variant="amoled"] {
    --bg: #000000; --surface: #080808; --surface-2: #111118; --surface-3: #1a1a20;
    --shadow: 0 4px 24px rgba(0,0,0,0.70); --shadow-lg: 0 8px 40px rgba(0,0,0,0.85);
  }
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: var(--radius-pill); }

/* Overlay scrollbars so they float over content and don't shift layout */
* { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; }

/* ─── Navbar ───────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--navbar-h);
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease), backdrop-filter var(--dur) var(--ease);
}

.navbar.scrolled {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom-color: var(--surface-2);
}

.navbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

.navbar-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.navbar-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-self: center;
}

.navbar-station-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-now-playing {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Inline search that replaces now-playing info when scrolled */
.navbar-search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.navbar-search .search-input {
  padding: 9px 16px 9px 40px;
  font-size: 14px;
  box-shadow: none;
  background: var(--surface-2);
}

.navbar-search .search-icon {
  width: 40px;
}

/* ─── Play/Pause Button ────────────────────────────────────────── */
.btn-play {
  width: 52px; height: 52px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--dur) var(--spring), box-shadow var(--dur) var(--ease);
  box-shadow: 0 4px 16px var(--accent-glow);
  flex-shrink: 0;
}

.btn-play:hover { transform: scale(1.08); box-shadow: 0 6px 24px var(--accent-glow); }
.btn-play:active { transform: scale(0.93); }

.btn-play.playing {
  animation: pulse-ring 2s ease-out infinite;
}

/* Cover-art mode (when scrolled) */
.btn-play.with-art {
  background: var(--accent-soft);
  border: 2.5px solid var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow), 0 4px 16px var(--accent-glow);
  overflow: hidden;
  position: relative;
}

.btn-play.with-art.playing {
  animation: pulse-ring 2s ease-out infinite;
}

.btn-play-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.btn-play-art-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.btn-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.btn-play.with-art:hover .btn-play-overlay { opacity: 1; }

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--accent-glow), 0 4px 16px var(--accent-glow); }
  70%  { box-shadow: 0 0 0 12px transparent, 0 4px 16px var(--accent-glow); }
  100% { box-shadow: 0 0 0 0 transparent, 0 4px 16px var(--accent-glow); }
}

/* ─── Icon Buttons ─────────────────────────────────────────────── */
.btn-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--dur) var(--spring), background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.btn-icon:hover { background: var(--accent-soft); color: var(--accent); transform: scale(1.08); }
.btn-icon.btn-icon-bare { background: none; width: 28px; height: 28px; }
.btn-icon.btn-icon-bare:hover { background: none; }
.btn-icon:active { transform: scale(0.92); }
.btn-icon.pinned { color: #ffd700; }
.btn-icon.pinned svg { fill: currentColor; }
.btn-icon:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; background: var(--surface-2); color: var(--text-muted); }

/* ─── Main Layout ──────────────────────────────────────────────── */
.main {
  padding-top: calc(var(--navbar-h) + 48px);
  padding-bottom: 40px;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ─── Search Bar ───────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin-bottom: 28px;
}

.search-input {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
  outline: none;
  box-shadow: var(--shadow);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow);
}

.search-icon {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--dur) var(--ease);
}

.search-icon.search-back {
  pointer-events: auto;
  cursor: pointer;
}

.search-icon.search-back:hover { color: var(--accent); }

.search-url-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--spring);
}

.search-url-chip:hover { background: var(--accent); color: #fff; transform: scale(1.04); }
.search-url-chip:active { transform: scale(0.96); }

/* ─── Section Header ───────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 14px;
  min-height: 32px;
}

.section-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
  flex: 1;
}

.sort-toggle {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.sort-btn {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--spring);
}

.sort-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.sort-btn:active { transform: scale(0.95); }

/* ─── Station Grid ─────────────────────────────────────────────── */
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}

.empty-state {
  grid-column: 1/-1;
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ─── Station Card ─────────────────────────────────────────────── */
.station-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1 / 1;
  transition: transform var(--dur) var(--spring), box-shadow var(--dur) var(--ease);
}

.station-card:hover { transform: scale(1.05); box-shadow: var(--shadow-lg); }
.station-card:active { transform: scale(0.97); }

.station-card.playing {
  outline: 2.5px solid var(--accent);
  outline-offset: -2.5px;
  box-shadow: 0 4px 24px var(--accent-glow);
}

.station-card-img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.station-card-fallback {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--accent), #8000ff);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.9);
}

.station-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, transparent 55%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 10px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.station-card:hover .station-card-overlay,
.station-card.playing .station-card-overlay { opacity: 1; }

.station-card-name {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.station-card-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-card-actions {
  position: absolute;
  top: 8px; right: 8px;
  display: flex;
  gap: 5px;
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.station-card:hover .station-card-actions { opacity: 1; }

.card-action-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(8px);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--dur) var(--spring), background var(--dur) var(--ease);
}

.card-action-btn:hover { background: var(--accent); transform: scale(1.12); }
.card-action-btn:active { transform: scale(0.9); }
.card-action-btn.pinned { color: #ffd700; }
.card-action-btn.pinned svg { fill: currentColor; }

/* Folder cards */
.station-card-folder { background: var(--surface-2); }
.station-card-folder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  width: 100%; height: 100%;
  gap: 2px;
  overflow: hidden;
  border-radius: inherit;
}
.station-card-folder-cell {
  overflow: hidden;
  background: var(--surface);
  display: flex; align-items: center; justify-content: center;
}
.station-card-folder-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.station-card-folder-cell-fallback { color: var(--muted); opacity: 0.5; display: flex; align-items: center; justify-content: center; }
.station-card-folder.drag-over { outline: 2.5px solid var(--accent); outline-offset: -2.5px; box-shadow: 0 4px 24px var(--accent-glow); }
.station-card-folder.playing:not(:hover) .folder-card-name,
.station-card-folder.playing:not(:hover) .folder-card-sub { display: none; }
.station-card-folder.playing:not(:hover) .station-card-overlay { background: none; }

/* Folder well — full-width inline row within .station-grid */
.folder-well {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-md);
  padding: 12px;
}
.folder-well .station-grid { margin-bottom: 0; }
.folder-well-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.folder-well-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.folder-well-actions { display: flex; align-items: center; gap: 2px; }

/* Prompt dialog input */
.folder-dialog-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 4px;
}
.folder-dialog-input:focus { border-color: var(--accent); }

/* Section header extras */
.section-header-actions { display: flex; align-items: center; gap: 8px; }
.section-back-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px; display: flex; align-items: center;
  border-radius: var(--radius-sm); transition: color var(--dur) var(--ease);
}
.section-back-btn:hover { color: var(--fg); }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; display: flex; align-items: center; border-radius: var(--radius-sm); transition: color var(--dur) var(--ease); }
.icon-btn:hover { color: var(--accent); }
.icon-btn-sm { padding: 3px; }
.pill-btn {
  padding: 7px 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.pill-btn:hover { background: var(--accent-soft); color: var(--accent); }
.pill-btn:active { transform: scale(0.95); }
.pill-btn-active { background: var(--accent-soft); color: var(--accent); }

/* Pin folder dropdown */
.pin-folder-dropdown {
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  padding: 6px;
  display: flex; flex-direction: column; gap: 2px;
}
.pin-folder-dropdown-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 8px 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pin-folder-dropdown-item {
  background: none; border: none; cursor: pointer;
  text-align: left;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--fg);
  display: flex; align-items: center; gap: 7px;
  transition: background var(--dur) var(--ease);
  width: 100%;
}
.pin-folder-dropdown-item:hover { background: var(--surface-2); }

/* ─── Equalizer ────────────────────────────────────────────────── */
.equalizer {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  margin-bottom: 4px;
}

.eq-bar {
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: eq-bounce 0.8s ease-in-out infinite alternate;
}

.eq-bar:nth-child(1) { animation-delay: 0s;    animation-duration: 0.7s; }
.eq-bar:nth-child(2) { animation-delay: 0.15s; animation-duration: 0.9s; }
.eq-bar:nth-child(3) { animation-delay: 0.3s;  animation-duration: 0.6s; }

@keyframes eq-bounce {
  0%   { height: 3px; }
  100% { height: 14px; }
}

/* ─── Discovery List ───────────────────────────────────────────── */
.discovery-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 36px;
}

.discovery-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform var(--dur) var(--spring), box-shadow var(--dur) var(--ease);
}

.discovery-item:hover { transform: scale(1.015); box-shadow: var(--shadow-lg); }
.discovery-item:active { transform: scale(0.99); }
.discovery-item.playing { outline: 2px solid var(--accent); outline-offset: -2px; }

.discovery-favicon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-2);
}

.discovery-favicon-fallback {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #8000ff);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.9);
}

.discovery-info { flex: 1; min-width: 0; }

.discovery-name {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.discovery-meta {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.source-favicon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  flex-shrink: 0;
}
.source-favicon-fallback {
  font-size: 11px;
  opacity: 0.5;
  line-height: 1;
}
.source-favicon-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.7;
}

.discovery-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tag-manual {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-right: 4px;
  vertical-align: middle;
}

/* ─── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: none;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--dur) var(--spring), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}

.btn:active { transform: scale(0.95); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; transform: none !important; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover { background: var(--accent-dim); box-shadow: 0 6px 20px var(--accent-glow); transform: scale(1.03); }

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
}

.btn-ghost:hover { background: var(--surface-3); transform: scale(1.03); }

.btn-danger {
  background: transparent;
  color: #ff3b5c;
  border: 1.5px solid #ff3b5c44;
}

.btn-danger:hover { background: #ff3b5c18; transform: scale(1.03); }

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ─── Modal / Sheet ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-sheet {
  background: var(--surface);
  width: 100%;
  max-width: 540px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow: hidden;
}

.modal-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--surface-2);
  flex-shrink: 0;
  gap: 12px;
}

.modal-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--spring);
  justify-self: start;
}

.modal-back:hover { background: var(--accent); color: #fff; transform: scale(1.05); }
.modal-back:active { transform: scale(0.95); }

.modal-title {
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}

.modal-title-spacer { display: block; }

.modal-body {
  overflow-y: auto;
  overflow-y: overlay;
  padding: 20px;
  flex: 1;
  min-height: 0;
}

.modal-body-flex {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: 20px;
  flex: 1;
  min-height: 0;
}


.modal-list-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.modal-sticky-footer {
  flex-shrink: 0;
  padding: 12px 0 0;
}

/* Mobile: full-height sheet below navbar */
@media (max-width: 600px) {
  .modal-backdrop {
    align-items: flex-end;
    background: rgba(0,0,0,0.3);
  }

  .modal-sheet {
    max-width: 100%;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    max-height: calc(100vh - var(--navbar-h));
    max-height: calc(100dvh - var(--navbar-h));
  }
}

/* Modal transition */
.modal-enter-active, .modal-leave-active {
  transition: opacity var(--dur) var(--ease);
}

.modal-enter-active .modal-sheet,
.modal-leave-active .modal-sheet {
  transition: transform var(--dur) var(--spring);
}

.modal-enter-from, .modal-leave-to { opacity: 0; }
.modal-enter-from .modal-sheet { transform: translateY(20px) scale(0.97); }
.modal-leave-to .modal-sheet { transform: translateY(20px) scale(0.97); }

@media (max-width: 600px) {
  .modal-enter-from .modal-sheet { transform: translateY(100%); }
  .modal-leave-to .modal-sheet  { transform: translateY(100%); }
}

/* ─── Form Inputs ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--surface-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.form-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

.form-input-error { border-color: #ff3b5c !important; }

.form-error {
  font-size: 12px;
  color: #ff3b5c;
  margin-top: 4px;
}

.form-hint {
  font-size: 12px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-radio-group {
  display: flex;
  gap: 8px;
}

.form-radio-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 2px solid var(--surface-2);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--dur) var(--ease), transform var(--dur) var(--spring);
  user-select: none;
}

.form-radio-option:hover { transform: scale(1.02); }
.form-radio-option:active { transform: scale(0.97); }
.form-radio-option input { display: none; }

.form-radio-option.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ─── Manual Station List ──────────────────────────────────────── */
.manual-station-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  margin-bottom: 8px;
  transition: background var(--dur) var(--ease);
}

.manual-station-item:hover { background: var(--surface-3); }
.manual-station-item.no-hover { cursor: default; }
.manual-station-item.no-hover:hover { background: var(--surface-2) !important; }

.manual-station-favicon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.manual-station-favicon-fallback {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #8000ff);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.9);
  flex-shrink: 0;
}

.manual-station-info { flex: 1; min-width: 0; }
.manual-station-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manual-station-url  { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.manual-station-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ─── Favicon Preview ──────────────────────────────────────────── */
.favicon-preview-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.favicon-preview {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: var(--surface-2);
}

.favicon-preview-fallback {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #8000ff);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.9);
}

/* ─── Info rows ────────────────────────────────────────────────── */
.info-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--surface-2);
}

.info-row:last-child { border-bottom: none; }

.info-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.info-value {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
}

.info-value-source { display: flex; align-items: center; gap: 6px; }
.info-value a { color: var(--accent); text-decoration: none; }
.info-value a:hover { text-decoration: underline; }

.info-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.info-header-text { min-width: 0; }

.info-header-name {
  font-size: 16px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
a.info-header-name-link {
  color: inherit;
  text-decoration: none;
  display: block;
}
a.info-header-name-link:hover { text-decoration: underline; }

.info-header-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.pid-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fifo-path-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.fifo-path-row .form-input { flex: 1; }

.fifo-path-row .btn { align-self: stretch; height: auto; }

.pid-value {
  font-family: ui-monospace, monospace;
  font-size: 13px;
  background: var(--surface-2);
  padding: 4px 10px;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  flex: 1;
}

.pid-value.pid-idle { opacity: 0.45; }

.pid-row .btn:disabled { opacity: 0.35; cursor: not-allowed; }

.info-actions .btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ─── Modal tabs ───────────────────────────────────────────────── */
.modal-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 3px;
  margin-bottom: 16px;
}

.modal-tab {
  flex: 1;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.modal-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

/* ─── History search ───────────────────────────────────────────── */
.history-search-wrap {
  position: relative;
  padding: 0 0 10px;
}
.history-search-icon {
  position: absolute;
  left: 0; top: 0; bottom: 10px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--dur) var(--ease);
}
.history-search-back {
  pointer-events: auto;
  cursor: pointer;
}
.history-search-back:hover { color: var(--accent); }
.history-search-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 8px 10px 8px 36px;
  outline: none;
  box-sizing: border-box;
}
.history-search-input:focus { border-color: var(--accent); }
.history-search-input::placeholder { color: var(--text-muted); }

/* ─── Modal action row ─────────────────────────────────────────── */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions .btn { flex: 1; }

/* The 20px top margin is meant to separate the row from form fields above it — when a
   .modal-actions row is the only thing in a sticky footer (e.g. Scrobble All / Clear All)
   that margin just adds an odd gap under the list, so drop it there. */
.modal-sticky-footer > .modal-actions { margin-top: 0; }

/* ─── No results ───────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.load-more-row {
  display: flex;
  justify-content: center;
  padding: 8px 16px 12px;
}

/* ─── Loading spinner ──────────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

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

/* ─── Recognition modal ────────────────────────────────────────── */
.recognition-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 28px 0 28px;
}

.recognition-loading-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 36px;
}

.recognition-loading-bars span {
  display: block;
  width: 5px;
  border-radius: 3px;
  background: var(--accent);
  animation: bar-bounce 1s ease-in-out infinite;
}

.recognition-loading-bars span:nth-child(1) { animation-delay: 0s;    height: 16px; }
.recognition-loading-bars span:nth-child(2) { animation-delay: 0.15s; height: 28px; }
.recognition-loading-bars span:nth-child(3) { animation-delay: 0.3s;  height: 20px; }
.recognition-loading-bars span:nth-child(4) { animation-delay: 0.45s; height: 32px; }
.recognition-loading-bars span:nth-child(5) { animation-delay: 0.6s;  height: 14px; }

@keyframes bar-bounce {
  0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

.recognition-loading-station {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}

.recognition-loading-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -8px;
}

.recognition-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 4px;
}

.recognition-cover {
  width: 148px;
  height: 148px;
  border-radius: var(--radius-md);
  object-fit: cover;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}

.recognition-title {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  margin-bottom: 6px;
}

.recognition-artist {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 4px;
}

.recognition-album {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
  text-align: center;
}

.recognition-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
  width: 100%;
}

.recognition-shazam-btn { width: 100%; text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }

.recognition-primary-actions { display: flex; gap: 8px; }
.recognition-primary-actions .recognition-shazam-btn { width: auto; flex: 1; }

.recognition-divider { border-top: 1px solid var(--surface-3); }

.service-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

@media (max-width: 480px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 320px) {
  .service-grid { grid-template-columns: 1fr; }
}


.recognition-cover-placeholder {
  width: 148px;
  height: 148px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* ── Hover scroll text ─────────────────────────────────── */
@keyframes text-scroll {
  0%, 15%  { transform: translateX(0); }
  85%, 100% { transform: translateX(var(--tx, 0px)); }
}
.manual-station-item:hover .manual-station-name,
.manual-station-item:hover .manual-station-url {
  text-overflow: clip;
  animation: text-scroll 4s ease-in-out infinite;
}

.recognition-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 0 8px;
  text-align: center;
}

.recognition-error-icon {
  opacity: 0.35;
  margin-bottom: 4px;
}

.recognition-error-title {
  font-size: 16px;
  font-weight: 600;
}

.recognition-error-msg {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── History split (home page) ───────────────────────────────── */
.history-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 36px;
  min-width: 0;
}

.history-split-col {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  min-height: 260px;
}

.history-split-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.history-split-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.history-split-open {
  width: 26px;
  height: 26px;
  font-size: 13px;
}

.history-split-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-split-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
  min-width: 0;
}

.history-split-item:hover { background: var(--surface-2); }

.history-split-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.history-split-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-split-track {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.history-split-cover {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.history-split-cover-placeholder {
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}


@media (max-width: 800px) {
  .history-split { display: none; }
}

/* ─── History modal ────────────────────────────────────────────── */
.history-clickable {
  cursor: pointer;
}

.history-clickable:hover {
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.history-time {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.history-track-cover {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.history-track-cover-placeholder {
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

/* ─── Confirm dialog ───────────────────────────────────────────── */
.confirm-backdrop {
  align-items: center !important;
}

.confirm-sheet {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 24px 20px 20px;
  width: calc(100% - 48px);
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.confirm-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 2px;
}
.confirm-icon-danger { background: #ff3b5c18; color: #ff3b5c; }
.confirm-icon-info   { background: var(--accent-soft); color: var(--accent); }

.confirm-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  line-height: 1.3;
}

.confirm-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.4;
  margin-top: -4px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

.confirm-actions .btn { flex: 1; }

/* ─── Responsive tweaks ────────────────────────────────────────── */
@media (max-width: 480px) {
  .main { padding-left: 14px; padding-right: 14px; }
  .station-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
  .navbar-inner { padding: 0 14px; gap: 8px; }
  .btn-play { width: 46px; height: 46px; }
}

/* ─── Settings nav list ────────────────────────────────────────────── */
.settings-nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.settings-nav-item:hover { background: var(--surface-2); }
.settings-nav-icon { color: var(--accent); display: flex; align-items: center; line-height: 0; }
.settings-nav-icon svg { display: block; }
.settings-nav-label { flex: 1; font-size: 15px; font-weight: 500; }
.settings-nav-caret { color: var(--text-muted); display: flex; align-items: center; }

.settings-section-caption {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.settings-section-caption svg { display: block; flex-shrink: 0; }
.settings-divider {
  border-top: 1px solid var(--surface-3);
  margin: 8px 10px;
}

/* ── Theme screen ─────────────────────────────────────────────────────────── */
.theme-section-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; padding: 16px 16px 8px; }
.theme-segment { display: flex; background: var(--surface-2); border-radius: var(--radius-md); margin: 0 16px 16px; padding: 3px; gap: 3px; }
.theme-segment-btn { flex: 1; padding: 8px; border: none; background: none; color: var(--text-muted); font-size: 14px; cursor: pointer; border-radius: calc(var(--radius-md) - 2px); transition: background var(--dur), color var(--dur); }
.theme-segment-btn.active { background: var(--surface); color: var(--text); font-weight: 600; }
.accent-swatches { display: flex; gap: 12px; padding: 4px 16px 20px; flex-wrap: wrap; }
.accent-swatch { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; outline: 3px solid transparent; outline-offset: 2px; transition: transform var(--dur), outline-color var(--dur); }
.accent-swatch:hover { transform: scale(1.1); }
.accent-swatch.active { outline-color: var(--text); transform: scale(1.15); }
/* Suppress background transitions while rainbow cycles accent variables each frame */
[data-rainbow] * { transition-property: transform, color, opacity, box-shadow !important; }

.accent-swatch-rainbow {
  background: conic-gradient(
    hsl(0,100%,55%), hsl(45,100%,55%), hsl(90,100%,55%), hsl(135,100%,55%),
    hsl(180,100%,55%), hsl(225,100%,55%), hsl(270,100%,55%), hsl(315,100%,55%), hsl(360,100%,55%)
  );
}

.toggle-btn {
  width: 44px; height: 26px; flex-shrink: 0;
  border-radius: 13px; border: none; cursor: pointer;
  background: var(--surface-3); position: relative;
  transition: background var(--dur) var(--ease);
}
.toggle-btn::after {
  content: ""; position: absolute;
  top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--text-muted);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.toggle-btn.active { background: var(--accent-dim); }
.toggle-btn.active::after { transform: translateX(18px); background: var(--accent); }

.settings-sort-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px;
  margin-top: 4px;
  border-top: 1px solid var(--surface-2);
}
.settings-sort-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ─── Instances screen ─────────────────────────────────────────────── */
.instance-current-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 10px;
}
.instance-list { display: flex; flex-direction: column; gap: 8px; }
.instance-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.instance-item:hover { background: var(--surface-3); }
.instance-item.current { border-color: var(--accent); background: var(--accent-soft); }
.instance-item-icon { color: var(--accent); display: flex; align-items: center; flex-shrink: 0; }
.instance-item-info { flex: 1; min-width: 0; }
.instance-item-name {
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.instance-item-type {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.instance-badge-current {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
}
.instance-badge-default {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  color: var(--text-muted);
}
.add-instance-form {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
/* Inputs and the ghost Cancel button share the well's --surface-2 background elsewhere,
   but inside the well itself that makes them indistinguishable from their container —
   bump contrast here. */
.add-instance-form .form-input {
  background: var(--surface);
  border-color: var(--surface-3);
}
.add-instance-form .btn-ghost {
  background: var(--surface-3);
}

/* ─── Stats screen ─────────────────────────────────────────────────── */
.stats-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.stats-process-list { display: flex; flex-direction: column; gap: 6px; }
.stats-process-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-size: 13px;
}
.stats-process-icon { color: var(--accent); display: flex; align-items: center; flex-shrink: 0; }
.stats-process-pid { font-family: ui-monospace, monospace; color: var(--text-muted); font-size: 12px; min-width: 50px; }
.stats-process-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-process-mem { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-muted); min-width: 60px; text-align: right; }
.stats-process-action { min-width: 36px; display: flex; justify-content: flex-end; }

/* ─── About screen ─────────────────────────────────────────────────── */
.about-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 0 8px;
  text-align: center;
}
.about-logo { color: var(--accent); opacity: 0.85; display: flex; line-height: 0; }
.about-name { font-size: 22px; font-weight: 800; }
.about-desc { font-size: 13px; color: var(--text-muted); }
.about-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ─── Snapcast tab ─────────────────────────────────────────────────── */
.snapcast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.snapcast-url {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: ui-monospace, monospace;
}
.inline-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}
.inline-warning.error {
  background: #ff3b5c18;
  color: #ff3b5c;
}
.snapcast-client-list { display: flex; flex-direction: column; gap: 10px; }
.snapcast-client {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}
.snapcast-client-info { flex: 1; min-width: 0; }
.snapcast-client-name { font-weight: 700; font-size: 14px; }
.snapcast-client-host { font-size: 11px; color: var(--text-muted); font-family: ui-monospace, monospace; }
.snapcast-client-status { font-size: 11px; font-weight: 600; margin-top: 2px; }
.snapcast-client-status.connected { color: #30d158; }
.snapcast-client-status.disconnected { color: var(--text-muted); }
.snapcast-client-controls { display: flex; align-items: center; gap: 8px; }
.snapcast-volume-slider {
  flex: 1;
  min-width: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.btn-sm-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--surface-3);
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.btn-sm-icon:hover { background: var(--accent-soft); color: var(--accent); }
.btn-sm-icon.muted { color: #ff3b5c; background: #ff3b5c18; }
.btn-sm-icon:disabled { opacity: 0.35; cursor: not-allowed; }

/* ─── Stats mem bar ────────────────────────────────────────────────── */
.stats-process-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stats-mem-bar-track {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.stats-mem-bar {
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width 0.4s var(--ease);
  min-width: 2px;
}

/* ─── Instance item actions ────────────────────────────────────────── */
.instance-item-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* ─── Snapcast outputs redesign ────────────────────────────────────── */
.snapcast-client-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.snapcast-client-stream {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.snapcast-client-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.snapcast-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.snapcast-source-wrap {
  position: relative;
}
.snapcast-source-btn {
  padding: 6px 10px !important;
}
.snapcast-source-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--surface-3);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 50;
  overflow: hidden;
}
.snapcast-source-option {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.snapcast-source-option:hover { background: var(--surface-2); }
.snapcast-source-option.active { color: var(--accent); font-weight: 700; }
.snapcast-source-empty {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.snapcast-client { padding: 12px 14px; }

/* ─── Toast notifications ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s var(--spring);
  pointer-events: auto;
  max-width: 340px;
  white-space: nowrap;
}
.toast-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toast-icon { display: flex; align-items: center; flex-shrink: 0; line-height: 0; }
.toast-action {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: inherit;
  opacity: 0.7;
  text-decoration: none;
  background: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid currentColor;
}
.toast-action:hover { opacity: 1; }
.toast-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.5;
  padding: 2px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}
.toast-dismiss:hover { opacity: 1; }
.toast-error   { background: #ff3b5c; }
.toast-info    { background: var(--surface); border: 1px solid var(--surface-3); color: var(--text-muted); }
.toast-success { background: #30d158; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ─── Snapcast green play button ───────────────────────────────────── */
.btn-snapcast-play {
  background: #30d158;
  color: #fff;
  box-shadow: 0 2px 8px rgba(48,209,88,0.35);
}
.btn-snapcast-play:hover { background: #25a244; transform: scale(1.05); }
.btn-snapcast-play:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ─── Snapcast local-instance warning ─────────────────────────────── */


/* ─── Stats RAM chart ──────────────────────────────────────────────── */
.stats-ram-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.stats-ram-total {
  font-size: 12px;
  color: var(--text-muted);
}
.stats-ram-bar {
  display: flex;
  height: 20px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
  gap: 2px;
  margin-bottom: 10px;
}
.stats-ram-segment {
  height: 100%;
  min-width: 2px;
  transition: width 0.4s var(--ease);
}
.stats-ram-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 4px;
}
.stats-ram-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.stats-ram-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Stream debug modal ───────────────────────────────────────────── */
.debug-sheet { max-width: 680px; }
.debug-body  { font-family: ui-monospace, monospace; font-size: 12px; }
.debug-instance { margin-bottom: 20px; }
.debug-instance-header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.debug-url { color: var(--text-muted); font-size: 11px; word-break: break-all; }
.debug-now-playing { margin-bottom: 8px; color: var(--text-muted); }
.debug-now-playing .debug-label { font-weight: 700; color: var(--text); }
.debug-source { opacity: 0.5; font-size: 11px; }
.debug-log { display: flex; flex-direction: column; gap: 3px; }
.debug-log-line { display: flex; gap: 10px; padding: 3px 6px; border-radius: 4px; background: var(--surface-2); }
.debug-log-ts { color: var(--accent); flex-shrink: 0; }
.debug-log-text { color: var(--text); word-break: break-all; }
.debug-empty { color: var(--text-muted); font-style: italic; }

/* ─── About logo img ───────────────────────────────────────────────── */

/* ── Wordmark ─────────────────────────────────────────────────────── */
.wordmark { display: inline-flex; align-items: center; gap: 6px; line-height: 1; }
.wordmark-icon { display: inline-flex; align-items: center; flex-shrink: 0; color: var(--accent); }
.wordmark-text { display: inline-flex; align-items: center; white-space: nowrap; }
.wordmark-radio { font-weight: 500; color: var(--accent); letter-spacing: -0.02em; }
.wordmark-party { font-weight: 500; color: var(--text-muted); letter-spacing: -0.02em; }
.wordmark-md { font-size: 16px; }
.wordmark-sm { font-size: 13px; }

.desktop-footer {
  display: flex;
  justify-content: center;
  padding: 20px 0 28px;
  opacity: 0.6;
  pointer-events: none;
}

/* ═══════════════════════════════════════════════════════════════════
   Mobile layout  (≤640px)
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {
  /* Hide desktop elements entirely */
  .navbar { display: none !important; }
  .main   { display: none !important; }

  /* Root container */
  .mobile-root {
    position: fixed;
    inset: 0;
    overflow: hidden;
    background: var(--bg);
  }

  /* ── Now Playing panel ──────────────────────────────────────────── */
  .mobile-player {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    padding: max(env(safe-area-inset-top), 32px) 28px max(env(safe-area-inset-bottom), 28px);
    touch-action: pan-x;
  }

  .mobile-player-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
  }

  .mobile-wordmark-wrap {
    position: absolute;
    top: max(env(safe-area-inset-top), 20px);
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
  }

  .mobile-art-wrap {
    flex-shrink: 0;
    margin-bottom: 8px;
  }

  .mobile-art {
    display: block;
    width: min(60vw, 280px);
    height: min(60vw, 280px);
    border-radius: var(--radius-xl);
    object-fit: cover;
    background: var(--surface-2);
  }

  .mobile-art-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--text-muted);
  }

  .mobile-track-info {
    text-align: center;
    min-width: 0;
    width: 100%;
    padding: 0 8px;
    margin-bottom: 8px;
  }

  .mobile-station-name {
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-now-playing {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Main controls row */
  .mobile-main-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 0 8px;
  }

  .mobile-side-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: color var(--dur) var(--ease);
    min-width: 64px;
  }
  .mobile-side-btn:hover { color: var(--text); }
  .mobile-side-btn:disabled { opacity: 0.35; pointer-events: none; }
  .mobile-side-btn svg { display: block; }

  .mobile-btn-play {
    width: 72px !important;
    height: 72px !important;
    flex-shrink: 0;
  }


  /* Actions row */
  .mobile-actions-row {
    display: flex;
    justify-content: center;
    gap: 8px;
  }

  .mobile-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: var(--radius-pill);
    transition: color var(--dur) var(--ease), transform var(--dur) var(--spring);
  }
  .mobile-action-btn:hover { color: var(--text); transform: scale(1.1); }
  .mobile-action-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none !important; }
  .mobile-action-btn.pinned { color: #ffd700; }
  .mobile-action-btn.pinned svg { fill: currentColor; }

  /* Discover handle */
  .mobile-discover-handle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 28px;
    box-shadow: 0 4px 16px var(--accent-glow);
    transition: transform var(--dur) var(--spring), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
    white-space: nowrap;
    z-index: 2;
    flex-shrink: 0;
  }
  .mobile-discover-handle:hover { background: var(--accent-dim); transform: scale(1.04); box-shadow: 0 6px 24px var(--accent-glow); }
  .mobile-discover-handle:active { transform: scale(0.97); }
  .mobile-discover-handle svg { display: inline-block; vertical-align: middle; }

  /* ── Discover panel ─────────────────────────────────────────────── */
  .mobile-discover {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    transform: translateY(100%);
    transition: transform 0.38s var(--spring);
    will-change: transform;
  }
  .mobile-discover.open { transform: translateY(0); }

  .mobile-search-top {
    padding: max(env(safe-area-inset-top), 12px) 14px 0;
    flex-shrink: 0;
  }
  .mobile-search-top .search-wrap { margin-bottom: 0; }

  .mobile-discover-body {
    flex: 1;
    overflow-y: auto;
  overflow-y: overlay;
    -webkit-overflow-scrolling: touch;
    padding: 14px;
  }

  /* Mini-bar at the bottom of the discover panel */
  .mobile-mini-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    padding-bottom: max(env(safe-area-inset-bottom), 10px);
    background: var(--surface);
    border-top: 1px solid var(--surface-2);
    flex-shrink: 0;
  }

  .mobile-mini-bar-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
  }

  .mobile-mini-bar-text { min-width: 0; }

  .mobile-mini-bar-name {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-mini-bar-track {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-mini-play {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0;
  }

  /* ── Modals: full-screen pages on mobile, no bounce ────────────── */
  .modal-backdrop:not(.confirm-backdrop) {
    align-items: stretch !important;
  }
  .modal-sheet {
    border-radius: 0 !important;
    max-height: 100dvh !important;
    height: 100dvh !important;
    max-width: 100% !important;
  }
  .modal-enter-active .modal-sheet,
  .modal-leave-active .modal-sheet {
    transition: none !important;
  }
  .modal-enter-from .modal-sheet,
  .modal-leave-to .modal-sheet {
    transform: none !important;
  }
}

/* ─── Global activity spinner ──────────────────────────────────────── */
.global-activity {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 450;
  width: 32px;
  height: 32px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s var(--ease);
}
.disconnected-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  animation: toast-in 0.25s var(--spring);
}

/* ─── Library building overlay ──────────────────────────────────── */
.library-building-overlay {
  position: fixed;
  inset: 0;
  z-index: 600;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}
.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}
.library-building-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}
.library-building-sub {
  font-size: 13px;
  color: var(--text-muted);
}

/* ─── Library settings screen ───────────────────────────────────── */
.library-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface-2);
}
.library-source-info { flex: 1; min-width: 0; }
.library-source-favicon-wrap { width: 20px; height: 20px; flex-shrink: 0; align-self: flex-start; margin-top: 2px; }
.library-source-favicon-wrap .source-favicon-fallback { font-size: 16px; }
a.library-source-name-link { color: inherit; text-decoration: none; }
a.library-source-name-link:hover { text-decoration: underline; }
.library-source-name  { font-size: 14px; font-weight: 500; }
.library-source-meta  { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.library-total        { font-size: 12px; color: var(--text-muted); text-align: center; margin-bottom: 10px; }

@keyframes fade-in {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}
