/* ER-1215: the fullscreen inside-tower view (scene host). The painting covers the application viewport behind the HUD; head, body and
   foot sit inside the measured HUD-safe bounds (--menu-top/left/right/bottom, written by tower-scene.js). No window frame: light glass
   directly on the painting. Colours only through tokens (derived with color-mix); animation is transform/opacity only. */
body.tower-scene-open #stage { visibility: hidden; }
.tower-scene {
  --tm-gap: 16px; --tm-max: 340px;
  --ts-body-top: calc(var(--menu-top, 96px) + 60px);
  --ts-body-h: calc(100vh - var(--ts-body-top) - var(--menu-bottom, 76px) - 64px);
  --tm-tile: min(var(--tm-max), calc((100vw - var(--menu-left, 84px) - var(--menu-right, 16px) - (var(--tm-count, 3) - 1) * var(--tm-gap)) / var(--tm-count, 3)));
  --ts-glass: color-mix(in srgb, var(--menu-surface-bottom) 64%, transparent);
  --ts-glass-strong: color-mix(in srgb, var(--menu-surface-bottom) 82%, transparent);
  --ts-rim: color-mix(in srgb, var(--menu-brass) 62%, transparent);
  position: fixed; inset: 0; z-index: 5; overflow: hidden; box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 30%, var(--menu-surface-top), var(--menu-surface-bottom) 82%);
  color: var(--menu-ink); font: 14px/1.35 var(--font-body);
}
.tower-scene[data-count="4"] { --tm-max: 310px; }
.tower-scene[data-count="5"] { --tm-max: 290px; --tm-gap: 14px; }
.tower-scene *, .tower-scene *::before, .tower-scene *::after { box-sizing: border-box; }

/* painting: token surface first, LQIP when decoded, then the full painting fades in (opacity only) */
.ts-bg { position: absolute; inset: 0; pointer-events: none; }
.ts-bg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; user-select: none; }
.ts-bg .ts-lqip { filter: blur(10px); }
.ts-bg img { scale: 1.06; will-change: transform; }   /* ER-1482: headroom for the pointer parallax (max drift 24px x / 15px y) */
.ts-bg .ts-art { opacity: 0; transition: opacity 220ms ease-out; }
.tower-scene[data-backdrop="ready"] .ts-art { opacity: 1; }
.tower-scene[data-backdrop="ready"] .ts-lqip { visibility: hidden; }
.ts-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg,
  color-mix(in srgb, var(--menu-inset) 64%, transparent) 0, color-mix(in srgb, var(--menu-inset) 34%, transparent) 15%, transparent 28%,
  transparent 76%, color-mix(in srgb, var(--menu-inset) 52%, transparent) 100%); }
.tower-scene[data-view="picker"] .ts-bg::after, .tower-scene[data-view="review"] .ts-bg::after, .tower-scene[data-view="sign"] .ts-bg::after {
  background: linear-gradient(180deg, color-mix(in srgb, var(--menu-inset) 68%, transparent) 0, color-mix(in srgb, var(--menu-inset) 50%, transparent) 60%, color-mix(in srgb, var(--menu-inset) 60%, transparent) 100%); }

/* header, body, footer: inside the HUD-safe bounds */
.ts-head { position: absolute; z-index: 3; left: var(--menu-left, 84px); right: var(--menu-right, 16px); top: var(--menu-top, 96px); height: 56px; padding: 0 4px;
  display: flex; align-items: center; gap: 10px; margin: 0; border: 0; background: none; min-width: 0; }
.ts-title { position: absolute; z-index: 3; left: calc(340px - var(--menu-left, 84px)); right: calc(340px - var(--menu-right, 16px)); top: 0; height: 56px; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; color: var(--menu-title);
  font: 600 46px/1.15 var(--font-display); text-shadow: 0 2px 10px var(--menu-shadow), 0 0 3px var(--menu-shadow); }
.ts-title:focus { outline: none; }
.ts-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.ts-head { justify-content: flex-end; pointer-events: none; }
.ts-head > * { pointer-events: auto; }
.ts-head .ts-sum[hidden] { display: none; }
/* ER-1381: the Reapers / Tower tabs are real buttons directly under the plot plaque, left-aligned with it */
.ts-tabs { position: absolute; z-index: 4; left: calc(var(--pp-x, 16px) - var(--menu-left, 84px)); top: calc(var(--pp-top, 12px) + 112px + 8px - var(--menu-top, 96px)); }
.ts-tabs:empty { display: none; }
/* ER-1713: one segmented glass switch (HUD glass recipe: --ts-glass over the surface, brass rim); the open segment is lit, the other subdued */
.ts-tabs .menu-tabs { display: inline-flex; gap: 0; margin: 0; padding: 3px; border: 1.5px solid var(--lp-rim, var(--menu-brass)); border-radius: 5px; backdrop-filter: blur(12px);
  background: linear-gradient(var(--lp-glass, var(--ts-glass)), var(--ts-glass)); box-shadow: inset 0 0 0 1px var(--menu-inset), 0 4px 12px var(--menu-shadow); }
.ts-tabs .menu-tab { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; min-height: 34px; min-width: 104px; padding: 6px 18px;
  border: 1px solid transparent; border-radius: 3px; background: transparent; color: color-mix(in srgb, var(--menu-ink) 62%, transparent);
  font: 600 14px/1.2 var(--font-body); text-shadow: none; cursor: pointer; transition: background-color 150ms, color 150ms, border-color 150ms; }
.ts-tabs .menu-tab:hover { color: var(--menu-ink); background: color-mix(in srgb, var(--menu-hover) 40%, transparent); }
.ts-tabs .menu-tab:focus-visible { outline: 3px solid var(--menu-focus); outline-offset: 1px; }
.ts-tabs .menu-tab[aria-selected="true"] { border-color: color-mix(in srgb, var(--menu-focus) 75%, transparent); color: var(--menu-focus); font-weight: 700;
  background: linear-gradient(color-mix(in srgb, var(--menu-gold-hover) 70%, transparent), color-mix(in srgb, var(--menu-gold-top) 55%, transparent)); box-shadow: inset 0 1px 3px var(--menu-shadow), 0 0 8px color-mix(in srgb, var(--menu-focus) 25%, transparent); }
.ts-sum { background: var(--ts-glass-strong); }
.ts-sp { flex: 1; }
.ts-body { position: absolute; z-index: 3; left: var(--menu-left, 84px); right: var(--menu-right, 16px); top: var(--ts-body-top);
  bottom: calc(var(--menu-bottom, 76px) + 64px); overflow-x: hidden; overflow-y: auto; padding: 2px 4px; scrollbar-width: thin; scrollbar-color: var(--menu-edge) transparent; }
.ts-foot { position: absolute; z-index: 3; left: var(--menu-left, 84px); right: var(--menu-right, 16px); bottom: var(--menu-bottom, 76px); min-height: 52px;
  display: flex; align-items: center; gap: 12px; padding: 0 4px; margin: 0; border: 0; background: none; }
.ts-foot .menu-kit-status { margin: 0; padding: 4px 10px; border-radius: 4px; background: var(--ts-glass); color: var(--menu-ink); font-size: 13px; text-shadow: 0 1px 4px var(--menu-shadow); }
.tower-scene .tm-root { min-width: 0; }
.tower-scene .tm-root :is(p, h3, dl, dd) { margin: 0; }

/* slots: a centred row of glass tiles over the painting; the first complete row is always visible, art whole */
.tower-scene[data-view="slots"] .ts-body { bottom: var(--menu-bottom, 76px); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; }
.tower-scene[data-view="slots"] .ts-body > #tm-pane { width: 100%; }
/* ER-1388 (ER-1382): the Reaper slots are the Worksite worker tiles (land-panel.css .ed / li.tc), same size, gap and row top; own copy of the rules, same tokens. */
.tower-scene { --lp-warn-ink: color-mix(in srgb, var(--warn) 45%, var(--menu-title)); --lp-danger-ink: color-mix(in srgb, var(--danger) 45%, var(--menu-title));
  --lp-glass: color-mix(in srgb, var(--menu-surface-bottom) 64%, transparent); --lp-rim: color-mix(in srgb, var(--menu-brass) 62%, transparent);
  --tw: var(--tile-w);   /* ER-1940/1941: the SAME tile width as the Worksite (worksite-tiles.css .ed --tw, without the picker height); was capped at 214 px (ER-1502) */ --ts-row-top: 236px; }
@media (max-height: 800px) { .tower-scene { --ts-row-top: 232px; } }
.tower-scene .tm-slots { display: grid; grid-template-columns: repeat(var(--tm-count, 3), var(--tw)); gap: 10px; justify-content: center; align-items: start; list-style: none; margin: var(--ts-row-mt, calc(var(--ts-row-top) - var(--ts-body-top) - 2px)) 0 0; padding: 0; }
.tower-scene .tw-li.tm-tile { position: relative; display: flex; flex-direction: column; gap: 4px; width: var(--tw); min-width: 0; padding: 0; border: 0; background: none; box-shadow: none; list-style: none; font: 14px/1.35 var(--font-body); }
.tower-scene .tw-li *, .tower-scene .tw-li *::before, .tower-scene .tw-li *::after { box-sizing: border-box; }
.tower-scene .tw-tile { position: relative; width: 100%; padding: 3px; border: 1.5px solid var(--lp-rim); border-radius: 5px; background: linear-gradient(var(--lp-glass), color-mix(in srgb, var(--menu-surface-bottom) 72%, transparent)); }
.tower-scene .tw-tile.tw-empty { border-style: dashed; border-color: var(--menu-focus); }
.tower-scene .tw-tile.tw-pending { border-style: dashed; border-color: var(--menu-focus); }
.tower-scene .tw-tile.tw-fallen { border-color: var(--danger); border-style: dashed; }
.tower-scene .tw-well { display: flex; align-items: center; justify-content: center; position: relative; container-type: inline-size; width: 100%; aspect-ratio: 5 / 7; border-radius: 3px; background: color-mix(in srgb, var(--menu-inset) 40%, transparent); overflow: hidden; }
.tower-scene .tw-well img { display: block; width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; filter: none; }
.tower-scene .tw-fallen .tw-well img { filter: grayscale(.75) brightness(.5); }
.tower-scene .tw-pending .tw-well img { opacity: .6; }
.tower-scene .tw-mark { color: color-mix(in srgb, var(--menu-focus) 80%, transparent); font: 600 44px/1 var(--font-display); }
.tower-scene .tw-nm { position: absolute; left: 0; right: 0; bottom: 0; height: 48.5cqi; display: flex; align-items: flex-start; justify-content: center; padding: 2.425cqi 3cqi 0; text-align: center;
  background: linear-gradient(to bottom, transparent, color-mix(in srgb, var(--menu-inset) 62%, transparent) 40%); pointer-events: none; }
.tower-scene .tw-nm span { font: 700 11.94cqi/13.71cqi var(--font-display); color: var(--menu-title); text-wrap: balance; text-shadow: 0 2px 3px var(--menu-shadow), 0 0 7px var(--menu-shadow); }
.tower-scene .tw-hit { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.tower-scene .tw-hit:hover { background: color-mix(in srgb, var(--menu-focus) 10%, transparent); }
.tower-scene .tw-hit:focus-visible { outline: 3px solid var(--menu-focus); outline-offset: 1px; }
.tower-scene .tw-badges { position: absolute; left: 6px; bottom: calc(34.6% + 6px); z-index: 3; display: flex; flex-direction: column-reverse; gap: 3px; align-items: flex-start; pointer-events: none; max-width: calc(100% - 44px); }
.tower-scene .tw-badges .tw-badge { margin: 0; padding: 1px 8px; font-size: 12px; line-height: 1.4; background: color-mix(in srgb, var(--menu-inset) 90%, transparent); white-space: nowrap; }
.tower-scene .tw-badges .tw-badge--wait { border-color: var(--menu-warn-border); background: var(--menu-warn-bg); color: var(--menu-warn-ink); }
.tower-scene .tw-badges .tw-badge--remove { border-color: var(--menu-attention-border); color: var(--menu-attention-ink); }
.tower-scene .tw-pp { container-type: inline-size; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-height: calc(var(--tw) * .31); line-height: 1.1; padding: 4px 2px; border: 1px solid var(--glass-rim); border-radius: var(--radius-control); background: var(--glass-text); }
.tower-scene .tw-pp b { font: 700 max(18px, 16.1cqi)/1.1 var(--font-numeric); color: var(--menu-title); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; text-align: center; }
.tower-scene .tw-pp small { font-size: max(13px, 7cqi); color: var(--menu-muted); }
.tower-scene .tw-pp.dim b { color: var(--menu-muted); }
.tower-scene .tw-sub { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 4px 4px 5px; font-size: 12px; text-align: center; color: var(--menu-ink); text-shadow: 0 1px 3px var(--menu-shadow); border: 1px solid var(--glass-rim); border-radius: var(--radius-control); background: var(--glass-text); overflow-wrap: anywhere; }
.tower-scene .tw-sub--blank { visibility: hidden; }
/* ER-1546: the plate of a placement the game has not confirmed yet uses the theme warn tokens (like the Worksite .tc-badge--wait) */
.tower-scene .tw-sub--wait { border-color: var(--menu-warn-border); background: var(--menu-warn-bg); color: var(--menu-warn-ink); }
.tower-scene .tw-sub--wait .tw-own { color: inherit; }
.tower-scene .tw-own { color: var(--menu-focus); }
.tower-scene .tw-hp { display: block; width: 80%; height: 6px; border: 1px solid var(--menu-brass); border-radius: 2px; background: var(--menu-inset); }
.tower-scene .tw-hp i { display: block; height: 100%; background: var(--ok); }
.tower-scene .tm-tile { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 3px; width: var(--tm-tile); min-width: 0; padding: 8px; text-align: left; color: var(--menu-ink); font: 400 14px/1.3 var(--font-body); }
.tower-scene .tm-tile .tm-slot { align-self: flex-start; }
.tower-scene .menu-row, .tower-scene .menu-tile { background: linear-gradient(var(--ts-glass), color-mix(in srgb, var(--menu-surface-bottom) 72%, transparent)); border: 1.5px solid var(--ts-rim); box-shadow: none; }
.tower-scene .menu-tile:hover:not(.tm-reserved) { background: color-mix(in srgb, var(--menu-brass) 22%, var(--menu-surface-bottom)); }
/* the well never crops the art: the image is only limited by the well, centred and contained */
.tower-scene .tm-well { position: relative; flex: none; display: flex; align-items: center; justify-content: center; width: 100%;
  height: clamp(150px, calc(var(--ts-body-h) - 230px), calc(var(--tm-tile) * 1.3)); overflow: visible; border-radius: 4px; background: color-mix(in srgb, var(--menu-inset) 30%, transparent); }
.tower-scene .tm-well img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; object-fit: contain; filter: drop-shadow(0 5px 7px var(--menu-shadow)); }
.tower-scene .tm-noart { padding: 8px; color: var(--menu-muted); font-size: 12px; text-align: center; }
.tower-scene .tm-name { color: var(--menu-title); font: 600 17px/1.2 var(--font-display); overflow-wrap: anywhere; text-shadow: 0 1px 3px var(--menu-shadow); }
.tower-scene .tm-meta { color: var(--menu-muted); font-size: 13px; overflow-wrap: anywhere; text-shadow: 0 1px 3px var(--menu-shadow); }
.tower-scene[data-count="5"] .tm-meta { font-size: 12px; }
.tower-scene .tm-owner { color: var(--menu-focus); }
.tower-scene .tm-fallen .tm-well { filter: grayscale(1); opacity: .72; }
.tower-scene .tm-hpbar { display: block; height: 8px; margin: 2px 0; border: 1px solid var(--menu-brass); border-radius: 2px; background: var(--menu-inset); }
.tower-scene .tm-hpbar span { display: block; height: 100%; background: var(--ok); }
.tower-scene .tm-pending { margin-top: auto; white-space: normal; border-color: var(--warn); background: color-mix(in srgb, var(--warn) 22%, var(--menu-surface-bottom)); }
.tower-scene .tm-warning { border-color: var(--warn); }
/* empty slot: a soft glowing recess; hover and focus brighten the rim */
.tower-scene .tm-empty { border-style: dashed; border-color: var(--menu-focus); font-weight: 400;
  background: radial-gradient(ellipse at 50% 38%, color-mix(in srgb, var(--amber) 30%, transparent), var(--ts-glass) 72%); box-shadow: 0 0 26px color-mix(in srgb, var(--amber) 26%, transparent); cursor: pointer; }
.tower-scene .tm-empty:hover, .tower-scene .tm-empty:focus-visible { border-style: solid; box-shadow: 0 0 34px color-mix(in srgb, var(--amber) 45%, transparent); }
.tower-scene .tm-empty-well { border: 2px dashed color-mix(in srgb, var(--menu-focus) 70%, transparent); background: transparent; }
.tower-scene .tm-plus { position: relative; width: 64px; height: 64px; border: 2px solid var(--menu-focus); border-radius: 50%; box-shadow: 0 0 18px color-mix(in srgb, var(--amber) 50%, transparent); }
.tower-scene .tm-plus::before, .tower-scene .tm-plus::after { content: ""; position: absolute; left: 50%; top: 50%; background: var(--menu-focus); transform: translate(-50%, -50%); }
.tower-scene .tm-plus::before { width: 28px; height: 3px; }
.tower-scene .tm-plus::after { width: 3px; height: 28px; }
.tower-scene .tm-reserved { cursor: default; border-color: var(--warn); box-shadow: none; }
.tower-scene .tm-reserved .tm-well { opacity: .9; }
.tower-scene .tm-reserved .tm-plus { border-style: dotted; box-shadow: none; }
.tower-scene .tm-reserved .tm-plus::before, .tower-scene .tm-reserved .tm-plus::after { display: none; }

/* Tower tab, waiting, replace: one glass sheet inside the safe area */
.tower-scene[data-view="tower"] .ts-body, .tower-scene[data-view="waiting"] .ts-body, .tower-scene[data-view="replace"] .ts-body, .tower-scene[data-view="rcompare"] .ts-body, .tower-scene[data-view="rreview"] .ts-body { padding: 12px 16px; border-radius: 10px; background: color-mix(in srgb, var(--menu-surface-bottom) 58%, transparent); }
.tower-scene .tm-tower { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; align-items: start; }
.tower-scene .tm-tower .tm-well { height: clamp(220px, calc(var(--ts-body-h) - 40px), 460px); }
.tower-scene .tm-tower-facts { display: grid; gap: 10px; }
.tower-scene .tm-tower-facts h3 { border: 0; }
.tower-scene .tm-tower-facts dl, .tower-scene .tm-review-copy dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 16px; }
.tower-scene dt { color: var(--menu-muted); font-size: 12px; }
.tower-scene dd { color: var(--menu-title); font-weight: 600; }
.tower-scene .tm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tower-scene .tm-secondary { display: grid; gap: 12px; justify-items: start; }
.tower-scene .tm-waiting { display: flex; justify-content: space-between; gap: 14px; width: 100%; }

/* ER-1403: the Reaper picker is the shared card picker (land-picker.js/css, tower adapter in tower-picker.js): full-screen layer, no rules of its own here. */

/* review: one large whole Reaper at left, calm facts and the explicit Sign at right */
.tower-scene .tm-review { display: grid; gap: 12px; justify-items: start; }
.tower-scene .tm-review-card { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 16px; align-items: start; width: 100%; padding: 12px; background: var(--ts-glass); }
.tower-scene .tm-review-card .tm-well { height: clamp(200px, calc(var(--ts-body-h) - 150px), 440px); }
.tower-scene .tm-review-copy { display: grid; gap: 10px; }
.tower-scene .tm-review-copy h3 { border: 0; }
.tower-scene .tm-review-copy h4 { margin: 0; color: var(--menu-title); font: 600 15px/1.2 var(--font-display); }
.tower-scene .tm-ops { margin: 0; padding-left: 22px; display: grid; gap: 4px; }

/* sign: the signing step is mounted inside the scene as one glass sheet */
.tower-scene[data-view="sign"] .ts-body { display: flex; justify-content: center; align-items: flex-start; }
.ts-sign { width: min(760px, 100%); padding: 14px 18px; border: 1.5px solid var(--ts-rim); border-radius: 10px; background: var(--ts-glass-strong); color: var(--menu-ink); }
.ts-sign-title { margin: 0 0 8px; color: var(--menu-title); font: 600 20px/1.2 var(--font-display); }
.ts-sign-title:focus { outline: none; }
.tower-scene[data-view="sign"] .ts-foot { justify-content: center; }
.tower-scene[data-view="sign"] .ts-foot .sign-go { width: min(760px, 100%); }
.ts-sign .sign-info { text-align: left; }
.tower-scene[data-view="sign"] .ts-foot .sign-foot, .tower-scene[data-view="sign"] .ts-foot .sign-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* decorative echoes: small idle figures at the edges, behind the controls, never interactive. transform/opacity only. */
.ts-echoes { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.ts-echo { position: absolute; height: var(--ts-size, 110px); width: auto; max-width: calc(var(--ts-size, 110px) * 1.5); opacity: 0; pointer-events: none; transform-origin: 50% 100%;
  transition: opacity 700ms ease-out; will-change: transform, opacity; animation-duration: var(--ts-dur, 3s); animation-delay: var(--ts-delay, 0s); animation-iteration-count: infinite; animation-timing-function: ease-in-out; }
.ts-echo[data-on="1"] { opacity: .94; }
.ts-perch { z-index: 1; }   /* ER-1501: perched on a Reaper tile's top edge, feet on the border */
.ts-perch[data-reduced="1"] { animation: none; transition: none; }
.ts-echo[data-anim="bell-swing"] { transform-origin: 50% 0; animation-name: ts-bell-swing; }
.ts-echo[data-anim="lantern-flicker"] { animation-name: ts-lantern-flicker; }
.ts-echo[data-anim="spring-bounce"] { animation-name: ts-spring-bounce; }
.ts-echo[data-anim="card-peek"] { animation-name: ts-card-peek; }
.ts-echo[data-anim="bunting-sway"] { transform-origin: 50% 0; animation-name: ts-bunting-sway; }
.ts-echo[data-anim="snuff-reach"] { animation-name: ts-snuff-reach; }
.ts-echo[data-anim="candy-nibble"] { animation-name: ts-candy-nibble; }
.ts-echo[data-anim="wobble"] { animation-name: ts-wobble; }
.ts-echo[data-anim="hover"] { animation-name: ts-hover; }
@keyframes ts-bell-swing { 0%, 100% { transform: rotate(-6deg); } 50% { transform: rotate(6deg); } }
@keyframes ts-lantern-flicker { 0%, 100% { transform: scale(1); opacity: .94; } 35% { transform: scale(1.03); opacity: .8; } 65% { transform: scale(.99); opacity: 1; } }
@keyframes ts-spring-bounce { 0%, 100% { transform: translateY(0) scale(1, 1); } 40% { transform: translateY(-14px) scale(.97, 1.04); } 60% { transform: translateY(0) scale(1.04, .96); } }
@keyframes ts-card-peek { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(10px) rotate(2deg); } }
@keyframes ts-bunting-sway { 0%, 100% { transform: rotate(-3deg) skewX(-2deg); } 50% { transform: rotate(3deg) skewX(2deg); } }
@keyframes ts-snuff-reach { 0%, 100% { transform: translateY(0) scaleY(1); } 50% { transform: translateY(-6px) scaleY(1.05); } }
@keyframes ts-candy-nibble { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-2deg) scale(1.02); } 50% { transform: rotate(0) scale(.99); } 75% { transform: rotate(2deg) scale(1.02); } }
@keyframes ts-wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes ts-hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.ts-echoes[data-paused="1"] .ts-echo { animation-play-state: paused; }
.ts-echoes[data-reduced="1"] .ts-echo { animation: none; transition: none; }

@media (prefers-reduced-motion: reduce) {
  .tower-scene * { animation: none !important; scroll-behavior: auto !important; transition: none !important; }
}

/* phone (desktop first: only has to stay usable): two columns, art whole, the page may scroll vertically inside the body */
@media (max-width: 600px) {
  .tower-scene { --tm-gap: 8px; --tm-max: 164px; --tm-tile: min(var(--tm-max), calc((100vw - 24px - var(--tm-gap)) / 2)); }
  .tower-scene[data-count="5"] { --tm-max: 144px; }
  .ts-head { height: auto; min-height: 48px; flex-wrap: wrap; gap: 6px; padding-right: 8px; }
  .ts-title { left: 16px; right: 16px; font-size: 24px; }
  .ts-sum, .ts-sp { display: none; }
  .ts-body { top: max(var(--ts-body-top, 166px), calc(var(--menu-top, 96px) + 112px)); }
  .tower-scene[data-view="slots"] .ts-body { align-items: flex-start; }
  .tower-scene .tm-slots { grid-template-columns: repeat(2, var(--tw)); margin-top: 0; }
  .tower-scene[data-count="1"] .tm-slots { grid-template-columns: var(--tw); }
  .tower-scene .tm-tile:not(.tw-li) { padding: 6px; }
  .tower-scene .tm-well { height: clamp(110px, 18vh, var(--tm-tile)); }
  .tower-scene .tm-occupied .tm-owner, .tower-scene .tm-occupied .tm-hpbar, .tower-scene .tm-empty .tm-meta { display: none; }
  .tower-scene .tm-name { font-size: 14px; }
  .tower-scene .tm-meta { font-size: 12px; }
  .tower-scene .tm-tower, .tower-scene .tm-review-card { grid-template-columns: 1fr; }
  .tower-scene .tm-review-card .tm-well { height: 240px; max-width: 320px; justify-self: center; }
  .tower-scene .rp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tower-scene .rp-controls > input[type="search"], .tower-scene .rp-controls > select { width: calc(50% - 5px); }
  .tower-scene .rp-count { margin-left: 0; flex-basis: 100%; }
  .tower-scene .rp-art { height: clamp(120px, 22vh, 190px); }
  .ts-echoes, .ts-perch { display: none; }
}
.tower-scene .tw-pending .tw-badges { max-width: calc(100% - 12px); }

/* ER-1398: staged removal, same tokens and look as the Worksite's (land-panel.css .is-pending-removal, .tc-over, .lp-changes-btn) */
.tower-scene .tw-tile.is-pending-removal { border-color: var(--menu-attention-border); border-style: dashed; box-shadow: 0 0 0 2px color-mix(in srgb, var(--menu-attention) 55%, transparent); }
.tower-scene .is-pending-removal .tw-well img { filter: grayscale(.75) brightness(.5); }
.tower-scene .tw-over { position: absolute; left: 6px; right: 6px; top: 46%; z-index: 3; padding: 3px 4px; border: 1px solid var(--glass-rim); border-radius: var(--radius-control); background: var(--glass-text);
  color: var(--menu-ink); font: 600 12px/1.25 var(--font-body); text-align: center; pointer-events: none; }
.tower-scene .ts-changes { min-height: 40px; }
.tower-scene .tw-changes { display: grid; gap: 10px; max-width: 640px; margin: 0 auto; }
.tower-scene .tw-chg-list, .tower-scene .tw-chg-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tower-scene .tw-chg { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tower-scene .tw-chg small { display: block; color: var(--menu-muted); }
.tower-scene .tw-chg-notes li { font-size: 13px; color: var(--menu-ink); }
.tower-scene .tw-chg-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tower-scene .tw-changes { padding: 12px; border: 1px solid var(--menu-edge); border-radius: 6px; background: color-mix(in srgb, var(--menu-inset) 90%, transparent); }

/* ER-1485: the INLINE Reaper picker (same behaviour as the Worksite worker picker, ER-1450/1462). The slot row moves to the top edge and stays visible, the selected tile is lifted and the others dimmed,
   the picker opens below it; the header, tabs and HUD step aside and the painted interior (with its parallax) stays visible around the semi-transparent picker. */
.tower-scene[data-view="picker"] :is(.ts-head, .ts-title, .ts-tabs) { visibility: hidden; pointer-events: none; }
.tower-scene[data-view="picker"] .ts-body { top: 0; bottom: 0; display: flex; flex-direction: column; align-items: stretch; overflow-y: auto; }
.tower-scene[data-view="picker"] .ts-body > #tm-pane { width: 100%; flex: none; }
.tower-scene[data-view="picker"] .tm-slots { margin-top: 8px; margin-bottom: 10px; }   /* ER-1892 (b): the same 10 px gap under the tiles as the Worksite */
.tower-scene[data-view="picker"] .ts-foot { display: none; }
/* ER-1902: the invisible placeholder rows (blank sub line, hidden amber) still reserved ~52 px under the power boxes; with the picker open they collapse so it starts 10 px under the last visible box. */
.tower-scene[data-view="picker"] .tm-slots li.tw-li > :is(.tw-sub--blank, [hidden]) { display: none; }
.tower-scene .tm-pickmount { width: 100%; flex: 1 0 auto; display: flex; flex-direction: column; }
.tower-scene .tm-pickmount > .lp-picker.is-inline { flex: 1 0 auto; background: linear-gradient(color-mix(in srgb, var(--menu-surface-bottom) 58%, transparent), color-mix(in srgb, var(--menu-surface-bottom) 70%, transparent)); }
.tower-scene .tm-slots .tc-ppbadge { display: none; }
/* ER-2081: like the Worksite (ER-1951, worksite-overrides.css), while the Reaper picker is open the boxes under a tile step aside, so the picker docks right under the tiles, and each Reaper carries its Power on the Worksite's glass badge (same class, same rule). */
.tower-scene .tm-slots.is-picking li.tw-li > :is(.tw-pp, .tw-sub) { display: none; }
.tower-scene .tm-slots.is-picking .tc-ppbadge { display: block; position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 12px); padding: 1px 10px; border: 1px solid var(--lp-rim, var(--menu-brass)); border-radius: 999px;
  background: linear-gradient(var(--lp-glass), color-mix(in srgb, var(--menu-surface-bottom) 72%, transparent)); color: var(--menu-title); font: 700 13px/1.5 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.tower-scene .tm-slots .tw-tile, .tower-scene .tm-slots .tw-pp, .tower-scene .tm-slots .tw-sub { transition: transform .28s cubic-bezier(.22,.61,.36,1), box-shadow .28s ease-out, filter .28s ease-out; }
.tower-scene .tm-slots.is-picking li.tw-li:not(.is-picked) { filter: saturate(.35) brightness(.86); opacity: .45; }   /* ER-1586: selected tile, the others turn semi-transparent */
.tower-scene .tm-slots li.tw-li { transition: opacity 140ms ease-out; }
.tower-scene .tm-slots:not(.is-picking):has(li.tw-li:hover) li.tw-li:not(:hover) { opacity: .45; }   /* ER-1586/1588: on hover the other tiles fade, boostable boxes with them */
.tower-scene .tm-slots.is-picking li.tw-li.is-picked .tw-tile { transform: translateY(-8px); box-shadow: 0 0 0 2px color-mix(in srgb, var(--menu-focus) 75%, transparent), 0 10px 22px color-mix(in srgb, var(--menu-focus) 38%, transparent); }
body.tower-picking #hud, body.tower-picking #hud *, body.tower-picking .prealpha, body.tower-picking #journey, body.tower-picking #notice { visibility: hidden !important; pointer-events: none !important; }
@media (prefers-reduced-motion: reduce) { .tower-scene .tm-slots .tw-tile { transition: none; } }

/* ER-1493: the title is the Worksite's gilded Title A (.wh-title / .wh-line / .wh-name / .wh-ico / .wh-rule from land-panel.css); only the placement and the size are the tower's own. ER-1626: no art beside the name; placement follows worksite-header.js. */
/* ER-1752: position, size rule and divider gap now come from view-title.css / view-title.js. */

/* ER-1502 (T1 command hall, approved on art-out/tower-view-redesign-v1): the header sits on the Worksite header grid (positions written by tower-scene.js layoutHeader); the plaques are the Worksite's .wh-box frame family, tokens only. */
.ts-hdr { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.ts-hdr[data-on="0"] { display: none; }
.ts-hdr > * { position: absolute; pointer-events: auto; }
.th-box { position: absolute; display: flex; align-items: stretch; min-width: 0; overflow: hidden; border: 2px solid var(--menu-edge); border-radius: 5px; background: linear-gradient(var(--menu-surface-top), var(--menu-surface-bottom)); isolation: isolate;
  box-shadow: inset 0 0 0 1px var(--menu-inset), 0 8px 22px var(--menu-shadow); color: var(--menu-ink); }
.th-box::before { content: ""; position: absolute; inset: 3px; border: 1px solid var(--menu-brass); border-radius: 3px; opacity: .55; pointer-events: none; z-index: 1; }
.th-box > * { position: relative; z-index: 2; }
.th-well { flex: none; width: 68px; display: flex; align-items: center; justify-content: center; background: var(--menu-head); border-right: 1px solid var(--menu-brass); border-radius: 3px 0 0 3px; }
.th-tplq .th-well { width: 52px; }
.th-well img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 2px 3px var(--menu-shadow)); }
.th-row.short .th-well img { width: 32px; height: 32px; }
.th-st { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 4px 12px; }
.th-k { font: 600 12px/1.1 var(--font-body); letter-spacing: .04em; text-transform: uppercase; color: var(--menu-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-v { display: flex; align-items: center; gap: 6px; font: 700 26px/1 var(--font-display); color: var(--menu-title); font-variant-numeric: tabular-nums; white-space: nowrap; }
.th-v--name { font-size: 18px; }
.th-tplq .th-st { gap: 1px; padding: 2px 12px; }
.th-v small { font: 600 12px var(--font-body); color: var(--menu-muted); }
.th-v .amber-icon { display: inline-flex; width: 22px; height: 22px; } .th-v .amber-icon img { width: 22px; height: 22px; object-fit: contain; }
.th-row.short .th-v { font-size: 22px; }
.th-sub { font: 500 12px/1.25 var(--font-body); color: var(--menu-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-sub.hi { color: var(--menu-focus); }
.th-bar { display: block; height: 7px; margin: 2px 0; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--menu-brass) 55%, transparent); background: var(--menu-inset); overflow: hidden; }
.th-bar i { display: block; height: 100%; background: var(--menu-brass); }
.th-row { display: grid; grid-template-columns: 1.25fr 1.1fr 1fr 1.05fr; gap: 8px; }
.th-row > .th-box { position: relative; }
.th-row .th-sub:last-child { color: var(--menu-ink); }
.th-pic { padding: 4px; border: 2px solid var(--menu-brass); border-radius: 5px; background: linear-gradient(var(--menu-surface-top), var(--menu-surface-bottom)); box-shadow: inset 0 0 0 1px var(--menu-inset), 0 4px 14px var(--menu-shadow); pointer-events: none; box-sizing: border-box; }
.th-snap { position: relative; display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; border-radius: 3px; background: radial-gradient(ellipse at 50% 72%, color-mix(in srgb, var(--menu-brass) 28%, var(--menu-card)), var(--menu-card) 75%); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--menu-brass) 60%, transparent); }
.th-snap img { max-width: 92%; max-height: 94%; object-fit: contain; filter: drop-shadow(0 6px 8px var(--menu-shadow)); }
.th-chip { display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 9px; border: 1px solid var(--menu-brass); border-radius: 3px; background: color-mix(in srgb, var(--menu-inset) 85%, transparent); color: var(--menu-title); font: 600 12px/1.2 var(--font-body); white-space: nowrap; }
.th-chip img { width: 16px; height: 16px; object-fit: contain; }
.th-chip.warn { border-color: var(--menu-warn-border); background: var(--menu-warn-bg); color: var(--menu-warn-ink); }
.th-chip.ok { border-color: var(--menu-confirm-border); background: var(--menu-confirm-bg); color: var(--menu-confirm-ink); }
.th-chip.bad { border-color: var(--menu-attention-border); background: var(--menu-attention-bg); color: var(--menu-attention-ink); }
/* body below the header (tabs included) and the rail centred on the Reaper row */
.tower-scene[data-hdr="1"] .ts-body { top: calc(var(--ts-hdr-bottom, 340px) + 8px); }
.tower-scene[data-hdr="1"][data-view="slots"] .ts-body > #tm-pane { padding-top: 0; }
/* the slot row may use the 8 px above the bottom HUD chips, so the owner / Level / health plate of the 5th tile is never clipped */
.tower-scene[data-hdr="1"][data-view="slots"] .ts-body { bottom: calc(var(--menu-bottom, 76px) - 8px); }
body.tower-scene-open .hud .rail { top: var(--ts-rail-cy, 50%); }
/* the Tower tab: the full ledger, three glass sheets */
.tower-scene[data-hdr="1"][data-view="tower"] .ts-body, .tower-scene[data-hdr="1"][data-view="waiting"] .ts-body, .tower-scene[data-hdr="1"][data-view="replace"] .ts-body, .tower-scene[data-hdr="1"][data-view="rcompare"] .ts-body, .tower-scene[data-hdr="1"][data-view="rreview"] .ts-body { padding: 0 4px; border-radius: 0; background: none; }
.tower-scene .tm-tower.tt-grid { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr) minmax(0, 1fr) minmax(0, .9fr); gap: 10px; align-items: start; }
.tower-scene .tm-tower.tt-grid:not(:has(.tt-pic)) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, .9fr); }
.tower-scene[data-hdr="1"][data-view="tower"] .ts-body, .tower-scene[data-hdr="1"][data-view="waiting"] .ts-body, .tower-scene[data-hdr="1"][data-view="replace"] .ts-body, .tower-scene[data-hdr="1"][data-view="rcompare"] .ts-body, .tower-scene[data-hdr="1"][data-view="rreview"] .ts-body { bottom: var(--menu-bottom, 76px); }
.tt-sheet { min-width: 0; border: 1.5px solid var(--ts-rim); border-radius: 6px; background: linear-gradient(var(--ts-glass), var(--ts-glass-strong)); color: var(--menu-ink); padding-bottom: 8px; }
.tt-sheet h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; padding: 7px 12px 6px; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--menu-brass) 45%, transparent); color: var(--menu-title); font: 600 17px/1.2 var(--font-display); }
.tt-sheet h4 { margin: 8px 12px 2px; color: var(--menu-focus); font: 600 11px/1.2 var(--font-body); letter-spacing: .08em; text-transform: uppercase; }
.tt-sheet dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 2px 12px; font-size: 13px; }
.tt-sheet dl > div { display: contents; }
.tt-sheet dt { color: var(--menu-muted); font-size: 13px; } .tt-sheet dd { margin: 0; color: var(--menu-title); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.tt-sheet dd small { color: var(--menu-muted); font-weight: 500; font-size: 12px; }
.tt-sheet .amber-icon { display: inline-flex; width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; } .tt-sheet .amber-icon img { width: 14px; height: 14px; }
.tt-sheet .th-bar { margin: 4px 12px 0; }
.tt-note { margin: 6px 12px 0; padding: 6px 9px; border: 1px solid color-mix(in srgb, var(--menu-brass) 45%, transparent); border-radius: 4px; background: color-mix(in srgb, var(--menu-inset) 70%, transparent); font-size: 12px; line-height: 1.35; color: var(--menu-ink); }
.tt-note.warn { border-color: var(--menu-warn-border); background: var(--menu-warn-bg); color: var(--menu-warn-ink); }
.tt-sheet .tm-actions { padding: 10px 12px 0; }
.tt-sheet dd { overflow-wrap: anywhere; }
.tt-pic .tm-well { margin: 8px; height: clamp(140px, calc(100vh - var(--ts-hdr-bottom, 340px) - var(--menu-bottom, 76px) - 76px), 420px); width: auto; }
/* ER-1502: short viewports (1366x768) keep the tile width and compact the plates under the tiles instead */
@media (max-height: 800px) {
  .tower-scene[data-hdr="1"] .tw-sub { min-height: 36px; padding: 1px 4px; gap: 0; }
  .tower-scene[data-hdr="1"] .tw-li.tm-tile { gap: 3px; }
}
@media (max-height: 800px) {
  .th-row .th-st { gap: 0; padding: 2px 10px; }
  .th-row .th-v { font-size: 19px; }
  .th-row > .th-box:first-child .th-sub:nth-child(3), .th-row .th-bar { display: none; }
}

/* ER-1502 wave 3: compare and review keep their action row in the foot, so the body stops above it */
.tower-scene[data-view="rcompare"] .ts-body, .tower-scene[data-view="rreview"] .ts-body, .tower-scene[data-hdr="1"][data-view="rcompare"] .ts-body, .tower-scene[data-hdr="1"][data-view="rreview"] .ts-body { bottom: calc(var(--menu-bottom, 76px) + 58px); overflow-y: auto; }
.tower-scene[data-view="rcompare"] .ts-foot, .tower-scene[data-view="rreview"] .ts-foot { justify-content: flex-end; }
.tower-scene .ts-foot .tr-act { padding: 0; align-items: center; }
/* ER-1650: the tower title's banner line: the gilt rule rises into a small crenellated tower in the middle (CSS mask of an inline SVG, colours from the menu tokens, no raster) */
/* ER-1650/ER-1673: the tower title's banner line is the shared .menu-banner-rule (menu-base.css); 1px up so it covers the door gap */
   /* the title box is a 56px flex column: flex:none in the base keeps the 2px rule from shrinking to 0 */

/* ER-2102: the slot row keeps its position and size; the scroll body must not cut it. In the slots view the body clips nothing (a lifted row's card tops, or boxes below the edge, stay visible). */
.tower-scene[data-view="slots"] .ts-body { overflow: visible; }
.tower-scene[data-view="slots"] .ts-foot { pointer-events: none; }   /* ER-2102: the empty foot strip overlaps the lowest boxes (Heal) of the lifted row and must not catch their clicks */
.tower-scene[data-view="slots"] .ts-foot > * { pointer-events: auto; }
/* ER-2151: the Reaper strip uses the same viewport centre as the Worksite. */
.tower-scene:is([data-view="slots"], [data-view="picker"]) .ts-body { left:0; right:0; }
.tower-scene .tm-slots { width:max-content; max-width:none; margin-inline:auto; }
/* ER-2151/2168: the slot row shares the Worksite tile baseline. The scene's
   rounded body measurement lands about 3 px below that baseline on desktop. */
.tower-scene[data-view="slots"] .tm-slots { margin-top: calc(var(--tile-row-top) - 372px) !important; }
/* ER-2191: use the same narrowed left HUD frame as the Worksite box. */
body:has(.nav-shell:not([hidden])) .tower-scene[data-view] .th-b3-frame {
  width: 430px !important; max-width: calc(100vw - 30px) !important;
}
