* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

@keyframes icon-spin {
  to { transform: rotate(360deg); }
}

.icon-spin {
  animation: icon-spin 0.9s linear infinite;
  transform-origin: center;
}

/* Wrapper for inline SVG icons — inherits color from parent */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

:root {
  /* Firmium Theme (Default) */
  color-scheme: dark;
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: rgba(255,255,255,0.08);
  --text: #f0f0f0;
  --muted: #888;
  --accent: #e8c97e;
  --accent-dim: rgba(232,201,126,0.15);
  --error: #e06060;
  --font: 'Courier New', monospace;
  --timing: 0.15s;
}

html, body {
  height: 100%;
  width: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#setup {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 2rem;
  background: linear-gradient(135deg, var(--bg) 0%, var(--surface) 100%);
}

.setup-box {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  border-radius: 4px;
}

.setup-box h1 {
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 2rem;
  letter-spacing: -0.5px;
  color: var(--accent);
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="url"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  border-radius: 2px;
  outline: none;
  transition: border-color var(--timing);
}

.field input[type="text"]:focus,
.field input[type="password"]:focus,
.field input[type="url"]:focus {
  border-color: var(--accent);
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.25rem;
}

.field-checkbox input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.field-checkbox label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.5px;
  cursor: pointer;
}

.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: background var(--timing), opacity var(--timing);
  margin-top: 0.5rem;
  touch-action: manipulation;
}

.btn-primary:hover {
  opacity: 0.9;
}

#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  background: var(--bg);
}

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px;
  flex-shrink: 0;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 0;
}

.app-brand .logo {
  font-size: 18px;
  color: var(--accent);
}

.app-brand .server-lbl {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--timing);
  touch-action: manipulation;
}

.nav-btn:hover, .nav-btn.active {
  color: var(--text);
  background: var(--surface2);
}

.nav-btn.active {
  color: var(--accent);
  font-weight: bold;
}

/* On desktop the icon is decorative; hide it to keep the original text-only look */
.nav-icon { display: none; width: 18px; height: 18px; }
.nav-label { display: inline; }

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px;
  font-family: var(--font);
  font-size: 11px;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--timing);
  text-align: center;
}

.logout-btn:hover {
  border-color: var(--error);
  color: var(--error);
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 0;
}

/* Desktop: player bar is always visible, always reserve space */
:not(html.is-mobile-layout) .main-area { padding-bottom: 75px; }

/* Mobile: only reserve space when a track is loaded */
html.is-mobile-layout.has-player .main-area {
  padding-bottom: calc(68px + 56px + env(safe-area-inset-bottom, 0px));
}

.list-panel {
  flex: 1;
  overflow-y: auto;
  padding: 30px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.list-panel::-webkit-scrollbar {
  display: none;
}

.section-header {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 1px;
  margin-top: 10px;
  margin-bottom: 12px;
}

.album-row {
  display: flex;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  gap: 16px;
  transition: background var(--timing);
  touch-action: manipulation;
}

.album-row:hover {
  background: var(--surface);
}

.album-row:active {
  background: var(--surface2);
}

.album-art-sm {
  width: 40px;
  height: 40px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.album-art-sm img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-art-sm .no-art {
  font-size: 16px;
  color: var(--muted);
}

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

.album-title {
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.album-artist {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tracklist-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 0;
}

.tl-art {
  width: 80px;
  height: 80px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  overflow: hidden;
  font-size: 32px;
  color: var(--muted);
  flex-shrink: 0;
}

.tl-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tl-info {
  flex: 1;
  min-width: 0;
}

.tl-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 4px;
}

.tl-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.artist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  cursor: pointer;
  transition: background var(--timing);
  touch-action: manipulation;
}

/* Circular artist photo in the artists list */
.artist-row-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface2);
}

/* Push the album count to the right */
.artist-row .artist-info {
  flex: 1;
  min-width: 0;
}

.artist-row:hover {
  background: var(--surface);
}

.artist-row:active {
  background: var(--surface2);
}

.artist-name {
  font-weight: bold;
  color: var(--text);
}

.artist-album-count {
  font-size: 11px;
  color: var(--muted);
}

.track-row {
  display: flex;
  align-items: center;
  padding: 10px;
  cursor: pointer;
  gap: 16px;
  transition: background var(--timing);
  touch-action: manipulation;
}

.track-row:hover {
  background: var(--surface);
}

.track-row:active {
  background: var(--surface2);
}

.track-row.playing {
  background: var(--accent-dim);
  border-bottom-color: rgba(232,201,126,0.3);
}

.track-row.playing .track-title {
  color: var(--accent);
}

.track-num {
  width: 24px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.track-thumb {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.track-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.track-title {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.track-artist {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-duration {
  font-size: 12px;
  color: var(--muted);
  padding-right: 10px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
}

.search-row input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px;
  font-family: var(--font);
  font-size: 13px;
  border-radius: 4px;
  outline: none;
}

.search-row input:focus {
  border-color: var(--accent);
}

.search-row button {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 20px;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--timing);
}

.search-row button:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.search-results-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 75px;
  background: var(--surface);
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  align-items: center;
  padding: 0 30px;
  z-index: 100;
}


.now-playing {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.np-art {
  width: 44px;
  height: 44px;
  background: var(--bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--muted);
  flex-shrink: 0;
  overflow: hidden;
}

.np-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.np-info {
  flex: 1;
  min-width: 0;
}

.np-title {
  font-weight: bold;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.np-artist {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0 20px;
}

.progress-row .time {
  font-size: 11px;
  color: var(--muted);
  width: 35px;
  flex-shrink: 0;
}

.progress-row .time.right {
  text-align: right;
}

.controls {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  min-width: 0;
}

.ctrl-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: all var(--timing);
  flex-shrink: 0;
  touch-action: manipulation;
}

.ctrl-btn:hover {
  color: var(--text);
  background: var(--surface2);
}

.ctrl-btn.main-ctrl {
  font-size: 20px;
  color: var(--text);
  background: var(--surface2);
  width: 40px;
  height: 40px;
}

.ctrl-btn.main-ctrl:hover {
  background: var(--accent);
  color: #000;
}

.ctrl-btn.secondary-ctrl {
  font-size: 12px;
}

.ctrl-btn.lyrics-btn {
  font-size: 18px;
  padding: 2px;
}


.ctrl-btn.secondary-ctrl.active {
  color: var(--accent);
}

/* Repeat button with optional "1" badge for repeat-one mode */
.repeat-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.repeat-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  font-size: 9px;
  font-weight: bold;
  line-height: 1;
  color: var(--accent);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  background: transparent;
  cursor: pointer;
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  background: var(--surface2);
  border-radius: 10px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: -3px;
  transition: transform var(--timing);
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 4px;
  background: var(--surface2);
  border-radius: 10px;
}

input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--timing);
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
}

.vol-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  width: 75px;
}

input[type="range"].volume-slider {
  width: 55px;
  flex: none;
}

.error-msg {
  color: var(--error);
  font-size: 11px;
  margin-top: 6px;
}

.loading-msg {
  color: var(--muted);
  padding: 16px 8px;
  font-size: 12px;
}

.loading-msg.error-msg {
  color: var(--error);
  padding: 16px 8px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  font-size: 12px;
  gap: 8px;
  letter-spacing: 0.5px;
}

.empty-state .big {
  font-size: 24px;
  color: rgba(255,255,255,0.05);
}


.artist-page-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 0;
}

.artist-img-circle {
  width: 130px;
  height: 130px;
  border-radius: 16px;
  background: var(--surface2);
  object-fit: cover;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 40px;
}

.artist-page-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.artist-page-name {
  font-size: 26px;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 4px;
}

.artist-page-bio {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.play-all-btn {
  align-self: flex-start;
  background: var(--accent);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  font-family: var(--font);
  font-size: 12px;
  text-transform: uppercase;
  transition: opacity var(--timing);
  touch-action: manipulation;
}

.play-all-btn:hover {
  opacity: 0.8;
}

.play-all-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.release-group-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--text);
  margin: 30px 0 15px 0;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border);
}

/* ── Desktop settings two-column layout ──────────────────────────────────── */

.sett-layout {
  display: flex;
  gap: 0;
  min-height: 0;
  height: 100%;
}

/* Left sidebar — fixed-width category list */
.sett-sidebar {
  width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
  border-right: 1px solid var(--border);
}

.sett-sidebar-label {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 8px 6px;
}

/* Category button in the sidebar */
.sett-nav-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background var(--timing), color var(--timing);
}

.sett-nav-btn:hover { background: var(--surface); }
.sett-nav-btn:active { background: var(--surface2); }

.sett-nav-btn--active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: bold;
}

.sett-nav-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.sett-nav-btn--active .sett-nav-icon { opacity: 1; }

/* Right content panel */
.sett-panel {
  flex: 1;
  min-width: 0;
  padding: 0 4px;
  overflow-y: auto;
}

.sett-panel-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--text);
  padding: 16px 10px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* ── Shared settings rows ─────────────────────────────────────────────────── */

.settings-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 15px 10px;
  
}

.settings-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-title {
  font-size: 14px;
  font-weight: bold;
  color: var(--text);
}

.settings-desc {
  font-size: 11px;
  color: var(--muted);
}

.settings-text-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 4px;
  width: 220px;
  align-self: center;
  outline: none;
}
.settings-text-input:focus {
  border-color: var(--accent);
}
.settings-text-input::placeholder {
  color: var(--muted);
}

.settings-row--disabled {
  opacity: 0.4;
  pointer-events: none;
}

.server-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  align-self: center;
}

.server-badge--os {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.server-badge--legacy {
  background: color-mix(in srgb, var(--muted) 20%, transparent);
  color: var(--muted);
  border: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
  align-self: center;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--surface2);
  transition: .2s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--muted);
  transition: .2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
  background-color: #000;
}

.crossfade-duration-control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  align-self: center;
}

.crossfade-duration-control input[type="range"] {
  width: 100px;
  accent-color: var(--accent);
  cursor: pointer;
}

.crossfade-duration-control span {
  font-size: 13px;
  color: var(--text);
  min-width: 24px;
  text-align: right;
}

.debug-btn {
  flex-shrink: 0;
  align-self: center;
  padding: 5px 14px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--timing), border-color var(--timing);
}

.debug-btn:hover {
  background: var(--surface2);
  border-color: var(--accent);
}

.debug-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.debug-btn--danger {
  border-color: color-mix(in srgb, #e05 40%, transparent);
  color: color-mix(in srgb, #e05 80%, var(--text));
}

.debug-btn--danger:hover {
  background: color-mix(in srgb, #e05 15%, transparent);
  border-color: #e05;
}

.debug-path {
  word-break: break-all;
  max-width: 340px;
}

.theme-selector {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 13px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: border-color var(--timing);
}

.theme-selector:hover,
.theme-selector.open {
  border-color: var(--accent);
}

.theme-selector-arrow {
  color: var(--muted);
  font-size: 12px;
  transition: transform var(--timing);
}

.theme-selector.open .theme-selector-arrow {
  transform: rotate(180deg);
}

.theme-selector-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: -1px;
  right: -1px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
  z-index: 100;
  overflow: hidden;
}

.theme-selector.open .theme-selector-dropdown {
  display: block;
}

.theme-option {
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--timing);
}

.theme-option:hover {
  background: var(--surface2);
}

.theme-option.selected {
  color: var(--accent);
}

/* ── Lyrics Panel ─────────────────────────────────────────────────────────── */

.lyrics-panel {
  width: 0;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding-bottom: 75px;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.lyrics-panel.open {
  width: 300px;
  min-width: 300px;
}

.lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  flex-shrink: 0;
}

.lyrics-header-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.lyrics-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--timing);
  padding: 0;
  font-family: var(--font);
}

.lyrics-close:hover {
  color: var(--text);
  background: var(--surface2);
}

.lyrics-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 40px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Status message shown when no lyrics or loading */
.lyrics-status {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 40px 0;
  line-height: 1.7;
}

/* Individual lyric line — default state is future/upcoming */
.lyric-line {
  font-size: 14px;
  color: var(--muted);
  padding: 7px 0;
  line-height: 1.55;
  opacity: 0.55;
  transition: color 0.3s ease, font-size 0.25s ease, opacity 0.3s ease, font-weight 0.25s ease;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Currently playing line */
.lyric-line.active {
  color: var(--accent);
  font-size: 19px;
  font-weight: bold;
  opacity: 1;
  letter-spacing: -0.2px;
}

/* Already-played lines */
.lyric-line.past {
  opacity: 0.3;
}

/* About to play (next few lines) */
.lyric-line.upcoming {
  opacity: 0.65;
}

/* Unsynced plain-text lyrics — no highlighting, just show the text */
.lyric-line.unsynced {
  opacity: 0.8;
  font-size: 14px;
  color: var(--text);
}

/* Empty instrumental lines rendered as a subtle spacer glyph */
.lyric-line.empty-line {
  opacity: 0.2;
  font-size: 12px;
  text-align: center;
  letter-spacing: 4px;
}

/* ── Playlist add button on track rows ────────────────────────────────────── */

.track-add-btn,
.track-remove-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 16px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--timing), color var(--timing), border-color var(--timing), background var(--timing);
  font-family: var(--font);
  line-height: 1;
}

.track-row:hover .track-add-btn,
.track-row:hover .track-remove-btn {
  opacity: 1;
}

.track-add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.track-remove-btn {
  font-size: 14px;
}

.track-remove-btn:hover {
  color: var(--error);
  border-color: var(--error);
  background: rgba(224, 96, 96, 0.12);
}

/* ── Album add button ─────────────────────────────────────────────────────── */

.album-add-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 16px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--timing), color var(--timing), border-color var(--timing), background var(--timing);
  font-family: var(--font);
  line-height: 1;
  margin-right: 4px;
}

.album-row:hover .album-add-btn {
  opacity: 1;
}

.album-add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Playlist add popup menu ─────────────────────────────────────────────── */

.pl-popup {
  position: fixed;
  z-index: 9999;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 200px;
  max-width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 6px 0;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.95);
  transform-origin: top left;
  transition: opacity 0.1s ease, transform 0.1s ease;
}

.pl-popup--visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

.pl-popup-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  padding: 6px 14px 8px;
  
  margin-bottom: 4px;
}

.pl-popup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: background var(--timing);
  gap: 8px;
}

.pl-popup-item:hover {
  background: var(--surface2);
}

.pl-popup-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pl-popup-count {
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
}

.pl-popup-empty {
  padding: 8px 14px;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

.pl-popup-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.pl-popup-create {
  color: var(--accent);
}

.pl-popup-input {
  width: calc(100% - 28px);
  margin: 4px 14px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  font-family: var(--font);
  font-size: 12px;
  border-radius: 3px;
  outline: none;
  display: block;
}

.pl-popup-input:focus {
  border-color: var(--accent);
}

.pl-popup-actions {
  display: flex;
  gap: 6px;
  padding: 0 14px 8px;
}

.pl-popup-btn {
  flex: 1;
  padding: 6px;
  font-family: var(--font);
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  transition: background var(--timing), color var(--timing), border-color var(--timing);
}

.pl-popup-confirm {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.pl-popup-confirm:hover {
  opacity: 0.85;
}

.pl-popup-cancel:hover {
  background: var(--surface);
}

/* ── Playlists list view ─────────────────────────────────────────────────── */

.pl-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pl-new-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 6px 14px;
  font-family: var(--font);
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  transition: background var(--timing), border-color var(--timing);
}

.pl-new-btn:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.pl-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.pl-empty-icon {
  font-size: 48px;
  opacity: 0.4;
}

.pl-card {
  display: flex;
  align-items: center;
  padding: 12px 10px;
  cursor: pointer;
  gap: 16px;
  transition: background var(--timing);
  touch-action: manipulation;
}

.pl-card:hover {
  background: var(--surface);
}

.pl-card:active {
  background: var(--surface2);
}

.pl-card-art {
  width: 48px;
  height: 48px;
  background: var(--surface2);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pl-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.pl-card-name {
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.pl-card-meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Playlist detail view ────────────────────────────────────────────────── */

.pl-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 16px;
  padding-bottom: 0;
}

.pl-detail-art {
  position: relative;
  width: 120px;
  height: 120px;
  background: var(--surface2);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--muted);
}

.pl-detail-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pl-detail-art-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 11px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0;
  transition: opacity var(--timing);
}

.pl-detail-art:hover .pl-detail-art-overlay {
  opacity: 1;
}

.pl-detail-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.pl-detail-name {
  font-size: 22px;
  font-weight: bold;
  color: var(--text);
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid transparent;
  transition: border-color var(--timing);
}

.pl-detail-name:hover {
  border-bottom-color: var(--border);
}

.pl-detail-desc {
  font-size: 12px;
  color: var(--muted);
  cursor: text;
  border-bottom: 1px solid transparent;
  transition: border-color var(--timing);
  min-height: 18px;
}

.pl-detail-desc:hover {
  border-bottom-color: var(--border);
}

.pl-detail-desc-hint {
  color: var(--border);
  font-style: italic;
}

.pl-detail-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.pl-detail-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}

.pl-delete-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 14px;
  font-family: var(--font);
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  transition: all var(--timing);
}

.pl-delete-btn:hover {
  border-color: var(--error);
  color: var(--error);
}

/* ── Playlist cover picker ───────────────────────────────────────────────── */

.pl-cover-picker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 24px;
}

.pl-cover-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.pl-cover-upload-label {
  cursor: pointer;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 3px;
  font-size: 11px;
  transition: background var(--timing);
}

.pl-cover-upload-label:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.pl-cover-file-input {
  display: none;
}

.pl-cover-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pl-cover-option {
  width: 52px;
  height: 52px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color var(--timing), transform var(--timing);
  flex-shrink: 0;
}

.pl-cover-option:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.pl-cover-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pl-cover-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ── Inline edit fields ──────────────────────────────────────────────────── */

.pl-inline-edit {
  font-size: 22px;
  font-weight: bold;
  font-family: var(--font);
  background: var(--surface2);
  border: 1px solid var(--accent);
  color: var(--text);
  border-radius: 3px;
  padding: 2px 8px;
  outline: none;
  width: 100%;
}

.pl-inline-edit--desc {
  font-size: 12px;
  font-weight: normal;
}

/* ── Home View ───────────────────────────────────────────────────────────── */

.home-view {
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.home-greeting {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 16px;
}

.home-greeting-label {
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.home-greeting-name {
  font-size: 28px;
  font-weight: bold;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.home-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.home-loading,
.home-empty {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 0;
}

/* Horizontal scrollable card row */
.home-scroll-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.home-scroll-row::-webkit-scrollbar {
  display: none;
}

/* Individual card */
.home-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 110px;
  flex-shrink: 0;
  cursor: pointer;
  transition: opacity var(--timing), transform var(--timing);
  touch-action: manipulation;
}

.home-card:hover {
  opacity: 0.8;
}

.home-card:active {
  opacity: 0.6;
  transform: scale(0.97);
}

.home-card-art {
  width: 110px;
  height: 110px;
  background: var(--surface2);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Rounded box art for artist cards */
.home-card-art--round {
  border-radius: 12px;
}

.home-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.home-card-no-art {
  font-size: 24px;
  color: var(--muted);
  opacity: 0.5;
}

.home-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 2px;
}

.home-card-title {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: bold;
}

.home-card-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Track card — slightly wider to fit title */
.home-card--track {
  width: 110px;
}

/* Artist card is same size but uses round art */
.home-card--artist {
  width: 100px;
}

.home-card--artist .home-card-art {
  width: 100px;
  height: 100px;
}

/* Genre chips */
.home-genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-genre-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 20px;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--timing), border-color var(--timing), color var(--timing);
  white-space: nowrap;
  touch-action: manipulation;
}

.home-genre-chip:active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.home-genre-chip:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.home-genre-count {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}

/* ── Mobile layout (phone viewport or Android device) ────────────────────── */
/* Applied via JS: html.is-mobile-layout is set when isMobile || viewport ≤ 640px */

html.is-mobile-layout body {
  font-size: 14px;
  padding-top: env(safe-area-inset-top, 24px);
}

/* Empty buffer bar that fills the system status bar area */
html.is-mobile-layout #app::before {
  content: '';
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 24px);
  background: var(--surface);
  z-index: 200;
}

/* Sidebar becomes a fixed bottom tab bar */
html.is-mobile-layout .sidebar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  /* Grow to include the system nav bar area so buttons stay in the 56px content zone */
  height: calc(56px + env(safe-area-inset-bottom, 0px));
  flex-direction: row;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-right: none;
  border-top: 1px solid var(--border);
  z-index: 101;
  overflow: hidden;
  align-items: stretch;
}

html.is-mobile-layout .app-brand { display: none; }
html.is-mobile-layout .logout-btn { display: none; }

html.is-mobile-layout .nav-links {
  flex-direction: row;
  flex: 1;
  gap: 0;
  align-items: stretch;
}

html.is-mobile-layout .nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px 2px;
  font-size: 8px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  text-align: center;
}

html.is-mobile-layout .nav-btn.active {
  border-bottom-color: var(--accent);
  background: none;
}

html.is-mobile-layout .nav-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
}

html.is-mobile-layout .nav-label {
  display: none;
}

/* Main area — full width, base padding clears just the tab bar */
html.is-mobile-layout .main-area {
  width: 100%;
  padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
}

/* Fix: 100vh overflows the body's padded content box on mobile, clipping the bottom */
html.is-mobile-layout #app {
  height: 100%;
}

html.is-mobile-layout .list-panel { padding: 16px; }

/* Player bar — 2-row compact layout, above the bottom tab bar */
html.is-mobile-layout .player-bar {
  bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  height: auto;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  padding: 8px 12px 6px;
  gap: 4px 8px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  touch-action: manipulation;
}

html.is-mobile-layout .now-playing {
  grid-column: 1;
  grid-row: 1;
  gap: 10px;
  min-width: 0;
}

html.is-mobile-layout .controls {
  grid-column: 2;
  grid-row: 1;
  justify-content: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

html.is-mobile-layout .progress-row {
  grid-column: 1 / -1;
  grid-row: 2;
  padding: 0;
}

html.is-mobile-layout .vol-row { display: none; }

html.is-mobile-layout .ctrl-btn {
  width: 28px;
  height: 28px;
  font-size: 14px;
}

html.is-mobile-layout .ctrl-btn.main-ctrl {
  width: 36px;
  height: 36px;
  font-size: 18px;
}

/* Lyrics panel → full-screen overlay, above MobilePlayer (z-index 300) */
html.is-mobile-layout .lyrics-panel.open {
  position: fixed;
  inset: 0;
  width: 100%;
  min-width: unset;
  z-index: 400;
  padding-bottom: calc(68px + 56px + env(safe-area-inset-bottom, 0px));
}

/* Spacer that reserves the status bar / notch area at the top of the full-screen
   lyrics panel; resolves to zero on desktop where there is no safe area inset. */
.lyrics-safe-top {
  height: 0;
  flex-shrink: 0;
}

html.is-mobile-layout .lyrics-panel.open .lyrics-safe-top {
  height: env(safe-area-inset-top, 24px);
}

html.is-mobile-layout .artist-page-header { flex-direction: column; gap: 16px; }
html.is-mobile-layout .artist-img-circle { width: 100px; height: 100px; }
html.is-mobile-layout .tracklist-header { flex-direction: column; align-items: flex-start; gap: 12px; }
html.is-mobile-layout .tl-art { width: 64px; height: 64px; font-size: 24px; }
html.is-mobile-layout .pl-detail-header { flex-direction: column; gap: 12px; }
html.is-mobile-layout .settings-row { flex-direction: column; gap: 10px; align-items: flex-start; }
html.is-mobile-layout .settings-text-input { width: 100%; }
html.is-mobile-layout .home-view { padding: 16px; gap: 24px; }
html.is-mobile-layout .home-greeting-name { font-size: 22px; }
html.is-mobile-layout .home-card { width: 130px; }
html.is-mobile-layout .home-card-art { width: 130px; height: 130px; }
html.is-mobile-layout .home-card--artist { width: 110px; }
html.is-mobile-layout .home-card--artist .home-card-art { width: 110px; height: 110px; }
html.is-mobile-layout .track-row { padding: 14px 10px; }

/* Always show action buttons — no hover state on touch screens */
html.is-mobile-layout .track-add-btn,
html.is-mobile-layout .track-remove-btn,
html.is-mobile-layout .album-add-btn { opacity: 1; }

html.is-mobile-layout #setup { padding: 1rem; }
html.is-mobile-layout .setup-box { padding: 1.5rem; }

/* ── Full-screen mobile player overlay ───────────────────────────────────── */

.mp-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 28px calc(28px + env(safe-area-inset-bottom, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  overflow-y: auto;
  animation: mp-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes mp-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

/* .mp-closing re-enables the transition so dragOffset animates to window.innerHeight */
.mp-closing {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.8, 1) !important;
}

/* Top bar: drag handle centred, close chevron pinned right */
.mp-topbar {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 14px 0 16px;
}

.mp-close-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--timing);
}

.mp-close-btn:active { background: var(--surface2); }

/* Legacy handle-row kept for backward compat but now inside mp-topbar */
.mp-handle-row {
  display: flex;
  justify-content: center;
  flex-shrink: 0;
}

.mp-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.mp-art {
  width: min(72vw, 320px);
  height: min(72vw, 320px);
  background: var(--surface2);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 32px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
}

.mp-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mp-no-art {
  font-size: 72px;
  color: var(--muted);
  opacity: 0.3;
}

.mp-info {
  width: 100%;
  text-align: center;
  margin-bottom: 28px;
  padding: 0 8px;
}

.mp-title {
  font-size: 20px;
  font-weight: bold;
  color: var(--text);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-artist {
  font-size: 14px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mp-progress {
  width: 100%;
  margin-bottom: 28px;
  position: relative;
}

/* Visual progress track */
.mp-progress-track {
  width: 100%;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
  pointer-events: none;
}

.mp-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.75s linear;
}

/* Invisible range input layered on top for touch interaction */
.mp-seek-input {
  position: absolute;
  top: -8px;
  left: 0;
  width: 100%;
  opacity: 0;
  height: 20px;
  cursor: pointer;
}

.mp-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.mp-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.mp-secondary {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.mp-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 30px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--timing), transform var(--timing);
  font-family: var(--font);
  flex-shrink: 0;
  touch-action: manipulation;
}

.mp-btn:active {
  background: var(--surface2);
  transform: scale(0.93);
}

.mp-btn-main {
  font-size: 28px;
  width: 72px;
  height: 72px;
  background: var(--accent);
  /* Use bg color so icon contrasts regardless of accent hue */
  color: var(--bg);
}

.mp-btn-main:active {
  opacity: 0.8;
  background: var(--accent);
}

.mp-btn-sm {
  font-size: 16px;
  width: 48px;
  height: 48px;
  color: var(--muted);
  position: relative;
}

.mp-btn-sm.active { color: var(--accent); }

.mp-repeat-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 10px;
  font-weight: bold;
  color: var(--accent);
  line-height: 1;
}

.mp-volume {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px;
}

.mp-vol-icon {
  font-size: 16px;
  flex-shrink: 0;
  color: var(--muted);
}

.mp-volume input[type="range"] {
  flex: 1;
}

/* ── Marquee animation for overflowing track title / artist ───────────────── */

@keyframes mp-marquee {
  0%, 18%   { transform: translateX(0); }
  75%, 100% { transform: translateX(var(--marquee-dist, 0px)); }
}

.mp-title.mp-marquee,
.mp-artist.mp-marquee {
  animation: mp-marquee 5s ease-in-out infinite alternate;
  /* Remove ellipsis so text can scroll fully */
  text-overflow: clip;
}

/* ── Mini-player mobile overrides ─────────────────────────────────────────── */

/* Hide prev and secondary controls in the mini-player — full controls live in
   the expanded MobilePlayer overlay. Keep only play + next. */
html.is-mobile-layout .player-bar .prev-ctrl,
html.is-mobile-layout .player-bar .secondary-ctrl {
  display: none;
}

/* Remove the progress strip from the mini-player bar on mobile */
html.is-mobile-layout .player-bar .progress-row {
  display: none;
}

html.is-mobile-layout .player-bar {
  grid-template-rows: auto;
}

/* Make the progress row a thin visual-only strip — no times, no seek handle */
html.is-mobile-layout .player-bar .progress-row .time {
  display: none;
}

html.is-mobile-layout .player-bar .progress-row input[type="range"] {
  pointer-events: none;
  height: 3px;
  appearance: none;
  -webkit-appearance: none;
  background: linear-gradient(
    to right,
    var(--accent) var(--pct, 0%),
    var(--surface2) var(--pct, 0%)
  );
  border-radius: 2px;
  flex: 1;
}

html.is-mobile-layout .player-bar .progress-row input[type="range"]::-webkit-slider-thumb {
  display: none;
}

html.is-mobile-layout .player-bar .progress-row input[type="range"]::-moz-range-thumb {
  display: none;
}

/* ── Queue sheet ──────────────────────────────────────────────────────────── */

.qs-overlay {
  position: fixed;
  inset: 0;
  top: 25%;
  background: var(--surface);
  z-index: 350;
  display: flex;
  flex-direction: column;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  animation: mp-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
}

.qs-closing {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.8, 1) !important;
}

.qs-handle-row {
  display: flex;
  justify-content: center;
  padding: 12px 0 6px;
  flex-shrink: 0;
}

.qs-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
}

.qs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 20px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}

.qs-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--text);
}

.qs-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--timing);
}

.qs-close-btn:active { background: var(--surface2); }

.qs-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.qs-empty {
  padding: 32px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.qs-track {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text);
  font-family: var(--font);
  transition: background var(--timing);
  border-bottom: 1px solid var(--border);
}

.qs-track:active { background: var(--surface2); }

.qs-track-active {
  background: var(--surface2);
}

.qs-track-active .qs-track-title {
  color: var(--accent);
}

.qs-track-index {
  font-size: 13px;
  color: var(--muted);
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.qs-track-active .qs-track-index {
  color: var(--accent);
}

.qs-track-info {
  flex: 1;
  min-width: 0;
}

.qs-track-title {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.qs-track-artist {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.qs-track-dur {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Mobile page header ───────────────────────────────────────────────────── */

.mobile-page-header {
  display: none;
}

html.is-mobile-layout .mobile-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
  background: var(--bg);
  flex-shrink: 0;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.mobile-page-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--text);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-page-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.mobile-header-btn {
  background: none;
  border: none;
  color: var(--muted);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  transition: background var(--timing), color var(--timing);
  touch-action: manipulation;
}

.mobile-header-btn:active {
  background: var(--surface2);
  color: var(--text);
}

/* list-panel sits below the mobile-page-header in the flex column */
html.is-mobile-layout .list-panel {
  padding-top: 12px;
}

/* ── Mobile search overlay ────────────────────────────────────────────────── */

.ms-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  animation: ms-slide-in 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.ms-overlay.ms-closing {
  animation: ms-slide-out 0.28s cubic-bezier(0.4, 0, 0.8, 1) forwards;
}

@keyframes ms-slide-in {
  from { transform: translateY(100%); opacity: 0.6; }
  to   { transform: translateY(0);    opacity: 1; }
}

@keyframes ms-slide-out {
  from { transform: translateY(0);    opacity: 1; }
  to   { transform: translateY(100%); opacity: 0.6; }
}

.ms-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ms-back-btn {
  background: none;
  border: none;
  color: var(--text);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background var(--timing);
}

.ms-back-btn:active { background: var(--surface2); }

.ms-input-wrap {
  flex: 1;
  min-width: 0;
}

.ms-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 16px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color var(--timing);
  -webkit-appearance: none;
  appearance: none;
}

.ms-input::placeholder { color: var(--muted); }
.ms-input:focus { border-color: var(--accent); }
/* Remove the native clear/search decoration */
.ms-input::-webkit-search-cancel-button { display: none; }

.ms-search-exec {
  background: none;
  border: none;
  color: var(--accent);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background var(--timing);
}

.ms-search-exec:active { background: var(--surface2); }

.ms-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
}

.ms-status {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

.ms-error { color: var(--error); }

.ms-hint {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  opacity: 0.7;
}

/* ── Mobile settings overlay ──────────────────────────────────────────────── */

.mset-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  animation: ms-slide-in 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.mset-overlay.mset-closing {
  animation: ms-slide-out 0.28s cubic-bezier(0.4, 0, 0.8, 1) forwards;
}

.mset-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mset-back-btn {
  background: none;
  border: none;
  color: var(--text);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 50%;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background var(--timing);
}

.mset-back-btn:active { background: var(--surface2); }

.mset-title {
  font-size: 18px;
  font-weight: bold;
  color: var(--text);
}

.mset-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Mobile settings: category list (folder rows) ─────────────────────────── */

.mset-cat-list {
  display: flex;
  flex-direction: column;
}

/* Each category row looks like a folder entry */
.mset-cat-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  touch-action: manipulation;
  transition: background var(--timing);
}

.mset-cat-row:first-child { border-top: 1px solid var(--border); }
.mset-cat-row:active { background: var(--surface2); }

.mset-cat-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.mset-cat-label {
  flex: 1;
  font-size: 15px;
  color: var(--text);
}

.mset-cat-chevron {
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Mobile settings: sub-panel slide-in ─────────────────────────────────── */

/* Sub-panel slides in from the right when a category is selected */
.mset-subpanel {
  opacity: 0;
  transform: translateX(32px);
}

.mset-subpanel--in {
  animation: mset-slide-in 0.22s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes mset-slide-in {
  from { opacity: 0.4; transform: translateX(40px); }
  to   { opacity: 1;   transform: translateX(0);    }
}

/* Category list fades in when returning from a sub-panel */
.mset-cat-list {
  animation: mset-fade-in 0.18s ease forwards;
}

@keyframes mset-fade-in {
  from { opacity: 0; transform: translateX(-20px); }
  to   { opacity: 1; transform: translateX(0);     }
}

/* ── Mobile play-all circle button ────────────────────────────────────────── */

.mobile-play-circle-btn {
  display: none;
}

html.is-mobile-layout .mobile-play-circle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: opacity var(--timing), transform var(--timing);
  margin-left: auto;
}

html.is-mobile-layout .mobile-play-circle-btn:active {
  opacity: 0.8;
  transform: scale(0.93);
}

/* Position within tracklist-header / pl-detail-actions */
html.is-mobile-layout .tracklist-header {
  position: relative;
  align-items: center;
}

html.is-mobile-layout .pl-detail-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Responsive font / spacing tweaks ─────────────────────────────────────── */

/* Small phones (< 375px) get slightly tighter spacing */
@media (max-width: 374px) {
  html.is-mobile-layout .mp-art {
    width: min(80vw, 280px);
    height: min(80vw, 280px);
    margin-bottom: 20px;
  }
  html.is-mobile-layout .mp-info {
    margin-bottom: 18px;
  }
  html.is-mobile-layout .mp-progress {
    margin-bottom: 18px;
  }
  html.is-mobile-layout .mp-secondary {
    gap: 16px;
  }
  html.is-mobile-layout .home-card {
    width: 110px;
  }
  html.is-mobile-layout .home-card-art {
    width: 110px;
    height: 110px;
  }
}

/* Wider phones (> 430px) can use a bit more space */
@media (min-width: 430px) and (max-width: 640px) {
  html.is-mobile-layout .home-card {
    width: 150px;
  }
  html.is-mobile-layout .home-card-art {
    width: 150px;
    height: 150px;
  }
  html.is-mobile-layout .home-card--artist {
    width: 130px;
  }
  html.is-mobile-layout .home-card--artist .home-card-art {
    width: 130px;
    height: 130px;
  }
}