:root {
  --bg: #0c0e12;
  --surface: #151922;
  --surface2: #1c2230;
  --border: #2a3344;
  --text: #e8ecf4;
  --muted: #8b95a8;
  --accent: #1ed760;
  --accent-dim: #169c46;
  --danger: #f87171;
  --radius: 12px;
  --player-h: 96px;
  --player-stack-h: 132px;
  --header-h: 52px;
  --font: "Outfit", system-ui, sans-serif;
  --display: "Syne", var(--font);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
}

body {
  margin: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  padding-bottom: 0;
  -webkit-tap-highlight-color: transparent;
}

body.app-logged {
  padding-bottom: calc(var(--player-stack-h) + env(safe-area-inset-bottom, 0px));
}

body:not(.app-logged) footer.player {
  display: none !important;
}

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100vw;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.app-sticky-head {
  flex-shrink: 0;
  z-index: 60;
  background: var(--bg);
  box-shadow: 0 1px 0 var(--border);
}

.app-sticky-library-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0;
  padding: 0.35rem max(0.75rem, env(safe-area-inset-left)) 0.65rem max(0.75rem, env(safe-area-inset-right));
  background: var(--bg);
  border-top: 1px solid rgba(42, 51, 68, 0.6);
}

.app-sticky-library-toolbar.hidden {
  display: none !important;
}

.app-sticky-library-mainhead {
  padding: 0 max(0.75rem, env(safe-area-inset-left)) 0.55rem max(0.75rem, env(safe-area-inset-right));
  background: var(--bg);
  border-top: 1px solid rgba(42, 51, 68, 0.45);
}

.app-sticky-library-mainhead .main-head {
  margin-bottom: 0;
}

.app-sticky-library-mainhead.hidden {
  display: none !important;
}

@media (min-width: 480px) {
  .app-sticky-library-toolbar {
    flex-direction: row;
    align-items: stretch;
    gap: 0.65rem;
  }
  .app-sticky-library-toolbar .library-search-label {
    flex: 1;
    min-width: 0;
  }
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--header-h);
  padding: 0.5rem max(0.75rem, env(safe-area-inset-left)) 0.5rem max(0.75rem, env(safe-area-inset-right));
  padding-top: max(0.5rem, env(safe-area-inset-top));
  background: var(--bg);
}

.app-header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.app-header-brand .logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  flex-shrink: 0;
  display: block;
}

.app-header-brand .brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex-shrink: 0;
}

.app-header-user .user-email {
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-header-logout {
  flex-shrink: 0;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-header-logout:active {
  opacity: 0.9;
}

.app-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-main-tabs {
  display: flex;
  gap: 0.35rem;
  margin: 0;
  padding: 0.65rem max(0.75rem, env(safe-area-inset-left)) 0.75rem max(0.75rem, env(safe-area-inset-right));
  background: var(--bg);
  flex-shrink: 0;
}

.app-main-tab {
  flex: 1;
  min-height: 44px;
  padding: 0.45rem 0.3rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

@media (min-width: 380px) {
  .app-main-tab {
    font-size: 0.85rem;
    padding: 0.45rem 0.5rem;
  }
}

.app-main-tab.active {
  color: var(--accent);
  border-color: rgba(30, 215, 96, 0.45);
  background: rgba(30, 215, 96, 0.08);
}

.app-main-panels {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem max(0.75rem, env(safe-area-inset-left)) calc(var(--player-stack-h) + env(safe-area-inset-bottom, 0px) + 1.25rem) max(0.75rem, env(safe-area-inset-right));
}

.app-main-panel:not(.hidden) {
  overflow: visible;
  min-height: 0;
}

.app-main-panel .app-section:last-child {
  margin-bottom: 0;
}

.app-section-library {
  overflow: visible;
  padding-bottom: 0.5rem;
}

.app-section {
  width: 100%;
  max-width: 100%;
  margin-bottom: 1.25rem;
}

.app-section:last-child {
  margin-bottom: 0;
}

.section-heading {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-hint {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
}

.btn-refresh-list {
  margin-top: 0.5rem;
  width: 100%;
  max-width: 100%;
}

.library-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
}


.upload-zone {
  display: block;
  width: 100%;
  max-width: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

@media (hover: hover) {
  .upload-zone:hover,
  .upload-zone.drag {
    border-color: var(--accent-dim);
    background: rgba(30, 215, 96, 0.06);
  }
}

.upload-zone.drag {
  border-color: var(--accent-dim);
  background: rgba(30, 215, 96, 0.06);
}

.upload-icon {
  display: block;
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.upload-text {
  font-size: 0.9rem;
  color: var(--muted);
}

.upload-progress {
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
}

.upload-progress-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.upload-progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.12s ease-out;
}

.upload-progress-pct {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.35rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.app.is-uploading .upload-zone,
.app.is-uploading .album-panel {
  pointer-events: none;
  opacity: 0.72;
}

.album-picker {
  width: 100%;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.album-submit-full {
  width: 100%;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.btn-ghost:hover {
  border-color: var(--muted);
  color: var(--accent);
}

.library-fav-filter {
  flex-shrink: 0;
  align-self: stretch;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.library-fav-filter[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(30, 215, 96, 0.45);
  background: rgba(30, 215, 96, 0.1);
}

.library-search-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.library-search-label:focus-within {
  border-color: rgba(30, 215, 96, 0.45);
  box-shadow: 0 0 0 2px rgba(30, 215, 96, 0.12);
}

.library-search-icon {
  font-size: 1rem;
  color: var(--muted);
  flex-shrink: 0;
  line-height: 1;
}

.library-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
}

.library-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.main-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.main-head .library-title {
  min-width: 0;
}

.badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface2);
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.track-list > li.album-block {
  min-height: min-content;
  flex-shrink: 0;
}

.track-list > li.hidden {
  display: none !important;
}

.track-list .album-tracks-inner .track-item.hidden {
  display: none !important;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}

.track-fav,
.track-add-pl {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
}

.track-fav.is-on {
  color: #ff6b9d;
}

.track-fav:hover,
.track-add-pl:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.track-add-pl:hover {
  color: var(--accent);
}

.track-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.65rem;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (hover: hover) {
  .track-item:hover {
    background: var(--surface2);
    border-color: var(--border);
  }
}

.track-item.active {
  border-color: rgba(30, 215, 96, 0.45);
  background: rgba(30, 215, 96, 0.08);
}

.track-num {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2d3548, #1a1f2e);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
}

.track-item.active .track-num {
  color: var(--accent);
}

.track-info {
  min-width: 0;
}

.track-title,
.track-meta,
.album-head-title,
.album-head-sub,
.player-title,
.player-sub,
.album-picker,
#albumTitle,
#albumArtist,
#albumGenre {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.track-title {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.track-del {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 6px;
  font-size: 1rem;
  line-height: 1;
}

.track-del:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.12);
}

.playlist-create-row {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

@media (min-width: 520px) {
  .playlist-create-row {
    flex-direction: row;
    align-items: center;
  }
  .playlist-create-row .playlist-name-input {
    flex: 1;
  }
}

.playlist-name-input {
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.playlists-root {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.playlist-block.album-block {
  padding-left: 0;
  padding-right: 0;
}

.playlist-head-actions {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-top: 0.12rem;
}

.playlist-head-rename {
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.playlist-head-rename:hover {
  color: var(--text);
  border-color: var(--muted);
}

.favorites-playlist-art {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #5c3550, #1a1218) !important;
  color: #ff8fb8 !important;
  font-size: 1.1rem;
}

#playlistsRoot .favorites-list-panel {
  border-color: rgba(255, 107, 157, 0.35);
  background: linear-gradient(165deg, rgba(255, 107, 157, 0.08), rgba(20, 22, 28, 0.95));
}

.favorites-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 157, 0.28);
  background: linear-gradient(165deg, rgba(255, 107, 157, 0.07), rgba(20, 22, 28, 0.92));
  overflow: hidden;
}

.favorites-list.no-border {
  border-top: none;
}

.favorites-list.collapsed .user-list-tracks-inner {
  display: none;
}

.user-list-head-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0;
}

.user-list-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

@media (hover: hover) {
  .user-list-toggle:hover {
    background: rgba(255, 255, 255, 0.04);
  }
}

.user-list-toggle:focus-visible {
  outline: 2px solid rgba(255, 107, 157, 0.45);
  outline-offset: -2px;
}

.user-list-chevron {
  width: 1.1rem;
  flex-shrink: 0;
  font-size: 0.65rem;
  line-height: 44px;
  color: var(--muted);
  user-select: none;
}

.user-list-chevron::before {
  content: "▼";
}

.favorites-list.collapsed .user-list-chevron::before {
  content: "▶";
}

.user-list-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
}

.favorites-list-icon {
  background: linear-gradient(145deg, #5c3550, #1a1218);
  color: #ff8fb8;
}

.user-list-meta {
  flex: 1;
  min-width: 0;
}

.user-list-kicker {
  margin: 0;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 143, 184, 0.85);
}

.user-list-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0.1rem 0 0;
  line-height: 1.25;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.user-list-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.user-list-tracks-inner {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem 0.65rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.playlist-art {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #2d3548, #1a1f2e);
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}

.playlist-empty-msg {
  padding: 0.65rem 0.75rem;
  color: var(--muted);
  font-size: 0.88rem;
  list-style: none;
}

.playlist-track-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}

@media (hover: hover) {
  .playlist-track-row:hover {
    background: rgba(255, 255, 255, 0.04);
  }
}

.pl-lines {
  flex: 1;
  min-width: 0;
}

.playlist-track-row .pl-title {
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.playlist-track-row .pl-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-track-remove {
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.playlist-track-remove:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}

.playlists-empty {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.75rem;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

@media (min-width: 520px) {
  .modal {
    align-items: center;
  }
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(78vh, 560px);
  overflow: auto;
  margin-top: auto;
  padding: 1.1rem 1.15rem 1.25rem;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom: none;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.45);
}

@media (min-width: 520px) {
  .modal-card {
    margin-top: 0;
    border-radius: var(--radius);
    border-bottom: 1px solid var(--border);
  }
}

.modal-title {
  margin: 0 0 0.85rem;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
}

.modal-playlist-pick {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 220px;
  overflow-y: auto;
}

.modal-playlist-pick button {
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.modal-playlist-pick button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-inline-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 400px) {
  .modal-inline-row {
    flex-direction: row;
    align-items: center;
  }
  .modal-inline-row .playlist-name-input {
    flex: 1;
  }
}

.modal-close-btn {
  width: 100%;
}

.player-fav {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-size: 1.15rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s, border-color 0.15s;
}

.player-fav.is-on {
  color: #ff6b9d;
  border-color: rgba(255, 107, 157, 0.45);
}

.player-fav:hover {
  color: var(--text);
}

.empty {
  display: none;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 2rem;
}

.empty.show {
  display: block;
}

.player {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  background: #0e1016;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.45rem;
  padding: 0.5rem max(0.65rem, env(safe-area-inset-left)) calc(0.45rem + env(safe-area-inset-bottom, 0px)) max(0.65rem, env(safe-area-inset-right));
  z-index: 100;
}

@media (min-width: 720px) {
  .player {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem 1rem;
    min-height: var(--player-h);
    padding: 0.5rem max(1rem, env(safe-area-inset-left)) calc(0.5rem + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-right));
  }
  .player-track {
    flex: 1 1 200px;
    min-width: 0;
    max-width: 100%;
  }
  .player-controls {
    flex: 0 0 auto;
  }
  .player-seek {
    flex: 2 1 220px;
    min-width: 0;
    max-width: 100%;
  }
  .player-vol {
    flex: 0 0 auto;
  }
}

.player-track {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.player-art {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
  background-color: #111;
}

.player-art:not(.has-cover) {
  background-image: linear-gradient(145deg, var(--accent-dim), #0d3d22);
}

.player-meta {
  flex: 1;
  min-width: 0;
}

.player-title {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
}

.ctrl-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, background 0.15s;
}

.ctrl-btn:hover {
  background: var(--border);
}

.ctrl-btn:active {
  opacity: 0.88;
}

.ctrl-play {
  width: 48px;
  height: 48px;
  background: var(--text);
  color: var(--bg);
  font-size: 1.1rem;
}

.ctrl-play:hover {
  background: var(--accent);
  color: #0a0a0a;
}

.player-seek {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.time {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 2.5rem;
  flex-shrink: 0;
}

.seek-bar {
  flex: 1;
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  cursor: pointer;
  position: relative;
}

.seek-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  pointer-events: none;
}

.player-vol {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  max-width: 100%;
}

.vol-icon {
  font-size: 0.85rem;
  opacity: 0.8;
}

#volRange {
  width: min(120px, 28vw);
  max-width: 100%;
  accent-color: var(--accent);
}

.toast {
  position: fixed;
  bottom: calc(var(--player-stack-h) + 8px + env(safe-area-inset-bottom, 0px));
  left: max(0.75rem, env(safe-area-inset-left));
  right: max(0.75rem, env(safe-area-inset-right));
  width: auto;
  max-width: min(420px, calc(100vw - 1.5rem));
  margin: 0 auto;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 200;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

.hidden {
  display: none !important;
}

.auth-screen {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem max(1.5rem, env(safe-area-inset-left)) max(1.5rem, env(safe-area-inset-bottom)) max(1.5rem, env(safe-area-inset-right));
  background: var(--bg);
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
}

.auth-brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.auth-brand .logo-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.auth-tab {
  flex: 1;
  padding: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  border-radius: 8px;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab.active {
  color: var(--accent);
  border-color: rgba(30, 215, 96, 0.45);
  background: rgba(30, 215, 96, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-form input {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.btn-primary {
  margin-top: 0.35rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #0a0a0a;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.auth-error {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--danger);
  min-height: 1.2em;
}

.album-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.album-form-title {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
  color: var(--text);
}

.album-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.album-label input {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.album-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.album-label.half {
  min-width: 0;
}

.album-submit {
  margin-top: 0.15rem;
}

.cover-preview-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0.15rem 0 0;
}

.cover-preview-wrap.hidden {
  display: none;
}

.cover-preview-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.cover-preview-img {
  width: min(200px, 100%);
  height: auto;
  max-height: 220px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  display: block;
}

.library-section {
  list-style: none;
  margin: 0;
  padding: 0.65rem 0 0.25rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
}

.library-section.first {
  padding-top: 0;
}

.album-block {
  list-style: none;
  margin: 0;
  padding: 0.85rem 0 0;
  border-top: 1px solid var(--border);
}

.album-block.no-border {
  border-top: none;
  padding-top: 0;
}

.album-block.collapsed .album-tracks-inner {
  display: none;
}

.album-head-row {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.album-head-btn {
  margin: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.album-head-btn:hover {
  background: rgba(255, 255, 255, 0.04);
}

.album-head-btn:focus-visible {
  outline: 2px solid rgba(30, 215, 96, 0.5);
  outline-offset: 2px;
}

.album-accordion-toggle {
  flex: 0 0 auto;
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.75rem;
  padding: 0.15rem 0.2rem;
}

.album-head-play {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.15rem 0.35rem 0.15rem 0;
}

.album-chevron {
  width: 1.1rem;
  flex-shrink: 0;
  font-size: 0.65rem;
  line-height: 1;
  color: var(--muted);
  user-select: none;
}

.album-accordion-toggle .album-chevron {
  line-height: 1;
}

.album-chevron::before {
  content: "▼";
}

.album-block.collapsed .album-chevron::before {
  content: "▶";
}

.album-tracks-inner {
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.album-head-art {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}

.album-head-meta {
  flex: 1;
  min-width: 0;
}

.album-head-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.25;
}

.album-head-sub {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0.2rem 0 0;
}

.album-head-del {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

.album-head-del:hover {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}
