/* S426.5 — Pulse Player design tokens + utility classes */
:root {
  /* Brand colors — modern music-app palette */
  --pulse-primary: #FF6B6B;          /* coral pink — buttons, active state */
  --pulse-primary-hover: #ff5252;
  --pulse-accent: #4ECDC4;            /* teal — highlights, equalizer */
  --pulse-accent-hover: #3db8b0;

  /* Surfaces */
  --pulse-surface: #0a0a0a;           /* near-black bg */
  --pulse-surface-elevated: #181818;  /* cards, modals, footer */
  --pulse-surface-overlay: rgba(0,0,0,.7);
  --pulse-surface-muted: #222;

  /* Text */
  --pulse-text: #eeeeee;
  --pulse-text-secondary: rgba(238,238,238,.7);
  --pulse-text-muted: rgba(238,238,238,.5);

  /* Borders */
  --pulse-border: #222;
  --pulse-border-strong: #333;

  /* Type */
  --pulse-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pulse-font-display: 'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing scale */
  --pulse-space-xs: 4px;
  --pulse-space-sm: 8px;
  --pulse-space-md: 16px;
  --pulse-space-lg: 24px;
  --pulse-space-xl: 32px;

  /* Radii */
  --pulse-radius-sm: 6px;
  --pulse-radius-md: 12px;
  --pulse-radius-lg: 24px;
  --pulse-radius-pill: 999px;

  /* Motion */
  --pulse-easing: cubic-bezier(.4, 0, .2, 1);
  --pulse-duration-fast: 120ms;
  --pulse-duration-normal: 240ms;

  /* Shadows */
  --pulse-shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --pulse-shadow-md: 0 4px 24px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.04);
  --pulse-shadow-lg: 0 12px 48px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
}

html, body, pulse-app {
  font-family: var(--pulse-font);
  background: var(--pulse-surface);
  color: var(--pulse-text);
}

/* Tabular numbers for time displays */
.pulse-tabular { font-variant-numeric: tabular-nums; }

/* Equalizer bars (used in mini-player when audio plays) */
.pulse-eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  width: 14px;
}
.pulse-eq__bar {
  width: 3px;
  background: var(--pulse-accent);
  border-radius: 1px;
  animation: pulse-eq-bounce 800ms ease-in-out infinite;
}
.pulse-eq__bar:nth-child(1) { height: 30%; animation-delay: 0ms; }
.pulse-eq__bar:nth-child(2) { height: 80%; animation-delay: 150ms; }
.pulse-eq__bar:nth-child(3) { height: 50%; animation-delay: 300ms; }
@keyframes pulse-eq-bounce {
  0%, 100% { transform: scaleY(.4); }
  50% { transform: scaleY(1); }
}

/* Cover-art consistency — no gradient fallback needed; img always present via cover-art.ts */
.pulse-cover {
  aspect-ratio: 1;
  object-fit: cover;
}

/* Nav — icon + label pairs */
.pulse-nav { display: flex; gap: var(--pulse-space-xs); align-items: center; }
.pulse-nav-item {
  display: inline-flex;
  align-items: center;
  gap: var(--pulse-space-xs);
  background: transparent;
  border: 0;
  color: var(--pulse-text-secondary);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--pulse-radius-sm);
  font: inherit;
  transition: color var(--pulse-duration-fast) var(--pulse-easing), background var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-nav-item:hover {
  color: var(--pulse-text);
  background: rgba(255,255,255,.06);
}
.pulse-nav-item--active {
  color: var(--pulse-text);
}
.pulse-nav-item__icon { width: 18px; height: 18px; display: inline-flex; }
.pulse-nav-item__label { font-size: 13px; font-weight: 500; }
.pulse-brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.pulse-brand-lockup__logo {
  height: 44px;
  width: auto;
  max-width: min(280px, 52vw);
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 6px 14px rgba(230,120,108,.25));
}

@media (max-width: 480px) {
  .pulse-nav-item__label { display: none; }
}

/* Route links should feel like app navigation, not default browser anchors. */
a[data-route-link] {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  font-weight: 500;
  transition:
    color var(--pulse-duration-fast) var(--pulse-easing),
    border-color var(--pulse-duration-fast) var(--pulse-easing),
    font-weight var(--pulse-duration-fast) var(--pulse-easing);
}
a[data-route-link]:hover {
  color: var(--pulse-accent);
  border-bottom-color: color-mix(in srgb, var(--pulse-accent) 65%, transparent);
  font-weight: 600;
}

/* ─── Mini player — Fix 2: fixed at very bottom, z-index 50 ─────────── */
pulse-now-playing[data-root-mounted] {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
}
/* Hide mini-player when drive mode is active */
body[data-route="drive"] pulse-now-playing[data-root-mounted] {
  display: none;
}
/* Admin sign-in: root mini-player is a sibling after <pulse-app>; hide so it cannot intercept taps */
body[data-pulse-route="admin"] pulse-now-playing[data-root-mounted] {
  display: none;
}

.pulse-mini {
  display: flex;
  align-items: center;
  gap: var(--pulse-space-md);
  padding: var(--pulse-space-sm) var(--pulse-space-md);
  background: var(--pulse-surface-elevated);
  border-top: 1px solid var(--pulse-border);
  height: 64px;
  cursor: pointer;
  transition: background var(--pulse-duration-fast) var(--pulse-easing);
  /* Fix 1: directional theme tint from current track color */
  background-image: linear-gradient(90deg, var(--pulse-theme-color-soft, transparent), transparent);
}
.pulse-mini:hover { background: #1f1f1f; }
.pulse-mini[data-empty] { color: var(--pulse-text-muted); justify-content: center; cursor: default; }
.pulse-mini__cover { width: 48px; height: 48px; border-radius: var(--pulse-radius-sm); flex-shrink: 0; }
.pulse-mini__meta { flex: 1; min-width: 0; }
.pulse-mini__title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-mini__artist {
  font-size: 12px;
  color: var(--pulse-text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pulse-mini__play {
  background: var(--pulse-primary);
  color: #fff;
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--pulse-duration-fast) var(--pulse-easing), background var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-mini__play:hover { background: var(--pulse-primary-hover); transform: scale(1.05); }
.pulse-mini__placeholder { font-size: 13px; }

/* Fix 4: additional controls in mini-player */
.pulse-mini__controls { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.pulse-mini__ctl {
  background: transparent;
  border: 0;
  color: var(--pulse-text-secondary);
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color var(--pulse-duration-fast) var(--pulse-easing), background var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-mini__ctl:hover { color: var(--pulse-text); background: rgba(255,255,255,.08); }
.pulse-mini__ctl[data-pressed="true"] { color: var(--pulse-primary); }
.pulse-mini__sleep-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: var(--pulse-radius-pill);
  background: rgba(255,255,255,.08);
  color: var(--pulse-text-secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.pulse-mini__overflow-menu {
  position: absolute;
  right: 12px;
  bottom: 58px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 160px;
  padding: 8px;
  border: 1px solid var(--pulse-border-strong);
  border-radius: var(--pulse-radius-md);
  background: var(--pulse-surface-elevated);
  box-shadow: var(--pulse-shadow-md);
  z-index: 60;
}
.pulse-mini__overflow-menu button,
.pulse-mini__overflow-menu pulse-share-button {
  width: 100%;
}
.pulse-mini__overflow-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: var(--pulse-radius-sm);
  background: transparent;
  color: var(--pulse-text);
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.pulse-mini__overflow-menu button:hover {
  background: rgba(255,255,255,.08);
}
@media (max-width: 1023px) {
  .pulse-mini__ctl--more,
  .pulse-mini__overflow-menu {
    display: none;
  }
}

/* ─── Expanded full-screen overlay ─────────────────────────────────── */
.pulse-expanded {
  position: fixed;
  inset: 0;
  /* Fix 1: expanded view uses theme color as top gradient stop */
  background: linear-gradient(180deg, var(--pulse-theme-color, var(--pulse-extracted-color, var(--pulse-surface-elevated))) 0%, var(--pulse-surface) 70%);
  z-index: 150;
  overflow-y: auto;
  animation: pulse-expanded-in var(--pulse-duration-normal) var(--pulse-easing);
}
@keyframes pulse-expanded-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.pulse-expanded__close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, .4);
  color: #fff;
  border: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-expanded__close:hover { background: rgba(0, 0, 0, .65); }
.pulse-expanded__inner {
  max-width: 480px;
  margin: 0 auto;
  padding: 64px var(--pulse-space-lg) var(--pulse-space-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--pulse-space-md);
}
.pulse-expanded__cover { width: 280px; height: 280px; border-radius: var(--pulse-radius-md); box-shadow: var(--pulse-shadow-lg); }
.pulse-expanded__title { font-size: 24px; font-weight: 700; margin: var(--pulse-space-lg) 0 4px 0; text-align: center; }
.pulse-expanded__artist { font-size: 16px; color: var(--pulse-text-secondary); margin: 0 0 var(--pulse-space-md) 0; text-align: center; }
.pulse-expanded__scrubber {
  display: flex;
  align-items: center;
  gap: var(--pulse-space-sm);
  width: 100%;
  font-size: 12px;
  color: var(--pulse-text-secondary);
}
.pulse-expanded__track {
  flex: 1;
  height: 4px;
  background: var(--pulse-border-strong);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.pulse-expanded__fill { height: 100%; background: var(--pulse-primary); border-radius: 2px; pointer-events: none; }
.pulse-expanded__controls {
  display: flex;
  align-items: center;
  gap: var(--pulse-space-lg);
  margin-top: var(--pulse-space-md);
}
.pulse-expanded__controls button {
  background: transparent;
  border: 0;
  color: var(--pulse-text);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: transform var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-expanded__controls button:hover { transform: scale(1.1); }
.pulse-expanded__play-button {
  background: var(--pulse-primary) !important;
  color: #fff !important;
  width: 64px;
  height: 64px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pulse-expanded__toolbar {
  display: flex;
  align-items: center;
  gap: var(--pulse-space-lg);
  margin-top: var(--pulse-space-md);
}
.pulse-expanded__toolbar button {
  background: transparent;
  border: 0;
  color: var(--pulse-text-secondary);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--pulse-radius-sm);
  transition: color var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-expanded__toolbar button:hover { color: var(--pulse-text); }
.pulse-expanded__toolbar button[data-pressed="true"] { color: var(--pulse-primary); }

/* ─── Library home ──────────────────────────────────────────────────── */
.pulse-library-home { padding: var(--pulse-space-md); display: flex; flex-direction: column; gap: var(--pulse-space-xl); }

/* Hero section */
.pulse-hero {
  display: grid; grid-template-columns: auto 1fr; gap: var(--pulse-space-lg);
  align-items: center; padding: var(--pulse-space-lg);
  background: linear-gradient(135deg, rgba(255,107,107,.15), rgba(78,205,196,.15));
  border-radius: var(--pulse-radius-lg);
}
.pulse-hero__art { position: relative; width: 200px; height: 200px; flex-shrink: 0; }
.pulse-hero__cover { width: 100%; height: 100%; border-radius: var(--pulse-radius-md); box-shadow: var(--pulse-shadow-lg); }
.pulse-hero__play {
  position: absolute; bottom: 12px; right: 12px;
  background: var(--pulse-primary); color: #fff; border: 0;
  width: 56px; height: 56px; border-radius: 50%; cursor: pointer;
  font-size: 22px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--pulse-shadow-md);
  transition: transform var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-hero__play:hover { transform: scale(1.08); }
.pulse-hero__eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--pulse-primary); font-weight: 600; }
.pulse-hero__title { font-size: 32px; font-weight: 700; margin: 4px 0; line-height: 1.1; }
.pulse-hero__artist { font-size: 16px; color: var(--pulse-text-secondary); margin: 0; }

@media (max-width: 600px) {
  .pulse-hero { grid-template-columns: 1fr; text-align: center; padding: var(--pulse-space-md); }
  .pulse-hero__art { width: 100%; max-width: 280px; height: auto; aspect-ratio: 1; margin: 0 auto; }
  .pulse-hero__art .pulse-hero__cover { height: 100%; }
  .pulse-hero__title { font-size: 24px; }
}

/* Rail titles */
.pulse-rail__title { font-size: 18px; font-weight: 600; margin: 0 0 var(--pulse-space-md) 0; }

/* Vertical track list section */
.pulse-rail-vert { display: flex; flex-direction: column; }

.pulse-tracks-list { display: flex; flex-direction: column; background: var(--pulse-surface-elevated); border-radius: var(--pulse-radius-md); overflow: hidden; }

/* Track row — used in home all-tracks, artist page, category page, search, queue */
.pulse-track-row {
  display: grid; grid-template-columns: 40px 1fr auto;
  align-items: center; gap: var(--pulse-space-md);
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-track-row:hover { background: rgba(255,255,255,.04); }
.pulse-track-row__cover { width: 40px; height: 40px; border-radius: var(--pulse-radius-sm); }
.pulse-track-row__title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-track-row__artist { font-size: 12px; color: var(--pulse-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-track-row__duration { font-size: 12px; color: var(--pulse-text-muted); }

/* Made for you callout */
.pulse-callout {
  display: flex; align-items: center; justify-content: space-between; gap: var(--pulse-space-md);
  padding: var(--pulse-space-md) var(--pulse-space-lg);
  background: var(--pulse-surface-elevated); border-radius: var(--pulse-radius-md);
  border-left: 3px solid var(--pulse-primary);
}
.pulse-callout h3 { margin: 0 0 4px 0; font-size: 15px; }
.pulse-callout p { margin: 0; font-size: 13px; color: var(--pulse-text-secondary); }
.pulse-callout__cta { background: var(--pulse-primary); color: #fff; border: 0; padding: 8px 16px; border-radius: var(--pulse-radius-sm); cursor: pointer; font-weight: 500; flex-shrink: 0; }
.pulse-callout__cta:hover { background: var(--pulse-primary-hover); }

/* ─── Artist cards (circular avatars) ──────────────────────────────── */
.pulse-artist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--pulse-space-md);
  padding: var(--pulse-space-md);
}
.pulse-artist-card {
  background: transparent; border: 0; cursor: pointer; padding: var(--pulse-space-sm);
  display: flex; flex-direction: column; align-items: center; gap: var(--pulse-space-sm);
  border-radius: var(--pulse-radius-md);
  transition: background var(--pulse-duration-fast) var(--pulse-easing);
  --avatar-size: 96px;
}
.pulse-artist-card:hover { background: rgba(255,255,255,.04); }
.pulse-artist-card__avatar {
  width: var(--avatar-size); height: var(--avatar-size);
  border-radius: 50%; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--pulse-shadow-sm);
}
.pulse-artist-card__avatar--fallback {
  color: #fff; font-size: calc(var(--avatar-size) * .4); font-weight: 700;
}
.pulse-artist-card__name {
  font-size: 14px; font-weight: 500; color: var(--pulse-text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: var(--avatar-size);
}

/* Language & category tile rows */
.pulse-tile-row { display: flex; gap: var(--pulse-space-sm); flex-wrap: wrap; }
.pulse-tile {
  background: var(--pulse-surface-elevated); border: 0; color: #fff; cursor: pointer;
  padding: 16px 20px; border-radius: var(--pulse-radius-md); font-weight: 600; font-size: 14px;
  min-width: 120px;
  transition: transform var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-tile:hover { transform: scale(1.02); }
.pulse-tile--lang { background: linear-gradient(135deg, var(--pulse-accent), #2dd4bf); }
.pulse-tile--category { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* ─── Trending tile (Fix 1 — S430) ──────────────────────────────────── */
.pulse-trending-tile {
  background: var(--pulse-surface-elevated); border: 0; cursor: pointer;
  border-radius: var(--pulse-radius-md); padding: 12px;
  width: 160px; flex-shrink: 0;
  text-align: left; color: var(--pulse-text);
  transition: transform var(--pulse-duration-fast), box-shadow var(--pulse-duration-fast);
}
.pulse-trending-tile:hover { transform: translateY(-3px); box-shadow: var(--pulse-shadow-md); }
.pulse-trending-tile .pulse-cover { width: 100%; height: 136px; border-radius: var(--pulse-radius-sm); margin-bottom: 8px; }
.pulse-trending-tile__title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-trending-tile__artist { font-size: 12px; color: var(--pulse-text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pulse-trending-tile__claps { font-size: 11px; color: var(--pulse-text-muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ─── Fix 3: drive-mode queue panel reskin (S430) ───────────────────── */
.pulse-queue-panel--drive { font-size: 18px; }
.pulse-queue-panel--drive .pulse-track-row { padding: 16px 20px; min-height: 64px; }
.pulse-queue-panel--drive .pulse-track-row__title { font-size: 18px; font-weight: 600; }
.pulse-queue-panel--drive .pulse-track-row__artist { font-size: 14px; }
.pulse-queue-panel--drive .pulse-track-row__cover { width: 56px; height: 56px; }

/* ─── Drive Mode FAB ────────────────────────────────────────────────── */
.pulse-drive-fab {
  position: fixed;
  bottom: 88px;          /* clear the 64px mini-player + spacing */
  right: 24px;
  width: 56px; height: 56px;
  background: var(--pulse-accent);
  color: #fff;
  border: 0; border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--pulse-shadow-md);
  z-index: 40;   /* below modals (100+), above mini-player (10) */
  transition: transform var(--pulse-duration-fast) var(--pulse-easing), background var(--pulse-duration-fast) var(--pulse-easing);
}
.pulse-drive-fab:hover { background: var(--pulse-accent-hover); transform: scale(1.05); }
.pulse-drive-fab:active { transform: scale(.95); }

@media (max-width: 480px) {
  .pulse-drive-fab { bottom: 80px; right: 16px; width: 48px; height: 48px; }
  .pulse-drive-fab svg { width: 24px; height: 24px; }
}

/* ─── Drive Mode auto-trigger banner ───────────────────────────────── */
.pulse-drive-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  background: linear-gradient(135deg, var(--pulse-accent), #2dd4bf);
  color: #fff; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--pulse-space-md);
  box-shadow: var(--pulse-shadow-md);
  animation: pulse-drive-banner-slide-down var(--pulse-duration-normal) var(--pulse-easing);
}
@keyframes pulse-drive-banner-slide-down { from { transform: translateY(-100%); } to { transform: translateY(0); } }
.pulse-drive-banner__text { font-weight: 500; }
.pulse-drive-banner__actions { display: flex; gap: 8px; }
.pulse-drive-banner__yes { background: #fff; color: var(--pulse-accent); border: 0; padding: 6px 14px; border-radius: var(--pulse-radius-sm); cursor: pointer; font-weight: 600; }
.pulse-drive-banner__no { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); padding: 6px 14px; border-radius: var(--pulse-radius-sm); cursor: pointer; }

@media (max-width: 480px) {
  .pulse-drive-banner { flex-direction: column; align-items: stretch; text-align: center; }
}

/* ─── Toast notifications ──────────────────────────────────────────── */
.pulse-toast-host {
  position: fixed;
  bottom: 96px;       /* clear mini-player (64px) + gap */
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.pulse-toast {
  background: var(--pulse-surface-elevated);
  color: var(--pulse-text);
  padding: 10px 16px;
  border-radius: var(--pulse-radius-pill);
  font-size: 13px;
  box-shadow: var(--pulse-shadow-md);
  pointer-events: auto;
  cursor: pointer;
  animation: pulse-toast-in var(--pulse-duration-normal) var(--pulse-easing);
  border: 1px solid var(--pulse-border);
}
.pulse-toast--success { border-color: rgba(78, 205, 196, .4); }
.pulse-toast--error { background: #4a1a1a; border-color: rgba(248, 113, 113, .4); color: #fca5a5; }
@keyframes pulse-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Like / heart burst animation ─────────────────────────────────── */
@keyframes pulse-heart-burst {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.4); }
  60%  { transform: scale(.9); }
  100% { transform: scale(1); }
}
.pulse-heart-burst {
  animation: pulse-heart-burst 360ms var(--pulse-easing);
}

/* ─── Skeleton loaders ──────────────────────────────────────────────── */
.pulse-skeleton {
  background: linear-gradient(90deg, var(--pulse-surface-elevated) 0%, #2a2a2a 50%, var(--pulse-surface-elevated) 100%);
  background-size: 200% 100%;
  animation: pulse-skeleton-shimmer 1.5s ease-in-out infinite;
}
@keyframes pulse-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── S430 Design Polish ────────────────────────────────────────────── */

/* Glassmorphism utility */
.pulse-glass {
  background: rgba(20, 20, 20, .5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .08);
}

/* Apply glass to mini-player */
.pulse-mini {
  background: rgba(20, 20, 20, .5) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .08);
}

/* Apply glass to toasts */
.pulse-toast {
  background: rgba(20, 20, 20, .5) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

/* Apply glass to drive FAB */
.pulse-drive-fab {
  background: rgba(20, 20, 20, .5) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .08) !important;
}
.pulse-drive-fab:hover {
  background: rgba(30, 30, 30, .6) !important;
}

/* Track row — hover lift + cover shadow */
.pulse-track-row {
  transition: background var(--pulse-duration-fast), transform var(--pulse-duration-fast);
}
.pulse-track-row:hover {
  background: rgba(255, 255, 255, .04) !important;
  transform: translateX(4px);
}
.pulse-track-row__cover {
  box-shadow: var(--pulse-shadow-sm);
  transition: box-shadow var(--pulse-duration-normal);
}
.pulse-track-row:hover .pulse-track-row__cover {
  box-shadow: var(--pulse-shadow-md);
}

/* Mount animation on library home rails */
.pulse-library-home > section {
  animation: pulse-rail-fade-in 480ms var(--pulse-easing) backwards;
}
.pulse-library-home > section:nth-child(1) { animation-delay: 0ms; }
.pulse-library-home > section:nth-child(2) { animation-delay: 80ms; }
.pulse-library-home > section:nth-child(3) { animation-delay: 160ms; }
.pulse-library-home > section:nth-child(4) { animation-delay: 240ms; }
.pulse-library-home > section:nth-child(5) { animation-delay: 320ms; }
.pulse-library-home > section:nth-child(6) { animation-delay: 400ms; }

@keyframes pulse-rail-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Hero — depth + subtle motion */
.pulse-hero {
  position: relative;
  overflow: hidden;
}
.pulse-hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,107,107,.2), transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(78,205,196,.15), transparent 60%);
  pointer-events: none;
  animation: pulse-hero-drift 12s ease-in-out infinite alternate;
}
@keyframes pulse-hero-drift {
  from { transform: scale(1) rotate(0deg); }
  to   { transform: scale(1.1) rotate(2deg); }
}
.pulse-hero__cover {
  transition: transform var(--pulse-duration-normal);
}
.pulse-hero:hover .pulse-hero__cover {
  transform: scale(1.03);
}

/* Tile hover lift */
.pulse-tile {
  transition: transform var(--pulse-duration-fast), box-shadow var(--pulse-duration-fast);
}
.pulse-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--pulse-shadow-md);
}

/* Typography hierarchy bump */
.pulse-rail__title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.5px;
  margin: 0 0 var(--pulse-space-md) 0;
}
.pulse-hero__title { font-size: 36px; letter-spacing: -1px; }
.pulse-expanded__title { font-size: 28px; letter-spacing: -.8px; }

/* ─── Fix 2: blocked-play pulsing attention animation (S430) ────────── */
.pulse-mini__play[data-blocked="true"],
.pulse-expanded__play-button[data-blocked="true"] {
  animation: pulse-button-attention 1.6s var(--pulse-easing) infinite;
}
@keyframes pulse-button-attention {
  0%, 100% { box-shadow: 0 0 0 0 var(--pulse-primary, #FF6B6B); transform: scale(1); }
  50% { box-shadow: 0 0 0 12px rgba(255, 107, 107, 0); transform: scale(1.06); }
}

/* ─── Fix 1: hero theme radial gradient stop ────────────────────────── */
.pulse-hero::before {
  background: radial-gradient(circle at 30% 20%, rgba(255,107,107,.2), transparent 60%),
              radial-gradient(circle at 70% 80%, rgba(78,205,196,.15), transparent 60%),
              radial-gradient(circle at 50% 50%, var(--pulse-theme-color-soft, transparent), transparent 80%);
}

/* ─── Fix 3: active track row CSS-driven highlight ─────────────────── */
.pulse-track-row[data-now-playing="true"] {
  background: var(--pulse-theme-color-soft, rgba(255,255,255,.06));
}
.pulse-track-row[data-now-playing="true"] .pulse-track-row__title {
  color: var(--pulse-theme-color, var(--pulse-text));
  font-weight: 600;
}

/* ─── Fix 5: View Transitions API animations ────────────────────────── */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 240ms;
  animation-timing-function: var(--pulse-easing);
}
::view-transition-old(root) { animation-name: pulse-page-out; }
::view-transition-new(root) { animation-name: pulse-page-in; }
@keyframes pulse-page-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes pulse-page-in { from { opacity: 0; transform: translateY(8px); } }

/* CSS fallback transitions */
.pulse-transition-out {
  opacity: 0;
  transition: opacity 120ms var(--pulse-easing);
}
.pulse-transition-in {
  animation: pulse-page-in 240ms var(--pulse-easing);
}
