/* =========================================================
   BEATS — "Tap to open" invitation intro
   An envelope + invitation card shown when a guest first lands.
   Each theme gets its own envelope colours, wax-seal symbol,
   floating particles and open-burst (see THEMES section).
   ========================================================= */

/* ---------- defaults (rose_gold) ---------- */
body {
  --env-body: #a83a5c;
  --env-flap: #8e2d4b;
  --env-front: #b9486b;
  --env-inner: #6e1f3d;
  --seal-bg: #c19a56;
  --seal-fg: #fff7e0;
  --card-bg: #fffdf8;
  --card-ink: var(--wine);
  --card-accent: var(--rose);
  --intro-glyph: "\2665";
  --intro-particle: "\2665";
}

/* ---------- THEMES ---------- */
body[data-theme="royal_sapphire"] {
  --env-body: #2c5aa0; --env-flap: #234a85; --env-front: #3568b3; --env-inner: #13284f;
  --seal-bg: #c9a24a; --seal-fg: #fffbe8;
  --intro-glyph: "\2726"; --intro-particle: "\2726";
}
body[data-theme="emerald_luxe"] {
  --env-body: #1f7a4d; --env-flap: #186340; --env-front: #278a58; --env-inner: #123a24;
  --seal-bg: #c9a24a; --seal-fg: #fffbe8;
  --intro-glyph: "\2766"; --intro-particle: "\2766";
}
body[data-theme="sunset_coral"] {
  --env-body: #d9642f; --env-flap: #bf5222; --env-front: #e5733f; --env-inner: #7a2e12;
  --seal-bg: #f0a45c; --seal-fg: #5c2a10;
  --intro-glyph: "\2600\FE0E"; --intro-particle: "\273F";
}
body[data-theme="lavender_dream"] {
  --env-body: #7a4bb0; --env-flap: #653c96; --env-front: #8a5cc0; --env-inner: #402863;
  --seal-bg: #cbb17a; --seal-fg: #3a2a4d;
  --intro-glyph: "\2741"; --intro-particle: "\2741";
}
body[data-theme="midnight_gold"] {
  --env-body: #2b2730; --env-flap: #35303a; --env-front: #322d37; --env-inner: #121014;
  --seal-bg: #e0c179; --seal-fg: #2b2220;
  --card-bg: #26222a; --card-ink: #e9d8a6; --card-accent: #e0c179;
  --intro-glyph: "\2605"; --intro-particle: "\2726";
}
body[data-theme="ocean_teal"] {
  --env-body: #0f8f8a; --env-flap: #0b7873; --env-front: #14a09a; --env-inner: #0a4a47;
  --seal-bg: #f2a65a; --seal-fg: #4a2a08;
  --intro-glyph: "\224B"; --intro-particle: "\25CB";
}
body[data-theme="pastel_confetti"] {
  --env-body: #e0578a; --env-flap: #c8447a; --env-front: #ea6c9a; --env-inner: #5c3a6a;
  --seal-bg: #59c3c9; --seal-fg: #ffffff;
  --intro-glyph: "\2726"; --intro-particle: "";
}

/* ---------- lock the page while the intro is showing ---------- */
body.intro-lock { overflow: hidden; height: 100vh; height: 100dvh; }
body.intro-lock .hero-frame,
body.intro-lock .cross,
body.intro-lock .event-logo { animation-play-state: paused; }

/* ---------- overlay ---------- */
.intro-gate {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: radial-gradient(ellipse at 50% 35%, var(--cream) 0%, var(--blush) 100%);
  transition: opacity .8s ease, visibility .8s ease;
  overflow: hidden;
}
body[data-theme="midnight_gold"] .intro-gate {
  background: radial-gradient(ellipse at 50% 35%, #2a252e 0%, #0f0d11 100%);
}
body[data-theme="pastel_confetti"] .intro-gate {
  background:
    radial-gradient(circle at 15% 20%, rgba(89,195,201,.25) 0 90px, transparent 91px),
    radial-gradient(circle at 85% 75%, rgba(224,87,138,.2) 0 120px, transparent 121px),
    radial-gradient(ellipse at 50% 35%, var(--cream) 0%, var(--blush) 100%);
}
body[data-theme="ocean_teal"] .intro-gate {
  background: linear-gradient(180deg, var(--cream) 0%, var(--blush) 60%, rgba(15,143,138,.25) 100%);
}
.intro-gate.leaving { opacity: 0; visibility: hidden; pointer-events: none; }

.intro-eyebrow {
  font-family: var(--font-heading); letter-spacing: 4px; text-transform: uppercase;
  font-size: clamp(.7rem, 2.6vw, .9rem); color: var(--rose); margin: 0 0 clamp(36px, 9vh, 90px);
  text-align: center; transition: opacity .5s;
}
body[data-theme="midnight_gold"] .intro-eyebrow { color: var(--gold); }

/* ---------- floating particles in the background ---------- */
.intro-float { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.intro-float span {
  position: absolute; bottom: -30px; left: var(--x);
  font-size: var(--size); color: var(--gold); opacity: 0;
  animation: introFloat var(--dur) linear var(--delay) infinite;
}
.intro-float span::before { content: var(--intro-particle); }
body[data-theme="pastel_confetti"] .intro-float span {
  width: calc(var(--size) * .6); height: var(--size); border-radius: 2px; background: var(--gold);
}
body[data-theme="pastel_confetti"] .intro-float span:nth-child(3n)   { background: #e0578a; }
body[data-theme="pastel_confetti"] .intro-float span:nth-child(3n+1) { background: #59c3c9; }
body[data-theme="pastel_confetti"] .intro-float span:nth-child(3n+2) { background: #f6c453; }
body[data-theme="pastel_confetti"] .intro-float span::before { content: none; }
@keyframes introFloat {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: .55; }
  90%  { opacity: .45; }
  100% { transform: translateY(-105vh) rotate(260deg); opacity: 0; }
}
/* oceans' bubbles sway rather than spin */
body[data-theme="ocean_teal"] .intro-float span { animation-name: introBubble; }
@keyframes introBubble {
  0%   { transform: translate(0,0); opacity: 0; }
  10%  { opacity: .6; }
  50%  { transform: translate(14px,-55vh); }
  100% { transform: translate(-8px,-105vh); opacity: 0; }
}
/* midnight stars twinkle in place */
body[data-theme="midnight_gold"] .intro-float span {
  bottom: auto; top: var(--y); animation-name: introTwinkle; animation-duration: calc(var(--dur) / 5);
}
@keyframes introTwinkle {
  0%, 100% { opacity: .1; transform: scale(.7); }
  50%      { opacity: .9; transform: scale(1.2); }
}

/* ---------- stage + envelope ---------- */
.intro-stage { perspective: 1100px; position: relative; z-index: 2; }
.intro-env {
  position: relative; width: min(84vw, 400px); aspect-ratio: 3 / 2;
  background: var(--env-body); border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0,0,0,.28), 0 2px 0 rgba(255,255,255,.12) inset;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  animation: envBob 3.2s ease-in-out infinite;
}
@keyframes envBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

/* theme-specific envelope trims */
body[data-theme="royal_sapphire"] .intro-env,
body[data-theme="midnight_gold"] .intro-env { box-shadow: 0 18px 40px rgba(0,0,0,.35), 0 0 0 2px var(--seal-bg) inset; }
body[data-theme="emerald_luxe"] .intro-env {
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.05) 0 6px, transparent 6px 12px);
}
body[data-theme="lavender_dream"] .intro-env {
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.12) 0 14px, transparent 15px),
                    radial-gradient(circle at 80% 70%, rgba(255,255,255,.12) 0 18px, transparent 19px);
}
body[data-theme="sunset_coral"] .intro-env {
  background-image: linear-gradient(180deg, rgba(255,255,255,.14), rgba(0,0,0,.08));
}
body[data-theme="ocean_teal"] .intro-env {
  background-image: repeating-radial-gradient(circle at 50% 120%, rgba(255,255,255,.08) 0 10px, transparent 10px 22px);
}
body[data-theme="pastel_confetti"] .intro-env {
  background-image:
    radial-gradient(circle, #59c3c9 0 3px, transparent 4px),
    radial-gradient(circle, #f6c453 0 3px, transparent 4px);
  background-size: 34px 34px, 52px 52px; background-position: 6px 8px, 22px 24px;
}

/* the invitation card tucked inside */
.intro-card {
  position: absolute; left: 5%; right: 5%; top: 5%; height: 90%; z-index: 2;
  background: var(--card-bg); color: var(--card-ink);
  border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 10px 14px; overflow: hidden;
  transition: transform 1s cubic-bezier(.2,.8,.25,1) .7s;
}
.intro-card::before {
  content: ""; position: absolute; inset: 6px; border: 1px solid var(--card-accent); opacity: .45; border-radius: 2px;
}
.intro-card .ic-small {
  font-family: var(--font-heading); letter-spacing: 3px; text-transform: uppercase;
  font-size: clamp(.55rem, 2vw, .7rem); color: var(--card-accent);
}
.intro-card .ic-names {
  font-family: var(--font-script); line-height: 1.1; margin: 6px 0;
  font-size: clamp(1.25rem, 6vw, 2rem); color: var(--card-ink); word-break: break-word;
}
.intro-card .ic-date {
  font-family: var(--font-body); font-size: clamp(.8rem, 3vw, 1rem); color: var(--card-ink); opacity: .85;
}
.intro-card .ic-glyph { color: var(--card-accent); font-size: 1rem; margin-top: 4px; }
.intro-card .ic-glyph::before { content: var(--intro-glyph); }

/* pocket front (covers the lower part of the card) */
.intro-front {
  position: absolute; inset: 0; z-index: 3; border-radius: 8px;
  background: linear-gradient(180deg, var(--env-front), var(--env-body));
  clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 0 100%);
  pointer-events: none;
}
/* flap (closed = covers the top, V-shaped) */
.intro-flap {
  position: absolute; top: 0; left: 0; width: 100%; height: 55%; z-index: 4;
  background: var(--env-flap);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center; pointer-events: none;
  border-radius: 8px 8px 0 0;
}

/* wax seal = the button */
.intro-seal {
  position: absolute; left: 50%; top: 55%; z-index: 6;
  width: clamp(48px, 15vw, 64px); aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--seal-bg); color: var(--seal-fg);
  box-shadow: inset -3px -4px 8px rgba(0,0,0,.25), inset 3px 3px 6px rgba(255,255,255,.35), 0 4px 10px rgba(0,0,0,.3);
  font-size: clamp(1.3rem, 5vw, 1.7rem); line-height: 1; cursor: pointer;
  animation: sealPulse 1.8s ease-in-out infinite;
}
.intro-seal::after { content: var(--intro-glyph); }
.intro-seal:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
@keyframes sealPulse {
  0%,100% { transform: translate(-50%,-50%) scale(1); }
  50%     { transform: translate(-50%,-50%) scale(1.1); }
}

.intro-hint {
  margin-top: clamp(26px, 6vh, 48px); position: relative; z-index: 2;
  font-family: var(--font-heading); letter-spacing: 3px; text-transform: uppercase;
  font-size: clamp(.72rem, 2.8vw, .9rem); color: var(--rose);
  background: none; border: 1px solid var(--line); border-radius: 30px; padding: 11px 26px; cursor: pointer;
  animation: hintBlink 2s ease-in-out infinite;
}
body[data-theme="midnight_gold"] .intro-hint { color: var(--gold); }
@keyframes hintBlink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- OPEN sequence ---------- */
.intro-gate.opening .intro-env { animation: none; }
.intro-gate.opening .intro-hint,
.intro-gate.opening .intro-eyebrow { opacity: 0; animation: none; transition: opacity .4s; }
.intro-gate.opening .intro-seal { animation: sealOut .45s ease-in forwards; pointer-events: none; }
@keyframes sealOut {
  0%   { transform: translate(-50%,-50%) scale(1.1) rotate(0); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(0) rotate(160deg); opacity: 0; }
}
.intro-gate.opening .intro-flap { animation: flapOpen .8s ease-in-out .25s forwards; }
@keyframes flapOpen {
  0%   { transform: rotateX(0);      z-index: 4; background: var(--env-flap); }
  49%  { z-index: 4; background: var(--env-flap); }
  50%  { z-index: 1; background: var(--env-inner); }
  100% { transform: rotateX(180deg); z-index: 1; background: var(--env-inner); }
}
.intro-gate.opening .intro-card { transform: translateY(-48%); }

/* finale: the card grows toward the guest while everything fades */
.intro-gate.leaving .intro-card { transition: transform .9s ease-in; transform: translateY(-40%) scale(1.5); }

/* ---------- burst particles (sprayed when the seal breaks) ---------- */
.intro-burst {
  position: absolute; left: 50%; top: 55%; z-index: 7; pointer-events: none;
  font-size: var(--s, 16px); color: var(--seal-bg);
  animation: burstOut 1.1s cubic-bezier(.15,.7,.3,1) forwards;
}
.intro-burst::before { content: var(--intro-glyph); }
body[data-theme="pastel_confetti"] .intro-burst { width: 8px; height: 13px; border-radius: 2px; background: currentColor; }
body[data-theme="pastel_confetti"] .intro-burst::before { content: none; }
body[data-theme="ocean_teal"] .intro-burst::before { content: var(--intro-particle); }
@keyframes burstOut {
  0%   { transform: translate(-50%,-50%) scale(.2) rotate(0); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1) rotate(var(--rot)); opacity: 0; }
}

/* ---------- accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  .intro-env, .intro-seal, .intro-hint, .intro-float span { animation: none !important; }
  .intro-card, .intro-gate { transition-duration: .01s !important; transition-delay: 0s !important; }
  .intro-gate.opening .intro-flap { animation-duration: .01s; animation-delay: 0s; }
  .intro-burst { display: none; }
}


/* =========================================================
   v1.2 — extra opening styles (rocket, scroll, press & colour,
   genie, circle, cartoon). Same open/leave timeline as the envelope.
   ========================================================= */
.free-stage { position: relative; width: min(84vw, 380px); aspect-ratio: 3 / 2; display: flex; align-items: center; justify-content: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.intro-card.free {
  position: absolute; left: 50%; top: 50%; right: auto; width: 100%; height: auto; aspect-ratio: 3 / 2;
  transform: translate(-50%, -50%) scale(.2); opacity: 0; transition: none; z-index: 3;
  box-shadow: 0 14px 34px rgba(0,0,0,.3);
}
@keyframes freeIn {
  0%   { transform: translate(-50%,-50%) scale(.2) rotate(-6deg); opacity: 0; }
  60%  { transform: translate(-50%,-50%) scale(1.07) rotate(1deg); opacity: 1; }
  100% { transform: translate(-50%,-50%) scale(1) rotate(0); opacity: 1; }
}
.intro-gate.opening .intro-card.free { animation: freeIn .9s cubic-bezier(.2,.9,.3,1) var(--cd, .6s) both; }
.intro-gate[data-style]:not([data-style="envelope"]).leaving .intro-stage { transition: transform .9s ease-in; transform: scale(1.3); }
.intro-hint.static { border: 0; cursor: default; pointer-events: none; }

/* ---------- PAPER ROCKET ---------- */
.intro-gate[data-style="rocket"] { --cd: .75s; }
.rk-rocket { position: absolute; left: 50%; bottom: -8%; width: clamp(54px, 16vw, 72px); transform: translateX(-50%); overflow: visible; z-index: 4;
  filter: drop-shadow(0 6px 8px rgba(0,0,0,.25)); animation: rkIdle 1.6s ease-in-out infinite; }
.rk-rocket .body { fill: #fff; stroke: var(--rose); stroke-width: 2.2; }
.rk-rocket .fold { fill: var(--blush); }
.rk-rocket .fin { fill: var(--rose); stroke: var(--wine); stroke-width: 1.5; }
.rk-rocket .win { fill: var(--gold); stroke: var(--wine); stroke-width: 2; }
.rk-rocket .crease { stroke: var(--rose); stroke-width: 1; opacity: .5; fill: none; }
.rk-rocket .flame { fill: var(--gold); transform-origin: 30px 88px; animation: rkFlame .25s ease-in-out infinite alternate; }
@keyframes rkIdle { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px); } }
@keyframes rkFlame { from { transform: scaleY(.7); } to { transform: scaleY(1.2); } }
.intro-gate.opening .rk-rocket { animation: rkLaunch 1.1s cubic-bezier(.5,0,.9,.4) forwards; }
@keyframes rkLaunch {
  0%   { transform: translateX(-50%) translateY(0); }
  15%  { transform: translateX(-50%) translateY(6px) rotate(-3deg); }
  30%  { transform: translateX(-52%) translateY(-4px) rotate(3deg); }
  100% { transform: translateX(-50%) translateY(-135vh); }
}
.rk-cloud { position: absolute; height: 22px; width: 70px; border-radius: 30px; background: rgba(255,255,255,.75); box-shadow: 0 0 0 1px var(--line); animation: cloudDrift 7s ease-in-out infinite alternate; }
.rk-cloud.c1 { left: 4%; top: 12%; } .rk-cloud.c2 { right: 2%; top: 34%; width: 90px; animation-duration: 9s; } .rk-cloud.c3 { left: 14%; bottom: 8%; width: 60px; animation-duration: 8s; }
@keyframes cloudDrift { from { transform: translateX(-10px); } to { transform: translateX(14px); } }
.rk-smoke { position: absolute; left: 50%; bottom: -2%; width: 46px; height: 46px; margin-left: -23px; border-radius: 50%; background: rgba(255,255,255,.85); opacity: 0; z-index: 3; }
.rk-smoke.s2 { margin-left: -44px; } .rk-smoke.s3 { margin-left: -2px; }
.intro-gate.opening .rk-smoke { animation: rkPuff 1.1s ease-out forwards; }
.intro-gate.opening .rk-smoke.s2 { animation-delay: .08s; } .intro-gate.opening .rk-smoke.s3 { animation-delay: .16s; }
@keyframes rkPuff { 0% { transform: scale(.3); opacity: .9; } 100% { transform: translateY(20px) scale(3.2); opacity: 0; } }

/* ---------- OLD KINGDOM LETTER (scroll) ---------- */
.sc-stage { position: relative; width: min(86vw, 360px); display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.sc-roll { position: relative; z-index: 2; width: 104%; height: 26px; border-radius: 14px;
  background: linear-gradient(180deg, #ecd7a3, #c9a45f 55%, #a07f3d); box-shadow: 0 4px 10px rgba(0,0,0,.3), inset 0 2px 0 rgba(255,255,255,.35); }
.sc-roll::before, .sc-roll::after { content: ""; position: absolute; top: 3px; bottom: 3px; width: 8px; border-radius: 50%; background: #8a6a2e; }
.sc-roll::before { left: -2px; } .sc-roll::after { right: -2px; }
.sc-paper { width: 92%; height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #f7ecd0, #efe0b8 60%, #e8d4a2); box-shadow: inset 0 0 22px rgba(120,90,40,.25);
  transition: height 1.2s cubic-bezier(.3,.8,.3,1) .5s; }
.intro-gate.opening .sc-paper { height: clamp(190px, 52vw, 240px); }
.sc-text { padding: 14px; text-align: center; display: flex; flex-direction: column; align-items: center; color: #4a3320; }
.sc-text .ic-small { font-family: var(--font-heading); letter-spacing: 3px; text-transform: uppercase; font-size: clamp(.55rem, 2vw, .7rem); color: #8a5a1f; }
.sc-text .ic-names { font-family: var(--font-script); line-height: 1.1; margin: 8px 0; font-size: clamp(1.4rem, 6.4vw, 2.1rem); word-break: break-word; }
.sc-text .ic-date { font-family: var(--font-body); font-size: clamp(.85rem, 3vw, 1.05rem); opacity: .85; }
.sc-text .ic-glyph { color: #8a5a1f; margin-top: 6px; } .sc-text .ic-glyph::before { content: var(--intro-glyph); }
.sc-ribbon { position: absolute; top: 0; bottom: 0; left: 50%; width: 22px; margin-left: -11px; z-index: 3; border-radius: 2px;
  background: linear-gradient(90deg, var(--rose), var(--wine)); box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: opacity .35s; }
.intro-gate.opening .sc-ribbon { opacity: 0; }
.sc-seal { top: 50%; z-index: 6; }

/* ---------- PRESS & COLOUR LOAD ---------- */
.intro-gate[data-style="presscolor"] { --cd: .6s; }
.pc-btn { position: relative; z-index: 4; width: clamp(120px, 36vw, 150px); aspect-ratio: 1; border-radius: 50%; border: 4px solid var(--rose);
  background: var(--cream); overflow: hidden; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 10px 26px rgba(0,0,0,.2); color: var(--rose); padding: 0; display: flex; align-items: center; justify-content: center; }
.pc-fill { position: absolute; inset: 0; background: linear-gradient(180deg, var(--gold), var(--rose)); transform: translateY(100%); transition: transform .3s ease-out; }
.pc-btn.holding .pc-fill { transform: translateY(0); transition: transform 1.2s linear; }
.pc-btn.holding { animation: pcShake .12s linear infinite; color: #fff; }
.pc-label { position: relative; z-index: 2; font-size: 2.6rem; line-height: 1; }
.pc-label::after { content: var(--intro-glyph); }
@keyframes pcShake { 0% { transform: translate(1px,0); } 50% { transform: translate(-1px,1px); } 100% { transform: translate(0,-1px); } }
.pc-flood { position: fixed; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; z-index: 1; pointer-events: none;
  background: radial-gradient(circle, var(--gold), var(--rose)); transform: scale(0); }
.intro-gate.opening .pc-flood { animation: pcFlood 1.3s ease-out forwards; }
@keyframes pcFlood { 0% { transform: scale(0); opacity: 1; } 65% { transform: scale(180); opacity: 1; } 100% { transform: scale(180); opacity: 0; } }
.intro-gate.opening .pc-btn { animation: none; opacity: 0; transform: scale(.4); transition: transform .35s ease-in, opacity .35s; }

/* ---------- GENIE WISH ---------- */
.gn-lamp { position: absolute; left: 50%; bottom: -4%; width: clamp(150px, 46vw, 200px); transform: translateX(-50%); z-index: 4;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,.3)); animation: gnIdle 2.4s ease-in-out infinite; }
.gn-lamp .lamp { fill: var(--gold); stroke: var(--wine); stroke-width: 3; stroke-linejoin: round; }
.gn-lamp .lamp-line { fill: none; stroke: var(--wine); stroke-width: 8; stroke-linecap: round; }
.gn-lamp .shine { fill: none; stroke: rgba(255,255,255,.75); stroke-width: 5; stroke-linecap: round; }
@keyframes gnIdle { 0%,100% { transform: translateX(-50%) rotate(-2deg); } 50% { transform: translateX(-50%) rotate(2deg); } }
.intro-gate.opening .gn-lamp { animation: gnRub .6s ease-in-out 2; }
@keyframes gnRub { 0%,100% { transform: translateX(-50%) rotate(0); } 25% { transform: translateX(calc(-50% - 4px)) rotate(-8deg); } 75% { transform: translateX(calc(-50% + 4px)) rotate(8deg); } }
.gn-smoke { position: absolute; left: 30%; bottom: 24%; width: 52px; height: 52px; border-radius: 50%; opacity: 0; z-index: 2;
  background: radial-gradient(circle, rgba(255,255,255,.95), var(--blush) 55%, transparent 72%); }
.gn-smoke.a { --sx: -30px; } .gn-smoke.b { --sx: 10px; left: 34%; } .gn-smoke.c { --sx: 40px; left: 28%; } .gn-smoke.d { --sx: -10px; left: 32%; }
.intro-gate.opening .gn-smoke { animation: gnSmoke 1.6s ease-out forwards; }
.intro-gate.opening .gn-smoke.b { animation-delay: .15s; } .intro-gate.opening .gn-smoke.c { animation-delay: .3s; } .intro-gate.opening .gn-smoke.d { animation-delay: .45s; }
@keyframes gnSmoke { 0% { transform: translate(0,0) scale(.3); opacity: 0; } 25% { opacity: .95; } 100% { transform: translate(var(--sx), -170px) scale(2.6); opacity: 0; } }
.intro-gate[data-style="genie"].opening .intro-card.free { animation: gnCard 1.1s cubic-bezier(.2,.9,.3,1) .45s both; }
@keyframes gnCard {
  0%   { transform: translate(-120%, 40%) scale(.1) rotate(-30deg); opacity: 0; }
  40%  { opacity: 1; }
  100% { transform: translate(-50%, -62%) scale(1) rotate(0); opacity: 1; }
}

/* ---------- CIRCLE WISH ---------- */
.cw-ring { position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; border-radius: 50%; border: 2px solid var(--gold);
  transform: translate(-50%,-50%); opacity: .8; animation: cwPulse 2.4s ease-out infinite; }
.cw-ring.r2 { animation-delay: .8s; } .cw-ring.r3 { animation-delay: 1.6s; }
@keyframes cwPulse { 0% { transform: translate(-50%,-50%) scale(1); opacity: .8; } 100% { transform: translate(-50%,-50%) scale(3.2); opacity: 0; } }
.cw-btn { position: relative; z-index: 4; width: 92px; height: 92px; border-radius: 50%; border: 0; cursor: pointer; padding: 0; color: #fff; font-size: 2rem;
  background: radial-gradient(circle at 35% 30%, var(--gold), var(--rose)); box-shadow: 0 0 0 6px var(--line), 0 0 30px var(--gold); animation: cwGlow 1.8s ease-in-out infinite; }
.cw-btn::after { content: var(--intro-glyph); }
@keyframes cwGlow { 0%,100% { transform: scale(1); } 50% { transform: scale(1.08); } }
.intro-gate.opening .cw-btn { animation: none; transform: scale(0); transition: transform .35s ease-in; }
.intro-gate.opening .cw-ring { animation: cwBurst 1.1s ease-out forwards; }
@keyframes cwBurst { 0% { transform: translate(-50%,-50%) scale(1); opacity: .9; } 100% { transform: translate(-50%,-50%) scale(14); opacity: 0; } }
.intro-card.free.cw-card { opacity: 1; transform: translate(-50%,-50%); clip-path: circle(0% at 50% 50%); }
.intro-gate.opening .intro-card.free.cw-card { animation: cwReveal 1s ease-out .35s both; }
@keyframes cwReveal {
  from { clip-path: circle(0% at 50% 50%); transform: translate(-50%,-50%) scale(.9); }
  to   { clip-path: circle(75% at 50% 50%); transform: translate(-50%,-50%) scale(1); }
}

/* ---------- CARTOON POP ---------- */
.ct-box { position: absolute; left: 50%; bottom: 0; width: clamp(110px, 34vw, 140px); transform: translateX(-50%); z-index: 4; transform-origin: 50% 100%; animation: ctWobble 1.4s ease-in-out infinite; }
@keyframes ctWobble { 0%,100% { transform: translateX(-50%) rotate(-3deg); } 50% { transform: translateX(-50%) rotate(3deg) scale(1.04); } }
.ct-body { position: relative; height: clamp(78px, 24vw, 98px); background: var(--rose); border: 4px solid #2b2230; border-radius: 10px; box-shadow: 5px 6px 0 #2b2230; }
.ct-ribbon { position: absolute; left: 50%; top: -4px; bottom: -4px; width: 22px; margin-left: -11px; background: var(--gold); border-left: 4px solid #2b2230; border-right: 4px solid #2b2230; }
.ct-lid { position: relative; z-index: 2; height: 34px; margin: 0 -8px -4px; background: var(--gold); border: 4px solid #2b2230; border-radius: 10px; box-shadow: 5px 6px 0 #2b2230; }
.ct-lid::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 22px; margin-left: -11px; background: var(--rose); border-left: 4px solid #2b2230; border-right: 4px solid #2b2230; }
.ct-lid .bow { position: absolute; top: -24px; width: 28px; height: 28px; border: 4px solid #2b2230; background: var(--rose); border-radius: 50% 50% 0 50%; }
.ct-lid .bow.l { left: calc(50% - 30px); transform: rotate(-20deg); } .ct-lid .bow.r { left: calc(50% + 2px); transform: rotate(70deg); }
.intro-gate.opening .ct-box { animation: ctBoxGone .5s ease-in .95s forwards; }
.intro-gate.opening .ct-lid { animation: ctLid .75s ease-out forwards; }
@keyframes ctLid { 0% { transform: translateY(0) rotate(0); } 60% { transform: translateY(-120px) rotate(-28deg); opacity: 1; } 100% { transform: translateY(-150px) rotate(-40deg); opacity: 0; } }
@keyframes ctBoxGone { to { transform: translateX(-50%) translateY(40px) scale(.2); opacity: 0; } }
.ct-pop { position: absolute; left: 50%; top: 40%; z-index: 5; padding: 20px 24px; opacity: 0; transform: translate(-50%,-50%) scale(0);
  font-family: var(--font-heading); font-weight: 900; font-size: 1.5rem; color: #2b2230; background: var(--gold);
  clip-path: polygon(50% 0,61% 20%,82% 12%,78% 35%,100% 40%,82% 56%,94% 78%,70% 74%,62% 100%,50% 82%,38% 100%,30% 74%,6% 78%,18% 56%,0 40%,22% 35%,18% 12%,39% 20%); }
.intro-gate.opening .ct-pop { animation: ctPop .8s ease-out .3s forwards; }
@keyframes ctPop { 0% { transform: translate(-50%,-50%) scale(0) rotate(-12deg); opacity: 1; } 45% { transform: translate(-50%,-50%) scale(1.35) rotate(6deg); opacity: 1; } 100% { transform: translate(-50%,-50%) scale(1) rotate(0); opacity: 0; } }
.intro-card.free.ct-card { border: 4px solid #2b2230; border-radius: 12px; box-shadow: 7px 8px 0 #2b2230; }
.intro-gate[data-style="cartoon"].opening .intro-card.free { animation: ctCard 1s cubic-bezier(.34,1.56,.64,1) .55s both; }
@keyframes ctCard {
  0%   { transform: translate(-50%, 10%) scale(.2) rotate(-15deg); opacity: 0; }
  55%  { transform: translate(-50%, -60%) scale(1.12) rotate(4deg); opacity: 1; }
  75%  { transform: translate(-50%, -48%) scale(.96) rotate(-2deg); }
  100% { transform: translate(-50%, -50%) scale(1) rotate(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .rk-rocket, .rk-cloud, .gn-lamp, .cw-ring, .cw-btn, .ct-box { animation: none !important; }
  .intro-gate.opening .intro-card.free, .intro-gate.opening .sc-paper { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; transition-delay: 0s !important; }
  .rk-smoke, .gn-smoke, .ct-pop, .pc-flood { display: none; }
}
