/* Values below are taken 1:1 from the Figma file (frame 1512×982).
   Figma letter-spacing % → em; background blur 40 → CSS blur(20px). */
:root {
  --ink: #22242a;
  --ink-64: rgba(34, 36, 42, 0.64);
  --blue: #2398ff;
  --white-80: rgba(255, 255, 255, 0.8);
  --glass-fill: rgba(255, 255, 255, 0.8);
  --glass-stroke: inset 0 0 0 1.5px rgba(255, 255, 255, 0.9);
  --glass-shadow: 0 16px 40px rgba(26, 77, 140, 0.16);
  --glass-blur: blur(20px);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.5, 1);
}

@font-face {
  font-family: "Miracle Rounded";
  src: local("SF Pro Rounded"), local("SFProRounded-Medium"), local("SF Pro Rounded Medium");
  font-weight: 500;
}
@font-face {
  font-family: "Miracle Rounded";
  src: local("SF Pro Rounded Semibold"), local("SFProRounded-Semibold");
  font-weight: 600;
}

* { box-sizing: border-box; }
html { height: 100%; }
body { position: relative; }
/* Canvas behind the page: sky-top blue at the top, sky-bottom pale blue below, so the
   area behind Safari's floating toolbar (outside the visible viewport) matches the sky. */
html { background: #c7ebff linear-gradient(180deg, #3aa7ef 0%, #7dccfa 55%, #c7ebff 100%) no-repeat; }
body {
  margin: 0;
  min-height: 100svh;
  /* SF Pro Rounded: ui-rounded on Apple devices, the installed font elsewhere, Nunito as the free fallback. */
  font-family: ui-rounded, "Miracle Rounded", "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #fff;
  background: linear-gradient(180deg, #3aa7ef 0%, #7dccfa 55%, #c7ebff 100%);
  overflow-x: hidden;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
img { display: block; }
[hidden] { display: none !important; }

/* ---------- Sky (Figma "Sky" frame, scaled to cover the viewport) ---------- */
/* Absolute, not fixed: iOS 26 Safari paints the status bar with the colour of a
   fixed element touching the top edge. As page content, the sky shows through instead. */
.sky { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.stage {
  position: absolute; left: 50%; top: 0;
  width: max(100vw, 100vh * 1512 / 982);
  height: max(100%, 100vh, 100vw * 982 / 1512);
  transform: translateX(-50%);
  background: linear-gradient(180deg, #3aa7ef 0%, #7dccfa 55%, #c7ebff 100%);
}
/* Group masked by a white→transparent gradient (top to bottom) */
.sky-masked {
  position: absolute; inset: 0;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 100%);
}
.sky-texture { /* "image 5": -208.66, -304.17, 1928.07 × 2472.65 */
  position: absolute; max-width: none;
  left: -13.800%; top: -30.975%; width: 127.518%; height: 251.797%;
}
.cloud-layer { position: absolute; inset: 0; will-change: transform; }
.cloud { position: absolute; max-width: none; opacity: 0; transition: opacity 1.4s var(--ease-out); user-select: none; }
.sky.is-ready .cloud { opacity: 0.8; }
.cloud-back { /* "cloud 4 2": -1455.61, -361.64, 3841.32 × 2033.06, mirrored */
  left: -96.271%; top: -36.827%; width: 254.056%; height: 207.032%;
  transform: scaleX(-1);
}
.cloud-front { /* "cloud 4 3": 296, 244, 1324 × 701 */
  left: 19.577%; top: 24.847%; width: 87.566%; height: 71.385%;
}

/* ---------- Logo (x 682, y 33, 148 × 49) ---------- */
.top { position: absolute; top: 33px; left: 0; right: 0; z-index: 2; display: flex; justify-content: center; }
.logo { display: block; transition: opacity .2s ease; }
.logo img { width: 148px; height: 49px; }
.logo:hover { opacity: .85; }

/* ---------- Hero ---------- */
.hero {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  /* Centre the block (h1 → signup count) between the logo (bottom 82px) and the
     dock (60px) within the *visible* screen height (svh, which excludes mobile
     browser toolbars), so the page only scrolls if the content truly doesn't fit. */
  --signup-gap: clamp(112px, 15.479svh, 152px);
  justify-content: center;
  min-height: 100svh;
  padding: 106px 16px calc(84px + env(safe-area-inset-bottom));
  text-align: center;
}
.copy { width: min(584px, 100%); display: flex; flex-direction: column; gap: 8px; }
h1 {
  margin: 0;
  font-size: 48px; line-height: 40px; font-weight: 600; letter-spacing: -0.02em;
  color: #fff;
}
h2 {
  margin: 0;
  padding-top: 20px; /* the Figma text box begins with an empty line */
  font-size: 24px; line-height: 20px; font-weight: 500; letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.64);
}

/* Texts reveal */
.reveal-line {
  display: block;
  opacity: 0; transform: translateY(14px); filter: blur(4px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out), filter 700ms var(--ease-out);
  will-change: transform, opacity, filter;
}
.reveal-line--2 { transition-delay: 90ms; }
.reveal.is-shown .reveal-line { opacity: 1; transform: none; filter: blur(0); }

/* ---------- Signup block (panel top at y 501) ---------- */
.signup {
  position: relative;
  width: min(626px, 100%);
  margin-top: var(--signup-gap);
  opacity: 0;
  transition: opacity 800ms var(--ease-out) 260ms;
}
.is-loaded .signup { opacity: 1; }

/* Anchor = panel top-centre. No z-index/transform here: the ghost stacks
   below the panel and the arms above it. */
.mascot { position: absolute; left: 50%; top: 0; width: 0; height: 0; }
.mascot img { position: absolute; max-width: none; pointer-events: none; user-select: none; }
/* 4x PNG exports from Figma (SVG filters render blurry/pixelated in iOS Safari) */
.mascot-ghost { left: -98px; top: -107px; width: 203px;   height: auto; z-index: 0; }
.mascot-arms  { left: -50px; top: 0;      width: 105.5px; height: auto; z-index: 2; }

.panel {
  position: relative; z-index: 1;
  overflow: hidden;
  text-align: left;
  color: var(--ink);
  background: var(--glass-fill);
  border-radius: 32px;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-stroke), var(--glass-shadow);
  transition: height 520ms var(--ease-out);
}
.state { padding: 25.5px; }
.state-form { display: flex; flex-direction: column; gap: 16px; }
.panel-header { display: flex; flex-direction: column; gap: 4px; }
.panel-title { margin: 0; font-size: 20px; line-height: 24px; font-weight: 600; letter-spacing: 0; color: var(--ink); }
.panel-sub { margin: 0; font-size: 15px; line-height: 20px; font-weight: 500; letter-spacing: 0.01em; color: var(--ink-64); }
.state-done .panel-sub { margin-top: 8px; }

.field {
  display: flex; align-items: center; gap: 0;
  height: 56px; padding: 0 16px;
  border-radius: 16px;
  background: rgba(34, 36, 42, 0.04);
  cursor: text;
  transition: box-shadow .2s ease, background-color .2s ease;
}
.field:focus-within { box-shadow: inset 0 0 0 1.5px rgba(35, 152, 255, 0.5); }
.field.has-error { box-shadow: inset 0 0 0 1.5px rgba(229, 72, 77, 0.6); }
.at, .field input {
  font: inherit; font-size: 15px; line-height: 20px; font-weight: 500; letter-spacing: 0.01em;
  color: var(--ink-64);
}
.field input {
  flex: 1; min-width: 0; height: 100%; padding: 0;
  border: 0; outline: 0; background: transparent;
}
.error {
  margin: 0; height: 0; overflow: hidden;
  font-size: 13px; line-height: 16px; color: #d64045;
  opacity: 0; transition: height .25s var(--ease-out), opacity .2s ease, margin .25s var(--ease-out);
}
.error.is-visible { height: 16px; margin-top: 8px; opacity: 1; }

.btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 52px; padding: 0 16px;
  border: 0; border-radius: 999px;
  font: inherit; font-size: 17px; line-height: 24px; font-weight: 600; letter-spacing: 0; color: #fff;
  background: var(--blue);
  cursor: pointer;
  transition: opacity .25s ease, filter .2s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:hover:not(:disabled) { filter: brightness(0.95); }
.btn:active:not(:disabled) { transform: scale(.985); }
.btn.is-loading { opacity: 1; cursor: progress; }
.btn-label { transition: opacity .2s ease, transform .25s var(--ease-out), filter .2s ease; }
.btn.is-loading .btn-label { opacity: 0; transform: translateY(-6px); filter: blur(2px); }

/* Matrix dot loader — 20×20 like the Figma spinner */
.matrix {
  position: absolute; left: 50%; top: 50%;
  display: grid;
  grid-template-columns: repeat(4, 3.5px);
  grid-auto-rows: 3.5px;
  gap: 2px;
  transform: translate(-50%, -50%) scale(.6);
  opacity: 0;
  transition: opacity .2s ease, transform .3s var(--ease-out);
}
.btn.is-loading .matrix { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.matrix i {
  display: block; border-radius: 1px;
  background: rgba(255, 255, 255, .3);
  animation: matrix-pulse 1100ms ease-in-out infinite;
  animation-delay: calc(var(--d, 0) * 1ms);
  animation-play-state: paused;
}
.btn.is-loading .matrix i { animation-play-state: running; }
@keyframes matrix-pulse {
  0%, 48%, 100% { background-color: rgba(255, 255, 255, .3); }
  16% { background-color: #fff; }
}

/* Panel state swap */
.party { display: inline-block; }
.state.is-entering { animation: state-in 520ms var(--ease-out) both; }
.state.is-entering .party { animation: party 700ms var(--ease-spring) 120ms both; }
.state.is-leaving { animation: state-out 220ms ease both; }
@keyframes state-in { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } to { opacity: 1; transform: none; filter: blur(0); } }
@keyframes state-out { to { opacity: 0; transform: translateY(-6px); filter: blur(3px); } }
@keyframes party { from { transform: scale(.2) rotate(-30deg); } to { transform: none; } }

.shake { animation: shake 420ms cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- Waitlist count (y 763: 32/38 Semibold, label 16/22 Medium, both white 80%) ---------- */
.count { margin-top: 23px; text-align: center; color: var(--white-80); }
.count p { margin: 2px 0 0; font-size: 16px; line-height: 22px; font-weight: 500; letter-spacing: 0; }
.reel {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; font-size: 32px; line-height: 38px; font-weight: 600; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.reel-col { position: relative; display: inline-block; height: 38px; line-height: 38px; }
.reel-sizer { visibility: hidden; }
.reel-digit {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  will-change: transform, opacity, filter;
}
.reel-sep { display: inline-block; height: 38px; line-height: 38px; }

/* ---------- Bottom dock (261 × 60 at y 922, chips 29px tall) ---------- */
.dock {
  position: fixed; left: 50%; bottom: 0; z-index: 3;
  transform: translate(-50%, 100%);
  display: flex; gap: 16px;
  padding: 15px 29px calc(16px + env(safe-area-inset-bottom));
  background: var(--glass-fill);
  border-radius: 32px 32px 0 0;
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-stroke), var(--glass-shadow);
  transition: transform 700ms var(--ease-out) 500ms;
}
.is-loaded .dock { transform: translate(-50%, 0); }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 29px; padding: 0 10.5px;
  border-radius: 32px;
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-stroke), var(--glass-shadow);
  color: rgba(0, 0, 0, 0.8); text-decoration: none;
  font-size: 16px; line-height: 22px; font-weight: 500; letter-spacing: 0;
  white-space: nowrap;
  transition: transform .2s var(--ease-out), background-color .2s ease;
}
.chip img { width: 15px; height: 15px; }
.chip:hover { transform: translateY(-2px); background: #fff; }
.chip:focus-visible, .btn:focus-visible, .logo:focus-visible { outline: 3px solid rgba(255,255,255,.9); outline-offset: 2px; }

/* ---------- Small screens (not in the Figma; scaled down to fit) ---------- */
@media (max-width: 640px) {
  h1 { font-size: 36px; line-height: 36px; }
  h2 { font-size: 18px; line-height: 20px; padding-top: 4px; }
  .signup { width: 100%; }
}
/* Short screens (e.g. phones with browser toolbars showing): tighten the outer spacing */
@media (max-height: 780px) {
  .top { top: 20px; }
  .hero { padding-top: 84px; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-line, .signup, .dock, .cloud { transition: none !important; }
  .matrix i { animation: none !important; }
}
