:root {
  --bg:       #0f0f0f;
  --bg2:      #161616;
  --bg3:      #1e1e1e;
  --bg4:      #2a2a2a;
  --text:     #f1f1f1;
  --text2:    #aaa;
  --text3:    #666;
  --accent:   #ff0050;
  --player-h: 72px;
  --sidebar-w: 230px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto', 'Inter', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  overflow: hidden;
}

a { text-decoration: none; color: inherit; cursor: pointer; }
button { background: none; border: none; color: inherit; cursor: pointer; font-family: inherit; }

.load-more-wrap { text-align: center; padding: 24px 0; }
.load-more-btn {
  padding: 10px 32px;
  border: 1px solid var(--bg4);
  border-radius: 20px;
  color: var(--text2);
  font-size: .85rem;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.load-more-btn:hover { background: var(--bg3); color: var(--text); }
.load-more-btn:disabled { opacity: .45; cursor: default; }

/* Layout */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: calc(100vh - var(--player-h));
}

/* Sidebar */
#sidebar {
  background: #000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
}
#sidebar::-webkit-scrollbar { display: none; }

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px 16px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 20px;
  font-size: .9rem;
  color: var(--text2);
  transition: color .15s, background .15s;
  position: relative;
}
.nav-item svg { flex-shrink: 0; width: 22px; height: 22px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active { color: #fff; font-weight: 500; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.sidebar-divider { height: 1px; background: #1e1e1e; margin: 8px 0; }

.sidebar-label {
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 10px 20px 4px;
}

.sidebar-pl-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  font-size: .84rem;
  color: var(--text2);
  cursor: pointer;
  transition: color .15s;
  overflow: hidden;
}
.sidebar-pl-item:hover { color: #fff; }
.sidebar-pl-item svg { flex-shrink: 0; opacity: .6; }
.sidebar-pl-item .pl-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.sidebar-pl-item .pl-count { font-size: .75rem; color: var(--text3); flex-shrink: 0; }

.scan-wrap { padding: 12px 16px 16px; margin-top: auto; }
.scan-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text2);
  border: 1px solid #333;
  transition: border-color .15s, color .15s;
}
.scan-btn:hover { border-color: #555; color: #fff; }
.scan-bar {
  margin-top: 8px; height: 2px;
  background: #222; border-radius: 1px; overflow: hidden;
}
.scan-fill {
  height: 100%; background: var(--accent);
  border-radius: 1px; transition: width .4s;
}

/* Main */
#main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px 10px;
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 24px;
  padding: 9px 18px;
  flex: 1;
  max-width: 500px;
  transition: border-color .2s, background .2s;
}
.search-wrap:focus-within { border-color: #666; background: var(--bg3); }
.search-wrap svg { color: var(--text3); flex-shrink: 0; }
.search-wrap input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 1rem; font-family: inherit; width: 100%;
  -webkit-appearance: none;
}
.search-wrap input::placeholder { color: var(--text3); }

#stats-bar {
  font-size: .75rem; color: var(--text3);
  white-space: nowrap; margin-left: auto;
}

#search-results {
  position: absolute;
  top: 58px; left: 32px;
  width: 500px; max-height: 70vh;
  overflow-y: auto;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 6px 0;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  scrollbar-width: thin;
}
.search-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; cursor: pointer; transition: background .15s;
}
.search-item:hover { background: rgba(255,255,255,.06); }
.search-item-cover {
  width: 42px; height: 42px;
  border-radius: 4px; overflow: hidden; background: var(--bg3); flex-shrink: 0;
}
.search-item-cover img { width: 100%; height: 100%; object-fit: cover; }
.search-item-title { font-size: .875rem; font-weight: 500; }
.search-item-sub { font-size: .77rem; color: var(--text2); }
.search-item-dur { margin-left: auto; font-size: .77rem; color: var(--text3); }
.search-section-hdr { padding: 8px 16px 4px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text3); }

#page-content {
  flex: 1;
  overflow-y: auto;
  padding: 0 32px 100px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}
#page-content::-webkit-scrollbar { width: 6px; }
#page-content::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* Section headers */
.section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin: 32px 0 14px;
}
.section-hdr:first-child { margin-top: 12px; }
.section-hdr h2 { font-size: 1.1rem; font-weight: 700; letter-spacing: -.2px; }
.see-all {
  font-size: .8rem; color: var(--text3);
  padding: 4px 8px; border-radius: 4px; cursor: pointer;
  transition: color .15s;
}
.see-all:hover { color: #fff; }

/* Home greeting */
.home-greeting {
  font-size: 1.65rem; font-weight: 700;
  padding: 22px 0 8px; letter-spacing: -.5px;
}

/* Quick picks */
.quick-picks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (max-width: 900px) { .quick-picks { grid-template-columns: 1fr; } }

.qp-item {
  display: flex; align-items: center;
  background: var(--bg3);
  border-radius: 6px;
  cursor: pointer; overflow: hidden;
  transition: background .15s;
  position: relative;
}
.qp-item:hover { background: var(--bg4); }
.qp-item.playing { background: rgba(255,0,80,.12); }
.qp-item.playing .qp-title { color: var(--accent); }

.qp-cover {
  width: 56px; height: 56px;
  object-fit: cover; flex-shrink: 0; display: block;
}
.qp-cover-ph {
  width: 56px; height: 56px;
  background: #333; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; color: var(--text3);
}
.qp-info { min-width: 0; flex: 1; padding: 0 14px; }
.qp-title {
  font-size: .875rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qp-artist {
  font-size: .77rem; color: var(--text2);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qp-play-icon {
  position: absolute; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.qp-item:hover .qp-play-icon { opacity: 1; }

/* Horizontal carousel */
.carousel {
  display: flex; gap: 14px;
  overflow-x: auto;
  padding: 2px 0 12px;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }

/* Cards */
.card {
  flex-shrink: 0;
  width: 172px;
  background: var(--bg2);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: background .2s;
  position: relative;
}
.card:hover { background: var(--bg3); }

/* Grid cards (Library view) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}
.card-grid .card { width: auto; }

.card-img {
  width: 100%; aspect-ratio: 1;
  background: #1a1a1a;
  position: relative; overflow: hidden;
}
.card-img img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  transition: transform .3s;
}
.card:hover .card-img img { transform: scale(1.04); }
.card-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: var(--text3);
  background: linear-gradient(135deg, #1e1e1e 0%, #2a2a2a 100%);
}
.card-play {
  position: absolute; bottom: 8px; right: 8px;
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(6px);
  transition: opacity .2s, transform .2s;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.card:hover .card-play { opacity: 1; transform: none; }
.card-play svg { margin-left: 2px; }
.card-body { padding: 10px 12px 14px; }
.card-name {
  font-size: .875rem; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px;
}
.card-sub {
  font-size: .77rem; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card.card-artist .card-img { border-radius: 50%; margin: 16px auto 0; width: calc(100% - 32px); }
.card.card-artist .card-body { text-align: center; }

/* Track list */
.track-list { display: flex; flex-direction: column; }

.track-row {
  display: grid;
  grid-template-columns: 36px 44px 1fr auto 62px 32px;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.track-row:hover { background: rgba(255,255,255,.06); }
.track-row.playing { background: rgba(255,0,80,.08); }
.track-row.playing .track-title { color: var(--accent); }
.track-row.playing .track-num { color: var(--accent); }

.track-num { text-align: center; font-size: .8rem; color: var(--text3); font-variant-numeric: tabular-nums; }
.track-cover { width: 40px; height: 40px; border-radius: 4px; overflow: hidden; background: var(--bg3); flex-shrink: 0; }
.track-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.track-meta { min-width: 0; }
.track-title { font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-by { font-size: .77rem; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-album { font-size: .77rem; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1000px) { .track-album { display: none; } }
.track-dur { font-size: .8rem; color: var(--text3); text-align: right; font-variant-numeric: tabular-nums; }
.track-like {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; opacity: 0; transition: opacity .15s, color .15s; color: var(--text3);
}
.track-row:hover .track-like { opacity: 1; }
.track-like.liked { opacity: 1 !important; color: var(--accent); }
.track-like.liked svg { fill: var(--accent); }

/* Playlist / Album hero */
.pl-hero {
  display: flex; align-items: flex-end; gap: 28px;
  padding: 28px 0 28px;
  margin: 0 0 8px;
}
.pl-hero-cover {
  width: 180px; height: 180px;
  border-radius: 8px; overflow: hidden; background: var(--bg3);
  flex-shrink: 0;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}
.pl-hero-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-hero-type { font-size: .75rem; color: var(--text2); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.pl-hero-title { font-size: 2rem; font-weight: 700; letter-spacing: -.4px; margin-bottom: 8px; line-height: 1.1; }
.pl-hero-meta { font-size: .85rem; color: var(--text2); margin-bottom: 20px; }
.pl-play-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 24px;
  background: var(--accent); color: #fff;
  font-size: .9rem; font-weight: 600;
  transition: opacity .2s, transform .1s;
}
.pl-play-btn:hover { opacity: .9; transform: scale(1.02); }
.artist-play-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px; padding: 7px 18px; border-radius: 20px;
  background: var(--accent); color: #fff;
  font-size: .8rem; font-weight: 600;
  transition: opacity .2s, transform .1s;
}
.artist-play-btn:hover { opacity: .9; transform: scale(1.02); }
.dup-toggle {
  padding: 5px 14px; border-radius: 14px; font-size: .78rem; font-weight: 600;
  background: var(--bg3); color: var(--text2); transition: background .15s, color .15s;
}
.dup-toggle.active { background: var(--accent); color: #fff; }
.dup-toggle:hover { opacity: .85; }

/* Explore */
.explore-banner {
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(135deg, #1a0030, #001a30);
  border-radius: 12px; padding: 36px 40px; margin: 16px 0 28px;
}
.explore-banner h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 8px; }
.explore-banner p { font-size: .88rem; color: var(--text2); max-width: 340px; margin-bottom: 20px; }
.explore-play-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 28px; border-radius: 24px;
  background: #fff; color: #000;
  font-size: .9rem; font-weight: 700; transition: opacity .2s;
}
.explore-play-btn:hover { opacity: .85; }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid #222; }
.tab { padding: 10px 20px; font-size: .9rem; color: var(--text2); cursor: pointer; position: relative; transition: color .15s; }
.tab:hover { color: #fff; }
.tab.active { color: #fff; font-weight: 500; }
.tab.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--accent); }

/* Page */
.page-title { font-size: 1.5rem; font-weight: 700; margin: 20px 0 4px; }
.page-subtitle { font-size: .85rem; color: var(--text2); margin-bottom: 20px; }

/* Empty */
.empty { display: flex; flex-direction: column; align-items: center; padding: 60px 20px; color: var(--text2); gap: 12px; }
.empty h3 { font-size: 1.1rem; color: var(--text); }

/* Spinner */
.loading { display: flex; align-items: center; justify-content: center; padding: 80px 0; }
.spinner { width: 32px; height: 32px; border: 2px solid #333; border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* Radio pill */
.radio-pill {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff;
  padding: 5px 14px; border-radius: 20px;
  font-size: .78rem; font-weight: 600; margin-bottom: 16px;
}
.radio-dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.2s ease-in-out infinite; }

/* Player */
#player {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--player-h);
  background: #101010;
  border-top: 1px solid #1e1e1e;
  display: grid;
  grid-template-columns: 280px 1fr 220px;
  align-items: center;
  padding: 0 16px;
  z-index: 200; gap: 8px;
}

.player-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-cover {
  width: 52px; height: 52px; border-radius: 4px; overflow: hidden;
  background: #1a1a1a; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.player-info { min-width: 0; flex: 1; }
.player-title { font-size: .875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: .77rem; color: var(--text2); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.like-btn { flex-shrink: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text2); transition: color .15s; }
.like-btn:hover { color: #fff; }
.like-btn.liked { color: var(--accent); }

.player-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.player-controls { display: flex; align-items: center; gap: 4px; }
.ctrl-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--text2); transition: color .15s, background .15s; }
.ctrl-btn:hover { color: #fff; background: rgba(255,255,255,.07); }
.ctrl-btn.active { color: var(--accent); }
.ctrl-btn.play-btn { width: 42px; height: 42px; background: #fff; color: #000; border-radius: 50%; }
.ctrl-btn.play-btn:hover { background: #e0e0e0; }

.progress-wrap { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 480px; }
.time { font-size: .75rem; color: var(--text3); font-variant-numeric: tabular-nums; min-width: 32px; }
#time-cur { text-align: right; }
.progress-bar { flex: 1; height: 4px; background: #333; border-radius: 2px; cursor: pointer; position: relative; }
.progress-bar:hover { height: 6px; margin: -1px 0; }
.progress-fill { height: 100%; width: 0%; background: #c0c0c0; border-radius: 2px; pointer-events: none; }
.progress-bar:hover .progress-fill { background: var(--accent); }
.progress-thumb { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 12px; height: 12px; border-radius: 50%; background: #fff; left: 0%; opacity: 0; pointer-events: none; transition: opacity .2s; }
.progress-bar:hover .progress-thumb { opacity: 1; }

.player-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.volume-slider { -webkit-appearance: none; appearance: none; width: 90px; height: 4px; background: #333; border-radius: 2px; cursor: pointer; outline: none; }
.volume-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; cursor: pointer; }

/* Toast */
#toast {
  position: fixed; bottom: calc(var(--player-h) + 16px); left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(30,30,30,.95); color: #fff;
  padding: 8px 20px; border-radius: 20px;
  font-size: .85rem; white-space: nowrap;
  opacity: 0; transition: opacity .25s, transform .25s;
  pointer-events: none; z-index: 999;
  border: 1px solid #333;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Back button */
.back-btn { display: flex; align-items: center; gap: 6px; color: var(--text2); font-size: .82rem; padding: 6px 0; margin-bottom: 16px; }
.back-btn:hover { color: #fff; }

/* ─── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  :root {
    --player-h: 128px;
    --mob-nav-h: 56px;
    --sidebar-w: 0px;
  }

  html, body { overflow: hidden; }

  /* Hide sidebar on mobile */
  #sidebar { display: none; }

  /* Full-width app */
  #app {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--player-h) - var(--mob-nav-h));
  }

  /* Topbar */
  .topbar { padding: 10px 14px 8px; gap: 10px; }
  #stats-bar { display: none; }
  .search-wrap { max-width: 100%; }

  /* Search results full width */
  #search-results { left: 10px; right: 10px; width: auto; top: 54px; }

  /* Page content */
  #page-content { padding: 0 14px calc(20px); }

  /* Track rows: hide album, compress */
  .track-row {
    grid-template-columns: 28px 40px 1fr 54px 30px;
    gap: 8px; padding: 8px 4px;
  }
  .track-album { display: none; }
  .track-cover { width: 36px; height: 36px; }
  .track-like { opacity: 1; }

  /* Cards: smaller min width */
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .card { width: auto; }

  /* Quick picks: single column */
  .quick-picks { grid-template-columns: 1fr; }

  /* Carousel items: slightly smaller */
  .carousel .card { width: 140px; }

  /* Hero: stack vertically */
  .pl-hero { flex-direction: column; align-items: flex-start; gap: 16px; padding: 16px 0 20px; }
  .pl-hero-cover { width: 140px; height: 140px; }
  .pl-hero-title { font-size: 1.4rem; }

  /* Explore banner */
  .explore-banner { padding: 22px 20px; }
  .explore-banner h2 { font-size: 1.2rem; }

  /* ── Player (tall mobile layout) ─────────────────────── */
  #player {
    height: var(--player-h);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 8px 16px 6px;
    gap: 4px;
  }

  /* Row 1: cover + track info + like */
  .player-track { gap: 10px; }
  .player-cover { width: 44px; height: 44px; }

  /* Row 2: controls + progress squeezed together */
  .player-center { gap: 2px; width: 100%; }
  .player-controls { gap: 0; }
  .ctrl-btn { width: 40px; height: 40px; }
  .ctrl-btn.play-btn { width: 46px; height: 46px; }
  .progress-wrap { max-width: 100%; }

  /* Hide volume on mobile */
  .player-right { display: none; }

  /* ── Bottom tab bar ───────────────────────────────────── */
  #mob-nav {
    position: fixed;
    bottom: var(--player-h);
    left: 0; right: 0;
    height: var(--mob-nav-h);
    background: #000;
    border-top: 1px solid #1e1e1e;
    display: flex;
    align-items: stretch;
    z-index: 190;
  }
  .mob-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; font-size: .62rem; color: var(--text3);
    cursor: pointer; transition: color .15s;
    padding: 6px 0;
  }
  .mob-nav-item svg { width: 22px; height: 22px; }
  .mob-nav-item.active { color: var(--accent); }
  .mob-nav-item span { line-height: 1; }

  /* Section titles in artist pages */
  .section-title { font-size: .85rem; padding: 14px 0 6px; }

  /* Tabs: smaller text */
  .tab { padding: 8px 12px; font-size: .82rem; }

  /* Home greeting */
  .home-greeting { font-size: 1.3rem; padding: 12px 0 6px; }
}

/* ─── Login / Register Screen ──────────────────────────────────────────────── */
#login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: flex-start; justify-content: center;
  z-index: 9999;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 40px 16px 60px;
  box-sizing: border-box;
}
.login-card {
  background: var(--bg2);
  border: 1px solid #2a2a3a;
  border-radius: 18px;
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
  margin: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.login-logo {
  display: flex; align-items: center; gap: 12px;
  justify-content: center;
  font-size: 1.5rem; font-weight: 700; color: var(--text);
  margin-bottom: 28px;
}
.login-tabs {
  display: flex; gap: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2a2a3a;
  margin-bottom: 24px;
}
.login-tab {
  flex: 1; padding: 12px; font-size: .9rem; font-weight: 600;
  background: transparent; color: var(--text2);
  border: none; cursor: pointer; transition: background .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.login-tab.active {
  background: var(--accent); color: #fff;
}
.auth-error {
  background: rgba(255,60,60,.15); border: 1px solid rgba(255,60,60,.4);
  color: #ff6b6b; border-radius: 8px;
  padding: 10px 14px; font-size: .85rem; margin-bottom: 16px;
}
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: .8rem; color: var(--text2); margin-bottom: 7px; }
.form-group input {
  width: 100%; padding: 14px 14px;
  background: var(--bg3); border: 1px solid #2a2a3a;
  border-radius: 10px; color: var(--text); font-size: 16px; /* prevents iOS auto-zoom */
  outline: none; transition: border-color .15s; box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.form-group input:focus { border-color: var(--accent); }
.auth-btn {
  width: 100%; padding: 15px;
  background: var(--accent); color: #fff;
  border: none; border-radius: 12px;
  font-size: 1rem; font-weight: 700;
  cursor: pointer; margin-top: 6px;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.auth-btn:hover { opacity: .88; }
.auth-btn:active { opacity: .78; }

/* ─── Profile Page ──────────────────────────────────────────────────────────── */
.profile-page { max-width: 640px; }
.profile-header {
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 32px; margin-top: 8px;
}
.profile-avatar {
  position: relative; width: 90px; height: 90px;
  border-radius: 50%; overflow: hidden;
  cursor: pointer; flex-shrink: 0;
  background: var(--bg3);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; font-weight: 700; color: var(--text2);
  background: var(--bg3);
}
.avatar-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 600; letter-spacing: .05em;
  opacity: 0; transition: opacity .2s;
}
.profile-avatar:hover .avatar-overlay { opacity: 1; }
.profile-name { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.profile-sub { font-size: .82rem; color: var(--text3); margin-top: 4px; }
.profile-section {
  background: var(--bg2); border: 1px solid #222234;
  border-radius: 12px; padding: 20px 22px;
  margin-bottom: 16px;
}
.profile-section-title {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text3); margin-bottom: 14px;
}
.genre-hint { font-size: .68rem; color: var(--text3); text-transform: none; letter-spacing: 0; }
.profile-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
}
.profile-toggle span { font-size: .92rem; color: var(--text); }
.toggle-switch {
  width: 44px; height: 24px; border-radius: 12px;
  background: var(--bg4); position: relative;
  cursor: pointer; transition: background .2s; flex-shrink: 0;
}
.toggle-switch.on { background: var(--accent); }
.toggle-knob {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: left .2s;
}
.toggle-switch.on .toggle-knob { left: 23px; }
.genre-grid {
  display: flex; flex-wrap: wrap; gap: 8px 16px;
  padding-top: 4px;
}
.genre-check {
  display: flex; align-items: center; gap: 7px;
  font-size: .88rem; color: var(--text2); cursor: pointer;
}
.genre-check.all-genres {
  display: block; margin-bottom: 12px;
  font-size: .9rem; color: var(--text); font-weight: 600;
}
.genre-check input[type=checkbox] {
  width: 16px; height: 16px; accent-color: var(--accent);
  cursor: pointer;
}
.logout-btn {
  padding: 10px 28px;
  background: transparent; border: 1px solid #3a3a4a;
  color: var(--text2); border-radius: 8px;
  font-size: .88rem; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.logout-btn:hover { border-color: #ff4444; color: #ff4444; }

@media (max-width: 680px) {
  #login-screen { padding: 24px 12px 50px; }
  .login-card { padding: 28px 20px; border-radius: 16px; }
  .login-logo { font-size: 1.25rem; margin-bottom: 22px; }
  .login-tab { padding: 13px; }
  .profile-header { gap: 16px; }
  .profile-avatar { width: 68px; height: 68px; }
  .profile-name { font-size: 1.2rem; }
}

