/* Follow the visible viewport, including Safari's shifting browser bars. */
html[data-view=play]{overflow:hidden}
html[data-view=play] #play-screen{box-sizing:border-box;inset:auto;top:var(--app-top,0px);left:var(--app-left,0px);width:var(--app-width,100%);height:var(--app-height,100dvh);max-height:var(--app-height,100dvh);min-height:0}
html[data-view=play] .play-layout{flex:1 1 0%;height:auto;min-height:0}
html[data-view=play] .game-shell{flex:1 1 0%;height:auto;min-height:0}
html[data-view=play] .stage{flex:1 1 0%;height:auto;min-height:0;aspect-ratio:auto}
html[data-view=play] .controls{flex-wrap:wrap;height:auto;min-height:calc(60px + env(safe-area-inset-bottom));padding-top:7px;padding-bottom:calc(7px + env(safe-area-inset-bottom))}
html[data-view=play] .power-button{border:1px solid #d5b8ee;border-radius:14px;background:#f0ddff;color:#754098;min-width:44px;min-height:44px;padding:7px 11px;font-size:12px;font-weight:800}
html[data-view=play] .play-settings button{flex-shrink:0;min-width:44px;min-height:44px}
html[data-view=play] #fullscreen[aria-pressed=true]{background:#e8d1fb;border-color:#b989d6;color:#663580}
html[data-view=play] #fullscreen-icon{font-size:21px;line-height:1}
/* The fallback really expands the board: compact the chrome without covering controls. */
html[data-view=play][data-play-display=window] .play-heading,html[data-view=play][data-play-display=native] .play-heading{height:44px;min-height:44px}
html[data-view=play][data-play-display=window] .hud,html[data-view=play][data-play-display=native] .hud{height:36px;min-height:36px;padding-top:3px;padding-bottom:3px;border-radius:0;gap:8px}
html[data-view=play][data-play-display=window] .hud-stat>span,html[data-view=play][data-play-display=native] .hud-stat>span{display:none}
html[data-view=play][data-play-display=window] .hud-stat b,html[data-view=play][data-play-display=native] .hud-stat b{font-size:15px}
html[data-view=play][data-play-display=window] .journey>span,html[data-view=play][data-play-display=native] .journey>span{font-size:8px;margin-bottom:3px}
html[data-view=play][data-play-display=window] .progress-track,html[data-view=play][data-play-display=native] .progress-track{height:4px}
html[data-view=play] .play-heading{padding-left:max(8px,env(safe-area-inset-left));padding-right:max(8px,env(safe-area-inset-right))}
.fullscreen-help{box-sizing:border-box;width:min(460px,calc(100% - 28px));max-height:calc(100dvh - 32px);overflow:auto;padding:28px;border:1px solid #e0c9ee;border-radius:24px;background:#fff9f4;color:#674274;box-shadow:0 24px 80px #4f286e44}
.fullscreen-help::backdrop{background:#43285c73;backdrop-filter:blur(4px)}
.fullscreen-help h2{font-size:24px;margin:12px 0}.fullscreen-help h3{font-size:15px;margin:22px 0 8px}.fullscreen-help p,.fullscreen-help li{font-size:13px;line-height:1.8}.fullscreen-help ol{padding-inline-start:23px;margin:8px 0}.fullscreen-help .helper{font-size:11px;color:#8c7894;margin-top:22px}.fullscreen-help button{margin-top:20px;min-height:44px;width:100%}
@media(max-width:600px){html[data-view=play] #power-label,html[data-view=play] #sound-label{display:none}html[data-view=play] .power-button{padding:7px;width:44px;flex:0 0 44px;font-size:20px}html[data-view=play] .play-settings{gap:3px}html[data-view=play] .play-heading .back-link{font-size:10px;min-height:44px}html[data-view=play] .controls{gap:5px}html[data-view=play] .controls .icon-button{flex:0 0 44px}html[data-view=play] .direction-controls{flex:0 0 auto}html[data-view=play] .play-settings .language-button{min-width:50px;padding-inline:6px}}
@media(max-height:500px) and (min-width:600px){html[data-view=play] #play-breadcrumb,html[data-view=play] #power-label{display:none}html[data-view=play] .controls{min-height:calc(50px + env(safe-area-inset-bottom));padding-top:3px;padding-bottom:calc(3px + env(safe-area-inset-bottom))}.fullscreen-help{padding:20px}}
@media(max-width:600px){html[data-view=play] .play-heading .back-link{flex:1 1 auto;min-width:0;white-space:normal;text-align:start}html[data-view=play] .play-settings{flex-shrink:0}}
/* V24: one stable mobile viewport, compact touch controls, and useful landscape expansion. */
html[data-view=play] body{position:fixed;inset:0;max-width:100%;overflow:hidden}
html[data-view=play] .play-heading .back-link{flex:0 1 auto;min-width:0}
html[data-view=play] .play-settings{min-width:0}
html[data-view=play] #fullscreen-help-open{font-size:11px;gap:4px}
html[data-view=play] .controls{touch-action:none}
.fullscreen-notice{position:absolute;z-index:12;inset-inline:12px;top:calc(84px + env(safe-area-inset-top));max-width:500px;margin:auto;padding:12px 38px 12px 14px;border-radius:16px;border:1px solid #dac5e9;background:#fffaf2f5;box-shadow:0 8px 28px #4d2b6233;color:#684572;font-size:11px;line-height:1.6;display:flex;align-items:center;gap:12px}
.fullscreen-notice span{flex:1}.fullscreen-notice button{border:0;border-radius:10px;background:#eee1f8;color:#70418c;min-height:36px;min-width:40px;padding:5px 9px;font:inherit;font-weight:bold;cursor:pointer}
.fullscreen-notice .notice-close{position:absolute;inset-inline-end:1px;top:2px;background:transparent;font-size:20px;min-width:33px}
html[dir=rtl] .fullscreen-notice{padding:12px 14px 12px 38px}
html[data-view=play][data-play-display=window] .play-heading,html[data-view=play][data-play-display=native] .play-heading{background:#fff9f1ce;border:0}
html[data-view=play][data-play-display=window] .hud,html[data-view=play][data-play-display=native] .hud{height:32px;min-height:32px;background:#fff9f1b8;border:0}
@media(max-width:600px){
 html[data-view=play] #restart{display:none}
 html[data-view=play] .controls{flex-wrap:nowrap;gap:4px;min-height:calc(56px + env(safe-area-inset-bottom));padding:5px max(8px,env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
 html[data-view=play] .direction-controls{gap:3px}
 html[data-view=play] .power-button{min-width:44px;width:44px;padding-inline:4px}
 html[data-view=play] .spin-button{min-width:44px;padding-inline:4px;font-size:10px}
 html[data-view=play] .jump-button{min-width:44px;max-width:220px;padding-inline:5px;font-size:11px}
 html[data-view=play] .play-settings .language-button{min-width:44px;font-size:11px}
 html[data-view=play] .hud-stat{min-width:58px}
 html[data-view=play] .hud-stat b{font-size:14px}
 html[data-view=play] #fullscreen-help-open span{display:none}
}
/* Let the portrait board use the entire height on short, wide phones. Chrome lives at the sides. */
@media(max-height:540px) and (min-width:560px){
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #play-screen{display:block}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .play-layout,
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .game-shell,
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .stage{position:absolute;inset:0;width:100%;height:100%;max-height:none;display:block}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .play-heading{position:absolute;inset-inline-start:max(8px,env(safe-area-inset-left));top:max(8px,env(safe-area-inset-top));z-index:8;width:128px;height:auto;min-height:0;padding:0;display:flex;flex-wrap:wrap;gap:5px;background:transparent}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .play-heading .back-link{background:#fff9f0ec;border-radius:13px;padding:9px;max-width:none;font-size:11px;min-height:42px;width:100%}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .play-settings{margin:0;display:flex;flex-wrap:wrap;gap:4px;justify-content:start}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .play-settings button{background:#fff9f0ec;min-width:42px;padding:6px!important}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #fullscreen-label,
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #sound-label,
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #fullscreen-help-open span{display:none}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .hud{position:absolute;inset-inline-end:max(8px,env(safe-area-inset-right));top:max(8px,env(safe-area-inset-top));z-index:5;width:128px;height:auto;min-height:0;padding:10px;display:flex;flex-wrap:wrap;gap:6px;border-radius:16px;background:#fff9f0e8}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .hud-stat{min-width:0;flex:1}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .hud-stat b{white-space:nowrap}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .hud .journey{flex:1 0 100%;width:100%;order:3}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .controls{position:absolute;inset:0;z-index:6;width:auto;max-width:none;height:auto;min-height:0;background:transparent;pointer-events:none;display:block;margin:0;padding:0}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .game-shell:has(.direction-controls:not([hidden])) .controls{max-width:none}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .controls>button,
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .direction-controls{position:absolute;pointer-events:auto;bottom:max(12px,env(safe-area-inset-bottom));margin:0}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .direction-controls{left:max(8px,env(safe-area-inset-left));width:140px;display:flex;flex-wrap:wrap;justify-content:center}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .direction-controls:has(#move-up:not([hidden])){display:grid;grid-template-columns:repeat(3,44px);gap:4px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #move-up{grid-column:2;grid-row:1}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #move-left{grid-column:1;grid-row:2}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #move-down{grid-column:2;grid-row:2}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #move-right{grid-column:3;grid-row:2}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .direction-controls[hidden]{display:none}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #pause{left:max(8px,env(safe-area-inset-left));bottom:122px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #restart{display:none}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #jump{right:max(8px,env(safe-area-inset-right));width:128px;max-width:128px;min-width:44px;white-space:normal}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #spin{right:max(8px,env(safe-area-inset-right));bottom:calc(max(12px,env(safe-area-inset-bottom)) + 54px);width:61px;min-width:44px;font-size:11px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) #superpower{right:calc(max(8px,env(safe-area-inset-right)) + 67px);bottom:calc(max(12px,env(safe-area-inset-bottom)) + 54px);width:61px;min-width:44px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .overlay{inset:0 146px;z-index:7;padding:6px;backdrop-filter:blur(5px)}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .overlay-card{padding:13px!important;min-height:0!important;max-width:620px;border-radius:18px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .overlay .result-mascot{display:none!important}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .overlay-card h2{font-size:22px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .guide-grid{grid-template-columns:1fr}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .guide-grid>div{padding:7px 9px;display:grid;grid-template-columns:90px 1fr;gap:7px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .guide-grid p{margin:0;font-size:11px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .overlay-card .primary{min-width:0;width:100%;margin-top:9px}
 html[data-view=play]:is([data-play-display=window],[data-play-display=native]) .fullscreen-notice{top:8px;inset-inline:150px;max-width:400px;padding:8px 32px 8px 10px;font-size:10px;gap:6px}
}
