:root {
  --show-ink: #472441;
  --show-rose: #981c5d;
  --show-night: #2c173f;
  --show-gold: #ffe4a3;
}

.festival, .quiz-block {
  width: min(68rem, calc(100% - 1.5rem));
  margin: clamp(1.4rem,6vw,3.8rem) auto 1.25rem;
  scroll-margin-top: 6.5rem;
}
.festival {
  padding: clamp(.5rem,2vw,1.1rem);
  border: 1px solid #a45996;
  border-radius: 1.65rem;
  background: linear-gradient(145deg,#5d3167,#352048 50%,#633452);
  color: #fff5e6;
  box-shadow: 0 0 2rem #d96bb8aa,0 .65rem #984b7c67,inset 0 0 0 3px #ffc5e027;
}
.festival-banner {
  display: grid;
  grid-template-columns: 1fr minmax(6rem,11rem);
  align-items: center;
  min-height: 14rem;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(.8rem,5vw,2.5rem);
  border: 1px solid #e2a4cc;
  border-radius: 1.2rem;
  background: radial-gradient(ellipse at 82% 45%,#d27dcb9e,transparent 52%),radial-gradient(ellipse at 5% -5%,#a761a3,transparent 65%),#4a264f;
}
.festival-banner h2, .quiz-block h2 { margin: 0 0 .65rem; font-size: clamp(2rem,5.8vw,4.25rem); }
.festival-banner h2 { text-shadow: 0 0 .7rem #ffa7e1; }
.festival-banner p { max-width: 36ch; color: #fce1eb; }
.festival-banner .critter.drawn-sticker { width: 100%; height: clamp(6rem,14vw,10.5rem); filter: drop-shadow(0 0 .75rem #fcb4db); }
.festival-orbit { position: absolute; z-index: -1; inset: 0; overflow: hidden; }
.festival-orbit i {
  position: absolute; inset: -20% -20% -40% 32%;
  border: 2px solid #ffdbdf78; border-radius: 48%; transform: rotate(-18deg);
  box-shadow: inset 0 0 1.2rem #ffd4b557,0 0 1.5rem #ffa3da73;
}
.festival-orbit i:nth-child(2) { inset: -17% 12% -60% -16%; transform: rotate(13deg); border-color: #ffd29c78; }
.festival-orbit i:nth-child(3) { inset: 48% 7% -55% -10%; border-color: #d9ffeb84; }
.festival-twinkle { position: absolute; top: 10%; right: 13%; font: bold 2.15rem Georgia,serif; color: #fff1ba; text-shadow: 0 0 .7rem white,0 0 1.1rem #ffe6a9; }
.festival-menu { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: .5rem; margin-top: .7rem; }
.festival-menu button {
  display: grid; justify-items: center; align-content: center; gap: .14rem; min-height: 7.45rem; padding: .42rem .22rem;
  border: 1px solid #f3aecb; border-radius: .9rem; background: radial-gradient(ellipse at 50% 9%,#b7599a,#67365f 72%); color: #fff4e8;
  box-shadow: 0 .25rem #23122e, inset 0 0 0 3px #fff1; line-height: 1.18;
}
.festival-menu button:nth-child(2) { background: radial-gradient(ellipse at top,#8671be,#3e3b78 74%); }
.festival-menu button:nth-child(3) { background: radial-gradient(ellipse at top,#b37354,#623650 72%); }
.festival-menu button:nth-child(4) { background: radial-gradient(ellipse at top,#995cb5,#4b2c71 74%); }
.festival-menu button:nth-child(5) { background: radial-gradient(ellipse at top,#648f83,#354e61 74%); }
.festival-menu button span { color: #ffdfab; font: bold 2rem/1 Georgia,serif; text-shadow: 0 0 .6rem #ffc8e6,0 0 1.1rem #fff; }
.festival-menu button small { font-size: .78rem; color: #fff1e9; }
.festival-menu button:hover { filter: saturate(1.25); box-shadow: 0 .25rem #23122e,0 0 1rem #ffadd9; }
#hello .festival-link { position: relative; margin: .1rem 0 .2rem; background: linear-gradient(145deg,#703371,#a64579); border: 1px solid #df8ab0; box-shadow: 0 0 .8rem #d878b8aa; }
#hello .festival-link span { color: #ffecb5; }

#festival-dialog,#quiz-dialog {
  width: min(46rem,calc(100% - 1.1rem));
  padding: clamp(.55rem,3vw,1.25rem);
  border: 2px solid #d58db4; border-radius: 1.45rem;
  background: radial-gradient(ellipse at 10% 0%,#ffe0b8,transparent 45%),radial-gradient(ellipse at 92% 6%,#e5cafa,transparent 55%),#fff1f6;
  box-shadow: 0 0 2.8rem #ee8fd2b0,0 0 .38rem #fff;
  color: var(--show-ink);
}
#festival-title,#quiz-title { font-size: clamp(1.7rem,5.4vw,3rem); font-weight: bold; color: #75265a; text-shadow: 1px 2px #fff7ed,0 0 .65rem #ffaed5; }
#festival-body,#quiz-body { margin-top: .7rem; }
.festival-picker {
  display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: .3rem;
  padding: .45rem; border-radius: .9rem; border: 1px solid #cb91bb; background: #fffe;
}
.festival-picker button,.festival-secondary {
  padding: .38rem .18rem; color: #6d2755; border: 1px solid #c487b3; border-radius: .5rem;
  background: #fce5f5; font-size: .8rem; line-height: 1.1;
}
.festival-secondary { padding: .45rem .75rem; margin: .4rem; font-size: .92rem; }
.festival-picker button[aria-pressed="true"] { color: #fff5ed; background: #823f7d; box-shadow: 0 0 .65rem #bd73b3; }
.festival-picker button.completed::after { content: ' ♥'; }
.festival-stage h3,.quiz-step h3,.quiz-finale h3 { margin: .55rem auto .7rem; color: #792858; font-size: clamp(1.2rem,4.3vw,2.15rem); text-wrap: balance; }
.festival-status { min-height: 1.65em; margin: .45rem 0; color: #6d2852; font-weight: bold; }
.memory-screen {
  position: relative; isolation: isolate; overflow: hidden; margin: .5rem auto .65rem; padding: .65rem;
  border: 2px solid #d594bb; border-radius: 1rem; background: radial-gradient(ellipse at top,#a15997,#322347 78%);
  box-shadow: inset 0 0 1.5rem #160e2c,0 .45rem 1.2rem #c276ad80; color: #fff1e9;
}
.memory-screen[data-palette="ice"],.memory-screen[data-palette="blue"] { background: radial-gradient(ellipse at top,#747ccc,#282854 75%); }
.memory-screen[data-palette="pumpkin"],.memory-screen[data-palette="peach"] { background: radial-gradient(ellipse at top,#bd745f,#4c294a 78%); }
.memory-screen img { display: block; width: auto; max-width: 90%; height: min(45svh,25rem); margin: auto; object-fit: contain; border: 4px solid #fff1e7; border-radius: .3rem; box-shadow: 0 0 1rem #fff7f7a8; }
.memory-screen figcaption { margin: .5rem auto .1rem; }
.memory-screen::after { content: ''; position: absolute; pointer-events: none; z-index: 2; inset: 0; background: linear-gradient(112deg,transparent 37%,#ffeedd9e 50%,transparent 64%); opacity: 0; }

.ice-stage,.potion-stage,.music-stage,.troupe-stage {
  position: relative; isolation: isolate; overflow: hidden;
  width: min(100%,33rem); margin: .5rem auto;
  padding: .7rem;
  border-radius: 1rem; border: 2px solid #b574a7; box-shadow: inset 0 0 0 3px #fff5,0 .4rem 1rem #ab65986e;
}
.ice-stage {
  background: radial-gradient(ellipse at 40% 15%,#d3b4ffc2,transparent 64%),repeating-linear-gradient(115deg,#9fe0eb24 0 1px,transparent 2px 30px),linear-gradient(#2f2459,#5f7dbe);
}
.ice-stage[data-tint="mint"] { background-color: #48796d; background-image: radial-gradient(ellipse at 50% 23%,#d0fff0a0,transparent 60%),linear-gradient(#395577,#538c91); }
.ice-stage[data-tint="rose"] { background-image: radial-gradient(ellipse at 50% 23%,#ffbedf99,transparent 60%),linear-gradient(#4b306e,#9772ae); }
.ice-board { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: .26rem; width: min(100%,18rem); margin: auto; }
.ice-tile {
  aspect-ratio: 1; border: 1px solid #c7ccff; border-radius: .43rem; color: #352766; padding: 0;
  background: linear-gradient(145deg,#f4fcff,#a8b8f1); font-size: clamp(.9rem,4vw,1.4rem); box-shadow: 0 0 .42rem #a0b0ff;
}
.ice-tile:disabled { color: #f6f0ff9c; background: #39295353; border-color: #cbc6fd40; box-shadow: none; }
.ice-tile.crystal { color: #773a9d; box-shadow: inset 0 0 .65rem #fff,0 0 .65rem #feb8f2; background: #fcd7fb; }
.ice-tile.skated { background: #b7eee7; }
.rink-memory,.potion-memory { width: min(100%,23rem); margin: .65rem auto; border: 2px solid #d492b9; border-radius: .85rem; padding: .45rem; background: #fff6ed; box-shadow: 0 0 1.05rem #f796c9; }
.rink-memory img { display: block; width: min(100%,11rem); height: auto; margin: auto; }
.potion-memory { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .4rem; }
.potion-memory img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.potion-memory figcaption { grid-column: 1 / -1; }

.potion-stage { background: radial-gradient(ellipse at 50% 32%,#b56c975e,transparent 60%),linear-gradient(#361d42,#623c60); color: #fff9e5; }
.cauldron {
  position: relative; display: grid; place-items: center; isolation: isolate; width: 6.6rem; height: 4.7rem; margin: 1.35rem auto .55rem;
  border: 2px solid #1c182f; border-radius: 26% 26% 45% 45%; background: linear-gradient(145deg,#9e75a6,#241c37 70%);
  box-shadow: 0 .3rem #26213f,0 0 1.3rem #c183bd9e;
}
.cauldron::before { content: ''; position: absolute; inset: -.34rem -.3rem auto; height: 1.1rem; border: 2px solid #332341; border-radius: 50%; background: hsl(var(--brew-hue,302) 77% 69%); box-shadow: inset 0 0 0 .21rem #674867,0 0 1rem #fda0e2; }
.cauldron span { position: absolute; left: 25%; top: -.38rem; width: .45rem; aspect-ratio: 1; border-radius: 50%; background: #ffe0cd; box-shadow: 0 0 .65rem #ffbad4; }
.cauldron span:nth-child(2) { left: 51%; top: -.25rem; }.cauldron span:nth-child(3) { left: 72%; top: -.3rem; }
.potion-recipe,.potion-ingredients { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; margin: .4rem auto; }
.potion-recipe span,.ingredient {
  display: grid; place-items: center; min-width: 2.3rem; min-height: 2.3rem;
  padding: .15rem .25rem; border: 1px solid #d7a0c7; border-radius: .55rem;
  background: #ffebf2; color: #67275c; font: bold 1.1rem Georgia,serif;
}
.potion-recipe .mixed { background: #baf0d3; box-shadow: 0 0 .85rem #affece; }
.ingredient { background: #6f4779; color: #ffeccc; }
.ingredient:disabled { opacity: .7; }
.music-stage {
  background: radial-gradient(ellipse at center,#aa5faf 0%,transparent 68%),linear-gradient(#3a2558,#614064);
  min-height: 8.5rem; display: grid; place-content: center; justify-items: center;
}
.music-emblem { color: #fff0b2; font: bold 3.8rem/1 Georgia,serif; text-shadow: 0 0 .65rem #fffbe3,0 0 1.3rem #fba3d9; }
.music-lights { display: flex; gap: .3rem; margin-top: .65rem; }
.music-lights i { display: block; width: clamp(.25rem,1vw,.48rem); aspect-ratio: 1; border-radius: 50%; background: #e5b2ef6b; }
.music-lights i.on { background: #fff1ad; box-shadow: 0 0 .65rem .12rem #fff; transform: scale(1.58); }
.troupe-stage {
  min-height: 11rem; background: radial-gradient(ellipse at 50% 90%,#f4b2d5,transparent 49%),repeating-linear-gradient(90deg,#9f4c8e 0 8%,#642e68 11% 15%);
}
.troupe-stage::before { content: ''; position: absolute; inset: 69% 3% 5%; z-index: -1; border: 1px solid #f9b9dd; border-radius: 50%; background: #421b42; box-shadow: 0 0 1.7rem #bd5f99; }
.troupe-cast { display: flex; align-items: end; justify-content: center; gap: .1rem; min-height: 9.25rem; }
.troupe-cast .critter.drawn-sticker { flex: 0 1 7.5rem; width: 100%; height: clamp(5.5rem,15vw,8rem); margin: .25rem 0; filter: drop-shadow(0 0 .75rem #ffd5f2); }

.quiz-block {
  display: grid; grid-template-columns: minmax(5rem,10rem) minmax(0,1fr); align-items: center; gap: clamp(.7rem,4vw,2rem);
  padding: clamp(.65rem,3vw,1.45rem);
  border: 2px solid #ce7ea8; border-radius: 1.45rem; background: radial-gradient(ellipse at 10% 15%,#ffe3a9,transparent 47%),radial-gradient(ellipse at 82% 8%,#dcc6ff,transparent 56%),#ffecf4;
  color: #63254d; box-shadow: inset 0 0 0 4px #fff9,0 0 1.45rem #ffb9dd,0 .4rem #b05b884c;
}
.quiz-block p { margin: 0 0 .55rem; }
.quiz-locket { position: relative; display: grid; place-items: center; width: 100%; max-width: 8rem; aspect-ratio: 1; border: 3px double #a4557f; border-radius: 43% 43% 50% 50%; background: radial-gradient(at 25% 21%,#ffffdc,#f6a3be 70%); color: #992859; box-shadow: 0 0 1.2rem #f69dc9,inset 0 0 1rem #fff; }
.quiz-locket i { font: normal clamp(2rem,8vw,4rem) Georgia,serif; text-shadow: 0 0 .6rem white; }
.quiz-locket span { position: absolute; top: 2%; right: -11%; color: #fff6b0; text-shadow: 0 0 .4rem #9f407a; font-size: 1.45rem; }
.quiz-locket span:last-child { top: auto; bottom: 9%; right: auto; left: -8%; }
.quiz-step {
  position: relative; padding: .65rem; border: 1px solid #d596bd; border-radius: 1rem;
  background: repeating-radial-gradient(ellipse at 51% 20%,#fff6e89e 0 2rem,#ffe4f153 2.05rem 3.25rem);
}
.quiz-step progress { display: block; width: 95%; height: .7rem; margin: .2rem auto; accent-color: #a83c78; }
.quiz-step-number { color: #754062; font-size: .85rem; }
.quiz-step .critter.drawn-sticker { height: 5.5rem; }
.quiz-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.quiz-controls > button:not(.festival-secondary) { padding: .58rem .75rem; border: 1px solid #b76d9b; border-radius: .58rem; background: #ffe3f0; color: #692653; }
.quiz-guess { display: flex; justify-content: center; flex-wrap: wrap; gap: .35rem; }
.quiz-guess input { width: min(100%,21rem); padding: .45rem .55rem; border: 1px solid #b4749d; border-radius: .45rem; color: #572242; background: #fff; }
.quiz-dialog .pill:disabled,.quiz-controls button:disabled { opacity: .67; cursor: default; }
.quiz-feedback { min-height: 1.4em; margin: .45rem auto; color: #722454; font-weight: bold; }
.quiz-finale { overflow: hidden; padding: .75rem; border: 2px solid #d27bb1; border-radius: 1.15rem; background: radial-gradient(ellipse at 50% 22%,#ffefc1,#ffd0e7 50%,#edc2ff); }
.finale-heart { display: block; color: #a53472; font: bold 3.2rem/1 Georgia,serif; text-shadow: 0 0 .65rem white,0 0 1.3rem #ff77ba; }
.quiz-finale-photos { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .25rem; width: min(100%,28rem); margin: .75rem auto; }
.quiz-finale-photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border: 3px solid #fff6f1; border-radius: .36rem; box-shadow: 0 0 .9rem #ad508f5d; }
.quiz-finale p { max-width: 42ch; margin: .6rem auto; }
.quiz-finale p + p { text-align: left; }
EOF

/* Result cards have opposite lighting, reactions, and character routines. */
#wrong-code,#access-granted {
  width: min(23rem,calc(100% - 1.2rem)); isolation: isolate; overflow: hidden; padding: 1.1rem;
  border: 2px solid #d083a9; border-radius: 1.35rem;
  box-shadow: inset 0 0 0 4px #fff8,0 0 2.8rem #f181c5ad,0 .65rem #7f416c69;
}
#access-granted { background: radial-gradient(ellipse at 50% 39%,#fff8cf,#ffc6e5 50%,#c3aff0); color: #642654; }
#wrong-code { background: radial-gradient(ellipse at 50% 38%,#f6f0ff,#dfc8ef 50%,#a99ccb); color: #59316b; }
#wrong-code h2,#access-granted h2 { position: relative; font-size: clamp(1.45rem,6vw,2.35rem); text-shadow: 0 1px #fff,0 0 .65rem #fff1e9; }
#wrong-code .drawn-sticker,#access-granted .drawn-sticker {
  width: min(100%,11rem); height: 11.5rem; position: relative; z-index: 1;
  margin: .15rem auto .55rem; filter: drop-shadow(0 0 .75rem #ffedf3) drop-shadow(0 .34rem .24rem #68335c63);
}
#access-granted p,#wrong-code button,#access-granted button { position: relative; }
#wrong-code button,#access-granted button { padding: .58rem 1.13rem; border-radius: 999px; box-shadow: 0 0 .7rem #f486c7; }
#access-granted::backdrop { background: #69295c92; backdrop-filter: blur(3px); }
#wrong-code::backdrop { background: #271c53a0; backdrop-filter: blur(3px); }
.result-rays { position: absolute; z-index: -1; inset: -27%; background: repeating-conic-gradient(from 10deg at 50% 47%,#fff6 0 12deg,transparent 12deg 27deg); mask-image: radial-gradient(ellipse,#000 0 20%,transparent 68%); }
#wrong-code .result-rays { background: repeating-radial-gradient(ellipse at 50% 50%,#c2adf855 0 5px,transparent 7px 23px); }
#wrong-code .result-rays::after { content: '·  ✧  ·  ✧'; position: absolute; inset: 43% 0 auto; color: white; font-size: 2rem; text-shadow: 0 0 .7rem #b1a0f3; }
#book-pages .new-photos .polaroid { border-color: #cf83af; }
#book-pages .new-photos .polaroid:nth-child(2n + 1) { background: #fff0f8; }
#book-pages .new-photos .polaroid:nth-child(2n) { background: #fff7e8; }
@media (max-width: 44rem) {
  .festival-menu { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .festival-picker { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .festival-banner { grid-template-columns: 1fr minmax(4.9rem,6rem); min-height: 10.5rem; }
}
@media (max-width: 32rem) {
  .festival-menu { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .festival-menu button { min-height: 6rem; }
  .quiz-block { grid-template-columns: minmax(2.75rem,4rem) 1fr; }
  .festival-picker button { min-height: 2.25rem; }
}
@media (prefers-reduced-motion: no-preference) {
  #festival-dialog[open],#quiz-dialog[open],#access-granted[open] { animation: festival-open .64s cubic-bezier(.18,.79,.32,1.12) backwards; }
  #wrong-code[open] { animation: slow-wobble .64s cubic-bezier(.22,.76,.37,1.1) backwards; }
  #access-granted[open] .result-rays { animation: spotlight-turn 7.5s linear infinite; }
  #wrong-code[open] .result-rays { animation: rain-ripple 2.6s ease-in-out infinite alternate; }
  #access-granted[open] .critter { animation: penguin-cheer 1s .08s ease-in-out both; }
  #wrong-code[open] .sad-panda { animation: sad-wobble 2.4s .2s ease-in-out infinite; }
  .festival-orbit i { animation: banner-sweep 4.2s ease-in-out infinite alternate; }
  .festival-orbit i:nth-child(2) { animation-delay: -2s; }.festival-orbit i:nth-child(3) { animation-delay: -1.15s; }
  .festival-twinkle,.quiz-locket span { animation: sparkle-pop 2.2s ease-in-out infinite; }
  .festival-banner .critter { animation: mascot-skip 2.8s ease-in-out infinite; }
  .festival-menu button,.festival-picker button,.quiz-controls button { transition: translate .24s,transform .24s,box-shadow .24s; }
  .festival-menu button:hover,.festival-picker button:hover,.quiz-controls button:not(:disabled):hover { translate: 0 -.32rem; }
  .festival-menu button:active,.festival-picker button:active,.quiz-controls button:not(:disabled):active { transform: scale(.9); }
  .festival-menu button span { animation: festival-symbol 3.25s ease-in-out infinite; }
  .festival-menu button:nth-child(2n) span { animation-delay: -1.5s; }.festival-menu button:nth-child(3n) span { animation-delay: -2.25s; }
  .festival.arrived .festival-menu button { animation: portal-spring .75s backwards; }
  .festival.arrived .festival-menu button:nth-child(2) { animation-delay: .09s; }.festival.arrived .festival-menu button:nth-child(3) { animation-delay: .17s; }.festival.arrived .festival-menu button:nth-child(4) { animation-delay: .24s; }.festival.arrived .festival-menu button:nth-child(5) { animation-delay: .32s; }
  .memory-screen.projecting img { animation: projector-zoom 1.15s cubic-bezier(.15,.84,.32,1) both; }
  .memory-screen.projecting::after { animation: projector-glint 1.12s ease-out; }
  .memory-screen.projecting figcaption { animation: card-arrival .65s .32s backwards; }
  .ice-tile.crystal { animation: crystal-flicker .95s ease-in-out infinite alternate; }
  .rink-memory,.potion-memory { animation: scene-prize .85s cubic-bezier(.16,.76,.37,1.2) both; }
  .cauldron span { animation: brew-bubble 1.6s ease-out infinite; }.cauldron span:nth-child(2) { animation-delay: -.6s; }.cauldron span:nth-child(3) { animation-delay: -1.1s; }
  .cauldron.brew-pop { animation: brew-jump .4s ease-out; }.cauldron.fizzled { animation: sad-wobble .52s ease-in-out; }
  .potion-recipe .mixed { animation: jewel-lock .4s ease-out; }
  .music-stage.playing .music-emblem { animation: music-dance .65s ease-in-out infinite alternate; }
  .music-lights i { transition: transform .12s,background .12s,box-shadow .12s; }
  .troupe-stage.performing .critter { animation: var(--act,act-bow) var(--act-time,1.05s) cubic-bezier(.2,.61,.33,1.1) both; }
  .troupe-stage[data-act="bow"] { --act: act-bow; }.troupe-stage[data-act="glide"] { --act: act-glide; --act-time: 1.35s; }
  .troupe-stage[data-act="skip"] { --act: act-skip; }.troupe-stage[data-act="spin"] { --act: act-spin; --act-time: .95s; }
  .troupe-stage[data-act="roll"] { --act: act-roll; --act-time: 1.1s; }.troupe-stage[data-act="wave"] { --act: act-wave; --act-time: 1.25s; }
  .troupe-stage[data-act="moon"] { --act: act-moon; --act-time: 1.14s; }.troupe-stage[data-act="stretch"] { --act: act-stretch; --act-time: 1.25s; }
  .troupe-stage[data-act="shower"] { --act: act-shower; }.troupe-stage[data-act="encore"] { --act: act-bow; }
  .troupe-stage[data-act="encore"] .critter:nth-child(2n) { animation-delay: .19s; }.troupe-stage[data-act="encore"] .critter:nth-child(3) { animation-delay: .34s; }
  .quiz-locket { animation: festival-symbol 2.8s ease-in-out infinite; }
  .quiz-step,.quiz-finale { animation: scene-prize .62s cubic-bezier(.2,.75,.34,1.13) backwards; }
  .quiz-step .quiz-cheer { animation: penguin-cheer .66s ease-out; }
  .quiz-finale .finale-heart { animation: act-shower .92s ease-out both; }
  .quiz-finale-photos img { animation: pin-photo .67s .2s backwards; }
  .quiz-finale-photos img:nth-child(2) { animation-delay: .32s; }.quiz-finale-photos img:nth-child(3) { animation-delay: .45s; }
  @keyframes festival-open { from { opacity: 0; transform: translateY(2.2rem) rotate(-5deg) scale(.72); } 70% { opacity: 1; transform: translateY(-.28rem) rotate(1deg) scale(1.038); } to { opacity: 1; transform: none; } }
  @keyframes slow-wobble { from { opacity: 0; transform: translateX(-1.2rem) rotate(-7deg) scale(.8); } 55% { opacity: 1; transform: translateX(.3rem) rotate(2.5deg) scale(1.025); } to { opacity: 1; transform: none; } }
  @keyframes spotlight-turn { to { transform: rotate(360deg); } }
  @keyframes rain-ripple { to { scale: 1.24; opacity: .45; } }
  @keyframes penguin-cheer { 42% { translate: 0 -1.5rem; rotate: -8deg; scale: 1.09; } 66% { translate: 0 .18rem; rotate: 6deg; scale: 1.18 .87; } }
  @keyframes sad-wobble { 25% { transform: translateX(-.34rem) rotate(-6deg); } 52% { transform: translateX(.22rem) rotate(4deg); } 75% { transform: translateX(-.09rem); } }
  @keyframes banner-sweep { to { translate: -1.9rem 1.1rem; rotate: 11deg; scale: 1.22; opacity: .56; } }
  @keyframes festival-symbol { 40% { translate: 0 -.35rem; rotate: -9deg; scale: 1.12; } 68% { translate: 0 .12rem; rotate: 5deg; } }
  @keyframes projector-zoom { from { opacity: .2; filter: brightness(1.7) saturate(.6); transform: translateY(20px) scale(.79); } 65% { opacity: 1; transform: scale(1.036); } to { opacity: 1; filter: none; transform: none; } }
  @keyframes projector-glint { from { opacity: .1; transform: translateX(-85%); } 46% { opacity: .7; } to { opacity: 0; transform: translateX(95%); } }
  @keyframes crystal-flicker { to { box-shadow: inset 0 0 1rem #fff,0 0 1rem #ff9fea; filter: brightness(1.13); } }
  @keyframes scene-prize { from { opacity: 0; transform: translateY(1.35rem) scale(.8) rotate(-3deg); } 68% { opacity: 1; transform: scale(1.03); } to { opacity: 1; transform: none; } }
  @keyframes brew-bubble { from { opacity: .4; translate: 0 .32rem; scale: .52; } 25% { opacity: 1; } to { opacity: 0; translate: .65rem -1.6rem; scale: 1.38; } }
  @keyframes brew-jump { 42% { translate: 0 -.55rem; scale: 1.17 .9; } }
  @keyframes music-dance { to { translate: 0 -.55rem; rotate: 10deg; scale: 1.15; filter: brightness(1.3); } }
  @keyframes act-bow { 46% { transform: translateY(.65rem) rotate(-15deg) scale(1.16,.72); } 76% { transform: translateY(-.22rem) rotate(4deg); } }
  @keyframes act-glide { 25% { transform: translateX(-3.3rem) rotate(-13deg); } 67% { transform: translateX(3rem) rotate(13deg); } }
  @keyframes act-skip { 23% { transform: translate(-.55rem,-1.8rem) rotate(-8deg); } 43% { transform: scale(1.15,.84); } 70% { transform: translate(.8rem,-1.25rem) rotate(10deg); } }
  @keyframes act-spin { to { transform: rotateY(360deg); } }
  @keyframes act-roll { 42% { transform: translate(-1.1rem,-1.5rem) rotate(-175deg); } to { transform: rotate(-360deg); } }
  @keyframes act-wave { 20%,55% { transform: rotate(-16deg) translateY(-.23rem); } 35%,70% { transform: rotate(12deg); } }
  @keyframes act-moon { 43% { transform: translateY(-2.8rem) rotate(12deg) scale(1.07); } 71% { transform: scale(1.16,.86); } }
  @keyframes act-stretch { 49% { transform: translateY(.4rem) scale(1.38,.69); } 76% { transform: scale(.97,1.1); } }
  @keyframes act-shower { 36% { transform: translateY(-1.35rem) scale(1.28); filter: brightness(1.3) drop-shadow(0 0 1.2rem #fff1dc); } }
}

#quiz-dialog:has(.quiz-finale) {
  width: min(55rem,calc(100% - .8rem)); max-height: 93svh;
  background: radial-gradient(ellipse at 52% 37%,#ffeeb9,#e6acf4 54%,#ad6baf);
  border-color: #fff2d4; box-shadow: 0 0 3.15rem #ff9ad5,0 0 .55rem #fff,0 .7rem #6a396c6b;
}
.quiz-finale { position: relative; isolation: isolate; box-shadow: inset 0 0 0 4px #fff7,0 0 1.3rem #ffd6e6; }
.quiz-finale::before {
  content: ''; position: absolute; z-index: -1; inset: -52%;
  background: repeating-conic-gradient(from 18deg at 50% 50%,#fff8 0 11deg,transparent 11deg 29deg);
  mask-image: radial-gradient(ellipse,#000 0 12%,transparent 67%);
}
.quiz-finale-photos img:nth-child(1) { rotate: -4deg; }.quiz-finale-photos img:nth-child(3) { rotate: 4deg; }
.quiz-review { width: min(100%,36rem); margin: .65rem auto; padding: .3rem .55rem; border: 1px dashed #ab6899; border-radius: .6rem; background: #fff4fa; }
.quiz-review summary { font-weight: bold; }.quiz-review dl { margin: .6rem auto; text-align: left; }.quiz-review dt { font-weight: bold; }.quiz-review dd { margin: 0 0 .45rem; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: no-preference) {
  .quiz-finale::before { animation: spotlight-turn 13s linear infinite; }
  .quiz-finale h3 { animation: reveal-swell .83s cubic-bezier(.14,.75,.28,1.2) both; }
}

/* Separate visual treatments for the photo reels, comic memories, and one-off prizes. */
.memory-screen { --rim: #ffc8b3; --screen-light: #f394c9; border-width: 3px; border-color: var(--rim); box-shadow: inset 0 0 1.8rem #140921d9,0 0 1.1rem var(--screen-light); padding: 1.1rem .85rem .7rem; }
.memory-screen[data-palette="blue"] { --rim: #a1dfff; --screen-light: #849cfb; }
.memory-screen[data-palette="ice"] { --rim: #c7e2ff; --screen-light: #a88cfa; }
.memory-screen[data-palette="violet"] { --rim: #f4ceff; --screen-light: #bf8fef; }
.memory-screen[data-palette="rose"] { --rim: #ffd2e0; --screen-light: #ff93be; }
.marquee-lights { position: absolute; inset: .2rem; pointer-events: none; border-radius: .72rem; background: radial-gradient(circle,#fffbde 0 16%,transparent 19%) 0 0/14px 6px repeat-x,radial-gradient(circle,#ffdce8 0 16%,transparent 19%) 0 100%/14px 6px repeat-x; }
.memory-screen img { position: relative; border: 3px solid var(--rim); box-shadow: 0 0 1.35rem #fcf4ff9c,0 .4rem 1.35rem #1e143b; }
.memory-screen figcaption { display: inline-block; padding: .2rem .45rem .15rem; font-size: 1.01rem; letter-spacing: .006em; }
.memory-cartoon { position: relative; isolation: isolate; width: min(100%,30rem); min-height: 12rem; margin: auto; display: grid; align-content: end; overflow: hidden; border: 1px solid #ffbdde; border-radius: .9rem; }
.memory-cartoon.walk { background: radial-gradient(ellipse at 48% 36%,#ffd39680,transparent 54%),linear-gradient(#373150,#8e627b 62%,#4f3c55 63%); }
.memory-cartoon.laugh { background: radial-gradient(ellipse at 78% 30%,#fbc0faad,transparent 54%),repeating-linear-gradient(140deg,#f2a4d730 0 15px,#ea98c31c 15px 32px),#984780; }
.memory-cartoon.walk::before { content: ''; position: absolute; z-index: -1; inset: 74% -6% -20%; border-top: 2px dashed #ffe9b79e; background: repeating-linear-gradient(109deg,#bd88b238 0 2px,transparent 3px 32px),#51405d; transform: skewY(-4deg); }
.cartoon-lights { position: absolute; inset: 8% 0 auto; font-size: 2rem; color: #fff1bc; letter-spacing: 1.3rem; text-shadow: 0 0 1rem #ffaed6; }
.memory-cartoon .troupe-cast { padding: 1.55rem 0 .2rem; isolation: isolate; }
.festival-prize { position: relative; display: grid; justify-items: center; gap: .24rem; width: min(100%,25rem); overflow: hidden; margin: .75rem auto; padding: .55rem; border: 2px solid #b87da9; border-radius: .9rem; background: radial-gradient(ellipse at 46% 25%,#fff7d2,#f6d4ee); box-shadow: 0 0 1.2rem #e695cd; color: #6f2a56; }
.prize-emblem { display: grid; place-items: center; width: 3.2rem; aspect-ratio: 1; border-radius: 50%; border: 2px double #b26f98; background: #ffeece; color: #904174; box-shadow: 0 0 .68rem #ee91cb,inset 0 0 .45rem #fff; font-size: 1.65rem; }
.festival-prize[data-prize="2"],.festival-prize[data-prize="5"],.festival-prize[data-prize="8"] { background: radial-gradient(ellipse at top,#fff1bc,#eec6fa); }
.festival-prize[data-prize="3"],.festival-prize[data-prize="6"],.festival-prize[data-prize="9"] { background: radial-gradient(ellipse at top,#f5ffd6,#d0ece0); }
.quiz-only-photo {
  position: relative; isolation: isolate; width: min(100%,14rem); margin: .9rem auto;
  padding: .39rem .39rem .55rem; rotate: -3deg; background: #fff7e6; border: 1px solid #ba789e;
  border-radius: .28rem; box-shadow: 0 0 1.6rem #eb7fbd,0 .4rem .8rem #8d487975;
}
.quiz-only-photo::before { content: ''; position: absolute; z-index: 1; top: -.43rem; left: 33%; width: 34%; height: .86rem; rotate: 6deg; opacity: .9; background: repeating-linear-gradient(45deg,#f0a8c9 0 3px,#f7c1db 3px 6px); }
.quiz-only-photo img { display: block; width: 100%; max-height: 38svh; object-fit: contain; background: #eee0d5; }
.quiz-only-photo figcaption { padding-top: .32rem; font-style: italic; font-size: .91rem; }
#book-pages .closing-photos { grid-template-columns: minmax(0,17rem); justify-content: center; }
@media (prefers-reduced-motion: no-preference) {
  .projecting .marquee-lights { animation: marquee-chase 1.2s ease-out; }
  .projecting[data-shot="skating"] img { animation: reel-skate 1.28s cubic-bezier(.17,.75,.33,1) both; }
  .projecting[data-shot="cheekkiss"] img { animation: reel-soft 1.3s cubic-bezier(.22,.74,.3,1) both; }
  .projecting[data-shot="blue"] img { animation: reel-blue 1.18s ease-out both; }
  .projecting[data-shot="masks"] img { animation: reel-tilt .99s cubic-bezier(.16,.74,.37,1.13) both; }
  .projecting[data-shot="cozy"] img { animation: reel-soft 1.08s ease-out both; }
  .projecting[data-shot="shadows"] img { animation: reel-dark 1.5s ease-out both; }
  .projecting[data-shot="smile"] img { animation: reel-smile .9s cubic-bezier(.2,.76,.32,1.15) both; }
  .projecting[data-shot="silly"] img { animation: reel-tilt .86s cubic-bezier(.16,.74,.37,1.13) both; }
  .projecting .memory-cartoon.walk .troupe-cast { animation: cartoon-walk 1.9s ease-in-out both; }
  .projecting .memory-cartoon.laugh .critter { animation: cartoon-laugh 1.25s ease-in-out both; }
  .projecting .memory-cartoon.laugh .critter:last-child { animation-delay: .13s; }
  .projecting .cartoon-lights { animation: cartoon-glow 1.05s .24s ease-in-out both; }
  .festival-prize { animation: scene-prize .72s ease-out both; }
  .festival-prize .prize-emblem { animation: badge-beat .75s .22s ease-out both; }
  .quiz-only-photo { animation: reel-smile .98s .2s cubic-bezier(.18,.72,.33,1.12) both; }
  @keyframes marquee-chase { 30% { opacity: .2; filter: brightness(1.35); } 55% { opacity: 1; filter: brightness(1.35); } 75% { opacity: .54; } }
  @keyframes reel-skate { from { opacity: 0; transform: translateX(-20%) rotate(-8deg) scale(.92); } 65% { opacity: 1; transform: translateX(2%) rotate(1deg) scale(1.025); } to { transform: none; } }
  @keyframes reel-soft { from { opacity: 0; filter: blur(8px) brightness(1.35); transform: scale(1.12); } to { opacity: 1; filter: none; transform: none; } }
  @keyframes reel-blue { from { opacity: .15; filter: saturate(2) contrast(1.28); transform: translateY(12%) scale(.87); } 60% { opacity: 1; filter: saturate(1.3); } to { opacity: 1; transform: none; filter: none; } }
  @keyframes reel-tilt { from { opacity: .05; transform: rotate(12deg) translateY(14%) scale(.73); } 70% { opacity: 1; transform: rotate(-3deg) scale(1.025); } to { transform: none; } }
  @keyframes reel-dark { from { opacity: .1; filter: brightness(.4); transform: translateX(11%) scale(1.07); } to { opacity: 1; transform: none; filter: none; } }
  @keyframes reel-smile { from { opacity: .2; transform: translateY(1.5rem) rotate(8deg) scale(.72); } 58% { opacity: 1; transform: translateY(-.3rem) rotate(-4deg) scale(1.05); } to { transform: none; } }
  @keyframes cartoon-walk { from { opacity: 0; transform: translateX(-29%) rotate(-4deg); } 25% { opacity: 1; } 60% { transform: translateX(3%) rotate(2deg); } to { transform: none; } }
  @keyframes cartoon-laugh { 23%,55% { transform: rotate(-8deg) translateY(-.9rem) scale(1.07); } 40%,72% { transform: rotate(8deg) scale(1.12,.89); } }
  @keyframes cartoon-glow { 46% { transform: scale(1.33) translateY(.2rem); filter: brightness(1.25); } }
}

.quiz-correction { width: min(100%,25rem); margin: .6rem auto .25rem; padding: .65rem; border: 2px solid #c781ab; border-radius: .85rem; background: radial-gradient(ellipse at top,#fff7cd,#fce6f5); box-shadow: 0 0 1rem #e994cc; }
.quiz-correction p { margin-bottom: .35rem; color: #70254f; font-weight: bold; }
@media (prefers-reduced-motion: no-preference) { .quiz-correction { animation: scene-prize .48s ease-out both; } }

.festival-menu { grid-template-columns: repeat(4,minmax(0,1fr)); }
.festival-menu button[data-show="pets"] { background: radial-gradient(ellipse at top,#648f83,#354e61 74%); }
.festival-banner { text-align: center; }
.festival-banner p { margin-inline: auto; }
.festival-picker { display: flex; flex-wrap: wrap; justify-content: center; }
.festival-picker button { flex: 0 1 min(8.4rem,47%); min-height: 2.5rem; }
#festival-dialog[data-show="ice"] .festival-picker button { flex-basis: min(13rem,48%); }
#festival-dialog[data-show="theater"] .memory-screen { width: fit-content; max-width: 100%; margin: .8rem auto; padding: 1rem .85rem; }
#festival-dialog[data-show="theater"] .memory-screen img { display: block; width: auto; height: auto; max-width: 100%; max-height: 53svh; margin-inline: auto; }
#halloween-note {
  width: min(26rem,calc(100% - 1.5rem)); padding: 1.45rem .8rem .8rem;
  border: 2px solid #c481ad; border-radius: 1.2rem; color: #762e5d;
  background: radial-gradient(ellipse at 51% 20%,#fff4c8,#ffd7ed 69%,#ebbeef);
  box-shadow: 0 0 1.6rem #ffc0e1,0 .45rem #944c7f83;
}
#halloween-note h2 { font-size: clamp(1.35rem,5vw,2rem); }
#halloween-note::backdrop { background: #2d173b91; }
.last-message {
  width: min(calc(100% - 1.5rem),58rem); margin: clamp(2rem,6vw,4rem) auto 1.25rem; padding: clamp(1rem,4vw,2.5rem);
  text-align: center; color: #642549; border: 2px solid #c984ac; border-radius: 1.35rem;
  background: radial-gradient(ellipse at 15% 10%,#fff0bb,transparent 59%),radial-gradient(ellipse at 85% 30%,#edc8ef,transparent 73%),#fff2f8;
  box-shadow: inset 0 0 0 4px #fff8,0 0 1.45rem #f0a5d3a0;
}
.last-message h2 { font-size: clamp(1.8rem,5vw,3.6rem); text-wrap: balance; text-shadow: 1px 2px #fff,0 0 .8rem #ffacce; }
.last-message details { margin-top: .85rem; }
.last-message summary {
  display: inline-grid; justify-items: center; gap: .15rem; cursor: pointer; list-style: none;
  padding: .4rem .95rem .55rem; border: 1px solid #b66b95; border-radius: .8rem; color: #74274e;
  background: #ffe4f2; box-shadow: 0 .18rem #be79a16b,0 0 .65rem #fb9fce;
}
.last-message summary::-webkit-details-marker { display: none; }
.last-message summary span { color: #a83471; font-size: 1.5rem; text-shadow: 0 0 .55rem #f88fc4; }
.last-message p {
  max-width: 62ch; margin: 1.05rem auto .25rem; padding: clamp(.75rem,4vw,1.65rem);
  color: #52253e; text-align: left; line-height: 1.7; background: #fffaf2;
  border: 3px double #c68dad; border-radius: .7rem; box-shadow: 0 .35rem .75rem #a454863d;
}
@media (max-width: 37rem) { .festival-menu { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (prefers-reduced-motion: no-preference) {
  #halloween-note[open] { animation: festival-open .52s ease-out backwards; }
  .last-message details[open] p { animation: scene-prize .73s ease-out both; }
  .last-message summary span { animation: festival-symbol 2.7s ease-in-out infinite; }
}

/* Keep the dialog in the top layer until its entire exit finishes. */
@media (prefers-reduced-motion: no-preference) {
  dialog[open]:not(.leaving) { animation: graceful-pop 1.02s cubic-bezier(.19,.71,.27,1) backwards !important; }
  dialog[open]:not(.leaving)::backdrop { animation: soft-curtain .85s ease-out backwards; }
  dialog[open].leaving { animation: sticker-exit .76s cubic-bezier(.48,.05,.79,.54) both !important; }
  dialog[open].leaving::backdrop { animation: curtain-out .76s ease-in both; }
  .quiz-step,.quiz-finale,.quiz-correction,.last-message details[open] p { animation-duration: .94s; }
  .festival-stage .memory-screen.projecting img { animation-duration: 1.67s; }
  .rink-memory,.potion-memory,.festival-prize { animation-duration: 1.13s; }
  @keyframes graceful-pop {
    from { opacity: 0; transform: translateY(1.9rem) rotate(-3deg) scale(.84); }
    55% { opacity: 1; transform: translateY(-.32rem) rotate(.65deg) scale(1.024); }
    77% { transform: translateY(.1rem) rotate(-.25deg) scale(.996); }
    to { opacity: 1; transform: none; }
  }
  @keyframes soft-curtain { from { opacity: 0; } to { opacity: 1; } }
}

#music-button {
  position: fixed; right: .8rem; bottom: .8rem; z-index: 5; padding: .48rem .9rem;
  border: 1px solid var(--line); border-radius: 999px; color: var(--berry); background: var(--paper);
  box-shadow: 0 0 .8rem #ec79b480,0 .25rem .65rem #5a244b35;
}
#music-button:hover { box-shadow: 0 0 1rem #e456a6,0 .25rem .65rem #5a244b35; }
#music-settings {
  width: min(23rem,calc(100% - 1.5rem)); padding: 1rem 1.1rem;
  border: 2px solid #ce86b5; border-radius: 1.1rem;
  background: radial-gradient(ellipse at top,#fff5d5,#ffe4f5);
  box-shadow: 0 0 1.6rem #ffc0e0,0 .4rem #81385d42;
}
#music-title { color: var(--berry); font-size: 2.45rem; text-shadow: 0 0 .65rem #ffb2d2; }
#music-form { display: grid; gap: .62rem; margin-top: .75rem; }
.music-toggle { display: flex; justify-content: center; flex-wrap: wrap; gap: .45rem; margin: 0; padding: .25rem .4rem .55rem; border: 1px solid #c985aa; border-radius: .6rem; }
.music-toggle legend { padding-inline: .2rem; }
.music-toggle label { display: flex; align-items: center; gap: .25rem; padding: .3rem .55rem; border: 1px solid #d995b8; border-radius: 999px; background: #fff8f1; cursor: pointer; }
.music-toggle label:has(input:checked) { border-color: #a7437d; box-shadow: 0 0 .55rem #ffa9d5; background: #ffcde8; }
.music-toggle input,#music-volume { accent-color: #9c3678; }
.music-volume-label { display: flex; justify-content: space-between; }
.music-volume-label output { font-weight: bold; }
#music-volume { width: 100%; }
.music-actions { display: flex; justify-content: center; gap: .45rem; margin-top: .35rem; }
.music-cancel { background: #fff1f8; color: var(--berry); border: 1px solid #c782ac; }
.music-cancel:hover { background: #fff; }
#music-dock {
  position: fixed; z-index: 5; bottom: .6rem; left: .6rem;
  width: min(232px, calc(100vw - 4.5rem));
}
#music-panel {
  padding: .27rem; border: 1px solid #c482af; border-radius: .8rem;
  background: #fff5f3; color: #69294c; box-shadow: 0 0 .9rem #ee9bc3;
}
#music-dock-toggle {
  position: absolute; top: 50%; left: calc(100% + .55rem); translate: 0 -50%;
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  padding: 0; border: 0; background: transparent; color: #271420;
}
#music-dock-toggle svg {
  display: block; width: 100%; fill: #fff5fa; stroke: currentColor;
  stroke-width: 3.5; stroke-linejoin: round; transform: scaleX(-1);
  filter: drop-shadow(0 0 .4rem #fff0f9);
}
#music-dock[data-collapsed] #music-dock-toggle svg { transform: none; }
@media (max-width: 40rem) {
  #music-dock[data-collapsed] #music-dock-toggle { top: auto; bottom: 0; translate: none; }
}
#music-dock-toggle:hover svg { fill: #ffd8ed; filter: drop-shadow(0 0 .5rem #f38dbd); }
#music-dock-toggle:focus-visible { outline: 2px solid #722452; outline-offset: 2px; }
#music-dock[data-collapsed] { transform: translateX(calc(-100% - .6rem)); }
#music-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: .55rem; background: #402336; }
#music-status { margin: .18rem .2rem; font-size: .85rem; }
#music-status:empty { display: none; }
#music-source { display: block; width: fit-content; margin: .16rem .25rem; font-size: .83rem; }
.music-playing:not(:has(#music-dock[data-collapsed])) main { padding-bottom: 11.5rem; }
.music-playing:not(:has(#music-dock[data-collapsed])) { scroll-padding-bottom: 11.5rem; }
@media (prefers-reduced-motion: no-preference) {
  #music-dock { transition: transform .48s cubic-bezier(.22, .8, .26, 1); }
  #music-dock-toggle svg { transition: transform .3s ease, fill .2s ease, filter .2s ease; }
  #music-dock:not([hidden]) #music-panel { animation: scene-prize .7s ease-out both; }
}
