/* Echo Reapers game UI — menu-base.css (ER-1166, ER-1169, ER-1181): the SHARED MENU BASE. 100 percent CSS, no image assets.
   The shared material is transparent HUD glass over the scene, with thin brass rims and whole artwork (contain).
   Colours come from the semantic --menu-* and --glass-* tokens in er.css (section 2b); it is themed for alchemical, dark, light and wood.
   Loaded after polish.css; buttons-quartz.css retains its import path and carries approved variant B through later feature sheets. Documented in
   docs/reference/MENU-BASE.md.

   Component classes (kit.js puts menu-shell, menu-header, menu-body, menu-footer on every panel that is not the login sheet):
     .menu-shell     the menu window. Width by --menu-w (set per menu below), height follows the content up to the free
                     viewport; on phones a full-width sheet. Only .menu-body scrolls.
     .menu-header    title (h2), help and close in one row: 64 px desktop, 60 px phone; help and close are 44 px.
     .menu-body      the scrolling content area (12 x 18 px desktop, 8 x 12 px phone).
     .menu-footer    automatic height, wraps; never a fixed blank band.
     .menu-row       a glass content card: 1 px rim, 5 px radius, 10 px padding.
     .menu-tile      a clickable row/card with art or icon, title and detail (More menu, picker cards).
     .btn            approved glass variant B (min 44 px; also inside the full-screen .land-panel and .tower-scene views, ER-1508). .btn.primary / .btn-primary the stronger accent, .btn.secondary /
                     .btn-secondary the low-tint glass surface, .btn.danger the semantic red glass accent. Disabled is muted.
     .menu-chip      a status chip: 24 px, informational. button.menu-chip / a.menu-chip is clickable: 44 px hit height and
                     INTRINSIC width (never a full row).
     .menu-tabs, .menu-tab   tab row (the open tab has aria-selected="true").
     .menu-field     a label above a 44 px control (inputs, selects).
     .menu-state     loading / empty / error note with a useful action.
     .menu-art       a well for whole artwork (object-fit: contain, never cropped).
   Rules: no background-image, border-image or url() for chrome in this file (tests/test_menu_base.py scans for it). */

/* -- the shell --------------------------------------------------------------------------------------------------- */
html body .panel-layer .panel.menu-shell {
  --menu-w: 1240px;
  box-sizing: border-box; display: flex; flex-direction: column; overflow: hidden; isolation: isolate;
  margin: 0; padding: 0; animation: none;
  border: 1px solid var(--glass-rim); border-image: none; border-radius: var(--radius-frame);
  background: var(--glass-frame);
  color: var(--menu-ink);
  box-shadow: var(--glass-shadow);
}
html body .panel-layer .panel.menu-shell::before { display: none; }
html body .panel-layer .panel.menu-shell > :is(.panel-head, .panel-body, .panel-foot) { position: relative; z-index: 1; }

/* width of each menu (plan: Finder/picker 1240, More 780, short fact dialogs 640) */
html body .panel-layer .panel.menu-shell:is(.menu-panel) { --menu-w: 780px; }
html body .panel-layer .panel.menu-shell:is(.info-panel, .keeper-panel, .card-panel, .sign-sheet) { --menu-w: 640px; }
html body .panel-layer .panel.menu-shell:is(.queue-panel, .tray-panel, .summary-panel, .trans-panel) { --menu-w: 1000px; }
html body .panel-layer .panel.menu-shell:is(.amber-panel) { --menu-w: 900px; }
html body .panel-layer .panel.menu-shell:is(.tower-menu, .replay-panel) { --menu-w: 1120px; }

@media (min-width: 601px) {
  html body .panel-layer { background: var(--menu-scrim); }
  html body .panel-layer .panel.menu-shell {
    position: fixed;
    inset: var(--menu-top, 96px) max(var(--menu-left, 84px), var(--menu-right, 16px)) auto !important;
    width: min(var(--menu-w), calc(100vw - 2 * max(var(--menu-left, 84px), var(--menu-right, 16px)))) !important;
    min-width: 0 !important; max-width: none !important; height: auto !important;
    max-height: calc(100dvh - var(--menu-top, 96px) - var(--menu-bottom, 76px)) !important;
    margin-inline: auto !important;
  }
}

/* -- header: title, help, close in one row --------------------------------------------------------------------------- */
html body .panel-layer .panel.menu-shell > .panel-head {
  flex: none; display: flex; align-items: center; justify-content: flex-start; gap: 12px;
  box-sizing: border-box; margin: 0; height: auto; min-height: 64px; padding: 10px 18px;
  background: var(--glass-text); border: 0; border-bottom: 1px solid var(--glass-divider); border-radius: 0; box-shadow: none;
}
html body .panel-layer .panel.menu-shell > .panel-head::before,
html body .panel-layer .panel.menu-shell > .panel-head::after { display: none; }
html body .panel-layer .panel.menu-shell > .panel-head > h2 {
  flex: 1 1 auto; min-width: 0; margin: 0; display: block;
  font: 600 26px/1.15 var(--font-display); font-variant-caps: normal; letter-spacing: 0; text-transform: none;
  color: var(--menu-title); text-shadow: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
html body .panel-layer .panel.menu-shell > .panel-head > h2::before { display: none; content: none; }
html body .panel-layer .panel.menu-shell > .panel-head > h2 .help { font-size: 14px; }
html body .panel-layer .panel.menu-shell > .panel-head > .icon-btn {
  position: static; flex: none; margin: 0; display: inline-grid; place-items: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0;
  border: 1px solid var(--glass-rim); border-image: none; border-radius: var(--radius-control);
  background: var(--glass-frame); color: var(--menu-title); box-shadow: none;
  font: 700 16px/1 var(--font-body);
}
html body .panel-layer .panel.menu-shell > .panel-head > .icon-btn:hover:not(:disabled) { background: var(--glass-text-hover); filter: none; transform: none; }
html body .panel-layer .panel.menu-shell > .panel-head > .icon-btn .ico { width: 22px; height: 22px; }
html body .panel-layer .panel.menu-shell > .panel-head > .icon-btn.help { background: var(--glass-frame); }

/* -- body and footer ------------------------------------------------------------------------------------------------- */
html body .panel-layer .panel.menu-shell > .panel-body {
  flex: 1 1 auto; min-width: 0; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  box-sizing: border-box; padding: 12px 18px; background: transparent; color: var(--menu-ink);
  scrollbar-width: thin; scrollbar-color: var(--menu-edge) transparent;
}
html body .panel-layer .panel.menu-shell > .panel-foot {
  position: relative; flex: none; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  box-sizing: border-box; height: auto; min-height: 0; max-height: none; overflow: visible; margin: 0;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom));
  background: var(--glass-text); border: 0; border-top: 1px solid var(--glass-divider); box-shadow: none;
}
.menu-shell .menu-kit-status { margin-right: auto; font-size: 13px; color: var(--menu-muted); }
.menu-shell .menu-kit-back { margin-left: auto; }
.menu-shell .panel-foot:has(> .menu-kit-status:only-child) { justify-content: space-between; }

/* -- text and links inside menus ------------------------------------------------------------------------------------- */
.menu-shell :is(.muted, .menu-label, .meta) { color: var(--menu-muted); }
.menu-shell a:not(.btn):not(.menu-item):not(.menu-chip) { color: var(--menu-focus); }
.menu-shell h3:not(.cards-name):not(.skins-name) { font: 600 17px/1.2 var(--font-display); font-variant-caps: normal; letter-spacing: 0; color: var(--menu-title); border-bottom-color: var(--menu-edge); }

/* -- buttons: ONE global family (ER-1513), HUD glass variant B (ER-1806, button-glass-v1): approved glass recipe (surface 64-72 percent, no blur) + a light role tint, 1 px rims on every role, 1 px top highlight; hover raises tint and brightens rim, pressed 1 px down, disabled 45 percent, focus 2 px outline --- */
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn, html body .btn,
.menu-btn {
  --btn-t1: 22%; --btn-t2: 10%; --btn-tint: var(--amber); --btn-rim: color-mix(in srgb, var(--menu-brass) 70%, transparent);
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; min-width: 0; padding: 7px 14px;
  border: 1px solid var(--btn-rim); border-image: none; border-radius: 3px;
  background: linear-gradient(color-mix(in srgb, var(--btn-tint) var(--btn-t1), transparent), color-mix(in srgb, var(--btn-tint) var(--btn-t2), transparent)), linear-gradient(color-mix(in srgb, var(--menu-surface-bottom) 64%, transparent), color-mix(in srgb, var(--menu-surface-bottom) 72%, transparent)); background-origin: padding-box;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  color: var(--menu-title); font: 600 14px/1.2 var(--font-body); letter-spacing: 0; text-transform: none; text-shadow: none;
  text-decoration: none;
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--menu-title) 10%, transparent); white-space: nowrap; cursor: pointer; transition: background-color 150ms, border-color 150ms, box-shadow 150ms;
}
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:hover:not(:disabled):not([aria-disabled="true"]), html body .btn:hover:not(:disabled):not([aria-disabled="true"]) { --btn-t1: 38%; --btn-t2: 24%; border-color: var(--menu-focus); filter: none; transform: none; box-shadow: inset 0 1px 0 color-mix(in srgb, var(--menu-title) 10%, transparent); }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:active:not(:disabled):not([aria-disabled="true"]), html body .btn:active:not(:disabled):not([aria-disabled="true"]) { transform: translateY(1px); box-shadow: inset 0 2px 5px var(--menu-shadow); border-color: color-mix(in srgb, var(--menu-brass) 90%, var(--menu-inset)); filter: brightness(.92); }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:disabled, html body .btn:disabled, html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn[disabled], html body .btn[disabled], html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn[aria-disabled="true"], html body .btn[aria-disabled="true"] { opacity: .45; filter: saturate(.4); cursor: not-allowed; border-color: color-mix(in srgb, var(--menu-muted) 60%, transparent); box-shadow: none; transform: none; }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:focus-visible, html body .btn:focus-visible { outline: 2px solid var(--menu-focus); outline-offset: 2px; }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:is(.secondary, .btn-secondary, .ghost), html body .btn:is(.secondary, .btn-secondary, .ghost) { --btn-t1: 0%; --btn-t2: 0%; --btn-rim: color-mix(in srgb, var(--menu-brass) 50%, transparent); font-weight: 500; }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:is(.secondary, .btn-secondary, .ghost):hover:not(:disabled):not([aria-disabled="true"]), html body .btn:is(.secondary, .btn-secondary, .ghost):hover:not(:disabled):not([aria-disabled="true"]) { --btn-t1: 12%; --btn-t2: 6%; border-color: color-mix(in srgb, var(--menu-focus) 80%, transparent); }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:is(.primary, .btn-primary), html body .btn:is(.primary, .btn-primary) { --btn-t1: 36%; --btn-t2: 18%; --btn-tint: color-mix(in srgb, var(--amber) 60%, var(--menu-focus)); --btn-rim: var(--menu-focus); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--menu-title) 10%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--menu-focus) 30%, transparent); }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn:is(.primary, .btn-primary):hover:not(:disabled):not([aria-disabled="true"]), html body .btn:is(.primary, .btn-primary):hover:not(:disabled):not([aria-disabled="true"]) { --btn-t1: 52%; --btn-t2: 32%; border-color: var(--menu-title); }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn.danger, html body .btn.danger { --btn-tint: var(--danger); --btn-rim: color-mix(in srgb, var(--danger) 85%, transparent); color: color-mix(in srgb, var(--danger) 55%, var(--menu-title)); }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn.danger:hover:not(:disabled):not([aria-disabled="true"]), html body .btn.danger:hover:not(:disabled):not([aria-disabled="true"]) { --btn-t1: 38%; --btn-t2: 24%; border-color: var(--danger); }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn.small, html body .btn.small { min-height: 44px; padding: 7px 10px; font-size: 13px; }
html body :is(.panel-layer .panel, .land-panel, .tower-scene) .btn .ico, html body .btn .ico { width: 1.3em; height: 1.3em; }
html body .panel-layer .panel-foot .btn:is(.primary, .btn-primary) { flex: 1 1 200px; font-size: 15px; }

/* -- chips ------------------------------------------------------------------------------------------------------------ */
/* MAT-04: menu-chip is a layout hook; menu-badge.css owns its face. */
.menu-chip { display: inline-flex; width: max-content; max-width: 100%; white-space: nowrap; }
:is(button,a).menu-chip { cursor: pointer; text-decoration: none; }
:is(button,a).menu-chip:disabled { opacity: .5; cursor: not-allowed; }

/* -- tabs ------------------------------------------------------------------------------------------------------------- */
.menu-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--glass-divider); }
.menu-shell :is(.menu-tab, .pick-tab, .finder-tab, .cards-tab, .tab) {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 7px 14px; border: 1px solid var(--glass-rim); border-image: none; border-radius: var(--radius-control);
  background: var(--glass-text); color: var(--menu-muted);
  font: 600 14px/1.2 var(--font-numeric); font-variant-numeric: lining-nums tabular-nums; letter-spacing: 0; text-transform: none; text-shadow: none; filter: none; box-shadow: none; cursor: pointer;
}
.menu-shell :is(.menu-tab, .pick-tab, .finder-tab, .cards-tab, .tab):hover { background: var(--glass-text-hover); filter: none; transform: none; }
.menu-shell :is(.menu-tab, .pick-tab, .finder-tab, .cards-tab, .tab)[aria-selected="true"] {
  border-width: 1px; border-color: var(--menu-focus); color: var(--menu-focus); opacity: 1; box-shadow: inset 0 -2px 0 var(--menu-focus);
  background: var(--glass-text-hover);
}
.menu-shell .pick-tabs { gap: 8px; border: 0; margin: 0 0 12px; }
.menu-shell .pick-tab .ico { width: 26px; height: 26px; }

/* -- fields: label above a 44 px control ----------------------------------------------------------------------------- */
.menu-field { display: grid; gap: 4px; min-width: 0; color: var(--menu-muted); font-size: 12px; font-weight: 600; }
html body .panel-layer .panel.menu-shell :is(input[type="text"], input[type="number"], input[type="search"], select, textarea) {
  box-sizing: border-box; width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--glass-rim); border-radius: var(--radius-control); background: var(--glass-text); color: var(--menu-ink);
  font: 400 14px/1.3 var(--font-numeric); font-variant-numeric: lining-nums tabular-nums; box-shadow: none; color-scheme: dark;
}
html:is([data-theme="light"], [data-theme="wood"]) .panel.menu-shell :is(input, select, textarea) { color-scheme: light; }
.menu-shell input[type="checkbox"] { accent-color: var(--amber); }

/* -- rows, tiles, art, states -------------------------------------------------------------------------------------- */
.menu-row, .menu-tile {
  box-sizing: border-box; padding: 10px; border: 1px solid var(--glass-rim); border-radius: var(--radius-frame);
  background: var(--glass-frame); box-shadow: var(--glass-shadow); color: var(--menu-ink);
}
.menu-tile { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; min-height: 78px; text-align: left; font: 600 15px/1.25 var(--font-numeric); color: var(--menu-title); text-decoration: none; cursor: pointer; }
/* -- interactive tiles (ER-2082): every enabled clickable tile shows the pointer like a button; disabled ones do not -- */
html body :is(.tc-tile:has(> .tc-hit:not(:disabled):not([aria-disabled="true"])), .tw-tile:has(> .tw-hit:not(:disabled):not([aria-disabled="true"])), .lp-socket:not(:disabled):not([aria-disabled="true"]), .site-tile:not(:disabled):not([aria-disabled="true"]), .mp-site-tile, .my-plots-site, .my-plots-main, .mp-card-click, .menu-tile:not(:disabled):not([aria-disabled="true"]), .tc-hit:not(:disabled), .tw-hit:not(:disabled)) { cursor: pointer; }
.menu-tile:hover { background: var(--glass-text-hover); }
.menu-tile:active { box-shadow: inset 0 0 0 1px var(--menu-inset), inset 0 2px 4px var(--menu-shadow); transform: translateY(1px); }
.menu-tile small { display: block; font: 400 12px/1.3 var(--font-numeric); color: var(--menu-muted); }
.menu-art { display: block; width: 100%; height: auto; object-fit: contain; }
.menu-state { margin: 12px 0; padding: 10px; border: 1px solid var(--glass-rim); border-radius: 4px; background: var(--glass-text); color: var(--menu-muted); font-size: 14px; font-family: var(--font-numeric); font-variant-numeric: lining-nums tabular-nums; }
.menu-state:has(.btn) { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* -- focus: 3 px outline with 2 px offset, everywhere in a menu -------------------------------------------------------- */
.menu-shell :is(button, a, input, select, summary, [tabindex]):focus-visible { outline: 3px solid var(--menu-focus); outline-offset: 2px; }

/* -- phone: a full-width sheet, 44 px touch targets ------------------------------------------------------------------- */
@media (max-width: 600px) {
  html body .panel-layer .panel.menu-shell {
    position: fixed; inset: auto 0 0 0 !important; width: 100% !important; min-width: 0 !important; max-width: none !important;
    height: auto !important; max-height: min(88dvh, calc(100dvh - 72px)) !important;
    border-width: 1px 0 0; border-radius: 10px 10px 0 0;
  }
  html body .panel-layer .panel.menu-shell > .panel-head { min-height: 60px; padding: 8px 12px; gap: 8px; }
  html body .panel-layer .panel.menu-shell > .panel-body { padding: 8px 12px; }
  html body .panel-layer .panel.menu-shell > .panel-foot { padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  html body .panel-layer .panel.menu-shell > .panel-head > h2 { font-size: 24px; }
  .menu-shell .panel-swipe-handle { display: block; position: absolute; top: 4px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--menu-edge); }
}
@media (prefers-reduced-motion: reduce) {
  html body .panel-layer .panel .btn, .menu-tile { transition: none; }
  html body .panel-layer .panel .btn:active:not(:disabled), .menu-tile:active { transform: none; }
}

/* ER-1673: the banner line (shared): a gilt rule with a slim crenellated tower rising from its middle, put under a title (tower interior, plot view, Worksite).
   Colours from the menu tokens, the tower is a CSS mask of an inline SVG, no raster. Sizes via --banner-w / --banner-gap / --banner-tower-w / --banner-tower-h. */
.menu-banner-rule { position: relative; flex: none; box-sizing: content-box; width: var(--banner-w, min(78%, 360px)); height: 2px; min-height: 2px; margin-top: calc(var(--banner-gap, 6px) + var(--banner-gap-extra, 4px));   /* ER-1680: 4 px more distance between a big title and its banner line, in every view (tower, Worksite, plot) */ filter: drop-shadow(0 1px 3px var(--menu-shadow));
  background: linear-gradient(90deg, transparent, var(--menu-brass) 22%, var(--menu-focus) 50%, var(--menu-brass) 78%, transparent); }
.menu-banner-rule::after { content: ""; position: absolute; left: 50%; top: 50%; width: var(--banner-tower-w, 24px); height: var(--banner-tower-h, 32px); transform: translate(-50%, -72%);
  background: linear-gradient(var(--menu-title), var(--menu-focus) 60%, var(--menu-brass)); filter: drop-shadow(0 1px 2px var(--menu-shadow));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32'%3E%3Cpath d='M3 32v-4h3V12H3V0h4v4h3V0h4v4h3V0h4v12h-3v16h3v4z M11 15h2v6h-2z M10 32v-3a2 2 0 0 1 4 0v3z' fill-rule='evenodd'/%3E%3C/svg%3E") center / 100% 100% no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 32'%3E%3Cpath d='M3 32v-4h3V12H3V0h4v4h3V0h4v4h3V0h4v12h-3v16h3v4z M11 15h2v6h-2z M10 32v-3a2 2 0 0 1 4 0v3z' fill-rule='evenodd'/%3E%3C/svg%3E") center / 100% 100% no-repeat; }

/* ER-1942: ONE rule for every remove (x) button on a tile (Worksite .tc-x, tower .tw-x; both are .btn.danger). A small round button (34 px, was 44 / 64 px),
   hidden until the tile is hovered or has keyboard focus inside (or the button itself is focused); always visible on touch / no-hover devices.
   Its own hover is the .btn.danger glass (red tint, above), not a local paint. */
html body :is(.land-panel, .tower-scene) :is(.tc-x, .tw-x).btn { width: 34px; height: 34px; min-height: 0; padding: 7px; border-radius: 999px; box-shadow: none; background: var(--glass-frame, var(--menu-inset)); opacity: 0; pointer-events: none; transition: opacity 120ms; }
html body :is(.land-panel, .tower-scene) :is(.tc-x, .tw-x).btn svg { width: 14px; height: 14px; }
html body .tower-scene .tw-li:hover .tw-x.btn, html body .tower-scene .tw-li:focus-within .tw-x.btn, html body :is(.land-panel, .tower-scene) :is(.tc-x, .tw-x).btn:focus-visible { opacity: 1; pointer-events: auto; }
html body :is(.land-panel, .tower-scene) :is(.tc:not(.tc-stack):hover, .tc:not(.tc-stack):focus-within) .tc-x.btn { opacity: 1; pointer-events: auto; }
html body :is(.land-panel, .tower-scene) :is(.tc-x, .tw-x).btn.danger:hover:not(:disabled):not([aria-disabled="true"]) { border-color: var(--danger); background: linear-gradient(color-mix(in srgb, var(--danger) 52%, transparent), color-mix(in srgb, var(--danger) 30%, transparent)), var(--glass-frame, var(--menu-inset)); color: var(--menu-title); }
@media (hover: none) { html body :is(.land-panel, .tower-scene) :is(.tc-x, .tw-x).btn { opacity: 1; pointer-events: auto; } }
@media (prefers-reduced-motion: reduce) { html body :is(.land-panel, .tower-scene) :is(.tc-x, .tw-x).btn { transition: none; } }

/* ER-2132/ER-2136: ONE tile geometry for Worksite worker tiles and tower Reaper tiles. The Worksite is the default; towers only centre the row horizontally.
   --tile-w: width (viewport-wide, same clamp as the Worksite); --tile-h: tile box (5:7 well + 3 px padding + 1.5 px border); --tile-pp-h: PP line under the tile;
   --tile-row-top: top edge of the tile row = the Worksite row centred in the free height (worksite-header.js ER-1509): 50vh + c - (tile + 4px gap + PP line) / 2, c = 163 px (156.2 px at heights up to 800). */
:root { --tile-w: clamp(100px, min(calc((100vw - 205px) / 7), calc((100vh - 337px) / 1.81), 304px), 304px);
  --tile-h: calc((var(--tile-w) - 8px) * 1.4 + 8px); --tile-pp-h: max(calc(var(--tile-w) * .31), calc(var(--tile-w) * .16 + 28.5px));
  --tile-row-c: 163px; --tile-row-top: calc(50vh + var(--tile-row-c) - (var(--tile-h) + 4px + var(--tile-pp-h)) / 2); }
@media (max-height: 800px) { :root { --tile-row-c: 156.2px; } }

/* ER-2807 (Ceres IR-9295/9296): small tags sit in one row from the top left; AT MOST ONE badge per tile is the full-width centred band (.is-band), chosen by projectBand() in tile-badge-band.js, never by CSS. */
/* ER-2151: badges have intrinsic width and flow across the card, wrapping as a group. */
html body :is(.land-panel .tc-tile, .tower-scene .tw-tile) :is(.tc-badges, .tw-badges) { position:absolute; left:6px; right:6px; top:6px; bottom:auto; z-index:5; display:flex; flex-flow:row wrap; align-content:flex-start; align-items:flex-start; gap:3px; max-width:none; width:auto; pointer-events:none; }
html body :is(.land-panel .tc-tile, .tower-scene .tw-tile) :is(.tc-badge, .tw-badge) { display:inline-flex; flex:0 1 auto; width:auto; max-width:100%; margin:0; white-space:normal; overflow-wrap:anywhere; }
html body :is(.land-panel .tc-tile, .tower-scene .tw-tile) :is(.tc-badge, .tw-badge).is-band { flex-basis:100%; justify-content:center; text-align:center; }
/* ER-2809 (Ceres 0.33.0 badge-face.css:67-82, .slot-tags): the tag row and the band keep the remove X's corner free. Row right edge = X right inset (6 px) + X width (34 px) + 1 px = 41 px, on every line; the band is full width of that row, text centred. A tile with no X (view-only, in flight, core-only) takes the full width (right 6 px, ER-2151). */
html body :is(.land-panel .tc-tile:has(.tc-x), .tower-scene .tw-tile:has(.tw-x)) :is(.tc-badges, .tw-badges) { right:41px; }
html body :is(.land-panel .tc-tile, .tower-scene .tw-tile) :is(.tc-x, .tw-x).btn { z-index:6; }
/* ER-2144: the empty worker and Reaper figures are the same large glass add control. */
html body :is(.land-panel .tc-pp.tc-pp--add, .tower-scene .tw-pp.tw-pp--add).btn { box-sizing:border-box; display:grid; place-items:center; width:100%; min-height:var(--tile-pp-h); padding:4px 6px; border:1px solid var(--glass-rim); border-radius:var(--radius-control); background:var(--tile-ghost); color:var(--menu-focus); font:700 max(11px, min(calc(var(--tile-w) * .17), calc((var(--tile-w) - 20px) / 6.7)))/1.1 var(--font-display); white-space:nowrap; cursor:pointer; }
html body :is(.land-panel .tc-pp.tc-pp--add, .tower-scene .tw-pp.tw-pp--add).btn:hover, html body :is(.land-panel .tc-pp.tc-pp--add, .tower-scene .tw-pp.tw-pp--add).btn:focus-visible { border-color:var(--menu-focus); background:color-mix(in srgb,var(--menu-focus) 20%,var(--glass-text)); color:var(--menu-title); }
html body :is(.land-panel .lp-empty-mark, .tower-scene .tw-mark) { color:color-mix(in srgb,var(--menu-focus) 80%,transparent); font:600 44px/1 var(--font-display); }
html body :is(.land-panel, .tower-scene) :is(.tc-x, .tw-x).btn { position:absolute; right:6px; top:6px; display:grid; place-items:center; }
html body .land-panel .tc-tile .tc-badge .tc-badge-text { white-space:normal; overflow:visible; text-overflow:clip; overflow-wrap:anywhere; }
html body .land-panel .tc-tile :is(.tc-badge--toil-paired, .tc-badge--toil-kin, .tc-badge--toil-solo, .tc-badge--toil-unknown) { display:flex; align-items:center; white-space:normal; overflow:visible; text-overflow:clip; }
