:root {
  --accent: #8b5cf6;
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 45%, #ffffff 5%);
  --bg: #08070d;
  --surface: #11101a;
  --surface-2: #171521;
  --surface-3: #1d1a29;
  --border: rgba(255,255,255,.08);
  --text: #f5f3ff;
  --muted: #a7a2b5;
  --danger: #ef4444;
  --player-height: 108px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 35%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--player-height));
}

.sidebar {
  width: 245px;
  min-height: calc(100vh - var(--player-height));
  padding: 28px 18px;
  border-right: 1px solid var(--border);
  background: rgba(8,7,13,.82);
  backdrop-filter: blur(20px);
  position: fixed;
  inset: 0 auto var(--player-height) 0;
  z-index: 20;
}

.brand {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.04em;
  padding: 10px 12px 32px;
}

.brand span {
  color: var(--accent);
}

.brand strong {
  color: #fff;
}

.main-nav {
  display: grid;
  gap: 5px;
}

.nav-link {
  padding: 12px 14px;
  color: var(--muted);
  border-radius: 10px;
  transition: .2s ease;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
}

.nav-link.active {
  color: #fff;
  background: var(--accent-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.sidebar-account {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 25px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}

#accountStatus {
  color: #fff;
  font-size: 13px;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-link {
  color: var(--accent);
  font-size: 13px;
}

.main-content {
  width: 100%;
  margin-left: 245px;
  padding: 38px 42px calc(var(--player-height) + 40px);
}

.view {
  display: none;
  max-width: 1250px;
  margin: 0 auto;
}

.view.active {
  display: block;
}

.hero {
  min-height: 230px;
  display: flex;
  align-items: center;
  padding: 45px 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .18em;
}

.hero h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 78px);
  line-height: .95;
  letter-spacing: -.06em;
  font-weight: 900;
}

.hero h1 span {
  color: var(--accent);
}

.hero h1::after {
  content: " Music";
  color: #fff;
}

.hero-text {
  color: var(--muted);
  font-size: 17px;
  margin: 20px 0 0;
}

.page-heading {
  padding: 25px 0 30px;
}

.page-heading h2 {
  font-size: 42px;
  margin: 0;
  letter-spacing: -.05em;
}

.page-heading p:last-child {
  color: var(--muted);
  margin-top: 9px;
}

.library-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.search-box {
  flex: 1;
  min-width: 0;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.search-box svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

.search-box input {
  width: 100%;
  background: none;
  border: 0;
  outline: 0;
  color: #fff;
}

.search-box input::placeholder {
  color: #706b7e;
}

select,
.setting-field input {
  min-height: 48px;
  padding: 0 14px;
  color: #fff;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  outline: 0;
}

select:focus,
.search-box:focus-within,
.setting-field input:focus {
  border-color: var(--accent-border);
}

.library-status {
  color: var(--muted);
  font-size: 13px;
  min-height: 20px;
}

.library-status[data-type="error"] {
  color: #f87171;
}

.genre-section {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 25px;
}

.section-count {
  color: var(--muted);
  font-size: 13px;
}

.song-list {
  display: grid;
}

.song-row {
  min-height: 70px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1.5fr) minmax(120px, 1fr) 100px 40px;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,.045);
  border-radius: 10px;
  transition: .15s ease;
  outline: 0;
}

.song-row:hover,
.song-row:focus-visible {
  background: rgba(255,255,255,.045);
}

.song-row.is-active {
  background: var(--accent-soft);
}

.song-cover-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-3);
}

.song-cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.row-play {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  background: rgba(0,0,0,.55);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: .15s ease;
}

.row-play svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.song-row:hover .row-play,
.song-row.is-active .row-play {
  opacity: 1;
}

.song-info {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.song-info strong,
.song-info span,
.song-album,
.song-genre {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-info strong {
  color: #fff;
}

.song-info span,
.song-album,
.song-genre {
  color: var(--muted);
  font-size: 13px;
}

.song-more {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.song-more:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.song-more svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

@media (hover: hover) and (pointer: fine) {
  .song-more {
    opacity: 0;
  }

  .song-row:hover .song-more {
    opacity: 1;
  }
}

@media (hover: none), (pointer: coarse) {
  .song-more {
    opacity: 1;
  }
}

.empty-state {
  padding: 70px 20px;
  text-align: center;
  color: var(--muted);
}

.empty-state h3 {
  color: #fff;
}

.player {
  position: fixed;
  z-index: 100;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: var(--player-height);
  padding: 12px 24px 8px;
  background: rgba(12,10,18,.96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(25px);
}

.player-main {
  max-width: 1450px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 25px;
}

.now-playing {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.now-playing img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-3);
}

.now-playing div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.now-playing strong,
.now-playing span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.now-playing span {
  color: var(--muted);
  font-size: 13px;
}

.player-controls,
.player-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.player-actions {
  justify-content: flex-end;
}

.icon-button,
.play-button {
  border: 0;
  background: transparent;
  color: #aaa5b8;
  display: grid;
  place-items: center;
  transition: .15s ease;
}

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
}

.icon-button:hover,
.icon-button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  stroke: none;
}

.play-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
}

.play-button:hover {
  transform: scale(1.05);
}

.play-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-control svg {
  width: 18px;
  height: 18px;
  fill: #aaa5b8;
}

.volume-control input {
  width: 90px;
}

.progress-area {
  max-width: 1000px;
  margin: 3px auto 0;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  gap: 8px;
  color: #817b91;
  font-size: 10px;
}

input[type="range"] {
  accent-color: var(--accent);
}

#progressBar {
  width: 100%;
}

.queue-panel,
.lyrics-panel {
  display: none;
  max-width: 700px;
  margin: 10px auto;
  padding: 15px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 14px;
  max-height: 230px;
  overflow: auto;
}

.queue-panel.has-items.open,
.lyrics-panel.open {
  display: block;
}

.queue-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.queue-heading h3 {
  margin: 0;
}

.queue-heading button {
  color: var(--accent);
  background: transparent;
  border: 0;
}

.queue-list {
  display: grid;
  margin-top: 8px;
}

.queue-item {
  border: 0;
  background: transparent;
  color: #fff;
  text-align: left;
  padding: 9px;
  border-radius: 8px;
  display: grid;
}

.queue-item:hover,
.queue-item.current {
  background: var(--accent-soft);
}

.queue-item small {
  color: var(--muted);
}

.lyrics-content {
  text-align: center;
}

.lyrics-content p {
  color: #777284;
  transition: .2s;
}

.lyrics-content p.active {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.song-context-menu {
  min-width: 205px;
  position: fixed;
  z-index: 500;
  padding: 6px;
  background: #1b1825;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
}

.song-context-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 0;
  background: transparent;
  color: #eee;
  border-radius: 8px;
  text-align: left;
}

.song-context-menu button:hover {
  background: var(--accent-soft);
}

.song-context-menu svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.menu-symbol {
  width: 18px;
  text-align: center;
  font-size: 20px;
}

.settings-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
}

.settings-tab {
  padding: 12px 17px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.settings-tab:hover {
  color: #fff;
}

.settings-tab.active {
  color: #fff;
  border-color: var(--accent);
}

.settings-panel {
  display: none;
}

.settings-panel.active {
  display: block;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 23px;
}

.settings-card-heading {
  margin-bottom: 24px;
}

.settings-card-heading h3 {
  margin: 0 0 6px;
}

.settings-card-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.setting-field {
  display: grid;
  gap: 7px;
  margin-bottom: 17px;
}

.setting-field label,
.colour-setting label {
  font-size: 13px;
  font-weight: 700;
}

.setting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.btn {
  min-height: 43px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #fff;
  background: #211e2b;
  font-weight: 700;
}

.btn:hover {
  background: #2b2737;
}

.btn.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.danger {
  color: #fff;
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.3);
}

.setting-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
}

.toggle-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.toggle-setting:last-child {
  border-bottom: 0;
}

.toggle-setting strong,
.toggle-setting small {
  display: block;
}

.toggle-setting small {
  color: var(--muted);
  margin-top: 4px;
}

.toggle-setting input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle {
  flex: 0 0 auto;
  width: 48px;
  height: 27px;
  padding: 3px;
  border-radius: 20px;
  background: #373241;
  transition: .2s;
}

.toggle::after {
  content: "";
  display: block;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  transition: .2s;
}

.toggle-setting input:checked + .toggle {
  background: var(--accent);
}

.toggle-setting input:checked + .toggle::after {
  transform: translateX(21px);
}

.colour-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 12px;
}

#accentColourSetting {
  width: 58px;
  height: 45px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: transparent;
  padding: 3px;
}

.colour-presets {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.colour-presets button {
  width: 29px;
  height: 29px;
  border: 2px solid rgba(255,255,255,.18);
  border-radius: 50%;
  background: var(--swatch);
}

.settings-save-bar {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 15px 0;
}

#settingsSaveStatus {
  color: var(--muted);
  font-size: 13px;
}

.playlist-page {
  display: grid;
  gap: 12px;
}

.playlist-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}

.playlist-card:hover {
  border-color: var(--accent-border);
}

.playlist-card h3 {
  margin: 0 0 5px;
}

.playlist-card p {
  color: var(--muted);
  margin: 0;
}

.playlist-songs {
  margin-top: 13px;
  display: none;
}

.playlist-card.open .playlist-songs {
  display: grid;
}

.playlist-song {
  padding: 8px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.modal {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(8px);
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(500px, 100%);
  max-height: 85vh;
  overflow: auto;
  padding: 23px;
  background: #171420;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}

.modal-card.small {
  width: min(430px, 100%);
}

.modal-heading {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}

.modal-heading h2,
.modal-card h2 {
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  color: #fff;
  font-size: 25px;
}

.modal-note {
  color: var(--muted);
  padding: 20px 0;
}

.playlist-choice-list {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.playlist-choice {
  display: flex;
  justify-content: space-between;
  text-align: left;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #fff;
  background: var(--surface);
}

.playlist-choice:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.playlist-choice span {
  color: var(--muted);
}

.full-width {
  width: 100%;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}

@media (max-width: 900px) {
  .sidebar {
    width: 75px;
    padding: 18px 10px;
  }

  .brand {
    font-size: 0;
    text-align: center;
    padding: 10px 0 25px;
  }

  .brand span {
    font-size: 23px;
  }

  .brand strong {
    display: none;
  }

  .nav-link {
    font-size: 0;
    text-align: center;
  }

  .nav-link::before {
    content: "•";
    font-size: 22px;
  }

  .sidebar-account {
    display: none;
  }

  .main-content {
    margin-left: 75px;
    padding-left: 22px;
    padding-right: 22px;
  }

  .song-row {
    grid-template-columns: 54px minmax(0, 1fr) 40px;
  }

  .song-album,
  .song-genre {
    display: none;
  }

  .player-main {
    grid-template-columns: 1fr auto;
  }

  .player-actions {
    display: none;
  }
}

@media (max-width: 600px) {
  :root {
    --player-height: 145px;
  }

  .main-content {
    padding: 20px 14px calc(var(--player-height) + 25px);
  }

  .hero {
    min-height: 190px;
  }

  .hero h1 {
    font-size: 45px;
  }

  .library-toolbar {
    flex-direction: column;
  }

  .song-row {
    gap: 9px;
    padding: 7px 4px;
  }

  .song-info strong {
    font-size: 14px;
  }

  .player {
    padding: 8px 12px;
  }

  .player-main {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .now-playing {
    justify-content: center;
  }

  .player-controls {
    gap: 2px;
  }

  .settings-tabs {
    overflow-x: auto;
  }

  .settings-tab {
    white-space: nowrap;
  }

  .settings-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .save-settings {
    width: 100%;
  }
}