/* Hold the Line on wide screens: iPad (portrait and landscape) and the Duo's inner screen. Nov 26, 2026.
   Contract: docs/ipad-duo/GAME-WORKER-GUIDE.md. Linked only in --wide builds, with the gate's media query, after the page CSS and the
   art pack's generated ui/ui.css. Every rule starts with html.tc-wide, so a phone never applies a line of it.
   ui.js (wideFit) places the stage, the wings (#htlWings) and the command panel (#htlPanel) in screen px and moves #hud, #sheet and
   #wavebtn into the panel during a battle. This file only styles them there. Specificity: ui.css uses :not(#\9#\9) boosters and the
   page's App Store block uses !important, so panel rules carry :not(#\9#\9#\9#\9) and, where the page pins a value, !important. */

/* ---------------------------------------------------------------- the map and the wings */
html.tc-wide #stage { box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), 0 0 18px 4px rgba(0, 0, 0, .55); }
/* in a battle the wings (art or the mirrored edge blend) touch the map left and right: no dark line down those joins, only the
   top and bottom edges keep the frame (final check, Nov 26, 2026). The shadows are in stage px (the stage is scaled), so a spread
   of minus the blur keeps the soft glow off the sides; the panel is "on" exactly when the wings are drawn (ui.js paintWings). */
html.tc-wide body:has(#htlPanel.on) #stage { box-shadow: 0 -1px 0 0 rgba(0, 0, 0, .7), 0 1px 0 0 rgba(0, 0, 0, .7),
  0 -16px 12px -12px rgba(0, 0, 0, .55), 0 16px 12px -12px rgba(0, 0, 0, .55); }
html.tc-wide #htlWings { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
html.tc-wide #htlWings > i { position: absolute; display: block; background-repeat: no-repeat; }
html.tc-wide #htlWings > i.art { image-rendering: pixelated; image-rendering: crisp-edges; }
html.tc-wide #htlWings > i.blend { image-rendering: auto; }

/* ---------------------------------------------------------------- the command panel */
html.tc-wide #htlPanel { position: absolute; z-index: 3; box-sizing: border-box; display: none; flex-direction: column; gap: 12px;
  padding: 10px; border-radius: 14px; background: rgba(14, 9, 6, .78); box-shadow: 0 0 0 1px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(255, 220, 160, .08), 0 6px 18px rgba(0, 0, 0, .5);
  font-size: 15px; touch-action: manipulation; }
html.tc-wide #htlPanel.on { display: flex; }
html.tc-wide #htlPanel > div { min-width: 0; }
html.tc-wide #htlPanel .hp-stats { flex: none; }
html.tc-wide #htlPanel .hp-sheet { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
html.tc-wide #htlPanel .hp-wave { flex: none; }
html.tc-wide #htlPanel .hp-tip { margin: auto 6px; text-align: center; font-size: 14px; line-height: 1.5; color: var(--ui-ink, #e8dcc0); opacity: .7; }
html.tc-wide #htlPanel #sheet:not(.hidden) + .hp-tip { display: none; }
/* pause and end screens (inside the map) own the taps: the panel rests */
html.tc-wide body:has(#pausescr:not(.hidden)) #htlPanel,
html.tc-wide body:has(#endscr:not(.hidden)) #htlPanel { pointer-events: none; filter: brightness(.55) saturate(.7); }

/* bottom dock (portrait, when it leaves the bigger map): the sheet on the left, stats and wave on the right */
html.tc-wide #htlPanel.on[data-lay="dock"] { display: grid; grid-template-columns: minmax(0, 1fr) 264px; grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "sheet stats" "sheet wave"; column-gap: 12px; row-gap: 10px; }
html.tc-wide #htlPanel[data-lay="dock"] .hp-stats { grid-area: stats; }
html.tc-wide #htlPanel[data-lay="dock"] .hp-sheet { grid-area: sheet; }
html.tc-wide #htlPanel[data-lay="dock"] .hp-wave { grid-area: wave; display: flex; flex-direction: column; justify-content: flex-end; }

/* ---------------------------------------------------------------- stats (the phone's HUD strip, as two plates) */
html.tc-wide #htlPanel #hud:not(#\9#\9#\9#\9) { position: relative; left: auto; top: auto; width: auto; height: auto; display: flex; flex-direction: column;
  align-items: stretch; gap: 8px; padding: 0; font-size: 17px; pointer-events: auto; z-index: auto; }
html.tc-wide #htlPanel #hud.hidden:not(#\9#\9#\9#\9) { display: none; }
html.tc-wide #htlPanel #hud::before,
html.tc-wide #htlPanel #hud .spacer { display: none; }
html.tc-wide #htlPanel #hud .pill:not(#\9#\9#\9#\9) { height: 52px; box-sizing: border-box; justify-content: space-between; gap: 10px !important;
  padding: 0 4px; border-width: 6px 10px 8px 10px !important; border-image-width: 8px 12px 12px 12px; border-radius: 0; box-shadow: none; }
html.tc-wide #htlPanel #hud .pill.r:not(#\9#\9#\9#\9) { gap: 6px !important; }
html.tc-wide #htlPanel #hud .pill.r .grp { margin-right: 0; }
html.tc-wide #htlPanel #hud .grp { gap: 6px; }
html.tc-wide #htlPanel #hud .grp:has(#keepbar) { flex: 1 1 auto; min-width: 0; }
html.tc-wide #htlPanel #hud .ico:not(#\9#\9#\9#\9) { width: 20px; height: 20px; }
html.tc-wide #htlPanel #gold:not(#\9#\9#\9#\9) { font-size: 20px; min-width: 52px !important; }
html.tc-wide #htlPanel #keepbar:not(#\9#\9#\9#\9) { flex: 1 1 auto; width: auto !important; height: 13px; }
html.tc-wide #htlPanel #wave:not(#\9#\9#\9#\9) { font-size: 17px; min-width: 34px !important; }
html.tc-wide #htlPanel #hud .hbtn:not(#\9#\9#\9#\9) { flex: 0 1 52px; width: auto; min-width: 38px; height: 36px; font-size: 16px; border-radius: 3px; }
html.tc-wide #htlPanel #hud .hbtn:not(#\9#\9#\9#\9)::after { left: -4px !important; right: -4px !important; top: -6px !important; bottom: -6px !important; }   /* 60 x 48 */

/* ---------------------------------------------------------------- the build / tower sheet, in the panel */
html.tc-wide #htlPanel #sheet:not(#\9#\9#\9#\9) { position: relative !important; left: auto !important; right: auto !important; top: auto !important;
  bottom: auto !important; width: 100%; box-sizing: border-box; z-index: auto; flex: none; }
html.tc-wide #htlPanel #sheet .hd:not(#\9#\9#\9#\9) { margin-bottom: 10px !important; font-size: 17px; min-height: 40px; }
html.tc-wide #htlPanel #sheet .x:not(#\9#\9#\9#\9) { width: 52px; height: 40px; font-size: 17px; }
html.tc-wide #htlPanel #sheet .x:not(#\9#\9#\9#\9)::after { inset: -4px !important; }
html.tc-wide #htlPanel #sheet .row:has(.tbtn):not(#\9#\9#\9#\9) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 8px !important; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .row:has(.tbtn):not(#\9#\9#\9#\9),
html.tc-wide #htlPanel[data-lay="fold"] #sheet .row:has(.tbtn):not(#\9#\9#\9#\9) { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px !important; }   /* one row of towers */
html.tc-wide #htlPanel #sheet .tbtn:not(#\9#\9#\9#\9) { height: 92px; min-width: 0; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .tbtn:not(#\9#\9#\9#\9) { height: 84px; }
html.tc-wide #htlPanel #sheet .tbtn i.spr.prev { zoom: 1.375; }   /* 32 x 48 previews at 44 x 66 */
html.tc-wide #htlPanel[data-lay="fold"] #sheet .tbtn:not(#\9#\9#\9#\9) { height: 84px; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .tbtn i.spr.prev,
html.tc-wide #htlPanel[data-lay="fold"] #sheet .tbtn i.spr.prev { zoom: 1.2; }
/* the dock is short: header and towers across, then the info beside the action buttons */
html.tc-wide #htlPanel[data-lay="dock"] #sheet:not(#\9#\9#\9#\9) { display: grid; grid-template-columns: minmax(0, 1fr) 176px; column-gap: 10px; align-items: start; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet.hidden:not(#\9#\9#\9#\9) { display: none; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet > .hd,
html.tc-wide #htlPanel[data-lay="dock"] #sheet > .row:has(.tbtn) { grid-column: 1 / -1; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .hd:not(#\9#\9#\9#\9) { margin-bottom: 6px !important; min-height: 34px; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .info:not(#\9#\9#\9#\9) { margin-top: 8px; font-size: 13px; line-height: 1.35; min-height: 40px; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .abtn:not(#\9#\9#\9#\9) { height: 48px !important; margin-top: 8px; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .row.acts:not(#\9#\9#\9#\9) { flex-direction: column; gap: 12px !important; }
html.tc-wide #htlPanel[data-lay="dock"] #sheet .row.acts > .abtn { flex: none !important; width: 100%; }
html.tc-wide #htlPanel #sheet .tbtn .c:not(#\9#\9#\9#\9) { font-size: 14px; }
html.tc-wide #htlPanel #sheet .info:not(#\9#\9#\9#\9) { font-size: 14px; line-height: 1.45; margin-top: 10px; min-height: 44px; }
html.tc-wide #htlPanel #sheet .abtn:not(#\9#\9#\9#\9) { height: 52px !important; font-size: 16px; margin-top: 10px; }
html.tc-wide #htlPanel #sheet .row.acts:not(#\9#\9#\9#\9) { gap: 22px !important; }
html.tc-wide #htlPanel[data-lay="side"] #sheet .row.acts:not(#\9#\9#\9#\9),
html.tc-wide #htlPanel[data-lay="fold"] #sheet .row.acts:not(#\9#\9#\9#\9) { flex-direction: column; gap: 14px !important; }   /* narrow panel: Upgrade above, Sell well below it */
html.tc-wide #htlPanel[data-lay="side"] #sheet .row.acts > .abtn,
html.tc-wide #htlPanel[data-lay="fold"] #sheet .row.acts > .abtn { flex: none !important; width: 100%; }

/* ---------------------------------------------------------------- the wave button */
html.tc-wide #htlPanel #wavebtn:not(#\9#\9#\9#\9) { position: relative !important; left: auto !important; right: auto !important; bottom: auto !important;
  width: 100%; min-height: 76px; box-sizing: border-box; padding: 4px 8px; }
html.tc-wide #htlPanel #wavebtn .l1:not(#\9#\9#\9#\9) { font-size: 17px; }
html.tc-wide #htlPanel #wavebtn .chips:not(#\9#\9#\9#\9) { gap: 5px; margin-top: 4px; }
html.tc-wide #htlPanel #wavebtn .chip:not(#\9#\9#\9#\9) { font-size: 14px; padding-right: 4px; }
html.tc-wide #htlPanel #wavebtn .chip .uico { zoom: 1.25; }
html.tc-wide #htlPanel #wavebtn .bar:not(#\9#\9#\9#\9) { height: 5px; margin-top: 5px; }

/* narrow docks (Split View halves): slimmer stats and action columns, so the tower info keeps its room */
@media (max-width: 719px) {
  html.tc-wide #htlPanel.on[data-lay="dock"] { grid-template-columns: minmax(0, 1fr) 232px; }
  html.tc-wide #htlPanel[data-lay="dock"] #sheet:not(#\9#\9#\9#\9) { grid-template-columns: minmax(0, 1fr) 148px; }
}

/* ---------------------------------------------------------------- phone-only rules that must not reach a wide screen */
/* 375-wide phones get a narrower seven-tower sheet (max-width: 389px): a wide window never matches it, nothing to undo. */

/* ---------------------------------------------------------------- the unified frame (Nov 29, 2026) */
/* Speed, the 44 pt kit square of the phone HUD, is 52 pt in the panel (frame spec: iPad buttons 52 tall); the frame's top bar stays
   at the top of the window (ui.js wideFit starts the map and the panel under it) */
html.tc-wide #htlPanel #hud #speed:not(#\9#\9#\9#\9) { position: relative; right: auto; top: auto; align-self: flex-end; width: 52px; height: 52px; margin: 0; font-size: 15px; flex: none; }
html.tc-wide #htlPanel #hud #speed .tcf-ic:not(#\9#\9#\9#\9) { width: 30px; height: 30px; margin-top: -6px; }
html.tc-wide #htlPanel #hud #speed b:not(#\9#\9#\9#\9) { right: 6px; bottom: 5px; font-size: 14px; }
