/* Not My Event: the look of "The Queen's Delusional Department" (public/templates/queens-delusional-department.html). One page that scrolls DOWN through five places of one day at a
   palace. Each scene is a section with a pinned picture behind it (.stage, drawn by delusional-art.js for the size of the screen) and its words and toys in front (.flow), which simply
   scroll: nothing is clipped on a small phone and nothing has to be finished to go on. The scroll frame in delusional.js writes only transform and opacity on a few layers.
   Midnight violet, royal plum, antique gold, blush and ivory. */
:root { --ac: #D6AD68; --ac2: #F6DFA8; --wine: #9A2E4A; --plum: #51385F; --night: #241D39; --blush: #E8B8D1; --ivory: #FFF6E8; --ink: #23172A; --head: 'Cinzel', 'Trajan Pro', Georgia, serif; --ed: 'Cormorant Garamond', Georgia, serif; --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--night); color: var(--ivory); font-family: var(--sans); line-height: 1.45; overflow-x: clip; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p, dl, dd, ul, ol, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 8px; top: -60px; z-index: 9100; background: #fff; color: #000; padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid #7FD4F5; outline-offset: 3px; }

/* ---------- the two controls at the top, the details pill, the sound hint ---------- */
#menu-wrap { position: fixed; left: 10px; top: 10px; z-index: 9040; }
#b-menu { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid rgba(255, 246, 232, .4); background: rgba(36, 29, 57, .9); color: #fff; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; font-size: 13px; }
#menu { margin-top: 8px; display: grid; gap: 6px; padding: 8px; border-radius: 14px; background: rgba(36, 29, 57, .97); border: 1px solid rgba(255, 246, 232, .25); min-width: 220px; }
#menu button { min-height: 44px; text-align: left; padding: 0 12px; border-radius: 9px; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 15px; }
#menu button[aria-pressed="true"] { background: var(--ac); color: var(--ink); }
#ev-pill { position: fixed; left: 50%; bottom: max(10px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9030; min-height: 40px; padding: 0 16px; border-radius: 20px; border: 1px solid rgba(255, 246, 232, .45); background: rgba(36, 29, 57, .92); color: #fff; font-size: 13px; letter-spacing: .04em; }
#snd-hint { position: fixed; left: 50%; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 48px); transform: translateX(-50%); z-index: 9030; padding: 6px 12px; border-radius: 14px; background: rgba(36, 29, 57, .92); color: #fff; font-size: 12px; white-space: nowrap; transition: opacity .4s; pointer-events: none; }
#snd-hint.gone { opacity: 0; }

/* ---------- a scene: a pinned picture, and the words in front ---------- */
.sc { position: relative; background: var(--night); }
.stage { position: sticky; top: 0; height: 100vh; height: 100lvh; overflow: hidden; z-index: 0; }
.flow { position: relative; z-index: 1; margin-top: -100vh; margin-top: -100lvh; }
.flow, .beat { pointer-events: none; }
.beat > * { pointer-events: auto; }
.ly, .ov, .pull { position: absolute; inset: 0; pointer-events: none; }
.ly svg { display: block; width: 100%; height: 100%; }
.ov { opacity: 0; z-index: 4; }
.beat { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 76px 16px 96px; text-align: center; }
.beat.tall { min-height: 125vh; justify-content: flex-start; padding-top: 14vh; }
.beat.out { min-height: 70vh; justify-content: flex-end; padding-bottom: 24vh; }
.cue { font-weight: 900; font-size: 12.5px; letter-spacing: .12em; text-transform: uppercase; padding: 7px 14px; border-radius: 16px; background: rgba(36, 29, 57, .9); color: #fff; }
.cue::after { content: '  ↓'; }
.linkish { background: none; border: 0; padding: 10px 8px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; color: inherit; opacity: .9; }
.linkish.light { color: #fff; background: rgba(36, 29, 57, .8); border-radius: 12px; }
.minor { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; }
.fine { font-size: 12.5px; opacity: .8; }
.status { font-weight: 700; font-size: 14px; color: #fff; background: rgba(36, 29, 57, .85); padding: 4px 12px; border-radius: 12px; }
.status:empty { display: none; }
.plate { font-family: var(--head); font-weight: 700; letter-spacing: .18em; font-size: clamp(11px, 3.1vw, 14px); padding: 8px 16px; border-radius: 4px; background: var(--wine); color: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .35); }
.unit { width: 100%; max-width: 640px; padding: 22px 18px 14px; border-radius: 16px; display: grid; gap: 14px; justify-items: center; }
.unit h2 { font-family: var(--ed); font-weight: 700; font-size: clamp(24px, 6.4vw, 34px); line-height: 1.1; }
.unit.glass { background: linear-gradient(180deg, rgba(81, 56, 95, .97), rgba(36, 29, 57, .98)); border: 2px solid var(--ac); box-shadow: 0 14px 40px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .15); }
.head { font-family: var(--ed); font-weight: 700; font-size: clamp(32px, 9vw, 64px); line-height: 1.04; max-width: 12em; color: var(--ivory); text-shadow: 0 3px 12px rgba(0, 0, 0, .75); }
.order { font-family: var(--head); font-weight: 900; font-size: clamp(30px, 8.6vw, 72px); line-height: 1.06; letter-spacing: .02em; text-transform: uppercase; max-width: 11em; color: var(--ac2); text-shadow: 0 3px 0 rgba(0, 0, 0, .5), 0 0 30px rgba(214, 173, 104, .5); overflow-wrap: anywhere; }
.tagline { font-family: var(--ed); font-style: italic; font-weight: 500; font-size: clamp(19px, 5.2vw, 27px); line-height: 1.25; max-width: 24em; padding: 8px 14px; border-radius: 8px; background: rgba(36, 29, 57, .82); overflow-wrap: anywhere; }
.say { max-width: 32em; font-size: clamp(15px, 4.2vw, 19px); line-height: 1.4; padding: 10px 14px; border-radius: 10px; background: rgba(36, 29, 57, .92); color: #fff; border-left: 4px solid var(--ac); text-align: left; overflow-wrap: anywhere; }
.say.in { background: rgba(0, 0, 0, .3); }
.say.in:empty { display: none; }
.say .who { display: block; font-weight: 900; font-size: .7em; letter-spacing: .14em; color: var(--ac); }
.btn-big { min-height: 56px; padding: 10px 24px; border-radius: 30px; border: 3px solid var(--ac2); background: var(--wine); color: #fff; font-family: var(--head); font-weight: 900; font-size: clamp(15px, 4.2vw, 20px); line-height: 1.2; letter-spacing: .06em; text-transform: uppercase; box-shadow: 0 5px 0 #5A1428; touch-action: manipulation; max-width: 100%; }
.btn-big:active { transform: translateY(3px); box-shadow: 0 2px 0 #5A1428; }
.btn-big.champ { background: linear-gradient(180deg, #F6DFA8, #D6AD68); color: var(--ink); border-color: var(--ink); box-shadow: 0 5px 0 #7A5A2A; }
.btn-big:disabled { opacity: .5; }
.done-line { font-weight: 700; color: var(--ac2); font-size: 15px; }
.crest { width: clamp(70px, 20vw, 110px); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.crest svg { display: block; width: 100%; height: auto; }

/* ---------- 1. the palace hall, the decree and the stamp ---------- */
/* the doors stand open and the curtain is up; the opening plays them from shut, once */
#s1 .doorl { transform: perspective(900px) rotateY(-74deg); } #s1 .doorr { transform: perspective(900px) rotateY(74deg); }
#s1 .curtain { transform: translateY(-86%); }
body.intro #s1 .doorl { animation: doorl 1.7s cubic-bezier(.5, 0, .2, 1) .5s both; } body.intro #s1 .doorr { animation: doorr 1.7s cubic-bezier(.5, 0, .2, 1) .5s both; }
body.intro #s1 .curtain { animation: rise 1.5s cubic-bezier(.6, 0, .3, 1) both; }
@keyframes doorl { from { transform: perspective(900px) rotateY(0); } } @keyframes doorr { from { transform: perspective(900px) rotateY(0); } }
@keyframes rise { from { transform: translateY(0); } }
.scroll { width: 100%; max-width: 560px; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .55)); }
.rod { height: 20px; margin: 0 -10px; border-radius: 10px; background: linear-gradient(180deg, #F6DFA8, #D6AD68 45%, #8E6A34 55%, #E2BE7E); position: relative; z-index: 1; }
.paper { position: relative; padding: 26px clamp(14px, 5vw, 34px) 22px; display: grid; gap: 10px; justify-items: center; color: var(--ink); background: repeating-linear-gradient(180deg, rgba(81, 56, 95, 0) 0 46px, rgba(81, 56, 95, .07) 46px 48px), linear-gradient(180deg, #FFF6E8, #F2E3C8); margin: -6px 0; }
/* the scroll unrolls once: the paper is uncovered from the top and the lower rod rides down with it */
.scroll.roll .paper { animation: unroll 1.5s cubic-bezier(.4, 0, .3, 1) both; }
.scroll.roll .rod.low { animation: rodrun 1.5s cubic-bezier(.4, 0, .3, 1) both; }
@keyframes unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes rodrun { from { transform: translateY(calc(-1 * var(--ph, 300px))); } }
.p-seal { width: 62px; margin-top: -8px; } .p-seal svg { display: block; width: 100%; height: auto; }
.paper h2 { font-family: var(--head); font-weight: 900; font-size: clamp(18px, 5.2vw, 26px); letter-spacing: .06em; text-transform: uppercase; color: var(--wine); }
.paper .by { font-family: var(--ed); font-style: italic; font-size: 17px; }
.paper .nm { font-family: var(--ed); font-weight: 700; font-size: clamp(28px, 8vw, 44px); line-height: 1.05; min-height: 1.1em; overflow-wrap: anywhere; }
.paper .narr { font-family: var(--ed); font-weight: 600; font-size: clamp(18px, 5vw, 22px); line-height: 1.25; max-width: 22em; overflow-wrap: anywhere; }
.demands { display: grid; gap: 6px; width: 100%; max-width: 400px; text-align: left; counter-reset: d; }
.demands li { counter-increment: d; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed rgba(81, 56, 95, .4); font-family: var(--ed); font-weight: 600; font-size: clamp(18px, 5vw, 22px); line-height: 1.2; overflow-wrap: anywhere; }
.demands li::before { content: counter(d, upper-roman) '.'; font-family: var(--head); font-weight: 700; font-size: .7em; color: var(--wine); min-width: 2em; }
.paper .aside { font-size: 14px; font-style: italic; opacity: .85; max-width: 26em; }
.spot { width: min(100%, 320px); min-height: 96px; display: grid; place-items: center; border: 2px dashed rgba(154, 46, 74, .55); border-radius: 10px; padding: 8px; margin-top: 4px; }
.spot-wait { font-weight: 900; font-size: 12px; letter-spacing: .2em; color: rgba(154, 46, 74, .7); }
.spot.hot { background: rgba(154, 46, 74, .12); border-style: solid; }
.imprint { display: block; font-family: var(--head); font-weight: 900; font-size: clamp(16px, 4.8vw, 22px); line-height: 1.15; letter-spacing: .05em; color: #B33A58; border: 4px double #B33A58; border-radius: 8px; padding: 8px 12px; transform: rotate(-5deg); }
.imprint small { display: block; font-size: .65em; letter-spacing: .24em; }
.spot.done { border-color: transparent; }
.spot.thud .imprint { animation: thud .5s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes thud { from { opacity: 0; transform: rotate(-5deg) scale(2.4); } 55% { opacity: 1; transform: rotate(-5deg) scale(.9, .82); } to { transform: rotate(-5deg) scale(1); } }
.scroll.jolt { animation: joltdown .35s ease-out; }
@keyframes joltdown { 30% { transform: translateY(6px) scale(1, .985); } }
.tray { display: grid; gap: 10px; justify-items: center; padding: 12px 14px; border-radius: 16px; background: rgba(36, 29, 57, .9); border: 1px solid rgba(214, 173, 104, .5); max-width: 100%; }
.stamp { width: 92px; padding: 0; border: 0; background: none; touch-action: none; cursor: grab; position: relative; z-index: 5; }
.stamp svg { display: block; width: 100%; height: auto; pointer-events: none; }
.stamp.drag { cursor: grabbing; filter: drop-shadow(0 16px 12px rgba(0, 0, 0, .5)); }
.stamp.back { transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.stamp:not(.drag):not(.back) { animation: nudge 3s ease-in-out infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-8px) rotate(-5deg); } 90% { transform: translateY(0) rotate(0); } }
.hint { font-size: 13.5px; max-width: 24em; }

/* ---------- 2. the Treasury ---------- */
.purse { display: grid; justify-items: center; gap: 2px; padding: 10px 18px; border-radius: 12px; background: #1C162E; border: 2px solid var(--ac); width: 100%; }
.p-lab { font-weight: 900; font-size: 12px; letter-spacing: .18em; color: var(--ac); }
.p-num { font-family: var(--head); font-weight: 900; font-size: clamp(46px, 14vw, 76px); line-height: 1; color: var(--ac2); text-shadow: 0 3px 0 rgba(0, 0, 0, .4); }
.wishes { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wish { position: relative; min-height: 104px; padding: 12px 10px 10px; border-radius: 6px; border: 0; background: linear-gradient(180deg, #FFF6E8, #F0E0C4); color: var(--ink); display: grid; gap: 6px; align-content: space-between; justify-items: start; text-align: left; box-shadow: 0 6px 12px rgba(0, 0, 0, .4), inset 0 0 0 2px rgba(214, 173, 104, .8); overflow: hidden; }
.wish .w-t { font-family: var(--ed); font-weight: 700; font-size: clamp(17px, 4.6vw, 21px); line-height: 1.12; overflow-wrap: anywhere; }
.wish .w-p { font-weight: 900; font-size: 13px; letter-spacing: .04em; padding: 2px 8px; border-radius: 10px; background: var(--plum); color: #fff; overflow-wrap: anywhere; }
.wish:active { transform: translateY(2px); }
.wish[aria-pressed="true"] { background: linear-gradient(180deg, #E8DCC6, #D8C8A8); }
.wish[aria-pressed="true"] .w-t { opacity: .55; }
.wish .w-s { position: absolute; right: 6px; top: 8px; max-width: 80%; font-family: var(--head); font-weight: 900; font-size: 11.5px; line-height: 1.1; letter-spacing: .06em; color: #B33A58; border: 3px double #B33A58; border-radius: 5px; padding: 3px 6px; transform: rotate(8deg); background: rgba(255, 246, 232, .85); text-align: center; }
.wish .w-s.ok { color: #2E7A52; border-color: #2E7A52; }
.arrive { width: 100%; min-height: 0; }
.arrive:empty { display: none; }
.slip { position: relative; padding: 14px 14px 12px; border-radius: 6px; background: linear-gradient(180deg, #FFF6E8, #F0E0C4); color: var(--ink); text-align: left; display: grid; gap: 6px; box-shadow: 0 10px 20px rgba(0, 0, 0, .45); animation: land .5s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes land { from { opacity: 0; transform: translateY(-70px) rotate(-7deg); } }
.slip small { font-weight: 900; font-size: 11px; letter-spacing: .16em; color: var(--plum); }
.slip .s-w { font-family: var(--ed); font-weight: 700; font-size: clamp(20px, 5.6vw, 26px); line-height: 1.1; overflow-wrap: anywhere; padding-right: 4px; }
.slip .s-k { justify-self: start; font-family: var(--head); font-weight: 900; font-size: clamp(17px, 5vw, 24px); letter-spacing: .05em; line-height: 1.1; color: #B33A58; border: 4px double #B33A58; border-radius: 6px; padding: 4px 10px; transform: rotate(-3deg); animation: thud2 .45s cubic-bezier(.2, 1.6, .4, 1) .45s both; }
.slip .s-k.ok { color: #2E7A52; border-color: #2E7A52; }
@keyframes thud2 { from { opacity: 0; transform: rotate(-3deg) scale(2.2); } to { opacity: 1; transform: rotate(-3deg) scale(1); } }
.slip .s-v { font-weight: 700; font-size: clamp(15px, 4.2vw, 18px); line-height: 1.3; overflow-wrap: anywhere; animation: fadein .4s .8s both; }
.ledger { width: 100%; padding: 12px 12px 10px; background: #FFFDF6; color: var(--ink); border-radius: 3px; font-family: 'Courier New', ui-monospace, monospace; text-align: left; box-shadow: 0 8px 16px rgba(0, 0, 0, .4); }
.l-top { text-align: center; font-weight: 700; letter-spacing: .2em; font-size: 13px; padding-bottom: 6px; border-bottom: 2px dashed rgba(35, 23, 42, .5); }
.ledger ol { display: grid; }
.ledger li { padding: 8px 0; border-bottom: 1px dashed rgba(35, 23, 42, .35); font-size: 13.5px; line-height: 1.35; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; overflow-wrap: anywhere; }
.ledger li.new { animation: print .7s steps(7) both; }
@keyframes print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.ledger li b { text-align: right; color: #B33A58; white-space: nowrap; }
.ledger li i { grid-column: 1 / -1; font-style: normal; opacity: .8; }
.l-bal { display: flex; justify-content: space-between; gap: 10px; padding-top: 8px; font-weight: 700; font-size: 15px; } .l-bal b { color: #B33A58; text-align: right; overflow-wrap: anywhere; }
.finding { font-family: var(--head); font-weight: 900; font-size: clamp(17px, 5vw, 26px); letter-spacing: .05em; line-height: 1.15; color: #fff; background: var(--wine); padding: 7px 16px; border-radius: 6px; transform: rotate(-2deg); animation: slam .4s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes slam { from { opacity: 0; transform: scale(1.5) rotate(-3deg); } }
@keyframes fadein { from { opacity: 0; } }
.rank { display: grid; gap: 2px; padding: 10px 14px; border-radius: 10px; border: 2px solid var(--ac); background: #1C162E; }
.rank small { font-weight: 900; font-size: 11px; letter-spacing: .18em; color: var(--ac); }
.rank b { font-family: var(--head); font-weight: 900; font-size: clamp(16px, 4.8vw, 22px); line-height: 1.2; letter-spacing: .03em; color: var(--ac2); overflow-wrap: anywhere; }

/* ---------- 3. the Complaints Office ---------- */
.folders { width: 100%; max-width: 720px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 700px) { .folders { grid-template-columns: repeat(4, 1fr); } }
.folders li { display: grid; gap: 8px; align-content: start; }
.fd { width: 100%; padding: 10px 8px 8px; border-radius: 14px; border: 2px solid var(--ac); background: rgba(36, 29, 57, .94); color: #fff; display: grid; gap: 4px; justify-items: center; box-shadow: 0 8px 18px rgba(0, 0, 0, .45); }
.fd svg { display: block; width: min(100%, 120px); height: auto; }
.fd .nm { font-weight: 900; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.fd .tap { font-size: 12px; opacity: .8; }
.fd[aria-expanded="true"] { background: var(--plum); border-color: #fff; }
.fd[aria-expanded="true"] svg { animation: react .5s cubic-bezier(.2, 1.5, .4, 1); }
@keyframes react { 40% { transform: scale(1.1) rotate(-4deg); } }
.comp { padding: 10px 12px; border-radius: 4px 14px 14px 14px; background: var(--ivory); color: var(--ink); text-align: left; display: grid; gap: 6px; animation: slam .3s ease both; }
.comp .c-q { font-family: var(--ed); font-weight: 700; font-size: clamp(17px, 4.6vw, 20px); line-height: 1.15; overflow-wrap: anywhere; }
.comp .c-v { justify-self: start; font-family: var(--head); font-weight: 900; font-size: 12.5px; line-height: 1.15; letter-spacing: .05em; color: #2E7A52; border: 3px double #2E7A52; border-radius: 5px; padding: 3px 7px; transform: rotate(-2deg); }
.comp .c-n { font-size: 13.5px; line-height: 1.3; opacity: .9; overflow-wrap: anywhere; }
.status.light:empty { display: none; }
.meter { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; text-align: left; }
.m-lab { grid-column: 1 / -1; font-weight: 900; font-size: 12px; letter-spacing: .16em; color: var(--ac); }
.m-bar { height: 22px; border-radius: 11px; background: #1C162E; border: 2px solid var(--ac); overflow: hidden; }
.m-bar i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(.74); background: linear-gradient(90deg, var(--blush), var(--wine)); border-radius: 9px; transition: transform .7s cubic-bezier(.3, 1.6, .5, 1); }
.m-num { font-family: var(--head); font-weight: 900; font-size: clamp(26px, 7.4vw, 38px); line-height: 1; min-width: 2.8em; text-align: right; }
.meter.jolt { animation: jolt .45s ease; }
@keyframes jolt { 20% { transform: translateX(-5px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } }
.redalert { font-family: var(--head); font-weight: 900; font-size: clamp(20px, 6vw, 34px); line-height: 1.12; letter-spacing: .03em; color: #fff; background: #C0304A; padding: 10px 16px; border-radius: 8px; box-shadow: 0 0 0 4px rgba(192, 48, 74, .35); animation: slam .45s cubic-bezier(.2, 1.5, .4, 1) both; overflow-wrap: anywhere; }
.stk { transition: transform .6s cubic-bezier(.3, 1.5, .5, 1); }
#s3.n1 .stk { transform: scaleY(1.35); } #s3.n2 .stk { transform: scaleY(1.8); } #s3.n3 .stk { transform: scaleY(2.4); } #s3.n4 .stk { transform: scaleY(3); }
#s3.n2 .stk.s1, #s3.n3 .stk.s1, #s3.n4 .stk.s1 { transform: scaleY(2.6) rotate(2deg); }
#s3 .alarm { opacity: 0; }
#s3.red .alarm { animation: alarm 2.6s ease-out both; }
@keyframes alarm { 0% { opacity: 0; } 15% { opacity: .3; } 45% { opacity: .06; } 65% { opacity: .22; } 100% { opacity: 0; } }

/* ---------- 4. the council, and the ballroom ---------- */
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.pull { transform: perspective(1000px) translateZ(110px); transition: transform 2s cubic-bezier(.3, 0, .2, 1); }
#s4.party .pull { transform: perspective(1000px) translateZ(0); }
.dev { font-family: var(--head); font-weight: 900; font-size: clamp(30px, 9.4vw, 78px); line-height: 1.04; letter-spacing: .03em; color: #fff; text-shadow: 0 4px 0 #5A1428, 0 0 40px rgba(192, 48, 74, .7); max-width: 9em; }
.foil { font-family: var(--head); font-weight: 900; font-size: clamp(28px, 8.6vw, 70px); line-height: 1.06; letter-spacing: .02em; max-width: 12em; overflow-wrap: anywhere; }
.foil span { display: block; color: transparent; background: linear-gradient(100deg, #A47A3C 0%, #F6DFA8 22%, #FFF6E8 30%, #D6AD68 44%, #A47A3C 60%, #F6DFA8 80%, #D6AD68 100%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; filter: drop-shadow(0 3px 0 rgba(35, 23, 42, .8)) drop-shadow(0 0 16px rgba(35, 23, 42, .7)); animation: sheen 6s ease-in-out infinite alternate; }
@keyframes sheen { from { background-position: 0 0; } to { background-position: 100% 0; } }
#l-advisor, .foil, #b-reveal { display: none; }
#s4.party #l-advisor { display: block; animation: slam .5s cubic-bezier(.2, 1.4, .4, 1) .3s both; }
#s4.party .foil { display: block; animation: slam .6s cubic-bezier(.2, 1.4, .4, 1) 1.3s both; }
#s4.party #b-reveal { display: inline-block; animation: fadein .5s 2.1s both; }
#s4.party .dev, #s4.party #b-twist, #s4.party #l-panic { display: none; }
#s4.hold .dev { animation: hold 1.2s steps(1) both; }
@keyframes hold { from { transform: scale(1.06); } }
#s4 .ball, #s4 .lights, #s4 .dancers { opacity: 0; transition: opacity 1.4s ease .3s; }
#s4.party .ball, #s4.party .lights { opacity: 1; }
#s4 .dancers { transform: translateY(3%); transition: opacity 1s ease 1.5s, transform 1s ease 1.5s; } #s4.party .dancers { opacity: 1; transform: none; }
#s4 .desks { transform-origin: 50% 100%; transition: transform 1.1s cubic-bezier(.6, 0, .4, 1), opacity .5s ease .7s; } #s4.party .desks { transform: perspective(700px) rotateX(-80deg) translateY(30%); opacity: 0; }
#s4 .chand { transform: translateY(-62%); transition: transform 1.6s cubic-bezier(.3, 1.2, .4, 1) .8s; } #s4.party .chand { transform: none; }
.cab { transition: transform .9s cubic-bezier(.3, 1.4, .5, 1) .5s; }
#s4.party .cab.l { transform: rotate(24deg); } #s4.party .cab.r { transform: rotate(-24deg); }
#s4 .dark { background: var(--night); }
#s4 .num { animation: tally 1.2s steps(2, jump-none) infinite; } #s4 .num.n1 { animation-delay: -.4s; } #s4 .num.n2 { animation-delay: -.8s; }
@keyframes tally { from { opacity: 1; } to { opacity: .4; } }

/* ---------- 5. the summons ---------- */
#s5 .beat { padding-top: 110px; }
.summons { position: relative; width: 100%; max-width: 600px; padding: clamp(34px, 8vw, 50px) clamp(16px, 5vw, 40px) clamp(20px, 5vw, 34px); display: grid; gap: 11px; justify-items: center; color: var(--ink); background: linear-gradient(180deg, #FFF6E8, #F4E6CC); box-shadow: inset 0 0 0 2px #FFF6E8, inset 0 0 0 5px var(--ac), inset 0 0 0 7px #FFF6E8, inset 0 0 0 8px var(--ac), 0 26px 50px rgba(0, 0, 0, .55); border-radius: 4px; }
.s-seal { position: absolute; left: 50%; top: -38px; width: 76px; margin-left: -38px; filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .4)); }
.s-seal svg { display: block; width: 100%; height: auto; }
.s-top { font-family: var(--head); font-weight: 700; font-size: clamp(11px, 3.1vw, 13px); letter-spacing: .24em; color: var(--wine); margin-top: 6px; }
#t-title { font-family: var(--ed); font-weight: 700; font-size: clamp(22px, 6.2vw, 34px); line-height: 1.12; overflow-wrap: anywhere; }
.summons .rule { width: 60%; height: 3px; background: linear-gradient(90deg, transparent, var(--ac), transparent); }
.summons .event { font-family: var(--ed); font-style: italic; font-weight: 600; font-size: clamp(21px, 5.8vw, 28px); line-height: 1.15; overflow-wrap: anywhere; min-height: 1.1em; }
.summons .when { font-weight: 900; font-size: clamp(16px, 4.6vw, 20px); }
.summons .where { font-size: clamp(15px, 4.3vw, 18px); overflow-wrap: anywhere; }
.summons .dress, .summons .with { font-size: 15px; overflow-wrap: anywhere; }
.summons .closing { font-family: var(--ed); font-style: italic; font-weight: 600; font-size: clamp(17px, 4.8vw, 21px); color: var(--wine); overflow-wrap: anywhere; }
.acts, .row-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 22px; border-radius: 24px; border: 2px solid var(--ac); background: var(--ac); color: var(--ink); font-weight: 900; font-size: 15px; letter-spacing: .03em; }
.btn.ghost { background: transparent; color: var(--ac); }
.summons .btn { border-color: var(--plum); background: var(--plum); color: var(--ivory); } .summons .btn.ghost { background: transparent; color: var(--plum); }
.btn:disabled { opacity: .5; }

/* ---------- the details, the reply, the certificate ---------- */
.after { position: relative; z-index: 2; background: #2E2346; color: var(--ivory); padding: 30px 16px calc(96px + env(safe-area-inset-bottom)); display: grid; gap: 34px; justify-items: center; }
.after section { width: 100%; max-width: 560px; display: grid; gap: 14px; }
.after h2 { font-family: var(--ed); font-weight: 700; font-size: 30px; color: var(--ac); }
.det { display: grid; gap: 11px; }
.det div { display: grid; gap: 1px; padding-bottom: 10px; border-bottom: 1px solid rgba(214, 173, 104, .25); }
.det dt { font-weight: 900; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ac); }
.det dd { font-size: 17px; overflow-wrap: anywhere; }
.row-acts { justify-content: flex-start; }
.going { font-size: 14px; color: var(--ac2); }
#rsvp-form { display: grid; gap: 14px; }
.f { display: grid; gap: 6px; font-size: 14px; color: #E4D8E8; }
.f input[type="text"], .f textarea { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(214, 173, 104, .6); background: var(--night); color: #fff; font: inherit; font-size: 16px; }
.ans { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.ans label { display: flex; gap: 10px; align-items: center; min-height: 54px; padding: 8px 12px; border-radius: 10px; border: 1px solid rgba(214, 173, 104, .45); background: var(--night); font-size: 15px; cursor: pointer; }
.ans label:has(input:checked) { border-color: var(--ac); background: var(--plum); box-shadow: inset 0 0 0 1px var(--ac); }
.ans input { width: 20px; height: 20px; accent-color: var(--wine); flex: none; }
.ans b { color: var(--ac2); letter-spacing: .04em; }
.step { display: flex; align-items: center; gap: 14px; }
.step button { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--ac); background: transparent; color: var(--ac); font-size: 22px; }
.step output { min-width: 1.5em; text-align: center; font-size: 20px; color: #fff; }
#err { min-height: 1.3em; font-size: 14px; color: #E4D8E8; } #err.err { color: #FFB0B8; }
#done { display: grid; gap: 8px; padding: 18px; border-radius: 10px; border: 1px solid var(--ac); background: var(--night); justify-items: start; }
.r-stamp span { display: inline-block; font-family: var(--head); font-weight: 900; font-size: clamp(16px, 4.8vw, 24px); letter-spacing: .06em; line-height: 1.15; color: var(--ac2); border: 4px double var(--ac2); border-radius: 6px; padding: 5px 12px; transform: rotate(-3deg); animation: slam .4s cubic-bezier(.2, 1.5, .4, 1) both; }
#done-t { font-family: var(--ed); font-weight: 700; font-size: 26px; color: var(--ac2); } #done-t:focus { outline: none; }
#r-closed { padding: 14px; border-radius: 10px; background: var(--night); }
#card { text-align: center; justify-items: center; padding: 24px 16px; border-radius: 6px; background: var(--night); box-shadow: inset 0 0 0 2px var(--ac), inset 0 0 0 6px var(--night), inset 0 0 0 7px var(--ac); }
#card .c-top { font-family: var(--head); font-weight: 700; letter-spacing: .16em; font-size: 12.5px; color: var(--ac); }
#card .c-pre { font-family: var(--ed); font-style: italic; font-size: 18px; }
.after .c-h { font-family: var(--head); font-weight: 900; font-size: clamp(18px, 5.4vw, 26px); line-height: 1.2; letter-spacing: .03em; color: var(--ac2); max-width: 16em; overflow-wrap: anywhere; }
.c-acts { justify-content: center; }
.foot { font-size: 12px; opacity: .65; text-align: center; max-width: 30em; }

/* ---------- the small motion in the pictures (slow, and never a strobe) ---------- */
.flame { animation: shimmer 2.2s ease-in-out infinite alternate; } .flame.d { animation-delay: -1.1s; }
@keyframes shimmer { from { opacity: 1; } to { opacity: .6; } }
.bead { animation: slide 6s ease-in-out infinite alternate; } .bead.b1 { animation-duration: 7.5s; animation-delay: -2s; } .bead.b2 { animation-duration: 9s; animation-delay: -4s; }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(14px); } }
.tilt { animation: tilt 5s ease-in-out infinite alternate; }
@keyframes tilt { from { transform: rotate(-9deg); } to { transform: rotate(-13deg); } }
.wheel { animation: wheel 40s linear infinite; }
@keyframes wheel { to { transform: rotate(360deg); } }
.moth { animation: moth 3s ease-in-out infinite alternate; }
@keyframes moth { from { transform: translate(0, 0); } to { transform: translate(10px, -12px); } }
.roll { animation: rolldown 3s linear infinite; }
@keyframes rolldown { from { transform: translateY(0); } to { transform: translateY(40px); } }
.spark { animation: shimmer 3.4s ease-in-out infinite alternate; } .spark.s1 { animation-delay: -1.2s; } .spark.s2 { animation-delay: -2.4s; }
/* a scene off the screen rests */
.sc.off .stage *, .sc.off .flow * { animation-play-state: paused !important; }

/* ---------- reduced motion: every word and control stays; the camera, the doors, the unrolling, the alarm, the rain and the confetti go ---------- */
body.rm *, body.rm *::before, body.rm *::after { animation: none !important; transition: none !important; }
body.rm .ov, body.rm #confetti, body.rm #s3 .alarm { display: none; }
body.rm .pull { transform: none; }
body.rm .beat.tall { min-height: 100vh; }
@media (max-width: 380px) { .beat { padding-left: 10px; padding-right: 10px; } .unit { padding: 18px 10px 12px; } .wishes { gap: 8px; } .wish { min-height: 96px; padding: 10px 8px 8px; } }
