/*
 * THE EXPERIENCE — Cinematic Race Engine
 * Full-screen immersive canvas race with GSAP animations
 */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --gold:    #D4AF37;
  --gold-lt: #F5E49A;
  --red:     #C0392B;
  --dark:    #06080F;
  --navy:    #0A0C16;
  --text:    #F0EBE0;
  --text-dim: rgba(240,235,224,0.55);
}

/* body already has styles from base.css — just add experience overrides */
body.page-experience {
  overflow: hidden;
}

/* ── SCREENS ────────────────────────────────────── */
.screen {
  position: fixed;
  top: var(--nav-h, 60px);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

/* ── SCREEN 0: INTRO ────────────────────────────── */
#screen-intro {
  background: radial-gradient(ellipse 100% 100% at 50% 50%,
    rgba(200,169,81,0.08) 0%, transparent 60%), var(--dark);
  text-align: center;
  gap: 32px;
  padding: 40px 24px;
}

.intro-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4em;
  color: var(--red);
  text-transform: uppercase;
  border: 1px solid rgba(192,57,43,0.4);
  padding: 5px 16px;
  border-radius: 20px;
  background: rgba(192,57,43,0.08);
}

.intro-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(36px, 7vw, 88px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.02em;
}

.intro-title__line1 {
  font-style: italic;
  color: rgba(255,255,255,0.88);
  font-size: 0.58em;
  display: block;
}

.intro-title__line2 {
  color: var(--gold);
  display: block;
  filter: drop-shadow(0 0 30px rgba(212,175,55,0.4));
}

.intro-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.intro-meta__sep { opacity: 0.3; }

.intro-runners-preview {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 600px;
}

.intro-runner-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
}

.intro-runner-chip--user {
  background: rgba(212,175,55,0.12);
  border-color: rgba(212,175,55,0.4);
  color: var(--gold);
  font-weight: 700;
}

.intro-runner-chip--fox {
  background: rgba(200,100,20,0.12);
  border-color: rgba(200,120,20,0.35);
  color: #E8A050;
}

.intro-btn {
  background: var(--red);
  color: white;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 18px 52px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 6px 32px rgba(192,57,43,0.45);
  transition: transform 0.15s, box-shadow 0.2s, background 0.15s;
}
.intro-btn:hover {
  background: #D9534F;
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(192,57,43,0.6);
}

/* ── SCREEN 1: PARADE ───────────────────────────── */
#screen-parade {
  background: var(--dark);
  gap: 0;
  padding: 0;
  justify-content: flex-start;
  overflow: hidden;
}

.parade-header {
  width: 100%;
  padding: 24px 40px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(212,175,55,0.1);
  flex-shrink: 0;
  z-index: 2;
  background: rgba(6,8,15,0.8);
  backdrop-filter: blur(10px);
}

.parade-header__title {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}

.parade-header__sub {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
}

.parade-counter {
  font-family: 'Playfair Display', serif;
  font-size: 32px;
  font-weight: 900;
  color: var(--gold);
  text-align: right;
  line-height: 1;
}

.parade-counter__label {
  font-family: 'DM Sans', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* The current horse on parade */
.parade-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  overflow: hidden;
}

.parade-bg-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.parade-card {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 520px;
  padding: 0 24px;
}

.parade-silk {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  font-weight: 900;
  color: white;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.15),
              0 0 50px rgba(212,175,55,0.3),
              0 8px 32px rgba(0,0,0,0.5);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  transition: box-shadow 0.3s;
}

.parade-number {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 10px;
}

.parade-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(28px, 5vw, 56px);
  font-weight: 900;
  color: var(--text);
  line-height: 1.05;
  margin-bottom: 10px;
}

.parade-connections {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 18px;
  line-height: 1.7;
}

.parade-odds-badge {
  display: inline-block;
  background: rgba(212,175,55,0.12);
  border: 1px solid rgba(212,175,55,0.35);
  color: var(--gold);
  font-size: 18px;
  font-weight: 900;
  padding: 6px 20px;
  border-radius: var(--r-pill, 20px);
  margin-bottom: 14px;
}

.parade-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.parade-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  padding: 3px 10px;
  border-radius: 3px;
  text-transform: uppercase;
}

.parade-tag--user {
  background: rgba(212,175,55,0.2);
  border: 1px solid var(--gold);
  color: var(--gold);
}

.parade-tag--fox {
  background: rgba(200,120,20,0.2);
  border: 1px solid #E8A050;
  color: #E8A050;
}

.parade-tag--fav {
  background: rgba(76,219,120,0.1);
  border: 1px solid #4cdb78;
  color: #4cdb78;
}

.parade-tag--sr {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-dim);
}

/* Progress dots at bottom */
.parade-dots {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 3;
}

.parade-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  transition: all 0.3s;
}

.parade-dot.active {
  background: var(--gold);
  width: 20px;
  border-radius: 3px;
}

.parade-dot.done {
  background: rgba(212,175,55,0.4);
}

/* ── SCREEN 2: RACE CANVAS ──────────────────────── */
#screen-race {
  background: var(--dark);
  padding: 0;
  gap: 0;
}

#raceCanvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

/* Race commentary overlay */
.race-commentary {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 32px 28px;   /* more top padding lifts text away from bottom edge */
  background: linear-gradient(to top, rgba(6,8,15,0.98) 0%, rgba(6,8,15,0.7) 60%, transparent 100%);
  z-index: 10;
  pointer-events: none;
}

.race-commentary__text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(18px, 2.4vw, 28px);
  font-style: italic;
  font-weight: 700;
  color: #fff;
  text-align: center;
  text-shadow:
    0 0 30px rgba(212,175,55,0.35),
    0 2px 16px rgba(0,0,0,0.95);
  min-height: 1.5em;
  line-height: 1.5;
  letter-spacing: 0.02em;
}

/* Race phase subtitle */
.race-phase-title {
  position: absolute;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 10;
  pointer-events: none;
}

.race-phase-title__text {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  text-transform: uppercase;
  background: rgba(6,8,15,0.7);
  padding: 4px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* Leader board top-right */
.race-leaderboard {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 10;
  background: rgba(6,8,15,0.85);
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: 8px;
  padding: 12px 16px;
  min-width: 200px;
  backdrop-filter: blur(8px);
}

.race-leaderboard__title {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.race-lb-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 12px;
  transition: all 0.4s;
}
.race-lb-row:last-child { border-bottom: none; }

.race-lb-pos {
  width: 18px;
  font-weight: 800;
  color: var(--text-dim);
  text-align: center;
  font-size: 10px;
}
.race-lb-pos.p1 { color: var(--gold); }
.race-lb-pos.p2 { color: #C0C0C0; }
.race-lb-pos.p3 { color: #CD7F32; }

.race-lb-silk {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.2);
}

.race-lb-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
}

.race-lb-name.user-horse { color: var(--gold); font-weight: 700; }
.race-lb-name.fox-horse  { color: #E8A050; }

/* Fence marker flash */
.fence-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Playfair Display', serif;
  font-size: clamp(18px, 3vw, 32px);
  font-weight: 700;
  color: var(--gold);
  text-align: center;
  pointer-events: none;
  z-index: 20;
  opacity: 0;
  text-shadow: 0 0 30px rgba(212,175,55,0.6);
}

/* ── SCREEN 3: REVEAL ───────────────────────────── */
#screen-reveal {
  background: var(--dark);
  text-align: center;
  gap: 28px;
  padding: 40px 24px;
  overflow-y: auto;
}

.reveal-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.reveal-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 680px;
  width: 100%;
}

.reveal-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0;
}

.reveal-winner-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  text-transform: uppercase;
  opacity: 0;
}

.reveal-horse-silk {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 52px;
  font-weight: 900;
  color: white;
  text-shadow: 0 3px 12px rgba(0,0,0,0.6);
  opacity: 0;
  box-shadow:
    0 0 0 4px rgba(212,175,55,0.3),
    0 0 80px rgba(212,175,55,0.4),
    0 16px 48px rgba(0,0,0,0.6);
}

.reveal-horse-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(36px, 8vw, 80px);
  font-weight: 900;
  color: var(--text);
  line-height: 0.95;
  letter-spacing: -0.02em;
  opacity: 0;
  filter: drop-shadow(0 0 30px rgba(212,175,55,0.25));
}

.reveal-horse-odds {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  opacity: 0;
}

.reveal-verdict-box {
  background: rgba(212,175,55,0.06);
  border: 1px solid rgba(212,175,55,0.2);
  border-radius: 10px;
  padding: 24px 28px;
  max-width: 560px;
  opacity: 0;
}

.reveal-verdict-box--win {
  background: rgba(212,175,55,0.1);
  border-color: rgba(212,175,55,0.4);
  box-shadow: 0 0 40px rgba(212,175,55,0.1);
}

.reveal-verdict-box--lose {
  background: rgba(192,57,43,0.07);
  border-color: rgba(192,57,43,0.25);
}

.reveal-verdict-title {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 10px;
}

.reveal-verdict-text {
  font-size: 15px;
  color: var(--text-dim);
  line-height: 1.75;
}

/* Podium — top 3 */
.reveal-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  opacity: 0;
}

.podium-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.podium-slot__silk {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 16px;
  color: white;
  border: 2px solid rgba(255,255,255,0.2);
}

.podium-slot__name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
  max-width: 80px;
  line-height: 1.3;
}

.podium-slot__pos {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.podium-slot--1st .podium-slot__silk {
  width: 60px; height: 60px; font-size: 22px;
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(212,175,55,0.5);
}
.podium-slot--1st .podium-slot__pos { color: var(--gold); }
.podium-slot--2nd .podium-slot__pos { color: #C0C0C0; }
.podium-slot--3rd .podium-slot__pos { color: #CD7F32; }

/* Score comparison */
.reveal-scores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  opacity: 0;
}

.reveal-score-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.reveal-score-card--win {
  background: rgba(76,219,120,0.08);
  border-color: rgba(76,219,120,0.25);
}

.reveal-score-card--lose {
  background: rgba(192,57,43,0.06);
  border-color: rgba(192,57,43,0.18);
}

.reveal-score-card__who {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.reveal-score-card__pick {
  font-family: 'Playfair Display', serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
}

.reveal-score-card__result {
  font-size: 11px;
  font-weight: 600;
}

.reveal-score-card--win  .reveal-score-card__result { color: #4cdb78; }
.reveal-score-card--lose .reveal-score-card__result { color: rgba(255,100,100,0.8); }
.reveal-score-card--neutral .reveal-score-card__result { color: var(--text-dim); }

/* Action buttons */
.reveal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
}

.reveal-btn {
  padding: 13px 28px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  border: none;
  font-family: 'DM Sans', sans-serif;
  transition: all 0.2s;
}

.reveal-btn--primary {
  background: var(--gold);
  color: #060810;
  box-shadow: 0 4px 20px rgba(212,175,55,0.35);
}
.reveal-btn--primary:hover { background: var(--gold-lt); transform: translateY(-1px); }

.reveal-btn--ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text);
}
.reveal-btn--ghost:hover { background: rgba(255,255,255,0.1); }

/* ── PARTICLE CANVAS ────────────────────────────── */
#particleCanvas {
  position: fixed;
  top: var(--nav-h, 60px);
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 5;
}

/* ── LOADING BAR ────────────────────────────────── */
#loadingBar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--gold);
  transition: width 0.4s;
  z-index: 1000;
  box-shadow: 0 0 8px rgba(212,175,55,0.8);
}

/* ── CINEMATIC SUBTITLE ─────────────────────────── */
/* ── CINEMATIC SUBTITLE — BOTTOM, BOLD YELLOW ── */
#subtitle {
  position: fixed;
  top: calc(var(--nav-h, 60px) + 10px);
  bottom: auto;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 200;
  pointer-events: none;
  width: 94%;
  max-width: 1000px;
}

.subtitle__text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(26px, 3.8vw, 52px);
  font-style: italic;
  font-weight: 900;
  color: #FFD700;                       /* vivid yellow */
  background: rgba(4, 5, 12, 0.90);    /* near-black */
  border-left: 5px solid #FFD700;
  border-right: 5px solid #FFD700;
  padding: 14px 40px;
  display: inline-block;
  backdrop-filter: blur(16px);
  text-shadow:
    0 0 40px rgba(255,215,0,0.6),
    0 0 80px rgba(255,215,0,0.25),
    0 3px 16px rgba(0,0,0,0.95);
  letter-spacing: 0.03em;
  opacity: 0;
  white-space: nowrap;
  box-shadow:
    0 0 0 1px rgba(255,215,0,0.2),
    0 8px 40px rgba(0,0,0,0.7);
}

@media (max-width: 700px) {
  #subtitle { top: calc(var(--nav-h, 60px) + 8px); bottom: auto; width: 96%; }
  .subtitle__text {
    font-size: clamp(18px, 6vw, 30px);
    padding: 10px 20px;
    white-space: normal;
    border-left-width: 3px;
    border-right-width: 3px;
  }
}

/* ── RESPONSIVE ─────────────────────────────────── */
@media (max-width: 600px) {
  .parade-header { padding: 16px 20px; }
  .parade-name { font-size: 28px; }
  /* Commentary bar sits above leaderboard bottom bar (≈90px total) */
  .race-commentary {
    padding-bottom: 120px;   /* clear leaderboard bar */
    padding-top: 60px;
  }
  .race-commentary__text {
    font-size: clamp(15px, 4.5vw, 22px);
  }
  /* Mobile leaderboard — starts top-right, shifts left at 50% */
  .race-leaderboard {
    top: 16px;
    right: 8px;
    left: auto;
    min-width: 140px;
    max-width: 160px;
    padding: 8px 10px;
    transition: right 0.5s cubic-bezier(0.4,0,0.2,1),
                left  0.5s cubic-bezier(0.4,0,0.2,1);
  }
  /* Shifted left state — triggered by JS at 50% progress */
  .race-leaderboard.lb-shifted-left {
    right: auto;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
  }
  .race-lb-name { font-size: 10px; }
  .race-leaderboard__title { font-size: 7px; }
  .reveal-scores { grid-template-columns: 1fr; max-width: 280px; }
  .intro-runners-preview { display: none; }
}

/* ── REVEAL TROPHY ── */
.reveal-trophy-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.reveal-trophy-svg {
  width: clamp(120px, 18vw, 200px);
  height: auto;
  filter:
    drop-shadow(0 0 30px rgba(212,175,55,0.7))
    drop-shadow(0 0 60px rgba(212,175,55,0.4));
  animation: trophyGlow 2.5s ease-in-out infinite;
}

@keyframes trophyGlow {
  0%, 100% { filter: drop-shadow(0 0 30px rgba(212,175,55,0.7)) drop-shadow(0 0 60px rgba(212,175,55,0.4)); }
  50%       { filter: drop-shadow(0 0 55px rgba(212,175,55,1.0)) drop-shadow(0 0 100px rgba(212,175,55,0.6)); }
}

/* ── PARADE SKIP — prominent bottom CTA ── */
.parade-skip-wrap {
  position: absolute;
  bottom: 32px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 20;
  pointer-events: all;
}

.parade-skip-cta {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(192,57,43,0.18);
  border: 1px solid rgba(192,57,43,0.6);
  color: rgba(255,200,200,0.95);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 14px 40px;
  border-radius: 40px;
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow:
    0 0 0 1px rgba(192,57,43,0.2) inset,
    0 4px 24px rgba(0,0,0,0.5);
  transition: all 0.2s ease;
}

.parade-skip-cta:hover,
.parade-skip-cta:active {
  background: rgba(192,57,43,0.4);
  border-color: rgba(192,57,43,0.9);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(192,57,43,0.4);
}

.parade-skip-cta__label {
  line-height: 1;
}

.parade-skip-cta__arrow {
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s;
}

.parade-skip-cta:hover .parade-skip-cta__arrow {
  transform: translateX(4px);
}

@media (max-width: 600px) {
  .parade-skip-wrap { bottom: 56px; }
  .parade-skip-cta {
    padding: 14px 32px;
    font-size: 13px;
    width: calc(100% - 40px);
    justify-content: center;
  }
}
