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

:root {
  --bg: #121212;
  --bg2: #181818;
  --bg3: #282828;
  --text: #fff;
  --text2: #b3b3b3;
  --green: #1DB954;
  --green-h: #1ed760;
  --player-h: 90px;
}

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

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: calc(100vh - var(--player-h));
  gap: 8px;
  padding: 8px 8px 0;
}

/* Sidebar */
.sidebar { background: #000; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 16px 16px; font-weight: 700; font-size: 16px; }
.sidebar-nav { padding: 0 8px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 6px; color: var(--text2); text-decoration: none; font-weight: 500; transition: color .15s; }
.nav-item:hover, .nav-item.active { color: var(--text); }
.nav-item.active { background: var(--bg3); }
.sidebar-library { margin-top: 8px; padding: 0 8px; flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.library-header { display: flex; align-items: center; gap: 10px; padding: 8px 12px; color: var(--text2); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.queue-list { flex: 1; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--bg3) transparent; }
.queue-item { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: background .15s; }
.queue-item:hover { background: var(--bg3); }
.queue-item.active { background: var(--bg3); }
.queue-item img { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.queue-item-info { overflow: hidden; }
.queue-item-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item-artist { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Main */
.main { background: var(--bg2); border-radius: 8px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--bg3) transparent; }
#main-content { padding: 24px; min-height: 100%; }

/* Login banner */
.login-banner { display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg,#1DB954,#158940); border-radius: 8px; padding: 16px 24px; margin-bottom: 24px; }
.login-btn { background: #fff; color: #000; padding: 8px 20px; border-radius: 20px; text-decoration: none; font-weight: 700; font-size: 13px; }
.login-btn:hover { background: #f0f0f0; }

.section-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.subsection-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; color: var(--text); }

/* Search bar */
.search-bar-wrap { display: flex; align-items: center; gap: 12px; background: var(--bg3); border-radius: 24px; padding: 10px 20px; margin-bottom: 24px; max-width: 480px; color: var(--text2); }
.search-bar-wrap input { flex: 1; background: none; border: none; outline: none; color: var(--text); font-size: 14px; font-family: inherit; }

/* Artist grid (search results) */
.artist-row { margin-bottom: 28px; }
.artist-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.artist-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 12px; border-radius: 8px; cursor: pointer; transition: background .15s; width: 130px; }
.artist-card:hover { background: var(--bg3); }
.artist-card img { width: 100px; height: 100px; border-radius: 50%; object-fit: cover; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.artist-card-name { font-size: 13px; font-weight: 600; text-align: center; }
.artist-card-type { font-size: 11px; color: var(--text2); }

/* Album grid */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.album-card { background: var(--bg3); border-radius: 8px; padding: 14px; cursor: pointer; transition: background .15s; position: relative; }
.album-card:hover { background: #3e3e3e; }
.album-card:hover .card-play { opacity: 1; transform: translateY(0); }
.album-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; margin-bottom: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.card-play { position: absolute; bottom: 70px; right: 16px; width: 40px; height: 40px; background: var(--green); 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 16px rgba(0,0,0,.4); }
.card-play:hover { background: var(--green-h) !important; }
.card-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* Track list */
.track-list { display: flex; flex-direction: column; gap: 2px; }
.track-row { display: grid; grid-template-columns: 20px 48px 1fr auto auto; align-items: center; gap: 12px; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: background .15s; }
.track-row:hover { background: var(--bg3); }
.track-row.playing { background: var(--bg3); }
.track-row.playing .track-row-title { color: var(--green); }
.track-num { color: var(--text2); font-size: 13px; text-align: center; }
.track-row img { width: 48px; height: 48px; border-radius: 4px; object-fit: cover; }
.track-row-info { overflow: hidden; }
.track-row-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-row-artist { font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-row-artist a { color: inherit; text-decoration: none; }
.track-row-artist a:hover { color: var(--text); text-decoration: underline; }
.track-dur { color: var(--text2); font-size: 13px; font-variant-numeric: tabular-nums; }
.dl-btn { background: none; border: none; color: var(--text2); cursor: pointer; padding: 4px 6px; border-radius: 4px; display: flex; align-items: center; opacity: 0; transition: opacity .15s, color .15s; flex-shrink: 0; }
.track-row:hover .dl-btn { opacity: 1; }
.dl-btn:hover { color: var(--text); }

/* Artist page */
.artist-header {
  position: relative;
  min-height: 280px;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  margin-bottom: 24px;
  background: var(--bg3);
}
.artist-header-bg {
  position: absolute; inset: 0;
  background-size: cover;
  background-position: center top;
  filter: brightness(.5);
}
.artist-header-content { position: relative; }
.artist-header h1 { font-size: 48px; font-weight: 900; letter-spacing: -1px; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.artist-header-meta { font-size: 13px; color: rgba(255,255,255,.7); margin-top: 6px; }
.artist-play-btn { margin-top: 20px; background: var(--green); color: #000; border: none; border-radius: 24px; padding: 12px 32px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.artist-play-btn:hover { background: var(--green-h); }
.artist-body { padding-bottom: 24px; }

/* Album page */
.album-header {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  padding: 32px 24px 24px;
  background: linear-gradient(to bottom, #3e3e3e, var(--bg2));
  border-radius: 12px;
  margin-bottom: 8px;
}
.album-header img { width: 180px; height: 180px; border-radius: 6px; object-fit: cover; box-shadow: 0 8px 32px rgba(0,0,0,.6); flex-shrink: 0; }
.album-header-info { flex: 1; }
.album-header-type { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--text); margin-bottom: 8px; }
.album-header-title { font-size: 36px; font-weight: 900; letter-spacing: -.5px; margin-bottom: 8px; }
.album-header-meta { font-size: 13px; color: var(--text2); }
.album-header-meta a { color: var(--text); text-decoration: none; font-weight: 600; }
.album-header-meta a:hover { text-decoration: underline; }
.album-play-btn { margin-top: 20px; background: var(--green); color: #000; border: none; border-radius: 24px; padding: 12px 32px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.album-play-btn:hover { background: var(--green-h); }

/* Player */
.player { position: fixed; bottom: 0; left: 0; right: 0; height: var(--player-h); background: #181818; border-top: 1px solid #282828; display: grid; grid-template-columns: 280px 1fr 220px; align-items: center; padding: 0 20px; gap: 20px; z-index: 100; }
.player-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-track img { width: 56px; height: 56px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }
.player-info { overflow: hidden; flex: 1; }
.player-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.ctrl-row { display: flex; align-items: center; gap: 20px; }
.ctrl-btn { background: none; border: none; color: var(--text2); cursor: pointer; padding: 4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: color .15s, transform .1s; }
.ctrl-btn:hover { color: var(--text); }
.ctrl-btn.active { color: var(--green); }
.play-btn { width: 36px; height: 36px; background: var(--text); color: var(--bg); border-radius: 50%; }
.play-btn:hover { transform: scale(1.06); color: var(--bg); }
.seek-row { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 560px; }
.time { font-size: 11px; color: var(--text2); font-variant-numeric: tabular-nums; min-width: 32px; }
.seek-bar { flex: 1; height: 4px; background: #535353; border-radius: 2px; cursor: pointer; position: relative; }
.seek-bar:hover .seek-fill { background: var(--green); }
.seek-bar:hover .seek-thumb { opacity: 1; }
.seek-fill { height: 100%; background: var(--text); border-radius: 2px; pointer-events: none; transition: background .1s; }
.seek-thumb { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 12px; height: 12px; background: var(--text); border-radius: 50%; opacity: 0; pointer-events: none; transition: opacity .15s; }
.player-right { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.vol-bar { width: 93px; height: 4px; background: #535353; border-radius: 2px; cursor: pointer; position: relative; }
.vol-bar:hover .vol-fill { background: var(--green); }
.vol-fill { height: 100%; background: var(--text); border-radius: 2px; pointer-events: none; transition: background .1s; }

/* Sidebar tabs */
.sidebar-tabs { display: flex; gap: 4px; padding: 4px 8px 8px; }
.sidebar-tab { flex: 1; background: none; border: none; color: var(--text2); font-family: inherit; font-size: 12px; font-weight: 600; padding: 6px; border-radius: 20px; cursor: pointer; transition: background .15s, color .15s; }
.sidebar-tab:hover { color: var(--text); }
.sidebar-tab.active { background: var(--bg3); color: var(--text); }

/* Lib items */
.lib-item { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: background .15s; }
.lib-item:hover { background: var(--bg3); }
.liked-row .liked-icon { width: 36px; height: 36px; border-radius: 4px; background: linear-gradient(135deg,#450af5,#c4efd9); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.pl-thumb { width: 36px; height: 36px; border-radius: 4px; object-fit: cover; flex-shrink: 0; }

/* Liked songs header */
.liked-header { position: relative; min-height: 200px; border-radius: 12px; overflow: hidden; display: flex; align-items: flex-end; padding: 24px; margin-bottom: 16px; }
.liked-header-bg { position: absolute; inset: 0; background: linear-gradient(135deg,#450af5 0%,#c4efd9 100%); }
.liked-header-content { position: relative; display: flex; align-items: flex-end; gap: 24px; }
.liked-icon-big { font-size: 80px; line-height: 1; flex-shrink: 0; }

/* Auth modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: none; align-items: center; justify-content: center; z-index: 500; }
.modal { background: var(--bg2); border-radius: 12px; padding: 32px; width: 340px; max-width: 90vw; position: relative; }
.modal-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: var(--text2); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal h2 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.modal-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--bg3); }
.modal-tab { background: none; border: none; color: var(--text2); font-family: inherit; font-size: 14px; font-weight: 600; padding: 8px 16px 10px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.modal-tab:hover { color: var(--text); }
.modal-tab.active { color: var(--text); border-bottom-color: var(--green); }
.auth-input { width: 100%; background: var(--bg3); border: 1px solid #3e3e3e; border-radius: 6px; color: var(--text); font-family: inherit; font-size: 14px; padding: 10px 14px; margin-bottom: 12px; outline: none; }
.auth-input:focus { border-color: var(--text2); }
.auth-submit-btn { width: 100%; background: var(--green); color: #000; border: none; border-radius: 24px; font-family: inherit; font-size: 14px; font-weight: 700; padding: 12px; cursor: pointer; margin-top: 4px; }
.auth-submit-btn:hover { background: var(--green-h); }
.auth-error { color: #f44; font-size: 12px; margin-top: 8px; min-height: 16px; }

/* Guest banner */
.lib-guest-banner { padding: 12px; }
.lib-guest-banner p { font-size: 12px; color: var(--text2); margin-bottom: 10px; line-height: 1.4; }
.lib-auth-btn { display: block; width: 100%; background: none; border: 1px solid var(--text2); color: var(--text); font-family: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 20px; cursor: pointer; margin-bottom: 6px; transition: border-color .15s, color .15s; }
.lib-auth-btn:hover { border-color: var(--text); }
.lib-auth-btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.lib-auth-btn.primary:hover { background: #ccc; }

/* User area */
.lib-user-area { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 8px; }
.lib-user-name { font-size: 12px; color: var(--text2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-logout-btn { background: none; border: none; color: var(--text2); font-family: inherit; font-size: 11px; cursor: pointer; padding: 2px 6px; border-radius: 10px; }
.lib-logout-btn:hover { color: var(--text); background: var(--bg3); }

/* Add-playlist btn */
.lib-add-btn { background: none; border: none; color: var(--text2); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; border-radius: 50%; margin-left: auto; }
.lib-add-btn:hover { color: var(--text); background: var(--bg3); }

/* Loading */
.loading { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: var(--bg3); color: var(--text); padding: 10px 20px; border-radius: 24px; display: flex; align-items: center; gap: 10px; font-size: 13px; z-index: 999; box-shadow: 0 4px 20px rgba(0,0,0,.5); }
.loading-spinner { width: 16px; height: 16px; border: 2px solid var(--bg); border-top-color: var(--green); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }
