/* Simplefun Audiobook — playlist-style player for the book.simplefun.id collection. */

:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eaefed;
  --surface-3: #dfe6e3;
  --text: #0f1714;
  --muted: #5b6964;
  --faint: #8a9893;
  --line: rgba(15, 23, 20, 0.08);
  --accent: #0c9a72;
  --accent-strong: #08805e;
  --accent-ink: #ffffff;
  --accent-soft: #d8f3e8;
  --danger: #d64545;
  --shadow: 0 1px 2px rgba(15, 23, 20, .05), 0 8px 24px rgba(15, 23, 20, .07);
  --shadow-lg: 0 18px 50px rgba(15, 23, 20, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Newsreader', Georgia, serif;
  --tabs-h: 62px;
  --mini-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c100f;
    --surface: #141a18;
    --surface-2: #1b2321;
    --surface-3: #25302d;
    --text: #edf3f0;
    --muted: #9aaaa4;
    --faint: #6d7c77;
    --line: rgba(237, 243, 240, 0.08);
    --accent: #3ddba6;
    --accent-strong: #5ee8b9;
    --accent-ink: #04221a;
    --accent-soft: rgba(61, 219, 166, .14);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c100f;
  --surface: #141a18;
  --surface-2: #1b2321;
  --surface-3: #25302d;
  --text: #edf3f0;
  --muted: #9aaaa4;
  --faint: #6d7c77;
  --line: rgba(237, 243, 240, 0.08);
  --accent: #3ddba6;
  --accent-strong: #5ee8b9;
  --accent-ink: #04221a;
  --accent-soft: rgba(61, 219, 166, .14);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
input { font: inherit; color: inherit; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.app { min-height: 100dvh; }
.side { display: none; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) var(--gutter) 10px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(16px);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
}
.top-actions { display: flex; gap: 6px; }
.main {
  outline: none;
  padding: 4px var(--gutter) calc(var(--tabs-h) + var(--mini-h) + var(--safe-b) + 28px);
  max-width: 1200px; margin: 0 auto;
}
.boot { display: grid; place-items: center; min-height: 50vh; }

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: url(/icon.svg) center / cover no-repeat;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; font-size: 13px; color: var(--muted); font-weight: 600; }
.brand-text b { color: var(--text); font-size: 16px; font-weight: 800; }

.icon-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text);
  transition: background .15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }

/* ---------- bottom tabs (mobile) ---------- */
.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 40;
  height: calc(var(--tabs-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--faint);
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg { color: var(--accent); }

/* ---------- headings, sections ---------- */
.hello { margin: 10px 0 18px; }
.hello h1 { margin: 0; font-size: 26px; line-height: 1.15; letter-spacing: -.03em; font-weight: 800; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.section { margin: 26px 0 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 19px; letter-spacing: -.02em; font-weight: 800; }
.section-head a, .section-head button { color: var(--accent-strong); font-weight: 700; font-size: 13px; white-space: nowrap; }
.page-title { margin: 12px 0 16px; font-size: 26px; letter-spacing: -.03em; font-weight: 800; }

/* ---------- featured hero ---------- */
.hero {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 16px; align-items: center;
  padding: 18px; border-radius: 24px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 55% 30%), hsl(calc(var(--h) + 40) 60% 20%));
  box-shadow: var(--shadow);
}
.hero::before {
  content: ""; position: absolute; inset: -40%; z-index: -1;
  background: radial-gradient(circle at 80% 20%, hsl(var(--h) 80% 60% / .5), transparent 45%);
}
.hero-kicker { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; opacity: .8; }
.hero h2 { margin: 6px 0 4px; font-size: 21px; line-height: 1.2; letter-spacing: -.02em; }
.hero p { margin: 0; font-size: 13px; opacity: .85; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hero-cover { border-radius: 10px; aspect-ratio: 2/3; width: 104px; object-fit: cover; box-shadow: 0 12px 30px rgba(0,0,0,.4); transform: rotate(3deg); }
.hero-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.hero-actions .btn { height: 40px; padding: 0 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  transition: transform .12s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-light { background: #fff; color: #0f1714; }
.btn-glass { background: rgba(255,255,255,.16); color: #fff; }
.btn-glass:hover { background: rgba(255,255,255,.24); }

/* ---------- horizontal shelves ---------- */
.shelf {
  display: grid; grid-auto-flow: column; gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 6px;
  scroll-padding: 0 var(--gutter);
}
.shelf::-webkit-scrollbar { display: none; }
.shelf > * { scroll-snap-align: start; }

/* continue cards */
.cont {
  width: 272px; display: grid; grid-template-columns: 56px minmax(0, 1fr) 40px; gap: 12px; align-items: center;
  padding: 10px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
  text-align: left;
}
.cont img { width: 56px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.cont-title { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cont-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.round-play {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
}
.round-play svg { width: 20px; height: 20px; }

/* playlist tiles */
.pl-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pl-tile {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 132px; padding: 14px; border-radius: var(--radius); color: #fff; text-align: left;
  background: linear-gradient(150deg, hsl(var(--h) 62% 44%), hsl(calc(var(--h) + 35) 58% 28%));
  box-shadow: var(--shadow);
  transition: transform .15s;
}
.pl-tile:active { transform: scale(.98); }
.pl-tile-name { position: relative; z-index: 1; font-weight: 800; font-size: 15px; line-height: 1.2; letter-spacing: -.01em; max-width: 72%; }
.pl-tile-count { position: relative; z-index: 1; font-size: 12px; opacity: .85; font-weight: 600; }
.pl-tile-art { position: absolute; right: -14px; bottom: -14px; width: 74px; z-index: 0; }
.pl-tile-art img {
  position: absolute; width: 54px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0,0,0,.35); background: rgba(255,255,255,.15);
}
.pl-tile-art img:nth-child(1) { right: 26px; bottom: 22px; transform: rotate(-14deg); opacity: .75; }
.pl-tile-art img:nth-child(2) { right: 2px; bottom: 14px; transform: rotate(14deg); }
.pl-tile.wide { grid-column: span 2; min-height: 96px; }
.pl-tile .pl-ico { position: absolute; right: 14px; top: 14px; opacity: .9; }
.pl-tile .pl-ico svg { width: 26px; height: 26px; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 8px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); white-space: nowrap;
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }

/* ---------- track list ---------- */
.tracks { list-style: none; margin: 0; padding: 0; }
.track {
  display: grid; grid-template-columns: 46px minmax(0, 1fr) auto 36px; gap: 12px; align-items: center;
  padding: 8px 6px; margin: 0 -6px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s;
}
.track:hover { background: var(--surface-2); }
.track:active { background: var(--surface-3); }
.track-art { position: relative; width: 46px; }
.track-art img { width: 46px; aspect-ratio: 2/3; object-fit: cover; border-radius: 7px; background: var(--surface-2); }
.track-art .eq { position: absolute; inset: 0; display: none; place-items: center; background: rgba(0,0,0,.45); border-radius: 7px; }
.track.is-current .track-art .eq { display: grid; }
.track-body { min-width: 0; }
.track-title { display: block; font-weight: 700; font-size: 14.5px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track.is-current .track-title { color: var(--accent-strong); }
.track-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.track-sub > span:not(.badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.track-sub > span:last-child { flex-shrink: 4; }
.track-sub .dot { flex: none; }
.track-sub .dot::before { content: "·"; }
.track-dur { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; text-align: right; }
.track-dur .done { color: var(--accent-strong); display: inline-flex; }
.track-dur .done svg { width: 16px; height: 16px; }
.track-more { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.track-more:hover { background: var(--surface-3); color: var(--text); }
.track-more svg { width: 20px; height: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px; border-radius: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .02em; flex: none;
  background: var(--surface-2); color: var(--muted);
}
.badge svg { width: 12px; height: 12px; }
.badge.mp3 { background: var(--accent-soft); color: var(--accent-strong); }
.track-prog { display: block; height: 3px; border-radius: 3px; background: var(--surface-3); margin-top: 5px; overflow: hidden; max-width: 160px; }
.track-prog i { display: block; height: 100%; background: var(--accent); }

.eq { gap: 2px; }
.eq-bars { display: flex; gap: 2.5px; align-items: flex-end; height: 16px; }
.eq-bars i { width: 3px; background: #fff; border-radius: 2px; animation: eq 1s ease-in-out infinite; }
.eq-bars i:nth-child(2) { animation-delay: -.4s; }
.eq-bars i:nth-child(3) { animation-delay: -.7s; }
.paused .eq-bars i { animation-play-state: paused; }
@keyframes eq { 0%, 100% { height: 30%; } 50% { height: 100%; } }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty svg { width: 44px; height: 44px; margin: 0 auto 10px; color: var(--faint); }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.more-row { display: flex; justify-content: center; margin: 14px 0 0; }

/* ---------- playlist page header ---------- */
.pl-hero {
  position: relative; overflow: hidden; isolation: isolate;
  margin: 0 calc(var(--gutter) * -1) 6px; padding: 20px var(--gutter) 20px;
  color: #fff;
  background: linear-gradient(180deg, hsl(var(--h) 55% 36%), hsl(calc(var(--h) + 30) 50% 18%));
}
.pl-hero-back { margin: -6px 0 6px -10px; color: #fff; }
.pl-hero-row { display: flex; gap: 16px; align-items: flex-end; }
.pl-mosaic {
  flex: none; width: 116px; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  box-shadow: 0 14px 34px rgba(0,0,0,.35); background: rgba(255,255,255,.12);
}
.pl-mosaic img { width: 100%; height: 100%; object-fit: cover; }
.pl-mosaic.single { display: block; }
.pl-kicker { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.pl-hero h1 { margin: 4px 0 6px; font-size: 25px; line-height: 1.12; letter-spacing: -.03em; }
.pl-meta { font-size: 13px; opacity: .85; }
.pl-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.pl-actions .big-play { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px rgba(0,0,0,.25); margin-left: auto; }
.pl-actions .big-play svg { width: 28px; height: 28px; }
.pl-actions .icon-btn { color: #fff; }
.pl-actions .icon-btn:hover { background: rgba(255,255,255,.15); }
.pl-actions .icon-btn[aria-pressed="true"] { color: var(--accent); }
.pl-desc { margin: 12px 0 0; font-size: 13.5px; opacity: .85; max-width: 60ch; }

/* ---------- search ---------- */
.search {
  position: sticky; top: calc(62px + env(safe-area-inset-top, 0px)); z-index: 10;
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px; margin: 4px 0 14px;
  border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.search svg { width: 20px; height: 20px; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; }
.search button { color: var(--muted); }

/* ---------- mini player ---------- */
.mini {
  position: fixed; z-index: 41;
  left: 8px; right: 8px; bottom: calc(var(--tabs-h) + var(--safe-b) + 6px);
  height: var(--mini-h); padding: 8px 6px 8px 8px; border-radius: 16px;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(20px);
  -webkit-backdrop-filter: saturate(1.6) blur(20px);
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  overflow: hidden; cursor: pointer;
  animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.mini-left { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: center; min-width: 0; }
.mini-right { display: none; }
.mini-art { width: 34px; aspect-ratio: 2/3; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.mini-body { min-width: 0; }
.mini-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-ctrls { display: flex; align-items: center; }
.mini-ctrls .icon-btn svg { width: 26px; height: 26px; }
.mini-ctrls .seek-btn, .mini-ctrls .vol { display: none; }
.mini-prog { position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.mini-prog i { display: block; height: 100%; background: var(--accent); width: 0; }
.mini-desk { display: none; }

/* ---------- now playing ---------- */
.np {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  color: #fff; background: #111;
  overflow: hidden;
  animation: sheetUp .32s cubic-bezier(.2,.8,.2,1);
}
.np.closing { animation: sheetDown .24s ease-in forwards; }
@keyframes sheetUp { from { transform: translateY(100%); } }
@keyframes sheetDown { to { transform: translateY(100%); } }
.np-bg { position: absolute; inset: 0; z-index: 0; }
.np-bg img { position: absolute; inset: -20%; width: 140%; height: 140%; max-width: none; object-fit: cover; filter: blur(60px) saturate(1.5) brightness(.55); transform: scale(1.1); }
.np-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.55) 60%, rgba(0,0,0,.75)); }
.np-inner {
  position: relative; z-index: 1; flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  width: 100%; max-width: 520px; margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 20px calc(16px + var(--safe-b));
}
.np-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; }
.np-head .icon-btn { color: #fff; }
.np-head .icon-btn:hover { background: rgba(255,255,255,.12); }
.np-from { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; opacity: .7; font-weight: 700; }
.np-from-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-left { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.np-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 14px 0; }
.np-cover {
  height: 100%; max-height: 420px; max-width: 100%; aspect-ratio: 2/3; object-fit: cover;
  border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.np.is-paused .np-cover { transform: scale(.94); }
.np-lyrics {
  width: 100%; height: 100%; overflow-y: auto; padding: 8px 2px 40vh;
  mask-image: linear-gradient(180deg, transparent, #000 8%, #000 80%, transparent);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 8%, #000 80%, transparent);
  scrollbar-width: none;
}
.np-lyrics::-webkit-scrollbar { display: none; }
.lyr { margin: 0 0 18px; font-family: var(--serif); font-size: 19px; line-height: 1.55; color: rgba(255,255,255,.42); cursor: pointer; transition: color .3s; }
.lyr.h { font-family: var(--font); font-weight: 800; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; margin-top: 26px; }
.lyr.on { color: #fff; }
.lyr.past { color: rgba(255,255,255,.62); }
.np-info { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; margin-top: 4px; }
.np-title { margin: 0; font-size: 21px; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
.np-sub { margin-top: 3px; font-size: 14px; opacity: .75; }
.np-sub a { text-decoration: underline; text-decoration-color: rgba(255,255,255,.35); text-underline-offset: 3px; }
.np-fav { color: #fff; }
.np-fav[aria-pressed="true"] { color: var(--accent); }
.np-fav svg { width: 26px; height: 26px; }
.np-chapter { font-size: 12.5px; margin-top: 10px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 19px; }

.scrub { margin-top: 10px; }
.range {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0; cursor: pointer;
  --p: 0%;
}
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, currentColor var(--p), rgba(127,127,127,.35) var(--p)); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: rgba(127,127,127,.35); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: currentColor; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: currentColor; border: 0; transition: transform .1s; }
.range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: currentColor; border: 0; }
.range:active::-webkit-slider-thumb { transform: scale(1.3); }
.times { display: flex; justify-content: space-between; font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; margin-top: -2px; }

.np-ctrls { display: flex; align-items: center; justify-content: space-between; margin: 10px -6px 0; }
.np-ctrls .icon-btn { color: #fff; width: 48px; height: 48px; }
.np-ctrls .icon-btn:hover { background: rgba(255,255,255,.12); }
.np-ctrls .icon-btn svg { width: 28px; height: 28px; }
.np-ctrls .icon-btn.sm svg { width: 22px; height: 22px; }
.np-ctrls .icon-btn.sm { opacity: .75; position: relative; }
.np-ctrls .icon-btn.sm.on { opacity: 1; color: var(--accent); }
.np-ctrls .icon-btn.sm.on::after { content: ""; position: absolute; bottom: 6px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor; }
.np-ctrls .repeat-one { position: absolute; font-size: 9px; font-weight: 800; top: 13px; left: 0; right: 0; text-align: center; }
.np-ctrls .play {
  width: 70px; height: 70px; border-radius: 50%; background: #fff; color: #111;
  display: grid; place-items: center; transition: transform .12s;
}
.np-ctrls .play:active { transform: scale(.94); }
.np-ctrls .play svg { width: 34px; height: 34px; }
.np-extra { display: flex; justify-content: space-between; gap: 8px; margin-top: 14px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 13px; font-weight: 700;
}
.pill:hover { background: rgba(255,255,255,.2); }
.pill svg { width: 18px; height: 18px; }
.pill.on { background: #fff; color: #111; }
.np-note { font-size: 12px; opacity: .7; text-align: center; margin-top: 10px; }

.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.np .spinner, .mini .spinner { width: 26px; height: 26px; border-color: rgba(127,127,127,.3); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- bottom sheet ---------- */
.sheet-scrim { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.45); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 71; left: 0; right: 0; bottom: 0;
  max-height: 82dvh; display: flex; flex-direction: column;
  background: var(--surface); color: var(--text);
  border-radius: 22px 22px 0 0; box-shadow: var(--shadow-lg);
  padding: 8px 0 calc(12px + var(--safe-b));
  animation: sheetUp .26s cubic-bezier(.2,.8,.2,1);
}
.sheet:focus { outline: none; }
.sheet-grab { width: 40px; height: 5px; border-radius: 5px; background: var(--surface-3); margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 4px 20px 10px; }
.sheet-head h3 { margin: 0; font-size: 17px; flex: 1; }
.sheet-body { overflow-y: auto; padding: 0 20px 6px; overscroll-behavior: contain; }
.sheet-book { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 4px 20px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.sheet-book img { width: 48px; aspect-ratio: 2/3; object-fit: cover; border-radius: 7px; }
.sheet-book b { display: block; line-height: 1.25; }
.sheet-book span { font-size: 13px; color: var(--muted); }
.menu-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 50px; padding: 0 4px;
  text-align: left; font-weight: 600; border-radius: 10px;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item svg { width: 22px; height: 22px; color: var(--muted); }
.menu-item.on { color: var(--accent-strong); }
.menu-item.on svg { color: var(--accent-strong); }
.menu-item .check { margin-left: auto; }
.sheet-sub { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.sheet .track { margin: 0 -6px; }
.sheet .np-now { background: var(--accent-soft); }

.toast {
  position: fixed; z-index: 90; left: 50%; bottom: calc(var(--tabs-h) + var(--mini-h) + var(--safe-b) + 22px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg); font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.about { max-width: 640px; }
.about p { color: var(--muted); }
.about h2 { font-size: 18px; margin: 26px 0 8px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.stat { background: var(--surface); border-radius: var(--radius-sm); padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------- tablets ---------- */
@media (min-width: 640px) {
  :root { --gutter: 24px; }
  .pl-grid { grid-template-columns: repeat(3, 1fr); }
  .pl-tile.wide { grid-column: span 1; min-height: 132px; }
  .hero { grid-template-columns: minmax(0, 1fr) 150px; padding: 26px; }
  .hero-cover { width: 150px; }
  .hero h2 { font-size: 26px; }
  .pl-mosaic { width: 170px; }
  .pl-hero h1 { font-size: 34px; }
  .mini { left: 50%; right: auto; width: min(620px, calc(100% - 32px)); transform: translateX(-50%); animation: none; }
}

/* ---------- desktop ---------- */
@media (min-width: 1000px) {
  :root { --mini-h: 84px; }
  .app {
    display: grid; grid-template-columns: 264px 1fr; grid-template-rows: auto 1fr;
    grid-template-areas: "side top" "side main";
    min-height: 100dvh;
  }
  .side {
    grid-area: side; display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    padding: 20px 14px calc(var(--mini-h) + 20px);
    background: var(--surface); border-right: 1px solid var(--line);
  }
  .side .brand { padding: 0 8px 18px; }
  .side-nav a, .side-lists a {
    display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 42px; border-radius: 10px;
    font-weight: 600; color: var(--muted); font-size: 14px;
  }
  .side-nav a svg { width: 22px; height: 22px; }
  .side-nav a:hover, .side-lists a:hover { background: var(--surface-2); color: var(--text); }
  .side-nav a[aria-current="page"], .side-lists a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
  .side-head { margin: 18px 12px 6px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
  .side-lists a { height: 38px; font-size: 13.5px; }
  .side-lists .sw { width: 10px; height: 10px; border-radius: 3px; background: hsl(var(--h) 60% 50%); flex: none; }
  .side-lists .n { margin-left: auto; font-size: 12px; color: var(--faint); }
  .top { grid-area: top; padding-left: 32px; padding-right: 32px; }
  .top .brand { visibility: hidden; }
  .main { grid-area: main; width: 100%; padding: 0 32px calc(var(--mini-h) + 40px); --gutter: 32px; }
  .tabs { display: none; }
  .pl-grid { grid-template-columns: repeat(4, 1fr); }
  .pl-grid.home > :nth-child(9) { display: none; }
  .hello h1 { font-size: 32px; }
  .search { top: 66px; }
  .shelf { grid-auto-flow: column; }
  .cont { width: 300px; }
  .track { grid-template-columns: 30px 46px minmax(0, 1fr) 160px auto 36px; padding: 8px 10px; margin: 0 -10px; }
  .track-num { display: block !important; text-align: center; color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; }
  .track.is-current .track-num { color: var(--accent-strong); }
  .track-cat { display: block !important; font-size: 12.5px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .toast { bottom: calc(var(--mini-h) + 24px); }

  /* the mini player becomes a full-width player bar */
  .mini {
    left: 0; right: 0; bottom: 0; width: auto; transform: none;
    height: var(--mini-h); border-radius: 0; border: 0; border-top: 1px solid var(--line);
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; padding: 0 24px;
    cursor: default; animation: none;
    background: var(--surface);
  }
  .mini-left { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center; min-width: 0; cursor: pointer; }
  .mini-art { width: 44px; }
  .mini-prog { display: none; }
  .mini-ctrls { display: none; }
  .mini-desk { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
  .mini-desk .row { display: flex; align-items: center; gap: 6px; }
  .mini-desk .icon-btn { width: 38px; height: 38px; color: var(--muted); }
  .mini-desk .icon-btn:hover { color: var(--text); }
  .mini-desk .icon-btn svg { width: 22px; height: 22px; }
  .mini-desk .icon-btn.on { color: var(--accent-strong); }
  .mini-desk .play { width: 40px; height: 40px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; margin: 0 6px; }
  .mini-desk .play svg { width: 22px; height: 22px; }
  .mini-desk .scrubline { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; width: 100%; font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
  .mini-desk .scrubline span:last-child { text-align: left; }
  .mini-desk .scrubline span:first-child { text-align: right; }
  .mini-desk .range { color: var(--text); }
  .mini-right { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
  .mini-right .icon-btn { width: 38px; height: 38px; color: var(--muted); }
  .mini-right .icon-btn:hover { color: var(--text); }
  .mini-right .icon-btn svg { width: 21px; height: 21px; }
  .mini-right .speed { font-size: 12.5px; font-weight: 800; color: var(--muted); padding: 0 8px; height: 30px; border-radius: 8px; }
  .mini-right .speed:hover { background: var(--surface-2); color: var(--text); }
  .mini-right .range { width: 110px; color: var(--muted); }

  /* now playing: two columns, cover and controls left, synced text right */
  .np-inner { max-width: 1180px; display: grid; grid-template-columns: minmax(340px, 440px) 1fr; grid-template-rows: auto 1fr; column-gap: 64px; padding: 20px 40px 32px; }
  .np-head { grid-column: 1 / -1; }
  .np-left { display: flex; flex-direction: column; min-height: 0; }
  .np-stage { flex: 1; }
  .np-right { display: block !important; min-height: 0; padding-top: 10px; }
  .np-right .np-lyrics { height: 100%; }
  .np-toggle-text { display: none !important; }
  .lyr { font-size: 22px; }
  .sheet { left: 50%; right: auto; bottom: 50%; width: 460px; transform: translate(-50%, 50%); border-radius: 22px; animation: fade .2s; }
  .sheet-grab { display: none; }
}
.track-num, .track-cat, .np-right { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
