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

:root {
  /* glass surfaces */
  --glass: rgba(255, 255, 255, .05);
  --glass-2: rgba(255, 255, 255, .12);
  --glass-3: rgba(255, 255, 255, .2);
  --edge: rgba(255, 255, 255, .3);
  --edge-soft: rgba(255, 255, 255, .14);
  --blur: saturate(150%) blur(16px);

  /* dark translucent pill sits behind text so white reads over any part of the photo */
  --pill: rgba(0, 0, 0, .38);
  --pill-strong: rgba(0, 0, 0, .5);

  /* dark glass — smoked, blurred, lit along the top edge */
  --dark: rgba(8, 20, 32, .34);
  --dark-hover: rgba(8, 20, 32, .48);
  --dark-blur: saturate(140%) blur(20px);
  --dark-edge: rgba(255, 255, 255, .16);
  --dark-lip: inset 0 1px 0 rgba(255, 255, 255, .22), 0 2px 10px rgba(0, 20, 40, .28);

  --text: #fff;
  --dim: rgba(255, 255, 255, .85);
  --dimmer: rgba(255, 255, 255, .7);
  --accent: #eafcff;          /* now-playing highlight */
  --accent-glow: rgba(120, 240, 255, .55);
  --shadow: 0 12px 44px rgba(0, 20, 40, .34);
  --radius: 22px;
}

html, body { height: 100%; }

body {
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: .01em;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow: hidden;
}

/* ---- ocean backdrop ---- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: url("ocean.jpg") center 42% / cover no-repeat;
}

/* depth wash so white text always reads */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(2, 22, 44, .1) 0%, rgba(2, 20, 42, .14) 60%, rgba(1, 16, 36, .22) 100%);
}

.app { flex: 1; display: flex; gap: 14px; min-height: 0; }

/* ---- shared glass card ---- */

.player {
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--edge-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .22);
}

/* the music bar is smoked glass */
.sidebar {
  background: var(--dark);
  backdrop-filter: var(--dark-blur);
  -webkit-backdrop-filter: var(--dark-blur);
  border: 1px solid var(--dark-edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--dark-lip);
}

/* ---- sidebar ---- */

.sidebar {
  width: 236px;
  flex-shrink: 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;

  /* hidden until you reach for it — space is reserved, so nothing shifts */
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity .22s ease, transform .22s ease;
}

.sidebar:hover,
.sidebar:focus-within {
  opacity: 1;
  transform: none;
}

.sidebar h1 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-left: 8px;
  letter-spacing: .02em;
}

.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--dim);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.nav-item:hover { background: var(--glass-2); color: var(--text); }
.nav-item.active {
  background: var(--glass-3);
  border-color: var(--edge);
  color: var(--text);
  font-weight: 500;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 8px;
  padding: 0 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.section-head button {
  background: var(--glass-2);
  border: 1px solid var(--edge-soft);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.section-head button:hover { background: var(--glass-3); transform: scale(1.08); }

.folder-box {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--edge-soft);
  display: grid;
  gap: 8px;
}
.folder-box label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--dimmer);
}
.folder-box input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--edge-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, .08);
  color: var(--text);
  font: 12px/1.3 ui-monospace, "SF Mono", monospace;
  outline: none;
  transition: border-color .18s ease, background .18s ease;
}
.folder-box input::placeholder { color: var(--dimmer); }
.folder-box input:focus {
  border-color: var(--edge);
  background: rgba(255, 255, 255, .16);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .12);
}
.folder-box button {
  padding: 9px;
  border: 1px solid var(--edge-soft);
  border-radius: 13px;
  background: var(--glass-2);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s ease, transform .12s ease;
}
.folder-box button:hover { background: var(--glass-3); }
.folder-box button:active { transform: scale(.97); }
#scan-status { font-size: 11px; color: var(--dimmer); min-height: 14px; }

/* ---- main ---- */

/* library is bare — no glass, the photo shows through untouched */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;

  /* stays down and out of sight until the arrow brings it up */
  opacity: 0;
  transform: translateY(24px);
  pointer-events: none;
  transition: opacity .28s ease, transform .28s cubic-bezier(.22, 1, .36, 1);
}

body.library-open .main {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* ---- waveform (fills the empty stage while the library is tucked away) ---- */

.viz {
  position: fixed;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-58%);
  width: 100%;
  height: 320px;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity .45s ease;
}

/* only on stage when the track list is down */
body:not(.library-open) .viz { opacity: 1; }

/* ---- library toggle arrow ---- */

.lib-toggle {
  position: fixed;
  left: 50%;
  bottom: 118px;                 /* clears the 88px player bar + page padding */
  transform: translateX(-50%);
  z-index: 5;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;

  background: var(--glass-2);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--edge-soft);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .28);
  color: var(--text);
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.lib-toggle:hover { background: var(--glass-3); border-color: var(--edge); transform: translateX(-50%) translateY(-2px); }
.lib-toggle:active { transform: translateX(-50%) scale(.94); }
.lib-toggle:focus-visible { outline: none; box-shadow: var(--shadow), 0 0 0 3px rgba(255, 255, 255, .3); }

.lib-toggle svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .28s cubic-bezier(.22, 1, .36, 1);
}
body.library-open .lib-toggle svg { transform: rotate(180deg); }

.main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}
.main-head h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head-actions { display: flex; gap: 8px; align-items: center; }

#search {
  padding: 8px 14px;
  border: 1px solid var(--edge-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, .09);
  color: var(--text);
  font: inherit;
  width: 210px;
  outline: none;
  transition: background .18s ease, border-color .18s ease;
}
#search::placeholder { color: var(--dimmer); }
#search:focus {
  background: rgba(255, 255, 255, .16);
  border-color: var(--edge);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .12);
}

.ghost {
  padding: 8px 14px;
  border: 1px solid var(--edge-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  color: var(--dim);
  font: inherit;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.ghost:hover { color: var(--text); background: var(--glass-2); border-color: var(--edge); }
.ghost.danger:hover {
  color: #fff;
  background: rgba(255, 89, 94, .45);
  border-color: rgba(255, 140, 140, .7);
}
.hidden { display: none !important; }

.track-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 12px 64px;        /* room under the last row for the arrow */
}

/* every row is its own pane of glass */
.track {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 52px 26px;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border-radius: 16px;
  cursor: default;

  /* smoked glass, same recipe as the sidebar */
  background: var(--dark);
  backdrop-filter: var(--dark-blur);
  -webkit-backdrop-filter: var(--dark-blur);
  border: 1px solid var(--dark-edge);
  box-shadow: var(--dark-lip);
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.track:hover {
  background: var(--dark-hover);
  border-color: var(--edge);
  transform: translateY(-1px);
}
.track.playing {
  background: rgba(8, 20, 32, .58);
  border-color: var(--edge);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 18px rgba(0, 20, 40, .34);
}
.track.playing .t-title {
  color: var(--accent);
  font-weight: 600;
  text-shadow: 0 0 16px var(--accent-glow);
}

.t-num { color: var(--dimmer); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.t-title, .t-album { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-artist { font-size: 12px; color: var(--dimmer); }
.t-album { font-size: 12px; color: var(--dimmer); }
.t-dur { font-size: 12px; color: var(--dimmer); text-align: right; font-variant-numeric: tabular-nums; }

.t-menu {
  border: 0;
  background: transparent;
  color: var(--dim);
  cursor: pointer;
  font-size: 15px;
  opacity: 0;
  border-radius: 50%;
  transition: opacity .16s ease, background .16s ease;
}
.track:hover .t-menu { opacity: 1; }
.t-menu:hover { color: var(--text); background: var(--glass-2); }

.empty { padding: 40px 24px; color: var(--dim); }

/* ---- player bar ---- */

.player {
  flex-shrink: 0;
  height: 88px;
  display: grid;
  grid-template-columns: 1fr minmax(320px, 520px) 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
}

.now { min-width: 0; }
.now-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-artist { font-size: 12px; color: var(--dimmer); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.controls { display: grid; gap: 8px; justify-items: center; }
.buttons { display: flex; align-items: center; gap: 16px; }
.buttons button {
  background: transparent;
  border: 0;
  color: var(--dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  transition: color .16s ease, transform .12s ease, background .16s ease, box-shadow .16s ease;
}
.buttons button:hover { color: var(--text); transform: scale(1.12); }
.buttons button:active { transform: scale(.94); }
.buttons .play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  color: #0b3a5c;
  font-size: 14px;
  text-shadow: none;
  box-shadow: 0 4px 16px rgba(0, 40, 70, .35), inset 0 1px 0 rgba(255, 255, 255, .8);
}
.buttons .play:hover { background: #fff; color: #0b3a5c; }

.scrub {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font-size: 11px;
  color: var(--dimmer);
  font-variant-numeric: tabular-nums;
}
.scrub input { flex: 1; }

.volume { display: flex; align-items: center; gap: 8px; justify-content: flex-end; font-size: 13px; }
.volume input { width: 90px; }

/* ---- iOS-style sliders ---- */

input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .45);
  cursor: pointer;
  outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 40, 70, .45);
  transition: transform .12s ease;
}
input[type=range]::-webkit-slider-thumb:active { transform: scale(1.25); }

/* ---- scrollbars ---- */

.track-list::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 9px; }
.track-list::-webkit-scrollbar-track, .sidebar::-webkit-scrollbar-track { background: transparent; }
.track-list::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, .3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.track-list::-webkit-scrollbar-thumb:hover, .sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, .5);
  background-clip: content-box;
}

::selection { background: rgba(255, 255, 255, .35); }

/* ---- surfaces (words themselves stay bare) ---- */

/* controls read as lit surfaces on the smoked panel, not gray pills */
.sidebar .nav-item,
.sidebar .section-head button,
.folder-box input,
.folder-box button {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.sidebar .nav-item:hover,
.sidebar .section-head button:hover,
.folder-box button:hover,
.folder-box input:focus { background: rgba(255, 255, 255, .16); }
.sidebar .nav-item.active {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .32);
}
.sidebar .nav-item { border-color: transparent; box-shadow: none; background: transparent; }
.sidebar .nav-item:hover { background: rgba(255, 255, 255, .12); }

/* main + player chrome keeps its darkened surface */
#search, .ghost { background: var(--pill); }
#search:focus { background: var(--pill-strong); }
.ghost:hover { background: var(--pill-strong); }

.buttons button:not(.play) {
  background: var(--pill);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  position: relative;
}

/* selected toggles (shuffle / loop) read as lit white, with a dot under them */
.buttons button:not(.play).on {
  color: #fff;
  background: rgba(255, 255, 255, .22);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .55),
    0 0 12px var(--accent-glow);
  text-shadow: 0 0 10px var(--accent-glow);
}
.buttons button:not(.play).on:hover { background: rgba(255, 255, 255, .3); }
.buttons button:not(.play).on::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px var(--accent-glow);
}
.buttons button:not(.play):hover { background: var(--pill-strong); }
.volume > span {
  background: var(--pill);
  border-radius: 999px;
  padding: 3px 7px;
}
