/* Native fullscreen + mobile landscape; no CSS rotation or stretched game canvas. */
:root { --screen-top: env(safe-area-inset-top,0px); --screen-right: env(safe-area-inset-right,0px); --screen-bottom: env(safe-area-inset-bottom,0px); --screen-left: env(safe-area-inset-left,0px); }
html,body { overscroll-behavior:none; }
html { height:100%; height:100dvh; }
html:fullscreen,html:-webkit-full-screen { width:100%;height:100%;background:#120c2a; }
.screen-safe-area { position:fixed;visibility:hidden;pointer-events:none;width:0;height:0;padding:var(--screen-top) var(--screen-right) var(--screen-bottom) var(--screen-left); }
#screen-tools { position:fixed;z-index:600;top:max(8px,var(--screen-top));left:max(10px,var(--screen-left));pointer-events:auto; }
#screen-fullscreen { min-height:40px;max-width:calc(100vw - 120px);padding:7px 12px;color:#fff4c9;background:#20143de8;border:1px solid #c7a5ff99;border-radius:12px;font:700 12px/1.4 var(--font);box-shadow:0 3px 14px #0005;cursor:pointer;touch-action:manipulation; }
#screen-fullscreen:focus-visible,#screen-rotate button:focus-visible { outline:3px solid #ffcf4a;outline-offset:3px; }
#screen-fullscreen[aria-pressed=true] { border-color:#ffcf4a;color:#ffe88e; }
#screen-fullscreen:disabled { opacity:.7;cursor:wait; }
#screen-rotate { position:fixed;z-index:590;left:max(12px,var(--screen-left));right:max(12px,var(--screen-right));bottom:max(12px,var(--screen-bottom));display:flex;gap:12px;align-items:center;justify-content:space-between;padding:13px 14px;border:1px solid #b996eb;border-radius:14px;background:#211638f5;color:#fff2ce;font:13px/1.55 var(--font);box-shadow:0 6px 25px #0007; }
#screen-rotate span { min-width:0; }
#screen-rotate button { flex:none;min-height:38px;padding:6px 10px;border:1px solid #c7a5ff;border-radius:9px;background:#42305f;color:white;font:700 12px var(--font); }
#screen-status { position:fixed;z-index:610;left:50%;transform:translateX(-50%);top:max(58px,calc(var(--screen-top) + 50px));width:max-content;max-width:min(580px,calc(100vw - 28px));padding:12px 16px;border:1px solid #ddbd79;border-radius:12px;background:#211638f5;color:#fff0b9;text-align:center;font:12px/1.5 var(--font);pointer-events:none; }
#screen-rotate[hidden],#screen-status[hidden] { display:none!important; }
/* Intro/results/modal buttons must never be covered by the gameplay A/B pad. */
html[data-screen-dialog=true] #touchpad { display:none!important; }
@media (pointer:coarse) {
  .tp-stick { left:max(14px,var(--screen-left));bottom:max(14px,var(--screen-bottom));width:clamp(84px,24vh,112px);height:clamp(84px,24vh,112px); }
  .tp-knob { width:32px;height:32px;left:calc(50% - 16px);top:calc(50% - 16px); }
  .tp-btns { right:max(14px,var(--screen-right));bottom:max(18px,var(--screen-bottom));gap:12px; }
  .tp-btns button { width:58px;height:58px;font-size:19px; }
  .tp-btns .tp-b { margin-top:18px; }
  .setup,.cs,.free { padding-top:max(54px,calc(var(--screen-top) + 48px));padding-left:max(16px,var(--screen-left));padding-right:max(16px,var(--screen-right));padding-bottom:max(12px,var(--screen-bottom)); }
  .modal,.mg-card { max-height:calc(100dvh - var(--screen-top) - var(--screen-bottom) - 16px); }
  .hud-top { padding-left:var(--screen-left);padding-right:var(--screen-right); }
}
@media (pointer:coarse) and (orientation:landscape) and (max-height:600px) {
  .title-screen { display:grid;grid-template-columns:minmax(200px,1fr) minmax(220px,.8fr);gap:12px 22px;align-items:center;align-content:center;justify-content:stretch;padding:50px max(18px,var(--screen-right)) max(10px,var(--screen-bottom)) max(18px,var(--screen-left));overflow:auto; }
  .title-screen .logo { position:static;top:auto;left:auto;right:auto;margin:0;text-align:left; }
  .title-screen .logo h1,html[lang=ja] .title-screen .logo h1,html[lang=zh-Hant] .title-screen .logo h1 { font-size:clamp(26px,4.8vw,42px);line-height:1.2; }
  .title-screen .logo .jp { font-size:15px;letter-spacing:2px;margin-top:10px; }
  .title-screen .logo .tag { font-size:11px;line-height:1.5; }
  .title-screen .menu-col { width:min(300px,100%);gap:5px;justify-self:end; }
  .title-screen .menu-col .btn { min-height:36px;padding:4px 12px;font-size:14px; }
  .title-screen .title-foot { position:static;grid-column:1/-1;margin:0;font-size:10px;line-height:1.3;text-align:right; }
  .mg-body { grid-template-columns:1.2fr 1fr;gap:12px; }
  .mg-card { width:min(900px,96vw);padding:12px; }
  .mg-head h2 { font-size:23px; }.mg-desc,.mg-controls { font-size:12px; }.mg-p .por { width:44px;height:44px; }
  #online-badge,.mg-on #online-badge { top:max(50px,calc(var(--screen-top) + 44px));left:max(10px,var(--screen-left));transform:none;max-width:calc(100vw - 125px); }
  .online-playing .hud-top { top:88px; }
  .online-screen { padding-top:max(92px,calc(var(--screen-top) + 84px)); }
  .online-panel { margin:0 auto; }
  body.mg-on #screen-fullscreen { min-height:32px;padding:5px 9px;font-size:11px; }
}
@media (pointer:coarse) and (orientation:landscape) and (max-width:650px) {
  .title-screen { grid-template-columns:minmax(160px,1fr) minmax(180px,1fr);gap:8px 12px;padding-top:48px; }
  .title-screen .logo h1,html[lang=ja] .title-screen .logo h1,html[lang=zh-Hant] .title-screen .logo h1 { font-size:26px; }
}
@media (pointer:coarse) and (orientation:landscape) and (max-height:360px) {
  .title-screen { padding-top:46px;gap:8px 12px; }
  .title-screen .menu-col .btn { min-height:32px;font-size:12px;line-height:1.2;padding:3px 10px; }
  .title-screen .title-foot { font-size:9px;line-height:1.2; }
}
