:root {
  color-scheme: dark;
  --bg: #0A0B0D;
  --surface: #14161A;
  --surface-2: #1B1E23;
  --line: #262A31;
  --text: #ECEDEE;
  --muted: #8A8F98;
  --accent: #2E86FF;
  --accent-soft: rgba(46, 134, 255, 0.14);
  --red: #E10600;
  --radius: 18px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --gutter: max(20px, env(safe-area-inset-left));
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

body::before {
  /* Soft stage light from above. */
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(46, 134, 255, 0.10), transparent 60%),
    radial-gradient(80% 50% at 50% 110%, rgba(255, 255, 255, 0.03), transparent 70%);
  pointer-events: none;
}

button { font: inherit; color: inherit; }

/* ---------- Type ---------- */

.display {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-wrap: balance;
}

.display-xl { font-size: clamp(2.8rem, 12vw, 5rem); }

.eyebrow {
  margin: 0 0 14px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow-accent { color: var(--accent); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 28px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.btn:active { transform: scale(0.97); }
.btn:focus-visible, .card:focus-visible, .gift:focus-visible, .skip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.btn-primary {
  background: var(--accent);
  color: #020A1A;
  box-shadow: 0 8px 30px rgba(46, 134, 255, 0.35);
}

.btn-primary:disabled {
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: none;
  cursor: default;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-block { width: 100%; }

.skip {
  position: fixed;
  z-index: 20;
  top: max(14px, env(safe-area-inset-top));
  right: var(--gutter);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.6);
  backdrop-filter: blur(8px);
  color: var(--muted);
  font-size: 0.8rem;
  cursor: pointer;
}

/* ---------- Scenes ---------- */

.scene {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:
    max(56px, env(safe-area-inset-top))
    var(--gutter)
    max(32px, env(safe-area-inset-bottom));
  text-align: center;
  overflow-y: auto;
  overscroll-behavior: contain;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out), visibility 0s linear 0.6s;
}

.scene.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.6s var(--ease-out) 0.15s, transform 0.6s var(--ease-out) 0.15s, visibility 0s;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- 1. Gift ---------- */

.scene-gift .display { margin-bottom: 8px; }

.gift {
  position: relative;
  width: 220px;
  height: 230px;
  margin: 28px 0 18px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  perspective: 700px;
  touch-action: none; /* finger drags tilt the box instead of scrolling */
  -webkit-user-select: none;
  user-select: none;
  animation: float 3.2s ease-in-out infinite;
}

/* app.js sets --rx/--ry (tilt), --sx/--sy (sheen position) and --gx (shadow shift). */
.gift-tilt {
  position: absolute;
  inset: 0;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  scale: var(--press, 1);
  transition: scale 0.2s ease;
}

.gift.is-pressed { --press: 0.96; }

.gift-body::after,
.gift-lid::after {
  /* Light catching the wrapping paper as it tilts. */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(160px circle at var(--sx, 50%) var(--sy, 20%), rgba(255, 255, 255, 0.11), transparent 70%);
  pointer-events: none;
}

.gift-glow {
  position: absolute;
  left: calc(50% + var(--gx, 0px));
  bottom: -10px;
  width: 240px;
  height: 60px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(46, 134, 255, 0.45), transparent);
  filter: blur(8px);
  animation: glow 3.2s ease-in-out infinite;
}

.gift-body,
.gift-lid {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent calc(50% - 15px), var(--accent) calc(50% - 15px), var(--accent) calc(50% + 15px), transparent calc(50% + 15px)),
    linear-gradient(160deg, #262A31, #14161A 60%, #0F1114);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 20px 40px rgba(0, 0, 0, 0.5);
}

.gift-body {
  bottom: 0;
  width: 180px;
  height: 140px;
  transition: transform 0.6s var(--ease-out), opacity 0.6s ease;
}

.gift-lid {
  z-index: 2;
  bottom: 136px;
  width: 204px;
  height: 46px;
  transform: translateX(-50%) translateZ(16px); /* sits proud of the box, so it parallaxes */
  transition: transform 0.75s var(--ease-out), opacity 0.6s ease 0.2s;
}

.gift-bow {
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 0;
  height: 0;
}

.gift-bow i {
  position: absolute;
  bottom: -6px;
  width: 52px;
  height: 36px;
  border: 9px solid var(--accent);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.gift-bow i:first-child { right: -2px; transform: rotate(-28deg); transform-origin: right bottom; }
.gift-bow i:last-child { left: -2px; transform: rotate(28deg); transform-origin: left bottom; }

.gift-burst {
  position: absolute;
  left: 50%;
  top: 55%;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  background: radial-gradient(closest-side, #fff, rgba(150, 196, 255, 0.8) 35%, rgba(46, 134, 255, 0) 70%);
  opacity: 0;
  transform: scale(0.2);
  pointer-events: none;
}

.gift.is-open { animation: none; }
.gift.is-open .gift-lid { transform: translate(-50%, -190px) translateZ(16px) rotate(-22deg); opacity: 0; }
.gift.is-open .gift-body { transform: translateX(-50%) scale(0.9); opacity: 0; }
.gift.is-open .gift-glow { opacity: 0; transition: opacity 0.4s; }
.gift.is-open .gift-burst { animation: burst 0.9s var(--ease-out) 0.1s forwards; }

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); }
  45% { transform: translateY(-8px) rotate(-1deg); }
  55% { transform: translateY(-8px) rotate(1deg); }
}

@keyframes glow {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.6; transform: translateX(-50%) scale(0.88); }
}

@keyframes burst {
  0% { opacity: 0; transform: scale(0.2); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(7); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ---------- 2. Note ---------- */

.note {
  width: 100%;
  max-width: 520px;
  text-align: left;
}

.note .display { margin-bottom: 28px; }

.note-body p {
  margin: 0 0 18px;
  font-size: 1.1rem;
  color: #C9CCD1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.note-body p.is-in { opacity: 1; transform: none; }

#to-lights {
  margin-top: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

#to-lights.is-in { opacity: 1; pointer-events: auto; }

/* ---------- 3. Lights ---------- */

.gantry {
  display: flex;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: #0E0F12;
  box-shadow: inset 0 0 0 1px var(--line), 0 30px 60px rgba(0, 0, 0, 0.6);
  transition: transform 0.8s var(--ease-out), opacity 0.6s ease;
}

.pod {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border-radius: 10px;
  background: #050506;
}

.pod i {
  display: block;
  width: clamp(30px, 10vw, 44px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3A1212, #1A0606 70%);
  transition: background 0.08s, box-shadow 0.08s;
}

.pod.is-on i {
  background: radial-gradient(circle at 35% 30%, #FF6B5E, var(--red) 55%, #8F0400);
  box-shadow: 0 0 18px rgba(225, 6, 0, 0.85), 0 0 42px rgba(225, 6, 0, 0.45);
}

.scene-lights.is-revealed .gantry { transform: translateY(-12px) scale(0.72); opacity: 0.35; }

.reveal {
  max-width: 560px;
  margin-top: 36px;
}

.reveal > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}

.scene-lights.is-revealed .reveal > * { opacity: 1; transform: none; }
.scene-lights.is-revealed .reveal > :nth-child(2) { transition-delay: 0.25s; }
.scene-lights.is-revealed .reveal > :nth-child(3) { transition-delay: 0.6s; }
.scene-lights.is-revealed .reveal > :nth-child(4) { transition-delay: 1.1s; }

.reveal-sub {
  margin: 18px 0 30px;
  font-size: 1.2rem;
  color: #C9CCD1;
}

.reveal { pointer-events: none; }
.scene-lights.is-revealed .reveal { pointer-events: auto; }

/* ---------- 4. Choose ---------- */

.scene-choose {
  justify-content: flex-start;
  padding-bottom: 0;
}

.choose-head { margin-bottom: 20px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #A8CCFF;
  font-size: 0.85rem;
  font-weight: 500;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* Both rides side by side at every width, so it's obvious there are two to choose from. */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 720px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease, opacity 0.25s ease;
}

.card:active { transform: scale(0.98); }

.card[aria-checked='true'] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 18px 50px rgba(46, 134, 255, 0.18);
}

.cards.has-pick .card[aria-checked='false'] { opacity: 0.6; }

.card-art {
  position: relative;
  height: 96px;
  background:
    radial-gradient(70% 90% at 50% 100%, rgba(46, 134, 255, 0.12), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 22px),
    var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.card-art img {
  position: absolute;
  inset: 22px 8px 4px;
  width: calc(100% - 16px);
  height: calc(100% - 26px);
  object-fit: contain;
  object-position: bottom center;
}

.card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1.5px solid #3A3F47;
  border-radius: 50%;
  background: rgba(10, 11, 13, 0.6);
  transition: background 0.2s, border-color 0.2s;
}

.card-check svg { width: 12px; height: 12px; opacity: 0; transition: opacity 0.2s; }
.card[aria-checked='true'] .card-check { background: var(--accent); border-color: var(--accent); }
.card[aria-checked='true'] .card-check svg { opacity: 1; }

.card-body { padding: 12px 14px 14px; }

.card-eyebrow {
  margin: 0 0 4px;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 1.45rem;
  line-height: 0.95;
  text-transform: uppercase;
  text-wrap: balance;
}

.card-venue {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Details for the picked ride, under both cards. */
.ride-details {
  width: 100%;
  max-width: 720px;
  margin-top: 14px;
  text-align: left;
}

.ride-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.ride-panel {
  padding: 18px 20px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  animation: panel-in 0.45s var(--ease-out) both;
}

.ride-tagline {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text);
}

.ride-specs {
  margin: 14px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.ride-specs li {
  position: relative;
  margin: 0 0 10px;
  padding-left: 22px;
  font-size: 0.95rem;
  color: #C9CCD1;
}

.ride-specs li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 10px;
  height: 2px;
  background: var(--accent);
  transform: skewX(-20deg);
}

.ride-note {
  margin: 4px 0 10px;
  font-size: 0.85rem;
  color: var(--muted);
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.lockbar {
  position: sticky;
  bottom: 0;
  width: 100%;
  max-width: 720px;
  margin-top: auto;
  padding: 28px 0 max(20px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 60%, transparent);
}

@media (min-width: 760px) {
  .cards { gap: 16px; }
  .card-art { height: 170px; }
  .card-body { padding: 18px 20px 20px; }
  .card-eyebrow { font-size: 0.72rem; letter-spacing: 0.2em; }
  .card-title { font-size: 2rem; }
  .card-venue { font-size: 0.9rem; }
  .lockbar { max-width: 420px; }
}

/* ---------- 5. Pit pass ---------- */

.pass {
  position: relative;
  display: flex;
  width: 100%;
  max-width: 460px;
  margin: 4px 0 14px;
  border-radius: var(--radius);
  background: linear-gradient(155deg, #1E2127, #121418);
  box-shadow: inset 0 0 0 1px var(--line), 0 30px 70px rgba(0, 0, 0, 0.55);
  text-align: left;
  animation: pass-in 0.9s var(--ease-out) both;
}

.pass-check {
  flex: 0 0 16px;
  border-radius: var(--radius) 0 0 var(--radius);
  background:
    conic-gradient(#ECEDEE 25%, #0A0B0D 0 50%, #ECEDEE 0 75%, #0A0B0D 0) 0 0 / 16px 16px;
  opacity: 0.9;
}

.pass-main {
  flex: 1;
  min-width: 0;
  padding: 22px 18px 22px 20px;
}

.pass-label {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}

.pass-title {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(1.9rem, 8vw, 2.4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.pass-venue { margin: 6px 0 18px; color: var(--muted); font-size: 0.9rem; }

.pass-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 12px;
  margin: 0;
}

.pass-grid dt {
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.pass-grid dd { margin: 2px 0 0; font-weight: 600; font-size: 0.95rem; }

.pass-stub {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 54px;
  border-left: 2px dashed #2E333B;
}

.pass-stub::before,
.pass-stub::after {
  /* Perforation notches */
  content: '';
  position: absolute;
  left: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg);
}

.pass-stub::before { top: -11px; }
.pass-stub::after { bottom: -11px; }

.pass-stub span {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.pass-hint { margin: 0 0 22px; color: var(--muted); font-size: 0.85rem; }

.pass-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.save-status { min-height: 1.4em; margin: 14px 0 0; color: var(--muted); font-size: 0.8rem; }

@keyframes pass-in {
  from { opacity: 0; transform: translateY(30px) rotate(-3deg) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* ---------- 6. Finale ---------- */

.scene-finale { justify-content: center; }

.photos {
  display: flex;
  gap: 14px;
  width: calc(100% + 2 * var(--gutter));
  margin: 0 calc(-1 * var(--gutter)) 34px;
  padding: 10px var(--gutter) 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.photos:empty { display: none; }
.photos::-webkit-scrollbar { display: none; }

.photos figure {
  flex: 0 0 min(68vw, 300px);
  margin: 0;
  padding: 8px 8px 0;
  border-radius: 6px;
  background: #ECEDEE;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  scroll-snap-align: center;
}

.photos figure:nth-child(odd) { transform: rotate(-1.5deg); }
.photos figure:nth-child(even) { transform: rotate(1.5deg); }

.photos img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 2px;
}

.photos figcaption {
  padding: 8px 4px 10px;
  color: #3A3F47;
  font-size: 0.8rem;
  text-align: center;
}

@media (min-width: 760px) {
  .photos { justify-content: safe center; }
}

.finale-copy { max-width: 560px; }
.finale-from { margin: 16px 0 30px; color: var(--muted); font-size: 1.05rem; }
.finale-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- Reduced motion ---------- */

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

  .scene, .scene.is-active { transform: none; }
  .gift.is-open .gift-lid { transform: translateX(-50%); }
  .scene-lights.is-revealed .gantry { transform: none; }
  .reveal > *, .note-body p { transform: none !important; }
}
