/* Siege Lines 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 cell size is set by layoutWide() in index.html (--cell); 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 the rules that must win carry :not(#\9#\9#\9) (3 more ids) and, where the rule they beat is !important, !important too.

   tall  (iPad portrait):   the phone stack, wider (game.json "column"); bigger cells; status a fixed height so a hint never
                            shrinks the board; the frame's bottom bar (Restart | Hint | Undo) at most 560 wide (shared/frame.css).
   wide  (iPad landscape):  top bar across; board on the left at full height; a side rail on the thumb side with the level
                            picker (previous | Level N | next), the level label, hearts and chips, the status (room for long hints) and the frame's
                            bottom bar stood on end, 52 tall, Undo on top (unified frame spec, Nov 29, 2026).
   fold  (Duo inner, 890x626, no hinge reported): the same as wide with a narrower rail.
   fold + a real hinge (html.tcw-hinge): board on one half, everything else on the other; nothing crosses the hinge.
   Victory / defeat sheets come up over the rail (wide, fold) so the solved board stays in view. */

/* ---------- 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 #app.tight .boardwrap:not(#\9#\9#\9) { margin-left: 0; margin-right: 0; }   /* layoutWide() never sets .tight; belt and braces */
html.tc-wide { --cw-rail: clamp(280px, 26vw, 340px); }
html.tc-wide.tcw-fold { --cw-rail: 276px; }
html.tc-wide #app .boardwrap { min-width: 0; min-height: 0; }
html.tc-wide .overlay > .sheet:not(#\9#\9#\9) { max-width: 560px; }
/* the unified frame (Nov 29, 2026): the top bar adds the top safe area itself and the bottom bar keeps 8 above the bottom one;
   on a wide window the bar sits on the column's own edges (16 in), not 8 px outside them as on a phone */
html.tc-wide #app > .tcf-bar:not(#\9#\9#\9) { margin: 0; }
/* ui.css turns the info panel into a slim dark well 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 panel 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: iPad portrait ---------- */
html.tc-wide.tcw-tall #app:not(#\9#\9#\9) { max-width: var(--tcw-col); gap: 10px; padding-left: 0; padding-right: 0;
  padding-top: 0; padding-bottom: 8px; }
html.tc-wide.tcw-tall #app .info #lvlLabel:not(#\9#\9#\9) { font-size: 18px !important; }
html.tc-wide.tcw-tall #app .status:not(#\9#\9#\9) { height: 84px; min-height: 84px; max-height: 84px; font-size: 16px; }
html.tc-wide.tcw-tall #app #lvlBar .tcf-levels:not(#\9#\9#\9) { margin-top: 0; }

/* ---------- wide and fold (no real hinge): top bar across, board left, rail on the thumb side ---------- */
html.tc-wide:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) #app:not(#\9#\9#\9) {
  display: grid; max-width: var(--tcw-col); width: 100%; margin: 0 auto;
  grid-template-columns: minmax(0, 1fr) var(--cw-rail);
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "board levels" "board info" "board status" "board controls";
  column-gap: 16px; row-gap: 10px;
  padding: 0 16px 4px; }
html.tc-wide.tcw-left:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) #app:not(#\9#\9#\9) {
  grid-template-columns: var(--cw-rail) minmax(0, 1fr);
  grid-template-areas: "top top" "levels board" "info board" "status board" "controls board"; }
html.tc-wide.tcw-fold:not(.tcw-hinge) #app:not(#\9#\9#\9) { column-gap: 12px; row-gap: 8px;
  padding-left: 12px; padding-right: 12px; padding-bottom: 0; }

/* ---------- fold with a real hinge: board 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 auto minmax(0, 1fr) auto;
  grid-template-areas: "board . top" "board . levels" "board . info" "board . status" "board . controls";
  row-gap: 8px; padding: 0 16px; }
html.tc-wide.tcw-fold.tcw-hinge.tcw-left #app:not(#\9#\9#\9) {
  grid-template-areas: "top . board" "levels . board" "info . board" "status . board" "controls . board"; }

/* ---------- the regions in a grid layout (wide, fold) ---------- */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app > .tcf-bar:not(#\9#\9#\9) { grid-area: top; min-width: 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #lvlBar:not(#\9#\9#\9) { grid-area: levels; min-width: 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #lvlBar .tcf-levels:not(#\9#\9#\9) { margin: 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .boardwrap:not(#\9#\9#\9) { grid-area: board; align-self: stretch; justify-self: stretch; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .info:not(#\9#\9#\9) { grid-area: info; min-width: 0;
  grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "chips"; gap: 8px; padding: 4px 4px 6px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .info #lvlLabel:not(#\9#\9#\9) { font-size: 17px !important; text-align: center; white-space: nowrap; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .info .chips:not(#\9#\9#\9) { justify-content: center; flex-wrap: wrap; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .status:not(#\9#\9#\9) { grid-area: status; height: auto; min-height: 0; max-height: none;
  font-size: 16px; line-height: 1.4; padding: 4px 6px; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .status.hint:not(#\9#\9#\9) { max-height: none; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app .status:not(#\9#\9#\9) > span { margin: 6px 0 0; }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #btns:not(#\9#\9#\9) { grid-area: controls; min-width: 0; }
/* the spec (iPad landscape): the bottom bar's buttons stand in the side rail, 52 tall, in reverse order (Undo on top, Restart last) */
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #btns .tcf-actions:not(#\9#\9#\9) { flex-direction: column-reverse; max-width: none; padding: 0; margin: 0 0 calc(8px + env(safe-area-inset-bottom)); }
html.tc-wide:is(.tcw-wide, .tcw-fold) #app #btns .tcf-actions > .tcf-plate:not(#\9#\9#\9) { --bh: 52px; flex: none; width: 100%; }
html.tc-wide.tcw-fold #app .status:not(#\9#\9#\9) { font-size: 15px; }

/* ---------- sheets on a wide window ---------- */
/* level list, how to play, settings, leave: centred on the screen */
html.tc-wide:is(.tcw-wide, .tcw-fold) .overlay:not(#\9#\9#\9) { align-items: center; }
/* victory / defeat: over the rail, so the solved board stays in view */
html.tc-wide:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) :is(#winOverlay, #loseOverlay):not(#\9#\9#\9) {
  justify-content: flex-end; padding-right: max(10px, calc(var(--tcw-colR, 0px) + 8px)); }
html.tc-wide.tcw-left:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) :is(#winOverlay, #loseOverlay):not(#\9#\9#\9) {
  justify-content: flex-start; padding-left: max(16px, calc(var(--tcw-colL, 0px) + 8px)); padding-right: 10px; }
html.tc-wide:is(.tcw-wide, .tcw-fold):not(.tcw-hinge) :is(#winOverlay, #loseOverlay) > .sheet:not(#\9#\9#\9) {
  max-width: calc(var(--cw-rail, 300px) + 16px); }
/* with a real hinge the sheets keep to the half away from the board */
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); }
