/* v4 only: approved v1-v3 gifts keep their original presentation. */
.scene.game-v4 { min-height:390px; isolation:isolate; }
.game-v4 .scene-title { top:13%; font-size:clamp(1.02rem,2vw,1.45rem); }
.game-v4 .character { transition:bottom 55ms linear; }
.game-v4 .scene-target { appearance:none; padding:0; font:inherit; color:inherit; touch-action:manipulation; opacity:1; }
.game-v4 .scene-target.item,.game-v4 .scene-target.character { border:0; background:transparent; }
.game-v4 .scene-target.pedestal { z-index:5; }
.game-v4 .scene-target::before { content:""; position:absolute; left:50%; top:50%; width:100%; height:100%; min-width:44px; min-height:44px; transform:translate(-50%,-50%); border-radius:7px; }
.game-v4 .scene-target:not(:disabled)::before { box-shadow:0 0 0 2px #fff3ccaa; }
.game-v4 .scene-target:not(:disabled) { cursor:pointer; }
.game-v4 .scene-target:disabled { cursor:default; }
.game-v4 .scene-target:focus-visible { outline:none; }
.game-v4 .scene-target:focus-visible::before { outline:3px solid #0062cc; outline-offset:4px; }
.game-v4 .scene-target-action { position:absolute; left:50%; bottom:calc(100% + 5px); transform:translateX(-50%); padding:4px 6px; border:1px solid #d4bfa0; border-radius:5px; background:#fffaf0; color:#514229; font-size:.61rem; line-height:1.2; white-space:nowrap; pointer-events:none; }
.game-v4 .scene-target.item .scene-target-action,.game-v4 .scene-target.pedestal .scene-target-action { bottom:auto; top:3px; left:auto; right:calc(100% + 10px); transform:none; }
.game-v4 .scene-target.character .scene-target-action { bottom:auto; top:calc(100% + 8px); }
.game-v4 .scene-target:disabled .scene-target-action { display:none; }
.game-v4 .item.carried { width:25px; height:25px; z-index:6; pointer-events:none; }
.game-v4 .item.carried .item-label,.game-v4 .item.flying .item-label { display:none; }
.game-v4 .item.flying { width:29px; height:29px; z-index:7; pointer-events:none; }
.game-v4 .item[hidden],.game-v4 .scene-message[hidden],.game-v4 .scene-letter-trigger[hidden],.game-v4 .boss[hidden] { display:none; }
.game-v4 .boss.asleep { opacity:0; transform:translateX(-50%) scale(.9); transition:opacity 360ms ease-out,transform 360ms ease-out; }
.game-v4.scene-transitioning { animation:gg-v4-depart 320ms ease-in both; }
.game-v4.scene-arriving { animation:gg-v4-arrive 320ms ease-out both; }
.game-v4 .scene-letter-trigger { position:absolute; left:80%; bottom:23%; transform:translateX(-50%); width:76px; min-height:57px; padding:0; border:2px solid #b28b5c; border-radius:5px; color:#714b29; background:linear-gradient(145deg,transparent 49%,#d9bb91 50%,transparent 52%),linear-gradient(215deg,#fff3d8 49%,#d9bb91 50%,#eddbb9 52%); box-shadow:0 5px 12px #47332322; z-index:5; }
.game-v4 .scene-letter-trigger:disabled { opacity:.85; cursor:default; }
.game-v4 .scene-letter-trigger:not(:disabled) { cursor:pointer; }
.game-v4 .scene-letter-trigger:not(:disabled):hover { box-shadow:0 0 0 4px #fff4ca88,0 5px 12px #47332322; }
.game-v4 .letter-seal { display:block; width:23px; height:23px; border-radius:50%; margin:16px auto 12px; background:#9c574b; color:#fff5e8; font-size:18px; line-height:23px; }
.game-v4 .letter-action { position:absolute; top:calc(100% + 7px); left:50%; transform:translateX(-50%); white-space:nowrap; background:#fffaf0; padding:4px 6px; font-size:.61rem; border-radius:5px; border:1px solid #d4bfa0; }
.game-v4 .scene-message { position:absolute; top:25%; left:7%; right:7%; max-height:28%; padding:10px 13px; box-sizing:border-box; z-index:8; border:1px solid #d6c4a5; border-radius:12px; background:#fffdf4; color:#302c26; box-shadow:0 5px 16px #24362b18; display:flex; flex-direction:column; }
.game-v4 .scene-message-speaker { flex:none; font-size:.61rem; font-weight:700; color:#675238; margin-bottom:5px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.game-v4 .scene-message-text { overflow:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:#a39886 transparent; min-height:0; font-size:.87rem; line-height:1.45; white-space:pre-wrap; overflow-wrap:anywhere; touch-action:pan-y; }
.game-v4 .scene-message-text:focus { outline:2px solid #0062cc; outline-offset:3px; border-radius:2px; }
.game-v4 .scene-letter { background:repeating-linear-gradient(#fff9e8 0,#fff9e8 23px,#eee0bc 24px); border:1px solid #b8a277; border-radius:3px 3px 10px 3px; transform:rotate(-1deg); padding:12px 16px; }
.game-v4 .scene-letter::before { content:""; position:absolute; bottom:-11px; right:19%; width:18px; height:18px; background:#fff9e8; border-right:1px solid #b8a277; border-bottom:1px solid #b8a277; transform:rotate(45deg); }
.game-v4 .scene-speech::after { content:""; position:absolute; top:calc(100% - 7px); left:clamp(16px,calc(var(--speech-anchor, 70%) - 7%),92%); width:13px; height:13px; background:#fffdf4; border-right:1px solid #d6c4a5; border-bottom:1px solid #d6c4a5; transform:rotate(45deg); }
.game-v4-stage .scene-dialogue-actions { padding:16px 20px; }
.game-v4-stage .scene-dialogue-actions .end-message { margin:0 0 12px; }
.game-v4-stage .soundtrack-panel { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; margin:-3px 0 18px; }
.game-v4-stage .soundtrack-label { display:flex; align-items:center; flex:1; gap:8px; font-size:.68rem; color:#475467; min-width:180px; }
.game-v4-stage .soundtrack-select { flex:1; min-width:0; width:auto; max-width:250px; min-height:44px; padding:8px 25px 8px 9px; font-size:.71rem; border:1px solid #b8c4d8; border-radius:8px; }
.game-v4-stage .soundtrack-mute { min-height:44px; padding:8px 12px; font-size:.72rem; border:1px solid #b8cbe5; border-radius:8px; color:#0062cc; background:white; }
.game-v4-stage .soundtrack-status { flex-basis:100%; color:#596579; font-size:.64rem; line-height:1.4; }
.game-v4-stage .jump-keyboard-hint { display:none; font-size:.55rem; font-weight:500; margin-top:2px; }
@media(pointer:fine) { .game-v4-stage .jump-keyboard-hint { display:block; } }
@media(max-width:640px) {
 .scene.game-v4 { min-height:340px; aspect-ratio:1.05; }
 .game-v4 .scene-title { top:14%; font-size:1.05rem; right:8%; }
 .game-v4 .scene-message { left:6%; right:6%; padding:9px 11px; max-height:29%; }
 .game-v4 .scene-message-text { font-size:.82rem; }
 .game-v4 .scene-letter-trigger { width:61px; min-height:49px; }
 .game-v4 .letter-seal { margin:12px auto 10px; }
 .game-v4 .item.carried { width:23px; height:23px; }
 .game-v4-stage .soundtrack-label { flex-basis:100%; }
 .game-v4-stage .soundtrack-select { max-width:none; }
 .game-v4-stage .soundtrack-status { flex:1; }
}
@media(max-width:350px) {
 .game-v4 .scene-message { top:26%; }
 .game-v4 .scene-title { font-size:.96rem; }
 .game-v4 .item.carried { width:21px; height:21px; }
}
@keyframes gg-v4-depart { from {opacity:1} to {opacity:0} }
@keyframes gg-v4-arrive { from {opacity:0} to {opacity:1} }
@media(prefers-reduced-motion:reduce) { .scene.game-v4,.game-v4 * { animation:none!important; transition:none!important; } }
.game-v4 .scene-continue{position:absolute;right:12px;bottom:12px;z-index:7;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:48px;min-height:48px;padding:8px 12px;background:#0062cc;color:#fff;border:2px solid #fff;border-radius:12px;font:700 1rem/1.25 system-ui,sans-serif;cursor:pointer;animation:gg-v4-continue-halo 1s ease-in-out 2}
.game-v4 .scene-continue[hidden]{display:none}
.game-v4 .scene-continue:focus-visible{outline:3px solid #111827;outline-offset:2px;box-shadow:0 0 0 2px #fff;animation:none}
@keyframes gg-v4-continue-halo{0%,100%{box-shadow:0 0 0 0 rgba(0,98,204,.08)}50%{box-shadow:0 0 0 6px rgba(0,98,204,.28)}}
@media(prefers-reduced-motion:reduce){.game-v4 .scene-continue{animation:none}}
/* Reserve the lower path for the exit without covering names below the hero. */
@media(max-width:640px){.scene.game-v4{min-height:440px}}
