/* Plunder 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 tile size comes from fitWide() in index.html; these rules only place the
   regions. ui.css uses :not(#\9#\9) selectors (up to four ids with the tool ids) and the page's touch pass uses !important, so the
   rules that must win here carry five more (:not(#\9#\9#\9#\9#\9)) and, where the rule they beat is !important, !important too.

   tall  (iPad portrait):   the phone stack, wider (game.json "column"): bigger counters and tools, the board takes the rest;
                            the layout list two cards across.
   wide  (iPad landscape):  top bar across; the board on the left at full height; a side rail on the thumb side holding the
                            counters (one per row) at the top and the frame's bottom bar at the bottom, near the thumb, its
                            buttons stacked 52 tall, Undo / Shuffle / Hint top to bottom (the phone order reversed, spec).
   Unified frame (Nov 29, 2026): the top bar is the frame's (#hdr), the tools are the frame's bottom bar (#btns .tcf-actions),
   the ☰ panel, the How to play card and the confirm card are the frame's sheets.
                            The layout list three cards across.
   fold  (Duo inner, 890x626): the same as wide with a narrower rail.
   fold + a real hinge (html.tcw-hinge): board on one half, the rail on the other.
   Pop-ups stay centred; the win sheet is wider with its three buttons side by side. */

/* ---------- every wide mode ---------- */
/* 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 740 px tall, 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; }
html.tc-wide { --sp-rail: clamp(250px, 24vw, 300px); }
html.tc-wide.tcw-fold { --sp-rail: 216px; --fm-px: 8px; }
html.tc-wide #app #boardWrap:not(#\9#\9#\9#\9#\9) { min-width: 0; min-height: 0; }
/* the frame's bar: iPad margins 24 (spec); the bottom bar's buttons 52 tall in the rail */
html.tc-wide #app > #hdr:not(#\9#\9#\9#\9#\9) { padding-left: 24px; padding-right: 24px; }
html.tc-wide #app .stat b:not(#\9#\9#\9#\9#\9) { font-size: 21px; }
html.tc-wide #app .stat small:not(#\9#\9#\9#\9#\9) { font-size: 12px; }
/* ui.css tightens the console below 740 px tall (short phones); that also hits an iPad in landscape with
   Safari's bars and the Duo's inner screen: keep the full sizes there (the frame's top bar does not shrink) */
@media (max-height: 740px) {
  html.tc-wide #app .hud:not(#\9#\9#\9#\9#\9) { border-width: 12px; box-shadow: var(--ui-panel-shadow); gap: 5px 6px; padding: 0 2px 2px;
    --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 .hud > * { --ui-img-well: var(--tcwk-well); --ui-well-slice: var(--tcwk-well-slice); --ui-well-bw: var(--tcwk-well-bw); }
}

/* ---------- the layout list (every wide mode) ---------- */
html.tc-wide #app #picker:not(#\9#\9#\9#\9#\9) { padding-left: 8px; padding-right: 8px; gap: 14px; }
html.tc-wide #app .hero:not(#\9#\9#\9#\9#\9) { padding-top: 10px; }
html.tc-wide #app .hero h2:not(#\9#\9#\9#\9#\9) { font-size: 52px; }
html.tc-wide #app .hero p:not(#\9#\9#\9#\9#\9) { font-size: 16px; max-width: 640px; margin-left: auto; margin-right: auto; }
html.tc-wide #app .pickbtns:not(#\9#\9#\9#\9#\9) { width: 100%; max-width: 560px; margin: 0 auto; }
html.tc-wide #app .cards:not(#\9#\9#\9#\9#\9) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .cards:not(#\9#\9#\9#\9#\9) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html.tc-wide.tcw-fold #app .cards:not(#\9#\9#\9#\9#\9) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.tc-wide #app .cards .card:not(#\9#\9#\9#\9#\9) { min-height: 96px; }

/* ---------- tall: iPad portrait ---------- */
html.tc-wide.tcw-tall #app:not(#\9#\9#\9#\9#\9) { max-width: var(--tcw-col); gap: 10px;
  padding-left: 0; padding-right: 0; padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
html.tc-wide.tcw-tall #app #game:not(#\9#\9#\9#\9#\9) { gap: 10px; }
/* #app has no side padding here: the bar and the bottom bar keep 24 from the sides themselves */
html.tc-wide.tcw-tall #app > #hdr:not(#\9#\9#\9#\9#\9) { margin-left: 0; margin-right: 0; }
html.tc-wide.tcw-tall #app #btns .tcf-actions:not(#\9#\9#\9#\9#\9) { padding: 0 24px; }
html.tc-wide.tcw-tall #app .stat:not(#\9#\9#\9#\9#\9) { min-height: 36px; }

/* ---------- wide and fold (no real hinge): top bar across, board left, rail on the thumb side ---------- */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app:not(#\9#\9#\9#\9#\9) { max-width: var(--tcw-col); width: 100%;
  padding-left: 16px; padding-right: 16px; padding-bottom: calc(env(safe-area-inset-bottom) + 12px); --fm-px: 16px; }
html.tc-wide.tcw-fold #app:not(#\9#\9#\9#\9#\9) { padding-left: 8px; padding-right: 8px; padding-bottom: calc(env(safe-area-inset-bottom) + 8px); --fm-px: 8px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app > #hdr:not(#\9#\9#\9#\9#\9) { margin-left: -16px; margin-right: -16px; }
html.tc-wide.tcw-fold #app > #hdr:not(#\9#\9#\9#\9#\9) { margin-left: -8px; margin-right: -8px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #game:not(#\9#\9#\9#\9#\9) {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--sp-rail); grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "board hud" "board btns"; column-gap: 16px; row-gap: 8px; }
html.tc-wide.tcw-left:is(.tcw-wide, .tcw-fold) #app #game:not(#\9#\9#\9#\9#\9) {
  grid-template-columns: var(--sp-rail) minmax(0, 1fr); grid-template-areas: "hud board" "btns board"; }
html.tc-wide.tcw-fold #app #game:not(#\9#\9#\9#\9#\9) { column-gap: 10px; }
/* fold with a real hinge: the board on one half, the rail on the other; nothing crosses the hinge */
html.tc-wide.tcw-fold.tcw-hinge #app:not(#\9#\9#\9#\9#\9) { max-width: none; margin: 0; }
html.tc-wide.tcw-fold.tcw-hinge #app #game:not(#\9#\9#\9#\9#\9) {
  grid-template-columns: minmax(0, 1fr) calc(var(--tcw-hinge-w) + 24px) minmax(0, 1fr); grid-template-areas: "board . hud" "board . btns"; column-gap: 0; }
html.tc-wide.tcw-fold.tcw-hinge.tcw-left #app #game:not(#\9#\9#\9#\9#\9) { grid-template-areas: "hud . board" "btns . board"; }
/* the regions */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #boardWrap:not(#\9#\9#\9#\9#\9) { grid-area: board; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .hud:not(#\9#\9#\9#\9#\9) { grid-area: hud; min-width: 0; min-height: 0;
  grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto auto minmax(0, 1fr); gap: 8px; padding: 6px 4px 6px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .hud .stat:not(#\9#\9#\9#\9#\9) { min-height: 52px; justify-content: space-between; padding: 0 12px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .hud .stat b:not(#\9#\9#\9#\9#\9) { font-size: 26px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .hud .stat small:not(#\9#\9#\9#\9#\9) { font-size: 13px; }
/* the frame's bottom bar in the rail: one button per row, 52 tall, 8 apart, the phone order reversed (Undo on top) */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #btns:not(#\9#\9#\9#\9#\9) { grid-area: btns; min-width: 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #btns .tcf-actions:not(#\9#\9#\9#\9#\9) { flex-direction: column-reverse; max-width: none; padding: 0; margin: 0; gap: 8px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #btns .tcf-actions > .tcf-plate:not(#\9#\9#\9#\9#\9) { --bh: 52px; flex: none; width: 100%; }
html.tc-wide.tcw-fold #app .hud .stat:not(#\9#\9#\9#\9#\9) { min-height: 46px; padding: 0 8px; }
html.tc-wide.tcw-fold #app .hud .stat b:not(#\9#\9#\9#\9#\9) { font-size: 22px; }
/* the toast sits above the tools in the phone column; on a wide window it goes over the board's middle-bottom */
html.tc-wide:is(.tcw-wide, .tcw-fold) #toast:not(#\9#\9#\9#\9#\9) { bottom: calc(env(safe-area-inset-bottom) + 28px); }

/* ---------- pop-ups ---------- */
html.tc-wide .overlay > .sheet:not(#\9#\9#\9#\9#\9) { max-width: 560px; }
html.tc-wide #winOv > .sheet:not(#\9#\9#\9#\9#\9) { max-width: 640px; }
html.tc-wide #winOv .stack:not(#\9#\9#\9#\9#\9) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
html.tc-wide #winOv .stack:has(#wNext.hidden):not(#\9#\9#\9#\9#\9) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
