/* ==========================================================================
   Sleeve — design tokens
   A quiet, warm "liner notes" aesthetic: charcoal sleeves, brass foil accents,
   one sans (Inter) throughout — headlines and body share the same typeface.

   Accessibility notes (read before editing):
   - Dimensions that relate to layout/reading are in rem, not px, so the
     whole shell reflows correctly when a person increases their browser's
     text size (WCAG 1.4.4 Resize Text / 1.4.10 Reflow).
   - No text is truncated with ellipsis anywhere; long titles wrap instead
     (overflow-wrap: anywhere) so nothing is ever hidden from view.
   - Interactive controls keep a ~2.75rem (44px) minimum hit target.
   - Focus rings are always visible; nothing relies on :hover alone.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #16151a;
  --surface: #1e1d24;
  --surface-2: #262530;
  --border: #34313d;
  --text: #f2efe9;
  --text-muted: #9c97a8;
  --accent: #c9a24b;
  --accent-soft: rgba(201, 162, 75, 0.14);
  --accent-2: #5b7b7a;
  --danger: #c1595a;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 0.625rem;
  --radius-sm: 0.375rem;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
  --hit: 2.75rem; /* minimum interactive target size */
}

/* Alternate color themes — same structure as :root above, just different
   values. Chosen and verified the same way as the default palette: every
   text/text-muted/accent color checked against both --bg and --surface-2
   for WCAG AA contrast (4.5:1+; most land closer to AAA) before being used
   here, not just picked by eye. Typography, spacing, and everything else
   stays identical across themes — this is color-only. */

[data-theme="midnight"] {
  --bg: #10151f;
  --surface: #171f30;
  --surface-2: #1f2940;
  --border: #2d3752;
  --text: #eef1f8;
  --text-muted: #97a2bd;
  --accent: #7fb2e0;
  --accent-soft: rgba(127, 178, 224, 0.14);
  --accent-2: #4f8f8a;
  --danger: #d17272;
}

[data-theme="forest"] {
  --bg: #10160f;
  --surface: #171f16;
  --surface-2: #243325;
  --border: #33422f;
  --text: #eef2ea;
  --text-muted: #9aab90;
  --accent: #9ecb7a;
  --accent-soft: rgba(158, 203, 122, 0.14);
  --accent-2: #63a094;
  --danger: #d17a72;
}

[data-theme="beach"] {
  --bg: #171310;
  --surface: #1f1a15;
  --surface-2: #2a2119;
  --border: #453626;
  --text: #f5eee2;
  --text-muted: #ab9a84;
  --accent: #5ec4bd;
  --accent-soft: rgba(94, 196, 189, 0.14);
  --accent-2: #d98860;
  --danger: #d1726a;
}

[data-theme="slate"] {
  --bg: #131315;
  --surface: #1c1c1f;
  --surface-2: #26262a;
  --border: #3a3a40;
  --text: #f5f5f7;
  --text-muted: #a3a3ab;
  --accent: #8ecae6;
  --accent-soft: rgba(142, 202, 230, 0.14);
  --accent-2: #6c757d;
  --danger: #d17272;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win, full stop — otherwise any class
   that sets its own `display` (flex/grid/etc.) silently un-hides itself,
   since author CSS overrides the browser's default [hidden] handling. This
   exact bug has hit three separate elements already; this rule prevents a
   fourth. */
[hidden] { display: none !important; }

html {
  font-size: 100%; /* respects the browser/OS text-size setting */
}
html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

button {
  font-family: inherit;
  cursor: pointer;
}

img { max-width: 100%; }

::selection { background: var(--accent-soft); }

/* Focus visibility everywhere — never suppressed */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================================================
   Buttons & form controls
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: var(--hit);
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #16151a;
  font-weight: 600;
}
.btn-primary:hover { background: #d9b466; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border); }
.btn-danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger:hover { border-color: var(--danger); }
.btn-sm { min-height: 2.25rem; padding: 0.375rem 0.75rem; font-size: 0.875rem; }

input[type="text"], input[type="password"], input[type="search"], input[type="email"], textarea, select {
  width: 100%;
  min-height: var(--hit);
  padding: 0.625rem 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9375rem;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
}
label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.875rem 0 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
label:first-child { margin-top: 0; }

/* ==========================================================================
   Auth screen
   ========================================================================== */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 20% 15%, rgba(201, 162, 75, 0.08), transparent 45%),
    var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2rem 2rem;
  box-shadow: var(--shadow-card);
}

.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.brand-mark { display: flex; justify-content: center; margin-bottom: 0.625rem; }
.auth-brand h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.75rem;
  margin: 0;
  letter-spacing: -0.01em;
}
.auth-tagline { color: var(--text-muted); font-size: 0.875rem; margin: 0.375rem 0 0; }

.auth-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}
.auth-tab {
  flex: 1;
  min-height: var(--hit);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.auth-tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.auth-form .btn { width: 100%; margin-top: 1.125rem; }
.auth-error {
  color: var(--danger);
  font-size: 0.8125rem;
  margin: 0.75rem 0 0;
}
.auth-hint {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin: 0.5rem 0 0;
  line-height: 1.5;
}

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell {
  display: grid;
  grid-template-columns: 15rem 1fr;
  min-height: 100vh;
  padding-bottom: 6rem; /* space for the now-playing bar */
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.375rem 1.125rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 1.75rem;
  padding: 0 0.375rem;
}

.nav { display: flex; flex-direction: column; gap: 0.125rem; }
.nav-item {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  min-height: var(--hit);
  background: none;
  border: none;
  color: var(--text-muted);
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.3;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); }
.nav-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  opacity: 0.7;
  flex-shrink: 0;
}
.nav-item.is-active .nav-eyebrow { color: var(--accent); opacity: 1; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 0.875rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.sidebar-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.username {
  font-size: 0.8125rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.logout-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
}
.logout-link:hover { color: var(--accent); }

.main { padding: 1.75rem 2.25rem; min-width: 0; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.375rem;
}
.topbar h1 {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.topbar-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; }

.banner {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
  overflow-wrap: anywhere;
}
.banner a { font-weight: 600; }

/* ==========================================================================
   Cards & grids (albums, artists)
   ========================================================================== */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 1.375rem;
}

/* Used on the Artists page: smaller thumbnails, more of them per row. */
.grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 1rem 0.875rem;
}

.card {
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
}
.card-art {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card-art.is-empty::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.card-overridden {
  display: inline-block;
  width: 0.4rem; height: 0.4rem;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.35rem;
  vertical-align: middle;
  flex-shrink: 0;
}

.section-heading {
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 1.75rem 0 0.875rem;
  scroll-margin-top: 5rem; /* keeps the heading clear of the sticky alpha-index when jumped to */
}
.section-heading:first-child { margin-top: 0; }

/* Breadcrumb */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.125rem;
}
.crumbs button {
  background: none; border: none; color: var(--text-muted); font: inherit; padding: 0.25rem 0;
  min-height: 2rem;
}
.crumbs button:hover { color: var(--accent); }
.crumbs .sep { opacity: 0.5; }
.crumbs .current { color: var(--text); overflow-wrap: anywhere; }

/* ==========================================================================
   Alphabet jump index + floating "back to top"
   ========================================================================== */

.alpha-index {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.625rem 0;
  margin-bottom: 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.alpha-btn {
  min-width: 2rem;
  min-height: 2rem;
  padding: 0 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-mono);
}
.alpha-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.alpha-btn:disabled {
  color: var(--text-muted);
  opacity: 0.35;
  cursor: default;
  background: none;
}

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 6.5rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-height: var(--hit);
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--shadow-card);
}
.back-to-top:hover { background: var(--accent-soft); }
.back-to-top[hidden] { display: none; }

/* ==========================================================================
   Track list (rows)
   ========================================================================== */

.track-list { display: flex; flex-direction: column; }
.track-row {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  align-items: start;
  gap: 0.875rem;
  padding: 0.625rem 0.625rem;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid transparent;
}
.track-row.is-reorderable { grid-template-columns: var(--hit) 2rem 1fr auto; }
.track-row-wrap.is-dragging { opacity: 0.55; }
.track-row-wrap.is-dragging .track-row { background: var(--accent-soft); }
.drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: var(--hit);
  min-height: var(--hit);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1.125rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.drag-handle:hover, .drag-handle:focus-visible { color: var(--accent); background: var(--surface-2); }
.drag-handle:active { cursor: grabbing; }
.drag-handle-spacer { min-width: var(--hit); min-height: var(--hit); }
.track-row:hover, .track-row:focus-within { background: var(--surface); }
.track-row.is-playing { background: var(--accent-soft); }
.track-index {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: right;
  padding-top: 0.2rem;
}
.track-row.is-playing .track-index { color: var(--accent); }
.track-main {
  min-width: 0;
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  color: inherit;
  font: inherit;
}
.track-name {
  font-size: 0.9375rem;
  font-weight: 500;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.track-artist {
  font-size: 0.8125rem;
  color: var(--text-muted);
  overflow-wrap: anywhere;
  line-height: 1.35;
}
/* Duration + action buttons travel together as one unit — on wide screens
   they sit at the row's end; below the narrow breakpoint they drop to their
   own full-width line instead of squeezing the title. */
.track-extra {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}
.track-duration-block { display: flex; flex-direction: column; align-items: flex-end; }
.track-duration {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 0.2rem;
  white-space: nowrap;
}
.track-play-count {
  font-size: 0.6875rem;
  color: var(--text-muted);
  opacity: 0.75;
  white-space: nowrap;
}
/* Compact command buttons — visually identical to the alphabet index
   buttons, showing one letter with the full command as the accessible
   name (aria-label) and hover tooltip (title). Used for secondary actions
   on track rows, playlist rows, and the album header — same everywhere,
   not mobile-specific. */
.cmd-btn-group { display: flex; gap: 0.25rem; flex-shrink: 0; }
.cmd-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.cmd-btn svg { width: 1.125rem; height: 1.125rem; flex-shrink: 0; }
.cmd-btn:hover, .cmd-btn:focus-visible { border-color: var(--accent); color: var(--accent); }
.cmd-btn.is-remove:hover, .cmd-btn.is-remove:focus-visible { border-color: var(--danger); color: var(--danger); }
.cmd-btn[hidden] { display: none; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-width: 2.25rem;
  min-height: 2.25rem;
  background: none;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.icon-btn:hover { color: var(--accent); background: var(--surface-2); border-color: var(--border); }

/* ==========================================================================
   Detail panel (album/track edit — tag overrides)
   ========================================================================== */

.detail-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1.375rem;
  margin-bottom: 1.625rem;
  align-items: flex-start;
}
.detail-art {
  width: 10rem; height: 10rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}
.detail-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-art.is-empty::after { content: ""; position: absolute; inset: 0; background: #000; }
.detail-meta { min-width: 0; padding-top: 0.25rem; flex: 1 1 16rem; }
.detail-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.375rem;
}
.detail-title {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  margin: 0 0 0.375rem;
  overflow-wrap: anywhere;
}
.detail-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.875rem;
  overflow-wrap: anywhere;
}
.detail-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; }

.tag-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.375rem;
  max-width: 34rem;
}
.tag-row {
  display: grid;
  grid-template-columns: minmax(6rem, 7rem) 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}
.tag-row:last-child { border-bottom: none; }
.tag-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tag-value-original { font-size: 0.875rem; color: var(--text-muted); }
.tag-input {
  padding: 0.4375rem 0.625rem;
  font-size: 0.875rem;
  min-height: 2.25rem;
}

/* ==========================================================================
   Playlists
   ========================================================================== */

.playlist-list { display: flex; flex-direction: column; gap: 0.125rem; }
.playlist-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.8125rem 0.875rem;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--border);
}
.playlist-item:hover { background: var(--surface); }
.playlist-main {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  background: none;
  border: none;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
}
.playlist-name { font-weight: 600; font-size: 0.9375rem; overflow-wrap: anywhere; }
.playlist-count { font-size: 0.8125rem; color: var(--text-muted); }

.empty-state {
  text-align: center;
  padding: 3.75rem 1.25rem;
  color: var(--text-muted);
}
.empty-state h3 {
  font-family: var(--font-display);
  color: var(--text);
  font-size: 1.1875rem;
  margin-bottom: 0.5rem;
}

/* ==========================================================================
   Settings
   ========================================================================== */

.settings-panel {
  max-width: 30rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.625rem;
}

.user-list-header { display: flex; justify-content: flex-end; margin-bottom: 1rem; }
.user-list { display: flex; flex-direction: column; gap: 0.875rem; max-width: 36rem; }
.user-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
}
.user-username {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  margin-bottom: 0.75rem;
}
.user-field { display: block; margin-top: 0.625rem; }
.user-field span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.user-row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.user-row-error, .user-row-success { margin-top: 0.625rem; }

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.theme-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: 500;
  min-height: var(--hit);
}
.theme-swatch:hover, .theme-swatch:focus-visible { border-color: var(--accent); }
.theme-swatch.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-swatch-preview {
  display: block;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--swatch-bg);
  border: 3px solid var(--swatch-accent);
}
.theme-swatch-check {
  font-size: 0.75rem;
  color: var(--accent);
  height: 1rem;
}
.settings-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  margin-bottom: 1.125rem;
}
.status-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.status-dot.is-connected { background: #6fae72; }
.status-dot.is-error { background: var(--danger); }
.settings-actions { display: flex; flex-wrap: wrap; gap: 0.625rem; margin-top: 1.25rem; }

.version-link {
  display: block;
  width: 100%;
  margin: 1.5rem 0 0;
  padding: 0.5rem 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
}
.version-link:hover { color: var(--accent); text-decoration: underline; }

.changelog-entry {
  padding: 1.125rem 0;
  border-bottom: 1px solid var(--border);
  max-width: 34rem;
}
.changelog-entry:first-child { padding-top: 0; }
.changelog-entry:last-child { border-bottom: none; }
.changelog-version {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.changelog-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.625rem;
}
.changelog-notes {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}
.changelog-notes li { margin-bottom: 0.375rem; overflow-wrap: anywhere; }

/* ==========================================================================
   Now-playing bar — static artwork (no motion), always legible
   ========================================================================== */

.player-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  min-height: 5.25rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 3.5rem 1fr auto 17.5rem 6.5rem;
  align-items: center;
  gap: 1.125rem;
  padding: 0.625rem 1.375rem;
  z-index: 10;
}

.player-art {
  width: 3.25rem; height: 3.25rem; flex-shrink: 0;
  background: none; border: none; padding: 0; border-radius: var(--radius-sm);
}
.player-art:hover .now-playing-art, .player-art:focus-visible .now-playing-art { border-color: var(--accent); }
.now-playing-art {
  position: relative;
  width: 3.25rem; height: 3.25rem;
  border-radius: var(--radius-sm);
  background: #000;
  border: 1px solid var(--border);
  overflow: hidden;
}
.now-playing-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.now-playing-art.is-empty img { display: none; }

.player-info {
  min-width: 0;
  background: none; border: none; padding: 0;
  text-align: left; font: inherit; color: inherit;
  border-radius: var(--radius-sm);
}
.player-info:hover .player-title, .player-info:focus-visible .player-title { color: var(--accent); }
.player-title {
  font-size: 0.9375rem; font-weight: 600;
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.player-subtitle {
  font-size: 0.8125rem; color: var(--text-muted);
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.player-controls { display: flex; align-items: center; gap: 0.375rem; }
.player-btn {
  display: flex; align-items: center; justify-content: center;
  width: var(--hit); height: var(--hit);
  min-width: var(--hit); min-height: var(--hit);
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.125rem;
}
.player-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.player-btn.is-active { color: var(--accent); border-color: var(--accent); }
.player-btn:disabled { opacity: 0.4; cursor: default; }
.player-btn[hidden] { display: none; }

.player-progress {
  display: flex; align-items: center; gap: 0.625rem;
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted);
}
.player-progress input[type="range"] { width: 10rem; }
.player-duration-block { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.player-play-count { font-size: 0.625rem; opacity: 0.75; white-space: nowrap; }
.player-play-count:empty { display: none; }

.player-volume { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.player-volume input[type="range"] { width: 4.5rem; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 0.25rem;
  background: var(--border);
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 0.9375rem; height: 0.9375rem;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 0.9375rem; height: 0.9375rem;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}

#player-audio { display: none; }

/* ==========================================================================
   Full-screen now playing — opened by tapping the player bar's artwork
   ========================================================================== */

.now-playing-screen {
  position: fixed;
  inset: 0;
  z-index: 50; /* above the player bar (10) and back-to-top (20) */
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  padding: 4rem 1.5rem 2rem;
}
.now-playing-screen[hidden] { display: none; }
.now-playing-close {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  min-width: var(--hit);
  min-height: var(--hit);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 1.5rem;
}
.now-playing-close:hover, .now-playing-close:focus-visible { color: var(--accent); border-color: var(--accent); }

.now-playing-art-wrap { width: 100%; display: flex; justify-content: center; }
.now-playing-art-large {
  position: relative;
  width: min(80vw, 22rem);
  height: min(80vw, 22rem);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.now-playing-art-large img { width: 100%; height: 100%; object-fit: cover; display: block; }
.now-playing-art-large.is-empty img { display: none; }

.now-playing-meta {
  background: none;
  border: none;
  text-align: center;
  padding: 0.5rem;
  max-width: 28rem;
  width: 100%;
  border-radius: var(--radius-sm);
}
.now-playing-meta:hover .now-playing-title, .now-playing-meta:focus-visible .now-playing-title { color: var(--accent); }
.now-playing-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.3;
}
.now-playing-artist {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
  overflow-wrap: anywhere;
}

.now-playing-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 26rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}
.now-playing-progress input[type="range"] { flex: 1; }

.now-playing-controls { display: flex; align-items: center; gap: 1rem; }
.now-playing-controls .player-btn {
  width: 3.5rem;
  height: 3.5rem;
  min-width: 3.5rem;
  min-height: 3.5rem;
  font-size: 1.5rem;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 55rem) {
  .app-shell { grid-template-columns: 1fr; }
  .icon-btn { font-size: 1.5rem; }
  .track-row { grid-template-columns: 2rem 1fr; }
  .track-row.is-reorderable { grid-template-columns: var(--hit) 2rem 1fr; }
  .track-extra { grid-column: 1 / -1; justify-content: flex-end; margin-top: 0.375rem; }
  .now-playing-art-large { width: 33vw; height: 33vw; }
  .detail-header { flex-wrap: nowrap; }
  .detail-art { width: 33%; height: auto; aspect-ratio: 1 / 1; }
  .detail-meta { flex: 1 1 0; min-width: 0; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    overflow-x: auto;
  }
  .brand { margin-bottom: 0; margin-right: 0.75rem; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-footer {
    margin-top: 0;
    margin-left: auto;
    padding-top: 0;
    padding-left: 0.875rem;
    border-top: none;
    border-left: 1px solid var(--border);
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
  }
  .username { max-width: 8rem; }
  .main { padding: 1.25rem; }
  .player-bar {
    grid-template-columns: 3.25rem 1fr auto;
    min-height: auto;
    padding: 0.625rem 0.875rem;
  }
  .player-progress, .player-volume { display: none; }
  .back-to-top { right: 1rem; bottom: 6rem; }
}
