:root {
  --gold: #e9c46a;
  --gold-hi: #ffe9a8;
  --parch: #f3e2b3;
  --ink: #07040f;
  --violet: #3a1f6b;
  --violet-deep: #160a2e;
  --aarde: #3ddc4f;
  --water: #3aa0ff;
  --vuur: #ff6a2a;
  --lucht: #dfe9ff;
  --urgent: #ff9a5a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 50% 45%, var(--violet) 0%, var(--violet-deep) 50%, var(--ink) 100%);
  color: var(--parch);
  font-family: "Cinzel", Georgia, serif;
  user-select: none;
}
body.idle { cursor: none; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- moving background ---------- */
#sky, #fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#sky { z-index: 0; }
#fx { z-index: 8; }
.nebula {
  position: fixed; inset: -20%; z-index: 0; pointer-events: none; opacity: .6;
  background:
    radial-gradient(40% 30% at 20% 30%, rgba(140, 70, 220, .38), transparent 70%),
    radial-gradient(35% 25% at 80% 70%, rgba(60, 120, 255, .24), transparent 70%),
    radial-gradient(30% 30% at 60% 20%, rgba(233, 196, 106, .14), transparent 70%);
  animation: drift 70s ease-in-out infinite alternate, breath 12s ease-in-out infinite;
}
@keyframes drift { to { transform: translate(4%, -3%) rotate(6deg) scale(1.06); } }
@keyframes breath { 50% { opacity: .85; } }
.vignette { position: fixed; inset: 0; z-index: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, .55) 100%); }

/* ---------- stage ---------- */
#stage {
  position: relative; z-index: 1; height: 100vh;
  display: grid; grid-template-rows: auto 1fr auto; padding: 3vh 4vw 4vh;
  transition: opacity 1.5s;
}
.head { text-align: center; }
.kicker { letter-spacing: .35em; text-transform: uppercase; color: var(--gold); font-size: 1.6vh; opacity: .85; }
.title {
  font-family: "UnifrakturMaguntia", serif; font-weight: 400; font-size: 8vh; line-height: 1.1;
  background: linear-gradient(100deg, #a8782a 0%, var(--gold) 30%, #fff6d6 45%, var(--gold) 60%, #a8782a 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 1.2vh rgba(233, 196, 106, .45));
  margin: .4vh 0; animation: sheen 9s ease-in-out infinite;
}
@keyframes sheen { 0%, 100% { background-position: 100% 0; } 50% { background-position: 0% 0; } }
.locks { display: flex; gap: 2vw; justify-content: center; min-height: 3vh; }
.lock { font-size: 1.7vh; letter-spacing: .12em; color: var(--gold); opacity: .9; display: none; }
.lock::before { content: "✦ "; }
.lock.on { display: inline; animation: fadein 1.5s; }

.altar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 3vw; min-height: 0; }
.pillar { display: flex; gap: 1.6vw; }
.pillar.left { justify-content: flex-end; }
.pillar.right { justify-content: flex-start; }

/* ---------- rune stones ---------- */
.rune {
  --c: #6c6380;
  position: relative; width: 11vh; height: 30vh;
  border-radius: 2.2vh 2.2vh 1vh 1vh;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, .06), transparent 60%),
    linear-gradient(180deg, #2a2338 0%, #1a1424 60%, #120d1a 100%);
  border: 1px solid #3b2f55;
  box-shadow: inset 0 0 3vh rgba(0, 0, 0, .7), 0 1vh 3vh rgba(0, 0, 0, .6);
  display: flex; flex-direction: column; align-items: center; justify-content: space-evenly;
  color: #4d4560; transition: color 1s, box-shadow 1s, border-color 1s;
}
.rune[data-key="aarde"] { --c: var(--aarde); }
.rune[data-key="water"] { --c: var(--water); }
.rune[data-key="vuur"] { --c: var(--vuur); }
.rune[data-key="lucht"] { --c: var(--lucht); }
.rune .glyph { font-family: "Noto Sans Runic", serif; font-size: 7vh; line-height: 1; }
.rune .sym { width: 4.5vh; height: 4.5vh; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; }
.rune .name { font-size: 1.5vh; letter-spacing: .2em; text-transform: uppercase; }
.rune .digit {
  font-size: 5vh; font-weight: 700; color: #fff; opacity: 0; transform: scale(.4);
  transition: opacity .8s .6s, transform .8s .6s; text-shadow: 0 0 2vh var(--c);
}
.rune.flicker { animation: flicker 1.6s ease-out; }
@keyframes flicker {
  0% { color: #4d4560; } 20% { color: var(--c); filter: drop-shadow(0 0 1.5vh var(--c)); } 100% { color: #4d4560; }
}
.rune.on {
  color: var(--c); border-color: var(--c);
  box-shadow: inset 0 0 3vh rgba(0, 0, 0, .5), 0 0 4vh -0.5vh var(--c), 0 0 1vh var(--c);
  animation: glow 4s ease-in-out infinite;
}
@keyframes glow { 50% { box-shadow: inset 0 0 3vh rgba(0, 0, 0, .4), 0 0 7vh 0 var(--c), 0 0 1.5vh var(--c); } }
.rune.on .glyph, .rune.on .sym { filter: drop-shadow(0 0 1.2vh var(--c)); }
.rune.on .digit { opacity: 1; transform: none; }
.rune.ignite { animation: ignite 2.2s cubic-bezier(.2, .8, .2, 1); z-index: 9; }
@keyframes ignite {
  0% { transform: scale(1); filter: brightness(1); }
  12% { transform: scale(1.35) translateY(-2vh); filter: brightness(3); }
  40% { transform: scale(1.12); filter: brightness(1.8); }
  100% { transform: scale(1); filter: brightness(1); }
}
.flash { position: fixed; inset: 0; z-index: 7; pointer-events: none; opacity: 0; background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), var(--fc, #fff) 0%, transparent 60%); }
.flash.go { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { opacity: 0; } 8% { opacity: .75; } 100% { opacity: 0; } }

/* ---------- portal + antique dial ---------- */
.portal { position: relative; width: 56vh; height: 56vh; display: grid; place-items: center; }
.swirl {
  position: absolute; inset: -14%; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(120, 200, 255, 0), rgba(170, 120, 255, .45), rgba(120, 220, 255, .3), rgba(255, 220, 160, .35), rgba(170, 120, 255, 0), rgba(120, 200, 255, .4), rgba(120, 200, 255, 0));
  filter: blur(3vh); opacity: .55; animation: spin 40s linear infinite;
}
.dial { position: relative; width: 50vh; height: 50vh; transition: opacity 1.6s ease, transform 1.6s cubic-bezier(.2, .8, .2, 1); }
.face { position: absolute; inset: 0; width: 100%; height: 100%; filter: drop-shadow(0 0 2.5vh rgba(233, 196, 106, .35)); }
.face .hand { filter: drop-shadow(.3vh .5vh .4vh rgba(0, 0, 0, .6)); opacity: .9; }
#spark { animation: spin 60s linear infinite; }
.plate {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; padding: 1.2vh 2.4vh; border-radius: 2vh;
  background: radial-gradient(ellipse, rgba(11, 6, 24, .72) 40%, rgba(11, 6, 24, 0) 75%);
}
.clock {
  font-family: "Cinzel", serif; font-weight: 700; font-size: 11vh; letter-spacing: .04em; line-height: 1;
  color: var(--gold-hi); text-shadow: 0 0 2.5vh rgba(233, 196, 106, .8), 0 0 .5vh rgba(255, 255, 255, .5), 0 .4vh .8vh #000;
  font-variant-numeric: tabular-nums; transition: color 2s, text-shadow 2s;
}
.clock-label { font-size: 1.25vh; letter-spacing: .2em; text-transform: uppercase; margin-top: 1.2vh; color: var(--gold); opacity: .85; max-width: 26vh; text-align: center; line-height: 1.6; }
body.final10 .clock { color: var(--urgent); text-shadow: 0 0 3vh rgba(255, 120, 60, .9), 0 .4vh .8vh #000; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

/* start screen: no clock, no runes; only a sleeping portal */
.dormant { position: absolute; inset: 4vh; display: none; place-items: center; }
.dormant svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 1.5vh rgba(233, 196, 106, .35)); }
.dormant-runes { animation: spin 120s linear infinite; transform-origin: 0 0; opacity: .55; }
.dormant .orb {
  width: 14vh; height: 14vh; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 251, 232, .9) 0%, rgba(255, 233, 168, .45) 22%, rgba(170, 120, 255, .2) 50%, transparent 70%);
  animation: slumber 7s ease-in-out infinite;
}
@keyframes slumber { 50% { transform: scale(1.35); opacity: .6; } }
.dormant-text { display: none; text-align: center; font-family: "Cormorant Garamond", serif; font-style: italic; color: var(--parch); }
.dt-1 { font-size: 4.4vh; }
.dt-2 { font-size: 2.4vh; color: var(--gold); opacity: .8; margin-top: 1vh; letter-spacing: .04em; }
body[data-phase="standby"] .pillar, body[data-phase="standby"] .dial, body[data-phase="standby"] .locks { visibility: hidden; }
body[data-phase="standby"] .dormant { display: grid; }
body[data-phase="standby"] .dormant-text { display: block; animation: fadein 3s; }
body[data-phase="standby"] #stage { grid-template-rows: auto 1fr auto auto; }
body:not([data-phase="standby"]) .dormant-text { display: none; }

/* no clock during the intro; it is revealed at "nu" */
body[data-phase="intro"] .dial { opacity: 0; transform: scale(.7) rotate(-20deg); }
body.reveal .dial { animation: reveal 2.2s cubic-bezier(.2, .8, .2, 1); }
@keyframes reveal { 0% { filter: brightness(4); } 100% { filter: brightness(1); } }
.reveal-flash { position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0; background: radial-gradient(circle, #fffbe8 0%, rgba(255, 233, 168, .6) 30%, transparent 70%); }
body.reveal .reveal-flash { animation: flash 2.2s ease-out; }

/* ---------- lower panel ---------- */
.lower { display: flex; flex-direction: column; align-items: center; gap: 1.4vh; min-height: 10vh; justify-content: flex-end; }
.instruction { font-size: 2.2vh; letter-spacing: .08em; color: var(--parch); opacity: .9; text-align: center; }
.hint-small { min-height: 2.4vh; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 2.6vh; color: var(--gold); opacity: .95; max-width: 80vw; text-align: center; }
body:not([data-phase="playing"]) .lower { visibility: hidden; }

/* ---------- intro ---------- */
body[data-phase="intro"] .locks { visibility: hidden; }
body[data-phase="intro"] .pillar { opacity: .7; }
body[data-phase="intro"] .swirl { opacity: .9; animation-duration: 18s; }
.caption {
  position: fixed; z-index: 3; left: 50%; bottom: 9vh; transform: translateX(-50%); width: 80vw;
  text-align: center; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 4vh; line-height: 1.3;
  color: var(--parch); text-shadow: 0 0 2vh #000, 0 0 1vh #000; opacity: 0; transition: opacity .8s;
}
.caption.show { opacity: 1; }
body.has-video .caption { display: none; }
.intro-video { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; opacity: 0; pointer-events: none; background: #000; transition: opacity 1.2s; }
body.has-video[data-phase="intro"] .intro-video { opacity: 1; }

/* ---------- overlays ---------- */
.hint-big, .voice {
  position: fixed; z-index: 9; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2vh; padding: 0 12vw; text-align: center; background: radial-gradient(circle, rgba(22, 10, 46, .92), rgba(7, 4, 15, .85));
  opacity: 0; pointer-events: none; transition: opacity 1.2s;
}
.hint-big.show, .voice.show { opacity: 1; }
.hint-label { letter-spacing: .35em; text-transform: uppercase; color: var(--gold); font-size: 2vh; }
.hint-text, .voice { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 6vh; line-height: 1.25; color: var(--parch); }
.voice b { display: block; font-family: "Cinzel", serif; font-style: normal; font-size: 16vh; color: #fff; text-shadow: 0 0 4vh var(--lucht); margin-top: 2vh; animation: pulse 3s ease-in-out infinite; }

/* code ritual */
.code-ritual {
  position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh;
  background: radial-gradient(circle, rgba(42, 20, 80, .88), rgba(7, 4, 15, .94)); opacity: 0; pointer-events: none; transition: opacity 2s;
}
body.code-ritual-on .code-ritual { opacity: 1; }
body.code-ritual-on #stage { opacity: .12; }
.cr-kicker { letter-spacing: .35em; text-transform: uppercase; color: var(--gold); font-size: 2vh; }
.cr-title { font-family: "UnifrakturMaguntia", serif; font-weight: 400; font-size: 9vh; color: var(--gold-hi); text-shadow: 0 0 3vh rgba(233, 196, 106, .7); }
.cr-ring { position: relative; width: 34vh; height: 34vh; margin: 2vh 0; animation: spin 60s linear infinite; }
.cr-ring::before { content: ""; position: absolute; inset: 10%; border-radius: 50%; border: 1px solid rgba(233, 196, 106, .5); box-shadow: 0 0 6vh rgba(170, 120, 255, .4), inset 0 0 6vh rgba(170, 120, 255, .3); }
.cr-ring span {
  position: absolute; left: 50%; top: 50%; width: 9.5vh; height: 9.5vh; margin: -4.75vh;
  display: grid; place-items: center; border-radius: 50%; font-size: 6vh; font-weight: 700; color: #fff;
  border: .3vh solid var(--c); background: rgba(11, 6, 24, .85);
  box-shadow: 0 0 4vh var(--c), inset 0 0 2vh var(--c); text-shadow: 0 0 2vh var(--c);
  transform: rotate(calc(var(--i) * 90deg - 90deg)) translate(14vh) rotate(calc(var(--i) * -90deg + 90deg));
}
.cr-ring span::after { content: ""; }
.cr-ring span { animation: counter 60s linear infinite; }
@keyframes counter {
  from { transform: rotate(calc(var(--i) * 90deg - 90deg)) translate(14vh) rotate(calc(var(--i) * -90deg + 90deg)); }
  to { transform: rotate(calc(var(--i) * 90deg - 90deg)) translate(14vh) rotate(calc(var(--i) * -90deg + 90deg - 360deg)); }
}
.cr-steps { list-style: none; display: flex; flex-direction: column; gap: 1.6vh; text-align: center; counter-reset: s; }
/* each step appears when the Bewaker says it; the last one when the gate starts listening */
.cr-steps li { font-family: "Cormorant Garamond", serif; font-size: 3.6vh; color: var(--parch); opacity: 0; transition: opacity 1.5s; }
body.cr-s1 .cr-steps li:nth-child(1), body.cr-s2 .cr-steps li:nth-child(2), body.cr-s3 .cr-steps li:nth-child(3) { opacity: 1; }
/* the gate listens: numbers start dim and light up one by one as the group says them */
body.listening .cr-ring span:not(.heard) { opacity: .3; box-shadow: 0 0 1vh var(--c); text-shadow: none; }
.cr-ring span { transition: opacity .6s, box-shadow .6s, filter .6s; }
.cr-ring span.heard { filter: brightness(1.25); box-shadow: 0 0 7vh var(--c), 0 0 2vh #fff, inset 0 0 3vh var(--c); }
body.code-wrong .cr-ring span { animation: counter 60s linear infinite, wrong-flicker 1.2s ease-out; }
@keyframes wrong-flicker { 0%, 30% { border-color: #ff4a4a; box-shadow: 0 0 5vh #ff3030; opacity: 1; } 100% { } }
body.code-heard .cr-ring span { filter: brightness(1.8); box-shadow: 0 0 10vh #fff, 0 0 5vh var(--c), inset 0 0 3vh #fff; }
.cr-listen {
  display: flex; align-items: center; gap: 1.6vh; opacity: 0; transition: opacity 1.5s;
  font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 3vh; color: var(--gold);
}
body.listening .cr-listen { opacity: 1; }
.cr-mic {
  width: 2.4vh; height: 2.4vh; border-radius: 50%; background: var(--gold-hi);
  box-shadow: 0 0 calc(1vh + var(--lvl, 0) * 6vh) calc(var(--lvl, 0) * 2.5vh) rgba(255, 220, 140, .8);
  transform: scale(calc(1 + var(--lvl, 0) * .6));
}

/* paused */
.paused-overlay {
  position: fixed; inset: 0; z-index: 4; display: none; place-items: center;
  background: rgba(7, 4, 15, .6); backdrop-filter: blur(.4vh);
  font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 7vh; color: var(--parch);
}
body.paused .paused-overlay { display: grid; }
body.paused .swirl, body.paused #spark { animation-play-state: paused; }

/* QR */
.qr {
  position: fixed; z-index: 12; right: 3vh; bottom: 3vh; padding: 1.5vh; border-radius: 1.5vh;
  background: rgba(22, 10, 46, .9); border: 1px solid var(--gold); text-align: center;
  font-size: 1.5vh; color: var(--gold); display: none;
}
.qr img { display: block; width: 22vh; height: 22vh; margin-bottom: 1vh; border-radius: .6vh; }
body.show-qr .qr { display: block; }

/* ---------- finale ---------- */
.finale { position: fixed; inset: 0; z-index: 6; display: none; align-items: center; justify-content: center; }
body[data-phase^="finale"] .finale { display: flex; }
body[data-phase^="finale"] #stage { opacity: .2; }
.burst {
  position: absolute; left: 50%; top: 50%; width: 10vh; height: 10vh; margin: -5vh 0 0 -5vh; border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, #ffe9a8 20%, rgba(170, 120, 255, .6) 45%, transparent 70%);
  animation: open 6s cubic-bezier(.2, .7, .2, 1) forwards, breathe 6s 6s ease-in-out infinite;
}
@keyframes open { 0% { transform: scale(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(14); opacity: .55; } }
@keyframes breathe { 50% { transform: scale(15); opacity: .45; } 0%, 100% { transform: scale(14); opacity: .55; } }
.finale-inner { position: relative; text-align: center; animation: fadein 3s 2s both; }
/* success finale film (static/finale.mp4): it carries the story, so the burst and title step aside */
.finale-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1s; pointer-events: none; background: #07040f; }
body.has-finale-video[data-phase="finale_success"] .finale-video { opacity: 1; }
body.has-finale-video[data-phase="finale_success"] .finale .burst,
body.has-finale-video[data-phase="finale_success"] .finale-inner { display: none; }
.ritual-result { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 3.2vh; color: var(--gold); letter-spacing: .03em; }
.finale-title {
  font-family: "UnifrakturMaguntia", serif; font-weight: 400; font-size: 11vh; color: #fff8e0;
  text-shadow: 0 0 3vh rgba(255, 220, 140, .9), 0 0 8vh rgba(170, 120, 255, .8);
}
.finale-sub { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 4vh; color: #fff3cc; margin-top: 2vh; text-shadow: 0 0 2vh #000; }
.ritual {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 3.5vh;
  background: radial-gradient(circle, rgba(30, 14, 60, .97), rgba(7, 4, 15, 1)); text-align: center;
}
.ritual h2 { font-family: "UnifrakturMaguntia", serif; font-weight: 400; font-size: 10vh; color: var(--gold-hi); text-shadow: 0 0 3vh rgba(233, 196, 106, .7); }
.wait-msg { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 4vh; line-height: 1.35; color: var(--parch); max-width: 80vw; }
.ritual-steps { list-style: none; display: flex; flex-direction: column; gap: 2.6vh; counter-reset: r; text-align: left; }
.ritual-steps li { counter-increment: r; font-family: "Cormorant Garamond", serif; font-size: 4.2vh; color: var(--parch); opacity: 0; animation: fadein 2s forwards; }
.ritual-steps li::before { content: counter(r, upper-roman) " · "; font-family: "Cinzel", serif; color: var(--gold); }
.ritual-steps li:nth-child(2) { animation-delay: 3s; }
.ritual-steps li:nth-child(3) { animation-delay: 6s; }
.finale.ritual-on .ritual { display: flex; animation: fadein 2s; }
/* the film is gone once the waiting page is up */
.finale.ritual-on .finale-video, .finale.ritual-on .burst { display: none; }
/* NYE before midnight: wait for the countdown, the steps come at 00:00 */
body.nye-countdown .wait-steps { display: none; }
.finale.ritual-on .finale-inner { display: none; }

/* NYE: countdown to midnight, last ten seconds, new year */
.midnight { display: none; text-align: center; margin-top: 1vh; animation: fadein 2s 2s both; }
body.nye-countdown .midnight { display: block; }
.midnight-label { letter-spacing: .3em; text-transform: uppercase; color: var(--gold); font-size: 2vh; }
.midnight-clock { font-family: "Cinzel", serif; font-weight: 700; font-size: 9vh; color: var(--gold-hi); font-variant-numeric: tabular-nums; text-shadow: 0 0 2.5vh rgba(233, 196, 106, .8); }
.last-ten {
  position: fixed; inset: 0; z-index: 10; display: none; place-items: center; pointer-events: none;
  font-family: "Cinzel", serif; font-weight: 700; font-size: 45vh; color: #fff8e0;
  text-shadow: 0 0 6vh rgba(255, 220, 140, .9), 0 0 14vh rgba(170, 120, 255, .8);
  background: radial-gradient(circle, rgba(22, 10, 46, .5), rgba(7, 4, 15, .8));
}
body.last-ten-on .last-ten { display: grid; }
/* one counter at a time: the big last-ten numbers take over from the midnight clock */
body.last-ten-on .midnight { visibility: hidden; }
.last-ten.tick { animation: tick 1s ease-out; }
@keyframes tick { 0% { transform: scale(1.6); opacity: 0; } 20% { opacity: 1; } 100% { transform: scale(.9); opacity: .9; } }
.new-year {
  position: fixed; inset: 0; z-index: 9; display: none; place-content: center; text-align: center; pointer-events: none;
  font-family: "UnifrakturMaguntia", serif; font-size: 13vh; line-height: 1.1; color: #fff8e0;
  text-shadow: 0 0 4vh rgba(255, 220, 140, 1), 0 0 10vh rgba(255, 120, 200, .7);
}
.ny-greeting .year { font-family: "Cinzel", serif; font-weight: 700; font-size: 16vh; }
.ny-greeting { text-align: center; }
.ny-steps { margin: 5vh auto 0; width: max-content; max-width: 90vw; font-size: 1rem; text-shadow: 0 0 2vh #000, 0 0 1vh #000; }
.ny-steps li { font-size: 4vh; animation-delay: 4s; }
.ny-steps li:nth-child(2) { animation-delay: 7s; }
.ny-steps li:nth-child(3) { animation-delay: 10s; }
body.new-year-in-game .ny-steps, body.fw-test .ny-steps { display: none; }
body.new-year-on .new-year, body.fw-test .new-year { display: grid; animation: fadein 1.5s; }
/* its own night sky: covers the ritual/game, sits under the fireworks canvas (#fx z 8), text above (z 9) */
.new-year-bg {
  position: fixed; inset: 0; z-index: 7; display: none; pointer-events: none;
  background: radial-gradient(ellipse at 50% 60%, #1d0f3d 0%, #0c0620 55%, #030108 100%);
}
body.new-year-on .new-year-bg, body.fw-test .new-year-bg { display: block; animation: fadein 1.5s; }
body.new-year-in-game .new-year-bg { display: none; }
body.new-year-on #stage, body.new-year-on .finale { opacity: .15; }
/* late start: the game is still running, so keep it readable under the celebration */
body.new-year-in-game #stage { opacity: .75; }
body.new-year-in-game .new-year { font-size: 6vh; place-content: end center; padding-bottom: 6vh; }
body.new-year-in-game .new-year br { display: none; }
body.new-year-in-game .ny-greeting .year { font-size: 6vh; }

/* ---------- unlock + connection ---------- */
.unlock {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh;
  background: radial-gradient(ellipse at 50% 45%, var(--violet) 0%, var(--violet-deep) 50%, var(--ink) 100%);
}
body[data-unlocked="true"] .unlock { display: none; }
.unlock button {
  margin-top: 4vh; font: 600 2.6vh "Cinzel", serif; letter-spacing: .15em; color: var(--ink); cursor: pointer;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold)); border: 0; border-radius: 1vh; padding: 2vh 5vh;
  box-shadow: 0 0 4vh rgba(233, 196, 106, .5);
}
.conn {
  position: fixed; z-index: 21; left: 2vh; bottom: 2vh; font-size: 1.4vh; color: #ffb3a8; display: none;
  font-family: "Cormorant Garamond", serif; font-style: italic;
}
.conn::before { content: "● "; }
body[data-conn="lost"] .conn { display: block; }

/* ---------- wish lanterns (guests write a wish on /wens) ---------- */
.wish-qr {
  position: fixed; z-index: 12; right: 3vh; bottom: 3vh; width: 26vh; padding: 1.8vh; border-radius: 1.8vh; display: none;
  background: rgba(22, 10, 46, .88); border: 1px solid rgba(233, 196, 106, .7); text-align: center;
  box-shadow: 0 0 4vh rgba(255, 160, 60, .25); animation: fadein 2s 1s both;
}
body.wish-open .wish-qr { display: block; }
.wish-qr img { display: block; width: 100%; aspect-ratio: 1; border-radius: .8vh; margin-bottom: 1.2vh; }
.wq-title { font-family: "Cinzel", serif; font-weight: 600; font-size: 2vh; line-height: 1.25; color: var(--gold-hi); }
.wq-sub { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 1.8vh; color: var(--parch); opacity: .8; margin-top: .4vh; }
body.new-year-on .wish-qr { opacity: .85; }

/* before midnight: the guests' lanterns gather on the waiting page, kahoot-style */
.lantern-tray-wrap { display: none; max-width: 64vw; }
body.wish-gather .lantern-tray-wrap { display: block; }
.lantern-tray-label { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 2.6vh; color: var(--gold); margin-bottom: 1.4vh; }
.lantern-tray { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.6vh 2.6vh; }
.mini { display: flex; flex-direction: column; align-items: center; gap: .7vh; animation: bob 4s var(--d, 0s) ease-in-out infinite; }
.mini .paper { width: 3.4vh; height: 4.4vh; }
.mini .who { font-family: "Cinzel", serif; font-size: 1.6vh; color: var(--parch); max-width: 12vh; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.pop { animation: pop 1.2s cubic-bezier(.2, 1.6, .4, 1), bob 4s 1.2s ease-in-out infinite; }
.mini.pop .paper { animation: pop-glow 2s ease-out; }
@keyframes pop { 0% { transform: scale(0) translateY(3vh); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes pop-glow { 0% { filter: brightness(2.2); } 100% { filter: brightness(1); } }
@keyframes bob { 50% { transform: translateY(-.8vh); } }

/* the paper lantern itself */
.lanterns { position: fixed; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.lanterns .paper, .mini .paper {
  position: relative; margin: 0 auto; border-radius: 42% 42% 22% 22% / 34% 34% 18% 18%;
  background: radial-gradient(ellipse at 50% 70%, #fff4c8 0%, #ffc45a 28%, #f07a2a 62%, #9c3412 100%);
  box-shadow: 0 0 2.2vh .6vh rgba(255, 170, 70, .55), 0 0 7vh 2.4vh rgba(255, 120, 40, .22);
}
.lanterns .paper { width: 7vh; height: 9vh; animation: lantern-flicker 2.6s ease-in-out infinite; }
.lanterns .paper::after { content: ""; position: absolute; left: 24%; right: 24%; bottom: -.5vh; height: .7vh; border-radius: .4vh; background: #7a3410; }
@keyframes lantern-flicker { 0%, 100% { filter: brightness(1); } 40% { filter: brightness(1.15); } 70% { filter: brightness(.92); } }
.lantern {
  position: absolute; left: calc(var(--x) - 11vw); top: 100%; width: 22vw; text-align: center;
  animation: lantern-rise var(--dur, 30s) cubic-bezier(.35, .1, .6, 1) forwards;
}
.lantern .sway { animation: lantern-sway var(--swayt, 6s) ease-in-out infinite alternate; }
@keyframes lantern-rise {
  0% { transform: translateY(0) scale(var(--s, 1)); opacity: 0; }
  6% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(-140vh) scale(calc(var(--s, 1) * .55)); opacity: 0; }
}
@keyframes lantern-sway { from { transform: translateX(calc(var(--sway) * -1)) rotate(-2deg); } to { transform: translateX(var(--sway)) rotate(2deg); } }
/* a soft dark halo keeps the wish readable where it drifts over the waiting page text */
.lantern .words { margin-top: 1.2vh; padding: 1vh 1.5vh; background: radial-gradient(closest-side, rgba(7, 4, 15, .82), rgba(7, 4, 15, .55) 60%, transparent); }
.lantern .who { font-family: "Cinzel", serif; font-weight: 600; font-size: 1.9vh; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-hi); text-shadow: 0 0 1vh #000, 0 0 2vh #000;
}
.lantern .text {
  margin-top: .4vh; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 3vh; line-height: 1.2; color: #fff8e0;
  text-shadow: 0 0 1vh #000, 0 0 2.2vh #000, 0 0 2vh rgba(255, 150, 60, .5); overflow-wrap: anywhere;
}

/* ---------- the final minutes before midnight (new-year music playing) ---------- */
.ritual > *:not(.ny-stars) { position: relative; transition: opacity 3s, transform 3s cubic-bezier(.3, 0, .2, 1); }
body.ny-final .ritual-result, body.ny-final .ritual h2, body.ny-final .wait-msg { opacity: 0; }
body.ny-final .midnight { transform: translateY(-14vh) scale(2.1); }
body.ny-final .midnight-label { letter-spacing: .5em; }
body.ny-final .lantern-tray-wrap { transform: translateY(4vh) scale(.85); opacity: .85; }
.ny-stars { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ny-stars span {
  position: absolute; width: var(--sz); height: var(--sz); border-radius: 50%; background: #fff8e8; opacity: 0;
  box-shadow: 0 0 calc(var(--sz) * 3) rgba(255, 240, 200, .8);
}
.ny-stars span.big { background: #fff1c2; box-shadow: 0 0 calc(var(--sz) * 4) rgba(255, 220, 140, .9); }
body.ny-final .ny-stars span { animation: star-in 6s var(--d) ease-out forwards, twinkle var(--tw) calc(var(--d) + 6s) ease-in-out infinite; }
@keyframes star-in { from { opacity: 0; transform: scale(.2); } to { opacity: .9; transform: scale(1); } }
@keyframes twinkle { 0%, 100% { opacity: .9; } 50% { opacity: .35; } }

/* ---------- end credits: roll slowly over the night sky (lanterns and fireworks keep going) ---------- */
.credits { position: fixed; inset: 0; z-index: 11; pointer-events: none; overflow: hidden; display: none; }
body.credits-on .credits { display: block; }
.credits-roll {
  position: absolute; left: 0; right: 0; top: 100%; text-align: center; padding: 0 10vw;
  display: flex; flex-direction: column; align-items: center; gap: 7vh;
  text-shadow: 0 0 1.5vh #000, 0 0 3vh #000;
}
body.credits-go .credits-roll { animation: credits-roll var(--dur, 60s) linear forwards; }
@keyframes credits-roll { to { transform: translateY(var(--travel, -200vh)); } }
/* the screen steps back while the credits roll */
/* (filter, not opacity: those elements fade in with an animation that owns their opacity) */
body.credits-on .new-year, body.credits-on .finale .ritual > *:not(.ny-stars) { filter: opacity(.1); transition: filter 2s; }
.credits { background: radial-gradient(ellipse at 50% 50%, rgba(7, 4, 15, .55), rgba(7, 4, 15, .25)); }
.credits .c-kicker { letter-spacing: .35em; text-transform: uppercase; color: var(--gold); font-size: 2vh; margin-bottom: 2vh; }
.credits .c-title { font-family: "UnifrakturMaguntia", serif; font-size: 9vh; line-height: 1.1; color: var(--gold-hi); text-shadow: 0 0 3vh rgba(233, 196, 106, .7), 0 0 2vh #000; }
.credits .cr-close .c-title { font-size: 8vh; }
.credits .c-title .year { font-family: "Cinzel", serif; font-weight: 700; }
.c-block { display: flex; flex-direction: column; align-items: center; gap: 1vh; }
.c-role { font-family: "Cinzel", serif; font-size: 2vh; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin-bottom: .6vh; }
.c-name { font-family: "Cinzel", serif; font-weight: 600; font-size: 5vh; color: #fff8e0; }
.c-name.sm { font-size: 2.8vh; font-weight: 400; }
.c-note { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 2.8vh; color: var(--parch); opacity: .85; max-width: 60vw; }
.c-elements .c-el { font-family: "Cinzel", serif; font-size: 3.6vh; color: var(--c); text-shadow: 0 0 2vh var(--c), 0 0 1vh #000; }
.c-elements .c-el b { margin-left: 1.5vh; color: #fff; }
.c-guests { display: flex; flex-wrap: wrap; justify-content: center; gap: 1vh 4vh; max-width: 70vw; font-family: "Cormorant Garamond", serif; font-size: 3.6vh; color: #fff8e0; }
.c-secret { margin-top: 70vh; max-width: 62vw; display: flex; flex-direction: column; align-items: center; gap: 2vh; }
.c-psst { font-family: "Cinzel", serif; font-size: 2vh; letter-spacing: .35em; text-transform: uppercase; color: var(--gold); margin-bottom: 1vh; }
.c-secret p { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 3.6vh; line-height: 1.4; color: #fff8e0; }
.c-secret .c-wish { font-family: "UnifrakturMaguntia", serif; font-style: normal; font-size: 7vh; color: var(--gold-hi); margin-top: 2vh; text-shadow: 0 0 3vh rgba(233, 196, 106, .7), 0 0 2vh #000; }
.c-sign { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 4.4vh; color: var(--gold); margin-top: 1vh; }
.c-sign span { font-style: normal; font-size: 3vh; margin-left: 1vh; }
body.credits-on .wish-qr { filter: opacity(.15); transition: filter 2s; }
