:root {
  /* One curve for every fade to black (eased: no visible band where it starts or ends). Clear → black. */
  --fade-stops: rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .01) 6.67%, rgba(0, 0, 0, .04) 13.33%, rgba(0, 0, 0, .08) 20%, rgba(0, 0, 0, .15) 26.67%, rgba(0, 0, 0, .23) 33.33%, rgba(0, 0, 0, .33) 40%, rgba(0, 0, 0, .44) 46.67%, rgba(0, 0, 0, .56) 53.33%, rgba(0, 0, 0, .67) 60%, rgba(0, 0, 0, .77) 66.67%, rgba(0, 0, 0, .85) 73.33%, rgba(0, 0, 0, .92) 80%, rgba(0, 0, 0, .96) 86.67%, rgba(0, 0, 0, .99) 93.33%, #000 100%;
  --sf: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Inter", "Helvetica Neue", Arial, sans-serif;
  --inter: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;

  /* Timings — keep in sync with T in main.js */
    --t-zoom: 2000ms;
  /* the size of the spoken lines — the subtitles and the end card share it (phones: see below) */
  --voice-size: clamp(24px, 2.08vw, 40px); /* (24 px at the least: smaller was too small in narrow windows) */
  --t-char: 48ms; /* time per letter of the spoken phrases (was 61: a touch quicker) */
  --ease: cubic-bezier(.45, 0, .2, 1);

}

* { box-sizing: border-box; }

html { background: #000; color-scheme: dark; }
/* the page is locked while the scene plays (a swipe moves it on a step instead); on phones not with overflow — that
   would keep it from running under the browser's bars. There the swipe is caught in main.js (touchmove) instead. */
@media (min-width: 761px) { html.is-locked { overflow: hidden; } }
/* phones: spare black above the scene, scrolled past on load (main.js: toEdge) — see there why */
@media (max-width: 760px) {
  /* the scene starts 120 px above what's visible: that top strip sits under the browser's bars (Telegram draws
     what's above its frame, Safari once its bars fold) — so the picture, not black, is under them. Not sticky or
     fixed: Safari 26 paints a fixed/sticky element touching the top edge as a flat colour under the status bar
     instead of the page. Keep 120 in sync with EDGE in main.js. */
  main .hero { height: calc(100vh + var(--edge, 120px)); }
  /* black page below the scene: Telegram draws past the bottom of its frame (under its toolbar) — with nothing
     there it shows its own white. Never scrolled to: swipes are caught (main.js) */
  .tail { height: 240px; background: #000; }
}
html, body { overscroll-behavior: none; }

body {
  margin: 0;
  min-height: 100%;
  background: #000;
  color: #fff;
  font-family: var(--inter);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; }


/* ───────────── Nav (Figma 843:6778: logo at 25 px, About + Download 20 px from the right) ───────────── */

.nav {
  position: fixed;
  z-index: 10;
  top: 20px;
  left: 25px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav__logo { margin-right: auto; }

.nav__link,
.nav__cta {
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
}

.nav__link {
  font-family: "Geist", var(--inter);
  font-weight: 400;
  color: #fff;
  transition: opacity 200ms ease;
}
.nav__link:hover { opacity: .6; }

.nav__cta {
  padding: 8px 16px;
  border-radius: 40px;
  background: #fff;
  color: #000;
  font-weight: 600;
  letter-spacing: -.28px;
}

/* ───────────── Chapters (Figma 847:6646): left edge, vertically centred ───────────── */

.chapters {
  position: fixed;
  z-index: 10;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 11px;
  font-family: "Geist", var(--inter);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.3;
  color: #fff;
  opacity: 0;
  transition: opacity 1400ms ease;
  pointer-events: none;
}
:root:has(.hero.is-loaded) .chapters { opacity: 1; }

.chapters__item { margin: 0; color: rgba(255, 255, 255, .3); white-space: nowrap; }
/* one property for every state (colour, not colour + opacity): switching chapters then can't flash white */
/* Chapters that exist can be clicked: the scene jumps to their start (main.js: goTo) */
button.chapters__item {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
  transition: color 200ms ease;
}
button.chapters__item:not(.is-current):hover { color: rgba(255, 255, 255, .7); }
button.chapters__item:focus-visible { outline: 1px solid rgba(255, 255, 255, .6); outline-offset: 4px; border-radius: 2px; }

/* The chapter playing: the name at 22 %, a white copy over it revealed up to --p (0…1, set by main.js).
   The reveal is two opposite translations (no repaint per frame, unlike a moving gradient clipped to the text). */
.chapters__item { position: relative; }
.chapters__item.is-current { color: rgba(255, 255, 255, .22); transition: none; }
.chapters__fill {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: #fff;
  visibility: hidden;
  transform: translateX(calc((var(--p, 0) - 1) * 100%));
}
.chapters__fill > span { display: block; transform: translateX(calc((1 - var(--p, 0)) * 100%)); }
.is-current .chapters__fill { visibility: visible; }

@media (max-width: 760px) {
  .nav__link { display: none; }
  .chapters { display: none; }
  .edges { display: none; } /* no darkening at the left and right edges on phones: the picture is narrow enough */
  /* nor the vignette and the eyelids: the picture is its own frame up top (main.js: fit) — the vignette's dark top
     edge showed up as a black strip under the status bar once the dimming went off with the first push-in */
  .stage { display: none; }
}

/* ───────────── Hero ───────────── */

.hero {
  position: relative;
  height: 100vh; /* the large viewport: on phones it runs on under the browser's bars (Safari, Telegram), so the
                    picture shows through them at the top and the black at the bottom, as on shumakov.co/new */
  overflow: hidden;
  background: #000;
}

.stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1440px;
  height: 1024px;
  transform: translate(var(--stage-x, 0px), var(--stage-y, 0px)) scale(var(--stage-scale, 1));
  transform-origin: 0 0;
}

/* Photo canvas: 1920 × 1920 (square), fitted by main.js */
.scene {
  position: absolute;
  left: 0;
  top: 0;
  width: 1920px;
  height: 1920px;
  transform: translate(var(--scene-x, 0px), var(--scene-y, 0px)) scale(var(--scene-scale, 1));
  transform-origin: 0 0;
  opacity: 0;
  transition: opacity 1400ms ease;
}
.is-loaded .scene { opacity: 1; }
/* Phones: the picture is a 3 : 4 frame at the top (main.js: fit), cut off below it… */
.scene.is-framed {
  /* the frame's bottom edge fades out on the scene itself (a mask), not under a layer laid over it: the laptop's
     screen is a 3D layer the browser draws over anything above, so an overlay left it with a hard edge */
  --mask: linear-gradient(
    #000 calc(var(--frame-b) - var(--frame-f, 0px)),
    rgba(0, 0, 0, .9) calc(var(--frame-b) - var(--frame-f, 0px) * .8),
    rgba(0, 0, 0, .65) calc(var(--frame-b) - var(--frame-f, 0px) * .6),
    rgba(0, 0, 0, .35) calc(var(--frame-b) - var(--frame-f, 0px) * .4),
    rgba(0, 0, 0, .12) calc(var(--frame-b) - var(--frame-f, 0px) * .2),
    transparent var(--frame-b));
  -webkit-mask-image: var(--mask);
  mask-image: var(--mask);
}

/* The camera: main.js (camera) moves it between the shots — onto the screen, Mirai's orb, the photo — as a Web
   Animation of its transform. Its own GPU layer only while it moves (smooth, no re-rasterising every frame); dropped
   after, so the screen is redrawn sharp at the new size. */
.zoom {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
}
.zoom.is-moving { will-change: transform; }
/* Desktop: the photo's bottom edge always fades into the black — a mask on the photo itself (it moves and scales with
   the camera; an overlay laid on it could end up under other layers and leave a hard edge). 260 px of the 1920 px
   photo: the laptop's base and below, never its screen. Phones: the frame's own fade (.is-framed). */
@media (min-width: 761px) {
  .video {
    --mask: linear-gradient(
      #000 calc(100% - 260px),
      rgba(0, 0, 0, .9) calc(100% - 208px),
      rgba(0, 0, 0, .65) calc(100% - 156px),
      rgba(0, 0, 0, .35) calc(100% - 104px),
      rgba(0, 0, 0, .12) calc(100% - 52px),
      transparent 100%);
    -webkit-mask-image: var(--mask);
    mask-image: var(--mask);
  }
}

.video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* When the footage can't cover the window (narrow / tall screens: black above and below it), its top and bottom
   edges fade into the black instead of ending in a hard line. The fades sit on the footage itself (inside .zoom),
   so they move and scale with it as the camera moves (main.js: fit sets .has-bars). */
.fade {
  position: absolute;
  left: -2px;
  right: -2px;
  height: 260px;
  pointer-events: none;
  display: none;
}
.has-bars .fade { display: none; } /* (the bottom fade is now the mask on the photo: .video) */
.fade--top { display: none !important; } /* the footage is held against the top: no fade up there */
.fade--top    { top: -1px;    background: linear-gradient(0deg, var(--fade-stops)); }
.fade--bottom { bottom: -1px; background: linear-gradient(180deg, var(--fade-stops)); }

/* Darkens the photo a little (the dimming under the headline is .dim, over the whole picture) */
.scrim {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: .18;
}

/* ───────────── Laptop screen ───────────── */

/* The 1512 × 993 desktop page, mapped onto the laptop's screen in the photo by main.js (matrix3d) */
.screen {
  position: absolute;
  left: 0;
  top: 0;
  width: 1512px;
  height: 993px;
  transform-origin: 0 0;
  pointer-events: none;
  overflow: hidden;
  /* Display corners (r 25). A mask, not border-radius: under the 3D transform border-radius clips the iframe with
     hard, jagged corners; the mask is drawn as an image, slightly feathered, so they stay smooth at any zoom. */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1512' height='993'%3E%3Cfilter id='f'%3E%3CfeGaussianBlur stdDeviation='1'/%3E%3C/filter%3E%3Crect x='1' y='1' width='1510' height='991' rx='25' filter='url(%23f)'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1512' height='993'%3E%3Cfilter id='f'%3E%3CfeGaussianBlur stdDeviation='1'/%3E%3C/filter%3E%3Crect x='1' y='1' width='1510' height='991' rx='25' filter='url(%23f)'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}

.screen__desktop {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: linear-gradient(#c5d2d6, #a19583 50%, #a99782); /* the wallpaper's colours: no black flashes while it loads or moves */
}

/* The camera: a pill at the top centre instead of a notch (Figma "eye" 865:3806) */
.screen__notch {
  position: absolute;
  left: calc(50% - .25px);
  top: 12.77px;
  width: 57.51px;
  height: 33.55px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #000;
}

/* ───────────── Vignette + eyelids ───────────── */

.vignette {
  position: absolute;
  left: -603.24px;
  top: -313.97px;
  width: 2682.5px;
  height: 1651.9px;
  pointer-events: none;
}

/* A soft black ellipse (was: a black ellipse under filter: blur(72px) — far too heavy to redraw while the camera
   moves). Same footprint: the box is 144 px bigger all round, the softness is in the gradient. */
.lid {
  position: absolute;
  left: -396px;
  width: 2232px;
  height: 1192px;
  margin-top: -144px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 1) 50.00%, rgba(0, 0, 0, 0.99) 53.34%, rgba(0, 0, 0, 0.96) 56.66%, rgba(0, 0, 0, 0.92) 60.00%, rgba(0, 0, 0, 0.85) 63.34%, rgba(0, 0, 0, 0.77) 66.66%, rgba(0, 0, 0, 0.67) 70.00%, rgba(0, 0, 0, 0.56) 73.34%, rgba(0, 0, 0, 0.44) 76.66%, rgba(0, 0, 0, 0.33) 80.00%, rgba(0, 0, 0, 0.23) 83.34%, rgba(0, 0, 0, 0.15) 86.66%, rgba(0, 0, 0, 0.08) 90.00%, rgba(0, 0, 0, 0.04) 93.33%, rgba(0, 0, 0, 0.01) 96.67%, rgba(0, 0, 0, 0) 100.00%);
  pointer-events: none;
  will-change: transform;
  transition: transform 800ms cubic-bezier(.3, 0, .2, 1);
}

/* a tall (portrait) window on a computer: none of it, as on phones (main.js: fit) */
.is-tall .stage { display: none; }
/* Resting position = Figma's "zoom" frame (lids just peeking in); parked further out until then */
.lid--top    { display: none; } /* no darkening under the header: it showed up as a stray gradient */
.lid--bottom { top: 830px;   transform: translateY(460px); }

.is-zoomed .lid { transform: none; transition-duration: var(--t-zoom); transition-timing-function: var(--ease); }

/* ───────────── Type ───────────── */

.headline {
  position: absolute;
  left: 0;
  width: 100%;
  margin: 0;
  padding: 0 16px;
  font-family: var(--sf);
  font-weight: 590;
  line-height: 1;
  letter-spacing: -.03em;
  text-align: center;
  color: #fff;
}

.headline {
  top: calc(50% - 1.35em); /* two 1em lines: a touch above the exact centre (50% - 1em) */
  font-size: clamp(30px, 5vw, 72px);
  opacity: 0;
  transform: scale(.9);
  transition: opacity 500ms ease, transform 500ms ease;
}
.is-loaded .headline {
  opacity: 1;
  transform: scale(1);
  transition: opacity 1100ms ease 500ms, transform 1500ms cubic-bezier(.16, 1, .3, 1) 500ms;
}
.is-loaded.is-open .headline {
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 450ms ease, transform 600ms ease;
}

/* Layering: the subtitles sit above the eyelids (their soft edges would dim them) */
.stage { z-index: 2; }
.headline, .voice { z-index: 3; }

/* While the headline is up the whole picture is dimmed; it comes up out of the dark with the push-in (main.js: is-zoomed) */
.dim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #000;
  opacity: .72; /* was .6: a little darker, so the headline reads over any of the photos */
  pointer-events: none;
}
.is-zoomed .dim { opacity: 0; transition: opacity var(--t-zoom) var(--ease); }

/* Dark fade at the bottom, under the subtitles (Figma "image 57": 322 of 1000 px) */
.shade {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  height: 32.2%;
  background: linear-gradient(180deg, var(--fade-stops));
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms ease;
}
.is-lit .shade { opacity: .5; }

/* Darker at the left and right edges: the chapters on the left read better, the laptop stays in focus */
.edges {
  position: absolute;
  z-index: 2;
  inset: 0;
  background:
    linear-gradient(270deg, var(--fade-stops)) left / 24% 100% no-repeat,
    linear-gradient(90deg, var(--fade-stops)) right / 24% 100% no-repeat;
  opacity: .6;
  pointer-events: none;
}

/* Subtitles (Figma 839:17491, without the black box): Geist Bold 30 px on the 1440 frame; low on the screen */
.voice {
  position: absolute;
  left: 0;
  top: calc(100% - 65px); /* held by its centre: one line or two, every phrase has the same middle */
  translate: 0 -50%;
  width: 100%;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  opacity: 0;
  transition: opacity 160ms ease; /* the outgoing phrase clears quickly… */
  pointer-events: none;
}
.voice.is-on { opacity: 1; transition: opacity 250ms ease 160ms; } /* …before the next one comes in: never two at once */
/* once she's finished, the phrase stays up, dimmed, until the next one (its letters stay lit) */
.voice.is-said { opacity: .4; transition: opacity 500ms ease; }
.voice.is-said .ch { color: #fff; transition: none; }

/* Phones: bigger, and always in the same place — low on the screen, in the dark under the laptop; the opening
   line too */
@media (max-width: 760px) {
  .voice { top: 84%; top: calc(var(--top, 120px) + 100dvh * .84); } /* of the visible height, never under the bottom bar */
  :root { --voice-size: 30px; } /* the subtitles and the end card alike */
  .headline { top: 50%; top: calc(var(--top, 120px) + 50dvh); translate: 0 -50%; } /* in the middle of what's on screen, as on desktop */
}

.voice__box {
  display: inline-block;
  max-width: 100%;
  padding: 10px;
  font-family: "Geist", var(--sf);
  text-shadow: 0 1px 18px rgba(0, 0, 0, .55); /* no box: a soft shadow keeps it readable over the picture */
  font-weight: 700;
  font-size: var(--voice-size);
  line-height: 1;
  letter-spacing: -.03em;
  text-wrap: balance;
  color: #fff;
}
/* a small mic before her words: she's talking to her Mac, not typing */
.voice__box::before {
  content: "";
  display: inline-block;
  width: .55em;
  height: .8em;
  margin-right: .4em;
  vertical-align: -.06em;
  background: #fff;
  /* no opacity of its own: once the phrase is said and dimmed, the mic dims exactly as the words do */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 20'%3E%3Crect x='3' y='0' width='8' height='13' rx='4'/%3E%3Cpath d='M1 9a6 6 0 0 0 12 0M7 15v5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 20'%3E%3Crect x='3' y='0' width='8' height='13' rx='4'/%3E%3Cpath d='M1 9a6 6 0 0 0 12 0M7 15v5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* while she speaks the mic flickers unevenly (opacity only), like a level meter picking up a voice */
.voice.is-on .voice__box::before { animation: mic-voice 1.1s linear infinite; }
@keyframes mic-voice {
  0%   { opacity: .45; }
  12%  { opacity: 1; }
  24%  { opacity: .6; }
  38%  { opacity: .95; }
  50%  { opacity: .5; }
  63%  { opacity: 1; }
  77%  { opacity: .7; }
  88%  { opacity: .9; }
  100% { opacity: .45; }
}
@media (prefers-reduced-motion: reduce) { .voice.is-on .voice__box::before { animation: none; } }
.voice--mirai { --t-char: 40ms; } /* Mirai answers a little faster than she speaks */

/* Lights up letter by letter, as if the words are being transcribed while spoken.
   main.js wraps every character in <span class="ch" style="--i: index">; the letters dim again only once the box has faded */
.voice__text .ch {
  color: rgba(255, 255, 255, .3);
  transition: color 0s linear 200ms;
}
.voice.is-on .ch.lit { color: #fff; transition: color 60ms linear; } /* lit by the clock (main.js: render) */

/* The logo: a dip to black while everything goes back to the first frame (main.js: startOver) */
.hero::after {
  content: "";
  position: absolute;
  z-index: 9; /* over everything but the nav */
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1400ms ease; /* out of the black like the scene at the start (.is-loaded .scene) */
}
.hero.is-cut::after { opacity: 1; transition: opacity 450ms ease; }

/* ───────────── Debug (?state=…): jump to a state without animation ───────────── */

.no-anim *, .no-anim *::before, .no-anim *::after {
  transition: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  :root { --t-zoom: 600ms; }
  .headline { transform: none !important; }
}

/* ───────────── The end card (main.js: is-end): "Meet Mirai." and the sign-up over the dimmed picture ───────────── */

.endcard {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transform: scale(.97);
  transition: opacity 400ms ease, transform 400ms ease, visibility 0s linear 400ms;
}
.is-end .endcard {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 1200ms ease 900ms, transform 1600ms cubic-bezier(.16, 1, .3, 1) 900ms, visibility 0s;
}
.is-end .dim { opacity: .72; transition: opacity 1600ms ease; }
.is-end .voice { opacity: 0; }

.endcard__title,
.endcard__sub {
  /* the same type as the subtitles all through the scene (.voice__box) */
  margin: 0;
  font-family: "Geist", var(--sf);
  font-weight: 700;
  font-size: var(--voice-size);
  line-height: 1.15;
  letter-spacing: -.03em;
}
.endcard__sub { margin: 0 0 32px; }
.endcard.is-queued .endcard__title, .endcard.is-queued .endcard__sub { display: none; } /* signed up: the queue instead */
/* never under the chapters on the left (they reach ~280 px in): narrower windows get a narrower form */
.endcard__form { width: 100%; max-width: min(620px, calc(100vw - 580px)); min-width: min(100%, 340px); }
/* when the fields and the button don't fit on one line, the button goes under them, full width */
.endcard__fields { display: flex; flex-wrap: wrap; gap: 10px; }
.endcard__pill {
  flex: 3 1 460px;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 52px;
  border-radius: 40px;
  background: rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: background-color 150ms ease;
}
.endcard__pill:focus-within { background: rgba(255, 255, 255, .18); }
.endcard__input {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0 22px;
  border: 0;
  border-radius: 40px;
  background: none;
  color: #fff;
  font: 500 16px/1 var(--inter); /* 16 px: iOS doesn't zoom in on focus */
  outline: none;
}
.endcard__input::placeholder { color: rgba(255, 255, 255, .5); }
.endcard__split { flex: none; align-self: stretch; width: 1px; background: rgba(0, 0, 0, .1); } /* full height */
.endcard__input[name=name] { flex-grow: .9; } /* the name 10 % shorter than the email */
.endcard__input[name=x] { flex-grow: .9; }
.endcard__submit {
  flex: 1 0 auto;
  height: 52px;
  padding: 0 28px;
  border: 0;
  border-radius: 40px;
  background: #fff;
  color: #000;
  font: 600 16px/1 var(--inter);
  letter-spacing: -.28px;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.endcard__submit:hover { opacity: .9; }
.endcard__submit:disabled { opacity: .5; cursor: default; }
.endcard__error { min-height: 20px; margin: 10px 0 0; font-size: 14px; color: #ff8a80; }
.endcard__fields[hidden] { display: none; }
/* three fields in a row need room: the form a bit wider on wide windows */
@media (min-width: 1101px) { .endcard__form { max-width: min(760px, calc(100vw - 580px)); } }
@media (max-width: 760px) {
  /* phones: in the visible part of the screen, the fields stacked */
  .endcard { top: var(--top, 120px); bottom: auto; height: 100dvh; }
  /* typing in the end card's form: it sits in the middle of what's visible above the keyboard, whatever the phone
     has done with the page meanwhile */
  html.is-typing .endcard {
    transition: top 280ms ease, height 280ms ease;
    position: fixed;
    z-index: 20;
    top: var(--vv-top, 0px);
    height: var(--vv-h, 100%);
    background: rgba(0, 0, 0, .55);
  }
  .endcard__sub { margin-bottom: 28px; }
}
/* phones and narrower computer windows: name, email, X stacked (one field, three rows), the button under them */
@media (max-width: 1100px) {
  .endcard__form { max-width: 420px; }
  .endcard__fields { flex-direction: column; }
  .endcard__pill { flex: none; flex-direction: column; height: auto; border-radius: 26px; }
  .endcard__input { flex: none; width: 100%; height: 52px; }
  .endcard__split { width: 100%; height: 1px; }
  .endcard__submit { flex: none; }
}

/* ───────────── After signing up: the place in the queue + the invite link (signup.js: done) ───────────── */

.queue { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.queue[hidden], .queue [hidden] { display: none; }
.queue__place { margin: 0; font-family: var(--sf); font-size: 26px; font-weight: 600; letter-spacing: -.02em; color: #fff; } /* in the dialog: its title */
.queue__text, .queue__friends { margin: 0; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, .6); }
.queue__friends { color: rgba(255, 255, 255, .85); }
.queue__link {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 4px 0 16px;
  border-radius: 40px;
  background: rgba(255, 255, 255, .12);
}
.queue__url {
  flex: 1 1 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font: 500 15px/1 var(--inter);
  text-overflow: ellipsis;
  outline: none;
}
.queue__copy {
  flex: none;
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 40px;
  background: #fff;
  color: #000;
  font: 600 14px/1 var(--inter);
  letter-spacing: -.2px;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.queue__copy:hover { opacity: .9; }
/* "Copy link" ⇄ "Copied!": both labels in one grid cell (the button keeps the wider one's width, nothing jumps);
   the old one slides up and fades, the new one comes up from below; a little press on the click */
.queue__copy { display: inline-grid; place-items: center; overflow: hidden; transition: opacity 150ms ease, transform 200ms cubic-bezier(.2, .9, .3, 1.4); }
.queue__copy:active { transform: scale(.96); }
.queue__copy-a, .queue__copy-b {
  grid-area: 1 / 1;
  transition: opacity 260ms ease, transform 360ms cubic-bezier(.16, 1, .3, 1), filter 260ms ease;
}
.queue__copy-b { opacity: 0; transform: translateY(70%); filter: blur(2px); }
.queue__copy.is-copied .queue__copy-a { opacity: 0; transform: translateY(-70%); filter: blur(2px); }
.queue__copy.is-copied .queue__copy-b { opacity: 1; transform: none; filter: none; }
@media (prefers-reduced-motion: reduce) { .queue__copy-a, .queue__copy-b { transform: none !important; filter: none !important; } }
/* on the end card: centred, the place in the same big type as the headline above */
.queue--end { align-items: center; text-align: center; gap: 14px; }
.queue--end .queue__place { font-family: "Geist", var(--sf); font-weight: 700; font-size: var(--voice-size); line-height: 1.15; letter-spacing: -.03em; }
.queue--end .queue__text, .queue--end .queue__friends { max-width: 460px; font-size: 17px; }
.queue--end .queue__link { width: 100%; max-width: 460px; height: 52px; padding-left: 22px; -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.queue--end .queue__copy { height: 44px; padding: 0 22px; font-size: 15px; }

/* ───────────── Sign-up dialog (signup.js) ───────────── */

.signup {
  position: fixed;
  z-index: 50;
  /* the part of the screen that's actually visible (above the keyboard on phones): main.js sets --vv-top / --vv-h */
  left: 0;
  right: 0;
  top: var(--vv-top, 0px);
  height: var(--vv-h, 100%);
  transition: top 280ms ease, height 280ms ease; /* glides along as the keyboard comes up and goes down */
  display: grid;
  place-items: center;
  padding: 16px;
  /* no opacity on this container: it would make the blurs below see only what's inside it, not the page */
}
.signup[hidden] { display: none; }
.signup__backdrop {
  /* transparent: only there to close the window with a tap beside it. The page is darkened on the page itself
     (below: html.has-dialog) — a fixed layer isn't drawn under the browser's own header (Telegram, Safari), the page
     scrolled up under it is */
  position: fixed;
  inset: 0;
}

/* A dialog open: the page itself dims — the scene (which runs on up under the browser's header), the header's logo and
   button, the chapters */
.hero::before {
  content: "";
  position: absolute;
  z-index: 8; /* over the scene and the end card, under the dip to black (.hero::after) */
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
html.has-dialog .hero::before { opacity: .65; }
/* the scene: by its own brightness, not a layer on top — the laptop's screen is a 3D layer drawn over anything above */
html.has-dialog .scene { filter: brightness(.35); }
.is-loaded .scene { transition: opacity 1400ms ease, filter 250ms ease; }
.nav { transition: filter 250ms ease; }
.chapters { transition: opacity 1400ms ease, filter 250ms ease; } /* (keeps its own fade-in) */
html.has-dialog .nav, html.has-dialog .chapters { filter: brightness(.35); }

.signup__card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 36px 28px 28px;
  border-radius: 28px;
  /* glass, like Mirai's orb: see-through, the page behind it blurred, light caught softly along the top edge and a
     little along the bottom — no outline */
  background: rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow:
    inset 0 1.5px 2px -1px rgba(255, 255, 255, .35),
    inset 0 -1.5px 3px -1px rgba(255, 255, 255, .12),
    0 30px 80px rgba(0, 0, 0, .35);
  opacity: 0;
  transition: opacity 250ms ease; /* only a fade: moving glass would redraw its blur every frame */
}
.signup.is-open .signup__card { opacity: 1; }
.signup__form, .signup__done { display: flex; flex-direction: column; gap: 12px; }
.signup__form[hidden], .signup__done[hidden] { display: none; }

.signup__close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: rgba(255, 255, 255, .5);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.signup__close:hover { color: #fff; }

.signup__icon { display: block; width: 48px; height: 48px; margin: -8px 0 0 -6px; } /* the glyph sits inset in its 48 px box: lined up with the text's edge */
.signup__title { margin: 0; font-family: var(--sf); font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.signup__text { margin: 0 0 8px; font-size: 15px; line-height: 1.45; color: rgba(255, 255, 255, .6); }

.signup__input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 14px;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font: 500 16px/1 var(--inter); /* 16 px: iOS doesn't zoom in on focus */
  outline: none;
  transition: border-color 150ms ease;
}
.signup__input::placeholder { color: rgba(255, 255, 255, .4); }
.signup__input:focus { background: rgba(255, 255, 255, .2); }
/* name and email as one group: 1 px apart, square where they meet, round only at the outer corners */
.signup__input[name=name] { border-radius: 14px 14px 0 0; }
.signup__input[name=email] { border-radius: 0; margin-top: -11px; } /* the form's 12 px gap → 1 px */
.signup__input[name=x] { border-radius: 0 0 14px 14px; margin-top: -11px; }

.signup__error { min-height: 18px; margin: -4px 0 0; font-size: 13px; color: #ff8a80; }
.signup__error:empty { min-height: 0; margin: 0; }

.signup__submit {
  height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 40px;
  background: #fff;
  color: #000;
  font: 600 15px/1 var(--inter);
  letter-spacing: -.28px;
  cursor: pointer;
  transition: opacity 150ms ease;
}
.signup__submit:hover { opacity: .9; }
.signup__submit:disabled { opacity: .5; cursor: default; }
