/* Deep Listen. Dark-first studio look, one signal-orange accent, cover art as atmosphere.
   Shape rule: interactive controls are pills or circles, panels are 16px, artwork is 12px. */

@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0e0e11;
  --surface: rgb(24 24 29 / 0.92);
  --surface-solid: #18181d;
  --surface-2: #212128;
  --line: rgb(255 255 255 / 0.07);
  --line-2: rgb(255 255 255 / 0.13);
  --text: #ededf1;
  --text-2: #a6a6b1;
  --text-3: #74747f;
  --accent: #e77840;
  --accent-ink: #1a0d06;
  --accent-soft: rgb(231 120 64 / 0.16);
  --accent-mid: rgb(231 120 64 / 0.42);
  --atmos-opacity: 0.55;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 12px 32px rgb(0 0 0 / 0.28);
  --r-panel: 16px;
  --r-art: 12px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --bar-h: 60px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f3f3f5;
    --surface: rgb(251 251 252 / 0.9);
    --surface-solid: #fbfbfc;
    --surface-2: #e9e9ed;
    --line: rgb(15 15 20 / 0.07);
    --line-2: rgb(15 15 20 / 0.14);
    --text: #121216;
    --text-2: #4f4f59;
    --text-3: #7a7a85;
    --accent: #b14c18;
    --accent-ink: #fff7f2;
    --accent-soft: rgb(177 76 24 / 0.1);
    --accent-mid: rgb(177 76 24 / 0.32);
    --atmos-opacity: 0.4;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.6) inset, 0 10px 28px rgb(40 30 25 / 0.08);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ atmosphere */
.atmos {
  position: fixed;
  inset: 0 0 auto 0;
  height: 78vh;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 30%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 30%, transparent 100%);
}
.atmos-img {
  position: absolute;
  inset: -12%;
  background-size: cover;
  background-position: center;
  filter: blur(72px) saturate(1.35);
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 900ms var(--ease-out), transform 1400ms var(--ease-out);
}
body[data-view="result"] .atmos-img.ready { opacity: var(--atmos-opacity); transform: scale(1); }

/* ------------------------------------------------------------ top bar */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: var(--bg);
  background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) env(safe-area-inset-top), rgb(from var(--bg) r g b / 0.86) 70%, rgb(from var(--bg) r g b / 0) 100%);  /* solid under the status bar */
}
.brand {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 17px;
  letter-spacing: -0.02em;
  color: var(--text-2);
}
.brand-word { display: inline; }
.brand b { color: var(--text); font-weight: 600; }
.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: inset 0 0 0 3px var(--bg), inset 0 0 0 10px var(--accent);
}
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--text-2);
  transition: background-color 160ms ease, color 160ms ease, transform 120ms ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
#backBtn { justify-self: start; }
body[data-view="home"] #backBtn { visibility: hidden; }
.bar-right { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.account-btn {
  height: 36px;
  min-width: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 160ms ease, transform 120ms ease;
}
.account-btn:hover { background: var(--surface-2); }
.account-btn:active { transform: scale(0.96); }
.account-btn.is-signed { padding: 0; width: 36px; border: 0; background: var(--accent); color: var(--accent-ink); margin: 0 4px; }
.account-btn .avatar { font-size: 15px; }

main { position: relative; z-index: 1; }

/* ------------------------------------------------------------ home */
.home {
  min-height: calc(100dvh - var(--bar-h) - env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2vh 16px calc(28px + env(safe-area-inset-bottom));
}
.stage {
  position: relative;
  width: min(86vw, 400px);
  aspect-ratio: 1;
  margin-top: max(2vh, 8px);
  display: grid;
  place-items: center;
}
#viz { position: absolute; inset: 0; width: 100%; height: 100%; }
.listen {
  position: relative;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 180ms var(--ease-out);
}
.listen:active { transform: scale(0.96); }
.listen-core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 120% at 30% 20%, rgb(255 255 255 / 0.22), transparent 55%),
    var(--accent);
  color: var(--accent-ink);
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 0.35),
    inset 0 -10px 24px rgb(0 0 0 / 0.18),
    0 18px 48px var(--accent-mid);
  font-size: clamp(44px, 12vw, 64px);
  transition: background-color 300ms ease, box-shadow 300ms ease;
}
.listen-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
}
@media (prefers-reduced-motion: no-preference) {
  body[data-mode="idle"] .listen-ring { animation: ripple 2.8s var(--ease-out) infinite; }
  body[data-mode="busy"] .listen-core i { animation: spin 1.1s linear infinite; }
}
@keyframes ripple {
  0% { transform: scale(1); opacity: 0.55; }
  80%, 100% { transform: scale(1.7); opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
body[data-mode="listening"] .listen-core { box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.35), inset 0 -10px 24px rgb(0 0 0 / 0.18), 0 10px 30px var(--accent-soft); }

.status-block { text-align: center; margin-top: 6px; min-height: 84px; }
.status { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.substatus { margin: 6px auto 0; color: var(--text-2); font-size: 15px; max-width: 34ch; text-wrap: balance; }

.alt-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms ease, transform 120ms ease, border-color 160ms ease;
}
.pill i { font-size: 18px; color: var(--text-2); }
.pill:hover { background: var(--surface-2); }
.pill:active { transform: scale(0.97); }
.pill-quiet { background: transparent; color: var(--text-2); }
.pill[hidden] { display: none; }

.home-lower { width: min(100%, 720px); margin: auto auto 0; padding-top: 36px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.recent { width: 100%; }
.recent-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.recent-row {
  list-style: none;
  margin: 0;
  padding: 0 0 6px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 96px;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.recent-row::-webkit-scrollbar { display: none; }
.recent-row li { scroll-snap-align: start; }
.recent-card { display: block; width: 100%; text-align: left; }
.recent-card img, .recent-card .ph-art {
  width: 96px;
  height: 96px;
  border-radius: var(--r-art);
  object-fit: cover;
  background: var(--surface-2);
  transition: transform 160ms var(--ease-out);
}
.recent-card:active img { transform: scale(0.97); }
.recent-card span { display: block; margin-top: 8px; font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-card small { display: block; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------ result layout */
.result { max-width: 1180px; margin: 0 auto; padding: 4px 16px calc(64px + env(safe-area-inset-bottom)); }
.r-grid { display: grid; gap: 28px; }
.r-aside { display: grid; gap: 18px; align-content: start; }
.r-main { display: grid; gap: 40px; align-content: start; min-width: 0; }
.readout { display: grid; gap: 14px; }
@media (min-width: 1024px) {
  .result { padding-top: 12px; }
  .r-grid { grid-template-columns: 340px minmax(0, 1fr); gap: 56px; }
  .r-aside { position: sticky; top: calc(var(--bar-h) + 12px); align-self: start; }
  .r-main { gap: 44px; }
}
@media (min-width: 1240px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.enter { animation: enter 520ms var(--ease-out) both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* hero */
.hero { display: grid; gap: 16px; }
.cover {
  width: min(58vw, 240px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-art);
  background: var(--surface-2);
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.35), 0 0 0 1px var(--line);
}
.cover-unknown { display: grid; place-items: center; font-size: 64px; color: var(--text-3); }
@media (min-width: 1024px) { .cover { width: 100%; } }
.title { font-size: clamp(28px, 7vw, 36px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 650; text-wrap: balance; }
.artist { font-size: 19px; color: var(--text); margin-top: 4px; font-weight: 450; }
.meta-line { color: var(--text-2); font-size: 14.5px; margin-top: 4px; }
.heard { color: var(--text-3); font-size: 13px; margin-top: 10px; }
.genres { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.genre {
  font-size: 13.5px;
  line-height: 1;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text);
  background: var(--surface);
}
.genre.main { background: var(--accent); border-color: transparent; color: var(--accent-ink); font-weight: 600; }
.genre.genre-wait { display: inline-block; width: 92px; height: 29px; padding: 0; border: 0; }

/* mix points */
.mix { padding: 14px 16px; border-radius: var(--r-panel); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.mix-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.mix-head h3 { font-size: 14px; font-weight: 600; }
.mix-head span { font-size: 12.5px; color: var(--text-3); }
.mix-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.mix-grid b { display: block; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.mix-grid span { font-size: 12.5px; color: var(--text-3); }
.mix-live { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14.5px; color: var(--text); }
.mix-live b { color: var(--accent); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 120ms ease, background-color 160ms ease, opacity 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn i { font-size: 18px; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:disabled { opacity: 0.45; cursor: default; }
.btn-ghost { background: var(--surface); border: 1px solid var(--line-2); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn.icon { width: 42px; padding: 0; }

/* readout tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  position: relative;
  padding: 14px 16px 13px;
  border-radius: var(--r-panel);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  min-height: 104px;
  display: flex;
  flex-direction: column;
}
.tile-label { font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.tile-value { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: clamp(30px, 8.4vw, 38px); line-height: 1.1; letter-spacing: -0.04em; margin-top: 6px; font-weight: 500; }
.tile-value small { font-size: 0.5em; color: var(--text-2); letter-spacing: 0; margin-left: 2px; }
.tile-sub { font-size: 12.5px; color: var(--text-3); margin-top: auto; padding-top: 4px; }
.beat {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.25;
  transition: opacity 60ms linear;
}
.beat.on { opacity: 1; transition: none; }
@media (prefers-reduced-motion: no-preference) {
  .beat.idle { animation: beat var(--beat, 0.5s) steps(1, end) infinite; }
}
@keyframes beat { 0% { opacity: 1; } 18% { opacity: 0.25; } }

/* waveform */
.wave { position: relative; height: 64px; cursor: pointer; touch-action: none; }
.wave svg { width: 100%; height: 100%; display: block; }
.wave rect { fill: var(--text-3); }
.wave .played rect { fill: var(--accent); }
.wave-cap { display: flex; justify-content: space-between; color: var(--text-3); font-size: 12px; margin-top: 4px; }

/* skeletons */
.sk { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); }
.sk + .sk { margin-top: 10px; }
.sk.w60 { width: 60%; } .sk.w80 { width: 80%; } .sk.w40 { width: 40%; } .sk.w90 { width: 90%; }
@media (prefers-reduced-motion: no-preference) {
  .sk {
    background: linear-gradient(90deg, var(--surface-2) 0%, var(--line-2) 50%, var(--surface-2) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
  }
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.waiting { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 14px; margin-bottom: 14px; }
@media (prefers-reduced-motion: no-preference) { .waiting i { animation: spin 0.9s linear infinite; } }

/* sections */
.block h2 { font-size: 21px; letter-spacing: -0.02em; font-weight: 600; }
.lede { color: var(--text-2); font-size: 14.5px; margin-top: 6px; max-width: 62ch; }
.block-body { margin-top: 16px; }
.note-err { color: var(--text-3); font-size: 14px; margin-top: 12px; }

/* picks */
.picks { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 8px; }
.pick {
  border-radius: var(--r-panel);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: background-color 160ms ease;
}
.pick-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px 10px 10px; }
.pick-art { position: relative; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.pick-art img { width: 100%; height: 100%; object-fit: cover; }
.pick-art i {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #fff;
  background: rgb(0 0 0 / 0.38);
  opacity: 0;
  transition: opacity 140ms ease;
}
.pick-art:hover i, .pick-art:focus-visible i, .pick.is-playing .pick-art i { opacity: 1; }
.pick-title { font-weight: 600; font-size: 15.5px; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pick-artist { color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-genre { color: var(--text-3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  white-space: nowrap;
}
.tag.num { font-size: 11.5px; }
.tag.good { color: var(--accent); border-color: var(--accent-mid); }
.tag.muted { color: var(--text-3); border-style: dashed; }
.score { text-align: right; min-width: 44px; }
.score b { display: block; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 24px; font-weight: 500; letter-spacing: -0.04em; line-height: 1; }
.score small { color: var(--text-3); font-size: 11.5px; }
.score.hi b { color: var(--accent); }
.score.lo b { color: var(--text-3); }
.pick details { padding: 0 12px 12px 78px; }
.pick summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pick summary::-webkit-details-marker { display: none; }
.pick summary > i { transition: transform 200ms var(--ease-out); }
.pick details[open] summary > i { transform: rotate(90deg); }
.pick summary .origin { margin-left: auto; }
.origin-measured i { color: var(--accent); }
.pick-why { margin-top: 10px; font-size: 14.5px; color: var(--text); max-width: 62ch; }
.pick-how { margin-top: 8px; font-size: 14px; color: var(--text-2); max-width: 62ch; }
.pick-how b { color: var(--text); font-weight: 600; }
.pick-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pick-tools .btn { height: 36px; font-size: 13.5px; padding: 0 14px; }
.dir { display: inline-flex; align-items: center; gap: 4px; }
@media (max-width: 520px) { .pick details { padding-left: 12px; } }
.more-picks { margin-top: 12px; }
.pick-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-filters + .picks { margin-top: 12px; }
.pick-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 120ms ease;
}
.pick-filter .num { font-size: 12px; color: var(--text-3); }
.pick-filter:hover { background: var(--surface-2); color: var(--text); }
.pick-filter:active { transform: scale(0.97); }
.pick-filter[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent); }
.pick-filter[aria-pressed="true"] .num { color: var(--accent); }
.pick-note { color: var(--text-3); font-size: 13px; margin-top: 12px; }

/* notes */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 6px 11px; border-radius: 999px; background: var(--surface-2); color: var(--text); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.summary { font-size: 17px; line-height: 1.55; max-width: 62ch; text-wrap: pretty; }
.kv { display: grid; gap: 14px 28px; margin-top: 20px; }
@media (min-width: 720px) { .kv { grid-template-columns: 1fr 1fr; } }
.kv dt { font-size: 13px; color: var(--text-3); }
.kv dd { margin: 3px 0 0; font-size: 15px; max-width: 60ch; }
.inst { display: grid; gap: 10px; margin-top: 20px; }
@media (min-width: 720px) { .inst { grid-template-columns: 1fr 1fr; } }
.inst div { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.inst b { display: block; font-size: 14.5px; }
.inst span { display: block; color: var(--text-2); font-size: 14px; margin-top: 2px; }
.dj {
  margin-top: 22px;
  padding: 16px 18px;
  border-radius: var(--r-panel);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.dj h3 { font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.dj h3 i { color: var(--accent); font-size: 18px; }
.dj .kv { margin-top: 12px; }

/* story */
.md { max-width: 64ch; }
.md h3 { font-size: 15px; font-weight: 600; margin: 20px 0 6px; color: var(--text); }
.md h3:first-child { margin-top: 0; }
.md p, .md li { font-size: 15.5px; line-height: 1.62; color: var(--text); }
.md p + p { margin-top: 8px; }
.md ul { margin: 6px 0 0; padding-left: 18px; }
.md li + li { margin-top: 4px; }
.md li::marker { color: var(--text-3); }
.md strong { font-weight: 600; }
.caret { display: inline-block; width: 8px; height: 1em; background: var(--accent); vertical-align: -2px; margin-left: 2px; }
@media (prefers-reduced-motion: no-preference) { .caret { animation: caret 1s steps(1) infinite; } }
@keyframes caret { 50% { opacity: 0; } }
.sources { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.sources a { font-size: 12.5px; color: var(--text-2); text-decoration: none; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); }
.sources a:hover { color: var(--text); }

/* measured */
.measured { display: grid; gap: 30px; margin-top: 18px; }
.measured-top { display: grid; gap: 18px; align-items: center; }
@media (min-width: 640px) { .measured-top { grid-template-columns: 260px minmax(0, 1fr); gap: 28px; } }
.wheel { width: 100%; max-width: 300px; }
.measured-top .stats { margin-top: 18px; grid-template-columns: 1fr 1fr; }
.wheel text { font-family: var(--mono); font-size: 11px; }
.wheel-cap { color: var(--text-2); font-size: 13.5px; margin-top: 8px; max-width: 34ch; }
.charts { display: grid; gap: 26px; }
@media (min-width: 720px) { .charts { grid-template-columns: 1.4fr 1fr; gap: 32px; } }
.chart h3 { font-size: 14px; font-weight: 600; }
.chart p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.bars { display: grid; align-items: end; gap: 6px; height: 108px; margin-top: 12px; }
.bars-6 { grid-template-columns: repeat(6, 1fr); }
.bars-12 { grid-template-columns: repeat(12, 1fr); gap: 4px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; min-width: 0; }
.bar-fill { border-radius: 6px 6px 3px 3px; background: var(--text-3); transform-origin: bottom; }
.bar-fill.hot { background: var(--accent); }
.bar-fill.warm { background: var(--text-2); }
.bar-lab { font-size: 11px; color: var(--text-3); text-align: center; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: no-preference) {
  .bar-fill { animation: grow 700ms var(--ease-out) both; }
}
@keyframes grow { from { transform: scaleY(0.05); } to { transform: none; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 16px; }
.stat b { display: block; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 500; letter-spacing: -0.03em; }
.stat span { color: var(--text-3); font-size: 13px; }

/* facts */
.facts { display: grid; gap: 14px 28px; margin-top: 16px; }
@media (min-width: 720px) { .facts { grid-template-columns: 1fr 1fr; } }
.facts dt { font-size: 13px; color: var(--text-3); }
.facts dd { margin: 3px 0 0; font-size: 15px; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.foot { color: var(--text-3); font-size: 12.5px; margin-top: 8px; }

/* guess (no match) */
.guess { text-decoration: none; display: grid; grid-template-columns: 64px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: var(--r-panel); background: var(--accent-soft); margin-top: 14px; }
.guess img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.guess b { display: block; }
.guess span { color: var(--text-2); font-size: 14px; }

/* sheet */
.sheet {
  border: 0;
  padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
  width: min(100%, 560px);
  max-height: 82dvh;
  margin: auto auto 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: 0 -20px 60px rgb(0 0 0 / 0.4);
}
@media (min-width: 640px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet::backdrop { background: rgb(0 0 0 / 0.5); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.sheet-head h2 { font-size: 19px; }
.history-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 2px; }
.history-list button { width: 100%; display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; text-align: left; padding: 8px; border-radius: 12px; }
.history-list button:hover { background: var(--surface-2); }
.history-list img, .history-list .ph-art { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.history-list b { display: block; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list span { display: block; color: var(--text-2); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-list small { color: var(--text-3); font-size: 12px; font-family: var(--mono); }
.sheet-empty { color: var(--text-2); padding: 24px 0; text-align: center; }

/* toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 300ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

/* ------------------------------------------------------------ account and lists */
.nudge {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--r-panel);
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.nudge[hidden] { display: none; }
.nudge > i { font-size: 22px; color: var(--accent); margin-top: 1px; }
.nudge b { display: block; font-size: 15px; font-weight: 600; }
.nudge span { display: block; color: var(--text-2); font-size: 14px; margin-top: 2px; }
.nudge-actions { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.nudge-actions .pill { min-height: 38px; }

.auth-why { color: var(--text-2); font-size: 15px; margin: 0 0 16px; text-wrap: pretty; }
.auth-form { display: grid; gap: 8px; }
.auth-form label { font-size: 14px; color: var(--text-2); }
.auth-form input, .new-list input, .delete-account input {
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  min-width: 0;
}
.auth-form input:focus-visible, .new-list input:focus-visible, .delete-account input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-form .btn { height: 48px; margin-top: 6px; justify-content: center; }
.auth-err { color: var(--accent); font-size: 14px; min-height: 1em; margin: 0; }
.auth-switch { margin: 16px 0 0; text-align: center; color: var(--text-2); font-size: 14px; }
.auth-switch button { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.lists-cta { display: grid; gap: 10px; }
.lists-cta .btn { height: 48px; justify-content: center; }

.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.title-row .title { min-width: 0; }
.save-song { flex: none; margin-top: 2px; }
.btn.is-saved { color: var(--accent); border-color: var(--accent-mid); }

.save-item { display: grid; grid-template-columns: 48px 1fr; gap: 12px; align-items: center; padding: 4px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.save-item img, .save-item .ph-art { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.save-item b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-item span { display: block; color: var(--text-2); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-lists { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.save-lists button { width: 100%; display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: center; padding: 12px 8px; border-radius: 12px; text-align: left; font-size: 16px; }
.save-lists button:hover { background: var(--surface-2); }
.save-lists i { font-size: 22px; color: var(--text-3); }
.save-lists [aria-pressed="true"] i { color: var(--accent); }
.save-lists small { color: var(--text-3); font-size: 13px; }
.new-list { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 8px; }
.new-list .btn { height: 48px; }

.list-block { border-bottom: 1px solid var(--line); padding: 4px 0 8px; }
.list-block summary { list-style: none; display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: center; padding: 10px 4px; cursor: pointer; }
.list-block summary::-webkit-details-marker { display: none; }
.list-block summary i { color: var(--text-3); transition: transform 200ms var(--ease-out); }
.list-block[open] summary i { transform: rotate(90deg); }
.list-block summary b { font-size: 16px; font-weight: 600; }
.list-block summary small { color: var(--text-3); font-size: 13px; }
.list-block .history-list { margin: 0 0 6px; }
.list-item { display: grid; grid-template-columns: 1fr 44px; align-items: center; }
.list-item .icon-btn { font-size: 18px; color: var(--text-3); }
.list-block .sheet-empty { padding: 8px 0 12px; font-size: 14px; }
.account-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 16px 0 0; color: var(--text-3); font-size: 14px; }
.account-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item small { white-space: nowrap; }
.delete-account { margin-top: 20px; color: var(--text-3); font-size: 14px; }
.delete-account summary { cursor: pointer; padding: 6px 0; width: fit-content; }
.delete-account form { display: grid; gap: 8px; margin-top: 4px; }
.delete-account .auth-why { margin: 0; }
.btn-danger { background: #dc2626; color: #fff; height: 48px; }

/* ------------------------------------------------------------ find by link or name */
.find {
  position: relative;
  width: min(100%, 440px);
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.find > i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--text-3); pointer-events: none; }
.find input {
  height: 48px;
  min-width: 0;
  padding: 0 96px 0 44px;
  grid-column: 1 / -1;
  grid-row: 1;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}
.find input::placeholder { color: var(--text-3); }
.find input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.find-paste {
  grid-column: 2;
  grid-row: 1;
  margin-right: 5px;
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: transform 120ms ease;
}
.find-paste:active { transform: scale(0.96); }
.find-paste i { font-size: 16px; color: var(--text-2); }
.choices { list-style: none; width: min(100%, 440px); margin: 8px auto 0; padding: 6px; display: grid; gap: 2px; border-radius: var(--r-panel); border: 1px solid var(--line-2); background: var(--surface-solid); box-shadow: var(--shadow); }
.choices[hidden] { display: none; }
.choices button { width: 100%; display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center; padding: 6px; border-radius: 10px; text-align: left; }
.choices button:hover { background: var(--surface-2); }
.choices img, .choices .ph-art { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--surface-2); }
.choices b { display: block; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choices span { display: block; color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choices small { color: var(--text-3); font-size: 12px; font-family: var(--mono); }
.phone-help { display: block; margin: 14px auto 0; color: var(--text-2); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
.help { color: var(--text-2); font-size: 15px; overflow-y: auto; }
.help p { margin: 0 0 12px; text-wrap: pretty; }
.help h3 { display: flex; align-items: center; gap: 8px; margin: 18px 0 6px; color: var(--text); font-size: 16px; font-weight: 600; }
.help h3 i { color: var(--accent); font-size: 18px; }
.choices button > div { min-width: 0; }

/* ------------------------------------------------------------ guest claim, Google */
.claim { display: grid; gap: 4px; padding: 14px 16px; margin: 0 0 12px; border-radius: var(--r-panel); border: 1px solid var(--accent-mid); background: var(--accent-soft); }
.claim b { font-size: 15px; font-weight: 600; }
.claim span { color: var(--text-2); font-size: 14px; text-wrap: pretty; }
.claim-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.claim-actions .pill { min-height: 38px; }
.google-box[hidden] { display: none; }
/* Google's button is an iframe; a dark page colour scheme would paint it a white backdrop. */
.google-btn { min-height: 44px; display: flex; justify-content: center; color-scheme: light; }
.or { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; color: var(--text-3); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.auth-err.auth-ok { color: var(--text-2); }
.auth-form [hidden] { display: none; }

.claim .google-box { margin-top: 10px; }
.claim .google-btn { justify-content: flex-start; }
.alt-actions label.pill[hidden] { display: none; }
.phone-help[hidden] { display: none; }

/* ------------------------------------------------------------ add to list, open a pick */
.add-btn i { font-size: 19px; }
.add-btn.is-saved { color: var(--accent); border-color: var(--accent-mid); }
.pick-main { min-width: 0; cursor: pointer; border-radius: 8px; }
.pick-main:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pick-go { font-size: 13px; color: var(--text-3); margin-left: 4px; vertical-align: -1px; transition: transform 160ms var(--ease-out); }
.pick-main:hover .pick-go { transform: translateX(2px); color: var(--text-2); }
.pick-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pick-add { width: 36px; height: 36px; margin-right: -6px; display: grid; place-items: center; border-radius: 50%; font-size: 22px; color: var(--text-2); transition: background-color 160ms ease, transform 120ms ease; }
.pick-add:hover { background: var(--surface-2); color: var(--text); }
.pick-add:active { transform: scale(0.92); }
.pick-add.is-saved { color: var(--accent); }
.ai-remember { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; color: var(--text-2); font-size: 14px; }
.ai-remember input { width: 18px; height: 18px; accent-color: var(--accent); }
