/* Fit the complete artboard inside the visible viewport, including browser chrome. */
:root{--game-viewport-height:100vh;--game-viewport-width:100vw;--game-debug-space:0px}
@supports(height:100dvh){:root{--game-viewport-height:100dvh}}
html{height:100%;overflow:hidden!important}
body,body:has(#local-debug:not([hidden])){display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:flex-start!important;width:100%;height:var(--game-viewport-height)!important;min-height:0!important;margin:0!important;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) calc(env(safe-area-inset-bottom,0px) + var(--game-debug-space)) env(safe-area-inset-left,0px)!important;overflow:hidden!important;box-sizing:border-box}
body:has(#local-debug:not([hidden])){--game-debug-space:44px}
body .cabinet,body:has(#local-debug:not([hidden])) .cabinet{width:min(calc(var(--game-viewport-width) - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px)),calc((var(--game-viewport-height) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - var(--game-debug-space)) * .4731064764))!important;height:auto!important;min-height:0!important;max-height:none!important;aspect-ratio:862/1822!important;margin:0!important;flex:none!important}
.desktop-note{display:none!important}

/* Story and gameplay share the same fixed outer cabinet; only inner content scrolls. */
.cabinet>.story,.cabinet>.after-story{box-sizing:border-box;overscroll-behavior:contain}

/* Android already handles system bars natively; never subtract those insets twice. */
html[data-native-screen] body{padding:0 0 var(--game-debug-space) 0!important}
html[data-native-screen] body .cabinet{width:min(var(--game-viewport-width),calc((var(--game-viewport-height) - var(--game-debug-space)) * .4731064764))!important}
/* A taller phone extends the shell hinge; painted controls keep their original scale. */
body .cabinet.shell-extended,body:has(#local-debug:not([hidden])) .cabinet.shell-extended{height:var(--shell-height)!important;aspect-ratio:auto!important;background:none!important}
.cabinet.shell-extended:before,.cabinet.shell-extended:after{content:'';position:absolute;left:0;width:100%;z-index:-1;pointer-events:none;background-image:url('yaka-hardware-clean.png');background-repeat:no-repeat;background-size:100% var(--art-height)}
.cabinet.shell-extended:before{top:0;height:calc(var(--art-height) * .788);background-position:center top}
.cabinet.shell-extended:after{bottom:0;height:calc(var(--art-height) * .212);background-position:center bottom}
.shell-join{display:none}
.shell-extended>.shell-join{display:block;position:absolute;z-index:-2;left:0;right:0;top:calc(var(--art-height) * .788 - 2px);bottom:calc(var(--art-height) * .212 - 2px);background:linear-gradient(90deg,#9e7cbe 0%,#d6b8f0 1%,#5d4a78 3%,#29263c 5%,#29263c 95%,#5d4a78 97%,#d6b8f0 99%,#9e7cbe 100%);box-shadow:inset 0 1px #b391d455,inset 0 -1px #110c20}
.shell-extended>header{top:calc(var(--art-height) * .022);height:calc(var(--art-height) * .0515)}
.cabinet.shell-extended>.screen{height:var(--art-height)!important;bottom:auto!important}
.cabinet.shell-extended>.stage{top:calc(var(--art-height) * .559);height:calc(var(--art-height) * .182)!important}
.cabinet.shell-extended>.controls{inset:auto 0 0!important;height:calc(var(--art-height) * .212)!important}
.shell-extended>#show-heart{top:calc(var(--art-height) * .748);height:calc(var(--art-height) * .035)}
.shell-extended>#heart-particles{top:calc(var(--art-height) * .727);height:calc(var(--art-height) * .08)}
.shell-extended>#stage-curtain{top:calc(var(--art-height) * .5565);height:calc(var(--art-height) * .187)}
.shell-extended>.shell-join{left:.4%;right:.4%;border-left:1.4cqw solid #b79bd4;border-right:1.4cqw solid #b79bd4;background:linear-gradient(180deg,#242135,#353046 50%,#242135);box-shadow:inset 2px 0 #ead4ff88,inset -2px 0 #ead4ff88}
.shell-join:before{content:'';position:absolute;left:6%;right:6%;top:50%;height:1px;background:linear-gradient(90deg,transparent,#a88ac066 25%,#d3b4ed77 50%,#a88ac066 75%,transparent);box-shadow:0 2px #171326}
.shell-join:after{content:'✧';position:absolute;left:46%;width:8%;top:50%;transform:translateY(-50%);text-align:center;color:#c9abe7;background:#302a40;font-size:3cqw;line-height:1.5}

/* Width-first portrait keeps the complete artwork, including its stage. */
html:has(.cabinet.shell-width){overflow-y:auto!important}
body:has(.cabinet.shell-width),body:has(.cabinet.shell-width):has(#local-debug:not([hidden])){height:auto!important;min-height:var(--game-viewport-height)!important;overflow:visible!important}
body .cabinet.shell-width,body:has(#local-debug:not([hidden])) .cabinet.shell-width{width:var(--shell-width)!important;height:var(--art-height)!important;aspect-ratio:862/1822!important;overflow:clip}
#viewport-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:1.5cqw;margin-top:2cqw}
#viewport-actions button{font:inherit;font-size:2.6cqw;color:#f5eaff;background:linear-gradient(#705383,#453052);border:1px solid #b89ad2;border-radius:2cqw;padding:1.5cqw 3cqw;min-height:32px;cursor:pointer}
#viewport-actions button[hidden]{display:none}
#viewport-actions:empty{display:none}
