/* c3melounge — mobile-first UI
 *
 * Layout zones (top to bottom):
 *   .appbar        sticky top, brand + (desktop) nav + refresh
 *   main.container scrolling content
 *   .dock          fixed bottom: .mini-player + .tabbar (mobile only)
 *   .player-sheet  full-screen overlay for now-playing details
 *   footer         credits, scrolls with content
 */

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --surface-2: #1c2230;
  --border:    #30363d;
  --text:      #c9d1d9;
  --muted:     #8b949e;
  --accent:    #58a6ff;
  --green:     #3fb950;
  --red:       #f85149;
  --amber:     #d29922;
  --purple:    #a371f7;

  --radius:   10px;
  --radius-sm: 6px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --mini-h:   60px;
  --tabbar-h: 60px;
  /* total height occupied by the bottom dock */
  --dock-h: calc(var(--mini-h) + var(--tabbar-h) + var(--safe-bottom));

  --tap: 44px;
}

@media (min-width: 720px) {
  :root {
    /* tabbar disappears on desktop */
    --dock-h: calc(var(--mini-h) + var(--safe-bottom));
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui,
               Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: var(--dock-h);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

/* ── App bar ─────────────────────────────────────────── */
.appbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top, 0px));
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
  color: var(--text);
}
.brand:hover { color: var(--accent); text-decoration: none; }
.appbar .nav-desktop { display: none; }
.appbar form { margin: 0; }
.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.45rem 0.75rem;
  min-height: var(--tap);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

@media (min-width: 720px) {
  .appbar { padding: 0.75rem 1.5rem; gap: 1.5rem; }
  .appbar .nav-desktop {
    display: flex;
    gap: 1.25rem;
  }
  .appbar .nav-desktop a {
    color: var(--muted);
    font-size: 0.875rem;
    padding: 0.4rem 0;
  }
  .appbar .nav-desktop a:hover { color: var(--text); text-decoration: none; }
  .appbar .nav-desktop a.active { color: var(--text); }
  .refresh-btn { min-height: 0; padding: 0.35rem 0.7rem; }
}

/* ── Main container ──────────────────────────────────── */
main.container {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}
@media (min-width: 720px) { main.container { padding: 1.5rem 2rem; } }
@media (min-width: 1024px) { main.container { padding: 2rem; } }

h1 { font-size: 1.4rem; margin-bottom: 1rem; line-height: 1.25; }
h2 { font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
@media (min-width: 720px) { h1 { font-size: 1.7rem; margin-bottom: 1.25rem; } }

/* ── Page header (title + back) ──────────────────────── */
.page-header { margin-bottom: 1rem; }
.page-header .back {
  font-size: 0.82rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
  min-height: var(--tap);
  padding: 0.25rem 0;
}
.page-header .back:hover { color: var(--accent); text-decoration: none; }
.page-header h1 { margin-bottom: 0.25rem; }
.page-header .subtitle {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.6rem;
  align-items: center;
}
.page-header .ext-link { color: var(--muted); }

/* ── Stats strip on home ─────────────────────────────── */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
}
.stats strong { color: var(--text); }

/* ── Search bar ──────────────────────────────────────── */
.search-bar { margin-bottom: 0.75rem; }
.search-bar input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.7rem 0.875rem;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  -webkit-appearance: none;
}
.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--muted); }
@media (min-width: 720px) {
  .search-bar input { max-width: 480px; padding: 0.55rem 0.875rem; font-size: 0.9rem; }
}

/* ── Filter chips ────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0.25rem;
  /* edge-to-edge scroll on mobile */
  margin-left: -1rem;
  margin-right: -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
}
.filter-bar::-webkit-scrollbar { display: none; }
@media (min-width: 720px) {
  .filter-bar { flex-wrap: wrap; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
}
.filter-bar .label {
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}
.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: var(--tap);
  display: inline-flex;
  align-items: center;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); text-decoration: none; }
.filter-btn.active { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }

/* ── Card grids ──────────────────────────────────────── */
.events-grid,
.artists-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
@media (min-width: 480px) {
  .events-grid  { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .artists-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

.event-card,
.artist-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  transition: border-color 0.15s, transform 0.15s;
  display: block;
}
.event-card:hover,
.artist-card:hover { border-color: var(--accent); }
.event-card:active,
.artist-card:active { transform: scale(0.99); }
.event-card h2 a,
.artist-card h2 a { color: var(--text); }
.event-card h2 a:hover,
.artist-card h2 a:hover { color: var(--accent); text-decoration: none; }
.event-meta,
.artist-meta {
  margin-top: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.75rem;
}
.set-count { font-variant-numeric: tabular-nums; }
.artist-events {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.artist-event-tag {
  font-size: 0.72rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.artist-event-tag:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ── Set list ────────────────────────────────────────── */
.set-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}
.set-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "card"
    "footer";
}
@media (min-width: 720px) {
  .set-entry {
    grid-template-columns: 1fr 10rem;
    grid-template-areas:
      "card art"
      "footer art";
  }
}
.set-card {
  grid-area: card;
  padding: 0.875rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem 0.75rem;
  align-items: start;
}
.set-main {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.set-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  align-self: start;
}
.set-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
}
.set-title a { color: var(--text); }
.set-title a:hover { color: var(--accent); text-decoration: none; }
.set-meta {
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: center;
}
.set-meta a { color: var(--muted); }
.set-meta a:hover { color: var(--accent); text-decoration: none; }
.set-art-slot {
  grid-area: art;
  display: none;
  border-left: 1px solid var(--border);
  align-self: stretch;
}
@media (min-width: 720px) { .set-art-slot { display: block; } }
.set-art-slot img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.set-footer {
  grid-area: footer;
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
}
.set-slug {
  font-size: 0.72rem;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  user-select: all;
  overflow-wrap: anywhere;
}
.set-footer-plays { font-size: 0.72rem; color: var(--muted); }
.set-footer-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.sep { color: var(--border); }

/* ── Track list (radio) ──────────────────────────────── */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.track-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas:
    "body"
    "footer";
}
@media (min-width: 720px) {
  .track-card {
    grid-template-columns: 1fr 10rem;
    grid-template-areas:
      "body  art"
      "footer art";
  }
}
.track-art-slot {
  grid-area: art;
  display: none;
  border-left: 1px solid var(--border);
  align-self: stretch;
}
@media (min-width: 720px) { .track-art-slot { display: block; } }
.track-art-slot img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}
.track-body {
  grid-area: body;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  align-items: start;
}
.track-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}
.track-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  align-self: start;
}
.track-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}
.track-time {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
}
.track-end { color: var(--muted); }
.track-dur-label { color: var(--muted); opacity: 0.7; }
.track-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  overflow-wrap: anywhere;
}
.track-title a { color: var(--text); }
.track-title a:hover { color: var(--accent); text-decoration: none; }
.track-title .sets-link {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 0.4rem;
}
.track-meta {
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  align-items: center;
}
.track-meta a { color: var(--muted); }
.track-meta a:hover { color: var(--accent); text-decoration: none; }
.track-footer {
  grid-area: footer;
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.track-override-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}
.track-override-slug {
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  overflow-wrap: anywhere;
}
.track-override-row {
  display: flex;
  gap: 0.5rem;
  position: relative;
}
.track-override-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem; /* >=16px to prevent iOS zoom */
  padding: 0.55rem 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  flex: 1;
  min-width: 0;
  outline: none;
  -webkit-appearance: none;
}
.track-override-input:focus { border-color: var(--accent); }
.track-override-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  white-space: nowrap;
  min-height: var(--tap);
}
.track-override-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (min-width: 720px) {
  .track-override-input { font-size: 0.82rem; padding: 0.4rem 0.6rem; }
  .track-override-btn { font-size: 0.8rem; padding: 0.35rem 0.75rem; min-height: 0; }
}

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.4;
}
.badge-platform { border-color: var(--border); color: var(--muted); }
.badge-meta { border-color: var(--border); color: var(--muted); font-variant-numeric: tabular-nums; }
.badge-notes { border-color: var(--border); color: var(--muted); }
.badge-local    { border-color: var(--green);  color: var(--green); }
.badge-genre    { border-color: var(--purple); color: var(--purple); }
.badge-radio    { border-color: var(--amber);  color: var(--amber); }
.badge-votes    { border-color: var(--accent); color: var(--accent); }
.fa-podcast { margin-right: 0.25em; }

/* ── Copy buttons ────────────────────────────────────── */
.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.45rem 0.7rem;
  min-height: var(--tap);
  min-width: var(--tap);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
@media (min-width: 720px) {
  .copy-btn { font-size: 0.75rem; padding: 0.3rem 0.55rem; min-height: 0; min-width: 0; }
}

/* ── Bottom dock: mini player + tab bar ──────────────── */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding-bottom: var(--safe-bottom);
}

/* MOBILE mini-player layout — single row: art · info · play · expand
 * Desktop overrides this to a 3-column bar (left/center/right). */
.mini-player {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas: "left left center right";
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.75rem;
  height: var(--mini-h);
}
.mp-left {
  grid-area: left;
  display: contents; /* on mobile, art and info are placed individually */
}
.mp-center { grid-area: center; display: contents; }
.mp-right  { grid-area: right;  display: contents; }

/* Mobile: hide desktop-only widgets. */
.mp-progress-bar,
.mp-volume,
.mp-station { display: none; }

/* Top thin progress line — mobile only. */
.mp-progress-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  pointer-events: none;
  z-index: 1;
}
.mp-progress-line .fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 1s linear;
}

.mini-player .art {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
  display: block;
}
.mini-player .art[hidden] { display: none; }
.mini-player .art-placeholder {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1.1rem;
}
.mini-player .info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  cursor: pointer;
  background: none;
  border: none;
  text-align: left;
  color: var(--text);
  padding: 0;
  font: inherit;
}
.mini-player .info .title {
  font-size: 0.85rem;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mini-player .info .sub {
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn.playing { border-color: var(--accent); color: var(--accent); }
.mini-player .expand {
  width: var(--tap);
  height: var(--tap);
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
}
.mini-player .expand:hover { color: var(--accent); }

/* Tab bar (mobile only) */
.tabbar {
  display: flex;
  height: var(--tabbar-h);
  border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  color: var(--muted);
  font-size: 0.65rem;
  text-decoration: none;
  padding: 0.35rem 0.25rem;
  min-width: 0;
}
.tabbar a:hover { color: var(--text); text-decoration: none; }
.tabbar a.active { color: var(--accent); }
.tabbar .tab-icon {
  font-size: 1.15rem;
  line-height: 1;
}
.tabbar .tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (min-width: 720px) {
  .tabbar { display: none; }

  /* Desktop: 3-column bar — left art+info, center play+progress, right vol+station+expand */
  .mini-player {
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 2fr) minmax(220px, 1fr);
    grid-template-areas: "left center right";
    gap: 1.25rem;
    padding: 0.5rem 1.25rem;
    height: 72px;
  }
  :root { --mini-h: 72px; }

  /* Restore real grid placement (drop the mobile display:contents). */
  .mp-left,
  .mp-center,
  .mp-right { display: flex; align-items: center; min-width: 0; }
  .mp-left   { gap: 0.75rem; }
  .mp-center { gap: 0.75rem; flex-direction: column; align-items: stretch; justify-content: center; }
  .mp-right  { gap: 0.75rem; justify-content: flex-end; }

  /* Bigger album art on desktop. */
  .mini-player .art,
  .mini-player .art-placeholder {
    width: 56px;
    height: 56px;
  }

  /* Hide the thin top progress line — desktop has the inline bar. */
  .mp-progress-line { display: none; }

  /* Show the desktop-only widgets. */
  .mp-progress-bar { display: flex; align-items: center; gap: 0.5rem; }
  .mp-progress-bar .time {
    font-size: 0.7rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    min-width: 2.5rem;
    text-align: center;
  }
  .mp-progress-bar .bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
    cursor: default;
  }
  .mp-progress-bar .fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 1s linear;
  }

  /* Center the play button above the progress row. */
  .mp-center { align-items: center; }
  .mp-center .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
  .mp-center .mp-progress-bar { width: 100%; }

  /* Volume slider (desktop). */
  .mp-volume { display: flex; align-items: center; gap: 0.4rem; }
  .mp-volume .ico {
    color: var(--muted);
    font-size: 0.95rem;
    width: 1.25rem;
    text-align: center;
    user-select: none;
  }
  .mp-volume input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    outline: none;
    cursor: pointer;
  }
  .mp-volume input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 0;
  }
  .mp-volume input[type=range]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 0;
  }

  .mp-station {
    display: inline-flex;
    align-items: center;
    font-size: 0.78rem;
    color: var(--muted);
    white-space: nowrap;
  }
  .mp-station:hover { color: var(--accent); text-decoration: none; }
}

/* Narrower desktop: drop the station label so volume + expand still fit. */
@media (min-width: 720px) and (max-width: 960px) {
  .mp-station { display: none; }
}

/* Wider desktop: bigger title and cap the bar width so it doesn't sprawl edge-to-edge. */
@media (min-width: 1100px) {
  .mini-player {
    max-width: 1400px;
    margin: 0 auto;
  }
  .mini-player .info .title { font-size: 0.95rem; }
  .mp-volume input[type=range] { width: 110px; }
}

/* ── Player sheet (full now-playing) ─────────────────── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.player-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  background: var(--surface);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border: 1px solid var(--border);
  border-bottom: none;
  max-height: 92dvh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  padding-bottom: calc(1.5rem + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}
.player-sheet.open { transform: translateY(0); }
@media (min-width: 720px) {
  .player-sheet {
    left: 50%;
    right: auto;
    bottom: calc(var(--mini-h) + var(--safe-bottom) + 0.75rem);
    width: min(440px, calc(100vw - 2rem));
    transform: translate(-50%, calc(100% + 1rem));
    border-radius: 14px;
    border: 1px solid var(--border);
    max-height: min(80dvh, 720px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
  }
  .player-sheet.open { transform: translate(-50%, 0); }

  /* Desktop: sheet is a popover, not a modal — keep the bar fully
     visible and clickable above the (transparent) backdrop. */
  .dock { z-index: 115; }
  .sheet-backdrop { background: transparent; }
}

.sheet-grabber {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0.6rem auto 0.25rem;
  flex-shrink: 0;
}
.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem 0.25rem;
}
.sheet-header .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.sheet-close {
  width: var(--tap);
  height: var(--tap);
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  border-radius: 50%;
}
.sheet-close:hover { color: var(--text); background: var(--surface-2); }

.sheet-body {
  padding: 0.5rem 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.sheet-art {
  width: 220px;
  height: 220px;
  max-width: 80vw;
  max-height: 40vh;
  margin: 0.5rem auto 0;
  border-radius: 14px;
  object-fit: cover;
  background: var(--bg);
  border: 1px solid var(--border);
  display: block;
}
.sheet-art-placeholder {
  width: 220px;
  height: 220px;
  max-width: 80vw;
  max-height: 40vh;
  margin: 0.5rem auto 0;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--surface-2), var(--bg));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  color: var(--muted);
}
.sheet-title {
  font-size: 1.15rem;
  font-weight: 600;
  text-align: center;
  overflow-wrap: anywhere;
}
.sheet-artist {
  font-size: 0.95rem;
  color: var(--muted);
  text-align: center;
}
.sheet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  align-items: center;
  font-size: 0.82rem;
  color: var(--muted);
}
.sheet-meta a { color: var(--text); }
.sheet-progress {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.sheet-progress .bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}
.sheet-progress .fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 1s linear;
}
.sheet-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
}
.sheet-controls .play-big {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s, color 0.15s;
}
.sheet-controls .play-big:hover,
.sheet-controls .play-big.playing { border-color: var(--accent); color: var(--accent); }
.sheet-volume {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.sheet-volume .ico { color: var(--muted); font-size: 1rem; width: 1.5rem; text-align: center; }
.sheet-volume input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.sheet-volume input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
}
.sheet-volume input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 0;
}
.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.sheet-station {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
}
.sheet-station a { color: var(--accent); }
.sheet-override-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  padding: 0.6rem 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  outline: none;
  -webkit-appearance: none;
}
.sheet-override-input:focus { border-color: var(--accent); }

/* ── Autocomplete popup (slug suggestions) ───────────── */
.ac-list {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 200;
  max-height: 12rem;
  overflow-y: auto;
  box-shadow: 0 10px 24px rgba(0,0,0,0.5);
}
.ac-item {
  padding: 0.6rem 0.8rem;
  font-size: 0.85rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
  color: var(--text);
  min-height: var(--tap);
  display: flex;
  align-items: center;
}
.ac-item + .ac-item { border-top: 1px solid var(--border); }
.ac-item:hover, .ac-item:active { background: var(--surface-2); }

/* ── Footer ──────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1.25rem 1rem;
  color: var(--muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ── Visualizer page ─────────────────────────────────── */
.viz-wrap {
  position: relative;
  width: 100%;
  height: clamp(280px, calc(100dvh - var(--dock-h) - 9rem), 1200px);
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
#viz-canvas { display: block; width: 100%; height: 100%; }
.viz-fs-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(22, 27, 34, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 1.1rem;
  width: var(--tap);
  height: var(--tap);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.viz-fs-btn:hover { color: var(--text); border-color: var(--accent); }
.viz-controls {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  background: linear-gradient(to top, rgba(13,17,23,0.75) 0%, transparent 100%);
}
.viz-ctrl-btn {
  flex-shrink: 0;
  background: rgba(22, 27, 34, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  width: var(--tap);
  height: var(--tap);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.viz-ctrl-btn:hover { color: var(--text); border-color: var(--accent); }
.viz-preset-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:fullscreen .viz-wrap,
:-webkit-full-screen .viz-wrap { border-radius: 0; border: none; height: 100vh; }

/* ── Misc ────────────────────────────────────────────── */
.muted-note {
  color: var(--muted);
  font-size: 0.875rem;
}
.hide-narrow { display: none; }
@media (min-width: 480px) { .hide-narrow { display: inline; } }
[hidden] { display: none !important; }

/* ── External link icon next to set title ────────────── */
.set-ext-link {
  color: var(--muted);
  font-size: 0.8em;
  margin-left: 0.3em;
  text-decoration: none;
  opacity: 0.6;
}
.set-ext-link:hover { opacity: 1; color: var(--accent); }

/* ── Set detail page ─────────────────────────────────── */
.set-detail { display: block; }
.set-detail-art-wrap {
  float: right;
  margin: 0 0 1rem 1.5rem;
  max-height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  line-height: 0; /* collapse whitespace gap */
}
.set-detail-art {
  display: block;
  max-height: 300px;
  max-width: min(300px, 55vw);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius);
}
.set-detail-body {
  display: block;
  overflow: hidden; /* BFC: contains the float */
  min-width: 0;
}
/* lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 900;
  cursor: zoom-out;
  align-items: center;
  justify-content: center;
}
.lightbox.open {
  display: flex;
}
.lightbox-img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
  cursor: default;
}
.set-detail-title {
  font-size: 1.25rem;
  line-height: 1.3;
  margin-bottom: 1rem;
}
.set-detail-section {
  border-top: 1px solid var(--border);
  padding: 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.set-detail-row {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.9rem;
}
.set-detail-label {
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 5rem;
  flex-shrink: 0;
}
.set-detail-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.set-detail-stream {
  font-weight: 500;
}
.set-detail-actions {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  clear: right;
}
.set-detail-slug { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.set-detail-plays-header {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}
.set-detail-plays {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.set-detail-plays li {
  font-size: 0.85rem;
  color: var(--muted);
}

/* ── Set editor form ─────────────────────────────────── */
.edit-set-form {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-row label {
  font-size: 0.875rem;
  color: var(--text);
  font-weight: 500;
}
.form-hint {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}
.edit-set-form input[type="text"],
.edit-set-form input[type="url"],
.edit-set-form input[type="date"],
.edit-set-form textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
  box-sizing: border-box;
}
.edit-set-form input:focus,
.edit-set-form textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.edit-set-form textarea {
  resize: vertical;
  min-height: 72px;
}
/* rendered markdown notes in set detail view */
.set-notes {
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text);
}
.set-notes p { margin: 0 0 0.6em; }
.set-notes p:last-child { margin-bottom: 0; }
.set-notes a { color: var(--accent); }
.set-notes strong { color: var(--text); }
.set-notes em { font-style: italic; }
.set-notes ul, .set-notes ol {
  margin: 0.4em 0 0.6em 1.4em;
  display: flex;
  flex-direction: column;
  gap: 0.15em;
}
.set-notes code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}
.set-notes pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.5em 0;
}
.set-notes pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.55;
}
.set-notes blockquote {
  border-left: 3px solid var(--border);
  margin: 0.4em 0;
  padding: 0 0.85em;
  color: var(--muted);
}
.form-row-inline {
  flex-direction: row;
  gap: 1rem;
}
.form-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-row-check label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.form-row-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
}
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding-top: 0.25rem;
}
.btn-primary {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #0d1117;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
}
.btn-primary:hover { opacity: 0.88; }
.btn-secondary {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.error-banner {
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  color: var(--red);
  font-size: 0.875rem;
  max-width: 640px;
  padding: 0.6rem 0.9rem;
}
.edit-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  text-decoration: none;
}
.edit-btn:hover { border-color: var(--accent); color: var(--accent); }
.track-create-btn {
  text-decoration: none;
  white-space: nowrap;
}
.track-create-btn:hover { border-color: var(--green); color: var(--green); }
.radio-source-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.5rem 0.75rem;
}
/* art upload section (outside the main form, so uses .form-row directly) */
.art-upload-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.art-upload {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.art-upload-thumb {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}
.art-upload-thumb img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}
.art-upload-thumb.has-art img { display: block; }
.art-upload-thumb.has-art .art-upload-ph { display: none; }
.art-upload-ph {
  font-size: 0.75rem;
  color: var(--muted);
}
.art-upload-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.art-file-label {
  display: inline-block;
  cursor: pointer;
}
.art-upload-status {
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.2em;
}
