/* connect-four · fullscreen — pure CSS, no script. Active only while the shell's Full screen is on
   (html.pip-immersive on iPhone, html.pip-native where the Fullscreen API exists); normal play is untouched.
   The stage becomes a column (portrait) or a two-column grid (landscape). The board zone takes all the room
   left and sizes the board from its own box with container units, so nothing scrolls and nothing is cut off. */
:is(html.pip-immersive, html.pip-native) .pip-stage {
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden; overscroll-behavior: none;
  padding-left: max(8px, env(safe-area-inset-left, 0px));
  padding-right: max(8px, env(safe-area-inset-right, 0px));
  padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}
/* only the playing parts stay; intro copy, help, column lab, depth panels, goals, ads and footers are hidden (not deleted) */
:is(html.pip-immersive, html.pip-native) .pip-stage > :not(.hud):not(.diff-row):not(#status):not(#board-zone):not(#starter) { display: none !important; }
:is(html.pip-immersive, html.pip-native) .pip-stage .hud { padding: 0; flex: none; font-size: 0.8rem; gap: 0.5rem; flex-wrap: wrap; }
:is(html.pip-immersive, html.pip-native) .pip-stage .diff-row { margin: 0; flex: none; }
:is(html.pip-immersive, html.pip-native) .pip-stage #status { margin: 0; min-height: 1.4em; font-size: 1rem; flex: none; }
:is(html.pip-immersive, html.pip-native) .pip-stage #starter { margin: 0; text-align: center; flex: none; }
:is(html.pip-immersive, html.pip-native) .pip-stage .tools-row #move-count { flex: 0 1 auto; }
:is(html.pip-immersive, html.pip-native) .pip-stage .diff-btn,
:is(html.pip-immersive, html.pip-native) .pip-stage .tool-btn,
:is(html.pip-immersive, html.pip-native) .pip-stage #new-game { min-height: 44px; min-width: 44px; touch-action: manipulation; }

/* the board zone fills what is left; its box (not the page) decides the board size */
:is(html.pip-immersive, html.pip-native) .pip-stage #board-zone {
  flex: 1 1 0; min-height: 0; width: 100%; margin: 0;
  container-type: size;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
:is(html.pip-immersive, html.pip-native) .pip-stage #board-zone > #drop-row,
:is(html.pip-immersive, html.pip-native) .pip-stage #board-zone > #card-grid {
  --u: max(140px, min(100cqw, calc((100cqh - 60px) / 0.87)));
  width: var(--u); flex: none; box-sizing: border-box;
}
:is(html.pip-immersive, html.pip-native) .pip-stage #board-zone > #drop-row { margin: 0 0 2px; }
:is(html.pip-immersive, html.pip-native) .pip-stage .drop-btn { aspect-ratio: auto; height: 44px; min-width: 0; }
:is(html.pip-immersive, html.pip-native) .pip-stage #card-grid { filter: drop-shadow(0 8px 10px rgb(0 0 0 / .4)); }
@media (prefers-reduced-motion: reduce) { :is(html.pip-immersive, html.pip-native) .pip-stage #card-grid { filter: none; } }

/* landscape: board on the left at full height, HUD and controls in a column on the right */
@media (orientation: landscape) {
  :is(html.pip-immersive, html.pip-native) .pip-stage {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 260px);
    grid-template-rows: repeat(5, auto) 1fr; column-gap: 12px; align-content: stretch; align-items: start;
  }
  :is(html.pip-immersive, html.pip-native) .pip-stage > * { grid-column: 2; min-width: 0; }
  :is(html.pip-immersive, html.pip-native) .pip-stage > #board-zone { grid-column: 1; grid-row: 1 / -1; align-self: stretch; height: auto; }
  :is(html.pip-immersive, html.pip-native) .pip-stage .hud { justify-content: space-between; }
}
