/* Secret Spot Sounds: "Studio Night / Studio Day".
   A calm near-black (or warm paper) studio where one amber light means
   "sound". Waveforms and generated pack sleeves carry the colour.
   Pills for anything you press, 10-14px corners for things that hold content. */
:root {
  /* light: warm paper, ink, one amber light */
  --bg: #F7F6F2;
  --bg-deep: #EFEDE7;
  --surface: #FFFFFF;
  --surface-2: #F2F0EB;
  --surface-3: #E7E4DD;
  --ink: #17171B;
  --ink-2: #56545C;
  --ink-3: #6E6B73;
  --line: #E5E2DB;
  --line-strong: #8E8A84;
  --signal: #F2A516;
  --signal-hi: #FFB52E;
  --signal-ink: #9A5A00;
  --on-signal: #1C1405;
  --signal-wash: rgb(242 165 22 / 0.10);
  --signal-ring: rgb(242 165 22 / 0.28);
  --wave-idle: #CBC7BF;
  --wave-hover: #A29D94;
  --wave-played: #E2890B;
  --wave-head: #17171B;
  --danger: #B42F25;
  --ok: #1E7A47;
  --toast-bg: #17171B;
  --toast-ink: #F7F6F2;
  --glass: rgb(247 246 242 / 0.82);
  --scrim: rgb(23 23 27 / 0.45);
  --shadow-1: 0 1px 2px rgb(23 23 27 / 0.06);
  --shadow-2: 0 1px 2px rgb(23 23 27 / 0.05), 0 8px 24px -8px rgb(23 23 27 / 0.12);
  --shadow-3: 0 2px 6px rgb(23 23 27 / 0.06), 0 24px 60px -20px rgb(23 23 27 / 0.28);
  --glow-signal: 0 8px 24px -8px rgb(242 165 22 / 0.65);

  /* sample-type colours: dots and pack sleeves only, never UI chrome */
  --cat-tangerine: #FF6A3D;
  --cat-cobalt: #4C7DFF;
  --cat-pink: #FF4F8B;
  --cat-teal: #23B5A5;
  --cat-honey: #F2B33D;
  --cat-clay: #C77D4A;
  --cat-lime: #7BD148;
  --cat-periwinkle: #9A86FF;
  --cat-rose: #E8708F;
  --cat-graphite: #8A8F98;

  --font-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --font-body: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --fs-h1: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  --fs-h2: 1.375rem;
  --fs-h3: 1.0625rem;
  --fs-sm: 0.875rem;
  --fs-label: 0.75rem;
  --fs-mono: 0.8125rem;

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --gutter: 16px;
  --page: 1200px;
  --header-h: 64px;
  --tabbar-h: 0px;
  --player-h: 0px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --t-press: 100ms;
  --t-fast: 160ms;
  --t-base: 240ms;
  --t-slow: 420ms;
  --t-enter: 520ms;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0B0D;
    --bg-deep: #070708;
    --surface: #141417;
    --surface-2: #1C1C20;
    --surface-3: #26262B;
    --ink: #F3EFE7;
    --ink-2: #B6B1A8;
    --ink-3: #8D887F;
    --line: #242428;
    --line-strong: #6B6873;
    --signal: #F7B23B;
    --signal-hi: #FFC35C;
    --signal-ink: #F7B23B;
    --on-signal: #1C1405;
    --signal-wash: rgb(247 178 59 / 0.09);
    --signal-ring: rgb(247 178 59 / 0.30);
    --wave-idle: #3A3942;
    --wave-hover: #6B6873;
    --wave-played: #F7B23B;
    --wave-head: #F3EFE7;
    --danger: #FF7A6B;
    --ok: #4FCB8A;
    --toast-bg: #F3EFE7;
    --toast-ink: #0B0B0D;
    --glass: rgb(20 20 23 / 0.78);
    --scrim: rgb(0 0 0 / 0.6);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -10px rgb(0 0 0 / 0.6);
    --shadow-3: 0 2px 8px rgb(0 0 0 / 0.5), 0 30px 70px -20px rgb(0 0 0 / 0.75);
    --glow-signal: 0 8px 28px -8px rgb(247 178 59 / 0.55);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0B0D;
  --bg-deep: #070708;
  --surface: #141417;
  --surface-2: #1C1C20;
  --surface-3: #26262B;
  --ink: #F3EFE7;
  --ink-2: #B6B1A8;
  --ink-3: #8D887F;
  --line: #242428;
  --line-strong: #6B6873;
  --signal: #F7B23B;
  --signal-hi: #FFC35C;
  --signal-ink: #F7B23B;
  --on-signal: #1C1405;
  --signal-wash: rgb(247 178 59 / 0.09);
  --signal-ring: rgb(247 178 59 / 0.30);
  --wave-idle: #3A3942;
  --wave-hover: #6B6873;
  --wave-played: #F7B23B;
  --wave-head: #F3EFE7;
  --danger: #FF7A6B;
  --ok: #4FCB8A;
  --toast-bg: #F3EFE7;
  --toast-ink: #0B0B0D;
  --glass: rgb(20 20 23 / 0.78);
  --scrim: rgb(0 0 0 / 0.6);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 30px -10px rgb(0 0 0 / 0.6);
  --shadow-3: 0 2px 8px rgb(0 0 0 / 0.5), 0 30px 70px -20px rgb(0 0 0 / 0.75);
  --glow-signal: 0 8px 28px -8px rgb(247 178 59 / 0.55);
  color-scheme: dark;
}
@media (min-width: 600px) { :root { --gutter: 20px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--tabbar-h) + var(--player-h) + env(safe-area-inset-bottom, 0px));
}
body.has-player { --player-h: 92px; }
[hidden] { display: none !important; }
::selection { background: var(--signal-ring); color: var(--ink); }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
h1, h2 { font-family: var(--font-display); font-weight: 700; line-height: 1.08; letter-spacing: -0.025em; text-wrap: balance; margin: 0; }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); letter-spacing: -0.015em; }
p { margin: 0; }
.accent { font-style: normal; color: var(--signal-ink); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--fs-mono); }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--signal); color: var(--on-signal); padding: 8px 12px; z-index: 50; border-radius: var(--r-pill); }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
kbd { font: 500 11px var(--font-mono); background: var(--surface-3); color: var(--ink-2); border-radius: 6px; padding: 1px 6px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font: 600 var(--fs-label)/1.2 var(--font-body); text-transform: uppercase; letter-spacing: 0.14em; color: var(--signal-ink);
}
.eyebrow::before { content: ""; width: 1.5rem; height: 2px; border-radius: 2px; background: var(--signal); }
.filter-legend { font: 600 var(--fs-label)/1.2 var(--font-body); text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-3); padding: 0; margin: 0; }

/* ---------------------------------------------------------------- header */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 20;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base) var(--ease-out);
}
body.scrolled .top { border-bottom-color: var(--line); }
.top-inner {
  max-width: var(--page);
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-name { font: 800 1.25rem/1 var(--font-display); letter-spacing: -0.03em; white-space: nowrap; }
.brand-text { display: flex; flex-direction: column; gap: 3px; }
.brand-by { font: 500 11px/1 var(--font-body); color: var(--ink-3); letter-spacing: 0.02em; white-space: nowrap; }
.meter { display: inline-flex; align-items: center; gap: 2px; height: 22px; }
.meter i { display: block; width: 4px; border-radius: 2px; background: var(--signal); height: 40%; transform-origin: center; }
.meter i:nth-child(2) { height: 85%; }
.meter i:nth-child(3) { height: 60%; }
.meter i:nth-child(4) { height: 100%; }
.meter i:nth-child(5) { height: 50%; }
body.is-playing .meter i, .row[data-phase="playing"] .mini-meter i { animation: vu 0.9s ease-in-out infinite alternate; }
.meter i:nth-child(2), .mini-meter i:nth-child(2) { animation-delay: -0.3s; }
.meter i:nth-child(3), .mini-meter i:nth-child(3) { animation-delay: -0.6s; }
.meter i:nth-child(4) { animation-delay: -0.15s; }
.meter i:nth-child(5) { animation-delay: -0.45s; }
@keyframes vu { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }

.nav { display: flex; gap: 2px; padding: 4px; background: var(--surface-2); border-radius: var(--r-pill); flex: none; }
.nav a {
  height: 36px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: var(--r-pill);
  font: 500 var(--fs-sm) var(--font-body); color: var(--ink-2); text-decoration: none;
  transition: background var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}
.nav a.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 460px; }
.search input {
  width: 100%; height: 40px; padding: 0 40px 0 40px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid transparent;
}
.search input:focus { background: var(--surface); }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); }
.search input:focus ~ .search-kbd { display: none; }
.nav-upload { flex: none; margin-left: auto; }
.account { display: flex; align-items: center; gap: 6px; flex: none; }
.account-name { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; font-size: var(--fs-sm); }

.setup-banner { background: var(--signal-wash); border-bottom: 1px solid var(--line); padding: 10px var(--gutter); text-align: center; font-size: 14px; }

/* ---------------------------------------------------------------- phone tab bar */
.tabbar { display: none; }
@media (max-width: 719px) {
  :root { --header-h: 56px; --tabbar-h: 56px; }
  body.has-player { --player-h: 100px; }
  .top { position: static; }
  .top-inner { flex-wrap: wrap; gap: 10px 12px; padding-block: 8px 10px; }
  .nav, .top .nav-upload, .search-kbd { display: none; }
  .account { margin-left: auto; }
  .account .btn-quiet, .account-label { display: none; }
  .search { order: 5; flex-basis: 100%; max-width: none; }
  .search input { height: 44px; }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    z-index: 31;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    backdrop-filter: blur(18px) saturate(1.2);
    border-top: 1px solid var(--line);
  }
  .tabbar a {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 56px; color: var(--ink-3); text-decoration: none; font: 500 0.6875rem/1.2 var(--font-body);
  }
  .tabbar a svg { transition: transform var(--t-press) var(--ease-out); }
  .tabbar a:active svg { transform: scale(0.9); }
  .tabbar a.is-active { color: var(--ink); }
  .tabbar a.is-active::before { content: ""; position: absolute; top: 4px; width: 16px; height: 3px; border-radius: 2px; background: var(--signal); }
  .foot-keys { display: none; }
}
@media (max-width: 380px) { .brand-name { font-size: 1.1rem; } }
@media (max-width: 340px) { .brand .meter { display: none; } }

/* ---------------------------------------------------------------- page */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--page);
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.page:focus { outline: none; }
.view-enter { animation: view-in 280ms var(--ease-out); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
.foot { width: 100%; max-width: var(--page); margin: 0 auto; padding: 24px var(--gutter) 32px; color: var(--ink-3); font-size: 13px; border-top: 1px solid var(--line); }
.foot p { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
.intro { display: flex; flex-direction: column; gap: 10px; max-width: 46rem; }
.intro p { color: var(--ink-2); max-width: 42rem; }
.loading { padding: 24px 0; }
.notice { padding: 12px 16px; border-radius: var(--r-sm); background: var(--signal-wash); border-left: 2px solid var(--signal); }

/* ---------------------------------------------------------------- controls */
input, select, textarea {
  font: 400 16px/1.4 var(--font-body);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  min-width: 0;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
input:not([type]), input[type=email], input[type=search], select { height: 44px; padding-block: 0; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--signal); outline: none; box-shadow: 0 0 0 4px var(--signal-ring); }
label { font-weight: 500; }
small { font-size: 0.8rem; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%238E8A84' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") right 12px center/16px no-repeat;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: var(--r-pill);
  font: 600 var(--fs-sm)/1 var(--font-body);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--t-base) var(--ease-out), border-color var(--t-base) var(--ease-out),
    box-shadow var(--t-base) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.btn:active { transform: scale(0.98); background: var(--surface-3); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 0.95rem; }
.btn-primary { background: var(--signal); border-color: transparent; color: var(--on-signal); }
.btn-primary:active { background: var(--signal); }
.btn-primary:disabled { background: var(--surface-3); color: var(--ink-3); opacity: 1; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn-wide { width: 100%; }
.btn.is-on { color: var(--signal-ink); border-color: color-mix(in srgb, var(--signal) 50%, var(--line)); }
.btn-arrow { transition: transform var(--t-base) var(--ease-out); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; text-decoration: none;
  transition: background var(--t-base), transform var(--t-press);
}
.icon-btn:active { transform: scale(0.92); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; font-size: var(--fs-sm); font-weight: 500; color: var(--signal-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 4px; }
.link-btn svg { width: 14px; height: 14px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 600px) { .btn { height: 44px; } .btn-sm { height: 36px; } }
@media (hover: hover) {
  .nav a:hover { color: var(--ink); }
  .btn:hover { background: var(--surface-2); border-color: var(--ink-3); }
  .btn-primary:hover { background: var(--signal-hi); border-color: transparent; box-shadow: var(--glow-signal); transform: translateY(-1px); }
  .btn-quiet:hover { border-color: transparent; color: var(--ink); }
  .btn-danger:hover { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
  .btn:hover .btn-arrow { transform: translateX(3px); }
  .icon-btn:hover { background: var(--surface-2); color: var(--ink); }
  a:hover { color: var(--signal-ink); }
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface);
  font: 500 13px/1 var(--font-body); color: var(--ink-2); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: border-color var(--t-base), color var(--t-base), transform var(--t-press);
}
.chip:active { transform: scale(0.97); }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip svg { width: 13px; height: 13px; }
.chip-xs { height: 24px; padding: 0 9px; font-size: 12px; background: var(--surface-2); border: 0; gap: 6px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--cat-graphite)); flex: none; }
.tag-link { font-size: 13px; color: var(--ink-3); text-decoration: none; }
@media (hover: hover) {
  .chip:hover { border-color: var(--line-strong); color: var(--ink); }
  .chip.is-active:hover { color: var(--bg); border-color: var(--ink); }
  .tag-link:hover { color: var(--ink); text-decoration: underline; }
}
.pill { font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: var(--r-pill); }
.pill-wait { display: inline-flex; align-items: center; gap: 6px; background: var(--signal-wash); color: var(--signal-ink); }
.pill-wait::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--signal); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: 0.4; } }
.count { font: 500 12px var(--font-mono); color: var(--ink-3); background: var(--surface-2); border-radius: var(--r-pill); padding: 1px 7px; vertical-align: middle; letter-spacing: 0; }

/* segmented control (Sounds | Packs | Both, Any | All) */
.seg { display: inline-flex; gap: 2px; padding: 4px; margin: 0; border: 0; background: var(--surface-2); border-radius: var(--r-pill); flex: none; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span {
  display: inline-flex; align-items: center; height: 36px; padding: 0 16px; border-radius: var(--r-pill);
  font: 600 var(--fs-sm)/1 var(--font-body); color: var(--ink-2);
  transition: background var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1), 0 0 0 1px var(--line); }
.seg input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }
.seg-small span { height: 30px; padding: 0 12px; font-size: 13px; }

.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { min-height: 44px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-3); font: 500 var(--fs-sm)/1 var(--font-body); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--signal); }

/* ---------------------------------------------------------------- library */
.library { display: flex; flex-direction: column; gap: 16px; }
.lib-intro { display: flex; flex-direction: column; gap: 6px; }
.lib-intro-text { font: 700 clamp(1.4rem, 1.1rem + 1.4vw, 2rem)/1.1 var(--font-display); letter-spacing: -0.025em; text-wrap: balance; }
.toolbar {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--header-h));
  z-index: 10;
  margin-inline: calc(-1 * var(--gutter));
  padding: 10px var(--gutter);
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toolbar-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lib-summary { flex: 1 1 220px; min-width: 0; font-weight: 500; color: var(--ink-2); font-size: var(--fs-sm); }
.sort select { height: 40px; border-radius: var(--r-pill); font-size: 14px; padding-left: 16px; }
.filters-btn { display: none; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: var(--signal); color: var(--on-signal); font: 600 12px/1 var(--font-mono); }
.chip-row { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; padding-block: 2px; }
.chip-row .link-btn { margin-left: 6px; white-space: nowrap; }
.copy-link { margin-left: auto !important; color: var(--ink-2); }
.lib-body { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar { padding-right: 4px; }
.results { display: flex; flex-direction: column; gap: 16px; min-width: 0; transition: opacity var(--t-base); }
.results.is-loading .list:not(:has(.is-skeleton)), .results.is-loading .pack-grid:not(:has(.is-skeleton)) { opacity: 0.5; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.results-head h2 { font-size: 1.25rem; }
.shelf { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 1023px) {
  .lib-body { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .filters-btn { display: inline-flex; }
  .toolbar-row { gap: 8px; }
  .lib-summary { order: 5; flex-basis: 100%; }
}
@media (max-width: 719px) {
  .toolbar { top: env(safe-area-inset-top, 0px); }
  .toolbar-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
  #kind-toggle { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, 1fr); }
  #kind-toggle span { justify-content: center; width: 100%; }
  .filters-btn { grid-column: 1; }
  .sort { grid-column: 2; justify-self: end; }
  .lib-summary { grid-column: 1 / -1; order: 0; }
  .lib-intro-text { font-size: 1.3rem; }
  .eyebrow { font-size: 11px; letter-spacing: 0.1em; }
  .sort select { max-width: 170px; }
}

/* filter panel */
.filters-panel { display: flex; flex-direction: column; gap: 20px; }
.filter-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mode-group .seg { align-self: flex-start; }
.filter-hint { font-size: 13px; color: var(--ink-3); }
.filter-head { display: flex; justify-content: space-between; align-items: center; }
.filter-clear { font-size: 12px; color: var(--ink-3); }
.checks { display: flex; flex-direction: column; }
.check-row {
  position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 36px; padding: 0 8px; margin-inline: -8px; border-radius: var(--r-xs); cursor: pointer; font-weight: 400;
  transition: background var(--t-fast), opacity var(--t-base);
}
.check-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-box {
  width: 20px; height: 20px; border-radius: var(--r-xs); border: 1.5px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; color: var(--on-signal);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.check-box svg { width: 14px; height: 14px; transform: scale(0.6); opacity: 0; transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast); }
.check-row input:checked + .check-box { background: var(--signal); border-color: var(--signal); }
.check-row input:checked + .check-box svg { transform: scale(1); opacity: 1; }
.check-row input:focus-visible + .check-box { outline: 2px solid var(--signal); outline-offset: 2px; }
.check-round { border-radius: 50%; }
.check-row input:checked + .check-round::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--on-signal); }
.check-label { font-size: 15px; }
.check-row input:checked ~ .check-label { font-weight: 600; }
.check-count { color: var(--ink-3); font-size: 12px; transition: opacity var(--t-base); }
.is-stale .check-count { opacity: 0.6; }
.check-row.is-dead { color: var(--ink-3); cursor: not-allowed; }
.check-row.is-dead .check-box { border-color: var(--line); }
.no-counts .check-count { display: none; }
.radio-row { grid-template-columns: 20px minmax(0, 1fr); }
@media (hover: hover) { .check-row:not(.is-dead):hover { background: var(--surface-2); } }

/* phone / tablet filter sheet */
.sheet {
  border: 0; padding: 0; margin: auto 0 0; width: 100%; max-width: none; max-height: 90vh;
  background: var(--surface); color: var(--ink); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-3);
  display: none; flex-direction: column;
}
.sheet[open] { display: flex; animation: sheet-in var(--t-enter) var(--ease-out); }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }
.sheet::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); position: relative; }
.sheet-head::before { content: ""; position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--surface-3); }
.sheet-head h2 { font-size: 1.125rem; }
.sheet-head h2:focus { outline: none; }
.sheet-head .icon-btn { justify-self: end; }
.sheet-head .link-btn { justify-self: start; }
.sheet-body { overflow-y: auto; padding: 16px; flex: 1; }
.sheet-body .checks { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; }
.sheet-body .check-row { min-height: 48px; margin-inline: 0; }
.sheet-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
@media (min-width: 720px) { .sheet { margin: auto; max-width: 560px; border-radius: var(--r-lg); max-height: 85vh; } }

/* ---------------------------------------------------------------- sound rows */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; transition: opacity var(--t-base); }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  scroll-margin: calc(var(--header-h) + 140px) 0 calc(var(--player-h) + var(--tabbar-h) + 24px);
  transition: background var(--t-base) var(--ease-out);
}
.row:first-child { border-top: 0; }
.row.is-current { background: linear-gradient(90deg, var(--signal-wash), transparent 70%); }
.row.is-current::before, .row.is-selected::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--signal); }
.row.is-selected:not(.is-current) { background: var(--surface-2); }
.row.is-selected:not(.is-current)::before { background: var(--line-strong); }
.row.is-processing .wave { opacity: 0.5; }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.row-head { display: flex; align-items: baseline; gap: 4px 8px; flex-wrap: wrap; min-width: 0; }
.row-title { font: 600 var(--fs-h3)/1.3 var(--font-body); letter-spacing: -0.005em; text-decoration: none; overflow-wrap: anywhere; }
.row-by { color: var(--ink-3); font-size: 14px; }
.row-by a { text-decoration: none; color: var(--ink-2); font-weight: 500; }
.mini-meter { display: none; align-items: flex-end; gap: 2px; height: 12px; align-self: center; }
.mini-meter i { width: 3px; height: 100%; border-radius: 1px; background: var(--signal); transform-origin: bottom; }
.mini-meter i:nth-child(1) { height: 60%; }
.mini-meter i:nth-child(3) { height: 80%; }
.row.is-current .mini-meter { display: inline-flex; }
.row-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; color: var(--ink-3); }
.row-actions { display: flex; gap: 6px; align-items: center; }
.stat-btn {
  position: relative; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font: 500 13px var(--font-mono); font-variant-numeric: tabular-nums; cursor: pointer; text-decoration: none;
  transition: border-color var(--t-base), color var(--t-base), transform var(--t-press);
}
.stat-btn svg { width: 16px; height: 16px; transition: transform var(--t-base) var(--ease-out); }
.stat-btn:active { transform: scale(0.95); }
.stat-btn.is-on { color: var(--signal-ink); border-color: color-mix(in srgb, var(--signal) 45%, var(--line)); }
.stat-btn.is-on svg { color: var(--signal); }
.pop svg { animation: pop var(--t-slow) var(--ease-out); }
@keyframes pop { 40% { transform: scale(1.25); } }
.stat-btn.is-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.stat-btn:disabled { opacity: 0.5; cursor: default; }
@media (hover: hover) {
  .row:hover:not(.is-current):not(.is-skeleton) { background: var(--surface-2); }
  .row-title:hover { text-decoration: underline; }
  .stat-btn:hover { border-color: var(--line-strong); color: var(--ink); }
  .stat-dl:hover svg { transform: translateY(2px); }
}
@media (max-width: 600px) {
  .list { border-radius: 0; border-inline: 0; margin-inline: calc(-1 * var(--gutter)); }
  .row { grid-template-columns: 44px minmax(0, 1fr); gap: 8px 12px; padding: 14px var(--gutter); }
  .row-actions { grid-column: 2; }
  /* Compact phone row: title and buttons on top, full-width waveform below. */
  .row:not(.is-skeleton) {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas: "play head actions" "play wave wave" "meta meta meta";
    gap: 4px 12px;
    padding: 12px var(--gutter);
  }
  .row:not(.is-skeleton) > .play-btn { grid-area: play; }
  .row:not(.is-skeleton) .row-main { display: contents; }
  .row:not(.is-skeleton) .row-head { grid-area: head; align-self: end; }
  .row:not(.is-skeleton) .wave { grid-area: wave; height: 30px; }
  .row:not(.is-skeleton) .row-meta { grid-area: meta; padding-left: 56px; }
  .row:not(.is-skeleton) .row-actions { grid-area: actions; grid-column: auto; align-self: end; gap: 4px; }
  .row .stat-btn { height: 32px; padding: 0 9px; gap: 4px; }
  .row .row-by { font-size: 13px; }
  .row .tag-link, .row-meta .chip-xs ~ .chip-xs { display: none; }
  .stat-btn::after { content: ""; position: absolute; inset: -4px; }
}

/* play button and its states */
.play-btn {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  border: 0; background: var(--ink); color: var(--bg); cursor: pointer; flex: none;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-base), box-shadow var(--t-base), color var(--t-base);
}
.play-btn svg { width: 18px; height: 18px; }
.play-btn[data-phase="idle"] svg, .play-btn:not([data-phase]) svg { transform: translateX(1px); }
.play-btn:active { transform: scale(0.94); }
.play-btn[data-phase="playing"], .play-btn[data-phase="loading"], .play-btn[data-phase="paused"] { background: var(--signal); color: var(--on-signal); }
.play-btn[data-phase="playing"] { box-shadow: 0 0 0 4px var(--signal-ring); }
.play-btn[data-phase="loading"]::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--signal); border-top-color: transparent;
  animation: spin 0.8s linear infinite, fade-in 0.1s 120ms both;
}
.play-btn[data-phase="error"] { background: var(--danger); color: #fff; }
.play-btn.is-disabled { background: var(--surface-3); color: var(--ink-3); cursor: default; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } }
@media (hover: hover) {
  .play-btn:not(.is-disabled):hover { background: var(--signal); color: var(--on-signal); transform: scale(1.04); box-shadow: var(--glow-signal); }
}
@media (max-width: 600px) { .play-btn { width: 44px; height: 44px; } }
.play-big { width: 64px; height: 64px; }
.play-big svg { width: 26px; height: 26px; }

.wave { display: block; width: 100%; height: 40px; cursor: pointer; touch-action: pan-y; }
.wave-big { height: 120px; }

/* loading placeholders */
.is-skeleton .play-btn { background: var(--surface-2); }
.skel { display: block; height: 12px; width: 60%; border-radius: 6px; background: var(--surface-2); }
.skel-title { width: 40%; height: 14px; }
.skel-wave { width: 100%; height: 32px; background: repeating-linear-gradient(90deg, var(--surface-3) 0 2px, transparent 2px 5px); opacity: 0.7; }
.skel-meta { width: 30%; }
.is-skeleton .skel, .is-skeleton .play-btn, .is-skeleton .cover, .is-skeleton .sleeve { animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { 50% { opacity: 0.55; } }
.load-more { align-self: center; max-width: 320px; }

/* ---------------------------------------------------------------- pack sleeves */
.pack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 24px 16px; }
.pack-shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1023px) { .pack-shelf { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); } }
@media (max-width: 600px) {
  .pack-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .pack-shelf { display: flex; overflow-x: auto; scroll-snap-type: x proximity; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scrollbar-width: none; }
  .pack-shelf .pack-card { flex: 0 0 72%; scroll-snap-align: start; }
}
.pack-card { position: relative; display: flex; flex-direction: column; min-width: 0; }
.pack-link { display: block; text-decoration: none; border-radius: var(--r-sm); }
.pack-cover-wrap { position: relative; }
.pack-play { position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; z-index: 2; box-shadow: var(--shadow-2); background: var(--signal); color: var(--on-signal); }
@media (hover: hover) {
  .pack-play { opacity: 0; transform: translateY(4px); transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out), background var(--t-base); }
  .pack-card:hover .pack-play, .pack-play:focus-visible, .pack-play[data-phase="playing"], .pack-play[data-phase="loading"] { opacity: 1; transform: none; }
}
.pack-meta { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; font-size: 13px; color: var(--ink-3); min-width: 0; }
.pack-name { font: 600 15px/1.3 var(--font-body); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pack-types { color: var(--ink-3); }
.pack-matching { color: var(--signal-ink); font-weight: 500; }
.is-skeleton .cover { aspect-ratio: 1; border-radius: var(--r-sm); background: var(--surface-2); }
.is-skeleton .pack-info { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.sleeve-wrap { position: relative; }
.sleeve {
  position: relative; z-index: 1; aspect-ratio: 1; border-radius: var(--r-sm); overflow: hidden;
  background:
    radial-gradient(120% 90% at 20% 0%, color-mix(in oklab, var(--c1) 55%, #0D0D10) 0%, transparent 60%),
    radial-gradient(100% 80% at 100% 100%, color-mix(in oklab, var(--c2) 45%, #0D0D10) 0%, transparent 65%),
    #0D0D10;
  box-shadow: var(--shadow-2), inset 0 0 0 1px rgb(255 255 255 / 0.06);
  transition: transform var(--t-slow) var(--ease-out), box-shadow var(--t-slow) var(--ease-out);
}
.sleeve::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: linear-gradient(var(--c1), var(--c2)); border-radius: var(--r-sm) 0 0 var(--r-sm); z-index: 1; }
.sleeve::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, rgb(255 255 255 / 0.10), transparent 40%); pointer-events: none; }
.sleeve-disc {
  position: absolute; z-index: 0; top: 4%; right: 4%; width: 92%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--c1) 0 15%, #111 15.5% 17%, transparent 17.5%), repeating-radial-gradient(circle, #151515 0 1px, #0a0a0a 1px 3px);
  box-shadow: var(--shadow-2);
  transform: translateX(8%);
  transition: transform var(--t-slow) var(--ease-out);
}
.sleeve-art { position: absolute; inset: 14%; border-radius: inherit; mix-blend-mode: screen; opacity: 0.9; }
.sleeve[data-pattern="rings"] .sleeve-art { background: repeating-radial-gradient(circle at 70% 60%, var(--c1) 0 2px, transparent 2px 12px); }
.sleeve[data-pattern="stripes"] .sleeve-art { background: repeating-linear-gradient(calc(var(--seed) * 1deg), var(--c1) 0 10px, transparent 10px 22px, var(--c2) 22px 26px, transparent 26px 40px); }
.sleeve[data-pattern="grid"] .sleeve-art { background: radial-gradient(circle at 30% 40%, var(--c2) 0 7px, transparent 8px), radial-gradient(var(--c1) 1.6px, transparent 1.8px) 0 0 / 14px 14px; }
.sleeve[data-pattern="bars"] .sleeve-art {
  background: repeating-linear-gradient(90deg, var(--c1) 0 4px, transparent 4px 9px);
  -webkit-mask: linear-gradient(transparent 0 25%, #000 25% 75%, transparent 75%);
  mask: linear-gradient(transparent 0 25%, #000 25% 75%, transparent 75%);
}
.sleeve[data-pattern="sun"] .sleeve-art { background: repeating-conic-gradient(from calc(var(--seed) * 1deg) at 50% 110%, var(--c1) 0 6deg, transparent 6deg 14deg); }
.sleeve-label { position: absolute; top: 12px; left: 16px; font: 500 11px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em; color: rgb(255 255 255 / 0.75); }
.sleeve-badge {
  position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--signal); color: #1C1405; font: 800 9px/1 var(--font-display); transform: rotate(-12deg);
}
.sleeve-title {
  position: absolute; left: 16px; right: 14px; bottom: 14px;
  font: 800 clamp(1rem, 0.8rem + 0.8vw, 1.3rem)/1 var(--font-display); letter-spacing: -0.02em; color: #FFF8EC; text-wrap: balance;
  text-shadow: 0 1px 14px rgb(0 0 0 / 0.65);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.sleeve-hero { width: 180px; flex: none; margin-right: 24px; }
.sleeve-hero .sleeve-title { font-size: 1.35rem; }
@media (max-width: 600px) { .sleeve-hero { width: 128px; margin-right: 16px; } .sleeve-hero .sleeve-title { font-size: 1rem; } }
@media (hover: none) { .sleeve-disc { transform: translateX(14%) rotate(12deg); } }
@media (hover: hover) {
  .pack-link:hover .sleeve { transform: translateY(-4px); box-shadow: var(--shadow-3), inset 0 0 0 1px rgb(255 255 255 / 0.06); }
  .pack-link:hover .sleeve-disc { transform: translateX(26%) rotate(30deg); }
  .pack-name:hover { color: var(--signal-ink); }
}
.pack-link:active .sleeve { transform: scale(0.98); }

/* ---------------------------------------------------------------- sound page */
.sound-page { display: flex; flex-direction: column; gap: 20px; }
.sound-head { display: flex; gap: 18px; align-items: center; }
.sound-head h1 { overflow-wrap: anywhere; }
.sound-head > div { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.wave-well { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; }
.sound-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.sound-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
@media (max-width: 760px) { .sound-body { grid-template-columns: minmax(0, 1fr); } }
.sound-text { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.description { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 65ch; color: var(--ink-2); }
.license {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px 16px;
  border-left: 2px solid var(--signal); background: linear-gradient(90deg, var(--signal-wash), transparent 80%); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.license-name { font: 600 var(--fs-label) var(--font-body); text-transform: uppercase; letter-spacing: 0.14em; color: var(--signal-ink); }
.credit { color: var(--ink-3); overflow-wrap: anywhere; }
.specs { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px 16px; }
.specs div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.specs div:last-child { border-bottom: 0; }
.specs dt { color: var(--ink-3); }
.specs dd { margin: 0; text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.comments { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.comments h2 { margin-block: 8px; }
.comment { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment p { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 65ch; }
.comment-head { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.comment-head a { font-weight: 600; text-decoration: none; }
.comment-head .link-btn { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.comment-form { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; }
.comment-form textarea { flex: 1; }

.panel { display: flex; flex-direction: column; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); max-width: 40rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.success h2 { color: var(--ok); }
.pack-checks { display: flex; flex-direction: column; }
.check { display: flex; gap: 12px; align-items: flex-start; font-weight: 400; cursor: pointer; padding: 8px 0; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--signal); flex: none; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1 1 200px; }

/* ---------------------------------------------------------------- profile & pack header */
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: color-mix(in oklab, var(--signal) 28%, var(--surface-3)); color: var(--ink);
  font: 700 0.8rem var(--font-display); flex: none;
}
.avatar-lg { width: 72px; height: 72px; font-size: 1.6rem; }
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.profile-text { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.profile-text p { overflow-wrap: anywhere; }
#profile-form input, #profile-form textarea { width: 100%; }
.pack-head { display: flex; gap: 28px; align-items: flex-end; flex-wrap: wrap; }
.pack-head-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1 1 300px; }
.pack-head-text .row-btns { margin-top: 6px; }

/* ---------------------------------------------------------------- upload */
.upload-form { display: flex; flex-direction: column; gap: 22px; max-width: 48rem; }
.drop {
  display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center;
  padding: 36px 20px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface);
  cursor: pointer; font-weight: 400; transition: border-color var(--t-base), background var(--t-base);
}
.drop.is-over { border-style: solid; border-color: var(--signal); background: var(--signal-wash); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop-text { overflow-wrap: anywhere; }
.drop-preview { display: flex; align-items: center; gap: 14px; width: 100%; }
.drop-preview .wave { flex: 1; height: 80px; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field legend { font-weight: 500; padding: 0; margin-bottom: 8px; }
.type-picker legend span { font-weight: 400; font-size: 14px; }
.type-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.type-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.type-option {
  position: relative; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); cursor: pointer;
  font-weight: 500; font-size: 14px; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.type-option input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.type-option:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.type-option:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }
.type-option:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }
.upload-submit { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
progress { flex: 1 1 160px; accent-color: var(--signal); height: 8px; }

/* ---------------------------------------------------------------- player dock */
.player {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  width: min(calc(100vw - 24px), var(--page));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 44px minmax(120px, 240px) auto minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 12px 10px 10px;
  border-radius: var(--r-lg);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  animation: dock-in var(--t-enter) var(--ease-out);
}
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 24px); } }
.player .play-btn { width: 44px; height: 44px; }
.player-info { display: flex; flex-direction: column; min-width: 0; }
.player-title { font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.player-sub { display: flex; min-width: 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.player-user { text-decoration: none; }
.player-queue { overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.player-queue-btns { display: flex; }
.player-wave { height: 32px; }
.player-time { color: var(--ink-3); white-space: nowrap; font-size: 12px; min-width: 88px; text-align: right; }
@media (max-width: 719px) {
  .player {
    left: 8px; right: 8px; width: auto; transform: none;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px);
    grid-template-columns: 40px minmax(0, 1fr) auto 40px;
    grid-template-rows: auto 24px;
    gap: 6px 10px; padding: 8px; border-radius: var(--r-md);
    animation-name: dock-in-phone;
  }
  @keyframes dock-in-phone { from { opacity: 0; transform: translateY(24px); } }
  .player .play-btn { width: 40px; height: 40px; }
  .player-wave { grid-column: 1 / -1; grid-row: 2; height: 24px; }
  .player-time { display: none; }
}

/* ---------------------------------------------------------------- toast & dialogs */
.toast {
  position: fixed; left: 50%; z-index: 40;
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--tabbar-h) + var(--player-h) + 16px);
  transform: translateX(-50%);
  max-width: min(420px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md);
  background: var(--toast-bg); color: var(--toast-ink); font: 500 var(--fs-sm) var(--font-body); box-shadow: var(--shadow-3);
  animation: toast-in var(--t-base) var(--ease-out);
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); flex: none; }
.toast[data-kind="ok"]::before { background: var(--ok); }
.toast[data-kind="error"] { background: var(--danger); color: #fff; }
.toast[data-kind="error"]::before { background: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.login {
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--ink);
  padding: 24px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow-3);
}
.login[open] { animation: sheet-in var(--t-enter) var(--ease-out); }
.login::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.login > div { display: flex; flex-direction: column; gap: 14px; }
.login .panel-head { margin-bottom: 12px; }
.login > .panel-head { flex-direction: row; }
.login-buttons { display: flex; flex-direction: column; gap: 8px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 600px) {
  .login { margin: auto 0 0; width: 100%; max-width: none; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------------------------------------------------------------- empty states */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 56px 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--ink-2);
}
.list > .empty { border: 0; border-radius: 0; }
.empty strong { font: 700 var(--fs-h2)/1.15 var(--font-display); letter-spacing: -0.015em; color: var(--ink); text-wrap: balance; }
.empty p { max-width: 36ch; }
.empty .row-btns { justify-content: center; margin-top: 4px; }
.flatline {
  position: relative; width: 160px; height: 40px; margin-bottom: 6px;
  background: linear-gradient(var(--wave-idle), var(--wave-idle)) center/100% 2px no-repeat;
}
.flatline::after {
  content: ""; position: absolute; left: 50%; top: 8px; width: 2px; height: 24px; background: var(--signal); border-radius: 1px;
  box-shadow: -6px 6px 0 -0px var(--signal), 6px 10px 0 0 var(--signal);
  animation: blip 2.4s ease-in-out infinite;
}
@keyframes blip { 50% { opacity: 0.5; } }
.drop .flatline { margin: 0; }

/* ---------------------------------------------------------------- motion off */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  body.is-playing .meter i, .row[data-phase="playing"] .mini-meter i { animation: none; }
  .pack-link:hover .sleeve, .pack-link:hover .sleeve-disc { transform: none; }
}

/* ---------------------------------------------------------------- subject search */
.subject-bar { display: flex; align-items: center; gap: 10px; }
.token-box {
  position: relative; flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  min-height: 48px; padding: 6px 12px 6px 40px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line-strong); cursor: text;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.token-box > svg { position: absolute; left: 14px; top: 15px; color: var(--ink-3); }
.token-box:focus-within { border-color: var(--signal); box-shadow: 0 0 0 4px var(--signal-ring); }
.token-box.is-exclude { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.token-box.is-exclude:focus-within { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 22%, transparent); }
.token-box.is-exclude > svg { color: var(--danger); }
.tokens { display: contents; }
.token-box input {
  flex: 1 1 140px; min-width: 120px; height: 34px; padding: 0 4px; border: 0; background: transparent; box-shadow: none !important;
}
.token-box input::-webkit-search-cancel-button { display: none; }
.tok {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 4px 0 12px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--bg); font: 600 13px/1 var(--font-body); white-space: nowrap;
}
.tok-ex { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); }
.tok-not { font: 600 10px/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; margin-right: 4px; opacity: 0.85; }
.tok-x { position: relative; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; opacity: 0.75; }
.tok-x svg { width: 13px; height: 13px; }
.tok-x:hover { opacity: 1; background: rgb(127 127 127 / 0.2); }
.token-suggest {
  position: absolute; z-index: 25; left: 0; right: 0; top: calc(100% + 6px);
  display: flex; flex-direction: column; padding: 6px; max-height: 340px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-3);
  animation: fade-in var(--t-fast) var(--ease-out);
}
.suggest-head { font: 600 var(--fs-label)/1 var(--font-body); text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); padding: 8px 10px 6px; }
.suggest-opt {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  min-height: 44px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink);
  font: 500 15px var(--font-body); text-align: left; cursor: pointer;
}
.suggest-opt.is-active { background: var(--surface-2); }
.suggest-opt.is-active .suggest-name { color: var(--signal-ink); }
.suggest-opt.is-exclude .suggest-name, .suggest-opt.is-exclude.is-active .suggest-name { color: var(--danger); }
.suggest-kind { font: 500 11px var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); }
.suggest-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-count { color: var(--ink-3); font-size: 12px; }
.polarity input[value="exclude"]:checked + span { background: var(--danger); color: #fff; box-shadow: none; }
.match-hint { font-size: 13px; color: var(--ink-3); margin-top: -4px; padding-left: 4px; }
.check-row.is-excluded .check-box { background: var(--danger); border-color: var(--danger); color: #fff; }
.check-row.is-excluded .check-label { text-decoration: line-through; color: var(--danger); }
.check-row.is-excluded .check-count { color: var(--danger); text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; }
.check-box svg + svg { display: none; }
.check-row.is-excluded .check-box svg:first-child { display: none; }
.check-row.is-excluded .check-box svg + svg { display: block; transform: none; opacity: 1; }
@media (max-width: 719px) {
  .subject-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .token-box { grid-column: 1 / -1; order: -1; }
  .subject-bar .seg { display: grid; grid-template-columns: 1fr 1fr; }
  .subject-bar .seg span { justify-content: center; width: 100%; padding: 0 8px; }
}

/* ---------------------------------------------------------------- simplified pieces */
.tok-x::after { content: ""; position: absolute; inset: -10px; }
.play-results { flex: none; }
.spec-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--ink-3); }
.spec-line span { display: inline-flex; align-items: center; gap: 4px; }
.spec-line svg { width: 14px; height: 14px; }
.spec-line a { color: var(--ink-2); }
.chip-license { background: var(--signal-wash); color: var(--signal-ink); border-color: color-mix(in srgb, var(--signal) 45%, var(--line)); font-weight: 600; cursor: default; }
.pack-meta-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.pack-dl { width: 34px; height: 34px; margin-right: -6px; }
.pack-dl svg { width: 16px; height: 16px; }
.pack-dl:disabled { font: 500 11px var(--font-mono); width: auto; padding: 0 6px; border-radius: var(--r-pill); }
.foot-keys { display: inline-flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; }
.foot-keys kbd + kbd { margin-left: -2px; }
.comments h2 { display: flex; align-items: center; gap: 8px; }
@media (max-width: 719px) {
  /* Only the page scrolls; nothing pins half the screen. */
  .toolbar { position: static; }
  .lib-summary { grid-column: 1; align-self: center; }
  .play-results { grid-column: 2; justify-self: end; }
}

/* ---------------------------------------------------------------- songs */

.songs-head { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.songs-head h1 { margin-right: auto; }
.songs-search { position: relative; flex: 0 1 320px; min-width: 0; }
.songs-search input { width: 100%; height: 40px; padding: 0 16px 0 40px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid transparent; }
.songs-search input:focus { background: var(--surface); }
@media (max-width: 600px) {
  .songs-head h1 { flex: 1; }
  .songs-search { order: 5; flex-basis: 100%; }
  .songs-search input { height: 44px; }
}
.songs-tabs { align-items: center; margin-top: 12px; }
.songs-tabs { gap: 20px; }
.songs-tabs a.chip-toggle { margin: 0 0 0 auto; min-height: 0; height: 30px; padding: 0 12px; border: 1px solid var(--line); color: var(--ink-2); flex: none; }
.songs-tabs a.chip-toggle.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-toggle.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.song-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 28px 18px; margin-top: 20px; }
@media (max-width: 600px) { .song-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; } }
.song { position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; border-radius: var(--r-sm); }
.song-cover { position: relative; }
.song-cover > a { display: block; border-radius: var(--r-sm); }
.song-cover .sleeve-disc { display: none; }
.song-play { position: absolute; right: 10px; bottom: 10px; width: 46px; height: 46px; z-index: 2; box-shadow: var(--shadow-2); background: var(--signal); color: var(--on-signal); }
.song.is-current .sleeve { box-shadow: var(--shadow-2), 0 0 0 2px var(--signal); }
.song.is-selected:not(.is-current) .sleeve { box-shadow: var(--shadow-2), 0 0 0 2px var(--line-strong); }
.song.is-processing .sleeve { opacity: 0.6; }
.song-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.song-title { font: 600 15px/1.3 var(--font-body); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-by { font-size: 13px; color: var(--ink-2); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.song-meta .stat-btn { height: 28px; padding: 0 6px; }
@media (hover: hover) {
  .song-title:hover, .song-by:hover { text-decoration: underline; }
  .song-play { opacity: 0; transform: translateY(4px); transition: opacity var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out), background var(--t-base); }
  .song:hover .song-play, .song-play:focus-visible, .song-play[data-phase="playing"], .song-play[data-phase="loading"], .song.is-selected .song-play { opacity: 1; transform: none; }
}
.pill-review { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill-ai { background: var(--surface-2); color: var(--ink-2); font-family: var(--font-mono); letter-spacing: 0.04em; }
.notice-review { background: color-mix(in srgb, var(--danger) 10%, transparent); border-left-color: var(--danger); }

/* follow + people */
.sound-follow { margin-left: auto; flex: none; }
.profile-text .muted a { color: inherit; text-decoration: none; }
.profile-text .muted a strong { color: var(--ink); font-weight: 600; }
@media (hover: hover) { .profile-text .muted a:hover { text-decoration: underline; } }
.profile-head > .row-btns { margin-left: auto; }
.people { display: flex; flex-direction: column; margin-top: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.person:first-child { border-top: 0; }
.person-name { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; text-decoration: none; color: var(--ink); }
.person-name > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.person-name small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* login */
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form input { height: 44px; }
.login-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 2px; }
.login-links .link-btn { color: var(--ink-2); }

/* review + copyright */
.review-list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.review-item { max-width: 46rem; }
.review-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.review-reason { font: 500 var(--fs-sm)/1.4 var(--font-mono); color: var(--danger); }
.review-item audio { width: 100%; height: 40px; }
.prose { max-width: 40rem; display: flex; flex-direction: column; gap: 14px; }
.prose h2 { font-size: var(--fs-h3, 1.15rem); margin-top: 8px; }
.prose ul { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; color: var(--ink-2); }
