/* =====================================================================
   Crate — a warm, dark record-shop look.
   Colours: espresso background, cream text, terracotta + amber like vinyl labels.
   ===================================================================== */
:root {
  --bg: #1a1410;
  --bg-2: #211913;
  --surface: #2a2019;
  --surface-2: #34281f;
  --surface-3: #3f3126;
  --line: rgba(243, 233, 216, 0.09);
  --line-2: rgba(243, 233, 216, 0.16);
  --cream: #f3e9d8;
  --cream-2: #d9ccb6;
  --muted: #a39380;
  --faint: #7a6b5c;
  --terra: #d2693c;
  --terra-2: #e07b4c;
  --amber: #e9a23b;
  --rust: #a8472a;
  --danger: #e0614a;
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px -12px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 22px 44px -16px rgba(0, 0, 0, 0.85);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --topbar-h: 72px;
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 12px); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(210, 105, 60, 0.13), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(233, 162, 59, 0.07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.no-scroll { overflow: hidden; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
a { color: inherit; }
svg { fill: currentColor; }
[hidden] { display: none !important; }
::selection { background: var(--terra); color: var(--bg); }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 8px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 100; transform: translateY(-200%);
  background: var(--cream); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600;
  text-decoration: none; transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; }

/* subtle film grain for that record-sleeve texture */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer;
  padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: 15px; letter-spacing: 0.01em;
  transition: transform 0.15s var(--ease), background 0.2s, color 0.2s, box-shadow 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--terra); color: #1a0f09; box-shadow: 0 6px 18px -8px rgba(210, 105, 60, 0.8); }
.btn-primary:hover { background: var(--terra-2); }
.btn-primary:disabled { background: var(--surface-3); color: var(--faint); box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--cream-2); box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn-ghost:hover { background: rgba(243, 233, 216, 0.06); color: var(--cream); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px rgba(224, 97, 74, 0.5); }
.btn-danger:hover { background: rgba(224, 97, 74, 0.12); }

.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: transparent; color: var(--cream-2); cursor: pointer; transition: background 0.2s, color 0.2s, transform 0.15s;
  text-decoration: none; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: rgba(243, 233, 216, 0.08); color: var(--cream); }
.icon-btn:active { transform: scale(0.92); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: inherit; text-align: left; }
.link-btn:hover { color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- Top bar ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 24px; padding: 0 var(--gutter);
  transition: background 0.3s, box-shadow 0.3s, backdrop-filter 0.3s;
}
.topbar.scrolled {
  background: rgba(26, 20, 16, 0.82); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: 0 1px 0 var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.brand-name { font-family: var(--serif); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; font-variation-settings: "SOFT" 100, "opsz" 72; }
.brand-mark {
  position: relative; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: repeating-radial-gradient(circle at center, #0d0907 0 1.5px, #1e1611 1.5px 3px);
  box-shadow: 0 0 0 1px rgba(243, 233, 216, 0.1), 0 4px 12px rgba(0, 0, 0, 0.5);
  transition: transform 0.8s var(--ease);
}
.brand-mark span {
  position: absolute; inset: 31%; border-radius: 50%;
  background: radial-gradient(circle, var(--cream) 0 12%, var(--terra) 13% 100%);
}
.brand:hover .brand-mark { transform: rotate(200deg); }
.brand-mark.big { width: 64px; height: 64px; margin-bottom: 18px; animation: spin 6s linear infinite; }

.tabs { display: flex; gap: 4px; padding: 5px; background: rgba(42, 32, 25, 0.7); border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
.tab {
  position: relative; display: flex; align-items: center; gap: 8px; padding: 9px 18px; border-radius: 999px;
  text-decoration: none; color: var(--muted); font-weight: 500; font-size: 15px; transition: color 0.2s, background 0.25s;
}
.tab svg { width: 18px; height: 18px; }
.tab:hover { color: var(--cream); }
.tab.is-active { background: var(--cream); color: var(--bg); }
.tab-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--terra); color: #1a0f09;
  font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1;
}
.tab.is-active .tab-count { background: var(--bg); color: var(--cream); }
#settings-btn { margin-left: auto; }

/* ---------------- Page heads ---------------- */
main { position: relative; z-index: 2; padding: 0 var(--gutter); max-width: 1680px; margin: 0 auto; outline: none; }
.view { padding-bottom: 40px; }
.view-head { padding: clamp(24px, 5vw, 56px) 0 28px; max-width: 900px; animation: rise 0.6s var(--ease) both; }
.eyebrow {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--amber);
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: currentColor; border-radius: 2px; }
.display {
  margin: 0; font-family: var(--serif); font-weight: 600; font-size: clamp(46px, 8vw, 96px); line-height: 0.95;
  letter-spacing: -0.035em; font-variation-settings: "SOFT" 50, "opsz" 144; color: var(--cream);
}
.display em { font-style: italic; font-weight: 500; color: var(--terra-2); font-variation-settings: "SOFT" 100, "opsz" 144; }
.display.small { font-size: 32px; letter-spacing: -0.02em; }
.lede { margin: 16px 0 0; font-size: clamp(16px, 1.6vw, 19px); color: var(--cream-2); max-width: 620px; font-weight: 300; }
.head-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.nudge {
  display: flex; align-items: center; gap: 14px; margin: 0 0 26px; padding: 14px 14px 14px 18px; max-width: 720px;
  border-radius: 16px; background: linear-gradient(100deg, rgba(210, 105, 60, 0.16), rgba(233, 162, 59, 0.06));
  box-shadow: inset 0 0 0 1px rgba(210, 105, 60, 0.28); animation: rise 0.6s 0.1s var(--ease) both;
}
.nudge p { margin: 0; flex: 1; color: var(--cream-2); font-size: 15px; }
.nudge strong { color: var(--cream); font-weight: 600; }
.nudge em { font-family: var(--serif); color: var(--terra-2); }
.nudge-heart { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--terra); color: #1a0f09; flex: none; animation: beat 2.4s ease-in-out infinite; }
.nudge-heart svg { width: 18px; height: 18px; }

/* Search & chips */
.search {
  display: flex; align-items: center; gap: 10px; margin-top: 26px; padding: 6px 6px 6px 18px; max-width: 640px;
  background: var(--surface); border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line); transition: box-shadow 0.2s;
}
.search:focus-within { box-shadow: inset 0 0 0 1.5px var(--terra), 0 0 0 5px rgba(210, 105, 60, 0.15); }
.search > svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.search input {
  flex: 1; min-width: 0; background: transparent; border: 0; color: var(--cream); font: inherit; font-size: 16px; padding: 8px 0;
}
.search input::placeholder { color: var(--faint); }
.search input:focus-visible { outline: none; }
.search input::-webkit-search-cancel-button { filter: invert(0.7) sepia(1); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 15px 8px 12px; border-radius: 999px; text-decoration: none;
  font-size: 14px; font-weight: 500; color: var(--cream-2); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  transition: background 0.2s, color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.chip:hover { background: var(--surface-2); color: var(--cream); transform: translateY(-1px); }
.chip-mood { font-style: italic; font-family: var(--serif); font-size: 15px; }
.chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--chip); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25) inset, 0 0 0 1px rgba(255, 255, 255, 0.08); flex: none; }
.chip.is-active { background: var(--cream); color: var(--bg); box-shadow: none; }

.results-head { margin: 4px 0 22px; min-height: 1px; }
.section-title { margin: 0; display: flex; align-items: center; gap: 12px; font-family: var(--serif); font-weight: 600; font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.02em; }
.section-title .chip-dot { width: 16px; height: 16px; }
.section-sub { margin: 6px 0 0; color: var(--muted); }

/* ---------------- Masonry grid ---------------- */
.masonry { display: flex; align-items: flex-start; gap: clamp(12px, 1.6vw, 22px); }
.masonry-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: clamp(18px, 2vw, 28px); }
.skeleton-grid {
  display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: clamp(12px, 1.6vw, 22px);
  align-items: start; margin-top: clamp(18px, 2vw, 28px);
}
#fy-grid:empty + .skeleton-grid, #ex-grid:empty + .skeleton-grid { margin-top: 0; }

/* ---------------- Song card ---------------- */
.card { position: relative; min-width: 0; }
.card.enter { animation: cardIn 0.55s var(--ease) both; }
.card.leaving { transition: transform 0.25s var(--ease), opacity 0.25s; transform: scale(0.9); opacity: 0; }

.card-art {
  position: relative; aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background:
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 0 18%, rgba(0,0,0,.18) 18.5% 19%, rgba(0,0,0,0) 19.5%),
    linear-gradient(140deg, var(--tint, #3a2a20), #1e1712);
  box-shadow: var(--shadow); transform: translateZ(0);
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}
.v-tall .card-art { aspect-ratio: 4 / 5; }
.card-art img {
  width: 100%; height: 100%; object-fit: cover; opacity: 0; transform: scale(1.01);
  transition: opacity 0.5s ease, transform 0.7s var(--ease), filter 0.4s;
}
.card-art.loaded img { opacity: 1; }
.card-art.broken img { display: none; }
.card-art.broken::before {
  content: ""; position: absolute; inset: 18%; border-radius: 50%;
  background: radial-gradient(circle, var(--terra) 0 22%, transparent 23%), repeating-radial-gradient(circle, #0d0907 0 2px, #1a130f 2px 4px);
}
.art-shade {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: linear-gradient(to top, rgba(14, 9, 6, 0.65), rgba(14, 9, 6, 0) 45%), linear-gradient(to bottom, rgba(14, 9, 6, 0.35), transparent 30%);
}
.card:hover .card-art, .card:focus-within .card-art { box-shadow: var(--shadow-lift); transform: translateY(-3px); }
.card:hover .card-art img { transform: scale(1.06); }
.card:hover .art-shade, .card:focus-within .art-shade, .card.is-current .art-shade { opacity: 1; }

.btn-play {
  position: absolute; left: 12px; bottom: 12px; width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--cream); color: var(--bg);
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.7); opacity: 0; transform: translateY(8px) scale(0.9);
  transition: opacity 0.25s, transform 0.3s var(--ease), background 0.2s;
}
.btn-play svg { width: 22px; height: 22px; }
.btn-play .i-play svg { margin-left: 2px; }
.btn-play .i-pause, .play-big .i-pause { display: none; }
.is-playing .btn-play .i-play, .player.is-playing .play-big .i-play { display: none; }
.is-playing .btn-play .i-pause, .player.is-playing .play-big .i-pause { display: block; }
.btn-play:hover { background: var(--amber); transform: scale(1.06); }
.card:hover .btn-play, .card:focus-within .btn-play, .card.is-current .btn-play { opacity: 1; transform: none; }
.btn-play:disabled { display: none; }
.card.is-current .btn-play { background: var(--terra); color: #1a0f09; }

.btn-heart {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--cream);
  background: rgba(20, 14, 10, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transform: scale(0.85); transition: opacity 0.25s, transform 0.3s var(--ease), background 0.2s, color 0.2s;
}
.btn-heart svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; transition: fill 0.2s; }
.btn-heart:hover { background: rgba(20, 14, 10, 0.8); }
.card:hover .btn-heart, .card:focus-within .btn-heart, .btn-heart.is-saved { opacity: 1; transform: none; }
.btn-heart.is-saved { color: var(--terra-2); background: rgba(20, 14, 10, 0.7); }
.btn-heart.is-saved svg, .heart-mini.is-saved svg { fill: currentColor; }
.btn-heart.pop svg, .heart-mini.pop svg { animation: heartPop 0.5s var(--ease); }
.btn-heart.pop::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--terra-2);
  animation: ring 0.55s var(--ease) forwards; pointer-events: none;
}

.explicit {
  position: absolute; top: 12px; left: 12px; width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--bg); background: rgba(243, 233, 216, 0.82);
}
.spinning-vinyl {
  position: absolute; top: 10px; left: 10px; width: 36px; height: 36px; border-radius: 50%;
  background: repeating-radial-gradient(circle, #0d0907 0 1.5px, #221912 1.5px 3px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6); opacity: 0; transform: scale(0.5); transition: opacity 0.3s, transform 0.4s var(--ease);
}
.spinning-vinyl span { position: absolute; inset: 32%; border-radius: 50%; background: radial-gradient(circle, var(--cream) 0 14%, var(--terra) 15%); }
.card.is-current .spinning-vinyl { opacity: 1; transform: none; }
.card.is-playing .spinning-vinyl { animation: spin 2.4s linear infinite; }
.card.is-current .explicit { display: none; }
.card-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(243, 233, 216, 0.15); opacity: 0; transition: opacity 0.3s; }
.card-progress span { display: block; height: 100%; background: var(--amber); transform-origin: left; transform: scaleX(0); }
.card.is-current .card-progress { opacity: 1; }

.card-meta { padding: 12px 4px 0; }
.card-title {
  margin: 0; font-size: 15.5px; font-weight: 600; line-height: 1.3; color: var(--cream);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-artist {
  display: block; max-width: 100%; margin-top: 2px; padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-artist:hover { color: var(--cream); text-decoration: underline; text-underline-offset: 3px; }
.card-album {
  display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-family: var(--serif); font-style: italic; font-size: 14px; color: var(--cream-2);
  line-height: 1.35;
}
.label-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: radial-gradient(circle, var(--cream) 0 15%, var(--terra) 16% 60%, #120c09 61%); }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag {
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.03em; padding: 3px 9px; border-radius: 999px;
  color: var(--cream-2); background: rgba(243, 233, 216, 0.07);
}
.tag-muted { color: var(--faint); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.card-reason {
  margin: 8px 0 0; font-family: var(--serif); font-style: italic; font-size: 13.5px; color: var(--amber); line-height: 1.35;
  display: flex; gap: 6px; align-items: baseline;
}
.card-reason::before { content: "↳"; font-style: normal; color: var(--faint); }

/* skeletons */
.skeleton .sk-art, .skeleton .sk-line {
  border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton .sk-line { height: 12px; border-radius: 6px; margin-top: 14px; width: 80%; }
.skeleton .sk-line.short { width: 50%; margin-top: 8px; }

/* footers / empty / error */
.feed-footer { display: flex; justify-content: center; padding: 36px 0 12px; }
.feed-footer:empty { padding: 0; }
.sentinel { height: 1px; }
.end-note { display: flex; align-items: center; gap: 14px; color: var(--faint); font-family: var(--serif); font-style: italic; margin: 0; }
.end-note span { width: 48px; height: 1px; background: var(--line-2); }
.empty-state { text-align: center; padding: 48px 20px 64px; max-width: 460px; margin: 0 auto; animation: rise 0.5s var(--ease) both; }
.empty-state h2 { font-family: var(--serif); font-weight: 600; font-size: 30px; letter-spacing: -0.02em; margin: 26px 0 8px; }
.empty-state p { color: var(--muted); margin: 0 0 22px; }
.empty-art { position: relative; width: 170px; height: 110px; margin: 0 auto; }
.empty-art .rec {
  position: absolute; top: 5px; width: 100px; height: 100px; border-radius: 50%;
  background: radial-gradient(circle, var(--cream) 0 4%, var(--terra) 5% 26%, transparent 27%), repeating-radial-gradient(circle, #0d0907 0 2px, #241a14 2px 4px);
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.8);
}
.empty-art .r1 { left: 0; transform: rotate(-12deg); }
.empty-art .r2 { left: 35px; z-index: 1; animation: spin 8s linear infinite; }
.empty-art .r3 { left: 70px; transform: rotate(12deg); }
.empty-error .r2 { animation: wobble 2s ease-in-out infinite; }
.empty-error .r2 { background: radial-gradient(circle, var(--cream) 0 4%, var(--danger) 5% 26%, transparent 27%), repeating-radial-gradient(circle, #0d0907 0 2px, #241a14 2px 4px); }

/* footer */
.site-foot { padding: 28px 0 40px; margin-top: 24px; border-top: 1px solid var(--line); color: var(--faint); font-size: 13.5px; }
.site-foot p { margin: 4px 0; }
.site-foot strong { font-family: var(--serif); color: var(--cream-2); font-weight: 600; }
.foot-apple { color: var(--cream-2); }
kbd { font-family: var(--sans); font-size: 12px; padding: 1px 6px; border-radius: 5px; background: var(--surface); box-shadow: inset 0 -1px 0 var(--line-2); color: var(--cream-2); }
body.has-player .site-foot { padding-bottom: 130px; }

/* ---------------- Mini player ---------------- */
.player {
  position: fixed; z-index: 40; left: 50%; bottom: 16px; width: min(1080px, calc(100% - 32px));
  transform: translate(-50%, 140%); transition: transform 0.45s var(--ease);
  background: rgba(42, 32, 25, 0.88); backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-radius: 20px; box-shadow: 0 0 0 1px var(--line-2), 0 24px 60px -12px rgba(0, 0, 0, 0.85); overflow: hidden;
}
.player.open { transform: translate(-50%, 0); }
.player-progress { position: relative; height: 4px; background: rgba(243, 233, 216, 0.1); }
.player-progress-fill { position: absolute; inset: 0; background: linear-gradient(90deg, var(--terra), var(--amber)); transform-origin: left; transform: scaleX(0); pointer-events: none; }
.player-progress input {
  position: absolute; inset: -8px 0; width: 100%; height: 20px; margin: 0; opacity: 0; cursor: pointer; z-index: 1;
}
.player-progress:has(input:focus-visible) { outline: 2px solid var(--amber); }
.player-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; padding: 10px 14px 10px 10px; }
.player-now { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-art { position: relative; width: 52px; height: 52px; flex: none; }
.player-art img { position: relative; z-index: 1; width: 52px; height: 52px; border-radius: 9px; object-fit: cover; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); }
.player-disc {
  position: absolute; top: 4px; left: 8px; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle, var(--cream) 0 6%, var(--terra) 7% 28%, transparent 29%), repeating-radial-gradient(circle, #0d0907 0 1.5px, #221912 1.5px 3px);
  transition: transform 0.5s var(--ease);
}
.player.is-playing .player-disc { transform: translateX(22px); animation: spin 2.4s linear infinite; }
.player.is-playing .player-text { transform: translateX(16px); }
.player-text { min-width: 0; transition: transform 0.5s var(--ease); }
.player-title { margin: 0; font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artist { margin: 0; font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-controls { display: flex; align-items: center; gap: 6px; }
.play-big {
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: var(--cream); color: var(--bg); transition: transform 0.15s, background 0.2s;
}
.play-big svg { width: 22px; height: 22px; }
.play-big .i-play svg { margin-left: 2px; }
.play-big:hover { background: var(--amber); transform: scale(1.05); }
.player-extra { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-width: 0; }
.player-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; white-space: nowrap; }
.heart-mini svg { fill: none; stroke: currentColor; stroke-width: 2; }
.heart-mini.is-saved { color: var(--terra-2); }
.volume { display: flex; align-items: center; gap: 6px; margin: 0 4px 0 6px; color: var(--muted); }
.volume svg { width: 18px; height: 18px; display: block; }
.volume input { width: 90px; accent-color: var(--terra); }
.player-note { position: absolute; right: 16px; top: 8px; margin: 0; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); pointer-events: none; display: none; }

/* ---------------- Onboarding ---------------- */
.onboarding {
  position: fixed; inset: 0; z-index: 60; overflow-y: auto; overscroll-behavior: contain;
  background: radial-gradient(900px 500px at 50% -5%, rgba(210, 105, 60, 0.22), transparent 65%), var(--bg);
  opacity: 0; transition: opacity 0.3s ease;
}
.onboarding.open { opacity: 1; }
.ob-inner { max-width: 1180px; margin: 0 auto; padding: clamp(36px, 7vw, 80px) var(--gutter) 140px; }
.ob-head { text-align: center; max-width: 680px; margin: 0 auto 36px; display: flex; flex-direction: column; align-items: center; }
.ob-head .lede { margin-inline: auto; }
.ob-section { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 36px 0 14px; color: var(--cream-2); letter-spacing: -0.01em; }
.ob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 168px), 1fr)); gap: 14px; }
.ob-tile {
  position: relative; aspect-ratio: 1 / 1.08; border: 0; padding: 0; border-radius: 16px; overflow: hidden; cursor: pointer;
  background: var(--chip); text-align: left; box-shadow: var(--shadow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
.ob-tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease), filter 0.4s; filter: saturate(0.9); }
.ob-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(18, 12, 8, 0.92) 8%, rgba(18, 12, 8, 0.15) 60%, rgba(18, 12, 8, 0.05)); transition: background 0.3s; }
.ob-label {
  position: absolute; left: 14px; right: 14px; bottom: 34px; font-family: var(--serif); font-weight: 600; font-size: 24px;
  line-height: 1.05; letter-spacing: -0.02em; color: var(--cream);
}
.ob-blurb { position: absolute; left: 14px; right: 14px; bottom: 12px; font-size: 12.5px; color: var(--cream-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-check {
  position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(20, 14, 10, 0.5); box-shadow: inset 0 0 0 2px rgba(243, 233, 216, 0.6); color: transparent;
  transition: background 0.2s, color 0.2s, transform 0.3s var(--ease);
}
.ob-check svg { width: 18px; height: 18px; }
.ob-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); }
.ob-tile:hover img { transform: scale(1.06); }
.ob-tile.is-picked { box-shadow: 0 0 0 3px var(--terra), var(--shadow-lift); }
.ob-tile.is-picked .ob-check { background: var(--terra); color: #1a0f09; box-shadow: none; transform: scale(1.1); }
.ob-tile.is-picked .ob-shade { background: linear-gradient(to top, rgba(18, 12, 8, 0.92) 8%, rgba(160, 70, 35, 0.35) 70%, rgba(160, 70, 35, 0.25)); }
.ob-tile:active { transform: scale(0.97); }
.ob-bar {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom));
  background: rgba(26, 20, 16, 0.86); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 -1px 0 var(--line);
}
.ob-count { margin: 0; color: var(--cream-2); font-size: 15px; text-align: center; }

/* ---------------- Settings dialog ---------------- */
.settings {
  width: min(520px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 22px; color: var(--cream);
  background: var(--surface); box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px -20px rgba(0, 0, 0, 0.9);
}
.settings[open] { animation: pop 0.3s var(--ease); }
.settings::backdrop { background: rgba(10, 7, 5, 0.65); backdrop-filter: blur(4px); }
.settings-inner { padding: 22px 24px 18px; }
.settings-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 16px 0; border-top: 1px solid var(--line); cursor: default; }
label.setting { cursor: pointer; }
.setting-name { margin: 0; font-weight: 600; }
.setting-help { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.settings-foot { margin: 12px 0 0; font-size: 12.5px; color: var(--faint); }
.switch {
  appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; margin: 0; cursor: pointer;
  background: var(--surface-3); position: relative; transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--cream-2);
  transition: transform 0.25s var(--ease), background 0.2s;
}
.switch:checked { background: var(--terra); }
.switch:checked::after { transform: translateX(18px); background: var(--cream); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; z-index: 70; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 12px 20px; border-radius: 999px; background: var(--cream); color: var(--bg); font-weight: 500; font-size: 14.5px;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8); transition: transform 0.35s var(--ease), opacity 0.3s; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.has-player .toast { bottom: 112px; }

/* ---------------- Touch devices: controls always visible ---------------- */
@media (hover: none) {
  .btn-heart { opacity: 1; transform: none; width: 36px; height: 36px; }
  .btn-play { opacity: 1; transform: none; width: 42px; height: 42px; left: 10px; bottom: 10px; background: rgba(243, 233, 216, 0.92); }
  .btn-play svg { width: 18px; height: 18px; }
  .card:hover .card-art { transform: none; }
}

/* ---------------- Phones ---------------- */
@media (max-width: 720px) {
  :root { --topbar-h: 60px; }
  /* backdrop-filter on the header would trap the fixed bottom tab bar inside it */
  .topbar.scrolled { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(26, 20, 16, 0.97); }
  .brand-name { font-size: 26px; }
  .brand-mark { width: 28px; height: 28px; }
  .tabs {
    position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; border-radius: 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; background: rgba(26, 20, 16, 0.94); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -1px 0 var(--line);
  }
  .tab { flex-direction: column; gap: 2px; padding: 6px 14px; font-size: 11.5px; flex: 1; justify-content: center; }
  .tab svg { width: 22px; height: 22px; }
  .tab.is-active { background: transparent; color: var(--terra-2); }
  .tab-count { position: absolute; top: 2px; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 10.5px; }
  .tab.is-active .tab-count { background: var(--terra); color: #1a0f09; }
  body { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .view-head { padding-top: 18px; }
  .head-actions .btn { padding: 9px 16px; font-size: 14px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(-1 * var(--gutter)); padding: 2px var(--gutter) 6px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .search .btn { padding: 9px 14px; }
  .card-meta { padding-top: 9px; }
  .card-title { font-size: 14px; }
  .card-artist { font-size: 13px; }
  .card-reason { font-size: 12.5px; }
  .tag { font-size: 10.5px; }
  .player { bottom: calc(76px + env(safe-area-inset-bottom)); width: calc(100% - 16px); border-radius: 16px; }
  .player-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 8px 8px 8px 8px; }
  .player-extra { display: none; }
  .player-controls { gap: 0; }
  .player-controls #pl-prev { display: none; }
  .play-big { width: 42px; height: 42px; }
  .player-art, .player-art img { width: 44px; height: 44px; }
  .player-disc { width: 38px; height: 38px; }
  .player.is-playing .player-disc { transform: translateX(14px); }
  .player.is-playing .player-text { transform: translateX(10px); }
  body.has-player .toast { bottom: calc(160px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
  body.has-player .site-foot { padding-bottom: 90px; }
  .foot-keys { display: none; }
  .ob-bar .btn { padding: 10px 14px; font-size: 14px; }
  .ob-count { font-size: 13px; }
  .ob-label { font-size: 20px; bottom: 30px; }
  .settings .setting { flex-wrap: wrap; }
}
@media (min-width: 721px) and (max-width: 980px) {
  .volume { display: none; }
}

/* ---------------- Animations ---------------- */
@keyframes spin { to { transform: rotate(360deg); } }
.player.is-playing .player-disc { animation: spinShift 2.4s linear infinite; }
@media (max-width: 720px) { .player.is-playing .player-disc { animation-name: spinShiftSm; } }
@keyframes spinShift { from { transform: translateX(22px) rotate(0); } to { transform: translateX(22px) rotate(360deg); } }
@keyframes spinShiftSm { from { transform: translateX(14px) rotate(0); } to { transform: translateX(14px) rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -50% 0; } }
@keyframes heartPop { 0% { transform: scale(1); } 30% { transform: scale(1.4); } 60% { transform: scale(0.9); } 100% { transform: scale(1); } }
@keyframes ring { from { transform: scale(0.6); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 10% { transform: scale(1.12); } 20% { transform: scale(1); } 30% { transform: scale(1.08); } 40% { transform: scale(1); } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wobble { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

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