/* Rampart on wide screens (iPad, the Duo's inner screen). Nov 26, 2026. docs/ipad-duo/GAME-WORKER-GUIDE.md.
   Linked only in --wide builds, after the theme and the generated ui/ui.css, behind the gate's media query; every rule starts with
   html.tc-wide, so a phone never applies a line. The square size (--cs) and the sizes below (--rp-*) come from layoutWide() in
   index.html; these rules only place the regions. The generated ui.css uses two-id :not(#\9#\9) selectors and the page's touch pass
   uses html:root ... !important, so rules that must win carry :not(#\9#\9#\9) (3 more ids).

   tall  (iPad portrait):   the phone stack in a wider column (game.json "column"); bigger squares; score bar and tray as wide as
                            the wall; the wall and the tray share the spare height evenly.
   wide  (iPad landscape):  top bar across; the wall on the left at full height; a rail on the thumb side with the score and the
                            three sockets stacked (and the New game bar after a run ends).
   fold  (Duo inner, 890x626, no hinge reported): the wall on the left at full height; the top bar moves into the rail.
   fold + a real hinge (html.tcw-hinge): the wall on one half, everything else on the other; nothing crosses the hinge.
   tcw-left: the rail goes on the left. Pop-ups are centred dialogs; "No room left" comes up over the rail so the wall stays in view. */

/* ---------- every wide mode ---------- */
html.tc-wide #app:not(#\9#\9#\9) { max-width: var(--tcw-col); }
html.tc-wide #app .stat b:not(#\9#\9#\9) { font-size: 25px; }
html.tc-wide #app .stat.best b:not(#\9#\9#\9) { font-size: 20px; }
html.tc-wide #app #streakTxt:not(#\9#\9#\9) { font-size: 14px; }
/* the top bar is the unified frame's (shared/frame.js, Nov 29, 2026): Back, the name, Help, Menu; 44 pt, the same in every mode.
   iPad margins 24 (the spec): #app keeps 8 at the sides, the bar adds 16 here */
html.tc-wide #app > .tcf-bar:not(#\9#\9#\9) { padding: 0 16px; }
/* pop-ups: centred dialogs, a little wider than on a phone */
html.tc-wide .overlay:not(#\9#\9#\9) { align-items: center; }
html.tc-wide .overlay > .sheet:not(#\9#\9#\9) { max-width: 560px; }
html.tc-wide #overOverlay .bigstats b:not(#\9#\9#\9) { font-size: 34px; }
html.tc-wide .tok svg:not(#\9#\9#\9) { width: 64px; height: 64px; }

/* ---------- tall: iPad portrait ---------- */
html.tc-wide.tcw-tall #app:not(#\9#\9#\9) { gap: 12px; padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
html.tc-wide.tcw-tall #app .scorebar:not(#\9#\9#\9) { width: var(--rp-board-w, 100%); max-width: 100%; margin: 0 auto; }
html.tc-wide.tcw-tall #main:not(#\9#\9#\9) { justify-content: space-evenly; }
html.tc-wide.tcw-tall #tray:not(#\9#\9#\9) { width: var(--rp-board-w, 100%); max-width: 100%; height: var(--rp-tray-h, auto); margin: 0; gap: 12px; }
html.tc-wide.tcw-tall #overBar:not(#\9#\9#\9) { width: var(--rp-board-w, 100%); max-width: 100%; margin: 0 auto; }

/* ---------- wide and fold (no real hinge): the wall and a rail on the thumb side ---------- */
html.tc-wide:is(.tcw-wide, .tcw-fold) #main:not(#\9#\9#\9) { display: contents; }
html.tc-wide.tcw-wide:not(.tcw-hinge) #app:not(#\9#\9#\9) {
  display: grid; width: 100%; justify-content: center; align-content: stretch;
  grid-template-columns: var(--rp-board-w, 1fr) var(--rp-rail, 300px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "board score" "board tray" "board over";
  column-gap: 16px; row-gap: 12px; }
html.tc-wide.tcw-wide.tcw-left:not(.tcw-hinge) #app:not(#\9#\9#\9) {
  grid-template-columns: var(--rp-rail, 300px) var(--rp-board-w, 1fr);
  grid-template-areas: "top top" "score board" "tray board" "over board"; }
html.tc-wide.tcw-fold:not(.tcw-hinge) #app:not(#\9#\9#\9) {
  display: grid; width: 100%; justify-content: center; align-content: stretch;
  grid-template-columns: var(--rp-board-w, 1fr) var(--rp-rail, 310px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "board top" "board score" "board tray" "board over";
  column-gap: 12px; row-gap: 10px; }
html.tc-wide.tcw-fold.tcw-left:not(.tcw-hinge) #app:not(#\9#\9#\9) {
  grid-template-columns: var(--rp-rail, 310px) var(--rp-board-w, 1fr);
  grid-template-areas: "top board" "score board" "tray board" "over board"; }

/* ---------- fold with a real hinge: the wall on one half, the rest on the other ---------- */
html.tc-wide.tcw-fold.tcw-hinge #app:not(#\9#\9#\9) {
  display: grid; max-width: none; width: 100%; margin: 0;
  grid-template-columns: minmax(0, 1fr) calc(var(--tcw-hinge-w) + 32px) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "board . top" "board . score" "board . tray" "board . over";
  row-gap: 10px; }
html.tc-wide.tcw-fold.tcw-hinge.tcw-left #app:not(#\9#\9#\9) {
  grid-template-areas: "top . board" "score . board" "tray . board" "over . board"; }

/* ---------- the regions in the grid (wide, fold) ---------- */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app > .tcf-bar:not(#\9#\9#\9) { grid-area: top; min-width: 0; }
/* in the rail (fold) the bar keeps to the rail's width: Back, the name, Help, Menu still fit on one line (310 pt rail) */
html.tc-wide.tcw-fold #app > .tcf-bar:not(#\9#\9#\9) { padding: 0; }
/* score and best side by side, the streak plate under them (the rail is too narrow for all three on one line) */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .scorebar:not(#\9#\9#\9) { grid-area: score; min-width: 0; padding: 0;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-areas: "score best" "mid mid"; gap: 8px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .scorebar #score:not(#\9#\9#\9) { grid-area: score; min-width: 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .scorebar .best:not(#\9#\9#\9) { grid-area: best; min-width: 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .scorebar .mid:not(#\9#\9#\9) { grid-area: mid; min-height: 28px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #boardFrame:not(#\9#\9#\9) { grid-area: board; align-self: center; justify-self: center; }
/* the CLEAR / COMBO words: centred on the wall, not on the whole screen */
html.tc-wide:is(.tcw-wide, .tcw-fold) #banner:not(#\9#\9#\9) { grid-area: board; position: relative; top: auto; transform: none;
  align-self: center; height: 0; z-index: 15; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #tray:not(#\9#\9#\9) { grid-area: tray; flex-direction: column; width: auto; max-width: none;
  height: auto; min-height: 0; margin: 0; gap: 10px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #overBar:not(#\9#\9#\9) { grid-area: over; width: auto; max-width: none; }

/* ---------- "No room left" over the rail (wide, fold), so the finished wall stays in view ---------- */
html.tc-wide:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) #overOverlay:not(#\9#\9#\9) {
  justify-content: flex-end; padding-right: max(12px, var(--rp-rail-r, 12px)); }
html.tc-wide.tcw-left:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) #overOverlay:not(#\9#\9#\9) {
  justify-content: flex-start; padding-right: 12px; padding-left: max(12px, var(--rp-rail-l, 12px)); }
html.tc-wide:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) #overOverlay > .sheet:not(#\9#\9#\9) { max-width: max(340px, var(--rp-rail, 340px)); }
/* with a real hinge every pop-up keeps to the half away from the wall */
html.tc-wide.tcw-fold.tcw-hinge .overlay:not(#\9#\9#\9) { justify-content: flex-end; }
html.tc-wide.tcw-fold.tcw-hinge.tcw-left .overlay:not(#\9#\9#\9) { justify-content: flex-start; }
html.tc-wide.tcw-fold.tcw-hinge .overlay > .sheet:not(#\9#\9#\9) { max-width: calc(var(--tcw-w) / 2 - var(--tcw-hinge-w) / 2 - 24px); }
