:root {
  --ink: #111116;
  --paper: #ffffff;
  --black: #0a0a0d;
  --dim: #8e8e96;
  --purple: #6C3EF5;
  --purple-deep: #5b2ff0;
  --lavender: #E9E2FA;
  --lavender2: #DCD2F7;
  --cyan: #8FD9F2;
  --lime: #B8F13C;
  --amber: #FFC93C;
  --lilac: #D9C8F5;
  --coral: #FF9AA8;
  --card-radius: 22px;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--black); color: var(--ink);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  overscroll-behavior: none;
}
.display {
  font-family: 'Anton', 'Arial Narrow', sans-serif;
  text-transform: uppercase;
  letter-spacing: .5px;
  line-height: .95;
}
.display.sm { font-size: 22px; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input { font: inherit; }
.hidden { display: none !important; }

/* ---------- views ---------- */
.view { display: none; max-width: 520px; margin: 0 auto; min-height: 100dvh; padding: 0 18px 190px; }
.view.on { display: block; }
.view.dark { background: var(--black); color: #fff; }
body:not([data-view="search"]) { background: var(--black); }
body[data-view="search"] { background: var(--paper); }

.vhead { padding: calc(18px + env(safe-area-inset-top)) 0 14px; display: flex; align-items: center; gap: 12px; }
.vhead h1 { font-size: clamp(34px, 10vw, 46px); flex: 1; }

.pillbtn {
  background: var(--purple); color: #fff; font-weight: 600; font-size: 13px;
  padding: 10px 16px; border-radius: 999px;
}

/* search / filter inputs */
.searchbar { position: relative; margin: 4px 0 10px; }
.searchline { position: relative; margin: 4px 0 18px; border-bottom: 1px solid #2c2c33; }
.searchbar input, .searchline input {
  width: 100%; background: #F2F2F5; border: none; border-radius: 14px;
  padding: 14px 42px 14px 16px; font-size: 15px; outline: none; color: var(--ink);
}
.searchline input { background: transparent; color: #fff; border-radius: 0; padding: 12px 42px 12px 2px; }
.searchbar input:focus { background: #ECECF1; }
.searchline input:focus { border-color: var(--purple); }
.s-ico { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--dim); pointer-events: none; }

.tabs { display: flex; gap: 20px; padding: 2px 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 2px; font-size: 16px; font-weight: 500; color: #B9B9C0; position: relative; white-space: nowrap; }
.tab.on { color: var(--ink); font-weight: 600; }
.tab.on::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2.5px; background: var(--ink); border-radius: 2px; }

/* ---------- colored cards ---------- */
.list { display: flex; flex-direction: column; gap: 14px; }
.card {
  --c1: var(--cyan);
  display: flex; align-items: center; gap: 14px;
  background: var(--c1); color: var(--ink);
  border-radius: var(--card-radius);
  padding: 14px;
  transition: transform .15s ease;
}
.card:active { transform: scale(.98); }
.disc {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  background-size: cover; background-position: center; background-color: #1a1a20;
  position: relative;
}
.disc::after {
  content: ''; position: absolute; inset: 50% auto auto 50%; width: 22px; height: 22px;
  transform: translate(-50%, -50%); border-radius: 50%;
  border: 5px solid var(--purple); background: #141418;
}
.card .meta { flex: 1; min-width: 0; }
.card .t {
  font-family: 'Anton', 'Arial Narrow', sans-serif; text-transform: uppercase;
  font-size: 17px; letter-spacing: .4px; line-height: 1.05;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .a { font-size: 13px; color: rgba(17,17,22,.62); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .acts { display: flex; align-items: center; gap: 5px; flex: none; }
.ghostbtn {
  width: 35px; height: 35px; border-radius: 50%;
  border: 1.5px solid rgba(17,17,22,.4); display: flex; align-items: center; justify-content: center;
  font-size: 15px; color: var(--ink);
}
.ghostbtn.faved { background: var(--ink); color: var(--c1); border-color: var(--ink); }
.ghostbtn:active { transform: scale(.92); }

.empty { padding: 46px 10px; text-align: center; color: #8e8e96; font-size: 14px; line-height: 1.7; }
.dark .empty { color: #6b6b74; }

/* playlist cards */
.plcard {
  --c1: var(--amber);
  background: var(--c1);
  border-radius: var(--card-radius); padding: 18px 16px 16px; color: var(--ink);
  display: flex; flex-direction: column; gap: 14px;
}
.plcard .row1 { display: flex; align-items: center; gap: 14px; }
.plcard .disc { width: 74px; height: 74px; }
.plcard .row1 .meta { flex: 1; min-width: 0; }
.plcard .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: rgba(17,17,22,.55); }
.plcard .subs { font-size: 13px; color: rgba(17,17,22,.62); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plcard .row2 { display: flex; align-items: center; justify-content: space-between; }
.plcard .name { font-family: 'Anton', 'Arial Narrow', sans-serif; text-transform: uppercase; font-size: 26px; letter-spacing: .5px; }

/* ---------- nav ---------- */
nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: center; gap: 6px;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--black);
  border-top: 1px solid #17171d;
}
nav button {
  flex: 1; max-width: 112px; padding: 8px 0 5px; border-radius: 14px;
  color: #5d5d66; font-size: 10.5px; font-weight: 600; letter-spacing: .3px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.nico { font-size: 19px; line-height: 1; }
nav button.on { color: #fff; background: #1b1b22; }
body[data-view="search"] nav { background: rgba(10,10,13,.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }

/* ---------- mini player ---------- */
.mini {
  position: fixed; left: 50%; transform: translateX(-50%);
  width: min(calc(100% - 28px), 492px);
  bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 29;
  display: flex; align-items: center; gap: 12px;
  background: #16161c; border: 1px solid #26262e; border-radius: 20px;
  padding: 10px 14px 10px 10px; color: #fff;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.mini-disc {
  width: 48px; height: 48px; border-radius: 50%; flex: none;
  background-size: cover; background-position: center; background-color: #22222a; position: relative;
}
.mini-disc .hole, .vinyl .hole {
  position: absolute; inset: 50% auto auto 50%; width: 17px; height: 17px; transform: translate(-50%,-50%);
  border-radius: 50%; border: 4px solid var(--purple); background: #101014;
}
.mini-meta { flex: 1; min-width: 0; }
.mini-meta .t { font-family: 'Anton', 'Arial Narrow', sans-serif; text-transform: uppercase; font-size: 13.5px; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roundbtn {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: var(--purple); color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.roundbtn:active { transform: scale(.92); }
.roundbtn.ghost { background: transparent; border: 1.5px solid rgba(255,255,255,.5); }
.play-circle { background: transparent; border: 1.5px solid rgba(17,17,22,.4); color: var(--ink); font-size: 14px; }

/* ---------- now playing ---------- */
.np {
  position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain;
  background: var(--black); display: none;
}
.np.open { display: block; }
.np-hero {
  background: var(--purple); color: #fff; text-align: center;
  padding: calc(18px + env(safe-area-inset-top)) 22px 26px;
  border-radius: 0 0 30px 30px;
}
.np-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.np-label { font-weight: 600; font-size: 16px; }
.np-src { font-size: 12px; opacity: .75; letter-spacing: 1px; text-transform: uppercase; }
.np-title { font-size: clamp(30px, 9vw, 40px); margin: 6px 0 8px; }
.np-artist { font-size: 14px; opacity: .85; }

.np-card {
  width: min(calc(100% - 28px), 492px); margin: -14px auto 0; position: relative; z-index: 2;
  background: var(--lavender); border-radius: 28px; text-align: center;
  padding: 24px 22px 0; overflow: hidden;
}
.np-eyebrow { font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: #8a7fb8; }
.np-songname { font-size: 21px; font-weight: 600; margin: 6px 0 18px; color: #17131f; }

.vinyl-wrap { position: relative; width: min(62vw, 240px); aspect-ratio: 1; margin: 0 auto; }
.vinyl {
  position: absolute; inset: 9%; border-radius: 50%;
  background-size: cover; background-position: center; background-color: #241f33;
  box-shadow: 0 14px 40px rgba(60,30,140,.35);
  animation: spin 9s linear infinite; animation-play-state: paused;
}
.vinyl.playing { animation-play-state: running; }
.vinyl::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 32% 30%, rgba(255,255,255,.28), transparent 42%); }
.vinyl .hole { border-color: var(--purple); width: 19px; height: 19px; }
@keyframes spin { to { transform: rotate(360deg); } }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(108,62,245,.15); stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--purple); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 578; stroke-dashoffset: 578; transition: stroke-dashoffset .25s linear; }

.times { display: flex; justify-content: space-between; font-size: 12px; color: #6d6394; margin: 20px 4px 6px; font-variant-numeric: tabular-nums; }
.wave { position: relative; height: 34px; display: flex; align-items: center; gap: 2.5px; overflow: hidden; }
.wave.big { height: 44px; }
.wave i { flex: 1; min-width: 1.5px; border-radius: 2px; background: #c9bfe8; }
.wave.big i { background: #b9abe4; }
.wave .fill { position: absolute; inset: 0; overflow: hidden; display: flex; align-items: center; gap: 2.5px; pointer-events: none; width: 0%; }
.wave .fill i { flex: 1; min-width: 1.5px; background: var(--purple); border-radius: 2px; }
.wave input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; margin: 0; }
.mini .wave { flex: 1; height: 22px; }
.mini .wave i, .mini .wave .fill i { min-width: 1px; background: #3a3a46; }
.mini .wave .fill i { background: var(--purple); }

.np-controls { display: flex; align-items: center; justify-content: center; gap: 44px; background: var(--lavender2); margin: 22px -22px 0; padding: 18px 0 calc(18px + env(safe-area-inset-bottom)); }
.np-controls button { font-size: 26px; color: #241a4d; }
.playbig {
  width: 66px; height: 66px; border-radius: 50%; background: var(--purple); color: #fff; font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 10px 26px rgba(92,47,240,.45);
}
.playbig:active { transform: scale(.94); }

.np-queue { max-width: 520px; margin: 14px auto 0; padding: 4px 18px calc(30px + env(safe-area-inset-bottom)); display: none; }
.np-queue.open { display: block; }
.q-head { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: #6b6b74; padding: 12px 2px 10px; }
.qrow {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 16px; color: #fff;
}
.qrow.on { background: #1b1b22; }
.qrow .disc { width: 42px; height: 42px; }
.qrow .meta { flex: 1; min-width: 0; }
.qrow .t { font-family: 'Anton', 'Arial Narrow', sans-serif; text-transform: uppercase; font-size: 13px; letter-spacing: .4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow .a { font-size: 12px; color: #8e8e96; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* playlist detail overlay */
.detail {
  position: fixed; inset: 0; z-index: 35; background: var(--black); color: #fff;
  display: none; overflow-y: auto;
  max-width: 520px; margin: 0 auto; padding: 0 18px calc(120px + env(safe-area-inset-bottom));
}
.detail.open { display: block; }
.detail .vhead { padding-top: calc(22px + env(safe-area-inset-top)); }
.spin { animation: spin 1s linear infinite; display: inline-block; }
