/* ─────────────────────────────────────────────────────────────────────────────
   Core Conditioning for Horses — Audio App
   Design System: Deep equestrian · Editorial · Premium
   ───────────────────────────────────────────────────────────────────────────── */

/* ── Fonts ─────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;0,600;1,300;1,400;1,500&family=Inter:wght@300;400;500&display=swap');

/* ── Design Tokens ──────────────────────────────────────────────────────────── */
:root {
  /* Colour — dark equestrian earth palette */
  --ink:          #0e0c09;        /* near-black with warmth */
  --ink-deep:     #070604;        /* deepest dark */
  --ink-raised:   #1a1610;        /* raised surface */
  --ink-border:   #2a2318;        /* subtle border */
  --ink-muted:    #3d3327;        /* muted dark */

  --sand:         #c8b89a;        /* warm sand — primary accent */
  --sand-light:   #ddd0bc;        /* light sand */
  --sand-pale:    #f0e8dd;        /* pale sand / text on dark */
  --sand-dim:     #8c7a62;        /* dimmed sand */

  --gold:         #b8974a;        /* warm gold — highlight */
  --gold-bright:  #d4af6b;        /* bright gold */
  --gold-dim:     #7a6330;        /* dark gold */

  --cream:        #f5f0e8;        /* off-white */
  --cream-warm:   #faf6f0;        /* warmest white */

  --text-primary:   #f0e8dd;      /* sand-pale on dark bg */
  --text-secondary: #b8a99a;      /* muted warm grey */
  --text-tertiary:  #7a6d61;      /* very muted */
  --text-on-light:  #1a1610;      /* dark text on light bg */

  /* Track accent colours — one unique warm tone per level */
  --wellness-hue:     #9ab89a;    /* muted sage green */
  --connection-hue:   #9aabb8;    /* muted slate blue */
  --flexibility-hue:  #b8a99a;    /* warm taupe */
  --agility-hue:      #b89a9a;    /* muted rose */

  /* Typography */
  --font-serif:   'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
  --font-sans:    'Inter', 'Helvetica Neue', 'Arial', sans-serif;

  /* Spacing scale */
  --space-1:   4px;
  --space-2:   8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  48px;
  --space-8:  64px;
  --space-9:  96px;
  --space-10: 128px;

  /* Radii */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Motion */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
  --dur-fast:  150ms;
  --dur-base:  280ms;
  --dur-slow:  500ms;
  --dur-xslow: 800ms;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg:  0 12px 40px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.3);
  --shadow-gold: 0 0 0 1px rgba(184,151,74,0.3), 0 8px 32px rgba(184,151,74,0.12);

  /* Layout */
  --max-width: 560px;
  --player-height: 104px;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--ink);
  min-height: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

/* ── Grain texture overlay ──────────────────────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ── Ambient radial gradient ─────────────────────────────────────────────────── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 45% at 50% -5%,  rgba(184,151,74,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 50% 30% at 90% 100%,  rgba(184,151,74,0.04) 0%, transparent 60%);
}

/* ── App layout ─────────────────────────────────────────────────────────────── */
#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.app-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 var(--space-5);
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.site-header {
  padding: calc(var(--space-7) + 8px) 0 var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-4);
}

.header-eyebrow {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.95;
}

.site-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.logo-mark {
  width: 52px;
  height: 52px;
  opacity: 0.9;
}

.site-title {
  font-family: var(--font-serif);
  font-size: clamp(2.1rem, 6vw, 2.7rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.08;
  color: var(--sand-pale);
}

.site-title em {
  font-style: italic;
  font-weight: 300;
  color: var(--sand);
}

.header-rule {
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: var(--space-2) auto 0;
}

.site-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2.9vw, 1.15rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.55;
}

/* ── Offline banner ─────────────────────────────────────────────────────────── */
.offline-banner {
  display: none;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: rgba(184, 151, 74, 0.1);
  border: 1px solid rgba(184, 151, 74, 0.25);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.offline-banner.visible {
  display: flex;
}

.offline-banner-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--gold);
}

.offline-banner-text {
  font-size: 0.8125rem;
  color: var(--sand);
  line-height: 1.4;
}

/* ── Track list ─────────────────────────────────────────────────────────────── */
.tracks-section {
  flex: 1;
  padding-bottom: var(--space-5);
}

.tracks-heading {
  font-family: var(--font-serif);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
  padding-left: var(--space-1);
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ── Track card ─────────────────────────────────────────────────────────────── */
.track-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: 112px;
  padding: 28px;
  background: var(--ink-raised);
  border: 1px solid var(--ink-border);
  border-radius: 20px;
  cursor: pointer;
  transition:
    background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

.track-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  background: linear-gradient(135deg, rgba(184,151,74,0.06) 0%, transparent 60%);
  transition: opacity var(--dur-base) var(--ease-out);
}

.track-card:hover {
  background: #201c14;
  border-color: var(--ink-muted);
  box-shadow: var(--shadow-md);
}

.track-card:hover::before {
  opacity: 1;
}

.track-card:active {
  transform: scale(0.99);
}

/* Active / playing state */
.track-card.is-active {
  background: #1c1810;
  border-color: rgba(184,151,74,0.35);
  box-shadow: var(--shadow-gold);
}

.track-card.is-active::before {
  opacity: 1;
}

/* Track number badge */
.track-number {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--ink-muted);
  border: 1px solid var(--ink-border);
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition:
    background var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out);
}

.num-display {
  transition: opacity var(--dur-fast) var(--ease-out);
}

.track-card.is-active .track-number {
  background: rgba(184,151,74,0.15);
  border-color: rgba(184,151,74,0.4);
  color: var(--gold-bright);
}

/* Playing indicator — animated bars */
.playing-bars {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
  position: absolute;
}

/* Hide the number text, show bars — both live inside .track-number */
.track-card.is-active.is-playing .num-display {
  opacity: 0;
  pointer-events: none;
}

.track-card.is-active.is-playing .playing-bars {
  display: flex;
}

.playing-bars span {
  display: block;
  width: 3px;
  background: var(--gold-bright);
  border-radius: 2px;
  animation: bar-bounce 1.1s ease-in-out infinite;
}

.playing-bars span:nth-child(1) { height: 60%; animation-delay: 0s; }
.playing-bars span:nth-child(2) { height: 100%; animation-delay: 0.18s; }
.playing-bars span:nth-child(3) { height: 75%; animation-delay: 0.36s; }

@keyframes bar-bounce {
  0%, 100% { transform: scaleY(0.4); opacity: 0.6; }
  50%       { transform: scaleY(1);   opacity: 1; }
}

/* Track info */
.track-info {
  flex: 1;
  min-width: 0;
}

.track-name {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 4vw, 1.6rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 6px;
  transition: color var(--dur-base) var(--ease-out);
}

.track-card.is-active .track-name {
  color: var(--sand-pale);
}

.track-gait {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  transition: color var(--dur-base) var(--ease-out);
}

.track-card.is-active .track-gait {
  color: var(--gold-dim);
}

.track-description {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

/* Track right area */
.track-right {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.track-duration {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-tertiary);
  letter-spacing: 0.03em;
  transition: color var(--dur-base) var(--ease-out);
}

.track-card.is-active .track-duration {
  color: var(--sand-dim);
}

/* Cache status badge */
.cache-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  transition: all var(--dur-base) var(--ease-out);
}

.cache-badge.cached {
  color: var(--wellness-hue);
  background: rgba(154, 184, 154, 0.1);
  border: 1px solid rgba(154, 184, 154, 0.2);
}

.cache-badge.not-cached {
  color: var(--text-tertiary);
  background: var(--ink-muted);
  border: 1px solid var(--ink-border);
  opacity: 0.7;
}

.cache-badge.caching {
  color: var(--gold);
  background: rgba(184,151,74,0.08);
  border: 1px solid rgba(184,151,74,0.2);
  animation: pulse-badge 1.5s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 0.7; }
  50%       { opacity: 1; }
}

.cache-badge svg {
  display: inline-block;
  width: 8px;
  height: 8px;
}

/* ── Persistent Player ──────────────────────────────────────────────────────── */
.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(14, 12, 9, 0.97);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--ink-border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform: translateY(100%);
  transition: transform var(--dur-slow) var(--ease-out);
}

.player-bar.visible {
  transform: translateY(0);
}

.player-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px var(--space-5) 22px;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* Track identity in player */
.player-track-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.player-track-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-track-level {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  flex-shrink: 0;
}

/* Scrubber */
.player-scrubber {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.player-time {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.03em;
  width: 44px;
  flex-shrink: 0;
}

.player-time.right {
  text-align: right;
}

/* Progress / seek bar */
.seek-track {
  flex: 1;
  position: relative;
  height: 40px;
  display: flex;
  align-items: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.seek-rail {
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: #2a241a;
  border-radius: var(--radius-full);
  overflow: hidden;
}

.seek-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
  border-radius: var(--radius-full);
  transition: width 0.25s linear;
  pointer-events: none;
}

/* Invisible range input on top for native seek */
.seek-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.seek-input::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; }
.seek-input::-moz-range-thumb { width: 28px; height: 28px; border: none; background: transparent; }

/* Thumb dot */
.seek-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--gold-bright);
  box-shadow: 0 0 0 4px rgba(184,151,74,0.22);
  pointer-events: none;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  left: 0%;
}

.seek-track:hover .seek-thumb,
.seek-track:active .seek-thumb {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: 0 0 0 6px rgba(184,151,74,0.18);
}

/* Controls row */
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Secondary controls (skip ±15, download) */
.player-controls-secondary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.04);
  transition:
    color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.ctrl-btn:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

.ctrl-btn:active {
  transform: scale(0.9);
}

.ctrl-btn svg {
  width: 24px;
  height: 24px;
  pointer-events: none;
}

/* Play / Pause button — the big one */
.play-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: var(--radius-full);
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: var(--ink-deep);
  border: none;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
  box-shadow: 0 10px 30px rgba(184,151,74,0.24);
}

.play-btn:hover {
  background: linear-gradient(180deg, #e0ba75, var(--gold-bright));
  box-shadow: 0 14px 34px rgba(184,151,74,0.32);
}

.play-btn:active {
  transform: scale(0.93);
}

.play-btn svg {
  width: 28px;
  height: 28px;
  pointer-events: none;
}

/* Icon swap */
.icon-play   { display: block; }
.icon-pause  { display: none; }

.player-bar.is-playing .icon-play  { display: none; }
.player-bar.is-playing .icon-pause { display: block; }

/* Volume / speed pills */
.player-options {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.speed-btn {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: var(--ink-raised);
  border: 1px solid var(--ink-border);
  padding: 10px 14px;
  border-radius: var(--radius-full);
  min-width: 64px;
  min-height: 48px;
  text-align: center;
  transition: all var(--dur-fast) var(--ease-out);
}

.speed-btn:hover {
  color: var(--text-primary);
  border-color: var(--ink-muted);
}

.speed-btn.active {
  color: var(--gold);
  border-color: rgba(184,151,74,0.35);
  background: rgba(184,151,74,0.08);
}

/* ── Download / offline section ─────────────────────────────────────────────── */
.offline-section {
  padding: var(--space-6) 0;
  border-top: 1px solid var(--ink-border);
  margin-top: var(--space-5);
}

.offline-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.offline-section-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.download-all-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(184,151,74,0.08);
  border: 1px solid rgba(184,151,74,0.25);
  padding: 12px 18px;
  border-radius: var(--radius-full);
  transition: all var(--dur-fast) var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}

.download-all-btn:hover {
  background: rgba(184,151,74,0.14);
  border-color: rgba(184,151,74,0.4);
}

.download-all-btn:active {
  transform: scale(0.97);
}

.download-all-btn svg {
  width: 18px;
  height: 18px;
}

.download-all-btn.complete {
  color: var(--wellness-hue);
  background: rgba(154, 184, 154, 0.08);
  border-color: rgba(154, 184, 154, 0.2);
}

.offline-caption {
  font-family: var(--font-serif);
  font-size: 0.975rem;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-top: var(--space-3);
}

/* ── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
  text-align: center;
  padding: var(--space-7) 0 var(--space-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

/* Extra padding when player is visible */
.site-footer.player-visible {
  padding-bottom: 160px;
}

.footer-rule {
  width: 32px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ink-muted), transparent);
}

.footer-text {
  font-family: var(--font-serif);
  font-size: 0.75rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.footer-link {
  color: var(--sand-dim);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}

.footer-link:hover { color: var(--sand); }

/* ── Install prompt ─────────────────────────────────────────────────────────── */
.install-prompt {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 200;
  width: calc(100% - var(--space-8));
  max-width: 400px;
  background: var(--ink-raised);
  border: 1px solid rgba(184,151,74,0.25);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur-slow) var(--ease-out);
}

.install-prompt.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.install-prompt-content {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
}

.install-prompt-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  background: rgba(184,151,74,0.1);
  border: 1px solid rgba(184,151,74,0.25);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.install-prompt-icon svg {
  width: 22px;
  height: 22px;
  color: var(--gold);
}

.install-prompt-text {
  flex: 1;
}

.install-prompt-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.install-prompt-body {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.install-prompt-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
  justify-content: flex-end;
}

.install-btn-dismiss {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  transition: color var(--dur-fast) var(--ease-out);
}

.install-btn-dismiss:hover { color: var(--text-secondary); }

.install-btn-install {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-deep);
  background: var(--gold);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  transition: background var(--dur-fast) var(--ease-out);
}

.install-btn-install:hover { background: var(--gold-bright); }

/* ── Toast notifications ─────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--space-5);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: center;
  pointer-events: none;
}

.toast {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-primary);
  background: rgba(26, 22, 16, 0.95);
  border: 1px solid var(--ink-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-5);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  white-space: nowrap;
  animation: toast-in var(--dur-base) var(--ease-out) forwards;
}

.toast.leaving {
  animation: toast-out var(--dur-base) var(--ease-in-out) forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-8px) scale(0.96); }
}

/* ── Loading state ──────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--ink-muted);
  border-top-color: var(--gold);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Intro animation ────────────────────────────────────────────────────────── */
.fade-in-up {
  opacity: 0;
  transform: translateY(16px);
  animation: fade-in-up var(--dur-slow) var(--ease-out) forwards;
}

.fade-in-up:nth-child(1) { animation-delay: 0.05s; }
.fade-in-up:nth-child(2) { animation-delay: 0.12s; }
.fade-in-up:nth-child(3) { animation-delay: 0.19s; }
.fade-in-up:nth-child(4) { animation-delay: 0.26s; }

@keyframes fade-in-up {
  to { opacity: 1; transform: translateY(0); }
}

/* Stagger track cards */
.track-card {
  opacity: 0;
  transform: translateY(12px);
  animation: fade-in-up var(--dur-slow) var(--ease-out) forwards;
}

.track-card:nth-child(1) { animation-delay: 0.3s; }
.track-card:nth-child(2) { animation-delay: 0.42s; }
.track-card:nth-child(3) { animation-delay: 0.54s; }
.track-card:nth-child(4) { animation-delay: 0.66s; }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  html               { font-size: 16px; }
  .track-card        { min-height: 100px; padding: 22px 20px; gap: 18px; }
  .track-number      { width: 50px; height: 50px; font-size: 1.1rem; }
  .track-name        { font-size: 1.25rem; }
  .track-description { -webkit-line-clamp: 2; font-size: 0.95rem; }
  .player-inner      { padding: 18px 18px 20px; }
  .ctrl-btn          { width: 52px; height: 52px; }
  .play-btn          { width: 72px; height: 72px; }
}

@media (min-width: 640px) {
  .site-header    { padding-top: var(--space-8); }
  .track-name     { font-size: 1.35rem; }
}

/* ── Focus styles for accessibility ─────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ── Skip button label ("15") ────────────────────────────────────────────────── */
.ctrl-skip {
  position: relative;
  flex-direction: column;
  gap: 0;
  width: 44px;
  height: 44px;
}

.ctrl-skip svg {
  width: 18px;
  height: 18px;
  margin-bottom: -2px;
}

.skip-label {
  font-family: var(--font-sans);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: currentColor;
}

/* ── iOS install hint ────────────────────────────────────────────────────────── */
.ios-install-hint {
  display: none;  /* shown by JS only on iOS Safari */
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 200;
  width: calc(100% - var(--space-8));
  max-width: 340px;
  opacity: 0;
  pointer-events: none;
  transition: all var(--dur-slow) var(--ease-out);
}

.ios-install-hint.visible {
  display: block;
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.ios-hint-inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(26, 22, 16, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(184,151,74,0.25);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-4);
  box-shadow: var(--shadow-lg);
}

.ios-hint-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--gold);
}

.ios-hint-text {
  flex: 1;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.ios-hint-text strong {
  font-weight: 500;
  color: var(--text-primary);
}

.ios-share-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  color: var(--gold);
}

.ios-hint-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  transition: color var(--dur-fast) var(--ease-out);
}

.ios-hint-close:hover { color: var(--text-secondary); }
.ios-hint-close svg   { width: 14px; height: 14px; }

/* Down-pointing arrow */
.ios-hint-arrow {
  width: 12px;
  height: 8px;
  margin: 0 auto;
  background: rgba(26, 22, 16, 0.97);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-left: 1px solid rgba(184,151,74,0.25);
  border-right: 1px solid rgba(184,151,74,0.25);
}

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