/* Four in a Row on wide screens (iPad, the Duo's inner screen). Nov 26, 2026. Contract: docs/ipad-duo/GAME-WORKER-GUIDE.md.
   Only in --wide builds, linked last with the gate's media query; every rule starts with html.tc-wide, so a phone never
   applies a line. Level "split" (game.json): #game is the root; .topbar, .players, #status, #resultBar, .boardwrap and
   #lobbyActions are its direct children. The hole size comes from the TCWide script in index.html (--tcw4-cell).
     tall (iPad portrait):   the phone stack, wider; board as big as the column and the height allow, centred below.
     wide (iPad landscape):  board on the left with the whole height; top bar, players, status, result bar on the right.
     fold (Duo inner):       board on one half, everything else on the other; nothing crosses the hinge.
   The lobby: one centred column in tall mode, two columns (crest and play buttons | battle code card) in wide and fold. */

/* ------------------------------------------------------------------ hole size (falls back to the phone formula) */
html.tc-wide { --cell: var(--tcw4-cell, max(44px, min(calc((min(100vw, 520px) - 62px) / 7), calc((var(--tcvh,100dvh) - 330px) / 6)))); }
/* the board block's width: 7 holes, 6 gaps of 5, 8 padding and 5 frame each side */
html.tc-wide { --tcw4-board: calc(var(--cell) * 7 + 56px); }

/* ------------------------------------------------------------------ lobby */
html.tc-wide #app > #home { width: 100%; max-width: 560px; margin: 0 auto; justify-content: center; }
/* iPad portrait: a roomier lobby (wider card, bigger title and coins; 112 px coins are 2 device px per art px on a 2x iPad) */
html.tc-wide.tcw-tall #app > #home { max-width: 640px; gap: 18px; }
html.tc-wide.tcw-tall #home h1 { font-size: 46px; }
html.tc-wide.tcw-tall #home .pick { width: 200px; }
html.tc-wide.tcw-tall #home .pick svg { width: 112px; height: 112px; }
html.tc-wide.tcw-tall #home .crest .vs { margin-top: 64px; font-size: 26px; }
html.tc-wide.tcw-wide #app > #home,
html.tc-wide.tcw-fold #app > #home {
  max-width: 1000px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 40px; row-gap: 12px;
  align-content: center; padding-top: 0; }
html.tc-wide.tcw-wide #home > div:not(.card),
html.tc-wide.tcw-fold #home > div:not(.card) { grid-column: 1; grid-row: 2; }
html.tc-wide.tcw-wide #home > #cpuBtn,
html.tc-wide.tcw-fold #home > #cpuBtn { grid-column: 1; grid-row: 3; }
html.tc-wide.tcw-wide #home > #localBtn,
html.tc-wide.tcw-fold #home > #localBtn { grid-column: 1; grid-row: 4; }
html.tc-wide.tcw-wide #home > .card,
html.tc-wide.tcw-fold #home > .card { grid-column: 2; grid-row: 1 / span 4; align-self: end; }
/* fold: the two lobby columns are the two halves of the screen */
html.tc-wide.tcw-fold #app { padding-left: 0; padding-right: 0; }
html.tc-wide.tcw-fold #app > #home { max-width: none; width: var(--tcw-w); padding: 0 16px; column-gap: calc(var(--tcw-hinge-w) + 32px); }

/* ------------------------------------------------------------------ play screen, all wide modes */
/* a touch bigger names, coins and score than the phone (not in fold: that half is phone-sized) */
html.tc-wide:not(.tcw-fold) #game .pcard svg { width: 48px; height: 48px; }
html.tc-wide:not(.tcw-fold) #game .pcard .nm { font-size: 17px; }
html.tc-wide:not(.tcw-fold) #game .pcard .meta { font-size: 13px; }
html.tc-wide:not(.tcw-fold) #game .score { font-size: 24px; }
html.tc-wide:not(.tcw-fold) #game #status.status:not(#\9#\9#\9) { font-size: 17px; min-width: 260px; }

/* ------------------------------------------------------------------ tall: the phone stack, as wide as the board */
html.tc-wide.tcw-tall #game > .topbar,
html.tc-wide.tcw-tall #game > .players,
html.tc-wide.tcw-tall #game > #resultBar,
html.tc-wide.tcw-tall #game > #lobbyActions { width: 100%; max-width: max(520px, var(--tcw4-board)); align-self: center; }

/* ------------------------------------------------------------------ wide: board left (full height), panel right */
html.tc-wide.tcw-split.tcw-wide #game > [data-tcw="top"] { grid-row: 1; grid-column: 2; flex-wrap: wrap; row-gap: 8px; }
html.tc-wide.tcw-split.tcw-wide.tcw-left #game > [data-tcw="top"] { grid-column: 1; }
/* the panel is narrower than a phone: the code / foe chip across it (Leave and the music button left for the frame's top bar, Nov 29, 2026) */
html.tc-wide.tcw-wide #game > .topbar > .right { display: contents; }
html.tc-wide.tcw-wide #game > .topbar > .right > #codeChip { flex: 1 1 100%; justify-content: center; }
html.tc-wide.tcw-wide #game > .topbar > .right > #codeChip[style*="hidden"] { display: none; }
/* the frame's top bar sits above the play screen (#app, outside #game; Nov 29, 2026). Landscape and the Duo: across the window,
   16 in from the safe edges (as on a phone), and the board side keeps the rest of the height (index.html fit()). iPad portrait:
   as wide as the stack below it. */
html.tc-wide.tcw-tall #app > #tcfBar { width: 100%; max-width: max(520px, var(--tcw4-board)); align-self: center;
  margin-left: auto; margin-right: auto; padding-left: 0; padding-right: 0; }
html.tc-wide.tcw-split.tcw-wide #game > [data-tcw="board"] { grid-row: 1 / -1; }
html.tc-wide.tcw-wide #game > .players { grid-template-columns: 1fr; gap: 8px; }
html.tc-wide.tcw-wide #game > .players > .score { padding: 2px 0; }
/* the result bar in the panel: title and button on one line each */
html.tc-wide.tcw-wide #game > #resultBar h2 { font-size: 20px; }
html.tc-wide.tcw-wide #game > #resultBar #readyBtn:not(#\9#\9#\9) { font-size: 14px; letter-spacing: 0; padding-left: 8px; padding-right: 8px; white-space: nowrap; }

/* wide and fold: the board is centred in its side, its ghost row and legs inside its box */
html.tc-wide.tcw-wide #game > .boardwrap,
html.tc-wide.tcw-fold #game > .boardwrap { margin: calc(var(--cell) + 4px) 0 14px; }
html.tc-wide.tcw-wide #game > #lobbyActions,
html.tc-wide.tcw-fold #game > #lobbyActions { margin-top: 0; padding-top: 0; }

/* ------------------------------------------------------------------ fold: board half | hinge | panel half */
html.tc-wide.tcw-split.tcw-fold #game[data-tcw="root"]:not(.hidden) { padding: 0 16px; column-gap: 0; }
