/* ═══════════════════════════════════════════
   LOCAL FONTS
═══════════════════════════════════════════ */
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-Light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('fonts/IBMPlexMono-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans-Light.woff2') format('woff2');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}

/* ═══════════════════════════════════════════
   LISTENING — style.css
═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── SKIN TOKENS: Classic (*/
:root {
  --p-bg:        #1e1e1e;
  --p-surface:   #272727;
  --p-surface2:  #333;
  --p-border:    #484848;
  --p-border2:   #606060;
  --p-accent:    #18e600;
  --p-accent2:   #0faa00;
  --p-glow:      rgba(24,230,0,0.28);
  --p-dim:       #888;
  --p-dim2:      #4a4a4a;
  --p-text:      #f0f0f0;
  --p-text2:     #c0c0c0;
  /* Chrome — dark by default */
  --p-chrome-bg:   #1a1a1a;
  --p-chrome-text: #d0d0d0;
  --p-tb-border:   #2a2a2a;
  --p-titlebar:    #141414;
  /* Mac dots always the same */
  --dot-r: #ff5f57; --dot-y: #febc2e; --dot-g: #28c840;
  /* Page bg */
  --page-bg: #c0c0c0;
}

/* ── OCEAN ── */
[data-skin="ocean"] {
  --p-bg: #071828; --p-surface: #0c2240; --p-surface2: #122e58;
  --p-border: #1a4070; --p-border2: #2658a0;
  --p-accent: #38bdf8; --p-accent2: #0ea5e9; --p-glow: rgba(56,189,248,0.3);
  --p-dim: #4488bb; --p-dim2: #1e3858; --p-text: #e8f6ff; --p-text2: #9dd5f8;
  --p-titlebar: #030e1a; --p-tb-border: #0c2240;
  --page-bg: #a8c8e0;
}
/* ── EMBER ── */
/* ── ROSE ── */
[data-skin="rose"] {
  --p-bg: #180010; --p-surface: #280020; --p-surface2: #38002e;
  --p-border: #680040; --p-border2: #a00060;
  --p-accent: #fb7185; --p-accent2: #f43f5e; --p-glow: rgba(251,113,133,0.3);
  --p-dim: #903050; --p-dim2: #580030; --p-text: #fff1f2; --p-text2: #fca5b5;
  --p-titlebar: #080008; --p-tb-border: #280020;
  --page-bg: #dfb8ca;
}
/* ── SAGE ── */
/* ── VIOLET ── */
/* ── CHALK (light player) ── */
[data-skin="chalk"] {
  --p-bg: #f0eeea; --p-surface: #e8e5e0; --p-surface2: #dedad4;
  --p-border: #c8c4be; --p-border2: #a8a49e;
  --p-accent: #1d6bdc; --p-accent2: #155abd; --p-glow: rgba(29,107,220,0.2);
  --p-dim: #888480; --p-dim2: #c0bdb8; --p-text: #1a1818; --p-text2: #484440;
  --p-titlebar: #e0ddd8; --p-tb-border: #c8c4be;
  --page-bg: #d8d4cc;
}

/* ── CHROME OVERRIDE: light ── */
[data-chrome="light"] .player {
  --p-chrome-bg:   #ebebeb;
  --p-chrome-text: #1a1a1a;
  --p-tb-border:   #d0d0d0;
}
/* dark is the default, explicit for clarity */
[data-chrome="dark"] .player {
  --p-chrome-bg:   #1a1a1a;
  --p-chrome-text: #d0d0d0;
  --p-tb-border:   #2a2a2a;
}

/* ═══════════════════════════════════════════
   PAGE
═══════════════════════════════════════════ */
html, body { height: 100%; }
body {
  min-height: 100vh;
  background: #0e0a14;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'IBM Plex Sans', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  padding: 32px 16px;
  position: relative;
  overflow: hidden;
}
body.maximised {
  padding: 0;
  align-items: flex-start;
  overflow: auto;
}
body.has-bg-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
/* Lava lamp — static CSS blobs, no JS, no canvas */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 55% 45% at 15% 20%,  hsla(12,  90%, 62%, 0.72) 0%, transparent 70%),
    radial-gradient(ellipse 45% 55% at 78% 68%,  hsla(38,  88%, 58%, 0.65) 0%, transparent 70%),
    radial-gradient(ellipse 50% 42% at 55% 10%,  hsla(55,  85%, 60%, 0.60) 0%, transparent 68%),
    radial-gradient(ellipse 48% 52% at 28% 75%,  hsla(170, 80%, 52%, 0.60) 0%, transparent 70%),
    radial-gradient(ellipse 42% 48% at 82% 22%,  hsla(200, 85%, 58%, 0.65) 0%, transparent 68%),
    radial-gradient(ellipse 50% 44% at 60% 85%,  hsla(270, 80%, 62%, 0.60) 0%, transparent 70%),
    radial-gradient(ellipse 44% 50% at 10% 55%,  hsla(320, 85%, 60%, 0.62) 0%, transparent 68%),
    #0e0a14;
}
body.has-bg-image::before { display: none; }



/* ═══════════════════════════════════════════
   PLAYER WINDOW
═══════════════════════════════════════════ */
.player {
  position: absolute;  /* enables drag positioning */
  z-index: 2;
  width: min(820px, calc(100vw - 32px));
  /* height is set by JS; no CSS height so flex works cleanly */
  background: var(--p-bg);
  border-radius: 10px;
  border: 1px solid var(--p-border);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.5),
    0 8px 24px rgba(0,0,0,0.4),
    0 32px 64px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.05);
  overflow: hidden;
  transition: opacity 0.3s, transform 0.35s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  /* Initial centred position + height set by JS */
}
.player.is-dragging {
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.5),
    0 20px 60px rgba(0,0,0,0.6),
    0 60px 120px rgba(0,0,0,0.5);
  transition: box-shadow 0.2s; /* no opacity/transform while dragging */
}
.player.is-hidden {
  opacity: 0;
  transform: scale(0.88) translateY(20px);
  pointer-events: none;
}
.player.is-minimised {
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  pointer-events: none;
}
body.maximised .player {
  position: relative;
  width: 100%;
  min-height: 100vh;
  border-radius: 0;
  border: none;
  box-shadow: none;
  left: auto !important;
  top: auto !important;
}

/* ═══════════════════════════════════════════
   TITLE BAR
═══════════════════════════════════════════ */
.titlebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: var(--p-chrome-bg);
  border-bottom: 1px solid var(--p-tb-border);
  flex-shrink: 0;
  cursor: grab;
}
.titlebar:active { cursor: grabbing; }

.win-dots { display: flex; gap: 7px; align-items: center; flex-shrink: 0; }
.win-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid rgba(0,0,0,0.22);
  position: relative;
  flex-shrink: 0;
  transition: filter 0.1s;
}
.win-dot:hover  { filter: brightness(1.12); }
.win-dot:active { filter: brightness(0.82); }
.win-dot.close { background: var(--dot-r); }
.win-dot.min   { background: var(--dot-y); }
.win-dot.max   { background: var(--dot-g); }
/* Centred symbol overlays */
.win-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  line-height: 13px;      /* matches dot height exactly */
  text-align: center;
  font-weight: 900;
  color: rgba(0,0,0,0.55);
  opacity: 0;
  transition: opacity 0.12s;
}
.win-dot.close::after { content: "✕"; }
.win-dot.min::after   { content: "−"; }
.win-dot.max::after   { content: "+"; }
.win-dots:hover .win-dot::after { opacity: 1; }

.title-text {
  flex: 1;
  text-align: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 2.5px;
  color: var(--p-chrome-text);
  opacity: 0.5;
  text-transform: uppercase;
}

/* Skin + chrome swatches */
.titlebar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.swatch-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.swatch-sep {
  width: 1px;
  height: 12px;
  background: var(--p-chrome-text);
  opacity: 0.2;
}
.skin-dot, .chrome-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.skin-dot:hover, .chrome-dot:hover { transform: scale(1.2); }
.skin-dot.active  { border-color: var(--p-chrome-text); }
.chrome-dot.active { border-color: var(--p-chrome-text); }
/* bg picker trigger */
.bg-pick-btn {
  width: 11px; height: 11px;
  border-radius: 3px;
  cursor: pointer;
  border: 2px solid rgba(128,128,128,0.5);
  background: repeating-linear-gradient(
    45deg,
    #ccc 0px, #ccc 2px,
    #888 2px, #888 4px
  );
  transition: transform 0.12s, border-color 0.12s;
  flex-shrink: 0;
  position: relative;
}
.bg-pick-btn:hover { transform: scale(1.2); border-color: var(--p-chrome-text); }

/* ═══════════════════════════════════════════
   SAD MAC OVERLAY
═══════════════════════════════════════════ */
.sad-mac-overlay {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: var(--p-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.sad-mac-overlay.visible { opacity: 1; pointer-events: auto; }
.sad-mac-face {
  font-size: 64px;
  line-height: 1;
}
.sad-mac-text {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--p-dim);
  letter-spacing: 0.5px;
  text-align: center;
  line-height: 1.7;
}
.sad-mac-restart {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--p-accent);
  background: transparent;
  border: 1px solid var(--p-accent);
  border-radius: 5px;
  padding: 8px 22px;
  cursor: pointer;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
}
.sad-mac-restart:hover { background: var(--p-accent); color: #000; }

/* ═══════════════════════════════════════════
   NOW PLAYING
═══════════════════════════════════════════ */
.now-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--p-surface);
  border-bottom: 1px solid rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.viz-wrap {
  width: 64px; height: 52px;
  flex-shrink: 0;
  background: #000;
  border: 1px solid var(--p-border);
  border-radius: 4px;
  overflow: hidden;
}
#vizCanvas { display: block; width: 64px; height: 52px; }

.track-info {
  flex: 1;
  min-width: 0;
}
.track-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: var(--p-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
  text-shadow: 0 0 12px var(--p-glow);
}
.track-artist {
  font-size: 12px;
  font-weight: 500;
  color: var(--p-text2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-album {
  font-size: 11px;
  font-weight: 400;
  color: var(--p-dim);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-time-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.track-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--p-dim);
}

/* ── CONTROL STRIP ── */
.control-strip {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  background: var(--p-surface);
  border-bottom: 1px solid rgba(0,0,0,0.4);
  flex-shrink: 0;
}

/* Desktop: both rows sit inline as flex children */
.strip-row-transport,
.strip-row-aux {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 5px 6px;
}
.strip-row-transport { padding-right: 0; }
.strip-row-aux { flex: 1; min-width: 0; }

/* Desktop-only separator between the two rows */
.desktop-only { display: flex; }

/* Groups of buttons separated by a ruled line */
.strip-group {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
/* The playlist group is allowed to grow */
.strip-group.grow { flex: 1; min-width: 0; }

.strip-sep {
  width: 1px;
  height: 22px;
  background: var(--p-border);
  opacity: 0.6;
  flex-shrink: 0;
  margin: 0 4px;
}

/* vol slider fills available space */
.vol-slider {
  flex: 1;
  min-width: 50px;
  max-width: 120px;
}

/* pl-select expands inside its group */
.control-strip .pl-select {
  flex: 1;
  min-width: 0;
  font-size: 9px;
  padding: 0 5px;
  height: 34px;
}

/* eject sits tight */
.control-strip /* Local files label-button — styled identically to eject-btn
   Using <label for="localFileInput"> means iOS treats it as a native
   file input tap — no JS .click() required, no gesture restrictions. */
.local-files-btn {
  background: linear-gradient(180deg, var(--p-surface2) 0%, color-mix(in srgb, var(--p-surface2) 70%, var(--p-bg)) 100%);
  border: 1px solid var(--p-border);
  border-bottom-color: rgba(0,0,0,0.45);
  border-radius: 5px;
  color: var(--p-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.25),
    0 2px 0 var(--p-border2),
    0 3px 6px rgba(0,0,0,0.3);
  transition: color 0.08s, filter 0.08s;
  user-select: none;
  -webkit-user-select: none;
}
.local-files-btn:hover  { color: var(--p-accent); filter: brightness(1.12); }
.local-files-btn:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), 0 1px 0 rgba(0,0,0,0.25); }

.eject-btn {
  width: 34px; height: 34px;
  flex-shrink: 0;
}

.control-strip .ctrl-label { flex-shrink: 0; }
.control-strip .vol-val    { flex-shrink: 0; }

/* Vol group stretches a bit */
.strip-group.vol-group {
  flex: 0 1 160px;
  min-width: 90px;
}

.status-cluster { flex-shrink: 0; align-self: center; }
/* LED sits next to track time */
.led-pill {
  display: flex;
  align-items: center;
  background: transparent;
  border: none;
  padding: 0;
  gap: 4px;
}
.led {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--p-dim2);
  flex-shrink: 0;
  transition: background 0.2s, box-shadow 0.2s;
}
.led.green  { background: #4caf50; box-shadow: 0 0 8px rgba(76,175,80,0.9); }
.led.orange { background: #ff9800; box-shadow: 0 0 8px rgba(255,152,0,0.9); }
.led.red    { background: #e53935; box-shadow: 0 0 8px rgba(229,57,53,0.9); }
.led.blink  { background: #ff9800; animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.1} }
.led-label { display: none; }

/* ═══════════════════════════════════════════
   PROGRESS
═══════════════════════════════════════════ */
.progress-wrap {
  padding: 8px 12px 10px;
  background: var(--p-surface);
  border-bottom: 1px solid rgba(0,0,0,0.5);
  flex-shrink: 0;
}
.progress-track {
  height: 8px;
  background: var(--p-surface2);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: visible;
  border: 1px solid rgba(0,0,0,0.25);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--p-accent2), var(--p-accent));
  border-radius: 3px;
  width: 0%;
  transition: width 0.28s linear;
  pointer-events: none;
  position: relative;
}
.progress-fill::after {
  content: "";
  position: absolute;
  right: -5px; top: 50%;
  transform: translateY(-50%);
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--p-accent);
  box-shadow: 0 0 5px var(--p-glow);
  opacity: 0;
  transition: opacity 0.15s;
}
.progress-track:hover .progress-fill::after { opacity: 1; }

/* ═══════════════════════════════════════════
   MAIN AREA
═══════════════════════════════════════════ */
.main-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── BROWSER TABS ── */
.browser-tabs {
  display: flex;
  align-items: stretch;
  background: var(--p-surface2);
  border-bottom: 2px solid var(--p-border);
  flex-shrink: 0;
}
.b-tab {
  flex: 1;
  padding: 7px 10px 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--p-dim);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.b-tab:hover  { color: var(--p-text2); }
.b-tab.active { color: var(--p-accent); border-bottom-color: var(--p-accent); }

/* ── BROWSER — shared desktop + mobile visual language ── */
.browser {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-width: 0;
}

/* Desktop: three columns side by side */
.b-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(0,0,0,0.3);
  overflow: hidden;
  min-width: 0;
}
.b-col:last-child { border-right: none; }

/* Desktop tab switching — show/hide column groups */
.b-col { display: none; }  /* hidden by default */
/* Artists tab */
body[data-tab="artists"] .tab-artists { display: flex; }
/* Albums tab */
body[data-tab="albums"]  .tab-albums  { display: flex; }
/* Tracks tab */
body[data-tab="tracks"]  .tab-tracks  { display: flex; }
/* Default (no data-tab yet): show artists */
body:not([data-tab]) .tab-artists { display: flex; }

.b-col-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--p-dim);
  text-transform: uppercase;
  background: var(--p-surface2);
  border-bottom: 1px solid rgba(0,0,0,0.4);
  flex-shrink: 0;
}
.b-col-head span { flex: 1; }  /* heading fills space, pushes play-all right */

/* Play-all button in column header */
.b-col-play-all {
  display: none;   /* shown when a filter is active — toggled by JS */
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 7px;
  background: linear-gradient(180deg, var(--p-surface2) 0%, color-mix(in srgb, var(--p-surface2) 70%, var(--p-bg)) 100%);
  border: 1px solid var(--p-border);
  border-bottom-color: rgba(0,0,0,0.45);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--p-accent);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 2px 0 var(--p-border2),
    0 2px 4px rgba(0,0,0,0.25);
  transition: color 0.08s, filter 0.08s;
}
.b-col-play-all:hover  { filter: brightness(1.12); }
.b-col-play-all:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), 0 1px 0 rgba(0,0,0,0.25);
}
.b-col-play-all.visible { display: flex; }

/* Mobile-only back button — hidden on desktop */
.b-col-back {
  display: none;
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: 6px;
  color: var(--p-accent);
  cursor: pointer;
  padding: 4px 10px;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  min-width: 44px;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}
.b-col-back:active { background: var(--p-border); }

.b-col-list {
  flex: 1;
  overflow-y: auto;
  background: var(--p-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--p-border) transparent;
}
.b-col-list::-webkit-scrollbar { width: 3px; }
.b-col-list::-webkit-scrollbar-thumb { background: var(--p-border); border-radius: 2px; }

/* Row — shared by desktop + mobile */
.b-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 400;
  color: var(--p-text2);
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.18);
  transition: background 0.08s, color 0.08s;
  line-height: 1.35;
  gap: 8px;
}
.b-item:hover { background: var(--p-surface); color: var(--p-text); }
.b-item.active {
  background: rgba(0,0,0,0.32);
  color: var(--p-accent);
  border-left: 3px solid var(--p-accent);
  padding-left: 11px;
  font-weight: 600;
}
[data-skin="chalk"] .b-item.active { background: rgba(0,0,0,0.06); }

/* Label + sub stacked */
.b-item-inner {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.b-item-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.b-item-sub {
  display: block;
  font-size: 10px;
  color: var(--p-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.b-item.active .b-item-sub { color: var(--p-accent2); opacity: 0.7; }

/* Chevron — shown on mobile drill-down rows, hidden on track rows */
.b-item-chevron {
  flex-shrink: 0;
  color: var(--p-dim2);
  font-size: 14px;
  display: none;   /* shown via mobile CSS */
}

/* Now-playing indicator dot on active track */
.b-item-playing {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--p-accent);
  box-shadow: 0 0 5px var(--p-glow);
  flex-shrink: 0;
  display: none;
}
.b-item.now-playing .b-item-playing { display: block; }

/* ═══════════════════════════════════════════
   PHYSICAL BUTTONS
   Layered shadows give real depth:
   - top highlight (inset light)
   - face gradient (slight bevel)
   - bottom edge (dark drop)
   - ambient shadow
═══════════════════════════════════════════ */

/* Base physical button */
.t-btn {
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  background: linear-gradient(180deg,
    var(--p-surface2) 0%,
    color-mix(in srgb, var(--p-surface2) 70%, var(--p-bg)) 100%);
  border: 1px solid var(--p-border);
  border-bottom-color: rgba(0,0,0,0.5);
  border-radius: 5px;
  color: var(--p-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: color 0.08s, filter 0.08s;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),  /* top bevel highlight */
    inset 0 -1px 0 rgba(0,0,0,0.25),        /* bottom inner shadow */
    0 2px 0 var(--p-border2),               /* bottom edge — uses theme border so visible on dark */
    0 3px 6px rgba(0,0,0,0.3);              /* ambient drop */
  user-select: none;
  -webkit-user-select: none;
}
.t-btn:hover {
  color: var(--p-text);
  filter: brightness(1.12);
}
.t-btn:active {
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.4),        /* recessed inset */
    inset 0 -1px 0 rgba(255,255,255,0.04),
    0 1px 0 rgba(0,0,0,0.3);               /* minimal edge — pushed in */
  transform: translateY(1px);              /* physically depresses */
  filter: brightness(0.9);
}

/* Play — accent-coloured, slightly taller */
.btn-play {
  height: 38px;
  min-width: 46px;
  color: var(--p-accent);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--p-accent) 12%, var(--p-surface2)) 0%,
    color-mix(in srgb, var(--p-accent) 6%, var(--p-bg)) 100%);
  border-color: color-mix(in srgb, var(--p-accent) 35%, var(--p-border));
  border-bottom-color: rgba(0,0,0,0.6); 
  transition: color 0.08s, filter 0.08s, box-shadow 0.25s;
}
.btn-play:hover { filter: brightness(1.15); }
.btn-play.playing {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.3),
    0 0 14px color-mix(in srgb, var(--p-accent) 45%, transparent),
    0 2px 0 rgba(0,0,0,0.4),
    0 3px 8px rgba(0,0,0,0.35);
}

/* Mode buttons (SHUF / ORD / REPT) — slightly smaller */
.m-btn {
  height: 28px;
  padding: 0 9px;
  background: linear-gradient(180deg,
    var(--p-surface2) 0%,
    color-mix(in srgb, var(--p-surface2) 60%, var(--p-bg)) 100%);
  border: 1px solid var(--p-border);
  border-bottom-color: rgba(0,0,0,0.45);
  border-radius: 5px;
  color: var(--p-dim);
  cursor: pointer;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 2px 0 var(--p-border2),
    0 2px 4px rgba(0,0,0,0.25);
  transition: color 0.08s, filter 0.08s;
}
.m-btn:hover { color: var(--p-text2); filter: brightness(1.1); }
.m-btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), 0 1px 0 rgba(0,0,0,0.25);
  filter: brightness(0.88);
}
.m-btn.on {
  color: var(--p-accent);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--p-accent) 15%, var(--p-surface2)) 0%,
    color-mix(in srgb, var(--p-accent) 7%, var(--p-bg)) 100%);
  border-color: color-mix(in srgb, var(--p-accent) 30%, var(--p-border));
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 0 6px color-mix(in srgb, var(--p-accent) 25%, transparent),
    0 2px 0 var(--p-border2),
    0 2px 4px rgba(0,0,0,0.25);
}

/* Eject — same physical feel */
/* Local files label-button — styled identically to eject-btn
   Using <label for="localFileInput"> means iOS treats it as a native
   file input tap — no JS .click() required, no gesture restrictions. */
.local-files-btn {
  background: linear-gradient(180deg, var(--p-surface2) 0%, color-mix(in srgb, var(--p-surface2) 70%, var(--p-bg)) 100%);
  border: 1px solid var(--p-border);
  border-bottom-color: rgba(0,0,0,0.45);
  border-radius: 5px;
  color: var(--p-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.25),
    0 2px 0 var(--p-border2),
    0 3px 6px rgba(0,0,0,0.3);
  transition: color 0.08s, filter 0.08s;
  user-select: none;
  -webkit-user-select: none;
}
.local-files-btn:hover  { color: var(--p-accent); filter: brightness(1.12); }
.local-files-btn:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), 0 1px 0 rgba(0,0,0,0.25); }

.eject-btn {
  background: linear-gradient(180deg,
    var(--p-surface2) 0%,
    color-mix(in srgb, var(--p-surface2) 70%, var(--p-bg)) 100%);
  border: 1px solid var(--p-border);
  border-bottom-color: rgba(0,0,0,0.5);
  border-radius: 5px;
  color: var(--p-dim);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.10),
    inset 0 -1px 0 rgba(0,0,0,0.25),
    0 2px 0 var(--p-border2),
    0 3px 6px rgba(0,0,0,0.3);
  transition: color 0.08s, filter 0.08s;
}
.eject-btn:hover  { color: var(--p-accent); filter: brightness(1.12); }
.eject-btn:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgba(0,0,0,0.4), 0 1px 0 rgba(0,0,0,0.25); }

/* Volume slider — chunky track + thumb */
.ctrl-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 7px;
  font-weight: 600;
  color: var(--p-dim);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  flex-shrink: 0;
}
input[type=range].slider {
  -webkit-appearance: none;
  height: 5px;
  background: linear-gradient(180deg,
    rgba(0,0,0,0.4) 0%,
    var(--p-surface2) 100%);
  border: 1px solid rgba(0,0,0,0.35);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.4);
}
input[type=range].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 20px;
  border-radius: 3px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--p-border2) 80%, white) 0%,
    var(--p-surface2) 100%);
  border: 1px solid var(--p-border2);
  border-bottom-color: rgba(0,0,0,0.5);
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 1px 0 rgba(0,0,0,0.4),
    0 2px 4px rgba(0,0,0,0.35);
}
input[type=range].slider::-moz-range-thumb {
  width: 14px; height: 20px;
  border-radius: 3px;
  background: var(--p-surface2);
  border: 1px solid var(--p-border2);
}
.vol-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  font-weight: 500;
  color: var(--p-text2);
  min-width: 22px;
  text-align: right;
}

/* Playlist select */
select.pl-select {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  color: var(--p-text2);
  background: linear-gradient(180deg, var(--p-bg) 0%, var(--p-surface) 100%);
  border: 1px solid var(--p-border);
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  min-width: 0;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
  transition: border-color 0.2s;
}
select.pl-select:focus { border-color: var(--p-accent); }

/* ── STATUS BAR ── */
.statusbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 15px;
  background: var(--p-titlebar);
  border-top: 1px solid var(--p-tb-border);
  flex-shrink: 0;
}
.status-count { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: var(--p-dim); letter-spacing: 0.5px; }
.status-spacer { flex: 1; }
.status-error  { font-family: 'IBM Plex Mono', monospace; font-size: 9px; color: #ff6b6b; min-height: 13px; }
/* ═══════════════════════════════════════════
   RESIZE HANDLE
═══════════════════════════════════════════ */
.resize-handle {
  height: 6px;
  flex-shrink: 0;
  cursor: ns-resize;
  background: transparent;
  position: relative;
  z-index: 5;
}
.resize-handle::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 3px;
  border-radius: 2px;
  background: var(--p-border2);
  opacity: 0;
  transition: opacity 0.15s;
}
.resize-handle:hover::after,
.resize-handle.is-resizing::after { opacity: 1; }
/* Hide when maximised or on mobile */
body.maximised .resize-handle { display: none; }
@media (max-width: 620px) { .resize-handle { display: none; } }



/* ═══════════════════════════════════════════
   DOCK
═══════════════════════════════════════════ */
.dock {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.dock.visible { display: flex; }
.dock-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.62);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  padding: 8px 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.45);
  transition: background 0.15s;
}
.dock-pill:hover { background: rgba(0,0,0,0.78); }
.dock-led { width: 6px; height: 6px; border-radius: 50%; background: #555; flex-shrink: 0; transition: background 0.2s, box-shadow 0.2s; }
.dock-led.green  { background: #4caf50; box-shadow: 0 0 6px rgba(76,175,80,0.9); }
.dock-led.orange { background: #ff9800; animation: blink 1.1s ease-in-out infinite; }
.dock-title { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: rgba(255,255,255,0.72); max-width: 280px; white-space: normal; line-height: 1.5; }
.dock-indicator { width: 5px; height: 5px; border-radius: 50%; background: rgba(255,255,255,0.22); }

/* Hidden file input */
#bgFileInput { display: none; }

/* ═══════════════════════════════════════════
   MOBILE — margin + stacked browser
═══════════════════════════════════════════ */
@media (max-width: 620px) {

  /* ── Page ── */
  body {
    padding: 0;
    align-items: flex-start;
    overflow: hidden;
    height: 100dvh;
    background-size: cover;
  }

  /* ── Player: floated — background visible at top and sides ── */
  .player {
    position: fixed !important;
    left: 5% !important;
    right: 5% !important;
    top: 5% !important;
    width: 90% !important;
    height: 90dvh !important;
    border-radius: 12px !important;
    border: 1px solid var(--p-border) !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
    display: flex;
    flex-direction: column;
  }

  /* ── Resize handle hidden ── */
  .resize-handle { display: none !important; }

  /* ── Now row: slimmer ── */
  .now-row { padding: 6px 10px; }
  .viz-wrap { width: 44px; height: 36px; }
  #vizCanvas { width: 44px; height: 36px; }
  .track-title  { font-size: 13px; }
  .track-artist { font-size: 11px; }
  .track-album  { font-size: 10px; }
  .track-time   { font-size: 10px; }

  /* ── Control strip: two rows ── */
  .control-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
  }

  /* Row 1: transport — full width, big tap targets */
  .strip-row-transport {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background: var(--p-surface);
    border-bottom: 1px solid rgba(0,0,0,0.3);
    gap: 4px;
  }
  .strip-row-transport .t-btn    { flex: 1; height: 42px; border-radius: 6px; }
  .strip-row-transport .btn-play { flex: 1.5; height: 46px; }

  /* Row 2: modes + eject + vol — compact, fits 90% width */
  .strip-row-aux {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    background: var(--p-surface);
    border-bottom: 1px solid rgba(0,0,0,0.4);
    gap: 4px;
    overflow: hidden;
  }
  .strip-row-aux .m-btn            { height: 26px; padding: 0 6px; font-size: 7px; flex-shrink: 0; }
  .strip-row-aux .t-btn            { height: 26px; min-width: 26px; flex-shrink: 0; }
  .strip-row-aux .eject-btn        { width: 26px; height: 26px; flex-shrink: 0; }
  .strip-row-aux .local-files-btn  { width: 26px; height: 26px; flex-shrink: 0; }
  .strip-row-aux .vol-slider       { flex: 1; min-width: 30px; }
  .strip-row-aux .vol-val          { display: none; }
  .strip-row-aux .ctrl-label       { display: none; }
  .strip-row-aux .pl-select        { flex: 1; min-width: 0; max-width: 100px; height: 26px; font-size: 8px; }
  .strip-row-aux .strip-sep        { height: 14px; margin: 0 1px; flex-shrink: 0; }

  /* Flatten strip-groups */
  .strip-group { display: contents; }
  .control-strip > .strip-sep { display: none; }
  .desktop-only { display: none !important; }

  /* ── Main area ── */
  .main-area {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    flex-direction: column;
  }

  /* ── Browser tabs ── */
  .browser-tabs { flex-shrink: 0; }

  /* ── Browser: single column drill-down ── */
  .browser {
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    position: relative;
  }

  .b-col {
    position: absolute;
    inset: 0;
    border-right: none;
    display: none !important;
    flex-direction: column;
  }
  .b-col.is-active { display: flex !important; }

  /* Back button */
  .b-col-back { display: flex; align-items: center; justify-content: center; }

  /* Bigger rows for touch */
  .b-item { padding: 11px 14px; font-size: 14px; }
  .b-item.active { padding-left: 11px; }
  .b-item-sub { font-size: 11px; }

  /* Chevrons on drill columns */
  .b-col-artists .b-item-chevron,
  .b-col-albums  .b-item-chevron,
  .b-col-allalbums .b-item-chevron { display: block; }

  /* Status bar */
  .statusbar { padding: 4px 10px; }
}

#ytContainer { position: fixed; left: -9999px; top: -9999px; width: 1px; height: 1px; overflow: hidden; }
