/* Secret party quest. Colour is the story:
   phosphor green = the machine, neon magenta = Neo-Tokyo night, gold = Max and the people. */

:root {
  --void: #000;
  --phosphor: #4dff9a;
  --neon: #ff3dcb;
  --gold: #ecd364;
  --gold-deep: #cda255;
  --cream: #f2eee3;
  --ash: #8b958f;
  --blue: #4d7cff;
  --accent: var(--phosphor);

  --mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --display: "Anton", "Arial Narrow", Impact, sans-serif;
  --human: "Urbanist", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --jp: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --pad-x: max(22px, env(safe-area-inset-left));
  --top: calc(env(safe-area-inset-top, 0px) + 76px);
  --bottom: calc(env(safe-area-inset-bottom, 0px) + 32px);
}
body.gold {
  --accent: var(--gold);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--void);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--void);
  color: var(--cream);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}

/* ---------- atmosphere ---------- */

#rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.85;
  transition: opacity 1.2s var(--ease);
}
body[data-scene="gate1"] #rain,
body[data-scene="gate2"] #rain,
body[data-scene="gate3"] #rain {
  opacity: 0.32;
}
body[data-scene="memories"] #rain,
body[data-scene="wall"] #rain {
  opacity: 0.22;
}
body[data-scene="invite"] #rain {
  opacity: 0.12;
}
.scan {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.75) 100%),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 3px);
}
.sign {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  top: 50%;
  z-index: 1;
  margin: 0;
  transform: translateY(-50%);
  writing-mode: vertical-rl;
  font-family: var(--jp);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--neon);
  text-shadow: 0 0 6px var(--neon), 0 0 18px rgba(255, 61, 203, 0.6);
  opacity: 0.6;
  animation: neon 9s steps(1) infinite;
  transition: color 1.5s var(--ease), text-shadow 1.5s var(--ease);
}
body.gold .sign {
  color: var(--gold);
  text-shadow: 0 0 6px var(--gold), 0 0 18px rgba(236, 211, 100, 0.55);
}
@keyframes neon {
  0%, 100% { opacity: 0.6; }
  41% { opacity: 0.6; }
  42% { opacity: 0.15; }
  43% { opacity: 0.6; }
  44% { opacity: 0.25; }
  46% { opacity: 0.6; }
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) var(--pad-x) 14px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.95) 55%, transparent);
}
body[data-scene="invite"] .keys {
  opacity: 0;
  transition: opacity 1.2s var(--ease) 1.5s;
}
.keys {
  display: flex;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.key {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border: 1px dashed rgba(139, 149, 143, 0.55);
  border-radius: 50%;
  color: rgba(139, 149, 143, 0.6);
  transition: all 0.5s var(--ease);
}
.key svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.key.got {
  border: 1px solid var(--accent);
  color: #000;
  background: var(--accent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: keyIn 0.6s var(--ease);
}
@keyframes keyIn {
  0% { transform: scale(0.4) rotate(-40deg); }
  70% { transform: scale(1.25); }
  100% { transform: none; }
}
.snd {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(139, 149, 143, 0.45);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: var(--accent);
}
.snd svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.snd .off,
.snd[aria-pressed="false"] .on {
  display: none;
}
.snd[aria-pressed="false"] .off {
  display: inline;
}

/* ---------- scenes ---------- */

main {
  position: relative;
  z-index: 2;
}
.scene {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  width: 100%;
  max-width: 34rem;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  /* extra room on the right for the vertical neon sign */
  padding: var(--top) max(40px, env(safe-area-inset-right)) var(--bottom) var(--pad-x);
}
.scene.in {
  animation: glitchIn 0.5s var(--ease);
}
.scene.out {
  animation: glitchOut 0.3s steps(3) forwards;
}
@keyframes glitchOut {
  0% { clip-path: inset(0 0 0 0); transform: none; opacity: 1; }
  33% { clip-path: inset(14% 0 52% 0); transform: translateX(-10px); }
  66% { clip-path: inset(62% 0 10% 0); transform: translateX(12px); }
  100% { clip-path: inset(50% 0 50% 0); opacity: 0; }
}
@keyframes glitchIn {
  0% { clip-path: inset(48% 0 48% 0); opacity: 0; transform: translateX(8px); }
  35% { clip-path: inset(18% 0 34% 0); opacity: 1; transform: translateX(-5px); }
  100% { clip-path: inset(0 0 0 0); transform: none; }
}

/* the machine's voice; a soft dark halo keeps it readable over the rain */
.term,
.door,
.choice,
.gate-head,
.verse,
.turn,
.reveal:not(:empty),
.slots {
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 36px 26px rgba(0, 0, 0, 0.55);
}
.term p {
  margin: 0 0 6px;
  color: var(--phosphor);
  text-shadow: 0 0 10px rgba(77, 255, 154, 0.35);
}
.term p.big {
  font-family: var(--display);
  font-stretch: normal;
  font-size: clamp(30px, 8vw, 44px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--cream);
  text-shadow: none;
  margin-top: 8px;
}
.term p.name {
  font-family: var(--display);
  font-stretch: normal;
  font-size: clamp(64px, 20vw, 120px);
  line-height: 0.95;
  margin: 0 0 18px;
  color: var(--phosphor);
  text-shadow: -3px 0 var(--neon), 3px 0 rgba(77, 255, 154, 0.45), 0 0 30px rgba(77, 255, 154, 0.35);
  overflow-wrap: anywhere;
}
.term p.soft {
  color: var(--cream);
  text-shadow: none;
  opacity: 0.8;
  margin-top: 10px;
}

.lbl {
  margin: 0;
  color: var(--ash);
  font-size: 13px;
}
.aside {
  margin: 0;
  color: var(--ash);
  font-size: 12px;
  line-height: 1.6;
}
.err {
  min-height: 1.6em;
  margin: 0;
  color: var(--neon);
  font-size: 13px;
}

/* ---------- the door ---------- */

.door {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
}
.door input {
  width: 100%;
  padding: 14px 0 10px;
  border: 0;
  border-bottom: 2px solid rgba(77, 255, 154, 0.4);
  border-radius: 0;
  background: transparent;
  font-family: var(--mono);
  font-stretch: 112.5%;
  font-size: clamp(28px, 9vw, 40px);
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--phosphor);
  caret-color: var(--phosphor);
  text-shadow: 0 0 14px rgba(77, 255, 154, 0.45);
}
.door input::placeholder {
  color: rgba(77, 255, 154, 0.25);
  letter-spacing: 0.2em;
}
.door input:focus {
  outline: none;
  border-bottom-color: var(--phosphor);
}
.shake {
  animation: shake 0.42s;
}
@keyframes shake {
  20% { transform: translateX(-10px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(4px); }
}

/* ---------- buttons ---------- */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  padding: 0 20px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background-color: rgba(0, 0, 0, 0.85);
  background-image: linear-gradient(rgba(77, 255, 154, 0.1), rgba(77, 255, 154, 0.1));
  background-image: linear-gradient(color-mix(in srgb, var(--accent) 12%, transparent), color-mix(in srgb, var(--accent) 12%, transparent));
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}
.btn:active {
  background: var(--accent);
  background-image: none;
  color: #000;
  transform: scale(0.985);
}
.btn:disabled {
  opacity: 0.5;
}
.btn.ghost {
  border-color: rgba(139, 149, 143, 0.45);
  background: transparent;
  color: var(--cream);
}
.btn.gold {
  border-color: var(--gold);
  background: var(--gold);
  color: #120f05;
  font-family: var(--human);
  font-size: 17px;
  font-weight: 700;
}
.btn.gold:active {
  background: var(--gold-deep);
}

/* ---------- the pills ---------- */

.choice {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 30px;
}
.pills {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 54px;
}
.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 0;
  background: none;
  color: var(--cream);
  transition: opacity 0.7s var(--ease), filter 0.7s var(--ease), transform 0.7s var(--ease);
}
.capsule {
  position: relative;
  display: block;
  width: 76px;
  height: 30px;
  border-radius: 999px;
  transform: rotate(-24deg);
  animation: float 4.5s ease-in-out infinite;
}
.pill-red .capsule {
  background: linear-gradient(160deg, #ff8fa0, #ff2a3d 42%, #7a0a18);
  box-shadow: 0 0 26px rgba(255, 42, 61, 0.65), inset 0 -4px 8px rgba(0, 0, 0, 0.35);
}
.pill-blue .capsule {
  background: linear-gradient(160deg, #a9c1ff, var(--blue) 42%, #14246b);
  box-shadow: 0 0 22px rgba(77, 124, 255, 0.5), inset 0 -4px 8px rgba(0, 0, 0, 0.35);
  animation-delay: -2.2s;
}
.capsule::after {
  content: "";
  position: absolute;
  inset: 4px 14px auto;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
}
@keyframes float {
  50% { transform: rotate(-24deg) translateY(-6px); }
}
.pill-cap {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 13px;
  color: var(--cream);
  border-bottom: 1px solid rgba(255, 42, 61, 0.6);
  padding-bottom: 2px;
}
.pill:active .capsule {
  transform: rotate(-24deg) scale(0.92);
}
.pill.melt {
  opacity: 0.08;
  filter: blur(4px) grayscale(1);
  transform: translateY(20px) scaleY(0.5);
}
.choice .aside {
  text-align: center;
  min-height: 3.2em;
}

/* ---------- gates ---------- */

.gate-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gate-n {
  margin: 0;
  color: var(--ash);
  font-size: 12px;
}
.gate-t {
  position: relative;
  margin: 0;
  font-family: var(--display);
  font-stretch: normal;
  font-weight: 400;
  font-size: clamp(64px, 19vw, 104px);
  line-height: 0.95;
  color: var(--cream);
  text-shadow: -3px 0 var(--neon), 3px 0 rgba(77, 255, 154, 0.55);
}
.verse {
  margin: 0;
  max-width: 34ch;
  color: var(--cream);
  font-family: var(--human);
  font-stretch: normal;
  font-style: italic;
  font-size: 18px;
  line-height: 1.55;
  opacity: 0.9;
}
.reveal {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rv-big {
  margin: 0;
  font-family: var(--display);
  font-stretch: normal;
  font-size: clamp(48px, 15vw, 76px);
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 26px rgba(236, 211, 100, 0.5);
}
.rv-line {
  margin: 0;
  color: var(--cream);
  font-size: 14px;
}
.turn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 1.8em;
}
.dots {
  display: flex;
  gap: 6px;
  margin: 0;
}
.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--ash);
}
.dots i.on {
  background: var(--phosphor);
  border-color: var(--phosphor);
  box-shadow: 0 0 8px var(--phosphor);
}
.hint,
.status {
  min-height: 1.65em;
  margin: 0;
  color: var(--ash);
  font-size: 13px;
}
.got {
  margin: 0;
  color: var(--gold);
  font-size: 16px;
  text-shadow: 0 0 14px rgba(236, 211, 100, 0.4);
}

/* gate 1: tuner */
.tuner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(77, 255, 154, 0.25);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.72);
}
#wave {
  width: 100%;
  height: 110px;
}
.freq {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-family: var(--display);
  font-stretch: normal;
  font-size: 64px;
  line-height: 1;
  color: var(--phosphor);
  font-variant-numeric: tabular-nums;
}
.freq small {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ash);
}
.meter {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 26px;
}
.meter i {
  flex: 1;
  border-radius: 2px;
  background: rgba(139, 149, 143, 0.2);
  transition: background 0.15s;
}
.meter i:nth-child(1) { height: 22%; }
.meter i:nth-child(2) { height: 34%; }
.meter i:nth-child(3) { height: 46%; }
.meter i:nth-child(4) { height: 58%; }
.meter i:nth-child(5) { height: 70%; }
.meter i:nth-child(6) { height: 84%; }
.meter i:nth-child(7) { height: 100%; }
.meter i.on {
  background: var(--phosphor);
  box-shadow: 0 0 8px rgba(77, 255, 154, 0.6);
}
#dial {
  width: 100%;
  height: 44px;
  margin: 4px 0 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
}
#dial::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(77, 255, 154, 0.15), rgba(77, 255, 154, 0.5));
}
#dial::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: rgba(77, 255, 154, 0.35);
}
#dial::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -15px;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 0 1px var(--phosphor), 0 0 18px rgba(77, 255, 154, 0.8);
}
#dial::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border: 2px solid #000;
  border-radius: 50%;
  background: var(--phosphor);
  box-shadow: 0 0 18px rgba(77, 255, 154, 0.8);
}
#dial:disabled::-webkit-slider-thumb {
  background: var(--gold);
  box-shadow: 0 0 0 1px var(--gold), 0 0 22px rgba(236, 211, 100, 0.9);
}

/* gate 2: rhythm pads */
.pads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.pad {
  --c: var(--phosphor);
  aspect-ratio: 1;
  max-height: 34vh;
  border: 1px solid var(--c);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.7);
  background: color-mix(in srgb, var(--c) 7%, rgba(0, 0, 0, 0.75));
  color: var(--c);
  font-family: var(--display);
  font-size: clamp(56px, 16vw, 84px);
  line-height: 1;
  transition: background 0.12s, color 0.12s, box-shadow 0.12s, transform 0.12s;
}
.pad[data-pad="1"] { --c: var(--neon); }
.pad[data-pad="2"] { --c: var(--gold); }
.pad[data-pad="3"] { --c: var(--blue); }
.pad:disabled {
  cursor: default;
  opacity: 0.75;
}
.pad.lit {
  background: var(--c);
  color: #000;
  opacity: 1;
  box-shadow: 0 0 40px var(--c);
  transform: scale(0.97);
}

/* gate 3: cryptex */
.cryptex {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px 10px;
  border: 1px solid rgba(236, 211, 100, 0.35);
  border-radius: 14px;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.95), rgba(20, 17, 6, 0.9) 50%, rgba(0, 0, 0, 0.95));
}
.wheel {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  max-width: 64px;
}
.wheel button {
  height: 40px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold);
  opacity: 0.75;
}
.wheel button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.win {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 132px;
  border-block: 1px solid rgba(236, 211, 100, 0.25);
  overflow: hidden;
  touch-action: none;
  font-family: var(--display);
  user-select: none;
}
.win::before {
  content: "";
  position: absolute;
  inset: 36% 0;
  border-block: 1px solid rgba(236, 211, 100, 0.55);
  background: rgba(236, 211, 100, 0.07);
}
.win span {
  position: relative;
  line-height: 1.05;
  transition: transform 0.18s var(--ease);
}
.win .side {
  font-size: 20px;
  color: rgba(242, 238, 227, 0.25);
}
.win .cur {
  font-size: 46px;
  color: var(--cream);
}
.win.up span { animation: rollUp 0.18s var(--ease); }
.win.down span { animation: rollDown 0.18s var(--ease); }
@keyframes rollUp {
  from { transform: translateY(24px); opacity: 0.4; }
}
@keyframes rollDown {
  from { transform: translateY(-24px); opacity: 0.4; }
}
.cryptex.open .win .cur {
  color: var(--gold);
  text-shadow: 0 0 18px rgba(236, 211, 100, 0.9);
}
.cryptex.open .wheel {
  animation: glow 0.5s var(--ease) both;
}
.cryptex.open .wheel:nth-child(2) { animation-delay: 0.08s; }
.cryptex.open .wheel:nth-child(3) { animation-delay: 0.16s; }
.cryptex.open .wheel:nth-child(4) { animation-delay: 0.24s; }
.cryptex.open .wheel:nth-child(5) { animation-delay: 0.32s; }
@keyframes glow {
  50% { transform: translateY(-6px); }
}

/* knock knock */
.knock {
  margin-top: 14px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--cream);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 15px;
  opacity: 0.55;
  text-decoration: underline dotted rgba(242, 238, 227, 0.35);
  text-underline-offset: 5px;
}
.knock:disabled {
  opacity: 0.25;
  cursor: default;
}

/* gate III: the race */
.race {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.race-cv {
  display: block;
  width: 100%;
  height: min(54vh, 500px);
  border: 1px solid rgba(255, 61, 203, 0.35);
  border-radius: 12px;
  background: #04030a;
  touch-action: none;
}
.race-ready,
.race-over {
  position: absolute;
  inset: 0 0 auto 0;
  height: min(54vh, 500px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  border-radius: 12px;
  background: rgba(4, 3, 10, 0.72);
  text-align: center;
}
.race-ready .btn,
.race-over .btn {
  width: auto;
  min-width: 180px;
}
.race-big {
  margin: 0;
  font-family: var(--display);
  font-stretch: normal;
  font-size: 84px;
  line-height: 1;
  color: var(--neon);
  text-shadow: 0 0 30px rgba(255, 61, 203, 0.6);
}
.race-big.won {
  color: var(--gold);
  text-shadow: 0 0 30px rgba(236, 211, 100, 0.7);
}
.race-hint {
  max-width: 26ch;
  margin: 0 0 8px;
  color: var(--cream);
  font-family: var(--human);
  font-stretch: normal;
  font-style: italic;
  font-size: 18px;
  line-height: 1.45;
}
.race-ctl {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.ctl {
  display: grid;
  place-items: center;
  min-height: 74px;
  border: 1px solid rgba(255, 61, 203, 0.45);
  border-radius: 14px;
  background: rgba(255, 61, 203, 0.06);
  color: var(--neon);
  touch-action: none;
  -webkit-touch-callout: none;
}
.ctl svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ctl:active,
.ctl.held {
  background: var(--neon);
  color: #000;
  box-shadow: 0 0 26px rgba(255, 61, 203, 0.6);
}

/* gate IV: the falling word */
.slots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 0;
}
.slots span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 52px;
  border-bottom: 2px solid rgba(236, 211, 100, 0.35);
  font-family: var(--display);
  font-stretch: normal;
  font-size: 34px;
  color: rgba(236, 211, 100, 0.3);
}
.slots span.on {
  color: var(--gold);
  border-color: var(--gold);
  text-shadow: 0 0 16px rgba(236, 211, 100, 0.7);
  animation: keyIn 0.4s var(--ease);
}
.fall {
  position: relative;
  height: min(46vh, 420px);
  overflow: hidden;
  border: 1px solid rgba(77, 255, 154, 0.25);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
  touch-action: manipulation;
}
.drop {
  position: absolute;
  top: 0;
  font-family: var(--mono);
  font-size: 20px;
  color: rgba(77, 255, 154, 0.55);
  pointer-events: none;
  will-change: transform;
}
.drop.gold {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-left: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(236, 211, 100, 0.22), transparent 70%);
  font-family: var(--display);
  font-size: 40px;
  color: var(--gold);
  text-shadow: 0 0 14px rgba(236, 211, 100, 0.9);
  pointer-events: auto;
  cursor: pointer;
}
.drop.caught {
  animation: caught 0.32s var(--ease) forwards;
}
@keyframes caught {
  to { opacity: 0; transform: translateY(-40px) scale(1.8); }
}
.fall.still .drop {
  opacity: 0.2;
}

/* gate V: the day lock */
.cryptex.digits .sep {
  align-self: center;
  font-family: var(--display);
  font-size: 40px;
  color: var(--gold);
}

/* a memory between gates */
.frag {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  background: rgba(0, 0, 0, 0.92);
  cursor: pointer;
}
.frag-fig {
  margin: 0;
  max-width: min(86vw, 460px);
  max-height: 70vh;
  border: 1px solid rgba(236, 211, 100, 0.5);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(236, 211, 100, 0.25);
}
.frag-fig img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
.frag-cap {
  margin: 0;
  font-family: var(--human);
  font-stretch: normal;
  font-style: italic;
  font-size: 22px;
  color: var(--gold);
}
.frag.go .frag-fig {
  animation: memIn 1.1s var(--ease);
}
.frag.go .frag-cap {
  animation: fadeIn 1.6s var(--ease);
}
.frag.leave {
  opacity: 0;
  transition: opacity 0.45s var(--ease);
}
@keyframes memIn {
  0% { clip-path: inset(48% 0 48% 0); filter: brightness(3) grayscale(1); transform: scale(1.04); }
  30% { clip-path: inset(10% 0 30% 0); }
  60% { filter: brightness(1.3) grayscale(0.4); }
  100% { clip-path: inset(0 0 0 0); filter: none; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
}

/* the white rabbit */
.rabbit {
  position: fixed;
  left: 0;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 66;
  width: 64px;
  height: 48px;
  padding: 0;
  border: 0;
  background: none;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
}
.rabbit svg {
  width: 100%;
  height: 100%;
  fill: #fff;
}
.rabbit svg .eye {
  fill: #ff3d57;
}
.rabbit.hop {
  animation: wander 11s linear infinite;
}
.rabbit.hop svg,
.rabbit.dash svg {
  animation: hop 0.45s ease-in-out infinite;
}
.rabbit.dash {
  animation: dash 3.4s linear forwards;
}
@keyframes hop {
  50% { transform: translateY(-12px); }
}
@keyframes wander {
  0% { transform: translateX(-80px); }
  45% { transform: translateX(calc(50vw - 32px)); }
  55% { transform: translateX(calc(50vw - 32px)); }
  100% { transform: translateX(calc(100vw + 20px)); }
}
@keyframes dash {
  from { transform: translateX(-80px); }
  to { transform: translateX(calc(100vw + 20px)); }
}

/* ---------- human scenes ---------- */

.human {
  font-family: var(--human);
  font-stretch: normal;
}
.mem-lead {
  margin: 0;
  color: var(--ash);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 13px;
}
.mem-msg {
  font-size: clamp(20px, 5.6vw, 26px);
  line-height: 1.5;
  font-weight: 500;
  color: var(--cream);
  white-space: pre-line;
}
.mem-sign {
  margin: 0;
  font-family: var(--display);
  font-size: 34px;
  color: var(--gold);
}
.mem-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

/* the wall of faces */
#wall {
  max-width: 64rem;
  justify-content: center;
}
.faces {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
@media (min-width: 700px) {
  .faces {
    grid-template-columns: repeat(6, 1fr);
  }
}
.face {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: 4px;
  background: #050505;
  opacity: 0;
}
.face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.15) brightness(0.8);
  transition: filter 1.2s var(--ease);
}
.face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(77, 255, 154, 0.35);
  mix-blend-mode: color;
  transition: background 1.2s var(--ease);
}
.face span {
  position: absolute;
  inset: auto 0 0 0;
  padding: 3px 5px;
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 10px;
  color: var(--phosphor);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
  z-index: 1;
}
.face.on {
  animation: flickOn 0.45s steps(1) forwards;
}
@keyframes flickOn {
  0% { opacity: 0.9; }
  20% { opacity: 0.1; }
  40% { opacity: 0.8; }
  60% { opacity: 0.3; }
  80%, 100% { opacity: 1; }
}
.faces.warm .face img {
  filter: none;
}
.faces.warm .face::after {
  background: rgba(236, 211, 100, 0.12);
}
.faces.warm .face span {
  color: var(--gold);
}
.wall-line {
  min-height: 2.6em;
  margin: 8px 0 0;
  font-family: var(--display);
  font-size: clamp(26px, 7vw, 40px);
  line-height: 1.15;
  color: var(--gold);
}

/* ---------- invitation ---------- */

.invite .btn {
  font-family: var(--human);
  font-size: 16px;
  font-weight: 700;
}

.invite {
  justify-content: flex-start;
  gap: 0;
  font-family: var(--human);
  font-stretch: normal;
  font-size: 17px;
}
.inv-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(64px, 19vw, 112px);
  line-height: 0.95;
  color: var(--gold);
  text-shadow: 0 0 36px rgba(236, 211, 100, 0.35);
  overflow-wrap: anywhere;
}
.inv-sub {
  margin: 6px 0 0;
  font-size: clamp(24px, 6.6vw, 32px);
  font-weight: 600;
  color: var(--cream);
}
.inv-date {
  display: flex;
  flex-direction: column;
  margin: 36px 0 0;
}
.inv-day {
  font-family: var(--display);
  font-size: clamp(96px, 30vw, 168px);
  line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1.5px var(--gold);
  letter-spacing: 0.01em;
}
#inv-datelabel {
  margin-top: 6px;
  color: var(--ash);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 13px;
}
.letter {
  margin: 40px 0 0;
  max-width: 36ch;
  font-size: 19px;
  line-height: 1.6;
}
.letter p {
  margin: 0 0 14px;
}
.letter-sign {
  font-family: var(--display);
  font-size: 34px;
  color: var(--gold);
}
.acts {
  display: flex;
  flex-direction: column;
  gap: 26px;
  margin: 44px 0 0;
  padding: 0;
  list-style: none;
}
.act {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
}
.act-n {
  font-family: var(--display);
  font-size: 40px;
  line-height: 1;
  color: var(--gold);
}
.act h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0.01em;
  color: var(--cream);
}
.act p {
  margin: 0;
  color: rgba(242, 238, 227, 0.85);
}
.act b {
  color: var(--gold);
  font-weight: 700;
}
.loc {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid rgba(236, 211, 100, 0.35);
  border-radius: 10px;
  background: rgba(10, 8, 2, 0.85);
}
.loc-coords {
  margin: 0;
  font-family: var(--mono);
  font-stretch: 100%;
  font-size: 17px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.loc-place {
  margin: 6px 0 0;
  color: var(--cream);
}
.loc-place:empty {
  display: none;
}
.loc-actions {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.loc-actions .btn {
  min-height: 50px;
}
.dress {
  margin: 44px 0 0;
  padding: 20px 0;
  border-block: 1px solid rgba(236, 211, 100, 0.3);
}
.dress-l {
  margin: 0;
  color: var(--ash);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 13px;
}
.dress-v {
  margin: 2px 0 0;
  font-family: var(--display);
  font-size: clamp(44px, 13vw, 72px);
  line-height: 1;
  color: var(--cream);
}
.rules {
  margin: 18px 0 0;
  color: var(--ash);
  font-size: 15px;
}

/* RSVP */
.rsvp {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 48px 0 0;
}
.rsvp-t {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  color: var(--gold);
}
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.seg button {
  min-height: 56px;
  border: 1px solid rgba(236, 211, 100, 0.45);
  border-radius: 6px;
  background: transparent;
  font-family: var(--human);
  font-size: 17px;
  font-weight: 700;
  color: var(--cream);
}
.seg button[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #120f05;
}
.rsvp-more {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span {
  color: var(--ash);
  font-size: 15px;
}
.field input,
.field textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid rgba(139, 149, 143, 0.4);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.75);
  font-family: var(--human);
  font-size: 17px;
  color: var(--cream);
  resize: vertical;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.ok {
  min-height: 1.6em;
  margin: 0;
  color: var(--gold);
  font-weight: 600;
}
.extras {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 40px 0 0;
}
/* The poster closes the invitation as a framed print to keep, not a banner to open with. */
.keep {
  display: flex;
  flex-direction: column;
  width: min(100%, 320px);
  margin: 64px 0 0;
}
.keep-t {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  color: var(--gold);
}
.poster {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(236, 211, 100, 0.4);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: #000;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.9);
}
.poster a {
  display: block;
}
.poster img {
  display: block;
  width: 100%;
  height: auto;
  outline: 1px solid rgba(236, 211, 100, 0.55);
  outline-offset: 5px;
}
.keep .btn {
  border-radius: 0 0 6px 6px;
}
.inv-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 56px 0 0;
  color: var(--ash);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 12px;
}
.egg {
  padding: 8px 0 8px 8px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
}

/* ---------- story player ---------- */

.story {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.story-bars {
  position: absolute;
  inset: calc(env(safe-area-inset-top, 0px) + 10px) 10px auto;
  z-index: 3;
  display: flex;
  gap: 4px;
}
.story-bars i {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
}
.story-bars b {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
}
.story-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.story-stage::before {
  content: "";
  position: absolute;
  inset: -40px;
  background: var(--story-bg, none) center / cover no-repeat;
  filter: blur(34px) brightness(0.45) saturate(1.2);
}
.story-stage img,
.story-stage video {
  position: relative;
}
.story-stage img,
.story-stage video {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: contain;
  animation: storyIn 0.6s var(--ease);
}
@keyframes storyIn {
  from { opacity: 0; transform: scale(1.03); }
}
.story-zone {
  position: absolute;
  top: 0;
  bottom: 90px;
  z-index: 2;
  width: 40%;
  border: 0;
  background: transparent;
}
.story-zone.prev { left: 0; }
.story-zone.next { right: 0; width: 60%; }
.story-close {
  position: absolute;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index: 3;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid rgba(236, 211, 100, 0.6);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  color: var(--gold);
  font-family: var(--human);
  font-size: 16px;
  font-weight: 700;
}

/* ---------- overlays ---------- */

.flash {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, #fff7d6 0%, var(--gold) 35%, rgba(236, 211, 100, 0) 75%);
}
.flash.go {
  animation: flash 1.1s var(--ease);
}
@keyframes flash {
  0% { opacity: 0; }
  25% { opacity: 0.95; }
  100% { opacity: 0; }
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  z-index: 65;
  margin: 0;
  padding: 10px 18px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.9);
  color: var(--accent);
  font-size: 13px;
  white-space: nowrap;
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.4s;
}
.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}
.egg-d {
  max-width: min(26rem, calc(100vw - 40px));
  padding: 26px;
  border: 1px solid var(--gold);
  border-radius: 14px;
  background: #050402;
  color: var(--cream);
  font-family: var(--human);
  font-size: 17px;
}
.egg-d::backdrop {
  background: rgba(0, 0, 0, 0.8);
}
.egg-t {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 34px;
  line-height: 1.05;
  color: var(--gold);
}
.egg-d form {
  margin-top: 18px;
}

@media (min-width: 900px) {
  .sign {
    font-size: 15px;
    right: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .face {
    opacity: 1;
  }
}
