:root {
  --bg: #0a0e0c;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --surface-active: rgba(214, 177, 123, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(214, 177, 123, 0.35);
  --text: #f0ebe4;
  --text-secondary: #9a9189;
  --accent: #d6b17b;
  --accent-glow: rgba(214, 177, 123, 0.2);
  --good: #7cc49a;
  --danger: #d4796a;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-full: 999px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --sidebar-width: 380px;
}

* {
  box-sizing: border-box;
  margin: 0;
}

html, body {
  height: 100%;
}

body {
  color: var(--text);
  background:
    radial-gradient(ellipse at top left, rgba(214, 177, 123, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at bottom right, rgba(214, 177, 123, 0.06) 0%, transparent 50%),
    linear-gradient(160deg, #0d0a06 0%, #0a0804 30%, #050403 60%, #000000 100%);
  background-attachment: fixed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.6s ease;
}

button, input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

input[type="range"] {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a, button, input, [role="tab"] {
  -webkit-touch-callout: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ── Ambient blobs ── */

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  pointer-events: none;
  animation: drift 20s ease-in-out infinite alternate;
}

.ambient-one {
  width: 500px;
  height: 500px;
  top: -100px;
  left: -100px;
  background: var(--accent);
}

.ambient-two {
  width: 400px;
  height: 400px;
  bottom: -80px;
  right: -80px;
  background: #a0882e;
  animation-duration: 25s;
  animation-direction: alternate-reverse;
}

/* ── App shell ── */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Topbar ── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  background: rgba(5, 4, 2, 0.7);
  transition: opacity var(--transition), transform var(--transition);
}

.brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--surface);
}

.btn-zen {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}

.btn-zen:hover {
  color: var(--accent);
  background: var(--surface);
}

.btn-zen .zen-icon-exit { display: none; }
body.zen .btn-zen .zen-icon-enter { display: none; }
body.zen .btn-zen .zen-icon-exit { display: block; }
body.zen .btn-zen {
  color: var(--accent);
}

/* ── Content layout ── */

.content {
  display: flex;
  flex: 1;
  min-height: 0;
  transition: all var(--transition);
}

/* ── Player section ── */

.player {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.player-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  max-width: 480px;
  text-align: center;
}

/* ── Track info ── */

.player-info {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.player-playlist {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 600;
}

.player-title {
  font-size: clamp(1.4rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.player-meta {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.player-path {
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0.6;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Timeline / progress ── */

.player-timeline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.time-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 3rem;
}

#progressBar, #volumeSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: height 0.15s ease;
  padding: 10px 0;
  margin: -10px 0;
  background-clip: content-box;
}

#progressBar:hover, #volumeSlider:hover,
#progressBar:active, #volumeSlider:active {
  height: 6px;
}

#progressBar::-webkit-slider-thumb,
#volumeSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
  box-shadow: 0 0 10px var(--accent-glow);
  transition: transform 0.15s ease;
}

#progressBar::-webkit-slider-thumb:hover,
#volumeSlider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
}

#progressBar:active::-webkit-slider-thumb,
#volumeSlider:active::-webkit-slider-thumb {
  transform: scale(1.4);
}

#progressBar::-moz-range-thumb,
#volumeSlider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  border: 0;
}

/* ── Transport controls ── */

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

.btn-transport {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition), transform 0.15s ease;
}

.btn-transport:hover {
  color: var(--text);
  background: var(--surface);
  transform: scale(1.08);
}

.btn-transport:active {
  transform: scale(0.92);
  background: var(--surface-hover);
}

.btn-shuffle[aria-pressed="true"] {
  color: var(--accent);
  background: var(--surface-active);
}

.btn-play {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 8px 30px var(--accent-glow);
  transition: transform 0.15s ease, box-shadow var(--transition);
  margin: 0 0.5rem;
}

.btn-play:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(214, 177, 123, 0.35);
}

.btn-play:active {
  transform: scale(0.95);
}

.btn-play .icon-pause { display: none; }
body.playing .btn-play .icon-play { display: none; }
body.playing .btn-play .icon-pause { display: block; }

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: 0.75rem;
}

.vol-icon {
  color: var(--text-secondary);
  flex-shrink: 0;
}

.volume-wrap input {
  width: 80px;
}

/* ── Sidebar ── */

.sidebar {
  width: var(--sidebar-width);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: rgba(10, 14, 12, 0.5);
  backdrop-filter: blur(20px);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.4s ease,
              transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab {
  flex: 1;
  padding: 0.85rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

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

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-count {
  font-size: 0.68rem;
  background: var(--surface);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.tab.active .tab-count {
  background: var(--surface-active);
  color: var(--accent);
}

/* ── Tab panels ── */

.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 0.75rem;
  gap: 0.5rem;
}

.tab-panel.active {
  display: flex;
}

/* ── Scroll lists ── */

.scroll-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.scroll-list::-webkit-scrollbar {
  width: 4px;
}

.scroll-list::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius-full);
}

/* ── Playlist items ── */

.playlist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
  width: 100%;
  min-height: 48px;
  transition: background var(--transition), border-color var(--transition);
}

.playlist-item:hover {
  background: var(--surface);
}

.playlist-item.active {
  background: var(--surface-active);
  border-color: var(--border-accent);
}

.playlist-item strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.playlist-item span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.badge {
  font-size: 0.72rem;
  background: var(--surface);
  color: var(--text-secondary);
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ── Queue rows ── */

.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  min-height: 48px;
  transition: background var(--transition), border-color var(--transition);
}

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

.queue-row.active {
  background: var(--surface-active);
  border-color: var(--border-accent);
}

.queue-main strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-main span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-main {
  min-width: 0;
  flex: 1;
}

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

.btn-queue-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  padding: 0;
}

.btn-queue-icon:hover {
  background: var(--border);
  color: var(--text);
}

.btn-queue-remove:hover {
  color: var(--danger);
}

/* ── Library rows ── */

.library-row {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

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

.library-row.added {
  background: rgba(124, 196, 154, 0.07);
  border-left: 3px solid var(--good);
}

.library-row.added strong {
  color: var(--good);
}

.library-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.library-main {
  min-width: 0;
  flex: 1;
}

.library-main strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-main span {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.btn-expand {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

.btn-expand:hover {
  background: var(--border);
  color: var(--text-primary);
}

.library-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding-top: 0.4rem;
}

.library-actions.hidden {
  display: none;
}

.source-chip {
  display: none;
}

.library-bulk {
  padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

/* ── History rows ── */

.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

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

.history-main {
  min-width: 0;
  flex: 1;
}

.history-main strong {
  display: block;
  font-size: 0.86rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-main span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.12rem;
}

.history-date {
  font-size: 0.68rem;
  color: var(--accent);
  margin-top: 0.2rem;
}

/* ── Playlist picker modal ── */

.picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.picker-overlay.hidden {
  display: none;
}

.picker-dialog {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 380px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
}

.picker-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.picker-create {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.picker-create input {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
}

.picker-list {
  overflow-y: auto;
  padding: 0.5rem;
}

.picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  font-size: 0.85rem;
  color: var(--text);
}

.picker-item:hover {
  background: var(--surface-hover);
}

.picker-item .picker-count {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ── Small buttons ── */

.small-button, .danger-button {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  min-height: 36px;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

.small-button:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.small-button:active, .danger-button:active {
  transform: scale(0.95);
}

.small-button[disabled] {
  opacity: 0.4;
  cursor: default;
}

.danger-button {
  background: rgba(212, 121, 106, 0.08);
  color: var(--danger);
  border-color: rgba(212, 121, 106, 0.15);
}

.danger-button:hover {
  background: rgba(212, 121, 106, 0.15);
}

/* ── Forms ── */

.create-form {
  display: flex;
  gap: 0.4rem;
}

.create-form input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.create-form input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-create {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--accent);
  border: 1px solid var(--border);
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}

.btn-create:hover {
  background: var(--surface-active);
  border-color: var(--border-accent);
}

.btn-text {
  font-size: 0.76rem;
  color: var(--text-secondary);
  padding: 0.4rem 0;
  transition: color var(--transition);
}

.btn-text:hover {
  color: var(--accent);
}

.search-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-input:focus {
  border-color: var(--border-accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.helper-text {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Empty state ── */

.empty-state {
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ── Toast ── */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-full);
  background: rgba(10, 14, 12, 0.92);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  font-size: 0.85rem;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  white-space: nowrap;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
}

.noscript {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background: rgba(212, 121, 106, 0.15);
  color: #ffdcd4;
  text-align: center;
}

/* ── Zen mode ── */

body.zen .topbar {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  position: absolute;
}

body.zen .topbar:hover,
body.zen .topbar:focus-within {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

body.zen .sidebar {
  width: 0;
  opacity: 0;
  overflow: hidden;
  border-left-color: transparent;
  pointer-events: none;
}

body.zen .player {
  padding: 0;
}

body.zen .player-inner {
  max-width: 560px;
}

body.zen .player-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

body.zen {
  background:
    radial-gradient(ellipse at top left, rgba(214, 177, 123, 0.04) 0%, transparent 40%),
    radial-gradient(ellipse at bottom right, rgba(214, 177, 123, 0.03) 0%, transparent 40%),
    linear-gradient(160deg, #080600 0%, #050400 30%, #030200 60%, #000000 100%);
}

body.zen .ambient {
  opacity: 0.08;
}

/* Zen exit floating button */
.zen-exit-btn {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  place-items: center;
  z-index: 60;
  transition: color var(--transition), background var(--transition), opacity var(--transition);
  opacity: 0.5;
}

.zen-exit-btn:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.12);
  opacity: 1;
}

body.zen .zen-exit-btn {
  display: grid;
}

/* ── Animations ── */

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(20px, -20px) scale(1.1); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.15); }
  50% { box-shadow: 0 20px 80px rgba(214,177,123,0.25), inset 0 1px 0 rgba(255,255,255,0.15), 0 0 50px rgba(214,177,123,0.15); }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.app {
  animation: fade-in 0.5s ease;
}

/* ── Responsive ── */

@media (max-width: 900px) {
  :root {
    --sidebar-width: 100%;
  }

  .content {
    flex-direction: column;
    position: relative;
  }

  .player {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1rem 0.75rem;
    padding-top: calc(1rem + env(safe-area-inset-top, 0px));
    padding-bottom: 60px;
  }

  .player-inner {
    gap: 0.6rem;
    max-width: 400px;
  }

  .player-info {
    gap: 0.15rem;
  }

  .player-playlist {
    font-size: 0.65rem;
  }

  .player-title {
    font-size: clamp(1.1rem, 3vw, 1.5rem);
  }

  .player-meta {
    font-size: 0.78rem;
  }

  .player-path {
    font-size: 0.65rem;
  }

  .player-transport {
    gap: 0.15rem;
  }

  .btn-transport {
    width: 44px;
    height: 44px;
  }

  .btn-play {
    width: 56px;
    height: 56px;
  }

  /* ── Bottom sheet sidebar ── */
  .sidebar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    height: 52px;
    max-height: 70vh;
    z-index: 20;
    background: rgba(5, 4, 2, 0.92);
    backdrop-filter: blur(24px);
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .sidebar.expanded {
    height: 70vh;
  }

  .sidebar-tabs {
    flex-shrink: 0;
    position: relative;
  }

  .sidebar-tabs::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: none;
    transition: opacity var(--transition);
  }

  .sidebar.expanded .sidebar-tabs::before {
    opacity: 0.5;
  }

  .tab {
    padding: 0.85rem 0.5rem;
    font-size: 0.78rem;
  }

  .tab-panel {
    overflow-y: auto;
  }

  .scroll-list {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .queue-row, .playlist-item, .library-row {
    min-height: 52px;
  }

  body.zen .sidebar {
    height: 0;
    border-top-color: transparent;
    pointer-events: none;
  }

  body.zen .cover-orb {
    display: none;
  }

  body.zen .player {
    padding-bottom: 0;
  }

  body.zen .player-inner {
    gap: 1rem;
  }

  .volume-wrap {
    display: none;
  }

  .topbar {
    padding: 0.6rem 1rem;
    padding-top: calc(0.6rem + env(safe-area-inset-top, 0px));
  }

  .toast {
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }

  .sidebar.expanded ~ .toast,
  .toast {
    z-index: 101;
  }
}

@media (max-width: 480px) {
  .player {
    padding: 0.5rem 0.75rem 0.4rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    padding-bottom: 56px;
  }

  .cover-orb {
    display: none;
  }

  .player-inner {
    gap: 0.45rem;
  }

  .player-title {
    font-size: 1.05rem;
  }

  .player-meta {
    font-size: 0.75rem;
  }

  .player-timeline {
    gap: 0.4rem;
  }

  .player-path {
    display: none;
  }

  .btn-play {
    width: 52px;
    height: 52px;
    margin: 0 0.2rem;
  }

  .btn-transport {
    width: 40px;
    height: 40px;
  }

  .sidebar {
    height: 48px;
  }

  .sidebar.expanded {
    height: 75vh;
  }

  body.zen .cover-orb {
    display: none;
  }

  body.zen .player-title {
    font-size: clamp(1.2rem, 5vw, 1.6rem);
  }

  .small-button, .danger-button {
    padding: 0.45rem 0.7rem;
    font-size: 0.72rem;
    min-height: 34px;
  }

  .tab-panel {
    padding: 0.5rem;
  }

  .tab {
    padding: 0.75rem 0.4rem;
    font-size: 0.75rem;
  }

  .sidebar-tabs {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(5, 4, 2, 0.92);
    backdrop-filter: blur(12px);
  }

  .toast {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
  }
}

/* ── Touch-specific ── */

@media (pointer: coarse) {
  #progressBar::-webkit-slider-thumb,
  #volumeSlider::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }

  #progressBar::-moz-range-thumb,
  #volumeSlider::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }

  #progressBar, #volumeSlider {
    height: 5px;
    padding: 14px 0;
    margin: -14px 0;
  }

  .btn-transport {
    width: 50px;
    height: 50px;
  }

  .btn-play {
    width: 68px;
    height: 68px;
  }

  .btn-icon, .btn-zen {
    width: 44px;
    height: 44px;
  }

  .queue-actions, .library-actions {
    gap: 0.4rem;
  }

  .small-button, .danger-button {
    padding: 0.55rem 0.9rem;
    min-height: 40px;
  }

  .scroll-list {
    gap: 4px;
  }

  .create-form input {
    padding: 0.7rem 0.85rem;
    font-size: 1rem;
  }

  .search-input {
    padding: 0.75rem 0.85rem;
    font-size: 1rem;
  }

  .btn-create {
    width: 46px;
    height: 46px;
  }
}
