/* Kingsleap (checkers) on wide screens: iPad portrait and landscape, the Duo's inner screen (docs/ipad-duo/GAME-WORKER-GUIDE.md). Copied from Kingsfall (same page ids), Nov 28, 2026.
   Nov 26, 2026. Built in only with --wide; linked last in <head> behind the wide gate, and every rule starts with html.tc-wide,
   so a phone (and the Duo's outer screen, below the gate) never applies a line of it.
   Level "column" (game.json): the engine lifts #app's 520 px cap and marks #game; the layout below is this page's own.
     tall  (portrait iPad)      the phone's stack, bigger: board as wide as the screen allows, plates / status / moves / buttons above and below
     wide  (landscape iPad)     board fills the height; side panel on the thumb side: top bar, foe plate, status, move list, buttons, own plate
     fold  (Duo inner screen)   board on one half, the panel on the other; nothing crosses the hinge
   The square size is set here a second time over the page's own formula (and over the App Store overlay's html:root one):
   html.tc-wide:root outranks html:root, and this file loads last. --fitcut (the page's short-screen fit) is still honoured. */

/* ---------------------------------------------------------------- square size per mode */
html.tc-wide.tcw-tall:root {
  --cellw: calc((min(var(--tcw-w), 1100px) - 48px) / 8);
  --cell: max(34px, min(var(--cellw), calc((var(--tcw-h) - 384px - var(--fitcut, 0px)) / 8)));
}
html.tc-wide.tcw-wide:root {
  --cell: max(34px, calc((min(var(--tcw-h) - 24px, var(--tcw-w) - 352px) - 16px - var(--fitcut, 0px)) / 8));
  --tcwPanel: clamp(300px, calc(var(--tcw-w) - 52px - var(--bw)), 420px);
}
html.tc-wide.tcw-fold:root {
  --tcwHalf: calc((var(--tcw-w) - var(--tcw-hinge-w) - 64px) / 2);
  --cell: max(30px, calc((min(var(--tcwHalf), var(--tcw-h) - 24px) - 16px - var(--fitcut, 0px)) / 8));
}
/* whole CSS pixels per square, so the 64 squares never show hairline seams */
@supports (width: round(down, 10.5px, 1px)) {
  html.tc-wide.tcw-tall:root { --cell: round(down, max(34px, min(var(--cellw), calc((var(--tcw-h) - 384px - var(--fitcut, 0px)) / 8))), 1px); }
  html.tc-wide.tcw-wide:root { --cell: round(down, max(34px, calc((min(var(--tcw-h) - 24px, var(--tcw-w) - 352px) - 16px - var(--fitcut, 0px)) / 8)), 1px); }
  html.tc-wide.tcw-fold:root { --cell: round(down, max(30px, calc((min(var(--tcwHalf), var(--tcw-h) - 24px) - 16px - var(--fitcut, 0px)) / 8)), 1px); }
}

/* ---------------------------------------------------------------- every wide mode */
/* the menu (setup screen) keeps its phone column, centred; the theme backdrop fills the rest */
html.tc-wide #app > #home { width: 100%; max-width: 540px; margin-left: auto; margin-right: auto; }
html.tc-wide #app > #waitmsg { max-width: 540px; }
/* bigger plates to go with the bigger board; captured pieces easier to read */
html.tc-wide #game > .plate:not(#\9#\9#\9) { height: 64px; padding-left: 8px; padding-right: 8px; gap: 10px; }
html.tc-wide #game > .plate .av,
html.tc-wide #game > .plate .av svg { width: 48px; height: 48px; }
html.tc-wide #game > .plate .pname { font-size: 17px; }
html.tc-wide #game > .plate .pname small { font-size: 13px; }
html.tc-wide #game > .plate .pmeta { height: 26px; font-size: 13px; }
html.tc-wide #game > .plate .caps svg { width: 24px; height: 24px; flex: 0 1 24px; min-width: 8px; margin-left: -10px; }
html.tc-wide #game > .plate .caps svg:first-child { margin-left: 0; }
html.tc-wide #game > .plate .pturn { font-size: 14px; min-width: 60px; }
html.tc-wide #game > .plate .pscore { font-size: 24px; }
/* rank and file letters grow a little with the squares */
html.tc-wide #grid .sq .lbl { font-size: clamp(11px, calc(var(--cell) * .135), 15px); }
html.tc-wide #grid .sq .lbl.rk { left: 3px; top: 3px; }
html.tc-wide #grid .sq .lbl.fl { right: 3px; bottom: 3px; }
html.tc-wide #grid .sq.cap::after { border-width: max(4px, calc(var(--cell) * .06)); }
/* buttons: a full 52 px */
html.tc-wide #game .actions .btn:not(#\9#\9#\9) { min-height: 52px; font-size: 15px; }
html.tc-wide #game .drawbar .btn:not(#\9#\9#\9) { min-height: 44px; }
html.tc-wide #game > #status:not(#\9#\9#\9) { font-size: 17px; }

/* ---------------------------------------------------------------- tall: the phone's stack, bigger */
html.tc-wide.tcw-tall #app > #game:not(.hidden) { justify-content: center; }
html.tc-wide.tcw-tall #game > .topbar { width: var(--bw); max-width: 100%; }
html.tc-wide.tcw-tall #game > .strip:not(#\9#\9#\9) { height: 36px; font-size: 15px; padding-top: 7px; }

/* ---------------------------------------------------------------- wide and fold: board + side panel (a grid; no node moves) */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app > #game:not(.hidden):not(#\9#\9) {
  display: grid; row-gap: 0; align-items: start; justify-items: stretch;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto auto auto;
}
/* rows of the panel (top to bottom); a hidden part takes no room, so its row is 0 tall */
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > .topbar  { grid-row: 1; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #pTop    { grid-row: 2; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #status  { grid-row: 3; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #strip   { grid-row: 4; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #drawBar { grid-row: 5; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #actions { grid-row: 6; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #resultBar { grid-row: 7; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #shareBtn { grid-row: 8; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #pBot    { grid-row: 9; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > .boardwrap:not(#\9#\9#\9) { grid-row: 1 / -1; align-self: center; justify-self: center; margin: 0; }
/* the panel's parts fill the panel's width and keep 10 px apart */
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > :not(.boardwrap):not(#\9#\9#\9) { width: 100% !important; max-width: none; min-width: 0; margin-top: 10px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > .topbar:not(#\9#\9#\9) { margin-top: 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #status:not(#\9#\9#\9) { width: auto !important; justify-self: center; max-width: 100%; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #pBot:not(#\9#\9#\9) { align-self: end; }
/* the code chip / foe name may shrink in the narrow panel rather than push the buttons out */
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > .topbar #codeChip { min-width: 0; flex-shrink: 1; overflow: hidden; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > .topbar #codeText { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > .topbar .right { flex: none; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > .topbar #codeChip.foe:not(#\9#\9#\9) { letter-spacing: 0; gap: 4px; padding-left: 10px; padding-right: 10px; }
/* the move list: a scrolling column of numbered rows (1. e4 e5) filling the panel's spare height */
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #strip:not(#\9#\9#\9) {
  height: auto; align-self: stretch; min-height: 64px; overflow-x: hidden; overflow-y: auto; white-space: normal;
  display: grid; grid-template-columns: 2.6em minmax(0, 6.5em) minmax(0, 6.5em); justify-content: start; grid-auto-rows: min-content; align-content: start; row-gap: 3px; column-gap: 6px;
  padding: 8px 12px; font-size: 15px; line-height: 1.45;
}
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #strip .mn { margin: 0; text-align: right; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #strip .mv { justify-self: start; padding: 0 4px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #game > #strip .empty { grid-column: 1 / -1; line-height: 1.4; }

/* wide (landscape iPad): one centred block, board + panel, as tall as the board */
html.tc-wide.tcw-wide #app > #game:not(.hidden):not(#\9#\9) {
  flex: none; margin: auto; height: var(--bw);
  width: calc(var(--bw) + 24px + var(--tcwPanel)); max-width: none !important;
  grid-template-columns: var(--bw) var(--tcwPanel); column-gap: 24px;
}
html.tc-wide.tcw-wide #game > :not(.boardwrap) { grid-column: 2; }
html.tc-wide.tcw-wide #game > .boardwrap { grid-column: 1; }
html.tc-wide.tcw-wide.tcw-left #app > #game:not(.hidden):not(#\9#\9) { grid-template-columns: var(--tcwPanel) var(--bw); }
html.tc-wide.tcw-wide.tcw-left #game > :not(.boardwrap) { grid-column: 1; }
html.tc-wide.tcw-wide.tcw-left #game > .boardwrap { grid-column: 2; }

/* fold (Duo inner screen): board on one half, panel on the other, a hinge-wide gap between */
html.tc-wide.tcw-fold #app > #game:not(.hidden):not(#\9#\9) {
  flex: none; margin: auto 0; width: 100%; max-width: none !important; height: calc(var(--tcw-h) - 24px);
  grid-template-columns: minmax(0, 1fr) calc(var(--tcw-hinge-w) + 32px) minmax(0, 1fr); column-gap: 0;
}
html.tc-wide.tcw-fold #game > :not(.boardwrap) { grid-column: 3; }
html.tc-wide.tcw-fold #game > .boardwrap { grid-column: 1; }
html.tc-wide.tcw-fold.tcw-left #game > :not(.boardwrap) { grid-column: 1; }
html.tc-wide.tcw-fold.tcw-left #game > .boardwrap { grid-column: 3; }
/* the half is narrow: plates a little smaller there */
html.tc-wide.tcw-fold #game > .plate:not(#\9#\9#\9) { height: 58px; }
html.tc-wide.tcw-fold #game > .plate .av,
html.tc-wide.tcw-fold #game > .plate .av svg { width: 42px; height: 42px; }
