/* snack-snake · fullscreen fit — everything is scoped under html:is(.pip-immersive,.pip-native), so the normal page is
   untouched. Sizes come from js/fullscreen-fit.js (--fs-w / --fs-h / --fs-side on the stage). */
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 6px; overflow-x: hidden; overflow-y: auto; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > * { flex-shrink: 0; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > * { max-width: 100%; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit .canvas-wrapper { width: var(--fs-w) !important; height: var(--fs-h) !important; max-width: none !important; max-height: none !important; margin: 0 !important; flex: none; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit .canvas-wrapper canvas { width: 100% !important; height: 100% !important; max-width: none !important; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > .hud { width: var(--fs-w); max-width: 100%; margin: 0; padding-top: 4px; padding-bottom: 4px; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > [role="status"]:empty, html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > #status:empty { display: none; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > [role="status"], html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > #status { margin: 0; min-height: 0; padding: 2px 8px; width: var(--fs-w); text-align: center; font-size: .85rem; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit #dpad-controls { width: min(var(--fs-w), 190px); max-width: 190px; margin: 0; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-fit > .game-header { display: none; }
/* wide: board left, HUD/controls right */
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide { display: grid; grid-template-columns: var(--fs-w) var(--fs-side); justify-content: center; align-content: center; column-gap: 16px; row-gap: 8px; grid-auto-rows: min-content; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide .canvas-wrapper { grid-column: 1; grid-row: 1 / span 12; align-self: center; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide > :not(.canvas-wrapper) { grid-column: 2; width: auto; margin: 0; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide > .hud { width: auto; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide #turn-scout, html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide .editorial-section { display: none !important; }
/* fs-fix: turn-scout + editorial are non-play rows; never in the stage */
html:is(.pip-immersive,.pip-native) main.game-shell #turn-scout, html:is(.pip-immersive,.pip-native) main.game-shell .editorial-section { display: none !important; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide { grid-template-columns: var(--fs-w) minmax(0, var(--fs-side)); max-width: 100%; box-sizing: border-box; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide #dpad-controls { width: 150px; max-width: 150px; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide #dpad-controls .dpad-btn { min-height: 0; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide { row-gap: 0; align-content: center; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide > :not(.canvas-wrapper):not(.pip-dock):not(.pip-hint) { margin-block: 3px !important; }
/* wave4: touch targets 44px+, tighter stage padding, game-over card always fits and scrolls */
html:is(.pip-immersive,.pip-native) main.game-shell { padding: 4px 6px 4px; gap: 6px; max-width: none; }
html:is(.pip-immersive,.pip-native) main.game-shell .mode-tab { min-height: 44px; padding: 4px 6px; line-height: 1.1; }
html:is(.pip-immersive,.pip-native) main.game-shell .mode-selector { padding: 2px; gap: 4px; }
html:is(.pip-immersive,.pip-native) main.game-shell .btn-icon { width: 44px; height: 44px; }
html:is(.pip-immersive,.pip-native) main.game-shell .hud-bar { padding: 4px 8px; gap: 6px; }
html:is(.pip-immersive,.pip-native) main.game-shell #dpad-controls .dpad-btn { min-height: 44px; }
html:is(.pip-immersive,.pip-native) main.game-shell.fs-wide #dpad-controls { width: 156px; max-width: 156px; }
html:is(.pip-immersive,.pip-native) .overlay-backdrop { padding: 12px 12px 12px 64px; overflow: hidden; }
html:is(.pip-immersive,.pip-native) .overlay-card { max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto; box-sizing: border-box; }
@media (orientation: landscape) and (max-height: 520px) {
  html:is(.pip-immersive,.pip-native) .overlay-backdrop { padding: 8px 12px 8px 64px; }
  html:is(.pip-immersive,.pip-native) .overlay-card { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); max-width: 520px; padding: 12px 16px; gap: 8px; }
  html:is(.pip-immersive,.pip-native) .overlay-title { font-size: 1.25rem; }
  html:is(.pip-immersive,.pip-native) .overlay-card .stats-breakdown { display: none; }
  html:is(.pip-immersive,.pip-native) .overlay-card .button-stack { flex-direction: row; }
  html:is(.pip-immersive,.pip-native) .overlay-card .button-stack > button { flex: 1; min-height: 44px; }
}
