/* Opening scene, 2026-10-03. Remove this file and js/12-opening.js to restore the original gate. */
.gate.anim-opening {
  --anim-opening-ready: 1;
  --anim-opening-ease: cubic-bezier(.22, .61, .36, 1);
  /* Keep the decoded forest on the stationary gate, outside transformed layers.
     Avoid rerasterizing the full-screen bitmap as the approaching scenery changes. */
  background: #f6efd2 url('../assets/opening/enchanted-zoo.webp') center / cover no-repeat;
  isolation: isolate;
}
.anim-opening .gate-shutter {
  background: transparent; overflow-x: hidden; padding: 168px 20px 42px;
  z-index: 3; align-items: center;
}
.anim-opening .gate-bars,
.anim-opening .gate-rail,
.anim-opening .gate-peek,
.anim-opening .gate-rings { display: none; }
.anim-opening .gate-stage {
  width: min(620px, 88vw); margin: 0; transform: rotate(-1deg);
}
.anim-opening .gate-ticket {
  background-color: #fff9e8; box-shadow: 0 7px 0 var(--ink), 0 22px 0 -10px #e7c88f;
  grid-template-columns: minmax(0, 1fr) 76px; border-radius: 15px 13px 20px 12px;
}
.anim-opening .ticket-main { padding: 25px 24px 23px 40px; }
.anim-opening .ticket-head { margin-bottom: 18px; padding-bottom: 10px; gap: 8px; }
.anim-opening .ticket-label { font-size: .76rem; letter-spacing: .025em; }
.anim-opening .ticket-no b { font-size: .88rem; }
.anim-opening .gate-title { font-size: clamp(2.15rem, 5vw, 3.8rem); line-height: 1.18; margin-bottom: 20px; }
.anim-opening .gate-title .beat-row:first-child { font-size: .62em; margin-bottom: .14em; }
.anim-opening .gate-title .beat,
.gate.anim-opening.is-first .gate-title .beat { transform: none; will-change: auto; }
.anim-opening .beat-ghost { display: none; }
.anim-opening .gate-title .ch { text-shadow: .04em .055em 0 var(--ink); }
.anim-opening .gate-title .beat.anim-opening-lit .ch {
  text-shadow: .04em .055em 0 var(--ink), 0 0 15px #fff, 0 0 28px #ffde58;
}
.anim-opening .gate-count { margin-bottom: 17px; }
.anim-opening .gate-count-bar { height: 10px; padding: 1px; margin-bottom: 6px; }
.anim-opening .gate-count-text { font-size: .75rem; }
.anim-opening .gate-count.is-done .gate-count-label { animation: none; }
.anim-opening .gate-actions { gap: 9px; margin-bottom: 13px; flex-wrap: nowrap; }
.anim-opening .gate-actions .mp-cta-btn { min-height: 52px; padding: 10px 15px; font-size: .91rem; letter-spacing: 0; }
.anim-opening .gate-actions .btn-enter { background-color: var(--mi); }
.anim-opening .gate-actions .spk { width: 16px; height: 16px; }
.anim-opening .gate-actions .mp-cta-label { gap: 6px; }
.anim-opening .enter-wrap::before,
.anim-opening .enter-wrap::after { display: none; }
.anim-opening .gate-note { font-size: .75rem; line-height: 1.75; }
.anim-opening .gate-credit { font-size: .75rem; }
.anim-opening .ticket-stub { padding: 22px 5px; background: #ffe080; }
.anim-opening .stub-brand { font-size: 1rem; }
.anim-opening .gate-stamp { width: 58px; }
.anim-opening .gate-stamp-date { font-size: .75rem; }
.anim-opening .stub-time { font-size: .75rem; }

/* Three planes: the painted clearing, the portal, and the near bushes. */
.anim-opening-scene { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.anim-opening-world { position: absolute; inset: 0; transform-origin: 50% 40%; }
.anim-opening-portal { position: absolute; width: min(1180px, 108vw); height: 100%; top: 0; left: 50%; transform: translateX(-50%); overflow: visible; }
.anim-opening-bough { transform-origin: 80% 10%; }
.anim-opening-door { position: absolute; top: 49%; bottom: -4%; width: 31%; z-index: 2; }
.anim-opening-door--left { left: -2%; transform-origin: 0 70%; }
.anim-opening-door--right { right: -2%; transform-origin: 100% 70%; }
.anim-opening-door svg { display: block; width: 100%; height: 100%; overflow: visible; }
.anim-opening-door--right svg { transform: scaleX(-1); }
.anim-opening-visitor {
  position: absolute; z-index: 3; width: clamp(150px, 20vw, 285px);
  aspect-ratio: 1; display: grid; place-items: center;
  transform-origin: 50% 100%;
}
.anim-opening-visitor img { display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 4px 0 #f9edc9); }
.anim-opening-visitor > .frame-round { width: 90%; height: 90%; }
.anim-opening-visitor .frame-round > img.chara { object-fit: contain !important; filter: none; }
.anim-opening-visitor--left { left: 9%; bottom: 8%; transform: rotate(-7deg); }
.anim-opening-visitor--right { right: 8%; bottom: 11%; width: clamp(140px, 18vw, 255px); transform: rotate(8deg); }
.anim-opening-visitor--top { right: 22%; top: 7%; width: clamp(74px, 8vw, 122px); transform: rotate(9deg); }
.anim-opening-arrival { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.anim-opening-near { position: absolute; top: -10%; width: 47%; height: 122%; transform-origin: 0 55%; }
.anim-opening-near--left { left: -5%; }
.anim-opening-near--right { right: -5%; transform-origin: 100% 55%; }
.anim-opening-near svg { width: 100%; height: 100%; display: block; }
.anim-opening-near--right svg { transform: scaleX(-1); }
.anim-opening-brush { position: absolute; z-index: 4; bottom: -24px; width: 35%; height: 38%; }
.anim-opening-brush--left { left: -25px; }
.anim-opening-brush--right { right: -25px; transform: scaleX(-1); }
.anim-opening-brush svg { width: 100%; height: 100%; overflow: visible; }
.anim-opening-invitation {
  position: absolute; z-index: 5; top: max(116px, 16vh); left: 50%; transform: translateX(-50%) rotate(-2deg);
  width: max-content; max-width: calc(100% - 36px); margin: 0; padding: 11px 25px;
  background: #ffe66c; border: 3px solid var(--ink); border-radius: 60% 38% 48% 45% / 22% 38% 21% 30%;
  box-shadow: 3px 5px 0 var(--ink); font-family: var(--f-body); font-size: clamp(.875rem, 1.5vw, 1.125rem);
  font-weight: 900; letter-spacing: .04em; text-align: center; line-height: 1.5;
}
.anim-opening-invitation::before,
.anim-opening-invitation::after { content: ''; position: absolute; width: 3px; height: 27px; background: var(--ink); top: -29px; }
.anim-opening-invitation::before { left: 14%; transform: rotate(7deg); }
.anim-opening-invitation::after { right: 14%; transform: rotate(-6deg); }
.anim-opening-veil { position: absolute; inset: 0; z-index: 6; background: #fbf5e5; opacity: 0; pointer-events: none; }
.anim-opening-is-pressed .gate-shutter { pointer-events: none; }
html:has(.anim-opening) #mp-loader { display: none; }

@media (min-width: 1500px) {
  .anim-opening-visitor--left { left: 14%; }
  .anim-opening-visitor--right { right: 14%; }
}
@media (max-width: 899px) {
  .anim-opening .gate-shutter { padding-top: 156px; }
  .anim-opening .gate-stage { width: min(570px, 86vw); }
  .anim-opening .gate-title { font-size: clamp(2.5rem, 6vw, 3.5rem); }
  .anim-opening-visitor--left { left: -4%; bottom: 10%; }
  .anim-opening-visitor--right { right: -5%; bottom: 8%; }
  .anim-opening-visitor--top { right: 13%; top: 5%; }
  .anim-opening-invitation { top: 14vh; }
  .anim-opening-door { width: 38%; }
}
@media (max-width: 599px) {
  .anim-opening .gate-shutter { padding: 228px 12px 96px; place-items: center; }
  .anim-opening .gate-stage { width: min(342px, 91vw); transform: rotate(-1deg); }
  .anim-opening .gate-ticket { grid-template-columns: minmax(0, 1fr) 40px; }
  .anim-opening .ticket-main { padding: 18px 14px 17px 28px; }
  .anim-opening .ticket-head { flex-direction: row; align-items: center; margin-bottom: 14px; }
  .anim-opening .ticket-label { font-size: .75rem; line-height: 1.6; max-width: 146px; }
  .anim-opening .ticket-no { font-size: .75rem; }
  .anim-opening .ticket-no b { font-size: .75rem; }
  .anim-opening .gate-title { font-size: clamp(1.75rem, 8.3vw, 2.6rem); margin-bottom: 17px; }
  .anim-opening .gate-title .beat-row:first-child { margin-bottom: .2em; }
  .anim-opening .gate-count { margin-bottom: 15px; }
  .anim-opening .gate-count-text { font-size: .75rem; }
  .anim-opening .gate-actions { flex-direction: column; gap: 10px; }
  .anim-opening .gate-actions .mp-cta-btn { min-height: 48px; font-size: .88rem; }
  .anim-opening .gate-note { font-size: .75rem; }
  .anim-opening .gate-esc { display: none; }
  .anim-opening .gate-credit { font-size: .75rem; }
  .anim-opening .ticket-stub { padding: 16px 3px; }
  .anim-opening .stub-brand { font-size: .78rem; }
  .anim-opening .stub-time { font-size: .75rem; }
  .anim-opening .gate-stamp { width: 32px; border-width: 2px; }
  .anim-opening .gate-stamp-q { font-size: .88rem; }
  .gate.anim-opening { background-size: auto 100%; background-position: 52% center; }
  .anim-opening-portal { width: 670px; left: 50%; height: 84%; top: 0; }
  .anim-opening-door { top: 46%; width: 45%; opacity: .95; }
  .anim-opening-invitation { top: 153px; font-size: .83rem; padding: 11px 14px; max-width: 330px; letter-spacing: .01em; }
  .anim-opening-visitor--left { width: 148px; left: -20px; bottom: 35px; }
  .anim-opening-visitor--right { width: 126px; right: -10px; bottom: 31px; }
  .anim-opening-visitor--top { width: 77px; right: 29px; top: 65px; }
  .anim-opening-near { width: 58%; }
  .anim-opening-near--left { left: -13%; }
  .anim-opening-near--right { right: -13%; }
  .anim-opening-brush { width: 43%; height: 155px; bottom: -32px; }
}
@media (max-height: 760px) and (min-width: 600px) {
  .anim-opening .gate-shutter { padding-top: 155px; padding-bottom: 28px; }
  .anim-opening-invitation { top: 72px; }
  .anim-opening .gate-stage { width: min(570px, 82vw); }
  .anim-opening .ticket-main { padding-top: 18px; padding-bottom: 16px; }
  .anim-opening .gate-title { font-size: 3.15rem; margin-bottom: 13px; }
}
@media (max-height: 740px) and (max-width: 599px) {
  .anim-opening .gate-shutter { padding-top: 156px; padding-bottom: 65px; }
  .anim-opening-invitation { top: 93px; }
  .anim-opening-visitor--top { top: 17px; }
  .anim-opening .ticket-main { padding-top: 15px; padding-bottom: 13px; }
  .anim-opening .gate-count { margin-bottom: 12px; }
  .anim-opening .gate-title { margin-bottom: 12px; }
  .anim-opening .gate-actions { margin-bottom: 10px; }
}
/* A short landscape screen keeps both entry choices visible without scrolling. */
@media (max-height: 500px) and (min-width: 600px) {
  .anim-opening .gate-shutter { padding: 87px 16px 20px; }
  .anim-opening .gate-stage { width: min(730px, 94vw); transform: none; }
  .anim-opening .gate-ticket { grid-template-columns: minmax(0, 1fr) 48px; }
  .anim-opening .ticket-main {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 22px; padding: 13px 19px 13px 32px;
  }
  .anim-opening .ticket-head { grid-area: 1 / 1 / 2 / 3; padding-bottom: 7px; margin-bottom: 11px; }
  .anim-opening .gate-title { grid-area: 2 / 1 / 4 / 2; font-size: 2.3rem; margin: 0; align-self: center; }
  .anim-opening .gate-count { grid-area: 4 / 1 / 5 / 2; margin: 9px 0 0; align-self: end; }
  .anim-opening .gate-actions { grid-area: 2 / 2 / 3 / 3; flex-direction: column; gap: 7px; margin: 0 0 9px; }
  .anim-opening .gate-actions .enter-wrap,
  .anim-opening .gate-actions .mp-cta-btn { width: 100%; }
  .anim-opening .gate-actions .mp-cta-btn { min-height: 44px; padding: 8px 10px; font-size: .875rem; }
  .anim-opening .gate-note { grid-area: 3 / 2 / 5 / 3; font-size: .75rem; line-height: 1.5; }
  .anim-opening .gate-esc { display: none; }
  .anim-opening .gate-credit { grid-area: 5 / 1 / 6 / 3; font-size: .75rem; margin-top: 9px; }
  .anim-opening .ticket-stub { padding: 14px 4px; }
  .anim-opening .stub-brand { font-size: .8rem; }
  .anim-opening .gate-stamp { width: 35px; }
  .anim-opening .gate-stamp-date { display: none; }
  .anim-opening-invitation { top: 25px; font-size: .85rem; padding: 7px 18px; }
  .anim-opening-invitation::before,
  .anim-opening-invitation::after { height: 15px; top: -17px; }
  .anim-opening-visitor--top { width: 67px; top: 5px; right: 15%; }
  .anim-opening-visitor--left { width: 158px; bottom: 0; }
  .anim-opening-visitor--right { width: 137px; bottom: -8px; }
  .anim-opening-brush { height: 110px; }
}
html[data-reduced] .anim-opening .gate-stage { transform: none; }
html[data-reduced] .anim-opening-arrival { display: none; }
@media (prefers-reduced-motion: reduce) {
  .anim-opening .gate-stage { transform: none; }
  .anim-opening .gate-title .beat { transition: none; }
  .anim-opening-arrival { display: none; }
}
