/* games/_menu/wide.css — the home page (game list, and the Kingdom's "List view") on wide screens. Nov 26, 2026.
   game.json: "wide": { "level": "column", "root": "#app", "column": 780, "columnWide": 1120 }
   Phones: never applied (media-gated link, html.tc-wide scope). The tiles, their art and their order do not change. */

/* the game tiles go two across in portrait (from a 652 px column: every iPad), three across from about 1000 wide; the fold puts one column on each half */
html.tc-wide #app > nav.games { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; flex: none; }
html.tc-wide.tcw-fold #app > nav.games { grid-template-columns: 1fr 1fr; column-gap: calc(var(--tcw-hinge-w) + 32px); }
html.tc-wide.tcw-fold #app { max-width: none !important; width: var(--tcw-w); }
/* a tile keeps its phone size: the extra room is more tiles per row, not bigger art (art stays at whole pixels) */
html.tc-wide #app > nav.games > a.game { min-height: 92px; }
/* header: a little more air, same pictures */
html.tc-wide #app > header { padding-top: 8px; }
html.tc-wide #app > a.tourney { max-width: 520px; width: 100%; align-self: center; }
/* the Stronghold card meta.js puts above the tiles, and the offline buttons: phone width, centred */
html.tc-wide #app > .tcm-base, html.tc-wide #app > #tcoRow { max-width: 520px; width: 100%; align-self: center; }

/* The Kingdom start page (shared/city.js over the home page) and the Stronghold page (games/hub) on wide screens. Nov 26, 2026.
   This part lives in games/_menu/wide.css (the city is drawn on the home page); the Stronghold part is games/hub/wide.css.
   The city canvas itself is sized by city.js (sizeStage). On wide screens the build adds the city.js hook (ENGINE.md 7.2): whole device pixels per art pixel where that
   costs under 15% of the size, else the biggest fit (no 620 cap).
   Either way all buildings stay on one screen: the logical scene is still 384 wide and 520-860 tall. */

/* the stage around the canvas: sky above the horizon, land below, then the skin's wing pictures, instead of a flat colour.
   --tcw-colL is the canvas's left edge (TC_WIDE.measure = "#tccWrap"), so the wing pictures touch the scene.
   The wing pictures are named here, relative to this file (served at <edition>/_menu/wide.css), so each skin loads its own
   <edition>/theme/wide/city-wing-l.png and -r.png (packs/themes/<skin>/files/wide/). Not through --tcw-img-city-wing-*: a url() taken
   from a variable resolves against the stylesheet that uses it, here _menu/, so it asked for _menu/theme/wide/... (404).
   Size and place: see the next comment (each piece is 320 x 546 art px at the canvas's own density, horizon on row 176). */
html.tc-wide #tccStage {
  align-items: center; image-rendering: pixelated; }
/* The side pieces follow the scene at every canvas height (final check, Nov 26, 2026). The pieces are the scene at 384 x 546 art px
   (horizon row 176). city.js geom() and drawGround() do not crop the scene for another height SH, they redraw it:
     the sky picture keeps its scale and sits on GY + round(10 Z); the ground (tiles, tree line, haze) is drawn at zoom Z, anchored on the
     horizon GY and scaled about the canvas centre (the tile field is centred), with Z = min(1, (SH - 176) / 400) and GY = max(176, SH - 400)
     (every SH under 616: all iPads, the Duo and Split View). At SH 546, Z = 0.925.
   So each piece is drawn twice:
     1. the sky (this background): at the canvas scale s = canvas width / 384, moved down by s * (GY + round(10 Z) - 185);
        here 100% in background-position-y is the stage height minus the piece height (546 s), and the stage is the canvas height;
     2. the ground (#tccWrap::before / ::after below): from art row 180 down, at the ground's own scale s * Z / 0.925, bottom on the
        canvas bottom (true for every SH under 616), moved so the canvas centre lines up, never over the canvas.
   At SH 546 (iPad Air landscape, Pro 13 portrait) both are exactly the old placement. */
html.tc-wide #tccStage {
  --tcc-s: calc((100vw - var(--tcw-colL, 0px) - var(--tcw-colR, 0px)) / 384);
  --tcc-sky: max(calc(100% - 29 * var(--tcc-s)), clamp(0px, calc((100% - 9.5 * var(--tcc-s)) * 1000), var(--tcc-s)));
  background:
    url(../theme/wide/city-wing-l.png) right calc(100vw - var(--tcw-colL, 0px)) top var(--tcc-sky) / calc(320 * var(--tcc-s)) auto no-repeat,
    url(../theme/wide/city-wing-r.png) left calc(100vw - var(--tcw-colR, 0px)) top var(--tcc-sky) / calc(320 * var(--tcc-s)) auto no-repeat,
    linear-gradient(var(--sky1, #5aa8ec), var(--sky2, #d8f0ff) 34%, var(--g1, #5a9a3e) 35%, var(--g2, #3f7a2c)) !important; }
html.tc-wide #tccWrap::before, html.tc-wide #tccWrap::after {
  --tcc-s: calc((100vw - var(--tcw-colL, 0px) - var(--tcw-colR, 0px)) / 384);
  --tcc-in: max(0px, calc(192 * var(--tcc-s) - 60%));   /* how far the piece reaches in behind the canvas (192 s - 192 K) */
  content: ""; position: absolute; bottom: 0; pointer-events: none; image-rendering: pixelated;
  height: min(calc(546 * 400 / 370 * var(--tcc-s)), calc((100% - 176 * var(--tcc-s)) * 546 / 370)); aspect-ratio: 320 / 546;
  background: 0 0 / 100% 100% no-repeat;
  -webkit-mask-image: linear-gradient(transparent 32.967%, #000 32.967%); mask-image: linear-gradient(transparent 32.967%, #000 32.967%); }   /* rows 180+ of 546 */
html.tc-wide #tccWrap::before { right: 100%; background-image: url(../theme/wide/city-wing-l.png);
  transform: translateX(var(--tcc-in)); clip-path: inset(0 var(--tcc-in) 0 0); }
html.tc-wide #tccWrap::after { left: 100%; background-image: url(../theme/wide/city-wing-r.png);
  transform: translateX(calc(-1 * var(--tcc-in))); clip-path: inset(0 0 0 var(--tcc-in)); }
/* Night (Nov 26, 2026): city.js draws the dusk sky from 19:00 to 06:00 (its own sky-dusk picture, and the ground takes a little of
   that sky's colour). The index.html script puts html.tcw-night on for exactly those hours while the wide engine is on, and the
   pieces swap to their night versions: the same size and placement, the sky outpainted from the dusk scene, the ground the day
   ground with the scene's own tint (0.8 x day + the dusk haze per row). Same file names relative to this file, so each skin
   loads its own (packs/themes/<skin>/files/wide/city-wing-l-night.png, -r-night.png). */
html.tc-wide.tcw-night #tccStage {
  background-image: url(../theme/wide/city-wing-l-night.png), url(../theme/wide/city-wing-r-night.png),
    linear-gradient(var(--sky1, #5aa8ec), var(--sky2, #d8f0ff) 34%, var(--g1, #5a9a3e) 35%, var(--g2, #3f7a2c)) !important; }
html.tc-wide.tcw-night #tccWrap::before { background-image: url(../theme/wide/city-wing-l-night.png); }
html.tc-wide.tcw-night #tccWrap::after { background-image: url(../theme/wide/city-wing-r-night.png); }
/* the top row (gold, rank, Arrange, Daily board, List view) stays over the scene, not stretched across a 1366 pt screen */
html.tc-wide #tcc .tcc-bar { left: var(--tcw-colL, 0px) !important; right: var(--tcw-colR, 0px) !important; }
/* building sheet: in landscape it slides in on the thumb side as a side panel, the scene stays visible */
html.tc-wide.tcw-wide #tccS .sheet, html.tc-wide.tcw-fold #tccS .sheet {
  left: auto !important; right: var(--tcw-x, 0px); top: 0; bottom: 0; width: min(420px, 40vw) !important; max-height: none !important;
  border-radius: 22px 0 0 22px !important; transform: translateX(105%) !important; padding-top: calc(env(safe-area-inset-top) + 14px) !important; }
html.tc-wide.tcw-wide #tccS .sheet.on, html.tc-wide.tcw-fold #tccS .sheet.on { transform: translateX(0) !important; }
html.tc-wide.tcw-left.tcw-wide #tccS .sheet { right: auto !important; left: var(--tcw-x, 0px) !important; border-radius: 0 22px 22px 0 !important; transform: translateX(-105%) !important; }
html.tc-wide.tcw-left.tcw-wide #tccS .sheet.on { transform: translateX(0) !important; }
/* fold: the sheet takes exactly the other half */
html.tc-wide.tcw-fold #tccS .sheet { width: calc((var(--tcw-w) - var(--tcw-hinge-w)) / 2) !important; }
/* rooms (building interiors) keep the scene's column width */
html.tc-wide #tccRoom .rc { max-width: calc(100vw - var(--tcw-colL, 0px) - var(--tcw-colR, 0px)); margin: 0 auto; }

