/* music.benjaminb.xyz · GSAP-driven UI.
 *
 * Most of the motion is delivered by GSAP timelines from app.js
 * (entrance, mic breathe, thinking-orb morph, track-card stagger,
 * background colour drifts). This stylesheet defines the static
 * geometry, the colour system, and the few animations that are
 * cheap to express in CSS (gradient blob drift, grain, ring pulse
 * as a fallback before GSAP fires).
 */

:root {
  /* Near-black with a hint of warmth — reads richer than pure #000.
     Cards are barely-lifted glass over it. */
  --bg:        #08080c;
  --bg-2:      #101019;
  --ink:       #fbfbfd;
  --ink-dim:   #a8a8b8;
  --ink-faint: #65656f;
  /* Default accent is a confident electric violet; JS swaps the trio
     per mood. The 2/3 are derived hue-shifts so they always harmonise. */
  --accent:    #8b5cf6;
  --accent-2:  #ec4899;
  --accent-3:  #22d3ee;
  --line:      rgba(255,255,255,0.07);
  --line-2:    rgba(255,255,255,0.14);
  --line-3:    rgba(255,255,255,0.22);
  --bg-card:   rgba(255,255,255,0.035);
  --bg-card-2: rgba(255,255,255,0.06);
  --shadow:    0 24px 70px rgba(0,0,0,0.55);
  --sans:  'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', 'Georgia', serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100dvh; }
html { background: var(--bg); }
body {
  font-family: var(--sans);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--ink); text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: 0; color: inherit; padding: 0; }
.serif-i { font-family: var(--serif); font-style: italic; font-weight: 400; }

/* Keyboard focus ring — visible only for keyboard users, never on
   mouse click. Uses the live accent so it harmonises with the mood. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }
/* Smooth out the accent CSS-var swaps everywhere they're used as a
   solid colour (borders, text). Blobs/buttons have their own. */
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ── ambient background ─────────────────────────────────────────── */
/* A refined mesh of three soft light sources rather than muddy blobs.
   Each blob is a tighter, higher-contrast radial that reads as
   intentional lighting. Heavier blur + lower opacity = premium depth
   instead of "AI gradient soup". */
.bg-stage {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 80% at 50% -10%, var(--bg-2) 0%, transparent 55%),
    var(--bg);
  overflow: hidden;
}
.bg-blob {
  position: absolute;
  width: 60vmax; height: 60vmax;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.5;
  will-change: transform, opacity;
  transition: opacity 1.8s, background .8s;
  mix-blend-mode: screen;
}
.bg-blob-a {
  top: -28vmax; left: -20vmax;
  background: radial-gradient(circle, var(--accent) 0%, transparent 62%);
  animation: drift-a 34s ease-in-out infinite alternate;
}
.bg-blob-b {
  bottom: -28vmax; right: -20vmax;
  background: radial-gradient(circle, var(--accent-2) 0%, transparent 62%);
  animation: drift-b 42s ease-in-out infinite alternate;
}
.bg-blob-c {
  top: 25%; left: 50%;
  width: 42vmax; height: 42vmax;
  background: radial-gradient(circle, var(--accent-3) 0%, transparent 62%);
  animation: drift-c 50s ease-in-out infinite alternate;
  opacity: 0.38;
}
@keyframes drift-a {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(18vmax, 14vmax) scale(1.18); }
}
@keyframes drift-b {
  0%   { transform: translate(0, 0) scale(1.1); }
  100% { transform: translate(-18vmax, -12vmax) scale(0.92); }
}
@keyframes drift-c {
  0%   { transform: translate(-50%, -50%) scale(1); }
  100% { transform: translate(-35%, -65%) scale(1.25); }
}

.bg-particles {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
}
body[data-stage="story"] .bg-particles { opacity: 1; }

/* Finer, subtler grain than before. */
.bg-grain {
  position: absolute; inset: 0; pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size: 180px 180px;
  mix-blend-mode: overlay;
}
.bg-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 90% 90% at center, transparent 45%, rgba(0,0,0,0.5) 100%);
}

body[data-stage="listening"] .bg-blob { opacity: 0.8; }
body[data-stage="story"]     .bg-blob { opacity: 0.72; }

@media (prefers-reduced-motion: reduce) {
  .bg-blob { animation: none; }
}

/* ── topbar ─────────────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px;
  z-index: 10;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 0.95rem; letter-spacing: -0.005em;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
  filter: drop-shadow(0 0 14px var(--accent));
}
.brand-text { color: var(--ink-dim); }
.brand-dim  { color: var(--ink-faint); }

.topbar-right { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--ink-dim); }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.user-chip img { width: 24px; height: 24px; border-radius: 50%; }
.signin-btn, .signout-btn {
  padding: 7px 16px;
  font-size: 0.84rem;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background .15s, border-color .15s;
}
.signin-btn:hover, .signout-btn:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-card)); }

/* ── stage / scenes ─────────────────────────────────────────────── */
.stage {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 90px 24px 100px;
  position: relative;
}
.scene {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

/* ── IDLE SCENE ─────────────────────────────────────────────────── */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 32px;
  padding: 7px 16px;
  font-size: 0.74rem; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--ink-dim);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.eyebrow-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent), 0 0 0 0 var(--accent);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 8px var(--accent), 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); opacity: 1; }
  100% { box-shadow: 0 0 8px var(--accent), 0 0 0 14px transparent; opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) { .eyebrow-dot { animation: none; } }

.display-title {
  font-size: clamp(3rem, 9vw, 6.2rem);
  line-height: 0.98; letter-spacing: -0.045em;
  margin: 0 0 52px;
  font-weight: 700;
}
.display-title .line { display: block; }
.display-title .dim  {
  color: transparent;
  background: linear-gradient(120deg, var(--ink-dim), var(--ink-faint));
  -webkit-background-clip: text; background-clip: text;
}
.display-title .serif-i {
  background: linear-gradient(120deg, var(--accent-3), var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ── mic ────────────────────────────────────────────────────────── */
.mic {
  position: relative;
  width: 180px; height: 180px;
  margin: 0 auto 28px;
  display: inline-block;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.mic-core {
  position: absolute; inset: 22px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,0.35), transparent 50%),
    linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  color: #fff;
  box-shadow:
    0 24px 60px color-mix(in srgb, var(--accent) 45%, transparent),
    0 0 0 1px rgba(255,255,255,0.16) inset,
    0 -8px 24px rgba(255,255,255,0.12) inset,
    0 0 90px color-mix(in srgb, var(--accent) 30%, transparent);
  /* GSAP also tweens transform on hover/active; keep CSS shadow only. */
  transition: box-shadow .25s;
  z-index: 2;
}
.mic-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 30%, transparent);
  pointer-events: none;
}
.mic-ring-1 { animation: ring-pulse 3s ease-out infinite; }
.mic-ring-2 { animation: ring-pulse 3s ease-out infinite 1s; }
.mic-ring-3 { animation: ring-pulse 3s ease-out infinite 2s; }
@keyframes ring-pulse {
  0%   { transform: scale(0.95); opacity: 0.7; }
  100% { transform: scale(1.65); opacity: 0;   }
}
@media (prefers-reduced-motion: reduce) {
  .mic-ring { animation: none; opacity: 0.4; }
}

body[data-stage="listening"] .mic-core {
  box-shadow:
    0 24px 80px color-mix(in srgb, var(--accent) 70%, transparent),
    0 0 0 1px rgba(255,255,255,0.18) inset,
    0 0 140px color-mix(in srgb, var(--accent) 55%, transparent);
}
body[data-stage="listening"] .mic-ring-1 { animation-duration: 1.2s; border-color: var(--accent); }
body[data-stage="listening"] .mic-ring-2 { animation-duration: 1.2s; animation-delay: 0.4s; border-color: var(--accent); }
body[data-stage="listening"] .mic-ring-3 { animation-duration: 1.2s; animation-delay: 0.8s; border-color: var(--accent); }
body[data-stage="listening"] .mic-hint { color: var(--accent); }

.mic-hint { margin: 0 0 24px; font-size: 0.94rem; color: var(--ink-faint); transition: color .25s; }
.transcript {
  max-width: 560px; margin: 0 auto 24px;
  padding: 18px 24px;
  font-family: var(--serif); font-style: italic;
  font-size: 1.5rem; line-height: 1.35;
  color: var(--ink);
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  min-height: 60px;
}
.transcript-cursor {
  display: inline-block;
  width: 2px; height: 1em;
  margin-left: 4px;
  background: var(--accent);
  vertical-align: middle;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── text fallback ──────────────────────────────────────────────── */
.text-fallback { max-width: 620px; margin: 0 auto 28px; }
.text-fallback summary {
  display: inline-block; cursor: pointer;
  padding: 8px 18px;
  font-size: 0.86rem; color: var(--ink-dim);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 999px;
  list-style: none;
  user-select: none;
  transition: color .15s, border-color .15s;
}
.text-fallback summary::-webkit-details-marker { display: none; }
.text-fallback summary:hover { color: var(--ink); border-color: var(--ink-dim); }
.text-fallback[open] summary { color: var(--accent); border-color: var(--accent); margin-bottom: 14px; }

.mood-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.mood-form textarea {
  width: 100%; padding: 16px 18px;
  font: inherit; font-size: 1.02rem;
  color: var(--ink);
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  resize: none;
  outline: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.mood-form textarea::placeholder { color: var(--ink-faint); }
.mood-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

/* ── buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  font: inherit; font-size: 0.94rem; font-weight: 500;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--ink);
  transition: background .15s, border-color .15s, transform .04s, opacity .15s;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.btn:hover  { background: rgba(255,255,255,0.06); border-color: var(--ink-dim); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.btn-disabled { opacity: 0.55; cursor: not-allowed; pointer-events: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0a0a14; border-color: transparent; font-weight: 600;
  box-shadow: 0 8px 32px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-primary:hover    { filter: brightness(1.1); }
.btn-primary:disabled { background: var(--accent); }
.btn-spotify { background: #1ED760; border-color: #1ED760; color: #0a0a14; box-shadow: 0 8px 32px rgba(30,215,96,0.30); }
.btn-spotify:hover { background: #1fdc63; border-color: #1fdc63; filter: brightness(1.04); }
.btn-ghost { background: transparent; }
.badge-soon {
  margin-left: 4px; padding: 2px 8px;
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--line-2); color: var(--ink-dim);
  border-radius: 999px;
}
.btn.is-loading .btn-label, .btn.is-loading svg:not(.btn-spinner) { visibility: hidden; }
.btn .btn-spinner {
  position: absolute; width: 16px; height: 16px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; opacity: 0;
  transition: opacity .15s;
}
.btn.is-loading .btn-spinner { opacity: 1; animation: btn-spin .7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn .btn-spinner { animation: none; } }

/* ── suggestions ────────────────────────────────────────────────── */
.suggestions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; max-width: 600px; margin: 0 auto; }
.chip {
  padding: 9px 16px;
  font-size: 0.85rem; font-weight: 450;
  color: var(--ink-dim);
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background .18s, color .18s, border-color .18s, transform .12s;
}
.chip:hover {
  transform: translateY(-2px);
  color: var(--ink); border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-card));
}

/* ── THINKING SCENE ─────────────────────────────────────────────── */
.scene-thinking { display: flex; flex-direction: column; align-items: center; }

.orb-wrap {
  position: relative;
  width: 240px; height: 240px;
  margin: 0 auto 40px;
}
.orb-core {
  position: absolute; inset: 33%;
  background: radial-gradient(circle at 30% 30%, var(--accent-3), var(--accent), var(--accent-2));
  border-radius: 50%;
  box-shadow:
    0 24px 80px color-mix(in srgb, var(--accent) 55%, transparent),
    0 0 0 1px rgba(255,255,255,0.18) inset,
    0 0 120px color-mix(in srgb, var(--accent) 45%, transparent);
  /* Slow continuous rotation handled by GSAP — gives a "liquid" vibe. */
}
.orb-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--accent) 40%, transparent);
  pointer-events: none;
}

/* Avatars of resolved artists orbit around the orb. */
.orb-avatars { position: absolute; inset: 0; }
.orb-avatar {
  position: absolute;
  width: 36px; height: 36px;
  top: 50%; left: 50%;
  margin-left: -18px; margin-top: -18px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-2);
  border: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  opacity: 0; /* GSAP fades + scales in */
  will-change: transform, opacity;
}
.orb-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.thinking-phase {
  margin: 0 0 8px;
  font-family: var(--serif); font-style: italic;
  font-size: 1.8rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.thinking-meta {
  margin: 0 0 28px;
  font-size: 0.95rem;
  color: var(--ink-dim);
  max-width: 480px;
}

.intent-card {
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
  max-width: 640px; margin: 0 auto 24px;
  padding: 14px 22px;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
}
.intent-row {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-size: 0.88rem;
}
.intent-label {
  font-family: var(--sans);
  font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint);
}
.intent-val { color: var(--ink); font-weight: 500; }

.thinking-artists {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; gap: 6px; justify-content: center;
  max-width: 640px;
}
.thinking-artists li {
  font-size: 0.84rem;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, var(--bg-card));
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  color: var(--ink);
  opacity: 0; /* GSAP staggers them in */
}

/* ── RESULT SCENE ───────────────────────────────────────────────── */
.scene-result { text-align: left; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 32px;
  font-size: 0.9rem; color: var(--ink-dim);
  transition: color .15s;
}
.back-btn:hover { color: var(--ink); }

.result-head { text-align: center; margin-bottom: 36px; }
.result-vibe {
  display: inline-block;
  padding: 5px 14px;
  margin-bottom: 18px;
  font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 999px;
}
.result-title {
  font-size: clamp(2.4rem, 5.8vw, 4rem);
  line-height: 1.02; letter-spacing: -0.035em;
  margin: 0 0 14px;
  font-weight: 700;
}
.result-desc {
  max-width: 520px; margin: 0 auto;
  color: var(--ink-dim); font-size: 1.06rem; line-height: 1.5;
  font-family: var(--serif); font-style: italic;
}
.result-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 36px 0 40px; }

/* ── tracks ─────────────────────────────────────────────────────── */
.tracks { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.tracks li {
  /* GSAP handles the entrance animation now; static state is hidden
     so anything we don't tween stays invisible (defensive). */
  opacity: 1;
}
.track {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .12s, background .15s;
}
.track:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-card));
}
.track-art { width: 48px; height: 48px; border-radius: 8px; flex-shrink: 0; background: var(--bg-2); overflow: hidden; }
.track-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.track-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.track-title  { font-size: 0.96rem; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-artist { font-size: 0.84rem; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-why {
  font-family: var(--serif); font-style: italic; font-size: 0.82rem;
  color: var(--ink-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 28ch;
  display: none;
}
.track-time { font-size: 0.8rem; color: var(--ink-faint); font-variant-numeric: tabular-nums; flex-shrink: 0; }
@media (min-width: 640px) { .track-why { display: inline; } }

.result-foot {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem; color: var(--ink-faint);
  flex-wrap: wrap;
}
.result-foot .btn { padding: 9px 16px; font-size: 0.86rem; }

/* ── toast ──────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translateX(-50%);
  padding: 12px 22px;
  background: var(--ink); color: var(--bg);
  font-size: 0.92rem; font-weight: 500;
  border-radius: 12px;
  box-shadow: 0 16px 50px rgba(0,0,0,0.5);
  z-index: 100;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-bad  { background: #ff6b8a; color: #0a0a14; }
.toast.is-good { background: #5ce3a0; color: #0a0a14; }
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(-6px); }

/* ── footer ─────────────────────────────────────────────────────── */
.foot {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 14px 24px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--ink-faint);
  background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
  pointer-events: none;
}
.foot a { color: var(--ink-dim); pointer-events: auto; }
.foot a:hover { color: var(--ink); }
.foot-dot { margin: 0 6px; }

/* ── responsive ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .topbar { padding: 14px 16px; }
  .stage { padding: 80px 16px 110px; }
  .display-title { letter-spacing: -0.03em; margin-bottom: 40px; }
  .mic { width: 144px; height: 144px; margin-bottom: 22px; }
  .mic-core { inset: 18px; }
  .transcript { font-size: 1.18rem; padding: 14px 18px; }
  .result-actions .btn { flex: 1 1 100%; }
  .track-art { width: 44px; height: 44px; }
  .track { padding: 8px 12px; gap: 12px; }
  .orb-wrap { width: 200px; height: 200px; }
  .thinking-phase { font-size: 1.45rem; }
}
@media (max-width: 380px) {
  .display-title { font-size: 2.2rem; }
  .mic { width: 124px; height: 124px; }
  .chip { font-size: 0.78rem; padding: 7px 12px; }
}

/* ═══════════════════════════════════════════════════════════════════
   WRAPPED-STYLE STORY SCENE
   Each .story-card fills the viewport. Only one .is-active at a time.
   GSAP timelines tween entry/exit; CSS provides the rest pose.
   ═══════════════════════════════════════════════════════════════════ */

.scene-story {
  position: fixed; inset: 0;
  display: block;
  padding: 0;
  z-index: 5;
}

.story-progress {
  position: absolute; top: env(safe-area-inset-top, 12px);
  left: 16px; right: 16px;
  display: flex; gap: 4px;
  z-index: 12;
  pointer-events: none;
}
.story-progress .seg {
  flex: 1;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.story-progress .seg.is-done { background: rgba(255,255,255,0.55); }
.story-progress .seg .fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
  border-radius: 2px;
}

.story-stack { position: relative; width: 100%; height: 100%; }

.story-card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 80px 28px 100px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(40px);
  will-change: transform, opacity;
}
.story-card.is-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
@supports (height: 100dvh) {
  .story-card { padding: max(80px, env(safe-area-inset-top, 80px)) 28px max(100px, env(safe-area-inset-bottom, 100px)); }
}

/* Eyebrow above each card title. */
.story-eyebrow {
  margin: 0 0 24px;
  font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink-faint);
}

.story-headline {
  margin: 0 0 40px;
  font-size: clamp(2.6rem, 9vw, 6.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  font-weight: 700;
}
.story-line { display: block; }

/* "you said" — big italic serif. Wrapped trick. */
.story-mood-quote {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(2.2rem, 8vw, 5.4rem);
  line-height: 1.05;
  letter-spacing: -0.025em;
  max-width: 12ch;
  color: var(--ink);
  font-weight: 400;
}

/* Vibe card */
.story-vibe-word {
  margin: 0 0 12px;
  font-size: clamp(4rem, 16vw, 10rem);
  line-height: 0.85;
  letter-spacing: -0.05em;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-transform: lowercase;
}
.story-vibe-desc {
  max-width: 540px; margin: 0 0 36px;
  font-size: 1.1rem; color: var(--ink-dim);
  font-family: var(--serif); font-style: italic;
  line-height: 1.4;
}
.story-vibe-meters {
  display: flex; flex-direction: column; gap: 14px;
  max-width: 360px; width: 100%; margin: 0 auto 24px;
}
.meter {
  display: grid;
  grid-template-columns: 80px 1fr 44px;
  gap: 12px; align-items: center;
}
.meter-label {
  font-size: 0.74rem; letter-spacing: 0.10em; text-transform: uppercase;
  color: var(--ink-faint); text-align: right;
}
.meter-bar {
  height: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent), var(--accent-2));
  border-radius: 99px;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.meter-pct {
  font-size: 0.84rem; color: var(--ink); font-variant-numeric: tabular-nums;
  text-align: left; font-weight: 500;
}
.story-genres {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  max-width: 520px; margin: 12px auto 0;
}
.story-genre-chip {
  padding: 7px 14px;
  font-size: 0.86rem;
  background: var(--bg-card-2);
  border: 1px solid var(--line-2);
  border-radius: 99px;
  color: var(--ink);
}

/* Big number — Wrapped's signature. */
.story-bignum {
  margin: 0;
  font-size: clamp(8rem, 32vw, 18rem);
  line-height: 0.8;
  letter-spacing: -0.06em;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 8px 40px color-mix(in srgb, var(--accent) 30%, transparent));
}
.story-bignum-sub {
  margin: 8px 0 32px;
  font-size: 1.06rem;
  color: var(--ink-dim);
}
.story-bignum-sub-tight { margin: 8px 0 12px; }

/* Picking ticker — a vertical roll of song names. */
.picking-ticker {
  width: 100%; max-width: 520px;
  height: 220px;
  margin: 0 auto;
  position: relative;
  mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
  overflow: hidden;
}
.picking-ticker-inner {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 80px 0;
}
.picking-ticker-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  font-size: 0.88rem;
}
.picking-ticker-item img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.picking-ticker-item-info { min-width: 0; flex: 1; }
.picking-ticker-item-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picking-ticker-item-artist { font-size: 0.76rem; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Personal card — user's favourite artists fly in */
.personal-list {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  max-width: 640px; padding: 0; margin: 0 0 8px; list-style: none;
}
.personal-list li {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--bg-card-2);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: 0.92rem;
}
.personal-list img { width: 28px; height: 28px; border-radius: 50%; }

/* Playlist name reveal */
.story-playlist-title {
  margin: 0 0 16px;
  font-size: clamp(3rem, 11vw, 7.4rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-weight: 700;
  max-width: 12ch;
  background: linear-gradient(135deg, var(--accent-3), var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.story-playlist-desc {
  max-width: 540px; margin: 0;
  font-family: var(--serif); font-style: italic;
  font-size: 1.2rem; line-height: 1.4;
  color: var(--ink-dim);
}

/* Final result card */
.story-card-result {
  align-items: stretch;
  text-align: left;
  justify-content: flex-start;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.story-card-result > * { width: 100%; max-width: 720px; margin-left: auto; margin-right: auto; }
.story-card-result .result-head { text-align: center; margin-bottom: 28px; }
.story-card-result .tracks { padding-bottom: 40px; }

/* Context-card pills */
.story-context-grid {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
  max-width: 640px;
}
.ctx-pill {
  display: inline-flex; flex-direction: column; gap: 4px;
  padding: 14px 22px;
  background: var(--bg-card-2);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  text-align: left; min-width: 140px;
}
.ctx-key {
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint);
}
.ctx-val {
  font-size: 1.1rem; font-weight: 500;
  color: var(--ink);
}

/* Nav arrows */
.story-nav {
  position: absolute;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px;
  z-index: 11;
}
.story-nav-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--bg-card-2);
  border: 1px solid var(--line-2);
  color: var(--ink);
  font-size: 1.1rem;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background .15s, border-color .15s;
}
.story-nav-btn:hover { background: rgba(255,255,255,0.08); border-color: var(--accent); }
.story-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.story-skip {
  position: absolute;
  top: max(env(safe-area-inset-top, 12px) + 20px, 32px);
  right: 16px;
  padding: 8px 16px;
  font-size: 0.84rem; color: var(--ink-dim);
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  z-index: 12;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.story-skip:hover { color: var(--ink); border-color: var(--accent); }

@media (max-width: 600px) {
  .story-progress { left: 10px; right: 10px; }
  .story-eyebrow { margin-bottom: 18px; font-size: 0.72rem; }
  .story-headline { margin-bottom: 28px; }
  .story-vibe-meters { max-width: 100%; }
  .meter { grid-template-columns: 70px 1fr 38px; gap: 10px; }
  .meter-label { font-size: 0.68rem; }
  .ctx-pill { min-width: 110px; padding: 12px 16px; }
  .story-skip { right: 10px; padding: 6px 12px; font-size: 0.78rem; }
  .picking-ticker { height: 180px; }
}

/* Reduced motion: kill scaling but keep cross-fade. */
@media (prefers-reduced-motion: reduce) {
  .story-card { transition: opacity .3s; transform: none !important; }
}


/* ── audio preview button on each track ────────────────────────── */
.track-preview {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-card-2);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  flex-shrink: 0;
  transition: background .15s, color .15s, transform .12s;
  margin-left: 4px;
}
.track-preview:hover { background: var(--accent); color: #0a0a14; border-color: var(--accent); transform: scale(1.08); }
.track-preview.is-playing { background: var(--accent); color: #0a0a14; border-color: var(--accent); }
.track-preview.is-playing svg { animation: preview-pulse 1.2s ease-in-out infinite; }
@keyframes preview-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }


/* ── result cover: 2x2 album-art mosaic ────────────────────────── */
.result-cover {
  width: 168px; height: 168px;
  margin: 0 auto 24px;
  border-radius: 16px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px var(--line) inset;
  background: var(--bg-2);
}
.result-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-cover.is-single { grid-template-columns: 1fr; grid-template-rows: 1fr; }
@media (max-width: 600px) {
  .result-cover { width: 132px; height: 132px; }
}
