/* The website owns its modal chrome; the game owns the play surface. */
.side-flipper,.flight-fire,.mobile-tool{display:none}
.cabinet,.side-flipper,.touch-controls,.flight-fire{
  -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
  -webkit-tap-highlight-color:transparent;
}
.side-flipper,.flight-fire{touch-action:none}
.cabinet:has(.overlay:not([hidden])){touch-action:pan-y}
.overlay{overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;align-items:flex-start}
.overlay-content{flex:none;margin-top:clamp(0px,25%,180px);padding-bottom:12px}
.overlay:has(#sbWrap:not([hidden])) .overlay-content{margin-top:0}
.overlay [hidden]{display:none!important}
.embedded .overlay,.overlay:has(#sbWrap:not([hidden])){background:linear-gradient(#060b14ed,#060b14f5)}
.overlay input,.help-card,.radio-panel{touch-action:pan-y}
#sbName{font-size:16px!important;-webkit-user-select:text;user-select:text;-webkit-touch-callout:default;touch-action:manipulation}
.overlay button,.help-card button{touch-action:manipulation}
html.embedded,html.embedded body{height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
.embedded body{height:100dvh;display:grid;grid-template-rows:40px minmax(0,1fr);background:#050508}
.embedded header{height:40px;margin:0 12px;justify-content:flex-end}
.embedded header .brand,.embedded header .edition,.embedded footer{display:none}
.embedded .layout{width:100%;height:100%;min-height:0;max-width:1200px;padding:6px 16px 10px;gap:16px;grid-template-columns:180px minmax(0,1fr) 210px;justify-items:center}
.embedded .cabinet{width:min(520px,calc((100dvh - 56px)*520/940),calc(100vw - 454px));max-width:none;flex:none}
.embedded .left>h1,.embedded .left>.intro,.embedded .left>.eyebrow,.embedded .left>.hairline:first-of-type{display:none}
.embedded .right{max-width:210px}
.embedded .mini-booth,.embedded .radio-site,.embedded .radio-next{display:none}
.embedded .radio-panel{margin-bottom:8px;padding:10px}
.embedded .mission{padding:8px 0}
.embedded .score{font-size:36px}
@media(min-width:861px) and (max-height:650px){
  .embedded .right>:not(.radio-panel){display:none}
  .embedded .left .controls,.embedded .left .hairline{display:none}
}
/* Reserve thumb gutters, preserving the original 520:940 table proportions. */
@media(max-width:860px),(pointer:coarse) and (max-height:600px){
  html,body{height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
  body,.embedded body{
    --play-height:calc(100dvh - 84px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    --table-width:min(calc(100vw - 88px - env(safe-area-inset-left) - env(safe-area-inset-right)),calc(var(--play-height)*520/940));
    --table-height:calc(var(--table-width)*940/520);
    height:100dvh;min-height:0;display:grid;grid-template-rows:44px 40px minmax(0,1fr);
    padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    -webkit-user-select:none;user-select:none;-webkit-touch-callout:none;
  }
  header,.embedded header{height:44px;margin:0 8px;justify-content:flex-end}
  header .brand,header .edition{display:none}
  .top-actions{gap:6px}
  .icon-btn{min-width:36px;width:auto;height:36px;padding:0 8px}
  .mobile-tool{display:inline-block;font-size:11px}
  #motionBtn{min-width:65px}
  .mobile-score,.embedded .mobile-score{display:flex;width:100%;height:40px;padding:0 12px}
  .mobile-score strong{font-size:20px;margin:0}
  .layout,.embedded .layout{position:relative;display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:0;margin:0;padding:0;gap:0}
  .left,.right,footer,.embedded .left,.embedded .right{display:none}
  .cabinet,.embedded .cabinet{width:var(--table-width);height:var(--table-height);max-width:none;flex:none;aspect-ratio:520/940;border-radius:15px;overflow:hidden}
  #game{width:100%;height:100%;aspect-ratio:520/940}
  .touch-controls{display:none}
  .side-flipper{
    display:flex;position:absolute;align-items:center;justify-content:center;
    top:calc(50% + var(--table-height)*.11);height:clamp(80px,calc(var(--table-height)*.3),240px);
    width:max(44px,calc((100% - var(--table-width))/2 - 12px));
    padding:4px;border:1px solid #00d4c855;border-radius:14px;
    background:linear-gradient(#0d252b,#0c1420);color:var(--teal);font:22px 'Share Tech Mono';z-index:4;
  }
  #sideLeft{left:4px}#sideRight{right:4px}
  .side-flipper.held{background:#006963;color:white;box-shadow:inset 0 0 18px #00d4c840}
  .layout:has(.overlay:not([hidden])) .side-flipper{opacity:.3;pointer-events:none}
  .flight-mode .flight-fire{display:block;position:absolute;bottom:5px;left:50%;transform:translateX(-50%);height:44px;min-width:88px;border:1px solid var(--gold);background:#342d12;color:var(--gold);border-radius:10px;z-index:7;font:13px 'Share Tech Mono'}
  .overlay{padding:14px}
  .overlay-content{margin-top:0;max-width:340px;margin-bottom:auto}
  .overlay h2{font-size:22px}
  .overlay p{font-size:14px;margin-bottom:12px;line-height:1.4}
  .overlay-foot{font-size:8px}
  .overlay input,.help-card{user-select:text;-webkit-user-select:text}
  .right:has(.radio-panel.open),.embedded .right:has(.radio-panel.open){display:block;position:fixed;inset:0;width:100%;max-width:none;padding:55px 16px 16px;overflow-y:auto;z-index:18}
  .radio-panel.open #closeRadioBtn{display:block}
  .help-card{padding:20px;max-height:calc(100dvh - 36px)}
}

/* v52: maximize the portrait playfield without stretching it. The controls
   overlap only the outer cabinet trim; the spring and ball lane stay exposed.
   Extra selector specificity fences off old host fullscreen injections. */
@media(max-width:860px),(pointer:coarse) and (max-height:600px){
  html[data-game-version="v52"]:root body{
    --play-height:calc(100dvh - 76px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    --table-width:min(calc(100vw - 56px - env(safe-area-inset-left) - env(safe-area-inset-right)),calc(var(--play-height)*520/940));
    grid-template-rows:44px 32px minmax(0,1fr)!important;
  }
  html[data-game-version="v52"] body header{
    position:relative!important;inset:auto!important;height:44px!important;
    width:auto!important;margin:0 8px!important;padding:0!important;
    justify-content:flex-end!important;z-index:6!important;
  }
  html[data-game-version="v52"] body .mobile-score{height:32px}
  html[data-game-version="v52"] body .cabinet{width:var(--table-width)!important;height:var(--table-height)}
  .side-flipper{
    width:max(44px,calc((100% - var(--table-width))/2 - 4px));
    top:calc(50% + var(--table-height)*.13);
    height:clamp(80px,calc(var(--table-height)*.25),200px);
    background:linear-gradient(#0d252be8,#0c1420e8);
  }
  .layout{touch-action:none}
  /* Keep native scrolling inside dialogs, never on the playing surface. */
  .layout:has(.overlay:not([hidden])),.layout:has(.radio-panel.open){touch-action:pan-y}
  #game,.side-flipper,.flight-fire{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;touch-action:none}
  .mobile-score{pointer-events:none}
}
