@media(max-width:520px){#game-wrapper{max-height:100dvh;border-radius:0}.overlay-screen{padding:16px 12px}.title-logo{margin-bottom:12px}.title-logo h1{font-size:27px}.pixel-btn{margin:5px 0;padding:11px 16px}.studio-footer{margin-top:12px}.high-score-badge{margin-top:12px}}@media(max-height:650px){.menu-screen{padding-top:10px}.title-logo{margin-bottom:8px}.title-logo h1{font-size:24px}.title-logo p{font-size:8px}.high-score-badge{padding:7px 11px}.studio-footer{padding:9px;margin-top:8px}}#gameCanvas{touch-action:none}

.gameover-footer{margin:8px 0 0}.gameover-footer h2{margin-bottom:4px}.overlay-screen{overflow-y:auto}
@media(max-width:520px){.shop-screen{padding:10px}.shop-shell{gap:7px}.shop-header{padding:8px}.shop-items{max-height:min(36vh,270px)}.shop-preview-panel{padding:5px 9px}.shop-card{grid-template-columns:20px 1fr auto;gap:6px}.shop-action{min-width:75px;font-size:6px}.shop-shell>#btn-shop-back{padding:9px}}
@media(max-width:980px) and (min-width:721px){#arcade-app{padding-inline:10px;grid-template-rows:42px minmax(0,1fr) 30px}.game-layout{grid-template-columns:minmax(0,1fr) 166px;gap:10px}#project-rail{gap:12px}.rail-brand h2{font-size:10px}.rail-links a,.rail-social a{gap:5px;padding:6px;grid-template-columns:26px 1fr 12px}.rail-icon,.rail-social a>span{width:24px;height:24px}.rail-links a>span:nth-child(2){font-size:9px}#game-wrapper{width:min(100%,calc((100dvh - 92px)*1.7777778))}}
@media(max-width:720px) and (orientation:portrait){html,body{height:auto;min-height:100%}body{overflow-x:hidden;overflow-y:auto}#arcade-app{height:auto;min-height:100dvh;grid-template-rows:42px auto 30px;gap:0;padding:0 8px}.site-header{width:100%;height:42px}.brand-mark{font-size:10px}.brand-mark small{font-size:7px}.fullscreen-btn{padding:7px 8px;font-size:7px}.game-layout{width:100%;grid-template-columns:minmax(0,1fr);gap:12px;padding:12px 0 8px}#game-wrapper{width:min(100%,calc((100dvh - 104px)*.6666667));aspect-ratio:2/3;border-radius:7px}#project-rail{width:min(100%,420px);margin:0 auto 12px;gap:12px}.rail-brand h2{font-size:11px}.rail-links{display:grid;grid-template-columns:1fr 1fr;gap:7px}.rail-links a{min-height:44px;grid-template-columns:25px 1fr 12px}.rail-links a:last-child{grid-column:1/-1}.rail-links a>span:nth-child(2){font-size:9px}.rail-links small{font-size:8px}.rail-social{display:grid;grid-template-columns:1fr 1fr;gap:7px}.rail-social a{min-height:40px;grid-template-columns:24px 1fr auto;font-size:9px}.rail-social a>span{width:22px;height:22px}.page-footer{min-height:30px;width:100%;font-size:8px}.page-footer span:last-child{display:none}.overlay-screen{padding:12px 10px}.title-logo h1{font-size:27px}.menu-screen .pixel-btn{font-size:8px;padding:10px;margin:4px 0}.high-score-badge{font-size:7px}.shop-shell{width:100%}.shop-items{max-height:34dvh}}
@media(max-width:720px) and (orientation:landscape){#arcade-app{padding-inline:6px;grid-template-rows:34px minmax(0,1fr) 24px}.site-header{height:34px}.brand-icon{width:24px;height:24px}.brand-mark small{display:none}.game-layout{grid-template-columns:minmax(0,1fr);gap:0}#project-rail{display:none}#game-wrapper{width:min(100%,calc((100dvh - 66px)*1.7777778));border-radius:4px}.page-footer{min-height:24px;font-size:7px}.overlay-screen{padding:8px}.menu-screen .title-logo{margin-bottom:4px}.menu-screen .title-logo h1{font-size:20px}.menu-screen .title-logo p{margin-top:4px;font-size:7px}.menu-screen .studio-kicker{font-size:6px;margin-bottom:4px}.menu-screen .pixel-btn{width:220px;padding:7px;margin:2px 0;font-size:7px}.high-score-badge{margin-top:4px;padding:5px 8px}.shop-shell{max-width:440px;gap:5px}.shop-preview-panel{padding:3px 8px}.shop-preview-panel canvas{height:54px}.shop-items{max-height:35dvh}}
@media(prefers-reduced-motion:reduce){.rail-links a,.rail-social a{transition:none}}
@media(max-width:480px){.reset-dialog-card{padding:16px}.reset-dialog-card h2{font-size:15px}.reset-dialog-card p{font-size:13px}.reset-dialog-actions{flex-direction:column-reverse}.reset-dialog-actions .pixel-btn,.reset-dialog-actions #btn-reset-confirm{width:100%;max-width:none}}

/* Keep the selected canvas geometry undistorted if a device rotates mid-run. */
html.portrait-playfield #game-wrapper{aspect-ratio:2/3;width:min(100%,calc((100dvh - 104px)*.6666667))}
html:not(.portrait-playfield) #game-wrapper{aspect-ratio:16/9;width:min(96%,calc((100dvh - 106px)*1.7777778))}
@media(min-width:1300px){#game-wrapper{max-width:1240px}}
@media(max-width:720px) and (orientation:landscape){html.portrait-playfield #game-wrapper{width:min(100%,calc((100dvh - 66px)*.6666667))}}
@media(max-width:720px) and (orientation:portrait){html:not(.portrait-playfield) #game-wrapper{width:min(100%,calc((100dvh - 104px)*1.7777778))}}
