/* ============================================================
   JooseBox — Spotify-clone stylesheet
   ============================================================ */

/* Variables */
:root {
  --bg: #121212;
  --surface: #181818;
  --surface2: #282828;
  --surface3: #3e3e3e;
  --border: #282828;
  --accent: #1db954;
  --accent-hover: #1ed760;
  --discord: #5865f2;
  --text: #ffffff;
  --text-muted: #b3b3b3;
  --text-dim: #6a6a6a;
  --radius: 8px;
  --radius-sm: 4px;
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --npbar-height: 90px;
}

/* YouTube Music theme overrides — active when body.yt-mode */
body.yt-mode {
  --accent: #ff0033;
  --accent-hover: #ff3355;
}
body.yt-mode .source-pill.active {
  background: #ff0033;
  color: #fff;
}
body.yt-mode .logo-icon { color: var(--accent); }

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Circular', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; color: inherit; font: inherit; }
img { display: block; }
select { background: var(--surface2); color: var(--text); border: none; border-radius: var(--radius-sm); padding: 6px 10px; font: inherit; cursor: pointer; outline: none; }
input[type="text"], input[type="search"] {
  background: var(--surface2);
  color: var(--text);
  border: none;
  border-radius: 500px;
  padding: 8px 16px;
  font: inherit;
  outline: none;
}
input[type="text"]::placeholder { color: var(--text-dim); }
ol, ul { list-style: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ============================================================
   APP SHELL — CSS Grid layout
   ============================================================ */
.app { height: 100%; overflow: hidden; }

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr var(--npbar-height);
  grid-template-areas:
    "sidebar topbar"
    "sidebar main"
    "npbar   npbar";
  height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  grid-area: sidebar;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 8px 0;
}

.sidebar-top {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  padding: 12px 8px 16px;
}
.logo-icon { color: var(--accent); flex-shrink: 0; }

/* Nav */
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  transition: color .15s, background .15s;
}
.nav-item svg { flex-shrink: 0; }
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--text); }

/* Sidebar sections */
.sidebar-section { padding: 0 8px 12px; }
.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-dim);
  text-transform: uppercase;
  padding: 8px 0 6px;
}

.guild-select { width: 100%; font-size: 13px; }

/* Sidebar playlists */
.sidebar-playlists { display: flex; flex-direction: column; gap: 2px; }
.sidebar-playlist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.sidebar-playlist-item:hover { color: var(--text); }
.sidebar-empty { color: var(--text-dim); font-size: 12px; padding: 4px 0; }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.user-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer-actions { display: flex; align-items: center; gap: 8px; }

.spotify-connect-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 500px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text-muted);
  transition: background .15s, color .15s;
  flex: 1;
}
.spotify-connect-btn:hover { background: var(--surface3); color: var(--text); }
.spotify-connect-btn.connected { background: #1d3a27; color: var(--accent); }
.spotify-connect-btn.connected svg { color: var(--accent); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  grid-area: topbar;
  background: linear-gradient(to bottom, rgba(0,0,0,.6), transparent);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left { display: flex; gap: 8px; }

/* Source switcher */
.source-switcher {
  display: flex;
  background: rgba(0,0,0,.3);
  border-radius: 500px;
  padding: 3px;
  gap: 2px;
}

.source-pill {
  padding: 5px 16px;
  border-radius: 500px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.source-pill:hover { color: var(--text); }
.source-pill.active {
  background: var(--surface3);
  color: var(--text);
}

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* Search bar in topbar */
.search-bar-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border-radius: 500px;
  padding: 8px 16px;
  width: 360px;
  transition: background .15s;
}
.search-bar-wrapper:focus-within { background: var(--surface3); outline: 1px solid var(--text-muted); }
.search-bar-icon { color: var(--text-muted); flex-shrink: 0; }
.search-bar-input {
  flex: 1;
  background: none;
  border-radius: 0;
  padding: 0;
  font-size: 14px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}

/* View containers */
.view { padding: 0 0 32px; }

.view-hero {
  padding: 32px 24px 24px;
  background: linear-gradient(to bottom, #1e4d2b, var(--bg));
  margin-bottom: 8px;
}
.view-hero.yt { background: linear-gradient(to bottom, #4d1e1e, var(--bg)); }

/* Mood chips row */
.mood-chips {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scrollbar-width: none;
}
.mood-chips::-webkit-scrollbar { display: none; }
.mood-chip {
  flex-shrink: 0;
  padding: 8px 20px;
  border-radius: 500px;
  border: 1.5px solid var(--surface3);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.mood-chip:hover {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--text-muted);
}
.mood-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.view-hero h1 { font-size: 28px; font-weight: 700; margin-bottom: 4px; }
.view-hero p { color: var(--text-muted); font-size: 14px; }

.view-section { padding: 16px 24px 0; }
.section-heading {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-heading a { font-size: 13px; color: var(--text-muted); font-weight: 400; }
.section-heading a:hover { color: var(--text); text-decoration: underline; }

/* Card carousel */
.card-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 8px;
}
.card-row::-webkit-scrollbar { display: none; }

/* Card */
.card {
  flex: 0 0 180px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background .15s, transform .15s;
  position: relative;
}
.card:hover {
  background: var(--surface2);
  transform: translateY(-2px);
}
.card-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  object-fit: cover;
  margin-bottom: 12px;
  background: var(--surface3);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.card-art.rounded { border-radius: 50%; }
.card-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.card-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Play overlay button on cards */
.card-play {
  position: absolute;
  bottom: 58px;
  right: 16px;
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  color: #000;
}
.card:hover .card-play { opacity: 1; transform: translateY(0); }
.card-play:hover { background: var(--accent-hover); transform: scale(1.05) !important; }

/* ============================================================
   TRACK LIST
   ============================================================ */
.track-list { display: flex; flex-direction: column; }

.track-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  border-radius: var(--radius-sm);
  cursor: default;
  transition: background .1s;
}
.track-row:hover { background: var(--surface2); }
.track-row:hover .track-num { display: none; }
.track-row:hover .track-play-btn { display: flex; }

.track-num {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  user-select: none;
}
.track-play-btn {
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.track-play-btn:hover { color: var(--accent); }

.track-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.track-art { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface3); flex-shrink: 0; }
.track-details { min-width: 0; }
.track-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.track-duration { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.track-list-header {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  padding: 8px 24px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ============================================================
   ARTIST PAGE
   ============================================================ */
.artist-hero {
  padding: 80px 24px 32px;
  background: linear-gradient(to bottom, var(--surface3), var(--bg));
  display: flex;
  align-items: flex-end;
  gap: 24px;
}
.artist-hero-art { width: 200px; height: 200px; border-radius: 50%; object-fit: cover; box-shadow: 0 16px 56px rgba(0,0,0,.8); flex-shrink: 0; background: var(--surface3); }
.artist-hero-info {}
.artist-hero-type { font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .08em; margin-bottom: 8px; }
.artist-hero-name { font-size: 48px; font-weight: 900; line-height: 1; margin-bottom: 12px; }
.artist-hero-followers { color: var(--text-muted); font-size: 13px; }

/* ============================================================
   ALBUM / PLAYLIST HERO
   ============================================================ */
.collection-hero {
  padding: 32px 24px 24px;
  background: linear-gradient(to bottom, var(--surface3), var(--bg));
  display: flex;
  gap: 24px;
  align-items: flex-end;
}
.collection-hero-art {
  width: 220px;
  height: 220px;
  border-radius: var(--radius);
  object-fit: cover;
  box-shadow: 0 16px 56px rgba(0,0,0,.8);
  flex-shrink: 0;
  background: var(--surface3);
}
.collection-hero-info {}
.collection-hero-type { font-size: 11px; text-transform: uppercase; font-weight: 700; letter-spacing: .08em; margin-bottom: 8px; }
.collection-hero-title { font-size: 36px; font-weight: 900; line-height: 1.1; margin-bottom: 8px; }
.collection-hero-sub { color: var(--text-muted); font-size: 13px; }

.collection-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 24px 16px;
}
.btn-play-big {
  width: 56px;
  height: 56px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  transition: background .15s, transform .1s;
}
.btn-play-big:hover { background: var(--accent-hover); transform: scale(1.05); }

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-page { min-height: calc(100vh - 160px); }

.search-hero {
  text-align: center;
  padding: 80px 24px 40px;
}
.search-hero h1 {
  font-size: 44px;
  font-weight: 700;
  margin-bottom: 20px;
}

.search-sources {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.search-source-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border-radius: 500px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.search-source-badge.coming-soon { opacity: 0.4; }
.badge-soon {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
  margin-left: 2px;
}

.search-results-header {
  padding: 24px 24px 0;
}

.search-main-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border-radius: 500px;
  padding: 14px 24px;
  max-width: 580px;
  margin: 0 auto;
  border: 2px solid transparent;
  transition: border-color .15s, background .15s;
}
.search-main-bar-wrap:focus-within {
  background: var(--surface3);
  border-color: rgba(255,255,255,.15);
}
.search-main-input {
  flex: 1;
  background: none;
  border: none;
  font-size: 16px;
  color: var(--text);
  outline: none;
}
.search-main-input::placeholder { color: var(--text-dim); }

/* Legacy small hint (fallback) */
.search-hint { text-align: center; padding: 80px 24px; color: var(--text-muted); }
.search-hint svg { opacity: .3; margin: 0 auto 16px; }
.search-hint h2 { font-size: 20px; color: var(--text); margin-bottom: 8px; }

/* ============================================================
   LIBRARY PAGE
   ============================================================ */
.library-tabs {
  display: flex;
  gap: 8px;
  padding: 24px 24px 16px;
}
.lib-tab {
  padding: 6px 16px;
  border-radius: 500px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface2);
  color: var(--text-muted);
  transition: background .15s, color .15s;
}
.lib-tab:hover { color: var(--text); }
.lib-tab.active { background: var(--text); color: var(--bg); }

/* ============================================================
   NOW-PLAYING BAR
   ============================================================ */
.now-playing-bar {
  grid-area: npbar;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  z-index: 20;
}

/* NP track info (left) */
.np-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.np-artwork-wrap { flex-shrink: 0; }
.np-artwork {
  width: 56px;
  height: 56px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface3);
}
.np-track-info { min-width: 0; }
.np-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* Center controls */
.np-controls { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; max-width: 560px; width: 100%; }

.np-buttons { display: flex; align-items: center; gap: 16px; }

.ctrl-btn {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, transform .1s;
  padding: 4px;
  border-radius: 50%;
}
.ctrl-btn:hover { color: var(--text); transform: scale(1.05); }
.ctrl-btn.active { color: var(--accent); }

.ctrl-play {
  width: 40px;
  height: 40px;
  background: var(--text);
  color: var(--bg);
  border-radius: 50%;
  transition: background .15s, transform .1s;
}
.ctrl-play:hover { background: #fff; transform: scale(1.06) !important; color: var(--bg); }

/* Progress */
.np-progress-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.np-time { font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 32px; text-align: center; user-select: none; }

.np-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  transition: height .15s;
}
.np-progress-bar:hover { height: 6px; }
.np-progress-fill {
  height: 100%;
  background: var(--text-muted);
  border-radius: inherit;
  transition: background .15s;
  pointer-events: none;
}
.np-progress-bar:hover .np-progress-fill { background: var(--accent); }
.np-progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 12px;
  height: 12px;
  background: var(--text);
  border-radius: 50%;
  pointer-events: none;
  transition: transform .15s;
}
.np-progress-bar:hover .np-progress-thumb { transform: translate(-50%, -50%) scale(1); }

/* Right side */
.np-right {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.vol-icon { color: var(--text-muted); flex-shrink: 0; }
.vol-slider {
  -webkit-appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface3);
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}
.vol-slider:hover:not(:disabled) { accent-color: var(--accent); }
.vol-slider:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.vol-slider:disabled::-webkit-slider-thumb {
  cursor: not-allowed;
  background: var(--text-muted);
}
.vol-label { font-size: 11px; color: var(--text-muted); min-width: 24px; text-align: right; }

/* ============================================================
   QUEUE PANEL
   ============================================================ */
.queue-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: calc(100vh - var(--npbar-height));
  background: var(--surface);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform .3s ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.queue-panel.open { transform: translateX(0); }

.queue-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.queue-panel-header h2 { font-size: 16px; font-weight: 700; }

.queue-now-playing { padding: 16px 20px 8px; }
.queue-up-next { flex: 1; overflow-y: auto; padding: 8px 0 0; }

.queue-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.queue-track {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  cursor: default;
  transition: background .1s;
}
.queue-track:hover { background: var(--surface2); }
.queue-track--current { background: rgba(255,255,255,.04); margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.queue-track-art { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; background: var(--surface3); flex-shrink: 0; }
.queue-track-info { min-width: 0; flex: 1; }
.queue-track-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-track-artist { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-track-requester { font-size: 10px; color: var(--text-dim, var(--text-muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; font-style: italic; }

.queue-autoplay-row {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.queue-track--autoplay {
  opacity: 0.95;
}
.queue-track-num { font-size: 12px; color: var(--text-dim); min-width: 20px; text-align: right; }

/* ============================================================
   ICON BUTTON
   ============================================================ */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: 50%;
  padding: 6px;
  transition: color .15s, background .15s;
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.08); }

/* ============================================================
   LOADING / EMPTY STATES
   ============================================================ */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--surface3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state h3 { font-size: 20px; color: var(--text); margin-bottom: 8px; }

/* Error toast */
.toast {
  position: fixed;
  bottom: calc(var(--npbar-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  z-index: 100;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; }

/* --- Casino --- */
.casino-balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-right: 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2d1f3d 0%, #1a1424 100%);
  border: 1px solid rgba(255, 200, 100, 0.25);
  font-size: 13px;
  font-weight: 600;
  color: #ffd88a;
}
.casino-balance-pill .jb-icon {
  font-size: 10px;
  opacity: 0.85;
  letter-spacing: 0.05em;
}
.casino-view .view-hero p {
  max-width: 640px;
  line-height: 1.5;
  color: var(--text-muted);
}
.casino-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}
.casino-subnav-a {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  border: 1px solid var(--border);
}
.casino-subnav-a:hover {
  background: var(--bg-hover);
}
.casino-panel {
  max-width: 720px;
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}
.casino-input {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  width: 100%;
  max-width: 280px;
}
.casino-out {
  margin-top: 16px;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.casino-lb {
  list-style: none;
  padding: 0;
  margin: 0;
}
.casino-lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.casino-lb-rank {
  width: 28px;
  font-weight: 700;
  color: var(--text-muted);
}
.casino-lb-av, .casino-lb-av-ph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}
.casino-lb-av-ph {
  background: var(--bg);
}
.casino-lb-name {
  flex: 1;
  min-width: 0;
}
.casino-lb-bal {
  font-weight: 600;
  color: #ffd88a;
}
.casino-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.casino-shop-item {
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.casino-shop-name { font-weight: 700; margin-bottom: 6px; }
.casino-shop-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.casino-shop-price { color: #ffd88a; margin-bottom: 8px; }
.casino-luck-badge { margin-bottom: 8px; }
.mines-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-width: 280px;
  margin: 16px 0;
}
.mines-cell {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}
.mines-cell:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ============================================================
   HOMEPAGE LOGIN SCREEN (index.html reuse via #login-screen)
   ============================================================ */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 24px;
  text-align: center;
  padding: 24px;
}
.login-logo { display: flex; align-items: center; gap: 12px; font-size: 32px; font-weight: 900; }
.login-logo svg { color: var(--accent); }
.login-tagline { color: var(--text-muted); max-width: 360px; }
.btn-discord {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--discord);
  color: #fff;
  padding: 14px 28px;
  border-radius: 500px;
  font-size: 16px;
  font-weight: 700;
  transition: filter .15s;
  text-decoration: none;
}
.btn-discord:hover { filter: brightness(1.1); }

/* index.html error state */
.error-msg { color: #f04747; font-size: 13px; }

/* ============================================================
   LANDING PAGE (index.html)
   ============================================================ */
body.landing {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  overflow: auto;
}

.landing-card {
  text-align: center;
  padding: 48px 40px;
  background: var(--surface);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  box-shadow: 0 16px 56px rgba(0,0,0,.6);
}

.landing-logo { font-size: 48px; line-height: 1; }

.landing-card h1 { font-size: 32px; font-weight: 900; }

.landing-sub { color: var(--text-muted); font-size: 15px; }

.btn.btn-discord, .btn-discord {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--discord);
  color: #fff;
  padding: 14px 28px;
  border-radius: 500px;
  font-size: 15px;
  font-weight: 700;
  transition: filter .15s;
  text-decoration: none;
  border: none;
  cursor: pointer;
}
.btn.btn-discord:hover, .btn-discord:hover { filter: brightness(1.1); }

.error-banner {
  background: rgba(240,71,71,.15);
  border: 1px solid rgba(240,71,71,.4);
  color: #f44;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  width: 100%;
  text-align: center;
}

/* Genre cards (no artwork, colour block) */
.genre-card {
  min-height: 120px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  position: relative;
}
.genre-card-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
  padding: 0 4px 4px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
  word-break: break-word;
}

/* ============================================================
   DISABLED SOURCE PILLS (locked tabs)
   ============================================================ */
.source-pill[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   SEARCH SUGGESTIONS DROPDOWN
   ============================================================ */
.search-bar-wrapper { position: relative; }

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 380px;
  background: #282828;
  border-radius: 8px;
  box-shadow: rgba(0,0,0,0.6) 0 8px 24px;
  z-index: 200;
  overflow: hidden;
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: none;
}
.search-suggestions::-webkit-scrollbar { display: none; }

.search-suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .1s;
}
.search-suggestion:hover { background: #3e3e3e; }

.search-suggestion-art {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: #3e3e3e;
}

.search-suggestion-info {
  flex: 1;
  min-width: 0;
}
.search-suggestion-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-suggestion-artist {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.search-suggestion-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  position: relative;
}
.search-suggestion-duration { font-size: 12px; color: var(--text-dim); }
.search-suggestion-save {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
}
.search-suggestion-save:hover { color: var(--accent); background: rgba(255,255,255,.08); }

/* Save-to-playlist submenu */
.save-to-playlist-menu {
  position: absolute;
  right: 0;
  top: 28px;
  background: #282828;
  border-radius: 8px;
  box-shadow: rgba(0,0,0,0.6) 0 4px 16px;
  z-index: 210;
  min-width: 200px;
  overflow: hidden;
  border: 1px solid #3e3e3e;
}
.save-to-playlist-item {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.save-to-playlist-item:hover { background: #3e3e3e; }
.save-to-playlist-item.new-playlist { color: var(--accent); font-weight: 600; }

/* ============================================================
   START SESSION PANEL
   ============================================================ */
.start-session {
  text-align: center;
  padding: 80px 24px 60px;
  max-width: 520px;
  margin: 0 auto;
}
.start-session h2 { font-size: 32px; font-weight: 700; margin-bottom: 10px; }
.start-session p { color: var(--text-muted); margin-bottom: 36px; font-size: 15px; }

.channel-select-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.channel-select {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--surface3);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  min-width: 200px;
  cursor: pointer;
}
.channel-select:focus { outline: none; border-color: var(--accent); }

.btn-join {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 500px;
  padding: 14px 44px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background .15s, transform .1s;
}
.btn-join:hover { background: var(--accent-hover); transform: scale(1.03); }
.btn-join:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Now-playing home card */
.np-home-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border-radius: 10px;
  padding: 20px;
  max-width: 540px;
}

/* Create playlist button in library */
.btn-create-playlist {
  background: transparent;
  border: 1.5px solid var(--surface3);
  color: var(--text-muted);
  border-radius: 500px;
  padding: 7px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.btn-create-playlist:hover { border-color: var(--text-muted); color: var(--text); }

/* ============================================================
   PLAYLIST GRID (library)
   ============================================================ */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 16px;
  padding: 8px 0;
}
.playlist-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.playlist-card:hover { background: var(--surface2); }
.playlist-card.create-card {
  border: 2px dashed var(--surface3);
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 190px;
  color: var(--text-muted);
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}
.playlist-card.create-card:hover { border-color: var(--text-muted); color: var(--text); background: var(--surface); }

.playlist-card-art {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface2);
  border-radius: 4px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  overflow: hidden;
}
.playlist-card-art img { width: 100%; height: 100%; object-fit: cover; }

.playlist-card-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.playlist-card-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,.55);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.playlist-card:hover .playlist-card-menu { display: flex; }
.playlist-card-menu:hover { background: rgba(0,0,0,.8); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: #282828;
  border-radius: 12px;
  padding: 28px;
  min-width: 340px;
  max-width: 480px;
  width: 90%;
  box-shadow: rgba(0,0,0,0.6) 0 8px 32px;
}
.modal h3 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.modal-input {
  width: 100%;
  background: var(--surface3);
  color: var(--text);
  border: none;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 14px;
  box-sizing: border-box;
  margin-bottom: 12px;
}
.modal-input:focus { outline: 2px solid var(--accent); }
.modal-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 14px;
  cursor: pointer;
}
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.btn-modal-cancel {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 500px;
  padding: 10px 24px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
.btn-modal-cancel:hover { color: var(--text); }
.btn-modal-confirm {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 500px;
  padding: 10px 24px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
}
.btn-modal-confirm:hover { background: var(--accent-hover); }

/* ============================================================
   PLAYLIST DETAIL PAGE
   ============================================================ */
.playlist-header {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  padding: 40px 24px 24px;
  background: linear-gradient(to bottom, #1a3a1a, transparent);
  margin-bottom: 8px;
}
.playlist-hero-art {
  width: 180px;
  height: 180px;
  border-radius: 6px;
  background: var(--surface2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}
.playlist-hero-art svg { width: 56px; height: 56px; }
.playlist-hero-info { flex: 1; min-width: 0; }
.playlist-hero-type {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.playlist-hero-name {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 10px;
  word-break: break-word;
}
.playlist-hero-meta { font-size: 14px; color: var(--text-muted); }

.playlist-actions {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Track remove button hover */
.track-row:hover .track-remove-btn { opacity: 1 !important; }
.track-remove-btn { opacity: 0; transition: opacity .15s, color .15s; }
.track-remove-btn:hover { color: var(--text) !important; }
