/* ═══════════════════════════════════════════════════════════════════════════════════════════════════
   THE METERS AND THE PAINTED FIGHT FOR A MONITOR (2026-10-15). Audit CH-02, SCR-09, FIGHT-10, CH-13 and
   IN-12. Loaded after desktop-polish.css; same rules as desktop.css (one gutter, one px scale, nothing
   full-width or centred for a thumb).
   Measured before, at 1920x1080: on the place the meters were four 54x75 tiles (icon, label, number,
   bar) in a 270x91 cluster; on every page screen they were a fixed 1920x124 band at y 956 with
   --rail-h 124px reserved under the page; the painted fight stood its pair at 46 and 40 percent of
   an 846px stage, ran a 1890x4 stamina rail across the stage's foot and kept the band under its deck.
   THE RULES HERE
   - One HUD element everywhere: a plate in the top-left corner, under the title block on the place
     and level with the site row on a page screen. Four rows, each its name in 11px, a 160x8 bar and
     the number in tabular figures (HP 92/100). The rows carry the flash and the rising delta; each has
     a title saying what the meter is and what brings it back (app.js renderRail, METER_ROW).
   - Nothing is reserved at the foot: --rail-h is 0 on every screen (app.js renderRail).
   - On a page screen the plate's head carries the arc, the age and the coin (the place says them in its
     title block), and the page column keeps clear of the plate on a narrow window.
   - The painted fight: the pair at 60 and 65 percent of the stage (each times its own projection), the
     HUD in the corners as the 3D fight has it, no rail across the stage, the walking plate down.
   - The place's cursor says what a click does: a crosshair where a click locks the mouse or walks you
     there, the default under a menu or a panel where it does nothing. No grab, no touch-action.
   ═══════════════════════════════════════════════════════════════════════════════════════════════════ */

/* `body:is(*, :has(.hub.place))` matches every body and carries the specificity of style.css's
   `body:has(.hub.place) .rail...` rules (style.css 4209-4238), so one rule here outranks both the band and
   the old place cluster by order instead of being written twice. */

/* ---- the plate ------------------------------------------------------------------------------- */
body:is(*, :has(.hub.place)) .rail {
  position: fixed; left: var(--hud-inset); top: 12px; right: auto; bottom: auto; z-index: 16;
  width: max-content; padding: 9px 12px 10px; box-sizing: border-box;
  background: rgba(14,11,8,0.8); border: 1px solid rgba(217,184,102,0.22); border-radius: 8px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.3); backdrop-filter: blur(7px);
  zoom: var(--ui);
}
/* on the place it hangs under the title block, at the height renderRail measures (--stage-top-h). That is a
   measured screen px and zoom scales `top` again, so it is divided back out: at 2560 the plate hung 39px under
   the block (206 for a 167 foot) where it hangs 12px at 1920. */
body:has(.hub.place) .rail { top: calc(var(--stage-top-h, 118px) / var(--ui)); }
body:is(*, :has(.hub.place)) .rail .rail-inner {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; flex-wrap: nowrap;
  gap: 0; width: auto; max-width: none; margin: 0;
}

/* ---- the head: the arc, the age and the coin on a page screen (a bearing alone on the place) ------- */
/* width 0 / min-width 100%: the rows set the plate's width and the head wraps inside it */
body:is(*, :has(.hub.place)) .rail .rail-life {
  width: 0; min-width: 100%; max-width: none; justify-content: flex-start; align-items: baseline; flex-wrap: wrap;
  gap: 2px 10px; margin: 0 0 7px; padding: 0 0 7px; border-bottom: 1px solid rgba(217,184,102,0.16);
  font-size: 10.5px; line-height: 14px; letter-spacing: 0.14em; text-transform: uppercase;
}
.rail .rl-arc { letter-spacing: inherit; }
.rail .rl-age::before { content: "\00b7"; margin-right: 10px; color: var(--ink-faint); }
.rail .rl-bearing { font-size: inherit; }

/* ---- the rows: name, bar, number ------------------------------------------------------------- */
body:is(*, :has(.hub.place)) .rail .rail-pips {
  display: grid; grid-template-columns: max-content 160px minmax(44px, max-content); gap: 6px 9px; align-items: center;
  justify-content: start; width: auto; max-width: none; margin: 0; padding: 0;
  background: none; border: 0; border-radius: 0; backdrop-filter: none;
}
/* (the number column holds 100/100 at 12.5px, 42px, so the plate does not change width as the numbers do: it
   measured 289 wide at HP 100/100 and 282 at 93/100 without the floor) */
/* each row is a subgrid, so the three columns line up down the plate whatever the widest name or number */
body:is(*, :has(.hub.place)) .rail .meter-pip {
  display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; gap: normal; align-items: center;
  min-width: 0; padding: 0; margin: 0; border: 0; border-radius: 4px; background: none;
}
body:is(*, :has(.hub.place)) .rail .pip-short {
  font: 500 11px/16px var(--sans); letter-spacing: 0.03em; color: #c6bfae; white-space: nowrap; text-transform: none;
}
body:is(*, :has(.hub.place)) .rail .pip-bar {
  width: 160px; height: 8px; border-radius: 4px; background: rgba(233,220,196,0.12); box-shadow: inset 0 0 0 1px rgba(0,0,0,0.3);
}
.rail .pip-bar > i { border-radius: 4px; }
body:is(*, :has(.hub.place)) .rail .pip-num {
  justify-self: end; font: 500 12.5px/16px var(--sans); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap;
}
body:is(*, :has(.hub.place)) .rail .pip-val { font: inherit; font-variant-numeric: tabular-nums; }
.rail .pip-max { font-size: 10.5px; color: var(--ink-faint); margin-left: 1px; }

/* ---- a change: the row lights, the number takes the colour, the delta rises beside the plate ---- */
/* (style.css's bloom scales the token 1.07 and haloes it in a circle; on a 290px row that is a jump, so the
   row keeps still and a band of the colour fades across it instead) */
body:is(*, :has(.hub.place)) .rail .pip.flash-up { --fl: rgba(127,176,105,0.34); animation: none; }
body:is(*, :has(.hub.place)) .rail .pip.flash-down { --fl: rgba(217,140,115,0.36); animation: none; }
body:is(*, :has(.hub.place)) .rail .pip:is(.flash-up, .flash-down)::after {
  inset: -2px -7px; border-radius: 5px; transform: none;
  background: linear-gradient(90deg, var(--fl) 0%, var(--fl) 35%, rgba(0,0,0,0) 100%);
  animation: hud-row-halo 1.6s ease-out forwards;
}
@keyframes hud-row-halo { 0% { opacity: 0; } 16% { opacity: 1; } 100% { opacity: 0; } }
/* the delta on its row, just past the plate's right edge, carrying its own ground over the picture */
/* (SKEPTIC 2026-10-15: the -50% is also the resting transform, for prefers-reduced-motion, where style.css sets
   `animation: none` on .pip-float. Without it the pill hung half its height low: measured mid 183.5 against the
   HP row's 175 at 1920, between HP and Armour.) */
body:is(*, :has(.hub.place)) .rail .meter-pip .pip-float,
body:is(*, :has(.hub.place)) .rail .rl-coin .pip-float {
  left: calc(100% + 20px); top: 50%; padding: 0 6px; border-radius: 8px; background: rgba(14,11,8,0.84);
  font-size: 12px; line-height: 17px; letter-spacing: 0; text-transform: none; animation-name: hud-float;
  transform: translateY(-50%);
}
body:is(*, :has(.hub.place)) .rail .rl-coin .pip-float { left: calc(100% + 8px); }
@keyframes hud-float {
  0% { opacity: 0; transform: translate(-6px, -50%); }
  16% { opacity: 1; transform: translate(0, -50%); }
  72% { opacity: 1; transform: translate(0, -50%); }
  100% { opacity: 0; transform: translate(0, calc(-50% - 8px)); }
}

/* ---- the page column keeps clear of the plate ------------------------------------------------- */
/* The plate takes 24 + 291 + 24px of the left edge at --ui 1 (measured 291 wide; 292 here leaves a px). At 1920
   the 1180px column already starts at x 434 and this resolves to its own 64px; at 1366 the sheet's own
   arithmetic starts it at x 157 (93 of margin and 64 of padding), under the plate, and this moves it to
   x 340 (measured). Screens fixed to the viewport (the chart, the fight) do not use the column and are
   left out. */
body[data-view="play"]:not(:has(.hub.place, .map-screen:not(.leaving), .combat:not(.leaving))):has(.rail) .game {
  padding-left: max(clamp(18px, 5vw, 64px), calc((var(--hud-inset) * 2 + 292px) * var(--ui) - max(0px, (100vw - var(--gw)) / 2)));
}

/* ---- the painted fight (?cb3=0, or no world): one HUD, the fight's own ------------------------ */
/* the walking plate stands down as it does in the 3D fight (desktop.css), so HP is not shown twice */
body:has(.combat:not(.leaving)) .rail { display: none; }
/* the pair at 60 and 65 percent of the stage (style.css had 46 and 50 and marked them provisional), each
   times the projection combatPaint writes. They stand further out from the centre so the bigger figures keep
   the gap between them; the strike boxes share his box through the same rule, so they move with him. */
body[data-view="play"]:has(.combat) .combat:not(.cb3) .cs-you { left: 25%; height: calc(60% * var(--cb-you-k, 1)); }
body[data-view="play"]:has(.combat) .combat:not(.cb3) .cs-foe,
body[data-view="play"]:has(.combat) .combat:not(.cb3) .combat-stage .strike-zones { right: 25%; height: calc(65% * var(--cb-foe-k, 1)); }
/* the HUD in the corners, as the 3D fight has it: the bars 320 wide, the stamina under yours (it was a
   1890x4 line across the stage's foot), the bow's draw under that (it was 1890 wide at the foot too).
   74px down, clear of the site row, which is not dimmed on the painted stage. */
body[data-view="play"]:has(.combat) .combat:not(.cb3) .cs-hud { top: 74px; width: 320px; max-width: 320px; }
.combat:not(.cb3) .cs-hud.you { left: var(--hud-inset); }
.combat:not(.cb3) .cs-hud.foe { right: var(--hud-inset); }
.combat:not(.cb3) .cs-stam { left: var(--hud-inset); right: auto; top: 114px; bottom: auto; width: 320px; }
.combat:not(.cb3) .aim-gauge { left: var(--hud-inset); right: auto; top: 124px; bottom: auto; width: 320px; }
/* the deck now ends at the window's foot rather than on the band, so it keeps the 3D fight's 12px under it */
body[data-view="play"]:has(.combat) .combat:not(.cb3) .combat-ctrl:not(.aiming) { padding-bottom: 12px; }
/* the same px scale on a big monitor as the 3D fight's chrome */
.combat:not(.cb3) :is(.cs-hud, .cs-stam, .aim-gauge, .combat-ctrl, .brink-panel, .combat-log, .combat-feedback) { zoom: var(--ui); }

/* ---- the place's cursor (IN-12) --------------------------------------------------------------- */
/* style.css 4279 gave the stage `cursor: grab` (grabbing while dragging) and `touch-action: pan-y`. In a world
   the .w3-stage over it says crosshair until a click locks the mouse and none under the lock; on the
   painted place (no world) a click walks you to the spot, which a crosshair says too. Under the action
   menu or a side panel a click on the world does nothing (w3Lock refuses while P.menu or P.plate). */
.place-stage, .place-stage.looking { cursor: crosshair; touch-action: auto; }
.place-stage:is(.halted, .plated), .place-stage:is(.halted, .plated) .w3-stage { cursor: default; }
