/* go-five · fullscreen — paired with fullscreen-fit.js, which sets --fs-side (the board unit's width),
   --fs-rows and toggles .fs-wide. Only applies while the game-shell's Full screen is on
   (html:is(.pip-immersive,.pip-native)); normal play is untouched. */
html:is(.pip-immersive,.pip-native) .pip-stage .fs-unit { width: var(--fs-side, 100%); max-width: none; margin-left: auto; margin-right: auto; box-sizing: border-box; }
html:is(.pip-immersive,.pip-native) .pip-stage.fs-wide {
  display: grid;
  grid-template-columns: var(--fs-side) var(--fs-side-col, 320px);
  grid-template-rows: repeat(var(--fs-rows, 6), auto) 1fr;
  column-gap: 20px;
  justify-content: center;
  align-content: start;
}
html:is(.pip-immersive,.pip-native) .pip-stage.fs-wide > * { grid-column: 2; min-width: 0; }
html:is(.pip-immersive,.pip-native) .pip-stage.fs-wide > .fs-unit { grid-column: 1; grid-row: 1 / -1; margin: 0; align-self: start; }

/* go-five: board + HUD first; how-to line, tools and Pattern Workshop below the fold. */
html:is(.pip-immersive,.pip-native) .pip-stage .gf-how { display: none; }
html:is(.pip-immersive,.pip-native) .pip-stage #board-box { margin: 0; max-width: none; }
html:is(.pip-immersive,.pip-native) .pip-stage.fs-wide > #board-box.fs-unit { position: sticky; top: 0; margin: 0; }
html:is(.pip-immersive,.pip-native) .pip-stage:not(.fs-wide) { display: flex; flex-direction: column; }
html:is(.pip-immersive,.pip-native) .pip-stage:not(.fs-wide) > .fs-unit { order: 5; flex: none; }
html:is(.pip-immersive,.pip-native) .pip-stage:not(.fs-wide) > .gf-tools { order: 6; }
html:is(.pip-immersive,.pip-native) .pip-stage:not(.fs-wide) > .gf-workshop { order: 8; }

/* 44px controls and safe-area clearance while full screen is on. */
html:is(.pip-immersive,.pip-native) .pip-stage .gf-tools .btn,
html:is(.pip-immersive,.pip-native) .pip-stage .gf-seg button,
html:is(.pip-immersive,.pip-native) .pip-stage .hud .btn { min-height: 44px; }
html:is(.pip-immersive,.pip-native) .pip-stage .gf-rank { display: none; }
html:is(.pip-immersive,.pip-native) .pip-stage { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); padding-bottom: max(8px, env(safe-area-inset-bottom)); overflow: hidden; }

/* Outside full screen: board first, the how-to line under it. */
html:not(.pip-immersive):not(.pip-native) .game-wrap { display: flex; flex-direction: column; }
html:not(.pip-immersive):not(.pip-native) .game-wrap > * { order: 3; }
html:not(.pip-immersive):not(.pip-native) .game-wrap > .game-title { order: 0; }
html:not(.pip-immersive):not(.pip-native) .game-wrap > .facts { order: 1; }
html:not(.pip-immersive):not(.pip-native) .game-wrap > .gf-seg { order: 2; }
html:not(.pip-immersive):not(.pip-native) .game-wrap > .gf-how { order: 6; }
html:not(.pip-immersive):not(.pip-native) .game-wrap > .gf-workshop { order: 7; }
html:not(.pip-immersive):not(.pip-native) .game-wrap > .pip-actions { order: 8; }

/* Full screen is for the match: the practice Workshop and the All Games link stay out of the way (display only,
   nothing removed; they return when full screen ends). */
html:is(.pip-immersive,.pip-native) .pip-stage > .gf-workshop,
html:is(.pip-immersive,.pip-native) .pip-stage > .pip-actions { display: none; }
