:root{font-family:"Helvetica Neue",Arial,"Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;color:#292824;background:#f4f1eb;font-synthesis:none}*{box-sizing:border-box}body{margin:0}.stage{min-height:100svh;padding:clamp(30px,6vh,66px) 20px 28px;display:flex;align-items:center;flex-direction:column;overflow:hidden;background:radial-gradient(ellipse at 50% 26%,#fffdfa,#f4f1eb 78%)}.intro{text-align:center;position:relative;z-index:2}.eyebrow{color:#91877c;font-size:10px;letter-spacing:.24em;margin:0 0 20px}.intro h1{font-size:clamp(19px,4.5vw,27px);font-weight:500;line-height:1.6;letter-spacing:.055em;margin:0}.instruction{font-size:12px;letter-spacing:.04em;color:#746d64;margin:12px 0 0}.scene{width:min(68vw,290px);height:clamp(308px,49vh,455px);margin-top:24px;position:relative;perspective:1100px;flex:none;filter:drop-shadow(0 13px 11px #73695a29)}.interior{position:absolute;inset:10px 9px 5px;overflow:hidden;background:#756e61}.interior img{width:100%;height:100%;display:block;object-fit:cover;object-position:center}.interior-shade{position:absolute;inset:0;background:linear-gradient(0deg,#161b1cb5,transparent 45%)}.gallery-label{position:absolute;bottom:20px;left:14px;right:14px;color:white;display:flex;flex-direction:column;gap:7px;text-align:center;opacity:0;transform:translateY(10px);transition:opacity .8s,transform .8s}.gallery-label span{font-size:9px;letter-spacing:.23em}.gallery-label strong{font-size:17px;font-weight:500;letter-spacing:.06em}.doorframe{position:absolute;inset:0;border:10px solid #e5ddd0;border-top-width:12px;border-bottom-width:8px;background:#67553f;box-shadow:inset 0 0 0 2px #b7a998,0 4px 12px #0002;transform-style:preserve-3d}.door{position:absolute;inset:0;transform-origin:left center;transform-style:preserve-3d;background:linear-gradient(100deg,#9f7856 0%,#b18b67 9%,#b9926d 25%,#b58b64 53%,#ad825c 85%,#8d694c 100%);box-shadow:inset 5px 0 10px #ffffff21,inset -4px 0 11px #472d1655,2px 3px 3px #271d1640;will-change:transform}.door:before{content:"";position:absolute;inset:0;background:repeating-linear-gradient(92deg,#47331b0b 0 1px,transparent 1px 11px,#fff7 11px 12px,transparent 12px 24px);opacity:.34;pointer-events:none}.door-panel{position:absolute;left:13%;right:13%;border:solid 4px #86624270;box-shadow:inset 0 0 0 3px #d3b08a55,2px 2px 1px #fce7c537;background:linear-gradient(90deg,#52381b0c,#ffffff0d 50%,#48351a0e)}.panel-top{top:10%;height:40%}.panel-bottom{top:54%;bottom:8%}.keyhole{position:absolute;left:80%;top:54%;width:12px;height:25px;transform:translate(-50%,-50%);background:linear-gradient(110deg,#d4b475,#8d6834);border-radius:6px;box-shadow:0 0 0 2px #7556395a;z-index:3}.keyhole span{position:absolute;top:5px;left:4px;width:4px;height:11px;background:#503923;clip-path:polygon(50% 0,100% 30%,75% 45%,90% 100%,10% 100%,25% 45%,0 30%)}.handle{position:absolute;top:43%;left:80%;width:64px;height:46px;transform:translate(-13%,-50%);z-index:4}.handle-base{position:absolute;left:0;top:12px;width:25px;height:25px;border-radius:50%;background:radial-gradient(circle at 35% 28%,#f9e3aa,#b18a48 55%,#694a24);box-shadow:1px 1px 3px #0005}.lever{position:absolute;left:14px;top:20px;width:50px;height:9px;border-radius:5px 6px 4px 3px;background:linear-gradient(#f7e7b2,#b08a46 55%,#76542d);transform-origin:5px 4px;box-shadow:0 3px 4px #0003}.controls{min-height:118px;text-align:center;display:flex;align-items:center;flex-direction:column;justify-content:center;position:relative;z-index:10}.key-button{border:0;background:none;color:#6d5b46;cursor:pointer;display:flex;align-items:center;flex-direction:column;gap:0;padding:0 24px 9px;touch-action:manipulation}.key-button:focus-visible,.replay:focus-visible{outline:3px solid #6a8ca6;outline-offset:5px}.key-art{width:132px;height:75px;overflow:visible;filter:drop-shadow(0 4px 2px #71542f33)}.tap-text{font-size:10px;letter-spacing:.2em}.note{color:#968a7d;font-size:10px;letter-spacing:.035em;min-height:15px;margin:8px 0 0}.replay{font-size:12px;border:1px solid #a99c8a;padding:11px 19px;min-height:44px;background:#ffffffb0;color:#635544;letter-spacing:.05em;border-radius:2px;cursor:pointer}.completed{text-align:center;padding:0 12px 15px;display:flex;flex-direction:column;gap:11px;animation:softIn .8s both}.completed[hidden],.replay[hidden]{display:none}.completed p{font-size:10px;letter-spacing:.27em;color:#947e61;margin:0}.completed strong{font-size:21px;font-weight:500}.completed span{font-size:12px;color:#766b60}.stage.is-open .gallery-label{opacity:1;transform:none}.stage.is-open .door{transform:rotateY(-105deg)}.stage.is-open .controls{margin-top:10px}.stage.is-open .scene{filter:drop-shadow(0 13px 13px #73695a22)}@keyframes softIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}@media(min-width:700px){.stage{padding-top:52px}.scene{width:300px;height:440px;margin-top:27px}}@media(max-height:700px){.stage{padding-top:18px}.eyebrow{margin-bottom:8px}.scene{height:43vh;min-height:260px;margin-top:15px}.controls{min-height:95px}.key-art{height:60px}}@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* v2: This is a separate handoff layout only. Original door, key and animation CSS above stays intact. */
.visually-hidden{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.stage{padding-top:clamp(22px,4vh,43px)}
.intro .eyebrow{margin-bottom:4px}
.intro .instruction{margin-top:0}
.handoff{width:min(100%,420px);height:245px;position:relative;flex:none;margin-top:12px;isolation:isolate}
.mascot{position:absolute;width:180px;height:auto;left:-44px;top:5px;z-index:1;pointer-events:none;filter:drop-shadow(0 8px 6px #5c4c3e19)}
.mascot-message{position:absolute;z-index:3;top:4px;right:3px;width:clamp(190px,63%,270px);background:#fffdfa;border:1px solid #c9bfb1;border-radius:22px;padding:15px 10px;text-align:center;box-shadow:0 6px 15px #5a4c3712}
.mascot-message:before{content:'';position:absolute;left:-10px;top:30px;width:18px;height:18px;background:#fffdfa;border-left:1px solid #c9bfb1;border-bottom:1px solid #c9bfb1;transform:rotate(45deg)}
.mascot-message p{font-size:17px;line-height:1.4;font-weight:650;letter-spacing:.015em;margin:0;position:relative}
.key-gift{position:absolute;right:7%;top:115px;z-index:11;min-width:156px;display:flex;justify-content:center}
.key-gift .key-button{padding:5px 12px 11px;border-radius:12px;background:#fffdfa80;box-shadow:0 0 0 1px #cfc4b420}
.key-gift .key-button:not(:disabled):hover{background:#fffdfacc}
.key-gift .key-art{width:145px;height:80px}
.scene{margin-top:0}
.controls{min-height:58px;justify-content:flex-start}
.controls .note{margin-top:7px}
.stage.is-open .handoff .mascot-message{opacity:.72}
@media(max-width:360px){.mascot{left:-51px;width:164px}.mascot-message{width:65%;right:0}.mascot-message p{font-size:15px}.key-gift{right:2%}}
@media(min-width:700px){.handoff{height:255px}.mascot{left:-20px}.scene{margin-top:0}}
@media(max-height:700px){.handoff{height:215px;margin-top:7px}.mascot{width:165px}.key-gift{top:98px}.scene{margin-top:0}}

/* v3 fixes: key must travel IN FRONT of the door, and mascot enters from left. */
.handoff{z-index:20;}
.scene{z-index:1;}
.mascot{opacity:0;transform:translateX(-235px);transition:transform .85s cubic-bezier(.18,.78,.28,1),opacity .55s ease;}
.handoff.mascot-visible .mascot{opacity:1;transform:translateX(0)}
@media(prefers-reduced-motion:reduce){.mascot{opacity:1;transform:none;transition:none}}


/* v5 independent scene handoff. Existing key/door WAAPI keyframes are unchanged. */
.stage { position: relative; height: 100svh; min-height: 560px; padding: clamp(24px,5vh,45px) 16px 16px; overflow: hidden; }
.intro { transition: opacity .38s ease; }
.handoff { position: absolute; top: 39%; left: 50%; transform: translate(-50%,-50%); width: min(100%,420px); height: 245px; margin: 0; z-index: 20; }
.mascot { transition: transform .85s cubic-bezier(.18,.78,.28,1), opacity .42s ease; }
.mascot-message { transition: opacity .36s ease, transform .36s ease; }
.key-gift { right: 7%; top: 115px; }
.key-gift .key-button { background: none; box-shadow: none; }
.scene { position:absolute; top:54%; left:50%; transform:translate(-50%,-50%); width:min(68vw,290px); height:min(49vh,455px); min-height:280px; margin:0; opacity:0; visibility:hidden; pointer-events:none; transition:opacity .52s ease, visibility 0s linear .52s; z-index:1; }
.stage.scene-transition .scene { opacity:1; visibility:visible; transition:opacity .52s ease; }
.stage.scene-transition .mascot { opacity:0; transform:translateX(-235px); pointer-events:none; }
.stage.scene-transition .mascot-message { opacity:0; transform:translateY(-12px); pointer-events:none; }
.stage.scene-transition .intro { opacity:0; pointer-events:none; }
.controls { position:absolute; inset:auto 0 4px; min-height:0; height:40px; z-index:30; margin:0!important; }
.controls .note { display:none; }
.replay { position:fixed; top:calc(env(safe-area-inset-top, 0px) + 10px); right:14px; z-index:40; background:#fffdfae8; box-shadow:0 2px 9px #0001; }
.completed { position:absolute; bottom:10px; left:0; right:0; padding:0 12px; gap:3px; }
.completed p { margin:0; }
.completed strong { font-size:15px; }
.completed span { font-size:10px; }
.stage.is-open .scene { opacity:1; visibility:visible; }
@media(max-height:700px){.handoff{top:37%;height:220px}.key-gift{top:103px}.scene{top:56%;height:43vh;min-height:260px}.completed{bottom:8px}}
@media(min-width:700px){.scene{width:300px;height:440px}.handoff{top:39%}}
@media(prefers-reduced-motion:reduce){.scene,.mascot-message,.intro{transition:none!important}}
/* Ensure the real gallery preview is visible behind an opened door. */
.doorframe{background:transparent}
.stage.scene-transition .tap-text{opacity:0;transition:opacity .2s}
.stage.scene-transition.is-open .handoff .mascot-message{opacity:0}

/* v6: move the gift beside the pointing hand; staged, unhurried transition. */
.key-gift { left: 43px; right: auto; top: 45px; }
.key-gift .key-art { width: 134px; height: 74px; }
.mascot-message { top: -10px; right: 0; }
.stage .intro { transition: opacity .7s ease; }
.stage .mascot { transition: transform .85s cubic-bezier(.18,.78,.28,1), opacity .68s ease; }
.stage .mascot-message { transition: opacity .68s ease, transform .68s ease; }
.stage .scene { transition: opacity .82s ease, visibility 0s linear .82s; }
.stage.scene-transition .scene { transition: opacity .82s ease; }
.stage.handoff-fading .mascot { opacity:0; transform:translateX(-100px); pointer-events:none; }
.stage.handoff-fading .mascot-message { opacity:0; transform:translateY(-10px); pointer-events:none; }
.stage.handoff-fading .intro { opacity:0; pointer-events:none; }
/* Keep the key as the sole persistent visual across both scenes. */
.stage.handoff-fading .key-gift { opacity:1; }
@media(max-width:360px){.key-gift{left:42px;right:auto;top:45px}.key-gift .key-art{width:125px;height:70px}}
@media(max-height:700px){.key-gift{top:39px}}
.key-gift .tap-text { transform: translateX(38px); white-space: nowrap; }


/* v7: center the mascot + key grouping before tap. Post-transition flow stays unchanged. */
.handoff{width:min(100%,360px);height:245px}
.mascot{width:160px;left:18px;top:10px}
.mascot-message{top:-4px;right:50%;transform:translateX(50%);width:230px}
.key-gift{left:126px;top:56px;right:auto}
.key-gift .key-art{width:126px;height:70px}
.key-gift .tap-text{transform:translateX(0);display:block;text-align:center;margin-top:-2px}
@media(max-width:360px){
  .handoff{width:min(100%,330px)}
  .mascot{width:150px;left:10px;top:12px}
  .mascot-message{width:210px;top:-2px}
  .key-gift{left:114px;top:58px}
  .key-gift .key-art{width:120px;height:68px}
}
@media(max-height:700px){
  .mascot{width:150px;top:6px}
  .key-gift{top:49px}
}


/* v8: avoid overlap between mascot and speech bubble. Only pre-tap layout adjusted. */
.mascot{left:12px;top:34px;width:156px}
.mascot-message{top:-10px;right:calc(50% - 16px);transform:translateX(50%);width:224px;z-index:4}
.key-gift{left:128px;top:82px}
.key-gift .key-art{width:122px;height:68px}
.key-gift .tap-text{margin-top:0}
@media(max-width:360px){
  .mascot{left:6px;top:38px;width:146px}
  .mascot-message{top:-8px;right:calc(50% - 12px);width:208px}
  .key-gift{left:114px;top:84px}
  .key-gift .key-art{width:116px;height:65px}
}
@media(max-height:700px){
  .mascot{top:28px;width:148px}
  .mascot-message{top:-6px}
  .key-gift{top:74px}
}

/* v9: ONLY the speech bubble is moved 10px upward in every viewport. */
.mascot-message{top:-20px}
@media(max-width:360px){.mascot-message{top:-18px}}
@media(max-height:700px){.mascot-message{top:-16px}}

/* v10: only the handoff scene presentation is redesigned as a game-like
   text window. No names or portraits, no comic speech-bubble tail. */
.handoff { width:min(calc(100vw - 32px),360px); height:335px; top:41%; }
.mascot { left:25px; top:0; width:155px; }
.key-gift { left:140px; top:58px; right:auto; }
.key-gift .key-art { width:125px; height:70px; }
.key-gift .tap-text { transform:none; margin-top:-2px; }
.mascot-message {
  box-sizing:border-box; position:absolute; left:15px; right:15px; top:240px;
  width:auto; transform:none; padding:17px 20px; border-radius:9px;
  border:1px solid #cfc6b9; background:#faf7f1;
  box-shadow:0 5px 16px #5a4c3710; text-align:center;
}
.mascot-message::before { content:none; display:none; }
.mascot-message p { margin:0; font-size:17px; line-height:1.5; letter-spacing:.025em; }
.key-gift .key-button,
.key-gift .key-button:not(:disabled):hover { background:transparent; box-shadow:none; }
.key-gift .key-button:not(:disabled):hover .key-art { filter:drop-shadow(0 4px 3px #71542f55) brightness(1.04); }
@media (max-width:360px) {
  .handoff { width:min(calc(100vw - 24px),330px); height:320px; }
  .mascot { left:15px; top:0; width:145px; }
  .key-gift { left:126px; top:56px; }
  .key-gift .key-art { width:116px; height:66px; }
  .mascot-message { top:223px; left:9px; right:9px; }
  .mascot-message p { font-size:16px; }
}
@media (max-height:700px) {
  .handoff { top:40%; }
}

/* Only the key artwork floats before tapping, never TAP THE KEY. */
@keyframes keyGentleFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-4px)}}
.stage:not(.handoff-fading):not(.scene-transition):not(.is-open) .idle-key-inner,
.stage:not(.handoff-fading):not(.scene-transition):not(.is-open) .idle-key-shine{animation:keyGentleFloat 3s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){.idle-key-inner,.idle-key-shine{animation:none!important}}


/* Integrated page fix: preserve the approved portrait door proportions on mobile.
   The iframe's mobile viewport height can otherwise create a square door.
   No key animation, timing, character, or opening behavior is changed. */
@media(max-width:699px){
  .stage .scene{
    width:min(68vw,290px);
    height:auto;
    min-height:0;
    aspect-ratio:300 / 440;
  }
}
