/* ==================================================================
   Hatch Pulse 2027
   ================================================================== */
:root {
  --bg: #05060a;
  --ink: #f4f2ff;
  --mute: rgba(236, 233, 255, 0.62);
  --faint: rgba(236, 233, 255, 0.38);
  --line: rgba(255, 255, 255, 0.14);
  --lime: #e4ff3a;
  --primary: #653aff;
  --primary-hi: #8466ff;
  --violet: #653aff;
  --deep: #6d00ff;
  --magenta: #d225ff;
  --pink: #f19cff;
  --a1: #6d00ff;
  --a2: #d225ff;
  --a3: #f19cff;
  --dir: 1;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --sans: 'Inter Tight', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
button, input, textarea { font: inherit; color: inherit; }
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.dim { color: var(--faint); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: 50; padding: 10px 14px; border-radius: 10px;
  background: var(--primary); color: #fff; font-weight: 600; transform: translateY(-200%);
}
.skip-link:focus { transform: none; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.ico { width: 20px; height: 20px; flex: none; }

/* ---------- canvas + atmosphere ---------- */
#scene {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100lvh; display: block; z-index: 0;
  opacity: 0; transition: opacity 1.6s ease;
}
.has-scene #scene { opacity: 1; }
.no-webgl {
  background:
    radial-gradient(60% 50% at 75% 45%, color-mix(in srgb, var(--a2) 35%, transparent), transparent 70%),
    radial-gradient(40% 40% at 70% 50%, color-mix(in srgb, var(--a3) 25%, transparent), transparent 70%),
    var(--bg);
}
.aura {
  position: fixed; left: -10%; right: -10%; bottom: -18vh; height: 52vh; z-index: 1; pointer-events: none;
  filter: blur(60px); opacity: 0.42; transition: opacity 0.6s ease;
}
.aura span {
  position: absolute; bottom: 0; width: 46%; height: 70%; border-radius: 50%;
  transition: background-color 1.4s ease, transform 2s var(--ease);
  animation: drift 14s ease-in-out infinite alternate;
}
.aura span:nth-child(1) { left: 2%; background: var(--a1); }
.aura span:nth-child(2) { left: 30%; height: 82%; background: var(--a2); animation-delay: -5s; }
.aura span:nth-child(3) { left: 56%; background: var(--a3); animation-delay: -9s; opacity: 0.8; }
@keyframes drift { from { transform: translate3d(-4%, 6%, 0) scale(1); } to { transform: translate3d(5%, -2%, 0) scale(1.12); } }
.aura-bump .aura { animation: bump 0.9s ease-out; }
@keyframes bump { 0% { opacity: 0.42; } 25% { opacity: 0.75; } 100% { opacity: 0.42; } }
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* legibility scrim between the 3D scene and the questions */
.scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0; transition: opacity 0.8s ease;
  background: linear-gradient(to bottom, rgba(5, 6, 10, 0) 20%, rgba(5, 6, 10, 0.8) 33%, rgba(5, 6, 10, 0.9) 100%);
}
[data-step='q'] .scrim { opacity: 1; }
@media (min-width: 1000px) and (min-aspect-ratio: 21/20) {
  .scrim { background: linear-gradient(to right, rgba(5, 6, 10, 0.86) 0%, rgba(5, 6, 10, 0.72) 34%, rgba(5, 6, 10, 0) 58%); }
}
.q__title, .q__hint, .q__count, .intro__text, .eyebrow { text-shadow: 0 1px 18px rgba(5, 6, 10, 0.9), 0 0 2px rgba(5, 6, 10, 0.6); }

/* ---------- HUD ---------- */
.hud {
  position: fixed; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; align-items: center; gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 14px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud__brand {
  display: flex; align-items: center; gap: 2px; font-weight: 800; font-size: 14px; letter-spacing: -0.01em;
  transition: opacity 0.6s ease, transform 0.6s var(--ease);
}
.hud__brand img { width: 13px; height: 20px; margin: 0 4px; filter: drop-shadow(0 0 8px rgba(101, 58, 255, 0.8)); }
.hud__brand em { font-style: normal; color: var(--violet); }
[data-step='intro'] .hud__brand { opacity: 0; transform: translateY(-6px); }
.hud__meta { display: flex; gap: 14px; margin-left: auto; color: var(--mute); }
.hud__motion {
  display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(5, 6, 10, 0.4); color: var(--mute); cursor: pointer;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hud__motion:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.3); }
.hud__motion .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-hi); box-shadow: 0 0 8px var(--primary); }
.hud__motion[aria-pressed='true'] .dot { background: transparent; border: 1px solid var(--mute); box-shadow: none; }

/* ---------- progress pulse line ---------- */
.pulsebar {
  position: fixed; z-index: 4; left: var(--gutter); right: var(--gutter);
  bottom: calc(14px + env(safe-area-inset-bottom)); height: 30px; pointer-events: none;
}
.pulsebar svg { width: 100%; height: 100%; overflow: visible; display: block; position: relative; }
.pulsebar::before {
  content: ''; position: absolute; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter));
  bottom: calc(-14px - env(safe-area-inset-bottom)); height: calc(84px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(5, 6, 10, 0), rgba(5, 6, 10, 0.92) 55%);
}
.pulsebar path { fill: none; }
.pulsebar__track { stroke: rgba(255, 255, 255, 0.12); stroke-width: 1.25; stroke-dasharray: 3 5; }
.pulsebar__fill {
  stroke: url(#pb-grad); stroke-width: 2.5; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(210, 37, 255, 0.6));
}
.pulsebar__head {
  position: absolute; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: #050507; border: 1.5px solid #fff;
  box-shadow: 0 0 0 4px rgba(101, 58, 255, 0.25), 0 0 18px 6px rgba(132, 102, 255, 0.6), 0 0 40px 12px rgba(101, 58, 255, 0.35);
  opacity: var(--on, 0); transition: opacity 0.4s ease;
}

/* ---------- steps ---------- */
#app { position: fixed; inset: 0; z-index: 3; }
#survey { height: 100%; }
.step {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(76px + env(safe-area-inset-top)) var(--gutter) calc(84px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}
.step::-webkit-scrollbar { display: none; }
.step[hidden] { display: none; }
.q { width: 100%; max-width: 620px; margin: auto 0 0; }
.step--intro, .step--outro { align-items: center; justify-content: center; text-align: center; }

/* side-by-side layout: questions left, orb right (matches scene.js) */
@media (min-width: 1000px) and (min-aspect-ratio: 21/20) {
  .step { justify-content: center; padding-left: max(var(--gutter), 7vw); }
  .q { margin: auto 0; }
  .step--intro, .step--outro { padding-left: var(--gutter); }
}
/* stacked layout: orb sits in the top third */
@media not all and (min-width: 1000px) and (min-aspect-ratio: 21/20) {
  .step:not(.step--intro):not(.step--outro) { padding-top: max(calc(76px + env(safe-area-inset-top)), 30vh); }
  .q { margin: auto auto 0; }
}

/* ---------- reveal choreography ---------- */
.reveal, .q__title, .q__title, .outro__title { opacity: 1; transform: none; filter: none; }
.is-active .reveal { opacity: 1; transform: none; filter: none; }
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.1em; margin-bottom: -0.1em; }
.w > span {
  display: inline-block; transform: translate3d(0, calc(110% * var(--dir)), 0) rotate(calc(5deg * var(--dir)));
  transition: transform 1s var(--ease); transition-delay: calc(var(--wi) * 38ms + 160ms);
}
.is-active .w > span { transform: none; }
.is-leaving .reveal, .is-leaving .q__title, .is-leaving .is-leaving .w > span { transform: none; }
.is-leaving .tile, .is-leaving .pill { transition-delay: calc(var(--i, 0) * 14ms); }

.reduce-motion .reveal, .reduce-motion .q__title, .reduce-motion .outro__title, .reduce-motion .w > span {
  transform: none !important; filter: none !important; transition: opacity 0.2s linear !important; transition-delay: 0s !important;
}
.reduce-motion .aura span, .reduce-motion .intro__bolt img { animation: none !important; }

/* ---------- type ---------- */
.eyebrow { color: var(--mute); margin: 0 0 14px; }
.q__count { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; color: var(--mute); }
.tag {
  padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--faint); font-size: 10px;
}
.tag--optional {
  display: inline-block; vertical-align: 0.35em; margin-left: 4px; letter-spacing: 0.06em; line-height: 1;
  padding: 5px 9px; font-size: 10px; color: #d8ccff; border-color: rgba(132, 102, 255, 0.6); background: rgba(101, 58, 255, 0.18);
}
.q__title {
  margin: 0; font-weight: 500; font-size: clamp(27px, 3.3vw, 44px); line-height: 1.1; letter-spacing: -0.012em;
  text-wrap: balance; outline: none;
}
.q__title--card { font-size: clamp(21px, 2.3vw, 30px); line-height: 1.15; }
.q__hint { margin: 12px 0 0; color: var(--mute); font-size: 16px; }
.q__error { min-height: 1.4em; margin: 14px 0 0; color: #ffb4c8; font-size: 14px; }
.q__error:empty { min-height: 0; margin: 0; }

/* ---------- buttons ---------- */
.q__nav { display: flex; align-items: center; gap: 10px; margin-top: 26px; flex-wrap: wrap; }
.btn {
  user-select: none; -webkit-user-select: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font-size: 15px; font-weight: 500; letter-spacing: -0.005em; cursor: pointer; white-space: nowrap;
  transition: transform 0.25s var(--ease), box-shadow 0.35s ease, background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  background: #fff; color: #0a0a0f; font-weight: 600;
  box-shadow: 0 10px 30px -12px rgba(140, 170, 255, 0.55);
}
.btn--primary:hover { background: #fff; box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.14), 0 14px 40px -10px rgba(160, 190, 255, 0.7); }
.btn--primary .ico { transition: transform 0.3s var(--ease); }
.btn--primary:hover .ico { transform: translateX(3px); }
.btn--primary:disabled { opacity: 0.7; cursor: progress; }
.btn--primary.is-loading .ico { animation: nudge 0.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(5px); } }
.btn--ghost { background: rgba(5, 6, 10, 0.35); border-color: var(--line); color: var(--mute); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.btn--ghost:hover { color: var(--ink); border-color: rgba(255, 255, 255, 0.32); }
.btn--xl { min-height: 60px; padding: 0 34px; font-size: 17px; }
.q__kbd { margin-left: 6px; color: var(--faint); user-select: none; -webkit-user-select: none; }

/* ---------- intro ---------- */
.intro { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 1100px; }
/* start screen: logo + Start centred in the upper half, the ring lies on the floor below */
.step--intro { justify-content: flex-start !important; }
.step--intro .intro { margin-top: clamp(64px, 15vh, 170px); }
.intro__hero { display: flex; flex-direction: column; align-items: center; text-align: center; }
.lockup {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-weight: 800; font-size: clamp(40px, 6.6vw, 96px); line-height: 1; letter-spacing: -0.018em; color: #fff;
  white-space: nowrap; margin-bottom: 26px;
}
.lockup__word { position: relative; z-index: 1; }
.lockup__word em { font-style: normal; color: var(--primary); }
.lockup__bolt { height: 2.3em; width: auto; margin: 0 -0.2em; }
/* Start: the glass swings away, revealing the ring behind it */
.intro__text { margin: 10px 0 28px; max-width: 30ch; color: var(--mute); font-size: clamp(17px, 1.6vw, 21px); text-wrap: balance; }
.intro__meta { display: flex; gap: 18px; padding: 0; margin: 26px 0 0; list-style: none; color: var(--faint); }

/* ---------- single choice pills ---------- */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.pill {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 22px 0 18px; font-size: 17px;
  border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; background: rgba(5, 6, 10, 0.35);
  color: rgba(244, 242, 255, 0.78); cursor: pointer; user-select: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.25s ease, color 0.25s ease, box-shadow 0.4s ease, background-color 0.3s ease, transform 0.25s var(--ease),
    opacity 0.7s var(--ease), filter 0.7s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.pill input, .tile input, .scale__opt input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.pill:hover { border-color: rgba(255, 255, 255, 0.42); color: var(--ink); }
.pill:active { transform: scale(0.97); }
.pill__dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid currentColor; opacity: 0.6; transition: all 0.3s ease; }
.pill:has(input:checked) {
  border-color: var(--primary-hi); color: #fff; background: rgba(101, 58, 255, 0.55);
  box-shadow: 0 0 28px -6px rgba(101, 58, 255, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.pill:has(input:checked) .pill__dot { background: #fff; opacity: 1; box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.7); }
.pill:has(input:focus-visible), .tile:has(input:focus-visible) { outline: 2px solid #fff; outline-offset: 3px; }
.other { margin-top: 18px; max-width: 420px; }
.line-input {
  width: 100%; min-height: 50px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(5, 6, 10, 0.5); font-size: 16px; outline: none;
}
.line-input:focus { border-color: var(--primary-hi); box-shadow: 0 0 22px -6px rgba(101, 58, 255, 0.8); }
.line-input::placeholder { color: var(--faint); }

/* ---------- scale (gooey glow slider) ---------- */
.scale {
  --lab: 132px; --row: 58px; --sc: rgb(190, 175, 255);
  position: relative; margin-top: 30px; touch-action: none; user-select: none; -webkit-user-select: none;
  width: 100%; max-width: 460px;
}
.scale__list { display: flex; flex-direction: column-reverse; }
.scale__opt {
  position: relative; display: flex; align-items: center; height: var(--row); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.scale__label {
  width: var(--lab); text-align: right; color: var(--faint); font-size: 16px; transition: color 0.3s ease, transform 0.4s var(--ease);
}
.scale__tick { width: 12px; height: 1px; margin-left: 12px; background: rgba(255, 255, 255, 0.35); }
.scale__opt:hover .scale__label { color: var(--mute); }
.scale__opt:has(input:checked) .scale__label { color: var(--sc); transform: translateX(-4px); }
.scale__rail {
  position: absolute; top: 6px; bottom: 6px; left: calc(var(--lab) + 30px); width: 8px; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 7px);
  mask-image: linear-gradient(to right, #000, transparent); -webkit-mask-image: linear-gradient(to right, #000, transparent);
}
.scale__svg { position: absolute; top: 0; left: calc(var(--lab) + 14px); width: 40px; height: 100%; overflow: visible; pointer-events: none; }
.scale__svg path { fill: none; stroke-linecap: round; }
.scale__dim { stroke: rgba(255, 255, 255, 0.24); stroke-width: 1.6; }
.scale__lit { stroke: var(--sc); stroke-width: 2.2; opacity: 0; transition: opacity 0.4s ease, stroke 0.4s ease; }
.scale__glow { stroke: var(--sc); stroke-width: 7; opacity: 0; transition: opacity 0.4s ease, stroke 0.4s ease; }
.scale.has-value .scale__lit { opacity: 1; }
.scale.has-value .scale__glow { opacity: 0.85; }
.scale__knob {
  position: absolute; top: -21px; left: calc(var(--lab) + 20px); width: 42px; height: 42px; pointer-events: none;
  will-change: transform;
}
.scale__halo {
  position: absolute; left: -46px; top: -38px; width: 118px; height: 118px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--sc) 55%, transparent) 0%, transparent 65%);
  filter: blur(10px); opacity: 0; transition: opacity 0.4s ease;
}
.scale.has-value .scale__halo { opacity: 1; }
.scale__btn {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #34343a, #131316 70%); color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 -2px 6px rgba(0, 0, 0, 0.6);
}
.scale__btn svg { width: 18px; height: 18px; }
.scale:has(input:focus-visible) .scale__btn { outline: 2px solid #fff; outline-offset: 3px; }
.scale__value { position: absolute; left: 58px; top: 50%; transform: translateY(-52%); display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.scale__big {
  font-weight: 300; font-size: clamp(46px, 5.2vw, 68px); line-height: 1; letter-spacing: -0.03em; color: var(--sc);
  text-shadow: 0 0 30px color-mix(in srgb, var(--sc) 40%, transparent); transition: color 0.4s ease;
}
.scale:not(.has-value) .scale__lit { opacity: 0.5; }
.scale:not(.has-value) .scale__glow { opacity: 0.4; }
.scale:not(.has-value) .scale__halo { opacity: 0.55; }
.scale:not(.has-value) .scale__big { opacity: 0.5; }
.scale:not(.has-value) .scale__opt:first-child .scale__label { color: var(--mute); }
.scale__big { transition: color 0.4s ease, opacity 0.4s ease; }
.scale__unit { color: var(--faint); }

/* ---------- multi-select tiles (glowing capsules) ---------- */
.tiles { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 24px; }
@media (min-width: 640px) { .tiles { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) and (min-aspect-ratio: 21/20) { .step--multi .q { max-width: 680px; } }
.tile {
  position: relative; display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 12px 18px 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.11); border-radius: 18px; background: rgba(8, 9, 15, 0.45);
  color: rgba(244, 242, 255, 0.82); font-size: 17px; line-height: 1.35; cursor: pointer; user-select: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color 0.3s ease, color 0.3s ease, background-color 0.3s ease, box-shadow 0.4s ease, transform 0.25s var(--ease),
    opacity 0.7s var(--ease), filter 0.7s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { border-color: rgba(255, 255, 255, 0.26); color: var(--ink); }
.tile:active { transform: scale(0.985); }
.tile__bar {
  flex: none; width: 11px; height: 34px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  background: linear-gradient(to bottom, color-mix(in srgb, var(--c) 18%, transparent), transparent);
  transition: all 0.45s var(--ease); transform-origin: 50% 100%;
}
.tile:has(input:disabled) { opacity: 0.4; cursor: not-allowed; }
.tile:has(input:disabled):hover { border-color: rgba(255, 255, 255, 0.11); color: rgba(244, 242, 255, 0.82); }
.tile input:disabled { cursor: not-allowed; }
.tile:has(input:checked) {
  color: #fff; border-color: color-mix(in srgb, var(--c) 55%, transparent);
  background: linear-gradient(100deg, color-mix(in srgb, var(--c) 14%, rgba(8, 9, 15, 0.6)), rgba(8, 9, 15, 0.5) 60%);
  box-shadow: 0 0 30px -12px var(--c);
}
.tile:has(input:checked) .tile__bar {
  border-color: transparent;
  background: linear-gradient(to bottom, #fff 0%, color-mix(in srgb, var(--c) 70%, #fff) 30%, var(--c) 100%);
  box-shadow: 0 0 14px 1px var(--c), 0 0 30px 2px color-mix(in srgb, var(--c) 40%, transparent);
  animation: barpop 0.5s var(--ease);
}
@keyframes barpop { 0% { transform: scaleY(0.4); } 60% { transform: scaleY(1.15); } 100% { transform: scaleY(1); } }
.multi__count { margin: 14px 0 0; color: var(--faint); }

/* ---------- glass card + text field ---------- */
.glass {
  position: relative; padding: clamp(20px, 2.4vw, 30px); border-radius: 28px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035) 55%, rgba(255, 255, 255, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 40px 90px -30px rgba(20, 0, 70, 0.75);
  backdrop-filter: blur(24px) saturate(140%); -webkit-backdrop-filter: blur(24px) saturate(140%);
}
.glass__top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.glass__top .q__count { margin: 0; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: url('../assets/hatch-ring.svg') center / 78% no-repeat, radial-gradient(circle at 35% 30%, #8466ff, #653aff 55%, #2a138f 100%);
  box-shadow: 0 0 22px -2px rgba(101, 58, 255, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: spin 9s linear infinite;
}
@keyframes spin { 50% { filter: brightness(1.25); } }
.field {
  position: relative; margin-top: 22px; border-radius: 20px; border: 1px solid transparent;
  background:
    linear-gradient(rgba(7, 8, 14, 0.82), rgba(7, 8, 14, 0.82)) padding-box,
    linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.14)) border-box;
  transition: box-shadow 0.5s ease;
}
.field:focus-within {
  background:
    linear-gradient(rgba(7, 8, 14, 0.9), rgba(7, 8, 14, 0.9)) padding-box,
    linear-gradient(90deg, #2f6bff 0%, #8a4dff 30%, #ff3b5c 52%, #ffc93a 74%, #26d36b 100%) border-box;
  box-shadow: -16px 4px 40px -14px rgba(47, 107, 255, 0.8), 0 16px 40px -16px rgba(255, 59, 92, 0.7),
    10px 16px 40px -16px rgba(255, 201, 58, 0.65), 18px 4px 40px -14px rgba(38, 211, 107, 0.7);
}
.field textarea {
  display: block; width: 100%; min-height: 108px; max-height: 38vh; resize: none; border: 0; outline: none; background: transparent;
  padding: 16px 18px 6px; font-size: 17px; line-height: 1.5; color: var(--ink);
}
.field textarea::placeholder { color: var(--faint); }
.field textarea[aria-invalid='true'] { caret-color: #ffb4c8; }
.field__bar { display: flex; align-items: center; gap: 10px; padding: 4px 8px 8px 18px; }
.field__line { flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06)); }
.field:focus-within .field__line { background: linear-gradient(90deg, rgba(47, 107, 255, 0.7), rgba(255, 59, 92, 0.6), rgba(38, 211, 107, 0.7)); }
.mic {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.16); background: radial-gradient(circle at 40% 30%, #2a2340, #0e0b18 70%); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.mic svg { width: 20px; height: 20px; position: relative; z-index: 1; }
.mic__ring { position: absolute; inset: -1px; border-radius: 50%; }
.mic.is-live { border-color: transparent; background: radial-gradient(circle at 40% 30%, #ff7ad6, #6d00ff 75%); }
.mic.is-live .mic__ring { animation: ring 1.4s ease-out infinite; box-shadow: 0 0 0 0 rgba(241, 156, 255, 0.7); }
@keyframes ring { to { box-shadow: 0 0 0 16px rgba(241, 156, 255, 0); } }

/* ---------- outro ---------- */
[data-step='outro'] .scrim { opacity: 0; }

/* ---------- feedback ---------- */
.shake { animation: shake 0.45s var(--ease); }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(7px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }

.noscript { padding: 40px; text-align: center; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .hud__meta #hud-time { display: none; }
  .hud__motion .label { font-size: 10px; }
  .pill { min-height: 50px; font-size: 16px; }
  .pills { gap: 8px; }
  .q__kbd { display: none; }
  .q__nav .btn--primary { flex: 1; }
  .scale { --lab: 112px; --row: 54px; }
  .scale__label { font-size: 14px; }
  .intro__meta { gap: 12px; }
  .glass { border-radius: 24px; }
}
@media (max-height: 700px) and (max-width: 999px) {
  .step:not(.step--intro):not(.step--outro) { padding-top: max(calc(70px + env(safe-area-inset-top)), 22vh); }
}

@media (prefers-reduced-transparency: reduce) {
  .glass, .tile, .pill { backdrop-filter: none; -webkit-backdrop-filter: none; background-color: rgba(12, 13, 20, 0.92); }
}

/* outro can be taller than the viewport: centre safely so the top never clips */
.step--outro { justify-content: flex-start; }
.step--outro .outro { margin: auto 0; }


/* start screen: near-black stage so only the bolt carries the violet */
[data-step='intro'] .aura { opacity: 0.12; }
body:not([data-step]) .aura, [data-step='intro'] .grain { opacity: 0.05; }

@media (max-width: 640px) {
  .lockup { font-size: clamp(28px, 9vw, 42px); }
  .step--intro .intro { margin-top: 10vh; }
  .step--intro .intro__text { max-width: 30ch; font-size: 18px; }
}

/* start-screen atmosphere: layered violet → blue orbs with a thin rim arc and a cyan bloom below */
.intro__orbs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: -1; mix-blend-mode: screen; transition: opacity 1.1s ease, transform 1.4s cubic-bezier(0.6, 0, 0.3, 1); }
.intro__orbs span { position: absolute; left: 50%; border-radius: 50%; }
.intro__orbs span:nth-child(1) {
  width: 150vmax; height: 150vmax; top: -4vh; transform: translateX(-50%);
  background: radial-gradient(circle at 28% 18%, rgba(123, 43, 255, 0.38), rgba(70, 20, 160, 0.14) 32%, rgba(0, 0, 0, 0) 58%);
  filter: blur(8px);
}
.intro__orbs span:nth-child(2) {
  width: min(118vw, 1250px); aspect-ratio: 1; top: 7vh; transform: translateX(-50%);
  background: radial-gradient(circle at 32% 20%, rgba(80, 110, 255, 0.34), rgba(40, 40, 160, 0.12) 36%, rgba(0, 0, 0, 0) 60%);
  box-shadow: inset 0 2px 0 rgba(220, 225, 255, 0.55), inset 0 14px 40px -18px rgba(170, 180, 255, 0.45);
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 75%); mask-image: linear-gradient(to bottom, #000 30%, transparent 75%);
}
.intro__orbs span:nth-child(3) {
  width: 70vw; height: 40vh; bottom: -12vh; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 70%, rgba(20, 220, 230, 0.3), rgba(30, 80, 255, 0.12) 45%, rgba(0, 0, 0, 0) 72%);
  filter: blur(20px);
}
.step--intro { isolation: isolate; }
.is-launch .intro__orbs { opacity: 0; transform: scale(1.12); }
.reduce-motion .intro__orbs { transition: opacity 0.3s linear; }

.intro__headline { margin: 10px 0 18px; font-weight: 500; font-size: clamp(22px, 2.3vw, 32px); letter-spacing: -0.005em; color: #fff; }
.step--intro .intro__text {
  /* a narrower, naturally ragged measure (not a justified-looking block) with room between lines */
  max-width: 36ch; margin: 0 0 38px; font-size: clamp(18px, 1.55vw, 22px); line-height: 1.62; letter-spacing: 0.003em;
  text-wrap: pretty; color: rgba(244, 245, 255, 0.95); text-shadow: 0 1px 18px rgba(0, 0, 0, 0.85);
}
.step--intro .btn--xl { min-height: 64px; padding: 0 44px; font-size: 19px; }
.step--intro .intro__meta { display: none; }

[data-step='intro'] .pulsebar { opacity: 0; }
.pulsebar { transition: opacity 0.6s ease; }

/* Start: logo, headline, text and button blur out one at a time */
.step--intro .intro__hero > * { transition: opacity 0.45s ease, filter 0.5s ease, transform 0.55s cubic-bezier(0.5, 0, 0.75, 0); }
.is-launch .intro__hero > * { opacity: 0 !important; filter: blur(14px) !important; transform: translate3d(0, -12px, 0) scale(0.98) !important; }
.is-launch .intro__hero > .lockup { transition-delay: 0s; }
.is-launch .intro__hero > .intro__headline { transition-delay: 0.12s; }
.is-launch .intro__hero > .intro__text { transition-delay: 0.24s; }
.is-launch .intro__hero > .btn { transition-delay: 0.36s; }
.reduce-motion .is-launch .intro__hero > * { transition-delay: 0s !important; }

/* ---------- end screen: thanks + shareable card ---------- */
.step--outro { text-align: left; }
.outro {
  width: 100%; max-width: 1180px; margin: auto; display: grid; grid-template-columns: 1fr minmax(300px, 440px);
  align-items: center; gap: clamp(32px, 6vw, 110px);
}
.outro__title { margin: 0; font-weight: 600; font-size: clamp(44px, 6vw, 92px); line-height: 1.02; letter-spacing: -0.028em; outline: none; }
.outro__text { margin: 28px 0 0; max-width: 24ch; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.4; color: #fff; }
.outro__event { margin: 20px 0 0; max-width: 28ch; font-size: clamp(16px, 1.35vw, 19px); line-height: 1.45; color: #a99bff; }
/* quiet text link: sits under the event line, lighter than the card buttons */
.outro__invite {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; padding: 6px 0;
  font-size: 15px; font-weight: 500; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28); transition: border-color 0.25s ease, color 0.25s ease;
}
.outro__invite .ico { width: 16px; height: 16px; transition: transform 0.3s var(--ease); }
.outro__invite:hover { border-color: #fff; }
.outro__invite:hover .ico { transform: translateX(3px); }
.outro__invite:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 2px; }
.outro__asset { display: flex; flex-direction: column; align-items: stretch; }
/* the card: text is HTML, the ring is the live 3D ring flown into .card__ring */
.card {
  position: relative; margin: 0; width: 100%; aspect-ratio: 4 / 5; overflow: hidden;
  background: transparent; /* the 3D ring and its violet glow render underneath */
  container-type: inline-size;
}
.card__lockup {
  position: absolute; top: 9%; left: 0; right: 0; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 4.3cqw; letter-spacing: -0.012em; color: #fff;
}
.card__lockup img { height: 1.45em; margin: 0 -0.22em; }
.card__lockup em { font-style: normal; color: var(--primary); }
.card__headline {
  position: absolute; top: 15%; left: 3%; right: 3%; margin: 0; text-align: center; z-index: 1;
  font-weight: 600; font-size: 14.2cqw; line-height: 1; letter-spacing: -0.028em; color: #fff;
}
.card__headline em { font-style: normal; color: var(--primary); }
.card__headline .cl { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.card__headline .cl > span { display: inline-block; }
.card__ring { position: absolute; left: 50%; top: 67%; width: 50%; aspect-ratio: 1; transform: translate(-50%, -50%); }
.card__url { position: absolute; bottom: 5.5%; left: 0; right: 0; margin: 0; text-align: center; font-weight: 500; font-size: 4.1cqw; color: #fff; z-index: 1; }
.card__actions { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 14px; margin-top: 16px; }
.card__actions .btn { min-height: 56px; }
/* Download + format arrow */
.split { position: relative; display: flex; min-width: 0; }
.split__main { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split__toggle { flex: 0 0 52px; padding: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; position: relative; }
.split__toggle::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 1px; background: rgba(10, 10, 15, 0.16); }
.split__toggle .ico { width: 20px; height: 20px; transition: transform 0.3s var(--ease); }
.btn--primary.split__toggle:hover .ico { transform: none; }
.split__toggle[aria-expanded="true"] .ico { transform: rotate(180deg); }
.split__menu {
  position: absolute; right: 0; bottom: calc(100% + 10px); z-index: 5; min-width: 248px; padding: 6px;
  display: grid; gap: 2px; border-radius: 18px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 14, 22, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.8);
  animation: menuIn 0.22s var(--ease);
}
.split__menu[hidden] { display: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.split__menu [role=menuitem] {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px; width: 100%;
  padding: 13px 14px; border: 0; border-radius: 12px; background: transparent; color: var(--ink);
  font: inherit; font-size: 15px; font-weight: 500; text-align: left; cursor: pointer;
}
.split__menu [role=menuitem] small { font-size: 11px; color: var(--mute); letter-spacing: 0.02em; }
.split__menu [role=menuitem]:hover, .split__menu [role=menuitem]:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; }
.split__menu [role=menuitem][aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.card__actions.is-exporting .split__main { font-variant-numeric: tabular-nums; }
.reduce-motion .split__menu { animation: none; }
.share__status { min-height: 1.2em; margin: 10px 0 0; font-size: 13px; color: #b9a6ff; text-align: center; }
@media (max-width: 860px) {
  .outro { grid-template-columns: 1fr; gap: 28px; padding-bottom: 30px; }
  .outro__copy { text-align: center; }
  .outro__text, .outro__event { margin-left: auto; margin-right: auto; }
  .outro__asset { width: min(100%, 420px); margin: 0 auto; }
}

body { letter-spacing: 0.003em; }
.step--multi .q { max-width: 700px !important; }

/* crisp type: proper kerning + smoothing; no lingering filters/layers on settled text */
html { text-rendering: optimizeLegibility; font-kerning: normal; font-feature-settings: 'kern' 1, 'liga' 1; -moz-osx-font-smoothing: grayscale; }
.card__headline, .card__lockup, .card__url, .outro__title, .intro__hero .lockup, .q__title { -webkit-font-smoothing: antialiased; backface-visibility: hidden; }

/* ---------- end screen build: the ring lands, then the card assembles around it ---------- */
.card__frame { position: absolute; inset: 0; border: 1px solid rgba(255, 255, 255, 0.12); pointer-events: none; clip-path: inset(0 100% 100% 0); }
.card__lockup, .card__url, .card__actions, .share__status, .outro__text, .outro__event, .outro__invite { opacity: 0; transform: translate3d(0, 16px, 0); filter: blur(6px); }
.card__headline .cl > span { transform: translate3d(0, 105%, 0); }
.step--outro .card__frame { transition: clip-path 1.3s cubic-bezier(0.65, 0, 0.35, 1); }
.step--outro .card__lockup, .step--outro .card__url, .step--outro .card__actions, .step--outro .outro__text, .step--outro .outro__event, .step--outro .outro__invite {
  transition: opacity 0.7s ease, transform 0.9s var(--ease), filter 0.7s ease;
}
.step--outro .card__headline .cl > span { transition: transform 0.9s var(--ease); }
.step--outro.is-active .card__frame { clip-path: inset(0 0 0 0); transition-delay: 1.0s; }
.step--outro.is-active .card__lockup { opacity: 1; transform: none; filter: none; transition-delay: 1.35s; }
.step--outro.is-active .card__headline .cl > span { transform: none; }
.step--outro.is-active .card__headline .cl:nth-child(1) > span { transition-delay: 1.5s; }
.step--outro.is-active .card__headline .cl:nth-child(2) > span { transition-delay: 1.62s; }
.step--outro.is-active .card__headline .cl:nth-child(3) > span { transition-delay: 1.74s; }
.step--outro.is-active .card__headline .cl:nth-child(4) > span { transition-delay: 1.86s; }
.step--outro.is-active .card__url { opacity: 1; transform: none; filter: none; transition-delay: 2.1s; }
.step--outro.is-active .card__actions { opacity: 1; transform: none; filter: none; transition-delay: 2.3s; }
.step--outro.is-active .share__status { opacity: 1; transform: none; filter: none; transition-delay: 0s; }
.step--outro .outro__title .w > span { transition-delay: calc(var(--wi) * 60ms + 0.9s); }
.step--outro.is-active .outro__text { opacity: 1; transform: none; filter: none; transition-delay: 1.5s; }
.step--outro.is-active .outro__event { opacity: 1; transform: none; filter: none; transition-delay: 1.7s; }
.step--outro.is-active .outro__invite { opacity: 1; transform: none; filter: none; transition-delay: 1.9s; }
.reduce-motion .step--outro * { transition-delay: 0s !important; }

/* ---------- legal links ---------- */
.legal {
  position: fixed; z-index: 6; right: var(--gutter); bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex; gap: 16px; font-size: 12px; line-height: 1;
}
.legal a { color: var(--faint); text-decoration: none; padding: 4px 0; transition: color 0.2s ease; }
.legal a:hover, .legal a:focus-visible { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 641px) {
  .pulsebar { right: calc(var(--gutter) + 150px); }
  /* the bar stops short of the legal links, but its dark fade runs to the screen edge behind them */
  .pulsebar::before { right: calc(-1 * (var(--gutter) + 150px)); }
}
@media (max-width: 640px) {
  .legal { left: 0; right: 0; justify-content: center; bottom: calc(6px + env(safe-area-inset-bottom)); font-size: 11px; }
  .pulsebar { bottom: calc(26px + env(safe-area-inset-bottom)); }
  .step { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}

.card__headline, .card__lockup, .card__url { text-shadow: 0 2px 18px rgba(4, 3, 14, 0.85); }
