/* Keep the shared JATA handle clear of the game HUD and the iPhone safe areas. */
.arcade{padding-top:max(30px,calc(env(safe-area-inset-top) + 24px))}
.arcade.menu-open{padding-top:var(--menu-clearance,126px)!important}
.game-screen{width:100%}
#jm-handle{position:fixed;top:env(safe-area-inset-top,0px);left:50%;transform:translateX(-50%);z-index:20;width:58px;height:18px;background:rgba(18,26,51,.92);border:1px solid #26315c;border-top:none;border-radius:0 0 11px 11px;color:#8b95c9;font:11px/1 -apple-system,BlinkMacSystemFont,sans-serif;display:flex;align-items:center;justify-content:center;cursor:pointer;touch-action:manipulation}
#jm-bar{position:fixed;top:calc(env(safe-area-inset-top) + 18px);left:50%;transform:translateX(-50%);z-index:21;display:flex;flex-wrap:wrap;justify-content:center;gap:8px;width:max-content;max-width:calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right) - 16px);padding:8px 10px;background:rgba(13,19,38,.98);border:1px solid #26315c;border-radius:0 0 16px 16px;box-shadow:0 8px 24px #0008}
.jm-b{background:#121a33;border:1px solid #26315c;color:#e8ecff;border-radius:10px;padding:9px 12px;font:700 13px -apple-system,BlinkMacSystemFont,sans-serif;cursor:pointer;text-decoration:none;white-space:nowrap;touch-action:manipulation;min-height:42px}
#jm-note{margin:0;flex-basis:100%;text-align:center;max-width:460px;font-size:11px;line-height:1.5;color:#aebbdd}
.result-games{display:block;margin:8px auto 0;width:fit-content}
.arcade:is(:fullscreen,:-webkit-full-screen){width:100%;height:100dvh;max-width:none;margin:0;padding:max(26px,calc(env(safe-area-inset-top) + 22px)) max(16px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));display:flex;flex-direction:column;background:#102728;overflow:auto}
.arcade:is(:fullscreen,:-webkit-full-screen) .topbar{flex:none;margin-bottom:10px}
.arcade:is(:fullscreen,:-webkit-full-screen) .game-frame{display:flex;flex-direction:column;flex:1;min-height:160px}
.arcade:is(:fullscreen,:-webkit-full-screen) .game-screen{height:100%;min-height:0;flex:1;aspect-ratio:auto}
.arcade:is(:fullscreen,:-webkit-full-screen) .game-bottom{flex:none}
.arcade:is(:fullscreen,:-webkit-full-screen) .touch-controls{flex:none}
.arcade:is(:fullscreen,:-webkit-full-screen) .instructions{display:none}
@media(pointer:coarse) and (min-height:551px),(pointer:coarse) and (orientation:portrait){
 .game-screen{min-height:0;max-height:calc(100dvh - 300px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
}
@media(orientation:portrait) and (max-height:600px){
 .title-content{margin-top:0}.title-content h1{font-size:50px;margin-top:10px}
 .title-content .eyebrow,.world-tour,.start-hint{display:none}
 .title-jp{font-size:11px;letter-spacing:2px;margin:10px 0}
 .title-star{font-size:24px;top:44px;right:-24px}
}

/* The media fits between caption bands, leaving every face unobstructed. */
#ending-dialog{position:fixed;inset:0;margin:auto;width:min(1040px,calc(100vw - 16px));height:min(900px,calc(100dvh - 16px));max-width:none;max-height:calc(100dvh - 16px);padding:0;border:1px solid #927c45;border-radius:15px;background:#102c26;color:#fff5d8;overflow:hidden;touch-action:manipulation}
#ending-dialog:not([open]){display:none}
#ending-dialog::backdrop{background:#06130ded}
.ending-shell{height:100%;display:flex;flex-direction:column;min-height:0}
.ending-stage{position:relative;flex:1;min-height:180px;background:radial-gradient(ellipse at center,#244d35,#071e18);overflow:hidden}
.ending-media{position:absolute;inset:86px 8px 76px}
.ending-media img,.ending-media video{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:contain}
.ending-opening,.ending-closing{position:absolute;left:8px;right:8px;text-align:center;z-index:2;pointer-events:none;text-shadow:0 2px 5px #0009}
.ending-opening{top:12px}
.ending-opening h2{font-size:clamp(19px,4vw,38px);line-height:1.1;letter-spacing:.02em;margin:0;color:#ffe08a;font-weight:900}
.ending-opening p{font-size:clamp(12px,2vw,18px);line-height:1.35;margin:8px 0 0}
.ending-closing{bottom:12px;opacity:0;transform:translateY(6px);transition:opacity .7s,transform .7s}
.ending-closing strong{display:block;font-size:clamp(19px,3vw,28px);line-height:1.2;color:#ffe39c}
.ending-closing span{display:block;font-size:clamp(11px,2vw,16px);line-height:1.3;letter-spacing:.13em;margin-top:6px}
[data-chapter="closing"] .ending-closing{opacity:1;transform:none}
.ending-caption{flex:none;text-align:center;padding:8px 20px;background:#15382d;border-top:1px solid #65846466}
.ending-caption p{margin:0;font-size:12px;line-height:1.6}
.ending-caption .ending-total{margin-top:5px;font:700 12px monospace;letter-spacing:1px;color:#a9d9b4}
.ending-total strong{font-size:21px;color:#ffe08a;margin-left:9px;letter-spacing:0;font-variant-numeric:tabular-nums}
.ending-actions{flex:none;padding:8px 14px max(12px,env(safe-area-inset-bottom));border-top:1px solid #76937455;background:#102c26;text-align:center}
#ending-status{margin:0 0 4px;font-size:12px;line-height:1.5;color:#bed7c4;min-height:18px}
.ending-playback{display:flex;align-items:center;justify-content:center;gap:12px}
.ending-playback .text-button{margin:0;min-height:42px;color:#ffe39c;font-weight:700}
.ending-playback .primary-button{min-height:42px;padding:8px 18px;box-shadow:none}
.ending-links{display:flex;flex-wrap:wrap;justify-content:center;gap:7px}
.ending-links .icon-button{justify-content:center;min-height:44px;padding:10px 12px;font-size:13px;color:#eef8e9}
.ending-confetti{position:absolute;inset:0;pointer-events:none;z-index:3;overflow:hidden}
.ending-confetti i{position:absolute;top:-15px;width:7px;height:11px;background:#ffe08a;left:3%;animation:ending-confetti 5s 2 linear}
.ending-confetti i:nth-child(2){left:14%;animation-delay:.8s;background:#8cf0c1}
.ending-confetti i:nth-child(3){left:25%;animation-delay:2.2s}
.ending-confetti i:nth-child(4){left:37%;animation-delay:1.5s;background:#fff9dd}
.ending-confetti i:nth-child(5){left:60%;animation-delay:.4s;background:#8cf0c1}
.ending-confetti i:nth-child(6){left:73%;animation-delay:1.8s}
.ending-confetti i:nth-child(7){left:85%;animation-delay:2.7s;background:#fff9dd}
.ending-confetti i:nth-child(8){left:95%;animation-delay:1.1s}
@keyframes ending-confetti{to{transform:translate(18px,75vh) rotate(400deg);opacity:0}}
@media(max-width:560px){.ending-media{inset:58px 4px 58px}.ending-opening{top:10px}.ending-caption{padding:8px 12px}.ending-caption p{font-size:11px}.ending-links .icon-button{font-size:12px;padding:9px 10px}.ending-actions{padding-inline:8px}.ending-stage{min-height:230px}}
@media(orientation:landscape) and (max-height:550px) and (pointer:coarse){
 .arcade,.arcade:is(:fullscreen,:-webkit-full-screen){width:100%;padding:calc(env(safe-area-inset-top) + 24px) calc(env(safe-area-inset-right) + 132px) calc(env(safe-area-inset-bottom) + 8px) calc(env(safe-area-inset-left) + 132px)}
 .game-screen{height:calc(100dvh - 80px - env(safe-area-inset-top) - env(safe-area-inset-bottom));min-height:0}
 .touch-controls{left:max(7px,env(safe-area-inset-left));right:max(7px,env(safe-area-inset-right))}
 .arcade:is(:fullscreen,:-webkit-full-screen) .game-screen{height:100%}
}
@media(orientation:landscape) and (max-height:550px){
 #ending-dialog{width:min(900px,calc(100vw - 16px))}
 .ending-shell{display:grid;grid-template-columns:minmax(0,1fr) minmax(205px,29%);grid-template-rows:minmax(0,1fr) auto}
 .ending-stage{grid-column:1;grid-row:1/3;min-height:0}
 .ending-media{inset:64px 5px 54px}
 .ending-opening{top:10px}.ending-opening h2{font-size:clamp(17px,3vw,26px)}.ending-opening p{font-size:11px;margin-top:6px}
 .ending-closing{bottom:10px}.ending-closing strong{font-size:20px}.ending-closing span{font-size:10px}
 .ending-caption{grid-column:2;grid-row:1;overflow:auto;padding:10px;align-self:center;border-top:0}
 .ending-caption p{font-size:11px}
 .ending-actions{grid-column:2;grid-row:2;padding:4px 8px max(6px,env(safe-area-inset-bottom))}
 .ending-links{gap:4px}.ending-links .icon-button{width:100%;min-height:36px;padding:7px;font-size:12px}
 .ending-playback .text-button{min-height:34px;padding:6px;margin:0}
 #ending-status{font-size:10px;line-height:1.4}
}
@media(prefers-reduced-motion:reduce){.ending-confetti{display:none}.ending-closing{transition:none}}
/* A short portrait viewport also occurs inside Wix on small phones. */
@media(orientation:portrait) and (max-height:550px){
 .arcade{padding-bottom:8px}.topbar{gap:8px;margin-bottom:8px}
 .brand{gap:6px}.brand-mark{width:28px;height:28px;font-size:14px}
 .brand-name{white-space:nowrap;font-size:14px;letter-spacing:0}.brand-credit{display:none}
 .toolbar{gap:4px}.toolbar .icon-button{min-width:34px;min-height:34px;padding:6px}
 .game-screen{height:calc(100dvh - 190px);max-height:calc(100dvh - 190px);min-height:0;aspect-ratio:auto}
 .game-bottom,.instructions{display:none}
 .touch-controls{padding-top:10px}.direction-controls{grid-template-columns:48px 48px;gap:5px}
 .direction-controls .direction{width:48px;height:48px}.control.crouch{height:32px;font-size:18px}
 .action-controls{grid-template-columns:54px 60px;grid-template-rows:28px 56px;gap:5px}
 .control.punch{width:54px;height:52px;font-size:10px}.control.jump{width:60px;height:56px;font-size:10px}
 .control.dash{height:28px}.control span{font-size:9px}
 .hud{padding:9px}.hud-world{font-size:10px}.hud-caption{font-size:8px}
 .stamina{width:115px}.stamina>span{font-size:8px}.weapon-label{font-size:8px}
 .hearts{right:9px;top:37px;font-size:13px}.hud-timer{right:9px;top:59px;font-size:12px}
 .toast{top:89px;font-size:9px;line-height:1.3;padding:4px 8px}
 .ending-stage{min-height:0}.ending-media{inset:50px 4px 44px}
 .ending-opening h2{font-size:17px}.ending-opening p{font-size:10px;margin-top:5px}
 .ending-closing{bottom:6px}.ending-closing strong{font-size:15px}.ending-closing span{font-size:9px;margin-top:3px}
 .ending-caption{padding:4px 8px}.ending-caption p{font-size:10px}.ending-total strong{font-size:18px}
 .ending-actions{padding:4px 7px 6px}.ending-links{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
 .ending-links .icon-button{padding:6px 2px;font-size:10px;min-height:40px;line-height:1.3}
 .ending-playback .text-button{min-height:30px;padding:5px;font-size:11px}#ending-status{font-size:10px;min-height:14px}
}

/* Weapon choice shares the fullscreen root and pauses the engine. */
#weapon-dialog{box-sizing:border-box;width:min(620px,calc(100% - 24px));max-width:none;max-height:calc(100dvh - 24px);margin:auto;padding:24px;border:1px solid #96b794;border-radius:20px;background:#12352d;color:#fff6df;overflow:auto;touch-action:manipulation;box-shadow:0 24px 80px #03171188}
#weapon-dialog[hidden],#weapon-dialog:not([open]){display:none}
#weapon-dialog::backdrop{background:#041912cc}
.weapon-choice-heading{text-align:center}.weapon-choice-heading h2{font-size:clamp(22px,5vw,30px);margin:10px 0}.weapon-choice-heading p{font-size:13px;line-height:1.65;margin:0 0 18px;color:#cbdcbd}
.weapon-options{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.weapon-option{display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;padding:20px 10px;border:2px solid #87ae86;border-radius:14px;background:#1d4638;color:#fff5d6;cursor:pointer;touch-action:manipulation;font-family:inherit}
.weapon-option:focus-visible,.weapon-option:hover{outline:3px solid #ffda81;outline-offset:2px;background:#2e5940}
.weapon-option strong{font-size:21px}.weapon-option>span:not(.weapon-mark){font-size:12px}.weapon-option b{font-size:14px;color:#ffe296}.weapon-option small{font-size:11px;color:#c9dec3}
.weapon-mobile-break{display:none}
.weapon-mark{display:block;font-size:0;position:relative;height:52px;width:110px}
.weapon-mark::before,.weapon-mark::after{content:'';position:absolute;border:2px solid #244c31;background:repeating-linear-gradient(90deg,#bce095 0 16px,#709459 16px 19px);height:8px;border-radius:3px}
#choose-spear .weapon-mark::before{width:88px;left:4px;top:23px;transform:rotate(-18deg)}
#choose-spear .weapon-mark::after{width:0;height:0;border-radius:0;border-left:15px solid #e8efbc;border-top:6px solid transparent;border-bottom:6px solid transparent;border-right:0;background:none;right:-1px;top:7px;transform:rotate(-18deg)}
#choose-nunchaku .weapon-mark::before{width:38px;left:10px;top:28px;transform:rotate(-42deg)}
#choose-nunchaku .weapon-mark::after{width:38px;left:56px;top:18px;transform:rotate(35deg);box-shadow:-22px -2px 0 -4px #fff1b9}
.weapon-choice-note{font-size:12px;line-height:1.8;color:#cbdcbd;text-align:center;margin:18px 0 0}
@media(max-width:400px){.weapon-mobile-break{display:block}#weapon-dialog{padding:16px 12px}.weapon-options{gap:8px}.weapon-option{padding:16px 5px}.weapon-option strong{font-size:18px}.weapon-option b{font-size:12px}.weapon-option small{font-size:10px}.weapon-mark{width:100px}.weapon-choice-heading p{font-size:12px}}
@media(max-height:480px){#weapon-dialog{padding:12px;max-height:calc(100dvh - 12px)}.weapon-choice-heading h2{margin:4px 0;font-size:22px}.weapon-choice-heading p{margin-bottom:8px}.weapon-option{padding:8px;gap:4px}.weapon-mark{height:40px}.weapon-choice-note{margin-top:8px;line-height:1.5;font-size:11px}}

/* Landscape messages live below the Canvas, never over enemies or controls. */
.landscape-notice{display:none}
@media(orientation:landscape){
 .toast{display:none}
 .game-bottom{display:flex;height:34px;min-height:34px;flex:none;padding:3px 9px;font-size:11px;line-height:1.25;overflow:hidden}
 .game-bottom-label{min-width:0;width:100%;gap:0}
 .game-bottom .spark,.game-bottom .edition{display:none}
 .landscape-notice.visible{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;color:#fff0b8}
 .game-bottom:has(.landscape-notice.visible) #bottom-text{display:none}
 #bottom-text{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
}
@media(orientation:landscape) and (max-height:550px) and (pointer:coarse){
 .game-screen{height:calc(100dvh - 114px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
 .arcade:is(:fullscreen,:-webkit-full-screen) .game-screen{height:100%}
}
