:root {
  --bg: #050505;
  --ink: #e9e6df;
  --dim: rgba(233, 230, 223, 0.42);
  --faint: rgba(233, 230, 223, 0.16);
  --red: #b3342f;
  --sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; }
body {
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: default;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
::selection { background: transparent; }

/* ---------- atmosphere ---------- */
#dust, #grain, #light, #vignette { position: fixed; inset: 0; pointer-events: none; }
#dust { width: 100%; height: 100%; opacity: 0.8; }
#grain { opacity: 0.07; background-size: 200px 200px; mix-blend-mode: screen; }
#light {
  background: radial-gradient(520px circle at var(--x, 50%) var(--y, 50%), rgba(233, 230, 223, 0.045), transparent 60%);
}
#vignette { background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.85) 100%); transition: background 4s; }
body.late #vignette { background: radial-gradient(ellipse at center, transparent 30%, rgba(30, 0, 0, 0.55) 80%, rgba(0, 0, 0, 0.92) 100%); }

/* ---------- stage ---------- */
#stage {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.35em;
  padding: 0 24px;
  text-align: center;
}
.line {
  font-weight: 200;
  font-size: clamp(26px, 4.2vw, 52px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  max-width: 16em;
  white-space: pre-wrap;
}
.line.quiet { font-size: clamp(16px, 2vw, 21px); color: rgba(233, 230, 223, 0.32); letter-spacing: 0.02em; }
.line.small { font-size: clamp(19px, 2.8vw, 32px); color: var(--dim); }
.line.heavy { font-weight: 200; font-size: clamp(40px, 7vw, 88px); letter-spacing: -0.04em; }
.line.mono { font-size: clamp(15px, 1.8vw, 18px); letter-spacing: 0.2em; color: var(--dim); }

.c { display: inline-block; white-space: pre; will-change: opacity, filter, transform; }
.w { display: inline-block; white-space: nowrap; }
.em { font-weight: 300; color: #fff; }

/* letters surface from a soft blur */
.c.b { opacity: 0; filter: blur(6px); transform: translateY(0.06em); transition: opacity 1.2s ease, filter 1.4s ease, transform 1.6s ease; }
.c.b.on { opacity: 1; filter: blur(0); transform: none; }

/* whole line exhales into place */
.drift { opacity: 0; filter: blur(5px); letter-spacing: 0.03em; transition: opacity 1.8s ease, filter 2s ease, letter-spacing 2.6s cubic-bezier(.2,.7,.2,1); }
.drift.on { opacity: 1; filter: none; letter-spacing: -0.02em; }
.drift.slow { transition-duration: 2.6s, 2.8s, 3.4s; }
.heavy.drift.on { letter-spacing: -0.04em; }

/* quiet typing */
.c.ty { opacity: 0; transition: opacity 0.4s ease; }
.c.ty.on { opacity: 1; }

/* words */
.w.wd { opacity: 0; filter: blur(5px); transform: translateY(0.05em); transition: opacity 1s ease, filter 1.2s ease, transform 1.4s ease; }
.w.wd.on { opacity: 1; filter: none; transform: none; }

/* fade out */
.c.out, .w.out {
  opacity: 0 !important; filter: blur(6px) !important;
  transform: translateY(-0.15em) !important;
  transition: opacity 1s ease, filter 1s ease, transform 1.2s ease !important;
}
.fade-out { opacity: 0 !important; filter: blur(6px) !important; transition: opacity 1s ease, filter 1s ease !important; }

/* ---------- gate ---------- */
#gate {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px;
  transition: opacity 1.4s;
}
#gate.gone { opacity: 0; pointer-events: none; }
#orb { width: 90px; height: 90px; display: grid; place-items: center; position: relative; }
#orb span {
  width: 7px; height: 7px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 18px 3px rgba(255, 255, 255, 0.55), 0 0 60px 10px rgba(255, 255, 255, 0.12);
  animation: breathe 3.4s ease-in-out infinite;
}
#orb::before, #orb::after {
  content: ''; position: absolute; inset: 37px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35);
  animation: ripple 3.4s ease-out infinite;
}
#orb::after { animation-delay: 1.7s; }
#orb:hover span { transform: scale(1.4); }
#orb.taken span { animation: none; transform: scale(60); opacity: 0; transition: transform 1.6s cubic-bezier(.6,0,.2,1), opacity 1.6s; }
@keyframes breathe { 50% { transform: scale(0.7); opacity: 0.7; } }
@keyframes ripple { from { inset: 40px; opacity: 0.7; } to { inset: -20px; opacity: 0; } }
/* ---------- whisper ---------- */
#whisper {
  position: fixed; left: 0; right: 0; bottom: max(64px, 9vh); text-align: center;
  font-family: var(--sans); font-weight: 300; font-size: 15px; letter-spacing: 0.02em; color: var(--dim);
  opacity: 0; filter: blur(6px); transition: opacity 0.8s, filter 0.8s; pointer-events: none;
}
#whisper.on { opacity: 1; filter: none; }

/* ---------- inputs ---------- */
.field { position: relative; margin-top: 1.6em; width: min(420px, 82vw); opacity: 0; transform: translateY(8px); transition: opacity 1s, transform 1s; }
.field.on { opacity: 1; transform: none; }
.field input {
  width: 100%; background: transparent; border: 0; outline: 0;
  color: var(--ink); caret-color: #fff; text-align: center;
  font-family: var(--sans); font-weight: 300; font-size: 22px; letter-spacing: 0.04em;
  padding: 10px 0 12px; user-select: text; -webkit-user-select: text;
}
.field input[type=password] { letter-spacing: 0.3em; font-size: 20px; }
.field input::placeholder { color: var(--faint); }
.field .rule { position: absolute; left: 50%; bottom: 0; height: 1px; width: 0; background: linear-gradient(90deg, transparent, var(--dim), transparent); transition: width 1.6s cubic-bezier(.2,.7,.1,1), background 0.4s; transform: translateX(-50%); }
.field.on .rule { width: 100%; }
.field.err .rule { background: linear-gradient(90deg, transparent, var(--red), transparent); }
.field.err { animation: nope 0.4s; }
@keyframes nope { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.field .hint { margin-top: 14px; font-size: 12px; letter-spacing: 0.04em; color: var(--faint); min-height: 1em; }

/* ---------- choice ---------- */
.choice { display: flex; gap: 56px; margin-top: 2em; font-size: 16px; font-weight: 300; letter-spacing: 0.06em; }
.choice button { padding: 12px 6px; color: var(--dim); opacity: 0; filter: blur(8px); transition: opacity 1.2s, filter 1.2s, color 0.4s, text-shadow 0.4s; }
.choice.on button { opacity: 1; filter: none; }
.choice button.yes:hover { color: #fff; }
.choice button.no.gone { opacity: 0 !important; filter: blur(14px) !important; transform: translateY(-6px); transition: all 1.4s; pointer-events: none; }

/* ---------- waiting ---------- */
.wait { display: flex; flex-direction: column; align-items: center; gap: 22px; opacity: 0; transition: opacity 2.4s; }
.wait.on { opacity: 1; }
.ringwrap { position: relative; width: min(340px, 74vw); aspect-ratio: 1; }
.ringwrap svg { width: 100%; height: 100%; overflow: visible; }
.ring-base { fill: none; stroke: var(--faint); stroke-width: 0.4; }
.ring-inner { fill: none; stroke: rgba(233, 230, 223, 0.1); stroke-width: 0.35; stroke-dasharray: 0.6 3.2; }
.ring-orbit circle { fill: #fff; filter: drop-shadow(0 0 3px #fff); }
.tick { stroke: var(--faint); stroke-width: 0.8; stroke-linecap: round; transition: stroke 1.6s, filter 1.6s; }
.tick.on { stroke: rgba(233, 230, 223, 0.7); }
.tick.me { stroke: #fff; filter: drop-shadow(0 0 2.5px #fff); animation: me 4.8s ease-in-out infinite; }
@keyframes me { 50% { opacity: 0.35; } }
@keyframes spin { to { transform: rotate(360deg); } }
.numeral {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: clamp(50px, 10vw, 84px); font-weight: 200; letter-spacing: 0.02em;
  text-shadow: 0 0 40px rgba(255, 255, 255, 0.15);
}
.numeral small { display: block; font-size: 12px; font-weight: 300; letter-spacing: 0.12em; color: var(--dim); text-align: center; margin-top: 6px; }
.who { font-size: 13px; font-weight: 300; letter-spacing: 0.1em; color: var(--dim); }
.status { font-weight: 300; font-size: 19px; letter-spacing: -0.01em; min-height: 1.3em; color: var(--ink); }
.broadcast {
  max-width: min(560px, 88vw); font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em; line-height: 1.7;
  color: #fff; padding: 14px 18px; border: 1px solid var(--faint); word-break: break-all; cursor: copy;
  user-select: text; -webkit-user-select: text;
}
.broadcast:empty { display: none; }
.ring-inner, .ring-orbit { transition: opacity 1.4s; }
.tick.seat { stroke: rgba(233, 230, 223, 0.26); }

/* ---------- the call: ring → clock ---------- */
.clock { opacity: 0; transition: opacity 1.6s; }
.calling .clock { opacity: 1; }
.calling .ring-inner, .calling .ring-orbit { opacity: 0; }
.hour { fill: var(--dim); opacity: 0; transition: opacity 0.9s; }
.calling .hour { opacity: 1; }
.time-arc { fill: none; stroke: rgba(233, 230, 223, 0.7); stroke-width: 0.7; stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 3s; }
.time-arc.drawing { transition: stroke-dashoffset 2.4s cubic-bezier(.2,.7,.2,1), stroke 3s; }
.low .time-arc { stroke: rgba(179, 52, 47, 0.85); }
.hand { stroke: rgba(233, 230, 223, 0.6); stroke-width: 0.6; stroke-linecap: round; }
.hub { fill: var(--dim); }
.numeral .roman, .numeral .count { grid-area: 1 / 1; text-align: center; transition: opacity 1.2s, filter 1.2s; }
.numeral .count { opacity: 0; filter: blur(6px); font-size: clamp(26px, 5.4vw, 40px); font-weight: 200; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.numeral .count span { display: block; }
.calling .numeral .roman { opacity: 0; filter: blur(6px); }
.calling .numeral .count { opacity: 1; filter: none; }
.answer { height: 46px; display: grid; place-items: center; }
.answer button { opacity: 0; filter: blur(6px); pointer-events: none; font-size: 18px; font-weight: 300; letter-spacing: 0.02em; color: var(--dim); padding: 10px 22px; transition: opacity 1.4s, filter 1.4s, color 0.4s; }
.answer.on button { opacity: 1; filter: none; pointer-events: auto; }
.answer button:hover { color: #fff; }

.leave { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); font-size: 12px; font-weight: 300; letter-spacing: 0.1em; color: var(--faint); transition: color 0.4s; }
.leave:hover { color: var(--dim); }

/* ---------- corners ---------- */
#key {
  position: fixed; top: max(20px, env(safe-area-inset-top)); right: 22px; z-index: 6;
  width: 40px; height: 40px; opacity: 0; transition: opacity 2s, filter 0.5s;
}
#key.on { opacity: 0.4; }
#key.on:hover { opacity: 1; filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.45)); }
#key svg { width: 100%; height: 100%; overflow: visible; }
#key .k-ring { fill: none; stroke: var(--faint); stroke-width: 0.8; }
#key .k-ring2 { fill: none; stroke: #fff; stroke-width: 0.9; stroke-dasharray: 116.3; stroke-dashoffset: 116.3; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 0.9s cubic-bezier(.2,.7,.1,1); }
#key:hover .k-ring2 { stroke-dashoffset: 0; }
#key .k-hole { fill: var(--ink); }
#key.hidden { opacity: 0 !important; pointer-events: none; }

.close { position: fixed; top: max(20px, env(safe-area-inset-top)); left: 22px; z-index: 6; font-size: 12px; font-weight: 300; letter-spacing: 0.1em; color: var(--faint); padding: 10px 4px; transition: color 0.4s; }
.close:hover { color: var(--dim); }

@media (prefers-reduced-motion: reduce) {
  #orb::before, #orb::after { animation: none; }
}
