/* Warpaths 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): #app is the root; #hdr (the frame's top bar), #lvlBar (the frame's level picker), .info, #wrap (the board),
   #status and #btns (the frame's bottom bar: Clear | Hint) are its direct children (unified frame, Nov 29, 2026).
   The cell size comes from layoutWide() in index.html (it fills #wrap, cap 141 px, coins on whole device pixels when that costs < 15%).
     tall (iPad portrait):   the phone stack, wider and with bigger words and buttons; the board as big as the column and height allow.
     wide (iPad landscape):  the board on the left with the whole height; top bar, level picker, console, status and Clear / Hint in the
                             side panel (on the left with the left-hand setting).
     fold (Duo inner):       the board on one half, everything else on the other; nothing crosses the hinge.
   Pop-ups: the level list is a wide sheet in the middle (on the panel half in fold); the victory sheet sits over the
   panel (wide, fold) or at the bottom (tall), so the won board stays in view. Help and Menu are the frame's own sheets. */

/* ------------------------------------------------------------------ all wide modes */
/* Skin art (fix, Nov 26): a wide.css never names a skin picture, not even through var(--ui-img-*): a url() taken from a
   variable is resolved against THIS file's folder, which on /outpost/ and /magic/ is the Pixel theme. To give a panel back its
   frame below the short-screen height, the short-screen rule of ui/ui.css keeps drawing its own border-image (so the url is
   resolved by ui.css, in this skin's folder) and only its well variables are pointed at the panel ones on that element. The
   children get the well back from these copies taken on <html>. */
html.tc-wide { --tcwk-well: var(--ui-img-well); --tcwk-well-slice: var(--ui-well-slice); --tcwk-well-bw: var(--ui-well-bw); }
/* the shared filler's fallback tile is a skin variable used from shared/wide.css, so it would load another skin's tile (or a 404):
   drop that fallback here; a skin's own wide backdrop (--tcw-img-backdrop, written by the build) still shows, else the theme's own
   page backdrop shows through */
html.tc-wide #tcWideBg .tcw-fill { --ui-img-bg-tile: none; background-color: transparent; }
/* the board region fills its grid cell / flex slot so layoutWide() can measure the room it has */
html.tc-wide #app > #wrap { min-width: 0; min-height: 0; }
/* the token that follows the mouse grows with the board (set by layoutWide) */
html.tc-wide #ghostTok { width: var(--wp-ghost, 30px); height: var(--wp-ghost, 30px); }
/* bigger words in the console and the status line */
html.tc-wide #app #lvlLabel:not(#\9#\9#\9) { font-size: 17px; }
html.tc-wide #app .chip:not(#\9#\9#\9) { font-size: 14.5px; }
html.tc-wide #app > #status { font-size: 16.5px; min-height: 44px; }

/* the skin's "short phone" rules (@media (max-height:740px) in ui/ui.css) also match an iPad in landscape with Safari's bars and the
   Duo's inner screen: keep the normal console frame there */
@media (max-height: 740px) {
  html.tc-wide #app > .info:not(#\9#\9#\9) { border-width: 12px; box-shadow: var(--ui-panel-shadow);
    --ui-img-well: var(--ui-img-panel); --ui-well-slice: var(--ui-panel-slice); --ui-well-bw: var(--ui-panel-bw); }
  html.tc-wide #app > .info > * { --ui-img-well: var(--tcwk-well); --ui-well-slice: var(--tcwk-well-slice); --ui-well-bw: var(--tcwk-well-bw); }
}

/* ------------------------------------------------------------------ tall: the phone stack, bigger */
html.tc-wide.tcw-tall #app > .info,
html.tc-wide.tcw-tall #app > #status { width: calc(100% - 24px); max-width: 760px; align-self: center; }
html.tc-wide.tcw-tall #app #lvlLabel:not(#\9#\9#\9) { font-size: 19px; }
html.tc-wide.tcw-tall #app .chip:not(#\9#\9#\9) { font-size: 15.5px; }
html.tc-wide.tcw-tall #app > #status { font-size: 18px; }
html.tc-wide.tcw-tall #hdr .tcf-plaque:not(#\9) { font-size: 22px; }
/* the bottom bar: at most 560 wide, centred (spec), 52 tall */
html.tc-wide.tcw-tall #btns .tcf-actions:not(#\9) { max-width: 560px; margin: 0 auto; padding: 0; }
html.tc-wide.tcw-tall #btns .tcf-actions > .tcf-plate:not(#\9) { --bh: 52px; font-size: 16px; }

/* ------------------------------------------------------------------ wide and fold: the side panel */
/* rows: top bar | space | level picker | console | status | Clear / Hint | space; the board spans them all */
html.tc-wide.tcw-split.tcw-wide #app[data-tcw="root"]:not(.hidden),
html.tc-wide.tcw-split.tcw-fold #app[data-tcw="root"]:not(.hidden) { grid-template-rows: auto minmax(0, 1fr) auto auto auto auto minmax(0, 1.4fr); row-gap: 12px; }
html.tc-wide.tcw-split.tcw-wide #app > [data-tcw="board"],
html.tc-wide.tcw-split.tcw-fold #app > [data-tcw="board"] { grid-row: 1 / -1; align-self: stretch; justify-self: stretch; }
html.tc-wide.tcw-split.tcw-wide #app > #hdr[data-tcw],
html.tc-wide.tcw-split.tcw-fold #app > #hdr[data-tcw] { grid-row: 1; }
html.tc-wide.tcw-split.tcw-wide #app > #hdr[data-tcw] { grid-column: 2; }
html.tc-wide.tcw-split.tcw-wide.tcw-left #app > #hdr[data-tcw] { grid-column: 1; }
html.tc-wide.tcw-split.tcw-wide #app > #lvlBar[data-tcw],
html.tc-wide.tcw-split.tcw-fold #app > #lvlBar[data-tcw] { grid-row: 3; margin: 0; }
html.tc-wide.tcw-split.tcw-wide #app > .info[data-tcw],
html.tc-wide.tcw-split.tcw-fold #app > .info[data-tcw] { grid-row: 4; margin: 0; }
html.tc-wide.tcw-split.tcw-wide #app > #status[data-tcw],
html.tc-wide.tcw-split.tcw-fold #app > #status[data-tcw] { grid-row: 5; margin: 0; }
html.tc-wide.tcw-split.tcw-wide #app > #btns[data-tcw],
html.tc-wide.tcw-split.tcw-fold #app > #btns[data-tcw] { grid-row: 6; margin: 0; }
/* the top bar sits in the panel, not across the screen (the frame shrinks the name and folds Back to its arrow if it must) */
html.tc-wide.tcw-split.tcw-wide #app > #hdr:not(#\9),
html.tc-wide.tcw-split.tcw-fold #app > #hdr:not(#\9) { margin: 0; padding-left: 0; padding-right: 0; }
/* the level picker fills the panel; Clear and Hint stand one above the other, 52 tall, the most-used (Hint) on top (spec) */
html.tc-wide.tcw-split:is(.tcw-wide, .tcw-fold) #lvlBar .tcf-levels:not(#\9) { margin: 0; }
html.tc-wide.tcw-split:is(.tcw-wide, .tcw-fold) #lvlBar .tcf-levels > .tcf-plate:not(#\9) { flex: 1 1 0; min-width: 0; }
html.tc-wide.tcw-split:is(.tcw-wide, .tcw-fold) #btns .tcf-actions:not(#\9) { flex-direction: column-reverse; max-width: none; margin: 0; padding: 0; }
html.tc-wide.tcw-split:is(.tcw-wide, .tcw-fold) #btns .tcf-actions > .tcf-plate:not(#\9) { --bh: 52px; flex: none; width: 100%; font-size: 16px; }
/* fold: phone-sized panel half, small side margins so it lines up with the board half */
html.tc-wide.tcw-split.tcw-fold #app[data-tcw="root"]:not(.hidden) { padding-left: 12px; padding-right: 12px; }

/* ------------------------------------------------------------------ pop-ups */
/* the level list: one row of ten shields per board size, a wide sheet in the middle */
html.tc-wide:not(.tcw-fold) #levelsOverlay:not(#\9) { align-items: center; }
html.tc-wide:not(.tcw-fold) #levelsOverlay > .sheet:not(#\9#\9#\9) { max-width: min(860px, calc(var(--tcw-w) - 48px)); padding-left: 24px; padding-right: 24px; }
html.tc-wide:not(.tcw-fold) #levelsOverlay .shields:not(#\9#\9#\9) { grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 10px 10px; }
html.tc-wide:not(.tcw-fold) #levelsOverlay .sheet h2:not(#\9#\9) { font-size: 26px; }
html.tc-wide:not(.tcw-fold) #levelsOverlay .sheet h3:not(#\9#\9) { font-size: 13px; }
/* victory, tall: the phone's bottom sheet, a little wider; the won board stays in view above it */
html.tc-wide.tcw-tall #winOverlay > .sheet:not(#\9#\9#\9) { max-width: 560px; }
/* victory, wide: over the side panel, centred in its height */
html.tc-wide.tcw-wide #winOverlay:not(#\9) { align-items: center; justify-content: flex-end; padding-right: calc(var(--tcw-colR, 0px) + 4px); }
html.tc-wide.tcw-wide.tcw-left #winOverlay:not(#\9) { justify-content: flex-start; padding-right: 12px; padding-left: calc(var(--tcw-colL, 0px) + 4px); }
html.tc-wide.tcw-wide #winOverlay > .sheet:not(#\9#\9#\9) { max-width: var(--tcw-panel, 340px); }
/* fold: every pop-up stays on the panel half */
html.tc-wide.tcw-fold .overlay:not(#\9) { align-items: center; justify-content: flex-end; padding-right: 12px; }
html.tc-wide.tcw-fold.tcw-left .overlay:not(#\9) { justify-content: flex-start; padding-right: 12px; padding-left: 12px; }
html.tc-wide.tcw-fold .overlay > .sheet:not(#\9#\9#\9) { max-width: calc((var(--tcw-w) - var(--tcw-hinge-w)) / 2 - 24px); }

/* the big VICTORY! words over the board, not over the panel or across the hinge */
html.tc-wide.tcw-wide #fxText { left: var(--tcw-colL, 0px); right: calc(var(--tcw-colR, 0px) + var(--tcw-panel, 340px) + 16px); }
html.tc-wide.tcw-wide.tcw-left #fxText { left: calc(var(--tcw-colL, 0px) + var(--tcw-panel, 340px) + 16px); right: var(--tcw-colR, 0px); }
html.tc-wide.tcw-fold #fxText { left: 0; right: calc(100% - var(--tcw-hinge-x)); font-size: 54px; }
html.tc-wide.tcw-fold.tcw-left #fxText { left: calc(var(--tcw-hinge-x) + var(--tcw-hinge-w)); right: 0; }
