.arcade-game-controls { position:absolute; top:max(var(--arcade-controls-anchor-top,8px),env(safe-area-inset-top)); right:max(10px,env(safe-area-inset-right)); z-index:40; display:flex; align-items:center; gap:8px; }
.arcade-game-controls .arcade-game-control { display:grid; place-items:center; box-sizing:border-box; width:56px; height:56px; min-width:56px; min-height:56px; padding:12px; border:2px solid #97cde4; border-radius:17px; background:linear-gradient(160deg,#29455e,#162c43); color:#d9f7ff; box-shadow:0 4px 0 #071628,0 5px 16px #0005,inset 0 1px 0 #ffffff1c; cursor:pointer; touch-action:manipulation; transition:background .15s,transform .15s,box-shadow .15s; }
.arcade-game-controls .arcade-game-close { border-color:#f8aaa6; background:linear-gradient(160deg,#6a3543,#422332); color:#ffe8e4; }
.arcade-game-controls .arcade-game-control svg { display:block; width:30px; height:30px; }
.arcade-game-controls .arcade-game-control:hover { filter:brightness(1.15); }
.arcade-game-controls .arcade-game-control:active { transform:translateY(3px); box-shadow:0 1px 0 #071628; }
.arcade-game-controls .arcade-game-control:focus-visible { outline:3px solid #fff3a6; outline-offset:3px; }
.arcade-controls-confirm { display:contents; }
@media(max-width:540px) { .arcade-game-controls { right:max(8px,env(safe-area-inset-right)); } .arcade-game-controls .arcade-game-control { width:52px; height:52px; min-width:52px; min-height:52px; padding:10px; border-radius:15px; } }
@media(prefers-reduced-motion:reduce) { .arcade-game-controls .arcade-game-control { transition:none; } }

/* The shell owns this space; lazy game styles must not reclaim it. */
[data-arcade-game-shell] {
  --arcade-controls-reserved:calc(134px + max(10px,env(safe-area-inset-right)));
  --arcade-controls-header-min:72px;
}
[data-arcade-game-shell] :is(.arcade-start-header,.sv-header,.mg-header,.ta-header,.mr-header,.cb-header,.bb-header,.tr-header,.pc-header,.sm-header,.ss-header,.cr-header,.mtr-header,.sks-header) {
  box-sizing:border-box;
  min-height:var(--arcade-controls-header-min)!important;
  height:auto!important;
  flex-shrink:0;
  min-width:0;
  padding:8px var(--arcade-controls-reserved) 8px max(12px,env(safe-area-inset-left))!important;
  gap:8px!important;
  align-items:center;
  flex-wrap:nowrap!important;
}
[data-arcade-game-shell] :is(.sv-brand,.mg-brand,.ta-brand,.mr-brand,.cb-brand,.bb-brand,.tr-brand,.pc-brand,.sm-brand,.ss-brand,.cr-brand,.mtr-brand,.sks-brand) {
  min-width:0;
}
[data-arcade-game-shell] :is(.sv-language,.mg-language,.cb-language,.bb-language,.tr-language,.pc-language,.sm-language,.ss-language,.cr-language,.mtr-language,.sks-language) {
  flex-shrink:0;
}
[data-arcade-game-shell] :is(.sv-language,.mg-language,.cb-language,.bb-language,.tr-language,.pc-language,.sm-language,.ss-language,.cr-language,.mtr-language,.sks-language) button {
  box-sizing:border-box;
  min-width:44px!important;
  min-height:44px!important;
  padding:6px 8px!important;
  font-size:11px!important;
  line-height:1.2;
}
[data-arcade-game-shell] .arcade-start-header h1 {
  overflow-wrap:anywhere;
}

/* Scores share the desktop header, then become a real row on small screens. */
[data-arcade-game-shell] .sv-play .sv-scoreboard,
[data-arcade-game-shell] .cb-play .cb-scoreboard {
  top:14px!important;
  right:calc(var(--arcade-controls-reserved) + 116px)!important;
}

/* All solo HUDs use the same bounded strip, including their dense power states. */
[data-arcade-game-shell] .arcade-game-hud {
  --arcade-hud-columns:4;
  position:absolute;
  top:10px!important;
  left:max(12px,env(safe-area-inset-left))!important;
  right:var(--arcade-controls-reserved)!important;
  width:auto!important;
  max-width:660px!important;
  transform:none!important;
  display:grid!important;
  grid-template-columns:repeat(var(--arcade-hud-columns),minmax(0,1fr));
  align-items:stretch!important;
  justify-content:start!important;
  gap:4px!important;
}
[data-arcade-game-shell] .arcade-game-hud[data-arcade-hud-count='2'] { --arcade-hud-columns:2; max-width:260px!important; }
[data-arcade-game-shell] .arcade-game-hud[data-arcade-hud-count='3'] { --arcade-hud-columns:3; max-width:360px!important; }
[data-arcade-game-shell] .arcade-game-hud[data-arcade-hud-count='5'] { --arcade-hud-columns:5; }
[data-arcade-game-shell] .arcade-game-hud[data-arcade-hud-count='6'] { --arcade-hud-columns:6; }
[data-arcade-game-shell] .arcade-game-hud[data-arcade-hud-count='7'] { --arcade-hud-columns:7; }
[data-arcade-game-shell] .arcade-game-hud[data-arcade-hud-count='8'] { --arcade-hud-columns:8; }
[data-arcade-game-shell] .arcade-game-hud > div {
  box-sizing:border-box;
  min-width:0!important;
  padding:3px 6px!important;
}
[data-arcade-game-shell] .arcade-game-hud > div > div:first-child {
  font-size:9px;
  line-height:11px;
  letter-spacing:.025em;
}
[data-arcade-game-shell] .arcade-game-hud > div > div:last-child {
  min-width:0;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:15px!important;
  line-height:17px;
}
[data-arcade-game-shell] :is(.arcade-tetris-next-preview,[aria-label='Next piece']) {
  top:max(72px,calc(env(safe-area-inset-top) + 68px))!important;
}

/* The upgrade workshop has no separate exit: keep its language row clear too. */
[data-arcade-game-shell] .tw-toolbar {
  display:block!important;
  padding:10px 12px!important;
}
[data-arcade-game-shell] .tw-topline {
  display:flex!important;
  align-items:center;
  min-height:var(--arcade-controls-header-min);
  padding:0 var(--arcade-controls-reserved) 0 0!important;
  gap:8px;
}
[data-arcade-game-shell] .tw-dashboard { display:flex!important; margin-top:8px; }
[data-arcade-game-shell] .tw-workshop .tw-language button { min-height:44px!important; }

@media(max-width:700px) {
  [data-arcade-game-shell] .sv-play .sv-scoreboard,
  [data-arcade-game-shell] .cb-play .cb-scoreboard {
    position:relative!important;
    inset:auto!important;
    flex-shrink:0;
    width:100%!important;
    max-width:none!important;
    height:40px!important;
    min-height:40px;
    margin:0!important;
    padding:2px 12px!important;
    background:rgba(8,18,32,.38);
  }
  [data-arcade-game-shell] .sv-play .sv-team > span { font-size:10px!important; }
  [data-arcade-game-shell] .cb-play .cb-scoreboard small { font-size:8px!important; }
}
@media(max-width:640px) {
  [data-arcade-game-shell] .arcade-game-hud { --arcade-hud-columns:2; gap:3px!important; }
  [data-arcade-game-shell] .arcade-game-hud[data-arcade-hud-count='3'] { --arcade-hud-columns:3; }
  [data-arcade-game-shell] .arcade-game-hud:is([data-arcade-hud-count='5'],[data-arcade-hud-count='6']) { --arcade-hud-columns:3; }
  [data-arcade-game-shell] .arcade-game-hud:is([data-arcade-hud-count='7'],[data-arcade-hud-count='8']) { --arcade-hud-columns:4; }
  [data-arcade-game-shell='pixel-jump'] .arcade-game-hud[data-arcade-hud-count] { --arcade-hud-columns:2; }
  [data-arcade-game-shell] .arcade-game-hud > div { min-height:24px; padding:0 3px!important; border-radius:6px; }
  [data-arcade-game-shell] .arcade-game-hud > div > div:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:8px; line-height:9px; }
  [data-arcade-game-shell] .arcade-game-hud > div > div:last-child { font-size:12px!important; line-height:13px; }
  [data-arcade-game-shell] .arcade-game-hud:is([data-arcade-hud-count='7'],[data-arcade-hud-count='8']) > div { padding-inline:1px!important; }
  [data-arcade-game-shell] .arcade-game-hud:is([data-arcade-hud-count='7'],[data-arcade-hud-count='8']) > div > div:last-child { font-size:clamp(10px,3vw,12px)!important; }
}
@media(max-width:600px) {
  [data-arcade-game-shell] :is(.sv-header,.mg-header,.ta-header,.mr-header,.cb-header,.bb-header,.tr-header,.pc-header,.sm-header,.ss-header,.cr-header,.mtr-header,.sks-header) > :is(.sv-brand,.mg-brand,.ta-brand,.mr-brand,.cb-brand,.bb-brand,.tr-brand,.pc-brand,.sm-brand,.ss-brand,.cr-brand,.mtr-brand,.sks-brand) { display:none!important; }
  [data-arcade-game-shell] :is(.ta-hud,.mr-hud) { min-width:0; gap:6px!important; }
  [data-arcade-game-shell] :is(.ta-hud,.mr-hud) > span { min-width:0; }
  [data-arcade-game-shell] :is(.ta-hud,.mr-hud) small { font-size:7px!important; }
  [data-arcade-game-shell] :is(.ta-hud b,.mr-hud strong) { font-size:16px!important; }
  [data-arcade-game-shell] :is(.ta-hud b,.mr-hud strong) i { font-size:9px!important; }
  [data-arcade-game-shell] .tw-topline { flex-wrap:wrap; justify-content:flex-end; }
  [data-arcade-game-shell] .tw-topline h2 { flex:1 0 100%; font-size:13px; }
}
@media(max-width:540px) {
  [data-arcade-game-shell] {
    --arcade-controls-reserved:calc(128px + max(8px,env(safe-area-inset-right)));
    --arcade-controls-header-min:68px;
  }
  [data-arcade-game-shell] .arcade-start-header:has(.arcade-start-toolbar) {
    display:grid;
    grid-template-columns:44px minmax(0,1fr);
    padding:10px 10px 12px!important;
    gap:8px;
  }
  [data-arcade-game-shell] .arcade-start-header:has(.arcade-start-toolbar) h1 { width:100%; }
  [data-arcade-game-shell] .arcade-start-toolbar {
    grid-column:1 / -1;
    justify-content:flex-end;
    width:calc(100% - var(--arcade-controls-reserved) + 10px);
    min-width:0;
    min-height:52px;
    padding:0!important;
  }
}
@media(max-width:380px) {
  [data-arcade-game-shell] .cr-header-controls {
    display:grid;
    grid-template-columns:repeat(2,minmax(44px,1fr));
    justify-content:end;
    width:116px;
    margin-left:auto;
    gap:4px;
  }
  [data-arcade-game-shell] .cr-header-controls .cr-language { grid-column:1 / -1; justify-self:end; }
}
