:root {
  --lime: #7AA236;
  --teal: #165E82;
  --orange: #DA3202;
  --night: #2a1b3d;
  --cream: #f5e9c8;
  --ink: #111;
  --yellow: #ffd23f;
  --gold: #d9a43a;
  --pink: #e04fa0;
  --paper: #f5e9c8;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
html { background: var(--night); }
body {
  background:
    radial-gradient(ellipse 90% 35% at 50% 12%, #5b3a86 0%, rgba(58,36,87,.55) 50%, transparent 85%),
    radial-gradient(circle at 8% 78%, rgba(122,162,54,.16), transparent 40%),
    radial-gradient(circle at 94% 96%, rgba(218,50,2,.16), transparent 45%),
    var(--night);
  color: var(--cream);
  font-family: 'Patrick Hand', 'Comic Sans MS', system-ui, sans-serif;
  font-size: 18px;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px dashed var(--yellow); outline-offset: 3px;
}

/* ---------- shared cartoon bits ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 6px 20px;
  font-family: 'Bangers', 'Luckiest Guy', sans-serif; font-size: 24px; letter-spacing: 1.2px;
  color: var(--ink); text-decoration: none;
  border: 3.5px solid var(--ink); border-radius: 999px;
  box-shadow: 4px 5px 0 var(--ink);
  transition: transform .08s, box-shadow .08s;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
.btn:active { transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.btn.lime { background: var(--lime); }
.btn.orange { background: var(--orange); color: var(--cream); text-shadow: 2px 2px 0 var(--ink); }
.btn.teal { background: var(--teal); color: var(--cream); text-shadow: 2px 2px 0 var(--ink); }
.btn.small { font-size: 19px; min-height: 44px; padding: 4px 16px; }
.linkish {
  background: none; border: 0; min-height: 44px; padding: 4px 10px;
  font-family: 'Patrick Hand', sans-serif; font-size: 17px;
  text-decoration: underline; text-underline-offset: 4px; color: inherit; opacity: .9;
}
.mute {
  position: fixed; z-index: 60; top: calc(var(--safe-t) + 8px); right: 8px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--cream); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  display: grid; place-items: center;
}
.mute svg { width: 24px; height: 24px; }
.mute.nudge { animation: muteNudge 1.2s ease-in-out infinite; }
@keyframes muteNudge { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12) rotate(-8deg); } }
.halftone {
  position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(0,0,0,.33) 1.1px, transparent 1.6px);
  background-size: 7px 7px;
}
.paper {
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(120,80,20,.10) 1px, transparent 1.4px),
    linear-gradient(transparent 31px, rgba(22,94,130,.14) 32px);
  background-size: 6px 6px, 100% 32px;
  color: var(--ink);
  border: 3.5px solid var(--ink);
  box-shadow: 5px 6px 0 #000;
}

/* SFX bursts */
.sfx {
  position: fixed; z-index: 70; width: 190px; height: 130px;
  margin: -65px 0 0 -95px; pointer-events: none;
  display: grid; place-items: center;
  transform: rotate(var(--rot, -8deg)) scale(0);
  animation: sfxPop 1.1s cubic-bezier(.2,1.6,.4,1) forwards;
}
.sfx svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.sfx span {
  position: relative; font-family: 'Bangers', sans-serif; font-size: 38px; letter-spacing: 1.5px;
  color: var(--cream); -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill;
  text-shadow: 3px 3px 0 var(--ink);
}
@keyframes sfxPop {
  0% { transform: rotate(var(--rot)) scale(0); opacity: 1; }
  18% { transform: rotate(var(--rot)) scale(1.18); }
  30% { transform: rotate(var(--rot)) scale(1); }
  78% { transform: rotate(var(--rot)) scale(1.04); opacity: 1; }
  100% { transform: rotate(var(--rot)) scale(.6) translateY(-30px); opacity: 0; }
}
@keyframes sfxFade {
  0% { transform: rotate(var(--rot)); opacity: 0; }
  20%, 75% { transform: rotate(var(--rot)); opacity: 1; }
  100% { transform: rotate(var(--rot)); opacity: 0; }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
.confetti { position: fixed; z-index: 66; top: -20px; width: 10px; height: 16px; border: 2px solid var(--ink); pointer-events: none; }

/* ---------- the pumpkin bust (used big in the intro, small on the page) ---------- */
.bust { position: relative; isolation: isolate; aspect-ratio: 1 / 1.22; display: block; }
.bust .body { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; filter: drop-shadow(3px 3px 0 #000); }
.bust .pumpkin { position: absolute; left: 17%; top: 9%; width: 66%; }
.bust .pk { display: block; width: 100%; height: auto; filter: drop-shadow(3px 3px 0 #000); }
.bust .hat { position: absolute; width: 40%; left: 33%; top: -38%; opacity: 0; transform: rotate(14deg); }
.bust .mask {
  position: absolute; left: -3%; top: 0; width: 106%; z-index: 3;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none; pointer-events: none;
  transform-origin: 50% 100%; filter: drop-shadow(3px 4px 0 #000);
}
.bust.off .mask { opacity: 0; }
.bust.off .hat { opacity: 1; }
.bust.off .eye { fill: #fff36b; }

/* ======================= INTRO OVERLAY ======================= */
#intro {
  position: fixed; inset: 0; z-index: 40; overflow: hidden; cursor: pointer;
  background: var(--night); touch-action: manipulation;
}
#intro[hidden] { display: none; }
#swirl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.title-vignette {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 85% 70% at 50% 40%, rgba(42,27,61,0) 25%, rgba(42,27,61,.55) 72%, rgba(18,9,28,.92) 100%);
}
.i-title {
  position: absolute; left: 0; right: 0; top: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding-top: calc(var(--safe-t) + 16dvh);
  transform-origin: 50% 0;
}
.badge {
  font-family: 'Bangers', sans-serif; letter-spacing: 1.5px; font-size: 17px;
  background: var(--cream); color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  padding: 3px 12px; transform: rotate(-3deg);
}
h1.big {
  font-family: 'Luckiest Guy', 'Bangers', sans-serif; font-weight: normal; text-align: center;
  font-size: clamp(44px, min(13.5vw, 9dvh), 104px); line-height: .9; letter-spacing: 1px;
  color: var(--cream); text-transform: uppercase;
}
h1.big .w {
  display: block; -webkit-text-stroke: 11px var(--ink); paint-order: stroke fill;
  text-shadow: 0 7px 0 var(--ink); transform: rotate(var(--tilt));
}
h1.big .spooky { color: var(--lime); font-size: 1.28em; line-height: .86; }
h1.big .on { color: var(--orange); }

.montage { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.mpanel {
  position: absolute; left: 50%; top: var(--y);
  width: min(80vw, 430px, 62dvh); aspect-ratio: 4 / 3; margin-left: calc(min(80vw, 430px, 62dvh) / -2);
  border: 5px solid var(--ink); box-shadow: 7px 7px 0 #000; background: #000; overflow: hidden;
  opacity: 0; transform: translateX(var(--x)) rotate(var(--r)) scale(1.25);
}
.mpanel img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.14); }
.mpanel::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: multiply;
  background-image: radial-gradient(rgba(0,0,0,.35) 1px, transparent 1.6px); background-size: 6px 6px;
  box-shadow: inset 0 0 0 4px var(--cream);
}
.mword {
  position: absolute; z-index: 2; font-family: 'Bangers', sans-serif; font-size: 44px; letter-spacing: 2px;
  color: var(--yellow); -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 4px 4px 0 var(--ink);
  opacity: 0; transform: rotate(var(--wr)) scale(1.5); white-space: nowrap;
}
.gang {
  position: absolute; left: 50%; top: calc(var(--safe-t) + 22dvh); z-index: 5;
  width: min(92vw, 560px, 70dvh); margin-left: calc(min(92vw, 560px, 70dvh) / -2);
  opacity: 0; transform: scale(1.3) rotate(-12deg);
}
.gang img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover;
  border: 6px solid var(--ink); box-shadow: 9px 9px 0 #000; background: #000;
}
.gang figcaption {
  position: relative; margin: -26px auto 0; width: 86%;
  font: clamp(22px, 7.4vw, 44px)/1 'Luckiest Guy', sans-serif; text-transform: uppercase; text-align: center;
  background: var(--yellow); color: var(--ink); border: 4px solid var(--ink); box-shadow: 5px 5px 0 #000;
  padding: 8px 8px 4px; transform: rotate(-3deg) scale(0); opacity: 0;
}
/* the unmasking stage: a hard-edged dark wipe over the gang frame, never a light frame */
.i-unmask {
  position: absolute; inset: 0; z-index: 8;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2dvh;
  background:
    radial-gradient(ellipse 60% 40% at 50% 42%, #4a2f6e 0%, #2a1b3d 70%),
    var(--night);
  clip-path: inset(0 100% 0 0);
  padding-bottom: 4dvh;
}
.big-bust { width: min(52vw, 250px, 30dvh); }
.i-itwas { font-family: 'Luckiest Guy', sans-serif; text-transform: uppercase; text-align: center; line-height: .95; }
.i-itwas span { display: block; opacity: 0; letter-spacing: 1.5px; word-spacing: .12em; -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
.i-itwas span:nth-child(1) { font-size: clamp(22px, 4dvh, 32px); color: var(--cream); -webkit-text-stroke-width: 5px; }
.i-itwas span:nth-child(2) { font-size: clamp(40px, min(13vw, 8dvh), 72px); color: var(--lime); }
.i-itwas span:nth-child(3) { font-size: clamp(34px, min(11vw, 7dvh), 62px); color: var(--orange); }
.i-skip {
  position: absolute; z-index: 9; left: 50%; bottom: calc(var(--safe-b) + 14px); transform: translateX(-50%);
  font-family: 'Bangers', sans-serif; letter-spacing: 1px; font-size: 17px; white-space: nowrap;
  background: rgba(17,8,28,.75); border: 2px solid var(--cream); border-radius: 22px; padding: 8px 14px;
}

/* intro choreography: delays are measured from adding .play (t = 0). Same beats in both motion modes. */
#intro.play .badge { animation: dropIn .35s .02s cubic-bezier(.3,1.7,.5,1) both; }
#intro.play h1.big .w { animation: slamWord .36s calc(.06s + var(--i) * .13s) cubic-bezier(.25,1.2,.45,1) both; }
#intro.play .i-title { animation: titleUp .32s 1.12s cubic-bezier(.5,0,.3,1) forwards; }
#intro.play .mpanel { animation: panelSlam .17s var(--d) cubic-bezier(.2,1.5,.4,1) forwards; }
#intro.play .mpanel img { animation: kenBurns .9s var(--d) linear forwards; }
#intro.play .mword { animation: wordSlam .2s calc(var(--d) + .07s) cubic-bezier(.2,1.8,.4,1) forwards; }
#intro.play .montage { animation: dimOut .2s 2.88s forwards; }
#intro.play .gang { animation: gangSlam .28s 2.8s cubic-bezier(.2,1.4,.4,1) forwards; }
#intro.play .gang figcaption { animation: bannerSlam .26s 3.02s cubic-bezier(.3,1.25,.5,1) forwards; }
#intro.play .i-unmask { animation: wipeIn .24s 4.03s cubic-bezier(.6,0,.4,1) forwards; }
#intro.play .i-skip { animation: fadeOut .2s 4.03s forwards; }
#intro.revealed .i-itwas span { animation: slam .32s cubic-bezier(.3,1.8,.5,1) both; }
#intro.revealed .i-itwas span:nth-child(1) { animation-delay: .1s; }
#intro.revealed .i-itwas span:nth-child(2) { animation-delay: .25s; }
#intro.revealed .i-itwas span:nth-child(3) { animation-delay: .4s; }
#intro.revealed .big-bust .hat { animation: hatDrop .42s .08s cubic-bezier(.3,1.7,.5,1) both; }
@keyframes dropIn { from { transform: translateY(-60px) rotate(-12deg); opacity: 0; } }
@keyframes slamWord {
  0% { transform: scale(1.35) rotate(calc(var(--tilt) * -4)); opacity: 0; }
  45% { opacity: 1; }
  100% { transform: scale(1) rotate(var(--tilt)); opacity: 1; }
}
@keyframes titleUp { to { transform: translateY(calc(-8dvh + 12px + var(--safe-t))) scale(.5); } }
@keyframes panelSlam { to { opacity: 1; transform: translateX(var(--x)) rotate(var(--r)) scale(1); } }
@keyframes kenBurns { to { transform: scale(1); } }
@keyframes wordSlam { to { opacity: 1; transform: rotate(var(--wr)) scale(1); } }
@keyframes gangSlam { to { opacity: 1; transform: scale(1) rotate(-2deg); } }
@keyframes bannerSlam { to { opacity: 1; transform: rotate(-3deg) scale(1); } }
@keyframes dimOut { to { opacity: .25; } }
@keyframes wipeIn { to { clip-path: inset(0 0 0 0); } }
@keyframes slam { from { transform: scale(1.5) rotate(-8deg); opacity: 0; } to { opacity: 1; transform: none; } }
@keyframes hatDrop { from { transform: translateY(-140%) rotate(-20deg); opacity: 0; } to { transform: rotate(14deg); opacity: 1; } }

/* ======================= THE ONE-SCREEN PAGE ======================= */
#page {
  position: relative; height: 100%; max-width: 520px; margin: 0 auto; overflow: hidden;
  padding: calc(var(--safe-t) + 8px) 14px calc(var(--safe-b) + 4px);
  display: flex; flex-direction: column; gap: clamp(8px, 1.5dvh, 16px);
}
.top { flex: none; display: flex; align-items: center; gap: 10px; padding-right: 50px; }
.mini-bust { flex: none; width: clamp(60px, 11.5dvh, 104px); border: 0; background: none; padding: 0; }
.it-was {
  font-family: 'Luckiest Guy', sans-serif; font-weight: normal; text-transform: uppercase; text-align: left;
  line-height: .95; min-width: 0;
}
.it-was span { display: block; letter-spacing: 1px; word-spacing: .1em; -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink); white-space: nowrap; }
.it-was span:nth-child(1) { font-size: clamp(15px, 2.5dvh, 22px); color: var(--cream); -webkit-text-stroke-width: 4px; }
.it-was span:nth-child(2) { font-size: clamp(26px, min(5.4dvh, 9.4vw), 48px); color: var(--lime); }
.it-was span:nth-child(3) { font-size: clamp(22px, min(4.6dvh, 8.2vw), 42px); color: var(--orange); }

.banner { position: relative; flex: 1 1 0; min-height: 0; max-height: 230px; }
.banner img {
  display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%;
  border: 4px solid var(--ink); box-shadow: 5px 5px 0 #000; background: #000; border-radius: 4px;
}
.banner figcaption {
  position: absolute; left: 10px; bottom: -8px; transform: rotate(-3deg);
  background: var(--yellow); color: var(--ink); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 #000;
  font-size: 15px; padding: 0 8px; line-height: 1.4;
}

.card { position: relative; flex: none; padding: 12px 12px 14px; border-radius: 6px; transform: rotate(-.4deg); }
.stamp-corner {
  position: absolute; right: -6px; top: -14px; transform: rotate(12deg);
  font: 13px/1 'Bangers', sans-serif; letter-spacing: 1px; text-align: center; text-transform: uppercase;
  color: var(--orange); border: 3px solid var(--orange); border-radius: 6px; padding: 3px 7px;
  background: rgba(245,233,200,.95); z-index: 20;
}
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-width: 0;
  background: #fffdf2; border: 3px solid var(--ink); border-radius: 10px; padding: 2px 9px 4px;
  box-shadow: 3px 3px 0 var(--ink);
}
.tile:nth-child(odd) { transform: rotate(-.8deg); }
.tile:nth-child(even) { transform: rotate(.7deg); }
.tile b { font: 14px 'Bangers', sans-serif; letter-spacing: 1.2px; color: var(--teal); font-weight: normal; }
.tile span { font: clamp(18px, 3.4dvh, 24px)/1.05 'Luckiest Guy', sans-serif; color: var(--orange); white-space: nowrap; }
.window-note { margin-top: 9px; font-size: min(16px, 3.3vw); line-height: 1.25; text-align: left; white-space: nowrap; }
.window-note b { font-weight: normal; background: linear-gradient(transparent 55%, rgba(122,162,54,.45) 55%); }
.cta { position: relative; display: flex; gap: 10px; align-items: center; margin-top: 11px; }
.big-cta { flex: 1; white-space: nowrap; padding: 6px 12px; font-size: clamp(20px, 6.2vw, 26px); min-height: 52px; animation: ctaPulse 2.2s 1s ease-in-out infinite; }
@keyframes ctaPulse { 0%, 80%, 100% { transform: scale(1); } 88% { transform: scale(1.05) rotate(-1.5deg); } 94% { transform: scale(1.02) rotate(1deg); } }
.nope { white-space: nowrap; background: #c7c7c7; font-size: 20px; min-height: 48px; padding: 4px 15px; z-index: 50; }
.nope.loose { position: fixed; margin: 0; transform-origin: 0 0; z-index: 60; transition: left .22s cubic-bezier(.3,1.5,.5,1), top .22s cubic-bezier(.3,1.5,.5,1); }
.replay { flex: none; align-self: center; min-height: 40px; font-size: 15px; opacity: .7; }

/* page entrance once the intro hands off */
body.pre .card { opacity: 0; }
body.entering .card { animation: cardUp .42s cubic-bezier(.25,1.3,.5,1) both; }
body.entering .banner { animation: fadeIn .3s both; }
@keyframes cardUp { from { opacity: 0; transform: translateY(60px) rotate(3deg); } to { opacity: 1; transform: rotate(-.4deg); } }

/* ======================= RSVP SHEET ======================= */
.sheet {
  position: fixed; inset: 0; z-index: 55; background: rgba(20,10,32,.92);
  padding: calc(var(--safe-t) + 6px) 8px calc(var(--safe-b) + 8px);
  display: flex;
}
.sheet[hidden] { display: none; }
.sheet.open .sheet-paper { animation: sheetUp .3s cubic-bezier(.25,1.2,.5,1) both; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }
.sheet-paper {
  flex: 1; max-width: 520px; margin: 0 auto; width: 100%; border-radius: 10px;
  padding: 8px 14px 14px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column;
}
.sheet-head { display: flex; align-items: center; gap: 6px; padding-right: 46px; }
.close {
  flex: none; min-height: 44px; min-width: 64px; padding: 0 10px; border-radius: 22px;
  background: var(--night); color: var(--cream); border: 2.5px solid var(--ink);
  font: 18px 'Bangers', sans-serif; letter-spacing: 1px;
}
.join-h {
  font: clamp(18px, 5.3vw, 30px)/1 'Luckiest Guy', sans-serif; min-width: 0; font-weight: normal; color: var(--lime); text-transform: uppercase;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 0 3px 0 var(--ink); letter-spacing: 1px; white-space: nowrap;
}
#form[hidden] { display: none; }
#form { display: flex; flex-direction: column; flex: 1; justify-content: space-evenly; gap: 8px; margin-top: 6px; }
.field { display: block; border: 0; }
.field.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field.row .lbl { margin: 0; }
.field legend, .lbl { display: block; font: 19px 'Bangers', sans-serif; letter-spacing: 1px; margin-bottom: 4px; }
.field legend small, .lbl small { font-family: 'Patrick Hand', sans-serif; letter-spacing: 0; font-size: 15px; opacity: .7; }
input {
  width: 100%; font: 20px 'Patrick Hand', sans-serif; color: var(--ink);
  background: #fffdf2; border: 3px solid var(--ink); border-radius: 8px; padding: 6px 10px; min-height: 46px;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,.12);
}
.attend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.att {
  min-height: 52px; border: 3px solid var(--ink); border-radius: 12px; background: #fffdf2; color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink); transition: transform .08s, background .15s;
  font: 18px/1.05 'Bangers', sans-serif; letter-spacing: .8px; padding: 3px;
}
.att[aria-checked="true"] { transform: translate(2px, 2px) rotate(-1.5deg); box-shadow: 1px 1px 0 var(--ink); }
.att.yes[aria-checked="true"] { background: var(--lime); }
.att.maybe[aria-checked="true"] { background: var(--yellow); }
.att.no[aria-checked="true"] { background: #f0a58a; }
.stepper { flex: none; display: inline-flex; align-items: center; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; box-shadow: 3px 3px 0 var(--ink); background: #fffdf2; }
.stepper button { width: 50px; height: 46px; border: 0; background: var(--lime); font: 900 30px/1 system-ui, sans-serif; color: var(--ink); }
.stepper button:first-child { border-right: 3px solid var(--ink); }
.stepper button:last-child { border-left: 3px solid var(--ink); }
.stepper output { width: 52px; text-align: center; font: 28px 'Luckiest Guy', sans-serif; color: var(--orange); }
.err {
  background: var(--orange); color: var(--cream); border: 3px solid var(--ink); border-radius: 10px;
  padding: 6px 10px; font-size: 18px; box-shadow: 3px 3px 0 var(--ink); animation: shake .4s;
}
.err::before { content: 'Ruh-roh! '; font-family: 'Bangers', sans-serif; letter-spacing: 1px; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.submit { width: 100%; font-size: 28px; min-height: 56px; }
.submit[disabled] { opacity: .75; }
.submit.busy::after { content: ''; width: 20px; height: 20px; margin-left: 10px; border: 4px solid var(--cream); border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result { flex: 1; display: flex; flex-direction: column; justify-content: space-evenly; align-items: center; text-align: center; gap: 6px; }
.result[hidden] { display: none; }
.jinkies-h {
  text-transform: uppercase; letter-spacing: 2px;
  font: clamp(46px, 14vw, 72px)/1 'Luckiest Guy', sans-serif; color: var(--yellow);
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink);
  animation: slam .5s cubic-bezier(.3,1.8,.5,1) both;
}
.res-sub { font-size: 19px; line-height: 1.2; }
.final-clue {
  position: relative; width: 100%; max-width: 420px; text-align: left;
  background: #fffdf2; border: 3px solid var(--ink); border-radius: 6px; padding: 10px 12px 12px;
  box-shadow: 5px 5px 0 var(--ink); transform: rotate(1deg);
}
.final-clue[hidden] { display: none; }
.fc-head { font: 18px 'Bangers', sans-serif; letter-spacing: 1px; color: var(--teal); }
.fc-addr { font: bold 21px/1.2 'Courier New', ui-monospace, monospace; margin: 6px 0; min-height: 1.2em; word-break: break-word; }
.fc-addr.typing::after { content: '|'; animation: caret .6s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.fc-note { font-size: 16px; line-height: 1.2; margin-bottom: 10px; }
.rubber {
  position: absolute; right: -10px; top: -16px; transform: rotate(-12deg) scale(3); opacity: 0;
  font: 18px/1 'Bangers', sans-serif; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--orange); border: 4px solid var(--orange); border-radius: 6px; padding: 4px 8px;
  background: #f5e9c8; z-index: 20; box-shadow: 2px 2px 0 rgba(0,0,0,.25);
}
.final-clue.stamped .rubber { animation: stampIt .35s cubic-bezier(.5,0,.6,1.4) forwards; }
@keyframes stampIt { to { transform: rotate(-12deg) scale(1); opacity: 1; } }
.res-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 6px; }

/* ======================= REDUCED MOTION: same beats, calmer ======================= */
/* No slams/zooms/shake/flash/spin: everything becomes a short fade or a soft crossfade. */
.rm #intro.play .badge,
.rm #intro.play h1.big .w,
.rm #intro.play .mword,
.rm #intro.play .gang,
.rm #intro.play .gang figcaption,
.rm #intro.revealed .i-itwas span,
.rm #intro.revealed .big-bust .hat { animation-name: fadeIn; animation-timing-function: ease-out; }
.rm #intro.play .mpanel { animation-name: fadeIn; animation-timing-function: ease-out; animation-duration: .22s; }
.rm #intro.play .i-title { animation-name: fadeOut; }
.rm #intro.play .mpanel img { animation: none; transform: none; }
.rm #intro.play .i-unmask { animation-name: fadeIn; clip-path: none; opacity: 0; }
.rm .mpanel { transform: translateX(var(--x)) rotate(var(--r)); }
.rm .mword { transform: rotate(var(--wr)); }
.rm .gang { transform: rotate(-2deg); }
.rm .gang figcaption { transform: rotate(-3deg); }
.rm .bust .hat { transform: rotate(14deg); }
.rm .sfx { animation-name: sfxFade; animation-duration: .6s; animation-timing-function: ease-out; transform: rotate(var(--rot)); }
.rm .big-cta, .rm .mute.nudge { animation: none; }
.rm body.entering .card { animation-name: fadeIn; }
.rm .sheet.open .sheet-paper { animation-name: fadeIn; }
.rm .jinkies-h { animation-name: fadeIn; }
.rm .final-clue.stamped .rubber { animation: none; opacity: 1; transform: rotate(-12deg); }
.rm .btn, .rm .att, .rm .nope.loose { transition: none; }

/* Window into the episode: the van loop crossfades over the banner still. */
.banner .window-loop { position: absolute; inset: 4px; overflow: hidden; border-radius: 2px; opacity: 0; transition: opacity .8s ease; pointer-events: none; background: #000; }
.banner .window-loop.on { opacity: 1; }
.banner .window-loop video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 55%; visibility: hidden; }
.banner .window-loop video.front { visibility: visible; }
.banner figcaption { z-index: 2; }

/* Desktop: scale the whole one-screen page up a notch (zoom keeps the phone layout intact,
   height is divided back so it still fits exactly), and the RSVP sheet becomes a centred
   card of fixed comfortable height instead of a full-height column. */
@media (min-width: 900px) and (min-height: 640px) {
  #page { zoom: 1.18; max-width: 540px; }
  .sheet { align-items: center; }
  .sheet-paper { zoom: 1.12; flex: none; height: auto; max-height: 88dvh; max-width: 500px; }
  #form { flex: none; gap: 14px; margin-top: 12px; }
}
@media (min-width: 900px) and (min-height: 900px) {
  #page { zoom: 1.32; }
  .sheet-paper { zoom: 1.25; }
}
@media (min-width: 1200px) and (min-height: 1040px) {
  #page { zoom: 1.5; }
  .sheet-paper { zoom: 1.4; }
}
/* street address is the longest tile value: scale with width so it fits a 320px iPhone SE */
#whereSt { font-size: clamp(14px, min(4.6vw, 3.4dvh), 24px); }
/* result: never let "Jinkies!" ride up into the sheet header (desktop sheet is content-height) */
.result { margin-top: 14px; padding-bottom: 6px; }
@media (min-width: 900px) and (min-height: 640px) { .result { gap: 14px; justify-content: flex-start; } }
/* final clue: room above the address heading so the overhanging stamp sits clear of it */
.final-clue { margin-top: 18px; }
.final-clue .rubber { top: -30px; right: -10px; }
.final-clue .fc-head { padding-right: 0; }
