/* getXplain.ai parent onboarding.
 *
 * The visual language comes from brand-guidelines.html §3–§5 — the cosmic
 * theme, the purple family, the orange→gold CTA.
 *
 * DARK MODE ONLY, deliberately. A soft night sky — deep navy, never pure
 * black — with gentle glows. There is no light variant and no toggle: a
 * half-supported second theme is worse than one done well.
 *
 * Contrast: --text-2 and up for body copy; purple text on these surfaces
 * is always --accent-text, never --purple (too dark on navy).
 */

:root {
  /* Night palette. Navy-charcoal ground, white-glass surfaces, one purple
   * family that leans into brand blue; orange→gold stays reserved for the
   * final CTA; emerald only ever means "done" or "safe". Channel tokens
   * (--*-rgb) exist so tints stay on-palette. */
  --bg: #0F1226;
  --bg-rgb: 15 18 38;
  --bg-top: #1B1F45;
  --bg-deep: #0A0C1C;
  --surface: #1A1E3A;
  /* Near-opaque so the starfield never shows through behind copy. */
  --surface-glass: rgb(28 31 62 / 0.95);
  --surface-hover: rgb(36 39 76 / 0.96);
  --surface-alt: rgb(255 255 255 / 0.07);
  --text-1: #F3F1FF;
  --text-2: #C5C2E0;
  --text-3: #9C98BF;
  --accent-text: #B8A8FF;
  --on-gold: #1A1530;
  --line: rgb(255 255 255 / 0.09);
  --line-soft: rgb(255 255 255 / 0.06);
  --line-strong: rgb(255 255 255 / 0.24);

  --purple: #7C5CFF;
  --purple-rgb: 124 92 255;
  --purple-lt: #A592FA;
  --purple-deep: #5B3DF0;
  --indigo: #4B5CE6;
  --blue-rgb: 59 130 246;
  --sky: #8EB8FF;
  --sky-rgb: 142 184 255;
  --lavender: #C8BEFF;
  --lavender-rgb: 200 190 255;
  --orange: #F5A623;
  --gold: #FFC94D;
  --green: #10B981;
  --green-text: #34D399;
  --amber-text: #F6D59A;

  --selected-bg: rgb(var(--purple-rgb) / 0.16);
  --progress-off: rgb(255 255 255 / 0.10);

  /* White text on --grad-brand clears 4.5:1 at every stop. */
  --grad-brand: linear-gradient(120deg, var(--purple-deep) 0%, #6A4BF7 50%, var(--indigo) 100%);
  --grad-progress: linear-gradient(90deg, var(--purple-deep), var(--purple) 55%, var(--sky));
  --grad-ink: linear-gradient(120deg, #FFFFFF 10%, #DCD3FF 55%, #AFCBFF 100%);
  --grad-tint: linear-gradient(135deg, rgb(var(--purple-rgb) / 0.16) 0%, rgb(75 92 230 / 0.12) 100%);
  --grad-selected: linear-gradient(135deg, rgb(var(--purple-rgb) / 0.26) 0%, rgb(75 92 230 / 0.16) 100%);
  /* Orange→soft gold carries a deep-ink label. White on gold fails. */
  --grad-cta: linear-gradient(135deg, #F5A623 0%, #FFBE3D 55%, #FFD36B 100%);

  /* Headings are Nunito, body is Space Grotesk — matching the live funnel
   * and brand guide §4. (The written spec had these the other way round;
   * the shipped design wins so the two funnels stay consistent.) */
  --font-display: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;

  --radius-card: 20px;
  --radius-pill: 999px;

  /* On navy, depth is a dark contact shadow plus a faint purple glow. */
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.25), 0 6px 18px rgb(0 0 0 / 0.22);
  --shadow-2: 0 2px 4px rgb(0 0 0 / 0.3), 0 12px 30px rgb(0 0 0 / 0.32), 0 0 28px rgb(var(--purple-rgb) / 0.10);
  --shadow-3: 0 4px 8px rgb(0 0 0 / 0.35), 0 18px 44px rgb(0 0 0 / 0.4), 0 0 40px rgb(var(--purple-rgb) / 0.14);

  /* One easing family for the whole flow, so every move feels related. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --bar-h: 52px;
  --cta-h: 104px;

  color-scheme: dark;
}


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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body {
  overscroll-behavior-y: none;
  overflow-x: hidden;
  min-height: 100dvh;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }

/* ── Ambient background ────────────────────────────────────────────────
 * The base of the sky — a lighter navy at the top falling to near-black at
 * the foot — and two slow nebula glows (brand guide §5). The glows are
 * soft radial gradients, not blur filters: a filter on a moving layer is
 * re-applied every frame, a gradient is painted once.
 */
.sparkle {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  background: radial-gradient(130% 80% at 50% -10%, var(--bg-top) 0%, var(--bg) 55%, var(--bg-deep) 100%);
}
.sparkle::before,
.sparkle::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.sparkle::before {
  width: 70vmax;
  height: 70vmax;
  top: -38vmax;
  left: -20vmax;
  background: radial-gradient(circle, rgb(var(--purple-rgb) / 0.08), rgb(var(--purple-rgb) / 0.03) 40%, transparent 68%);
  animation: drift-a 30s ease-in-out infinite alternate;
}
.sparkle::after {
  width: 60vmax;
  height: 60vmax;
  bottom: -34vmax;
  right: -22vmax;
  background: radial-gradient(circle, rgb(var(--blue-rgb) / 0.06), rgb(var(--sky-rgb) / 0.02) 40%, transparent 68%);
  animation: drift-b 34s ease-in-out infinite alternate;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(14vw, 10vh, 0) scale(1.12); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to   { transform: translate3d(-12vw, -8vh, 0) scale(0.95); }
}

/* ── Night sky ─────────────────────────────────────────────────────────
 * Everything floats. Each star layer and planet sways on two independent
 * axes — `translate` carries the horizontal sway, `transform` the
 * vertical — with periods that never line up. The two combine into a
 * path that keeps turning, never stops dead and never quite repeats: slow
 * floating, with no shared direction. Amplitude (--ax/--ay) and period
 * (--px/--py) are per element; negative delays desynchronise the start.
 *
 * Barely there on purpose: an ambient layer, felt more than seen.
 *
 * Smoothness rules: only transform, translate, scale and opacity animate
 * (compositor-only — no layout, no paint per frame). No filters or
 * backdrop blur anywhere a moving layer sits behind them.
 */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: strict;
}
.float {
  animation:
    float-x var(--px) ease-in-out var(--pxd, 0s) infinite alternate,
    float-y var(--py) ease-in-out var(--pyd, 0s) infinite alternate;
  will-change: transform;
}
@keyframes float-x {
  from { translate: calc(-1 * var(--ax)) 0; }
  to   { translate: var(--ax) 0; }
}
@keyframes float-y {
  from { transform: translate3d(0, calc(-1 * var(--ay)), 0); }
  to   { transform: translate3d(0, var(--ay), 0); }
}
/* Bleeds past every edge by more than the sway, so no edge ever shows. */
.stars {
  position: absolute;
  inset: -90px;
}
.stars.s1 {
  background-image:
    radial-gradient(1.2px 1.2px at 82px 38px, rgb(255 255 255 / 0.51) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 12px 18px, rgb(255 255 255 / 0.64) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 24px 93px, rgb(255 255 255 / 0.57) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 129px 54px, rgb(255 255 255 / 0.4) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 111px 107px, rgb(255 255 255 / 0.41) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 23px 141px, rgb(255 255 255 / 0.52) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 144px 31px, rgb(255 255 255 / 0.68) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 161px 160px, rgb(255 255 255 / 0.57) 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 15px 147px, rgb(255 255 255 / 0.57) 50%, transparent 100%);
  background-size: 170px 170px;
  --ax: 40px; --ay: 30px; --px: 61s; --py: 43s; --pxd: -20s;
  --lo: 0.1; --hi: 0.26;
  animation: float-x var(--px) ease-in-out var(--pxd) infinite alternate,
             float-y var(--py) ease-in-out infinite alternate,
             breathe 7s ease-in-out infinite alternate;
}
.stars.s2 {
  background-image:
    radial-gradient(1.8px 1.8px at 25px 113px, rgb(255 255 255 / 0.46) 50%, transparent 100%),
    radial-gradient(1.8px 1.8px at 68px 148px, rgb(255 255 255 / 0.59) 50%, transparent 100%),
    radial-gradient(1.8px 1.8px at 60px 157px, rgb(255 255 255 / 0.64) 50%, transparent 100%),
    radial-gradient(1.8px 1.8px at 92px 52px, rgb(255 255 255 / 0.65) 50%, transparent 100%),
    radial-gradient(1.8px 1.8px at 96px 190px, rgb(255 255 255 / 0.48) 50%, transparent 100%),
    radial-gradient(1.8px 1.8px at 32px 30px, rgb(255 255 255 / 0.66) 50%, transparent 100%);
  background-size: 260px 260px;
  --ax: 55px; --ay: 48px; --px: 47s; --py: 71s; --pyd: -30s;
  --lo: 0.08; --hi: 0.24;
  animation: float-x var(--px) ease-in-out infinite alternate-reverse,
             float-y var(--py) ease-in-out var(--pyd) infinite alternate,
             breathe 11s ease-in-out -4s infinite alternate;
}
.stars.s3 {
  background-image:
    radial-gradient(2.4px 2.4px at 254px 348px, rgb(255 255 255 / 0.75) 50%, transparent 100%),
    radial-gradient(2.4px 2.4px at 397px 160px, rgb(255 255 255 / 0.72) 50%, transparent 100%),
    radial-gradient(2.4px 2.4px at 232px 185px, rgb(255 255 255 / 0.65) 50%, transparent 100%),
    radial-gradient(2.4px 2.4px at 406px 92px, rgb(255 255 255 / 0.82) 50%, transparent 100%);
  background-size: 410px 410px;
  --ax: 70px; --ay: 56px; --px: 53s; --py: 39s; --pxd: -11s;
  --lo: 0.08; --hi: 0.28;
  animation: float-x var(--px) ease-in-out var(--pxd) infinite alternate,
             float-y var(--py) ease-in-out infinite alternate-reverse,
             breathe 15s ease-in-out -8s infinite alternate;
}
@keyframes breathe { from { opacity: var(--lo); } to { opacity: var(--hi); } }
.stars { will-change: transform; }

.twinkle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  background: #FFF6DA;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  --ax: 10px; --ay: 8px; --px: 23s; --py: 31s;
  animation:
    float-x var(--px) ease-in-out var(--d) infinite alternate,
    float-y var(--py) ease-in-out infinite alternate,
    twinkle 5.5s ease-in-out var(--d) infinite;
  will-change: transform;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.03; scale: 0.55; }
  50%      { opacity: 0.28; scale: 1; }
}

.world {
  position: absolute;
  width: var(--s);
  height: var(--s);
  opacity: 0.24;
  transition: opacity 1200ms ease;
}
.world::before {
  content: '';
  position: absolute;
  inset: -10%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 62%);
  opacity: 0.25;
  transition: opacity 1200ms ease;
}
.world svg { position: relative; display: block; width: 100%; height: 100%; overflow: visible; }
/* A world the parent chose glows a little brighter. */
.world.picked { opacity: 0.42; }
.world.picked::before { opacity: 0.5; }

.w-space   { --s: 76px; top: 1%;  right: -26px; --glow: rgb(124 92 255 / 0.55); --ax: 26px; --ay: 34px; --px: 57s; --py: 41s; --pyd: -17s; }
.w-earth   { --s: 54px; top: 47%; left: max(-22px, calc(50% - 400px)); --glow: rgb(47 111 224 / 0.55); --ax: 34px; --ay: 42px; --px: 44s; --py: 63s; --pxd: -25s; }
.w-animals { --s: 42px; top: 70%; right: max(-16px, calc(50% - 380px)); --glow: rgb(232 144 46 / 0.45); --ax: 30px; --ay: 26px; --px: 51s; --py: 37s; --pxd: -9s; --pyd: -30s; }
.w-coding  { --s: 22px; top: 31%; right: max(8px, calc(50% - 340px)); --glow: rgb(19 154 154 / 0.6); --ax: 22px; --ay: 30px; --px: 33s; --py: 47s; --pyd: -12s; }
.w-art     { --s: 32px; top: 88%; left: max(10%, calc(50% - 360px)); --glow: rgb(194 64 143 / 0.5); --ax: 36px; --ay: 22px; --px: 39s; --py: 55s; --pxd: -21s; }

@media (min-width: 700px) {
  .w-space { --s: 92px; top: 7%; right: calc(50% - 420px); }
}

/* ── Living sky (initLivingSky) ── */
/* A shooting star: a tail fading back from a bright head, flying along
 * its own angle. Only transform and opacity move. */
.meteor {
  position: absolute;
  width: var(--len);
  height: 1.6px;
  margin-left: calc(-1 * var(--len));
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgb(200 190 255 / 0.35) 55%, rgb(255 255 255 / 0.95));
  transform-origin: 100% 50%;
  opacity: 0;
  animation: meteor var(--dur) cubic-bezier(0.25, 0.6, 0.45, 1) forwards;
}
.meteor::after {
  content: '';
  position: absolute;
  right: -2px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 8px 2px rgb(255 246 218 / 0.9), 0 0 18px 6px rgb(var(--purple-rgb) / 0.45);
}
@keyframes meteor {
  0%   { opacity: 0; transform: rotate(var(--rot)) translateX(0) scaleX(0.3); }
  12%  { opacity: 0.9; }
  70%  { opacity: 0.75; transform: rotate(var(--rot)) translateX(calc(var(--dist) * 0.8)) scaleX(1); }
  100% { opacity: 0; transform: rotate(var(--rot)) translateX(var(--dist)) scaleX(0.6); }
}

/* Constellations drawn by tapping empty sky. */
.constellations { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.constellation { transition: opacity 1.4s ease; }
.constellation.fading { opacity: 0; }
.constellation line {
  stroke: rgb(200 190 255 / 0.5);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: c-draw 520ms var(--ease-out) forwards;
  transition: stroke 500ms ease, stroke-width 500ms ease;
}
@keyframes c-draw { to { stroke-dashoffset: 0; } }
.c-star path {
  fill: #FFF6DA;
  transform-box: fill-box;
  transform-origin: center;
  animation: c-pop 620ms var(--ease-spring) both, c-twinkle 2.6s ease-in-out 620ms infinite;
}
.c-glow { fill: rgb(255 246 218 / 0.16); transform-box: fill-box; transform-origin: center; animation: c-pop 620ms var(--ease-out) both; }
.c-ring {
  fill: none;
  stroke: rgb(255 246 218 / 0.7);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: c-ring 700ms ease-out forwards;
}
@keyframes c-pop {
  from { transform: scale(0) rotate(-45deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes c-twinkle {
  0%, 100% { transform: none; }
  50%      { transform: scale(0.72) rotate(45deg); }
}
@keyframes c-ring {
  from { transform: scale(0.3); opacity: 1; }
  to   { transform: scale(1.6); opacity: 0; }
}
/* Complete: the lines turn gold and every star flares once. */
.constellation.lit line { stroke: var(--gold); stroke-width: 1.8; }
.constellation.lit .c-glow { fill: rgb(255 201 77 / 0.35); animation: c-flare 1100ms ease-out both; }
.constellation.lit path { fill: #FFE7A3; }
@keyframes c-flare {
  0%   { transform: scale(1); opacity: 1; }
  35%  { transform: scale(2.2); opacity: 0.9; }
  100% { transform: scale(0.8); opacity: 0.25; }
}

/* Small, faded planets floating in the sky, built by JS (see buildDrifters).
 * Each carries its position, size, colour, sway and start offset as
 * custom properties. Smaller means farther: fainter, with a smaller,
 * slower sway. Shading is a single painted-once gradient. */
.drifter {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  opacity: var(--a);
  background: radial-gradient(circle at 34% 30%, var(--hl), var(--c) 55%, #0B0D22 100%);
}
.drifter.ringed::after {
  content: '';
  position: absolute;
  inset: 38% -48%;
  border: 1.5px solid var(--ring);
  border-radius: 50%;
  transform: rotate(-18deg);
}

/* ── Progress bar ──────────────────────────────────────────────────── */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar-h);
  padding: 0 20px;
  background: rgb(var(--bg-rgb) / 0.9);
  animation: fade-down 360ms var(--ease-out) both;
}
.bar[hidden] { display: none; }

.back {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 160ms ease, transform 200ms var(--ease-out);
}
.back:hover { background: var(--surface-alt); transform: translateX(calc(-2px * var(--dx, 1))); }
.back:active { transform: scale(0.9); }
.back:focus-visible { outline: 3px solid var(--purple-lt); outline-offset: 2px; }
.back svg { width: 18px; height: 18px; }

.track {
  --w: 0%;
  --n: 0;
  position: relative;
  flex: 1;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--progress-off);
}
/* A small gold star rides the tip of the fill — the explorer's marker.
 * It turns a quarter with every step, so moving forward feels earned. */
.track::after {
  content: '';
  position: absolute;
  top: 50%;
  inset-inline-start: var(--w);
  width: 16px;
  height: 16px;
  background: var(--gold);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  filter: drop-shadow(0 1px 2px rgb(245 166 35 / 0.6));
  transform: translate(-50%, -50%) rotate(calc(var(--n) * 90deg));
  transition: left 520ms var(--ease-out), transform 620ms var(--ease-spring);
}
.fill {
  position: relative;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: var(--grad-progress);
  box-shadow: 0 0 12px rgb(var(--purple-rgb) / 0.45);
  transition: width 520ms var(--ease-out);
  overflow: hidden;
}
/* A single highlight runs along the filled part when the bar first
 * appears — a greeting, not a loop. */
.fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: translateX(-100%);
  animation: sheen 1.6s ease-in-out 600ms 1 both;
}
.count {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-width: 38px;
  text-align: end;
}
/* Sound toggle: the speaker shows sound on, the crossed speaker off. */
.sound {
  flex: none;
  width: 32px;
  height: 32px;
  margin-inline-end: -6px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease;
}
.sound:hover { background: var(--surface-alt); color: var(--text-1); }
.sound:focus-visible { outline: 3px solid var(--purple-lt); outline-offset: 2px; }
.sound svg { width: 18px; height: 18px; }
.sound .off, .sound.muted .on { display: none; }
.sound.muted .off { display: block; }

/* ── Screen shell and transitions ──────────────────────────────────────
 * The screen slides in the direction of travel (set on #app by the
 * router), then its children follow in a short stagger. Exits are quicker
 * than entrances — leaving should never feel like waiting.
 *
 * #app clips sideways overflow: a screen sliding in sits 28px off the
 * right edge for a moment, and mobile browsers widen the page to fit it
 * (overflow-x on body does not stop them). `clip`, unlike `hidden`, makes
 * no scroll container; `hidden` is the fallback for older Safari.
 */
#app { overflow-x: hidden; overflow-x: clip; }
.screen {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 20px var(--cta-h);
  animation: screen-in-fwd 460ms var(--ease-out) both;
}
.screen.no-cta { padding-bottom: 28px; }
[data-dir='back'] .screen { animation-name: screen-in-back; }

.is-leaving { pointer-events: none; }
.is-leaving .screen { animation: screen-out-fwd 180ms ease-in both; }
.is-leaving[data-dir='back'] .screen { animation-name: screen-out-back; }
.is-leaving .cta-wrap .cta-inner { animation: fade-out 160ms ease-in both; }

@keyframes screen-in-fwd {
  from { opacity: 0; transform: translate3d(calc(28px * var(--dx, 1)), 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-in-back {
  from { opacity: 0; transform: translate3d(calc(-28px * var(--dx, 1)), 0, 0); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-out-fwd {
  to { opacity: 0; transform: translate3d(calc(-20px * var(--dx, 1)), 0, 0) scale(0.99); }
}
@keyframes screen-out-back {
  to { opacity: 0; transform: translate3d(calc(20px * var(--dx, 1)), 0, 0) scale(0.99); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheen {
  0%   { transform: translateX(-100%); }
  60%, 100% { transform: translateX(100%); }
}

/* Children of a screen arrive one after another. The result screen runs
 * its own choreography further down. */
.screen:not(.result) > * { animation: rise 520ms var(--ease-out) both; }
.screen:not(.result) > :nth-child(1) { animation-delay: 60ms; }
.screen:not(.result) > :nth-child(2) { animation-delay: 120ms; }
.screen:not(.result) > :nth-child(3) { animation-delay: 180ms; }
.screen:not(.result) > :nth-child(4) { animation-delay: 240ms; }
.screen:not(.result) > :nth-child(5) { animation-delay: 300ms; }
.screen:not(.result) > :nth-child(n+6) { animation-delay: 360ms; }

.q-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--grad-tint), var(--surface-glass);
  border: 1px solid var(--line-soft);
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
/* The glyph repeats the shape used on the rows below, so the pill and the
 * indicators teach each other. */
.q-kind .glyph { flex: none; width: 11px; height: 11px; border: 2px solid currentColor; }
.q-kind .glyph.ci { border-radius: 50%; }
.q-kind .glyph.sq { border-radius: 3px; }

.q-title { font-size: 26px; line-height: 1.18; letter-spacing: -0.015em; }
.q-sub {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-2);
}
.autonomy {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-3);
}

/* ── Option cards ──────────────────────────────────────────────────── */
.options {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 18px;
}
.options.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
/* The group itself is already staggered in as a screen child; its cards
 * cascade on top. `.settled` is set from the second paint on, so picking
 * an answer does not replay the entrance. */
.screen:not(.result) > .options { animation: none; }
.options:not(.settled) .opt {
  animation: rise 480ms var(--ease-out) both;
  animation-delay: calc(200ms + var(--i, 0) * 45ms);
}

.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 56px;
  padding: 11px 14px;
  text-align: start;
  background: var(--surface-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: border-color 200ms ease, background-color 200ms ease,
              box-shadow 260ms var(--ease-out), transform 260ms var(--ease-out);
}
@media (hover: hover) {
  .opt:hover {
    border-color: rgb(var(--purple-rgb) / 0.55);
    background: var(--surface-hover);
    box-shadow: var(--shadow-2);
    transform: translateY(-2px);
  }
  .opt:hover .emoji { transform: scale(1.12) rotate(-6deg); }
}
.opt:focus-visible { outline: 3px solid var(--purple-lt); outline-offset: 2px; }
.opt:active { transform: scale(0.97); transition-duration: 90ms; }

.opt[aria-checked='true'] {
  border-color: var(--purple);
  background: var(--grad-selected), var(--surface-glass);
  box-shadow: 0 0 0 3px rgb(var(--purple-rgb) / 0.22), 0 0 24px rgb(var(--purple-rgb) / 0.22), var(--shadow-1);
}

/* The card just tapped: a small spring, and a ripple from its centre. */
.opt.just { animation: pick 420ms var(--ease-spring) both; }
.opt.just::after {
  content: '';
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: rgb(var(--purple-rgb) / 0.30);
  animation: ripple 620ms var(--ease-out) both;
  pointer-events: none;
}
.opt.just[aria-checked='true'] .tick { animation: tick-pop 420ms var(--ease-spring) both; }
.opt.just[aria-checked='true'] .emoji { animation: emoji-bounce 520ms var(--ease-spring) both; }

@keyframes pick {
  0%   { transform: scale(0.97); }
  55%  { transform: scale(1.025); }
  100% { transform: scale(1); }
}
@keyframes ripple {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(14); opacity: 0; }
}
@keyframes tick-pop {
  0%   { transform: scale(0.4); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}
@keyframes emoji-bounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}

.opt .emoji {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 18px;
  border-radius: 50%;
  background: var(--surface-alt);
  transition: background-color 200ms ease, transform 300ms var(--ease-spring);
}
.opt[aria-checked='true'] .emoji { background: rgb(var(--purple-rgb) / 0.35); }

.opt .label {
  flex: 1;
  font-size: 14.5px;
  line-height: 1.3;
  color: var(--text-2);
  transition: color 200ms ease;
}
.opt[aria-checked='true'] .label { color: var(--text-1); font-weight: 600; }

.opt .tick {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.opt[aria-checked='true'] .tick { border-color: var(--purple); background: var(--purple); }
.opt .tick svg { width: 11px; height: 11px; color: #fff; opacity: 0; transition: opacity 160ms ease; }
.opt[aria-checked='true'] .tick svg { opacity: 1; }

/* Single-select is a radio: round, and checked shows a filled dot rather
 * than a tick. A tick reads as "done"; a dot reads as "this one, of
 * several" — which is what stops a parent expecting to pick a second. */
.options.single .opt .tick { border-radius: 50%; }
.options.single .opt .tick svg { display: none; }
.options.single .opt[aria-checked='true'] .tick { background: transparent; border-color: var(--purple-lt); }
.options.single .opt[aria-checked='true'] .tick::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--purple-lt);
}

/* Multi-select is a checkbox: square, ticked when taken. */
.options.multi .opt .tick { border-radius: 6px; }

/* The interest grid is 9 options; it only fits a small viewport as a
 * two-column grid with the tick dropped. */
.options.grid .opt { min-height: 50px; padding-block: 8px; padding-inline: 10px 22px; gap: 8px; }
.options.grid .opt .tick {
  position: absolute;
  top: 7px;
  inset-inline-end: 7px;
  width: 15px;
  height: 15px;
  border-radius: 5px;
}
.options.grid .opt .tick svg { width: 9px; height: 9px; }
.options.grid .opt .emoji { width: 28px; height: 28px; font-size: 15px; }
.options.grid .opt .label { font-size: 13px; }

/* "Not sure — surprise them!": the way out for a parent who is stuck, so
 * it spans the grid and carries the gold accent. */
.options.grid .opt.standout {
  grid-column: 1 / -1;
  justify-content: center;
  border-color: rgb(255 201 77 / 0.55);
  background: linear-gradient(135deg, rgb(255 201 77 / 0.16), rgb(var(--purple-rgb) / 0.14)), var(--surface-glass);
}
.options.grid .opt.standout .label { flex: none; font-size: 14px; font-weight: 700; color: var(--gold); }
.options.grid .opt.standout .emoji { background: rgb(255 201 77 / 0.22); }
.options.grid .opt.standout[aria-checked='true'] {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgb(255 201 77 / 0.25), 0 0 24px rgb(255 201 77 / 0.22), var(--shadow-1);
}
.options.grid .opt.standout[aria-checked='true'] .tick { border-color: var(--gold); background: var(--gold); }
.options.grid .opt.standout .tick svg { color: var(--on-gold); }

/* ── Sticky CTA ────────────────────────────────────────────────────── */
.cta-wrap {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 30;
  padding: 12px 20px max(16px, env(safe-area-inset-bottom));
  background: rgb(var(--bg-rgb) / 0.92);
  border-top: 1px solid var(--line-soft);
  box-shadow: 0 -10px 30px rgb(0 0 0 / 0.28);
}
.cta-inner { max-width: 560px; margin: 0 auto; animation: rise 420ms var(--ease-out) 120ms both; }

.cta {
  position: relative;
  display: block;
  width: 100%;
  padding: 15px 20px;
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.005em;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  background-image: var(--grad-cta);
  color: var(--on-gold);
  box-shadow: 0 12px 28px rgba(245, 166, 35, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: opacity 200ms ease, transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
/* One light sweep across the final button as it arrives — it draws the
 * eye once, then leaves the button alone. Purple buttons get none. */
.cta::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  transform: translateX(-100%);
  animation: sheen 1.6s ease-in-out 900ms 1 both;
}
.cta.quiet::after { display: none; }
@media (hover: hover) {
  .cta:not([disabled]):hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(245, 166, 35, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  }
  .cta.quiet:not([disabled]):hover { box-shadow: 0 14px 30px rgb(var(--purple-rgb) / 0.38); }
}
.cta:active { transform: translateY(1px) scale(0.985); transition-duration: 90ms; }
.cta:focus-visible { outline: 3px solid var(--lavender); outline-offset: 3px; }
.cta[disabled] { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.cta[disabled]::after { display: none; }

/* Auto-continue (break screens): a lighter band fills the button from its
 * start edge as the countdown runs, and the seconds left sit at its end. */
.cta.auto::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  background: rgb(255 255 255 / 0.2);
  transform: scaleX(var(--auto, 0));
  transform-origin: left center;
}
[dir='rtl'] .cta.auto::before { transform-origin: right center; }
.cta .auto-n {
  position: absolute;
  inset-inline-end: 18px;
  top: 50%;
  translate: 0 -50%;
  min-width: 1.6em;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}
.cta .auto-n:empty { display: none; }

/* Secondary action — never orange. Orange is spent once, on the final CTA. */
.cta.quiet {
  background-image: var(--grad-brand);
  color: #fff;
  box-shadow: 0 10px 26px rgb(var(--purple-rgb) / 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* The final, orange CTA breathes, slowly — it is the one button that
 * matters, and a slow pulse reads as calm rather than urgent. */
.cta:not(.quiet):not([disabled]) { animation: glow 4.2s ease-in-out 2.4s infinite; }
@keyframes glow {
  0%, 100% { box-shadow: 0 12px 28px rgba(245, 166, 35, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
  50%      { box-shadow: 0 14px 40px rgba(245, 166, 35, 0.62), 0 0 0 6px rgba(255, 215, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
}

.cta-hint {
  margin-top: 9px;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-3);
}

.skip {
  display: block;
  margin: 12px auto 0;
  padding: 6px 12px;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--text-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 160ms ease;
}
.skip:hover { color: var(--text-2); }

/* ── Free trial reassurance ────────────────────────────────────────────
 * Sits last, directly above the button — the final thing read before the
 * tap. Deliberately calm: a quiet emerald tint, not the amber of the
 * countdown. This block answers "what will you charge me", and a panel
 * that shouts undermines the reassurance it is making.
 */
.trial-card {
  margin-top: 18px;
  padding: 18px 20px;
  background: linear-gradient(160deg, rgb(16 185 129 / 0.10) 0%, rgb(16 185 129 / 0.04) 100%), var(--surface-glass);
  border: 1px solid rgb(16 185 129 / 0.32);
  border-radius: var(--radius-card);
  box-shadow: 0 0 24px rgb(16 185 129 / 0.08);
}
.trial-card h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 16.5px;
  line-height: 1.3;
}
.trial-tick {
  flex: none;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgb(16 185 129 / 0.18);
  color: var(--green-text);
  font-size: 12px;
  font-weight: 700;
}
.trial-rows { margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.trial-rows > div { display: grid; grid-template-columns: 68px 1fr; gap: 12px; align-items: baseline; }
.trial-rows dt {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--green-text);
}
.trial-rows dd { margin: 0; font-size: 14px; line-height: 1.45; color: var(--text-2); }

/* ── Time-limited offer ────────────────────────────────────────────────
 * Amber, not the orange→gold gradient. Spec §6 spends solid orange once,
 * on the final CTA; a countdown wearing the same colour would blunt the
 * one button that matters.
 *
 * Digits are tabular so the clock does not jitter as it counts.
 */
.offer-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: rgb(245 166 35 / 0.12);
  border: 1px solid rgb(245 166 35 / 0.34);
  font-size: 12.5px;
  color: var(--amber-text);
}
/* A live dot, so the strip reads as "running" at a glance. */
.offer-strip::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  animation: beat 1.4s ease-in-out infinite;
}
@keyframes beat {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.55); }
  50%      { box-shadow: 0 0 0 5px rgba(245, 166, 35, 0); }
}
.offer-label { font-weight: 500; }
.offer-clock {
  font-family: var(--font-display);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: var(--gold);
}

.offer-card {
  margin-top: 18px;
  padding: 20px;
  text-align: center;
  border-radius: var(--radius-card);
  background: linear-gradient(160deg, rgb(245 166 35 / 0.12) 0%, rgb(245 166 35 / 0.05) 100%), var(--surface-glass);
  border: 1px solid rgb(245 166 35 / 0.34);
  box-shadow: 0 0 28px rgb(245 166 35 / 0.10);
}
.offer-card h3 { font-size: 17px; line-height: 1.3; color: #FFE6B3; }
.offer-detail { margin-top: 9px; font-size: 14px; line-height: 1.55; color: var(--text-2); }
.offer-big {
  margin-top: 13px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  text-shadow: 0 0 18px rgb(255 201 77 / 0.35);
}

/* The sticky bar grows by the height of the strip, so nothing at the foot
 * of a screen ends up underneath it. */
.has-offer .screen { padding-bottom: calc(var(--cta-h) + 44px); }
.has-offer .screen.no-cta { padding-bottom: 28px; }

/* ── S0 hook ───────────────────────────────────────────────────────── */
.hook {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 22px calc(var(--cta-h) + 12px);
}
/* Language choice, first thing on the first screen: a two-option pill.
 * Each label is set in its own language and script. */
.lang {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 26px;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  border: 1px solid var(--line);
}
.lang button {
  min-width: 92px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
.lang button:hover { color: var(--text-1); }
.lang button:focus-visible { outline: 3px solid var(--purple-lt); outline-offset: 2px; }
.lang button[aria-pressed='true'] {
  background-image: var(--grad-brand);
  color: #fff;
  box-shadow: 0 6px 18px rgb(var(--purple-rgb) / 0.35);
}
.lang button[lang='ar'] { font-family: 'Tajawal', var(--font-body); font-size: 15px; }

/* The icon floats on a soft halo. The halo is the wrapper's pseudo
 * element; the <img> itself stays untouched. */
.hook .badge {
  position: relative;
  display: grid;
  place-items: center;
  animation: float 5s ease-in-out 700ms infinite;
}
.hook .badge::before {
  content: '';
  position: absolute;
  inset: -22%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--purple-rgb) / 0.30), rgb(var(--lavender-rgb) / 0.14) 45%, transparent 70%);
  animation: halo 5s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0); }
  50%      { transform: translateY(-8px) rotate(-1.5deg); }
}
@keyframes halo {
  0%, 100% { transform: scale(0.94); opacity: 0.8; }
  50%      { transform: scale(1.06); opacity: 1; }
}
/* The app icon is a filled tile, not a floating character — it carries
 * more visual weight per pixel, so it sits smaller than the mascot did.
 * Intrinsic dimensions live on the <img> so the box is reserved before it
 * loads and the hook never shifts. Corners and shadow are baked into the
 * artwork; do not add radius or box-shadow here. */
.hook .mascot { width: 112px; height: auto; }
.screen.hook > .badge { animation: pop-in 640ms var(--ease-spring) both, float 5s ease-in-out 700ms infinite; }
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.6) translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.hook h1 {
  margin-top: 22px;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  /* White easing into lavender and starlight blue. Every stop clears AA
   * on the navy ground. */
  background: var(--grad-ink);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* A gold, hand-drawn underline that draws itself under the last words —
 * the one handwritten touch on the page; the stroke sits beneath them.
 * The words carry their own copy of the headline's gradient, from where
 * it ends: Safari leaves a positioned span out of its parent's
 * background-clip: text, and on iPhone they rendered invisible. */
.hook h1 .swoosh {
  position: relative;
  white-space: nowrap;
  background: linear-gradient(120deg, #DCD3FF 0%, #AFCBFF 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hook h1 .swoosh::after {
  content: '';
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -0.12em;
  height: 0.32em;
  z-index: -1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M3 14C40 6 90 4 197 9' fill='none' stroke='%23FFC94D' stroke-width='6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  clip-path: inset(0 100% 0 0);
  animation: underline 800ms var(--ease-out) 900ms both;
}
@keyframes underline { to { clip-path: inset(0 0 0 0); } }
.hook .sub { margin-top: 14px; font-size: 16px; line-height: 1.5; color: var(--text-2); max-width: 22em; }
.hook .prompt { margin-top: 18px; font-size: 14.5px; color: var(--text-2); }
.trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
  color: var(--text-2);
}
.trust li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  border: 1px solid var(--line-soft);
}
.trust li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

/* ── Interstitials ─────────────────────────────────────────────────── */
.inter {
  min-height: calc(100dvh - var(--bar-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.inter .lead {
  position: relative;
  padding-inline-start: 18px;
  font-size: 21px;
  line-height: 1.38;
  font-family: var(--font-display);
  font-weight: 700;
}
/* A gradient rule that draws itself down beside the line. */
.inter .lead::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--purple), var(--sky));
  transform-origin: top;
  animation: draw-down 700ms var(--ease-out) 300ms both;
}
@keyframes draw-down { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Writing in: words rise and settle one after another, ~55ms apart,
 * starting as the rule finishes drawing. A caret follows the last word,
 * blinks a few times, then fades away. */
.writing .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.35em);
  animation: word-in 460ms var(--ease-out) calc(var(--start, 450ms) + var(--w) * var(--step, 55ms)) both;
}
@keyframes word-in {
  from { opacity: 0; transform: translateY(0.35em); }
  to   { opacity: 1; transform: none; }
}
.writing::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-inline-start: 4px;
  vertical-align: -0.12em;
  border-radius: 2px;
  background: var(--sky);
  opacity: 0;
  animation: caret 2.4s steps(1, end) calc(var(--start, 450ms) + var(--n) * var(--step, 55ms)) 1 forwards;
}
.writing.no-caret::after { display: none;
}
@keyframes caret {
  0%, 25%, 50%, 75% { opacity: 1; }
  12.5%, 37.5%, 62.5%, 100% { opacity: 0; }
}

.mirror-card {
  position: relative;
  padding: 22px 20px;
  background: var(--surface-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.mirror-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--grad-progress);
}
.mirror-card .line { font-size: 18px; line-height: 1.45; color: var(--text-1); }
.mirror-card .line + .line { margin-top: 8px; }
.mirror-card strong {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--accent-text);
  font-variant-numeric: tabular-nums;
}
.mirror-card .maths {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* Beat two lands a beat after beat one — the release must arrive while
 * the number is still on screen, never on a later tap. It writes itself
 * in from 1.3s (see writtenSequence in renderMirror), once the count-up
 * has landed. */
.release { margin-top: 20px; }
.screen:not(.result) > .release { animation: none; }
.release h2 { font-size: 19px; line-height: 1.35; color: var(--accent-text); }
.release p { margin-top: 12px; font-size: 14.5px; line-height: 1.6; color: var(--text-2); }

/* ── S9 calculation ────────────────────────────────────────────────── */
.calc {
  min-height: calc(100dvh - var(--bar-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.ring { position: relative; width: 136px; height: 136px; }
/* The mascot beside the ring: it pops up, bobs while thinking (with a
 * three-dot thought bubble), then hops when it switches to celebrating.
 * It sits in the empty space to the ring's side, clear of the stages. */
.calc-buddy {
  position: absolute;
  bottom: -10px;
  inset-inline-end: -84px;
  width: 78px;
  animation: buddy-in 640ms var(--ease-spring) 250ms both;
}
.calc-buddy img {
  display: block;
  width: 100%;
  height: auto;
  animation: explorer-bob 2.6s ease-in-out 900ms infinite alternate;
}
.calc-buddy.cheer img { animation: buddy-hop 700ms var(--ease-spring) 1 both; }
.calc-think {
  position: absolute;
  top: -6px;
  inset-inline-start: 50%;
  display: flex;
  gap: 4px;
  padding: 6px 9px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid rgb(var(--purple-rgb) / 0.35);
  transition: opacity 250ms ease, scale 250ms ease;
}
.calc-think i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lavender);
  animation: think 1.2s ease-in-out infinite;
}
.calc-think i:nth-child(2) { animation-delay: 0.15s; }
.calc-think i:nth-child(3) { animation-delay: 0.3s; }
.calc-buddy.cheer .calc-think { opacity: 0; scale: 0.6; }
@keyframes buddy-in {
  from { opacity: 0; transform: translateY(18px) scale(0.7); }
  to   { opacity: 1; transform: none; }
}
@keyframes buddy-hop {
  0%   { transform: none; }
  40%  { transform: translateY(-14px) rotate(-6deg) scale(1.08); }
  100% { transform: none; }
}
@keyframes think {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%      { opacity: 1; transform: translateY(-2px); }
}
/* A soft glow that breathes behind the ring while the plan builds. */
.ring::before {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(var(--purple-rgb) / 0.30), transparent 68%);
  animation: halo 2.4s ease-in-out infinite;
}
.ring svg { position: relative; width: 136px; height: 136px; transform: rotate(-90deg); filter: drop-shadow(0 4px 12px rgb(var(--purple-rgb) / 0.28)); }
.ring .pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.stages { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 330px; }
.stage {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.35;
  text-align: start;
  color: var(--text-3);
  opacity: 0.45;
  transform: translateX(0);
  transition: opacity 300ms ease, color 300ms ease, transform 400ms var(--ease-out);
}
.stage.on { opacity: 1; color: var(--text-1); font-weight: 600; transform: translateX(calc(4px * var(--dx, 1))); }
.stage.done { opacity: 1; color: var(--text-2); }
.stage .dot {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--progress-off);
  display: grid;
  place-items: center;
  transition: border-color 260ms ease, background-color 260ms ease;
}
.stage.done .dot { border-color: var(--green); background: var(--green); animation: tick-pop 380ms var(--ease-spring) both; }
.stage.done .dot::after {
  content: '';
  width: 8px; height: 4px;
  border: 2px solid #fff;
  border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
/* The active stage spins a quarter-arc, like a small loader. */
.stage.on .dot {
  border-color: var(--progress-off);
  border-top-color: var(--purple-lt);
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.fact {
  margin-top: 30px;
  width: 100%;
  max-width: 360px;
  min-height: 84px;
  display: grid;
  place-items: center;
  padding: 16px 18px;
  background: var(--surface-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
}
.fact p { font-size: 14.5px; line-height: 1.45; color: var(--text-1); }
.fact p.swap { animation: rise 420ms var(--ease-out) both; }
.fact .who { margin-top: 8px; font-size: 12px; color: var(--text-3); }
.dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.dots i {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--progress-off);
  transition: background-color 260ms ease, width 360ms var(--ease-out);
}
.dots i.on { background: var(--purple-lt); width: 18px; }

/* ── S10 result ────────────────────────────────────────────────────── */
.result { padding-top: 20px; }
/* The head arrives in sequence: mascot springs in, then the words. */
.result > .mascot { animation: pop-in 700ms var(--ease-spring) 80ms both; }
.result > .eyebrow { animation: rise 520ms var(--ease-out) 260ms both; }
.result > h1 { animation: rise 560ms var(--ease-out) 340ms both; }
.result > .affirm { animation: rise 560ms var(--ease-out) 440ms both; }

.result .eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  /* --accent-text clears AA with margin on the navy ground; small caps
   * text this size wants it. */
  color: var(--accent-text);
  text-align: center;
}
.result .mascot { display: block; width: 96px; height: auto; margin: 0 auto 6px; filter: drop-shadow(0 10px 24px rgb(var(--purple-rgb) / 0.40)); }
.result h1 {
  margin-top: 6px;
  font-size: 30px;
  line-height: 1.1;
  text-align: center;
  letter-spacing: -0.02em;
  background: var(--grad-ink);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.result .affirm {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-2);
  text-align: center;
}

/* Cards below the fold rise as they scroll in. `.reveal` is only added by
 * JS when IntersectionObserver exists, so without it they just show. */
.reveal { opacity: 0; transform: translateY(22px); }
.reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 600ms var(--ease-out), transform 700ms var(--ease-out);
}

.card {
  margin-top: 18px;
  padding: 20px;
  background: var(--surface-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
}
.card h2 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
}
.card h3 { font-size: 17px; line-height: 1.3; }

/* Bullets and days cascade once their card is in view. */
.reveal .bullets li, .reveal .day { opacity: 0; transform: translateY(8px); }
.reveal.in .bullets li, .reveal.in .day {
  animation: rise 460ms var(--ease-out) both;
}
.reveal.in .bullets li:nth-child(1), .reveal.in .day:nth-child(1) { animation-delay: 140ms; }
.reveal.in .bullets li:nth-child(2), .reveal.in .day:nth-child(2) { animation-delay: 200ms; }
.reveal.in .bullets li:nth-child(3), .reveal.in .day:nth-child(3) { animation-delay: 260ms; }
.reveal.in .bullets li:nth-child(4), .reveal.in .day:nth-child(4) { animation-delay: 320ms; }
.reveal.in .day:nth-child(5) { animation-delay: 380ms; }
.reveal.in .day:nth-child(6) { animation-delay: 440ms; }
.reveal.in .day:nth-child(7) { animation-delay: 500ms; }

.bullets { margin: 13px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 11px; }
.bullets li { display: flex; gap: 10px; font-size: 14.5px; line-height: 1.45; color: var(--text-2); }
.bullets li .mark {
  flex: none;
  width: 19px; height: 19px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgb(16 185 129 / 0.16);
  display: grid;
  place-items: center;
  color: var(--green-text);
  font-size: 11px;
  font-weight: 700;
}

/* The week. Three real titles, then the rest locked — the unfinished
 * object is what the parent is buying. */
.week { margin: 14px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.day {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgb(255 255 255 / 0.03);
  transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 200ms ease;
}
.day:not(.locked) {
  background: linear-gradient(135deg, rgb(255 255 255 / 0.06), var(--selected-bg));
}
@media (hover: hover) {
  .day:not(.locked):hover { transform: translateX(calc(3px * var(--dx, 1))); border-color: rgb(var(--purple-rgb) / 0.55); box-shadow: var(--shadow-1); }
}
.day .n {
  flex: none;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-text);
  width: 38px;
}
.day .t { font-size: 14px; line-height: 1.35; color: var(--text-1); }

.day.locked { position: relative; overflow: hidden; }
.day.locked .t { color: var(--text-3); filter: blur(4.5px); user-select: none; }
.day.locked .n { color: var(--text-3); }
/* One shimmer across the locked days, as they arrive, says "there is
 * more here" without pulling the eye back again and again. */
.day.locked::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / 0.10) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: sheen 1.8s ease-in-out 900ms 1 both;
  pointer-events: none;
}
.day .lock { margin-inline-start: auto; flex: none; width: 15px; height: 15px; color: var(--text-3); }
.locked-note { margin-top: 11px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* Celebration burst for the result. Pieces fly out from the top centre
 * and fall; each carries its own direction, spin and delay from JS. */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}
.confetti i {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
  animation: confetti 2.2s cubic-bezier(0.2, 0.7, 0.3, 1) var(--d) forwards;
}
.confetti i.round { width: 8px; height: 8px; border-radius: 50%; }
.confetti i.star {
  width: 13px;
  height: 13px;
  border-radius: 0;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.confetti i.x { width: 12px; height: 12px; background: none; }
.confetti i.x::before,
.confetti i.x::after {
  content: '';
  position: absolute;
  inset: 40% -5%;
  border-radius: 2px;
  background: var(--c);
  transform: rotate(45deg);
}
.confetti i.x::after { transform: rotate(-45deg); }
@keyframes confetti {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0) scale(0.6); }
  35%  { opacity: 1; transform: translate(var(--x), var(--y)) rotate(calc(var(--r) * 0.5)) scale(1); }
  100% { opacity: 0; transform: translate(calc(var(--x) * 1.1), 70vh) rotate(var(--r)) scale(1); }
}

/* ── Mascot visits ───────────────────────────────────────────────────
 * Off-screen at its edge until `.in`; `.out` drifts it up and away;
 * `.reset` snaps it back off-screen with no transition. Everything that
 * moves is transform or opacity. On arrival it gives one little hello
 * hop, then floats gently; both run only while it is on screen.
 */
.explorer {
  position: fixed;
  z-index: 35;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  text-align: start;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(var(--from), 0, 0) rotate(var(--tilt));
  transition: transform 1100ms var(--ease-out), opacity 700ms ease;
  will-change: transform, opacity;
}
.explorer[data-side='left']  { --from: -140%; --tilt: -14deg; flex-direction: row; }
.explorer[data-side='right'] { --from: 140%;  --tilt: 14deg;  flex-direction: row-reverse; }
.explorer.in { opacity: 1; transform: none; pointer-events: auto; }
.explorer.out {
  opacity: 0;
  transform: translate3d(calc(var(--from) * 0.35), -80px, 0) rotate(var(--tilt));
  transition-duration: 1600ms, 1100ms;
}
.explorer.reset { transition: none; }
.explorer:focus-visible { outline: 3px solid var(--purple-lt); outline-offset: 4px; border-radius: 16px; }

/* Fixed height, natural width: the poses differ in shape (one is square)
 * but the mascot should always read as the same size. */
.explorer-bot {
  flex: none;
  width: auto;
  height: 78px;
  user-select: none;
  -webkit-user-drag: none;
}
.explorer.in .explorer-bot {
  animation:
    explorer-hello 700ms var(--ease-spring) 450ms 1 both,
    explorer-bob 3.4s ease-in-out 1.2s infinite alternate;
}
@keyframes explorer-hello {
  0%   { transform: translateY(0) rotate(0) scale(1); }
  40%  { transform: translateY(-9px) rotate(-6deg) scale(1.06); }
  100% { transform: translateY(0) rotate(0) scale(1); }
}
@keyframes explorer-bob {
  from { transform: translateY(-3px) rotate(-3deg); }
  to   { transform: translateY(3px) rotate(3deg); }
}

.explorer-bubble {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid rgb(var(--purple-rgb) / 0.35);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-1);
  opacity: 0;
  scale: 0.85;
  transition: opacity 400ms ease 350ms, scale 500ms var(--ease-spring) 350ms;
}
.explorer[data-side='left'] .explorer-bubble { transform-origin: left center; }
.explorer[data-side='right'] .explorer-bubble { transform-origin: right center; }
.explorer.in .explorer-bubble { opacity: 1; scale: 1; }
.explorer.out .explorer-bubble { transition-delay: 0ms; }
/* The tail points back at the explorer. */
.explorer-bubble::before {
  content: '';
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -5px;
  background: var(--surface);
  border: 1px solid rgb(var(--purple-rgb) / 0.35);
  transform: rotate(45deg);
}
.explorer[data-side='left'] .explorer-bubble::before { left: -5px; border-top: 0; border-right: 0; }
.explorer[data-side='right'] .explorer-bubble::before { right: -5px; border-bottom: 0; border-left: 0; }
.explorer-x { flex: none; margin-top: -1px; font-size: 15px; line-height: 1; color: var(--text-3); }
.explorer:hover .explorer-x { color: var(--text-1); }

/* ── Name step ─────────────────────────────────────────────────────── */
.namefield {
  width: 100%;
  margin-top: 20px;
  padding: 16px 18px;
  font-family: var(--font-body);
  font-size: 16px; /* 16px or iOS zooms the viewport on focus */
  color: var(--text-1);
  background: var(--surface-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-1);
  outline: none;
  transition: border-color 200ms ease, box-shadow 260ms var(--ease-out), background-color 200ms ease;
}
.namefield::placeholder { color: var(--text-3); }
/* No name yet: a gold edge, a short shake, and the reason under the field. */
.namefield[aria-invalid='true'],
.namefield[aria-invalid='true']:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgb(255 201 77 / 0.2);
}
.namefield.shake { animation: shake 360ms var(--ease-out); }
@keyframes shake {
  20%, 60% { translate: -6px 0; }
  40%, 80% { translate: 6px 0; }
}
.name-error {
  margin-top: 10px;
  font-size: 14px;
  color: var(--amber-text);
}
.name-error:empty { display: none; }
.namefield:focus {
  border-color: var(--purple-lt);
  background: var(--surface-hover);
  box-shadow: 0 0 0 4px rgb(var(--purple-rgb) / 0.22), 0 0 28px rgb(var(--purple-rgb) / 0.18);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 480px) {
  .q-title { font-size: 30px; }
  .hook h1 { font-size: 40px; }
}

/* Small phones: 375×667 must not scroll on a question screen. */
@media (max-height: 700px) {
  .q-title { font-size: 23px; }
  .q-sub { margin-top: 7px; font-size: 13.5px; }
  .options { gap: 7px; margin-top: 14px; }
  .opt { min-height: 50px; padding: 9px 13px; }
  .opt .emoji { width: 30px; height: 30px; font-size: 16px; }
  .options.grid .opt { min-height: 44px; }
  .options.dense { gap: 5px; margin-top: 10px; }
  .options.dense .opt { min-height: 40px; padding: 5px 12px; }
  .options.dense .opt .label { font-size: 13px; line-height: 1.25; }
  .autonomy { margin-top: 10px; }
  .q-title { font-size: 22px; }
  :root { --cta-h: 92px; }
  .cta { padding: 13px 20px; }
}

/* ── Demo video ─────────────────────────────────────────────────────────
 * A small window in the corner, above the sticky CTA, over the first
 * screen, ringed by a slowly turning aurora. Tapped, it grows into a
 * phone-shaped frame on a dimmed sky; closed, it folds into a glowing
 * play button. The flights between these are driven from JS; this sets
 * the poses. Controls are solid translucent pills — no backdrop blur,
 * which would re-blur every video frame.
 */
@property --intro-spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: none;
  background: transparent;
  transition: background-color 300ms ease, opacity 450ms ease;
}
.intro.expanded { background: rgb(var(--bg-rgb) / 0.82); pointer-events: auto; }

/* Expanded: sized from the video's own 9:16 shape, so it is never
 * cropped — as wide as the screen allows, unless the height (minus the
 * controls) is the tighter limit. */
.intro-stage {
  --w: min(calc(100vw - 32px), calc((100dvh - 136px) * 9 / 16), 460px);
  position: relative;
  isolation: isolate;
  width: var(--w);
  display: flex;
  flex-direction: column;
  gap: 14px;
  pointer-events: auto;
  animation: intro-in 600ms var(--ease-spring) both;
  transition: scale 220ms var(--ease-out), opacity 400ms ease;
}
.intro:not(.expanded) .intro-stage {
  /* By width, but never taller than the room above the CTA (phones on
   * their side). */
  --w: min(clamp(104px, 28vw, 150px), calc((100dvh - 140px) * 9 / 16));
  position: fixed;
  inset-inline-end: 16px;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 92px);
  animation-delay: 700ms;
  touch-action: none;
  cursor: grab;
}
/* Dragged or thrown somewhere by the viewer. */
.intro.moved:not(.expanded) .intro-stage { inset: var(--mini-y) auto auto var(--mini-x); }
/* Held: it lifts a little off the page. */
.intro.dragging .intro-stage { scale: 1.05; cursor: grabbing; }
/* The entrance plays once; after that the JS flights take over. */
.intro.settled .intro-stage { animation: none; }
.intro.flying { pointer-events: none; }
.intro.flying .intro-stage { pointer-events: none; }
@keyframes intro-in {
  from { opacity: 0; transform: scale(0.85) translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* The aurora: a conic gradient turning behind the small window, once as
 * a crisp 2px edge and once blurred into a glow. */
.intro:not(.expanded) .intro-stage::before,
.intro:not(.expanded) .intro-stage::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -2px;
  border-radius: 18px;
  background: conic-gradient(from var(--intro-spin), #7C5CFF, #8EB8FF, #34D399, #FFC94D, #C2408F, #7C5CFF);
  animation: intro-spin 5s linear infinite;
  pointer-events: none;
}
.intro:not(.expanded) .intro-stage::after { inset: 4px; filter: blur(16px); opacity: 0.7; }
.intro.dragging .intro-stage::after { opacity: 1; inset: -2px; }
@keyframes intro-spin { to { --intro-spin: 360deg; } }

.intro-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 26px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.08), 0 30px 80px rgb(0 0 0 / 0.55), 0 0 70px rgb(var(--purple-rgb) / 0.28);
  transition: transform 450ms var(--ease-out), border-radius 400ms var(--ease-out);
}
.intro:not(.expanded) .intro-frame {
  border-radius: 16px;
  box-shadow: 0 14px 36px rgb(0 0 0 / 0.55);
}
.intro.dragging .intro-frame { box-shadow: 0 26px 50px rgb(0 0 0 / 0.6); }
/* A soft light that follows the mouse across the glass. */
.intro-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 0%), rgb(255 255 255 / 0.28), transparent 55%);
  mix-blend-mode: soft-light;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}
.intro-frame.tilting { transition: transform 90ms linear, border-radius 400ms var(--ease-out); }
.intro-frame.tilting::after { opacity: 1; }
.intro video { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Mini: the whole window is the button that opens it; its title sits at
 * the bottom, the speaker and × at the top. */
.intro-open {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 6px 40px;
  border: 0;
  background: linear-gradient(to top, rgb(0 0 0 / 0.6), transparent 45%);
  cursor: inherit;
}
/* The full-screen hint, where YouTube puts it. Decoration only: the
 * whole window is the button. */
.intro-max {
  position: absolute;
  inset-inline-end: 7px;
  bottom: 9px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgb(0 0 0 / 0.5);
  color: #fff;
  transition: transform 180ms var(--ease-out), background-color 180ms ease;
}
.intro-max svg { width: 16px; height: 16px; }
.intro-open:hover .intro-max { transform: scale(1.12); background-color: rgb(var(--purple-rgb) / 0.85); }
.intro-open:focus-visible { outline: 3px solid var(--purple-lt); outline-offset: -3px; border-radius: 16px; }
.intro-title {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background-image: var(--grad-brand);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgb(var(--purple-rgb) / 0.45);
}
/* A glint crosses the title every few seconds. */
.intro-title::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / 0.55) 50%, transparent 65%);
  transform: translateX(-120%);
  animation: intro-glint 4.2s ease-in-out 2s infinite;
}
@keyframes intro-glint {
  0%, 70% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
.intro-title svg { width: 11px; height: 11px; }
.intro-icon {
  position: absolute;
  top: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.intro-icon:hover { background-color: rgb(0 0 0 / 0.75); transform: scale(1.1); }
.intro-icon svg { width: 15px; height: 15px; }
.intro-icon:focus-visible { outline: 2px solid var(--purple-lt); outline-offset: 1px; }
.intro-mute { inset-inline-start: 6px; }
/* Waiting for the viewer's first tap to turn sound on: a pill in the
 * middle of the video asks for it, with sound bars moving as if the
 * audio were already playing, and the speaker button calls for it with
 * a ring pulsing out. */
.intro-unmute {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100% - 12px);
  padding: 7px 11px;
  border: 1px solid rgb(255 255 255 / 0.28);
  border-radius: var(--radius-pill);
  background: rgb(10 12 28 / 0.72);
  box-shadow: 0 8px 22px rgb(0 0 0 / 0.45), 0 0 0 4px rgb(var(--purple-rgb) / 0.25);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  cursor: pointer;
  translate: -50% -50%;
  animation: unmute-in 500ms var(--ease-spring) both, unmute-bob 2.4s ease-in-out 500ms infinite;
}
.intro.needs-sound:not(.expanded) .intro-unmute { display: inline-flex; }
/* Not playing at all yet: the play button is the only call to action. */
.intro.needs-sound.blocked .intro-unmute { display: none; }
/* A narrow window: bars above the words, so the words stay on one line. */
.intro-frame { container-type: inline-size; }
@container (max-width: 130px) {
  .intro-unmute { flex-direction: column; gap: 4px; padding: 7px 10px 6px; border-radius: 14px; font-size: 11px; }
}
.intro-unmute:hover { background: rgb(var(--purple-rgb) / 0.9); }
.intro-unmute:focus-visible { outline: 2px solid var(--purple-lt); outline-offset: 2px; }
@keyframes unmute-in {
  from { opacity: 0; scale: 0.6; }
  to   { opacity: 1; scale: 1; }
}
@keyframes unmute-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}
.intro-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; flex: none; }
.intro-bars i {
  width: 2.5px;
  height: 100%;
  border-radius: 2px;
  background: var(--gold);
  transform-origin: bottom;
  animation: unmute-bar 900ms ease-in-out infinite alternate;
}
.intro-bars i:nth-child(2) { animation-delay: -300ms; }
.intro-bars i:nth-child(3) { animation-delay: -600ms; }
.intro-bars i:nth-child(4) { animation-delay: -150ms; }
@keyframes unmute-bar {
  from { transform: scaleY(0.25); }
  to   { transform: scaleY(1); }
}
.intro.needs-sound .intro-mute { background: rgb(var(--purple-rgb) / 0.85); }
.intro.needs-sound .intro-mute::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgb(255 255 255 / 0.85);
  animation: sound-call 1.6s ease-out infinite;
  pointer-events: none;
}
@keyframes sound-call {
  from { transform: scale(1); opacity: 0.9; }
  to   { transform: scale(1.9); opacity: 0; }
}
.intro-dismiss { inset-inline-end: 6px; }
.intro.expanded :is(.intro-open, .intro-icon) { display: none; }

.intro-seekrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: -4px;
}
.intro:not(.expanded) .intro-seekrow { display: none; }
.intro-time {
  min-width: 34px;
  color: var(--text-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.intro-total { text-align: end; }
.intro-seek {
  flex: 1;
  min-width: 0;
  height: 24px;
  margin: 0;
  accent-color: var(--purple);
  cursor: pointer;
}
[dir='rtl'] .intro-seekrow { direction: ltr; }
.intro-controls {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.intro:not(.expanded) .intro-controls { display: none; }

/* Short landscape (a phone on its side): controls beside the video, not
 * under it, so the video gets the full height. */
@media (orientation: landscape) and (max-height: 520px) {
  .intro.expanded .intro-stage {
    --w: calc((100dvh - 32px) * 9 / 16);
    width: auto;
    display: grid;
    grid-template-columns: var(--w) min(250px, calc(100vw - var(--w) - 64px));
    grid-template-rows: 1fr auto auto 1fr;
    column-gap: 20px;
    row-gap: 14px;
  }
  .intro.expanded .intro-frame { grid-row: 1 / -1; }
  .intro.expanded .intro-seekrow { grid-column: 2; grid-row: 2; margin: 0; }
  .intro.expanded .intro-controls { grid-column: 2; grid-row: 3; }
}
.intro-btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 160ms ease, transform 160ms ease;
}
.intro-btn:hover { background-color: var(--surface-hover); }
.intro-close:hover { filter: brightness(1.08); }
.intro-btn:active { transform: scale(0.96); }
.intro-btn:focus-visible { outline: 3px solid var(--purple-lt); outline-offset: 2px; }
/* Close is the primary way back: give it the brand gradient. */
.intro-close { background-image: var(--grad-brand); border-color: transparent; padding-inline: 18px; }

/* Shown only when autoplay was refused (or reduced motion asked us not
 * to start on our own). */
.intro-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 76px;
  height: 76px;
  display: none;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background-image: var(--grad-brand);
  color: #fff;
  box-shadow: 0 12px 34px rgb(var(--purple-rgb) / 0.5);
  cursor: pointer;
}
.intro:not(.expanded) .intro-play { width: 44px; height: 44px; }
.intro-play svg { width: 45%; height: 45%; margin-inline-start: 6%; }
.intro.blocked .intro-play { display: grid; }

.intro-progress {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 3px;
  background: rgb(255 255 255 / 0.18);
}
.intro-progress i {
  display: block;
  height: 100%;
  background: var(--grad-progress);
  transform: scaleX(0);
  transform-origin: left center;
}
[dir='rtl'] .intro-progress i { transform-origin: right center; }
/* Expanded, the seek bar below takes its place. */
.intro.expanded .intro-progress { display: none; }

/* ── The play button ──
 * Where the window docks, at its side and height. An orb with a ring
 * that fills with how much has been watched, a ripple breathing out of
 * it, and a spark circling it. Under a mouse it leans toward the
 * pointer, and its label slides out from behind it toward the page.
 * Placed by physical side (left/right), which JS picks from where the
 * window was. */
.intro-chip {
  position: fixed;
  right: 16px;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 92px);
  display: none;
  align-items: center;
  direction: ltr;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  pointer-events: auto;
  translate: var(--pull-x, 0) var(--pull-y, 0);
  transition: translate 260ms var(--ease-out);
}
.intro.chip-left .intro-chip { right: auto; left: 16px; flex-direction: row-reverse; }
.intro.chip-placed .intro-chip { bottom: auto; top: var(--chip-y); }
.intro.docked .intro-stage { display: none; }
.intro.docked .intro-chip { display: inline-flex; }
.intro-chip { touch-action: none; }
/* Held: it follows the pointer (JS), lifts, and hides its label. */
.intro.chip-dragging .intro-chip { cursor: grabbing; transition: none; }
.intro.chip-dragging .intro-chip-orb { scale: 1.12; }
.intro.chip-dragging .intro-chip-label { max-width: 0; padding: 0; opacity: 0; }
.intro-chip:focus-visible { outline: none; }
.intro-chip:focus-visible .intro-chip-orb { outline: 3px solid var(--purple-lt); outline-offset: 5px; }

.intro-chip-orb {
  position: relative;
  z-index: 1;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background-image: var(--grad-brand);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 0.16), 0 10px 26px rgb(var(--purple-rgb) / 0.55);
  animation: chip-land 700ms var(--ease-spring) both;
  transition: scale 200ms var(--ease-out);
}
.intro-chip:hover .intro-chip-orb { scale: 1.08; }
.intro-chip:active .intro-chip-orb { scale: 0.94; }
.intro-chip-orb > svg:last-child { width: 18px; height: 18px; margin-left: 3px; }
@keyframes chip-land {
  0%   { transform: scale(0.4); }
  55%  { transform: scale(1.18); }
  100% { transform: none; }
}
/* The breathing ripple, and on landing, one quick shockwave first. */
.intro-chip-orb::before,
.intro-chip-orb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgb(var(--purple-rgb) / 0.7);
  pointer-events: none;
}
.intro-chip-orb::before { animation: chip-breathe 3s ease-out 1.2s infinite both; }
.intro-chip-orb::after { border-color: rgb(255 255 255 / 0.8); animation: chip-shock 650ms ease-out 120ms both; }
@keyframes chip-breathe {
  0%   { transform: scale(1); opacity: 0.8; }
  70%, 100% { transform: scale(2); opacity: 0; }
}
@keyframes chip-shock {
  from { transform: scale(0.9); opacity: 1; }
  to   { transform: scale(2.4); opacity: 0; border-width: 0.5px; }
}
.intro-chip-ring {
  position: absolute;
  inset: -6px;
  width: calc(100% + 12px);
  height: calc(100% + 12px);
  rotate: -90deg;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  pointer-events: none;
}
.intro-chip-ring circle { stroke: rgb(255 255 255 / 0.14); }
.intro-chip-ring .watched {
  stroke: var(--gold);
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 3px rgb(255 201 77 / 0.8));
}
/* A spark on a tilted orbit, passing behind the orb and in front. */
.intro-chip-orbit {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  animation: chip-orbit 4.5s linear infinite;
  pointer-events: none;
}
.intro-chip-orbit::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 2px rgb(255 201 77 / 0.9);
}
@keyframes chip-orbit { to { rotate: 360deg; } }

.intro-chip-label {
  max-width: 0;
  overflow: hidden;
  margin-right: -22px;
  padding: 0;
  opacity: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-glass);
  box-shadow: 0 0 0 1px var(--line), 0 8px 20px rgb(0 0 0 / 0.35);
  font-size: 13px;
  font-weight: 700;
  line-height: 32px;
  white-space: nowrap;
  transition: max-width 360ms var(--ease-out), padding 360ms var(--ease-out), opacity 220ms ease;
}
.intro.chip-left .intro-chip-label { margin-right: 0; margin-left: -22px; }
.intro-chip:is(:hover, :focus-visible) .intro-chip-label { max-width: 160px; padding: 0 32px 0 14px; opacity: 1; }
.intro.chip-left .intro-chip:is(:hover, :focus-visible) .intro-chip-label { padding: 0 14px 0 32px; }

/* The entrance animations hold their end state (fill: both), which would
 * override these; clearing them lets the exit transitions run. */
.intro.leaving { opacity: 0; pointer-events: none; }
.intro.leaving .intro-stage { animation: none; opacity: 0; transform: scale(0.8); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .intro-stage::before, .intro-stage::after, .intro-title::after,
  .intro-chip-orb, .intro-chip-orb::before, .intro-chip-orb::after, .intro-chip-orbit { animation: none !important; }
  .intro-chip-orb::after { opacity: 0; }
}

/* ── Arabic ────────────────────────────────────────────────────────────
 * Set by setLang() on <html>: lang="ar" dir="rtl". Logical properties
 * above handle most of the mirroring; this covers the rest.
 *
 * Fonts: Baloo Bhaijaan 2 (rounded, like Nunito) for headings, Tajawal
 * for body. Letter-spacing is zeroed everywhere — any tracking breaks the
 * joins between Arabic letters.
 */
:root[lang='ar'] {
  --font-display: 'Baloo Bhaijaan 2', 'Nunito', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Tajawal', 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
}
[lang='ar'] *, [lang='ar'] *::before, [lang='ar'] *::after { letter-spacing: 0 !important; }
[lang='ar'] .lang button[lang='en'] { font-family: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif; font-size: 14px; }
[lang='ar'] h1, [lang='ar'] h2, [lang='ar'] h3 { line-height: 1.35; }
[lang='ar'] .q-sub, [lang='ar'] .opt .label, [lang='ar'] .hook .sub { line-height: 1.55; }

[dir='rtl'] { --dx: -1; }
[dir='rtl'] .back svg { transform: scaleX(-1); }
/* The mascot's side and bubble placement are computed in screen terms
 * (left/right), so its layout stays LTR; only the words read RTL. */
[dir='rtl'] .explorer { direction: ltr; }
[dir='rtl'] .explorer-bubble { direction: rtl; text-align: start; }
/* The star sits on the fill's leading edge, which is now its left. */
[dir='rtl'] .track::after { transform: translate(50%, -50%) rotate(calc(var(--n) * -90deg)); }
/* Keep "4 / 11" and the countdown reading left to right. */
[dir='rtl'] .count, [dir='rtl'] .offer-clock, [dir='rtl'] .offer-big { direction: ltr; unicode-bidi: isolate; }

/* This flow leans on motion, so this matters more here than on a static
 * page. Everything is cut; the calculation screen shortens to 1.2s. The
 * looping ambience (aurora, sheen, float, glow) stops outright. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .sparkle::before, .sparkle::after,
  .fill::after, .cta::after, .day.locked::after,
  .hook .badge, .hook .badge::before, .ring::before,
  .stars, .twinkle, .world, .drifter, .float, .explorer-bot, .calc-buddy img, .calc-think i {
    animation: none !important;
  }
  .fill::after, .cta::after, .day.locked::after { display: none; }
  .reveal, .reveal .bullets li, .reveal .day { opacity: 1; transform: none; }
  .stars { opacity: 0.18; }
  .twinkle { opacity: 0.16; }
}
