/* Skin hooks: .mobile-frame, .mobile-screen, .game-left-controls,
   .game-right-actions, .game-control-options and the variables below. */
.mobile-frame{--mobile-shell:#14231e;--mobile-edge:#526b5d;--mobile-key:#293e35;--mobile-ink:#edffe9;--mobile-pressed:#b9db83;display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:"screen screen" "left right" "options options";gap:12px;padding:12px!important;background:var(--mobile-shell);border:1px solid var(--mobile-edge);border-radius:18px;max-width:100%;box-sizing:border-box;align-items:start}
.mobile-frame>canvas,.mobile-frame>.mobile-screen{grid-area:screen;width:100%;min-width:0;height:auto;max-height:60dvh;object-fit:contain;background:#050a07;border-radius:8px}
.mobile-frame .game-controls:not([hidden]),.mobile-frame .game-control-row{display:contents}
.mobile-frame .game-left-controls{grid-area:left;justify-self:start;display:flex;flex-direction:column;gap:8px;min-width:0}
.mobile-frame .game-right-controls{grid-area:right;width:100%;min-height:142px;justify-self:end}
.mobile-frame .game-control-options{grid-area:options;min-width:0}
.mobile-frame .game-controls button{background:var(--mobile-key);color:var(--mobile-ink);border-color:var(--mobile-edge)}
.mobile-frame .game-controls button[aria-pressed=true]{background:var(--mobile-pressed);color:#142519}
.mobile-frame .game-control-options small{color:var(--mobile-ink);opacity:.75}
.mobile-frame[data-orientation=landscape]{grid-template-columns:142px minmax(80px,1fr) 142px;grid-template-areas:"left screen right" "options options options";align-items:center}
.mobile-frame[data-orientation=landscape]>canvas{max-height:calc(100dvh - 130px)}
@media(orientation:landscape){
 .mobile-frame[data-orientation=auto]{grid-template-columns:142px minmax(80px,1fr) 142px;grid-template-areas:"left screen right" "options options options";align-items:center}
 .mobile-frame[data-orientation=auto]>canvas{max-height:calc(100dvh - 130px)}
}
@media(max-width:380px){.mobile-frame{gap:8px;padding:8px!important}}

/* Immersive mode uses the entire landscape height, with controls alongside or
   over the outer edges of a wide game. The game keeps its original aspect. */
html.mobile-fullscreen-open{overflow:hidden}
.mobile-fullscreen-target.mobile-fullscreen-target{position:fixed!important;inset:0!important;transform:none!important;margin:0!important;width:100vw!important;height:100dvh!important;max-width:none!important;max-height:none!important;padding:0!important;border:0!important;border-radius:0!important;overflow:hidden!important;z-index:2147483647!important;background:#050a07}
.mobile-fullscreen-target>.window-chrome,.mobile-fullscreen-target>.viewport-tools,.mobile-fullscreen-target>.viewport-resize{display:none!important}
.mobile-frame.mobile-immersive{position:relative;box-sizing:border-box;width:100%;height:100dvh;max-height:none;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;grid-template-areas:"screen screen" "left right";padding:0!important;border:0;border-radius:0;gap:0;overflow:hidden}
.mobile-frame.mobile-immersive .game-control-options{display:none!important}
.mobile-frame.mobile-immersive .game-control-options:has(.game-more-actions:not([hidden])){display:contents!important}
.mobile-immersive .game-control-options>small,.mobile-immersive .game-control-options>select,.mobile-immersive .game-control-options>.motion-controls{display:none!important}
.mobile-immersive .game-more-actions{position:absolute;top:max(8px,env(safe-area-inset-top));left:max(8px,env(safe-area-inset-left));z-index:7;max-width:calc(100% - 84px);max-height:calc(100dvh - 30px);background:#10251ef5;border:1px solid #a6c5b3;border-radius:9px;color:#f2fff8;padding:2px 8px;overflow:auto}
.mobile-immersive .game-more-actions[open]{width:min(460px,calc(100% - 32px));max-width:calc(100% - 32px)}
.mobile-immersive .game-more-actions summary{font:14px sans-serif;min-height:44px;display:flex;align-items:center;cursor:pointer;touch-action:manipulation}
.mobile-immersive .game-extra-actions{grid-template-columns:repeat(auto-fit,minmax(100px,1fr));max-height:calc(100dvh - 100px);overflow:auto;touch-action:pan-y}
.mobile-immersive .game-extra-actions button{min-height:48px}
.mobile-frame.mobile-immersive>canvas{width:100%!important;height:100%!important;max-width:100%!important;max-height:100%!important;object-fit:contain!important;border:0;border-radius:0}
.mobile-immersive .game-left-controls,.mobile-immersive .game-right-controls{z-index:1;align-self:center;padding:8px;max-width:158px}
.mobile-immersive .game-right-controls{justify-self:end}
.mobile-immersive .mobile-fullscreen-hint{display:block;position:absolute;bottom:8px;left:50%;transform:translateX(-50%);background:#000b;color:white;padding:5px 10px;border-radius:8px;z-index:2;font:12px sans-serif;pointer-events:none;animation:mobile-hint 3s forwards}
@keyframes mobile-hint{0%,70%{opacity:1}100%{opacity:0;visibility:hidden}}
@media(orientation:landscape){
 .mobile-frame.mobile-immersive{display:grid!important;grid-template-columns:158px minmax(0,1fr) 158px;grid-template-rows:100%;grid-template-areas:"left screen right"}
 .mobile-frame.mobile-immersive>canvas{grid-area:1/1/2/4}
 .mobile-immersive .game-left-controls{padding-left:max(8px,env(safe-area-inset-left))}
 .mobile-immersive .game-right-controls{padding-right:max(8px,env(safe-area-inset-right))}
}

/* Controller drags and gaps belong to the game, not browser scrolling. */
.mobile-immersive,.mobile-immersive .game-controls,.mobile-immersive .game-left-controls,.mobile-immersive .game-right-actions{touch-action:none;overscroll-behavior:none}
html.mobile-fullscreen-open,html.mobile-fullscreen-open body{overscroll-behavior:none}
.mobile-frame .game-left-controls{width:100%}
.mobile-frame .game-left-controls,.mobile-frame .game-right-controls{max-width:none}
@media(orientation:landscape){
 .mobile-frame.mobile-immersive{grid-template-columns:clamp(158px,25vw,280px) minmax(0,1fr) clamp(158px,25vw,280px)}
 .mobile-immersive .game-left-controls,.mobile-immersive .game-right-controls{width:min(100%,var(--action-width));max-width:none}
 .mobile-immersive [data-layout=rows].game-left-controls,.mobile-immersive [data-layout=rows].game-right-controls{height:100%;min-height:0;align-self:stretch}
 .mobile-immersive .game-actions[data-layout=rows]{min-height:0;grid-template-rows:repeat(3,minmax(0,1fr))}
 .mobile-immersive .game-actions[data-layout=rows] button{min-height:44px}
 .mobile-immersive .game-slider[data-directions=vertical]{max-height:calc(100dvh - 80px)}
}

/* Explicit overlay projects own their adaptive canvas. Thumb controls cover
   the lower corners instead of reserving columns beside the game. */
.game-corner-controls{display:flex;gap:8px}
.mobile-frame.mobile-immersive[data-overlay=true]{display:block!important}
.mobile-frame.mobile-immersive[data-overlay=true]>canvas{position:absolute;inset:0;width:100%!important;height:100%!important;object-fit:fill!important}
.mobile-immersive[data-overlay=true] .game-left-controls,
.mobile-immersive[data-overlay=true] .game-right-controls{position:absolute;bottom:max(14px,env(safe-area-inset-bottom));height:auto;min-height:0;padding:0;z-index:3;width:auto;max-width:none}
.mobile-immersive[data-overlay=true] .game-left-controls{left:max(18px,env(safe-area-inset-left))}
.mobile-immersive[data-overlay=true] .game-right-controls{right:max(18px,env(safe-area-inset-right))}
.mobile-immersive[data-overlay=true] .game-direction-control{width:clamp(136px,37dvh,180px);height:clamp(136px,37dvh,180px);display:block;opacity:.87}
.mobile-immersive[data-overlay=true] .game-direction-control button[data-key]{position:absolute;width:30%;height:30%;min-width:0;min-height:0;border:0!important;background:transparent!important;font-size:19px;padding:0;box-shadow:none}
.mobile-immersive[data-overlay=true] .game-direction-control [data-key="38"]{top:0;left:35%}
.mobile-immersive[data-overlay=true] .game-direction-control [data-key="40"]{bottom:0;left:35%}
.mobile-immersive[data-overlay=true] .game-direction-control [data-key="37"]{left:0;top:35%}
.mobile-immersive[data-overlay=true] .game-direction-control [data-key="39"]{right:0;top:35%}
.mobile-immersive[data-overlay=true] .game-right-actions{display:flex;align-items:end;gap:14px}
.mobile-immersive[data-overlay=true] .game-right-actions button[data-key]{width:clamp(94px,26dvh,128px);height:clamp(94px,26dvh,128px);min-height:94px;min-width:94px;border-radius:50%;font:bold clamp(15px,4.3dvh,20px) sans-serif;letter-spacing:.4px;border:3px solid #fff9!important;box-shadow:inset 0 -7px 0 #0004,0 4px 15px #0006}
.mobile-immersive[data-overlay=true] .game-right-actions button[data-key="86"]{margin-bottom:24px}
.mobile-immersive[data-overlay=true] .game-corner-controls{position:absolute;right:max(12px,env(safe-area-inset-right));top:max(10px,env(safe-area-inset-top));z-index:4}
.mobile-immersive[data-overlay=true] .game-corner-action{width:54px;min-width:54px;height:50px;border-radius:14px;font:bold 14px sans-serif;background:#102e2bdd!important}
@media(orientation:portrait){
 .mobile-immersive[data-overlay=true] .game-right-actions{gap:8px}
 .mobile-immersive[data-overlay=true] .game-right-actions button[data-key]{width:80px;height:80px;min-width:80px;min-height:80px;font-size:13px}
 .mobile-immersive[data-overlay=true] .game-direction-control{width:126px;height:126px}
 .mobile-immersive[data-overlay=true] .game-left-controls{left:max(10px,env(safe-area-inset-left))}
 .mobile-immersive[data-overlay=true] .game-right-controls{right:max(10px,env(safe-area-inset-right))}
}

