:root {
  /* Warm Sunset identity — its own look, not tied to any streaming service. */
  --accent: #ff6b6b;        /* coral */
  --accent-2: #ffb05c;      /* amber */
  --accent-grad: linear-gradient(135deg, #ff6b6b 0%, #ffb05c 100%);
  --accent-ink: #2a1114;    /* readable text on the warm accent */
  --accent-soft: rgba(255, 122, 92, 0.12);

  /* Back-compat aliases: existing rules reference --green*; they now render warm. */
  --green: #ff7a5c;
  --green-bright: #ffa46b;
  --green-hover: #ff8f6b;

  --bg: #17131a;
  --bg-elev: #1f1922;
  --bg-elev-2: #271f2b;
  --bg-card: #1f1922;
  --bg-hover: #2e2533;
  --sidebar: #100d14;
  --text: #f7f2ef;
  --text-muted: #b9aeb4;
  --text-dim: #7c7076;
  --border: #322a38;
  --radius: 10px;
  --font: "Segoe UI", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
/* Soft sunset glow behind the app. */
.app {
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(255, 107, 107, 0.16), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(255, 176, 92, 0.12), transparent 55%),
    #000;
}

.hidden { display: none !important; }

/* Layout */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
  gap: 8px;
  padding: 8px;
  background: #000;
}

/* Sidebar */
.sidebar {
  background: var(--sidebar);
  border-radius: var(--radius);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin-bottom: 28px;
}
.brand-mark { width: 30px; height: 30px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: color .15s;
}
.nav-item svg { width: 22px; height: 22px; fill: currentColor; }
.nav-avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: #333; }
.nav-item.active .nav-avatar { box-shadow: 0 0 0 2px var(--green); }
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--text); }
.sidebar-foot {
  margin-top: auto;
  padding-top: 20px;
}
.sidebar-foot p {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
}

/* Main */
.main {
  background: linear-gradient(180deg, #2e2130 0%, var(--bg) 260px);
  border-radius: var(--radius);
  overflow-y: auto;
  padding: 0 32px 40px;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 18px;
  background: linear-gradient(180deg, rgba(23,19,26,0.82), rgba(23,19,26,0));
  backdrop-filter: blur(6px);
}
.topbar-title h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -0.5px; }
.topbar-title p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }

/* Buttons */
.btn {
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 22px;
  transition: transform .1s ease, background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent-grad); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); transform: scale(1.03); }
.btn-primary:disabled { background: #3a3340; color: #7a7280; cursor: not-allowed; transform: none; filter: none; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid #7a7a7a;
}
.btn-outline:hover { border-color: var(--text); transform: scale(1.03); }
.btn-lg { padding: 14px 34px; font-size: 15px; }
.spotify-glyph { width: 20px; height: 20px; }

/* Auth area */
.auth-area { display: flex; align-items: center; gap: 12px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 14px 4px 4px;
  font-weight: 600;
  font-size: 14px;
}
.user-chip img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background:#333; }
.user-chip .logout {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 12px; font-family: inherit; text-decoration: underline;
}
.user-chip .logout:hover { color: var(--text); }

/* Notice */
.notice {
  background: rgba(255, 200, 0, 0.08);
  border: 1px solid rgba(255, 200, 0, 0.35);
  color: #f5d67b;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 8px 0 18px;
  font-size: 14px;
  line-height: 1.6;
}
.notice code {
  background: rgba(0,0,0,0.4);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  color: #fff;
  user-select: all;
}

/* Segmented toggle (Tools: Create / Modify) */
.seg-toggle {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 999px; margin: 4px 0 16px;
}
.seg {
  border: none; background: transparent; color: var(--text-muted);
  font-family: inherit; font-weight: 700; font-size: 14px;
  padding: 8px 22px; border-radius: 999px; cursor: pointer;
  transition: background .15s, color .15s;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--accent-grad); color: var(--accent-ink); }

/* Content grid */
.content {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  margin-top: 8px;
}
@media (max-width: 1040px) {
  .content { grid-template-columns: 1fr; }
}

.panel {
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 24px;
}

/* Fields */
.field { margin-bottom: 20px; }
.field > label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.field .val { color: var(--green-bright); font-weight: 800; text-transform: none; letter-spacing: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 560px) { .grid-2 { grid-template-columns: 1fr; } }

input[type="text"], input[type="number"], select {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 14px;
  outline: none;
  transition: border .15s, background .15s;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  border-color: var(--green);
  background: #262626;
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%23b3b3b3' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.hint { color: var(--text-dim); font-size: 12px; margin: 8px 0 0; line-height: 1.5; }

/* Artist search + suggestions */
.artist-search { position: relative; }
.suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  max-height: 320px;
  overflow-y: auto;
}
.suggest-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  cursor: pointer;
}
.suggest-item:hover { background: var(--bg-hover); }
.suggest-item img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: #333; }
.suggest-item .name { font-weight: 600; font-size: 14px; }
.suggest-item .sub { color: var(--text-dim); font-size: 12px; }
#artistChosen { color: var(--green-bright); font-weight: 600; }

/* Range sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #4d4d4d;
  border-radius: 2px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  border: none;
}
input[type="range"]:hover::-webkit-slider-thumb { background: var(--green-bright); }
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px; border-radius: 50%;
  background: #fff; cursor: pointer; border: none;
}
.dual-range { position: relative; height: 20px; display: flex; align-items: center; }
.dual-range input[type="range"] {
  position: absolute; left: 0; right: 0; margin: 0; pointer-events: none; background: none;
}
.dual-range input[type="range"]::-webkit-slider-thumb { pointer-events: all; }
.dual-range input[type="range"]::-moz-range-thumb { pointer-events: all; }
.dual-range::before {
  content: ""; position: absolute; left: 0; right: 0; height: 4px;
  background: #4d4d4d; border-radius: 2px;
}

.year-row { display: flex; align-items: center; gap: 10px; }
.year-row input { text-align: center; }
.year-row .dash { color: var(--text-dim); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: border .15s, background .15s;
}
.chip:hover { border-color: #5a5a5a; }
.chip input { accent-color: var(--green); width: 15px; height: 15px; cursor: pointer; }
.chip:has(input:checked) { border-color: var(--green); background: rgba(255,107,107,0.12); }

/* Actions */
.actions { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.status { margin-top: 14px; font-size: 13px; color: var(--text-muted); min-height: 18px; }
.status.error { color: #f0787a; }
.status.ok { color: var(--green-bright); }

/* Results */
.results-head {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px;
}
.results-head h2 { margin: 0; font-size: 20px; font-weight: 800; }
.results-head .head-right { display: flex; align-items: center; gap: 12px; }
.results-meta { color: var(--text-dim); font-size: 13px; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.track-list { display: flex; flex-direction: column; }
.track-row {
  display: grid;
  grid-template-columns: 28px 44px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: default;
}
.track-row:hover { background: var(--bg-hover); }
.track-row .idx { color: var(--text-dim); font-size: 14px; text-align: right; }
.track-row img { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; background: #333; }
.track-row .meta { min-width: 0; }
.track-row .t-name {
  font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-row .t-sub {
  color: var(--text-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-row .t-pop {
  display: flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 12px;
}
.pop-bar { width: 44px; height: 4px; background: #3a3a3a; border-radius: 2px; overflow: hidden; }
.pop-bar span { display: block; height: 100%; background: var(--green); }

/* Legend explaining the popularity bar in each track list */
.pop-legend {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-dim); font-size: 12px; margin: 0 0 12px;
}
.pop-legend .pop-bar { width: 34px; flex: none; }
.pop-legend .pop-bar span { width: 68%; }
.badge-e {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 3px; background: #6a6a6a; color: #000;
  font-size: 10px; font-weight: 800; margin-left: 6px; vertical-align: middle;
}

.empty-state {
  text-align: center; color: var(--text-dim); padding: 40px 20px;
}
.empty-state svg { width: 48px; height: 48px; fill: #3a3a3a; margin-bottom: 12px; }
.empty-state p { font-size: 14px; line-height: 1.6; max-width: 300px; margin: 0 auto; }
.empty-state em { color: var(--green-bright); font-style: normal; font-weight: 600; }

.saved-link {
  display: flex; align-items: center; gap: 12px;
  background: rgba(255,107,107,0.12);
  border: 1px solid var(--green);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.saved-link a { color: var(--green-bright); font-weight: 700; text-decoration: none; }
.saved-link a:hover { text-decoration: underline; }

/* Discover view */
.discover-search { margin-bottom: 12px; }
.load-more-wrap { display: flex; justify-content: center; margin-top: 14px; }
.discover-feed { display: flex; flex-direction: column; gap: 10px; }
.discover-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border .15s, background .15s;
}
.discover-card:hover { border-color: #5a5a5a; background: #232323; }
.dc-head { display: flex; align-items: center; gap: 10px; }
.dc-title { font-weight: 700; font-size: 15px; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-desc { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dc-foot {
  color: var(--text-dim); font-size: 12px; margin-top: 8px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.dc-foot .dc-by { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-stats { display: flex; align-items: center; gap: 12px; flex: none; }
.dc-added, .dc-comments { display: inline-flex; align-items: center; gap: 4px; }
.dc-like {
  display: inline-flex; align-items: center; gap: 5px;
  background: none; border: none; padding: 2px 4px; margin: -2px -4px;
  color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer;
  border-radius: 6px; transition: color .15s, background .15s;
}
.dc-like:hover { color: #ff6b81; background: rgba(255,107,129,0.1); }
.dc-like .heart { font-size: 13px; line-height: 1; }
.dc-like.liked { color: #ff5c77; }

/* small select used in results headers (sort) */
.mini-select {
  width: auto; padding: 7px 30px 7px 12px; font-size: 13px;
  background-position: right 10px center;
}

/* Detail like button liked-state */
.btn.liked { border-color: #ff5c77; color: #ff8098; }
.dc-badge {
  display: inline-flex; align-items: center; flex: none;
  font-size: 10px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px;
}
.dc-badge.asis { background: #2a2a2a; color: var(--text-muted); border: 1px solid var(--border); }
.dc-badge.community { background: rgba(255,107,107,0.15); color: var(--green-bright); border: 1px solid var(--green); }

/* Moderator-pinned featured playlist */
.discover-card.featured {
  border-color: #f0c040;
  background: linear-gradient(180deg, rgba(240,192,64,0.12), rgba(240,192,64,0.04));
}
.dc-featured-tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: #f0c040; margin-bottom: 8px;
}
.btn.pinned { border-color: #f0c040; color: #f0c040; }

/* Weekly challenge */
.challenge-banner {
  border: 1px solid var(--green);
  background: linear-gradient(180deg, rgba(255,107,107,0.16), rgba(255,176,92,0.05));
  border-radius: 10px; padding: 16px 18px; margin-bottom: 14px;
}
.challenge-banner.muted {
  border-color: var(--border); background: var(--bg-elev-2);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.challenge-banner .cb-tag {
  font-size: 11px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
  color: var(--green-bright); margin-bottom: 6px;
}
.challenge-banner .cb-theme { font-size: 18px; font-weight: 800; }
.challenge-banner .cb-desc { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.challenge-banner .cb-meta { color: var(--text-dim); font-size: 12px; margin-top: 8px; }
.challenge-banner .cb-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.challenge-form {
  border: 1px solid var(--border); background: var(--bg-elev-2);
  border-radius: 10px; padding: 16px; margin-bottom: 14px;
  display: flex; flex-direction: column; gap: 10px;
}

.dc-badge.entry { background: rgba(255,107,107,0.12); color: var(--green-bright); border: 1px solid var(--green); }
.dc-badge.winner { background: rgba(240,192,64,0.18); color: #f0c040; border: 1px solid #f0c040; }

/* Clickable curator name */
.dc-by .curator-link, .curator-link {
  color: var(--text-muted); cursor: pointer;
}
.dc-by .curator-link:hover, .curator-link:hover { color: var(--text); text-decoration: underline; }

/* Comments */
.comments-head { font-size: 15px; font-weight: 800; margin: 22px 0 10px; }
.comments-head span { color: var(--text-dim); font-weight: 600; font-size: 13px; }
.comment-box { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-box input { flex: 1; }
.comments { display: flex; flex-direction: column; gap: 10px; }
.comment { background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.comment .c-head { display: flex; align-items: center; gap: 8px; }
.comment .c-name { font-weight: 700; font-size: 13px; }
.comment .c-del {
  margin-left: auto; background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px;
}
.comment .c-del:hover { color: #f0787a; }
.comment .c-text { font-size: 14px; margin-top: 4px; color: var(--text); word-break: break-word; }

/* Top-bar coffee / donate button */
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.coffee-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  font-size: 18px; line-height: 1; text-decoration: none;
  border: 1px solid #7a7a7a; background: transparent;
  transition: background .15s, border-color .15s, transform .1s;
}
.coffee-btn:hover { background: rgba(240,192,64,0.14); border-color: #f0c040; transform: scale(1.05); }

/* Stats view */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-tile {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
}
.stat-tile .num { font-size: 24px; font-weight: 800; color: var(--green-bright); line-height: 1.1; }
.stat-tile .lbl {
  color: var(--text-muted); font-size: 11px; margin-top: 5px;
  text-transform: uppercase; letter-spacing: 0.4px;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  background: var(--bg-elev-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 13px; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: capitalize;
}

.stat-artists { display: flex; flex-direction: column; gap: 4px; }
.stat-artist { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.stat-artist .rank { color: var(--text-dim); font-size: 13px; width: 18px; text-align: right; }
.stat-artist img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #333; }
.stat-artist .n { font-weight: 600; font-size: 14px; }
.stat-artist .s { color: var(--text-dim); font-size: 12px; }

.suggestion {
  display: flex; align-items: center; gap: 14px;
  background: rgba(255,107,107,0.10); border: 1px solid var(--green);
  border-radius: 8px; padding: 14px;
}
.suggestion img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; background: #333; }
.suggestion .n { font-weight: 700; font-size: 15px; }
.suggestion .why { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.suggestion .cta { margin-left: auto; }
.suggestion.muted {
  display: block; border-color: var(--border); background: var(--bg-elev-2);
  color: var(--text-dim); font-size: 13px;
}

/* Loading spinner */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.25); border-top-color: #000;
  animation: spin .7s linear infinite; display: inline-block; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Modal (shareable card) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; width: 100%; max-width: 420px;
  max-height: 92vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-preview-wrap { display: flex; justify-content: center; }
.card-preview {
  max-width: 100%; max-height: 62vh; border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); background: #0a0a0a;
}
.modal-card .actions { justify-content: center; }

/* Toast */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--green-bright); color: #000;
  padding: 14px 24px; border-radius: 8px; font-weight: 700; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4); z-index: 100;
  animation: rise .25s ease;
}
.toast.err { background: #e8484a; color: #fff; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } }

/* Scrollbar */
::-webkit-scrollbar { width: 12px; }
::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 6px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #565656; background-clip: content-box; }

/* =========================== Mobile / phones =========================== */
@media (max-width: 760px) {
  /* Stack the whole app; let the page scroll naturally */
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    gap: 0;
    padding: 0;
  }

  /* Sidebar becomes a fixed bottom tab bar */
  .sidebar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    flex-direction: row;
    align-items: center;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-radius: 0;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(8px);
  }
  .brand,
  .sidebar-foot { display: none; }        /* the topbar title carries branding here */
  .nav {
    flex-direction: row;
    flex: 1;
    gap: 0;
    justify-content: space-around;
  }
  .nav-item {
    flex-direction: column;
    gap: 3px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 700;
  }
  .nav-item svg { width: 23px; height: 23px; }

  /* Main fills the screen; leave room for the bottom bar */
  .main {
    border-radius: 0;
    overflow: visible;
    padding: 0 16px calc(88px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, #2a2a2a 0%, var(--bg) 200px);
  }

  /* Topbar stacks: title on top, auth button full-width below */
  .topbar {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 18px 0 14px;
    backdrop-filter: none;
    background: none;
  }
  .topbar-title h1 { font-size: 24px; }
  .topbar-actions { width: 100%; }
  .auth-area { flex: 1; }
  .auth-area .btn { width: 100%; justify-content: center; }
  .user-chip { justify-content: center; }

  /* Tighter panels + always single column on phones */
  .content { grid-template-columns: 1fr; gap: 16px; margin-top: 4px; }
  .grid-2 { grid-template-columns: 1fr; }
  .panel { padding: 18px 16px; }

  /* Keep the toast clear of the bottom tab bar */
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
}

/* ===================== Multi-service (provider) UI ===================== */
/* Service picker shown at connect time when 2+ services are configured. */
.connect-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.connect-label { color: var(--text-muted); font-size: 13px; font-weight: 700; }
.btn-svc { padding: 10px 16px; }
.svc-glyph { width: 18px; height: 18px; }
.user-chip .chip-svc { color: var(--text-dim); font-weight: 600; }

/* Capability gating: hide features the connected service can't provide.
   Apple Music has no popularity score and no listening-history/top items. */
body.no-popularity .pop-legend,
body.no-popularity .t-pop { display: none !important; }
body.no-stats .stats-block { display: none !important; }
