/* ==========================================================================
   Stay Frosty — Frost Glass · ledger.css
   Frost panels (the content cards), schematic plates and sketches, weapon
   rows, column heads, the vernier gauge, build ledger + total, stat bars,
   map-fit rows with their skyline thumbnails, rating chart, sparklines,
   range card, definition table, deltas. Tokens only (SPEC §7). Every number
   is Martian Mono; every word is Archivo.
   ========================================================================== */

/* --------------------------------------------------------------------------
   7.1 Frost panels. Content sits on solid navy panels with a thin frost ring,
   a top highlight and a faint blue glow (SPEC §4.2 .panel recipe). Panels are
   applied by selector, so no module markup changes: every section on a tab
   screen or in a sheet, every list that is a page's own (a direct child of the
   view or of a sheet), the invite row, the share sheet's actions, the empty
   state. Not panels: the Squad tile grid (each plate is its own card), chip
   rows, segmented controls and the title hood.

   Rows read their side inset from --row-x: the gutter (--g) on the screen
   ground, the panel's inner padding (--pad) inside a panel. A panel sits
   --panel-x from the screen edge, so its text still starts --g in.
   -------------------------------------------------------------------------- */
:root { --row-x: var(--g); }
:is(#view, .sheet-inner, #threadBody) > :is(.sec, .list),
.panel {
  --row-x: var(--pad);
  --eyelet: var(--surface);
  position: relative;
  margin-inline: calc(var(--panel-x) - var(--g));
  padding: 12px var(--pad) 14px;
  border-radius: var(--r-panel);
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot));
  box-shadow: var(--edge-frost);
}
/* a list panel: rows run to its edges (their own --pad keeps the text on the --g line) */
:is(#view, .sheet-inner, #threadBody) > .list { padding: 0; }
/* the Squad grid section is not a card: its tiles are (SPEC §7.22) */
#view > .sec.sq-list { --row-x: var(--g); margin-inline: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; }
:is(#view, .sheet-inner, #threadBody) > :is(.sec, .list, .panel, .group, .empty, .invite, .chips, .seg, .notice.inline) + :is(.sec, .list, .panel) { margin-top: var(--sec-gap); }
/* a list inside a section panel bleeds to the panel's edges */
.list { margin-inline: calc(var(--row-x) * -1); }
.list > * { padding-inline: var(--row-x); }
:is(#view, .sheet-inner, #threadBody) > .list > * { padding-inline: var(--pad); }
/* a section head inside a panel: title3 on a frost hairline */
:is(#view, .sheet-inner) > .sec > .sec-h { border-bottom-color: rgba(150, 215, 255, .10); }
/* footnotes that close a panel keep it compact */
:is(#view, .sheet-inner) > .sec > .foot:last-child { margin-bottom: 0; }

/* Full-bleed ledger lines: inside a .list the list already bleeds; anywhere else a ledger line bleeds itself to
   the edge of whatever it sits in (the screen gutter, or the panel's padding). */
.wrow,
.colhead,
.group-label { box-sizing: border-box; width: 100%; }
:not(:is(.list, .watch, .lu-prows, .xs-actions, .xs-list)) > :is(.wrow, .colhead, .group-label) {
  width: calc(100% + var(--row-x) * 2);
  margin-inline: calc(var(--row-x) * -1);
}

/* --------------------------------------------------------------------------
   7.7 Plate — .paper: Jay's schematic drawings re-lit (SPEC §7.7). A deep-blue
   panel with a spotlight, a fine frost grid, a frost edge with a soft glow,
   reticle corners on large plates only. The datum line is retired.
   -------------------------------------------------------------------------- */
.paper {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: 100%;
  overflow: hidden;
  border-radius: var(--r-plate);
  background:
    var(--a-spot),
    repeating-linear-gradient(0deg, transparent 0 23px, var(--a-rule) 23px 24px),
    repeating-linear-gradient(90deg, transparent 0 23px, var(--a-rule) 23px 24px),
    var(--a-grad);
  box-shadow: var(--sh-plate);
  color: var(--a-ink);
  text-align: left;
}
.paper::before { display: none; }
/* reticle corners: four 14px brackets, drawn with gradients so the plate needs no extra markup */
.paper::after {
  --c: var(--a-corner); --l: 14px; --t: 1.5px;
  content: '';
  position: absolute;
  z-index: 2;
  inset: 6px;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) top left / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) top right / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) bottom left / var(--t) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--t),
    linear-gradient(var(--c), var(--c)) bottom right / var(--t) var(--l);
  background-repeat: no-repeat;
}
.paper > :is(svg, .sketch) {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}
/* the hero and sheet plates are backlit: a static frost glow around the drawing (never on thumbs) */
:is(.hero-paper, .sh-paper, .lu-art) > .sketch { filter: drop-shadow(0 0 10px rgba(92, 200, 255, .28)); }

/* captions — condensed HUD caps, only on plates */
.paper .fig {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 16px;
  max-width: calc(100% - 32px);
  height: 24px;
  margin: 0;
  padding-right: 6px;
  font: 600 var(--fs-hand-m)/20px var(--font-hand);
  font-stretch: var(--wd-cond);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--a-cap);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.paper .note {
  position: absolute;
  z-index: 2;
  left: 16px;
  right: 24px;   /* clear of the bottom-right reticle (6px inset + 14px arm) */
  bottom: 8px;
  height: 20px;
  margin: 0;
  padding-right: 2px;   /* text ends 26px from the edge, 6px clear of the reticle arm */
  font: 500 var(--fs-hand-s)/18px var(--font-hand);
  font-stretch: var(--wd-cond);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--a-note);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  /* the legend is the only key to the blue wash: it always stays whole, and only the description truncates */
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
}
.paper .note > .desc { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* as a flex item the description drops the space after its " · "; this is that space, and it
   still parts a cut description's ellipsis from the legend */
.paper .note > .desc:not(:last-child) { padding-right: .25em; }
.paper .note > mark { flex: none; white-space: nowrap; }
/* a plain-text note (community plates) keeps the block ellipsis */
.paper .note:where(:not(:has(> .desc, > mark))) { display: block; }
/* a tag, not a misregistered box: the wash covers the caps and stops at the baseline */
.paper mark {
  background: linear-gradient(transparent 12%, var(--a-hl) 12% 90%, transparent 90%);
  border-radius: 3px;
  padding-inline: 3px;
  color: #FFFFFF;   /* white keeps the legend readable on the frost wash */
}

/* plate sizes by context (zero-specificity contexts so modifiers below win). The datum line is gone, so the
   drawing is centred with even sides and gets the width back */
:where(.hero) .paper,
.paper.hero-plate,
.hero-paper {
  aspect-ratio: 16 / 7;
  padding: 30px 10px 26px;
}
:where(.sheet) .paper,
.paper.sh-plate,
.sh-paper {
  aspect-ratio: 640 / 300;
  padding: 30px 10px 26px;
}
:where(.sheet) .paper .fig { font-size: var(--fs-hand-l); line-height: 22px; }
/* a narrow plate (320pt, Display Zoom) drops the description from the note, so the legend for the blue wash
   ("blue = max-potential build") is never the part cut off. The query reads the content box */
.hero-paper, .sh-paper { container-type: inline-size; }
@container (max-width: 296px) { .note .desc { display: none; } }
:where(#editor) .paper,
.paper.ed-plate,
.ed-paper {
  aspect-ratio: 640 / 240;
  padding: 28px 10px 24px;
}
/* tiles and the shelf: a card of their own (radius 12), no corners or captions, a blue rank badge */
:where(.shelf) .paper { aspect-ratio: 2 / 1; padding: 18px 6px 8px; border-radius: var(--r-tile); }
:where(.ltile) .paper { aspect-ratio: 16 / 10; padding: 20px 6px 8px; border-radius: var(--r-tile); }
.ltile .paper::after, .shelf .paper::after, .thumb::after { display: none; }
:where(.shelf, .ltile) .paper .fig,
:where(.shelf, .ltile) .paper .note { display: none; }

/* rank badge on tiles and the shelf: a vivid frost tab with a glow (SPEC §7.7) */
.plate-no {
  position: absolute;
  z-index: 2;
  top: 3px;
  left: 4px;
  font: 600 11px/1 var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--a-cap);
  pointer-events: none;
}
:is(.ltile, .shelf) .plate-no {
  top: 6px;
  left: 6px;
  box-sizing: border-box;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 6px;
  background: var(--accent-fill);
  box-shadow: 0 0 10px rgba(40, 140, 255, .6), inset 0 1px 0 rgba(255, 255, 255, .3);
  font: 600 11px/22px var(--font-data);
  font-stretch: var(--wd-semi);
  color: var(--on-accent);
  text-align: center;
}

/* row thumb: 72×40 (64×36 below 390), 8px grid, no datum line or corners, no captions */
.thumb,
.paper.thumb {
  position: relative;
  display: block;
  flex: none;
  box-sizing: border-box;
  width: 72px;
  height: 40px;
  aspect-ratio: auto;
  padding: 3px 4px;
  overflow: hidden;
  border-radius: var(--r-thumb);
  background:
    radial-gradient(80% 100% at 35% 25%, rgba(60, 150, 255, .22), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 7px, var(--a-rule) 7px 8px),
    repeating-linear-gradient(90deg, transparent 0 7px, var(--a-rule) 7px 8px),
    var(--a-grad);
  box-shadow: inset 0 0 0 1px rgba(120, 200, 255, .30), inset 0 1px 0 rgba(200, 235, 255, .16);
}
.paper.thumb::before,
.paper.thumb::after { display: none; }
.thumb > svg,
.thumb > .sketch {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
}
.thumb :is(.fig, .note) { display: none; }
/* Row thumbs: the rank sits in its own 14px gutter on clean ruled paper and the drawing starts to the right of
   it, so the number never bites the stock (an opaque tab over the drawing did). */
.thumb .plate-no {
  top: 3px;
  left: 0;
  width: 14px;
  padding: 0;
  border-radius: 0;
  background: none;
  font-stretch: var(--wd-cond);
  text-align: center;
}
.thumb:has(> .plate-no) { padding-left: 0; padding-right: 2px; }
.thumb:has(> .plate-no) > :is(svg, .sketch) { margin-left: 14px; width: calc(100% - 14px); }
.thumb.sm,
.thumb.s64 { width: 64px; height: 36px; }

/* locked thumb: grey pencil + a small lock (drawn here unless the markup carries one) */
:is(.wrow.locked, .thumb.locked, .locked > .thumb) .thumb > svg,
.thumb.locked > svg,
.wrow.locked .thumb > svg {
  filter: grayscale(1);
  opacity: .55;
}
:is(.wrow.locked .thumb, .thumb.locked) :is(.lock, .ico-lock) {
  position: absolute;
  z-index: 2;
  right: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  color: var(--a-cap);
}
:is(.wrow.locked .thumb, .thumb.locked):not(:has(.lock, .ico-lock))::before,
:is(.wrow.locked .thumb, .thumb.locked):not(:has(.lock, .ico-lock))::after {
  content: '';
  position: absolute;
  z-index: 2;
  display: block;
  box-sizing: border-box;
}
:is(.wrow.locked .thumb, .thumb.locked):not(:has(.lock, .ico-lock))::before {     /* shackle */
  right: 5px;
  bottom: 8px;
  width: 6px;
  height: 5px;
  border: 1.5px solid var(--a-cap);
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}
:is(.wrow.locked .thumb, .thumb.locked):not(:has(.lock, .ico-lock))::after {      /* body */
  right: 4px;
  bottom: 3px;
  width: 8px;
  height: 6px;
  border-radius: 1.5px;
  background: var(--a-cap);
}

/* --------------------------------------------------------------------------
   Sketch rendering (art.js): fills → frost wash → inks → callouts
   -------------------------------------------------------------------------- */
.sketch { display: block; overflow: visible; }
.sketch .i1 {
  fill: none;
  stroke: var(--a-ink);
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sketch .i2 {
  fill: none;
  stroke: var(--a-ink);
  stroke-width: .8;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .45;
}
.sketch .hl path {
  fill: var(--a-hl);
  stroke: var(--a-hl);
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}
/* callouts: leader, part dot, balloon, letter — outside the pencil filter, always crisp */
.sketch .callouts :is(line, polyline, path:not(.balloon)) {
  fill: none;
  stroke: var(--a-ink);
  stroke-width: 1.4;
  stroke-opacity: .8;
  stroke-linecap: round;
}
.sketch .callouts :is(.dot, .co-dot, circle.dot) { fill: var(--a-ink); stroke: none; }
.sketch .callouts :is(.balloon, .co-ball, circle:not(.dot):not(.co-dot)) {
  fill: var(--a-paper);
  stroke: var(--a-ink);
  stroke-width: 1.4;
  stroke-opacity: 1;
}
.sketch .callouts text {
  font-family: var(--font-data);
  font-size: 24px;
  font-weight: 600;
  font-stretch: var(--wd-semi);
  fill: var(--a-ink);
  stroke: none;
  text-anchor: middle;
  dominant-baseline: central;
}

/* ink-in (hero and weapon sheet, once per weapon per session; §7.1) */
.sketch.draw .i1 {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: e2-ink 1100ms var(--ease-out) 150ms forwards;
}
.sketch.draw .i2 {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: e2-ink 900ms var(--ease-out) 450ms forwards;
}
.sketch.draw .fills { opacity: 0; animation: e2-fade 500ms var(--ease-out) 800ms forwards; }
.sketch.draw .hl path {
  -webkit-clip-path: inset(0 100% 0 0);
  clip-path: inset(0 100% 0 0);
  animation: e2-wipe 450ms var(--ease-out) 1300ms forwards;
}
.sketch.draw .hl path:nth-child(2) { animation-delay: 1360ms; }
.sketch.draw .hl path:nth-child(3) { animation-delay: 1420ms; }
.sketch.draw .hl path:nth-child(4) { animation-delay: 1480ms; }
.sketch.draw .hl path:nth-child(5) { animation-delay: 1540ms; }
.sketch.draw .hl path:nth-child(n+6) { animation-delay: 1600ms; }
.sketch.draw .callouts :is(line, polyline, path:not(.balloon))[pathLength] {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: e2-ink 200ms var(--ease-out) 1650ms forwards;
}
.sketch.draw .callouts :is(line, polyline, path:not(.balloon)):not([pathLength]) {
  opacity: 0;
  animation: e2-fade 200ms var(--ease-out) 1650ms forwards;
}
/* the part dot lands with its leader, not before the pencil */
.sketch.draw .callouts .dot { opacity: 0; animation: e2-fade 160ms var(--ease-out) 1650ms forwards; }
.sketch.draw .callouts > g,
.sketch.draw .callouts :is(.balloon, .co-ball) {
  transform-box: fill-box;
  transform-origin: center;
}
.sketch.draw .callouts > g :is(.balloon, .co-ball, circle:not(.dot):not(.co-dot), text) {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  animation: e2-balloon 160ms var(--ease-out) 1850ms both;
}
.sketch.draw .callouts > g:nth-of-type(2) :is(.balloon, .co-ball, circle:not(.dot):not(.co-dot), text) { animation-delay: 1890ms; }
.sketch.draw .callouts > g:nth-of-type(3) :is(.balloon, .co-ball, circle:not(.dot):not(.co-dot), text) { animation-delay: 1930ms; }
.sketch.draw .callouts > g:nth-of-type(4) :is(.balloon, .co-ball, circle:not(.dot):not(.co-dot), text) { animation-delay: 1970ms; }
.sketch.draw .callouts > g:nth-of-type(5) :is(.balloon, .co-ball, circle:not(.dot):not(.co-dot), text) { animation-delay: 2010ms; }
/* the caption writes itself in */
.paper:is(.draw, :has(> .sketch.draw)) .fig {
  -webkit-clip-path: inset(0 100% 0 0);
  clip-path: inset(0 100% 0 0);
  animation: e2-wipe 400ms var(--ease-out) 1500ms forwards;
}
/* the legend ("blue = this build") writes in only once the wash it explains has been laid down */
.paper:is(.draw, :has(> .sketch.draw)) .note {
  -webkit-clip-path: inset(0 100% 0 0);
  clip-path: inset(0 100% 0 0);
  animation: e2-wipe 350ms var(--ease-out) 1750ms forwards;
}

/* partial re-blue: only the parts that changed re-wipe (wipeParts) */
.sketch:not(.draw) .hl .wipe,
.sketch:not(.draw) .hl path.wipe {
  -webkit-clip-path: inset(0 100% 0 0);
  clip-path: inset(0 100% 0 0);
  animation: e2-wipe 400ms var(--ease-out) 60ms forwards;
}

@keyframes e2-ink { to { stroke-dashoffset: 0; } }
@keyframes e2-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes e2-wipe {
  from { -webkit-clip-path: inset(0 100% 0 0); clip-path: inset(0 100% 0 0); }
  to { -webkit-clip-path: inset(0 0 0 0); clip-path: inset(0 0 0 0); }
}
@keyframes e2-balloon {
  from { opacity: 0; transform: scale(.8); }
  to { opacity: 1; transform: scale(1); }
}

/* --------------------------------------------------------------------------
   5.2 Ledger entry (weapon row) — .wrow
   -------------------------------------------------------------------------- */
/* the two number tracks grow with Dynamic Type (two tabular digits are about 1.3em), so at the accessibility sizes
   "70" and "69" never run together into "7069"; at the default size they stay 44pt. A rare wider value (three digits)
   widens only its own row */
.wrow, .colhead { --num-col: minmax(max(44px, 1.35rem), max-content); }
.wrow {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) var(--num-col) var(--num-col);
  column-gap: 12px;
  align-items: start;
  min-height: 72px;
  margin: 0;
  padding: 12px var(--row-x);
  border: 0;
  border-radius: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-state) var(--ease-out);
}
.wrow:active { background-color: rgba(92, 200, 255, .08); transition: none; }
/* style-change FLIP (§7.4): a moving row is opaque, so it covers the rows it crosses instead of overprinting them */
.wrow.flipping { background: var(--surface); position: relative; transition: none; }
.wrow::after {
  content: '';
  position: absolute;
  left: calc(var(--row-x) + 72px + 12px);
  right: 0;
  bottom: 0;
  height: var(--hair);
  background: rgba(150, 215, 255, .08);
  pointer-events: none;
}
/* the last row of a list panel takes the panel's bottom corners for its pressed tint */
.list > .wrow:last-child { border-radius: 0 0 var(--r-panel) var(--r-panel); }
.wrow:last-child::after,
.wrow:not(:has(+ .wrow))::after { display: none; }
.wrow > .thumb { grid-column: 1; }

.wrow-main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
/* Rows never cut a name (amends §5.2 line 1: wraps, no ellipsis). Line 1 is set as running text so a long name
   ("FSS Carbon Edge 1095", or "ISO Nightshade" at larger text) wraps between words and the tier tag follows the
   last word, dropping to the next line only when it doesn't fit. Rows use min-height, so they grow. */
.wrow-l1 {
  display: block;
  min-width: 0;
  font: 600 var(--fs-headline)/var(--lh-headline) var(--font-ui);
  font-stretch: var(--wd-semi);
}
.wrow-name {
  display: inline;
  min-width: 0;
  font: 600 var(--fs-headline)/var(--lh-headline) var(--font-ui);
  font-stretch: var(--wd-semi);
  color: var(--ink);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.wrow-l1 > .tier { flex: none; margin-left: 6px; vertical-align: middle; top: -1px; }
.wrow-l2 {
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  color: var(--ink-2);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.wrow.locked .wrow-l2,
.wrow-l2 :is(.lock, .locked-l) { color: var(--brass-text); }
.wrow-l3 {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.wrow-l3 :is(svg, .tri) { flex: none; width: 7px; height: 7px; }

.wrow-max,
.wrow-you,
.wrow-fit {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  padding-top: 2px;
  font: 600 var(--fs-dm)/var(--lh-headline) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}
.wrow-max { grid-column: 3; }
.wrow-you { grid-column: 4; font-weight: 500; color: var(--ink-2); }
.wrow-you:is(.is-max),
.wrow.is-max .wrow-you { color: var(--green); }
.wrow-you svg { flex: none; width: 9px; height: 9px; color: var(--green); }
/* at max the You cell is the check alone (the number is in the label), centred in its column */
.wrow-you.is-max { justify-content: center; }
.wrow-you.is-max svg { width: 14px; height: 14px; margin-top: 4px; stroke-width: 2.4; }
.wrow.locked .wrow-you { color: var(--ink-3); }
/* launchers and melee: not rated against guns */
.wrow-max.na,
.wrow-you.na { font-weight: 500; color: var(--ink-3); }
/* a section header that sits right on a column head: the column head's double rule is the only rule */
.sec-h:has(+ .list > .colhead:first-child) { border-bottom: 0; padding-bottom: 4px; }

/* Arsenal › Maps: column 3 is map fit with a 40×4 diverging tick bar under it */
.wrow-fit {
  grid-column: 3;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.wrow-fit:is(.hi, .pos, .good) { color: var(--green); }
.wrow-fit:is(.lo, .neg, .bad) { color: var(--red); }
.wrow-fit + .wrow-max { grid-column: 4; }
.fitbar {
  --v: 50;
  position: relative;
  display: block;
  flex: none;
  width: 40px;
  height: 4px;
  background: var(--rule);
}
.fitbar::before {                               /* centre line at 50 */
  content: '';
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 1px;
  margin-left: -.5px;
  background: var(--rule-strong);
}
.fitbar > i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: min(50%, calc(var(--v) * 1%));
  width: max(calc((var(--v) - 50) * 1%), calc((50 - var(--v)) * 1%));
  background: var(--ink-3);
}
.wrow-fit:is(.hi, .pos, .good) .fitbar > i,
.fitbar > i:is(.pos, .up) { background: var(--green); box-shadow: 0 0 6px rgba(111, 224, 166, .45); }
.wrow-fit:is(.lo, .neg, .bad) .fitbar > i,
.fitbar > i:is(.neg, .down) { background: var(--red); }

/* secondary / plain ledger rows that reuse the row grid without numbers */
.wrow.plain { grid-template-columns: 72px minmax(0, 1fr); }

/* --------------------------------------------------------------------------
   5.3 Column head and group label
   -------------------------------------------------------------------------- */
/* 7.10 Column head: sticky inside its list panel, regular glass so the rows blur beneath it once it docks under
   the compact brand bar (SPEC §7.10). A frost hairline replaces the double rule; text is --ink-2 (on glass,
   never --ink-3). As a panel's first child it takes the panel's top corners. */
.colhead {
  position: sticky;
  top: var(--stick-col, var(--stick));
  z-index: var(--z-sticky);
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) var(--num-col) var(--num-col);
  column-gap: 12px;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--colhead-h, 32px);
  margin-top: 0;
  margin-bottom: 0;
  padding: 0 var(--row-x);
  border-bottom: 0;
  background: var(--glass-regular);
  -webkit-backdrop-filter: var(--blur-regular);
  backdrop-filter: var(--blur-regular);
  box-shadow: inset 0 calc(var(--hair) * -1) 0 rgba(150, 215, 255, .12);
  font: 600 12px/16px var(--font-ui);
  color: var(--ink-2);
}
.list > .colhead:first-child { border-radius: var(--r-panel) var(--r-panel) 0 0; }
:where(.sheet) .colhead { top: calc(var(--safe-t) + 50px); }
/* the style pull-down rides in Arsenal's and Maps' column heads, so the style stays in reach while the list
   scrolls (SPEC §7.10). 28pt capsule in the 32pt head; its hit area reaches 44 */
.colhead .nav-pull.sm {
  position: relative;
  min-height: 24px;
  margin: -2px 0 -2px 2px;
  padding: 0 4px 0 6px;
  gap: 4px;
  vertical-align: middle;
  font: 600 12px/16px var(--font-ui);
  color: var(--blue);
}
/* the 44pt slop reaches down, not up: above the docked head sits the compact brand lockup */
.colhead .nav-pull.sm::after { content: ''; position: absolute; left: -4px; right: -4px; top: -4px; height: 44px; }
.colhead .nav-pull.sm svg { width: 8px; height: 5px; }
.colhead .nav-pull.sm[aria-expanded="true"] { background: rgba(92, 200, 255, .14); border-radius: 12px; }   /* full-strength label while open */
/* only while the title row (and its own Balanced capsule) is scrolled away: never two pull-downs on screen */
.colhead .ch-pull { transition: opacity 200ms var(--ease-out), visibility 0s linear 0s; }
#app:not(.compact) .colhead .ch-pull { opacity: 0; visibility: hidden; transition: opacity 200ms var(--ease-out), visibility 0s linear 200ms; }
.colhead > :first-child {
  grid-column: 1 / 3;
  min-width: 0;
  white-space: normal;          /* wraps at larger text instead of cutting the label */
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
.colhead > :not(:first-child) {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  white-space: nowrap;
  text-align: right;
}
.colhead svg { flex: none; width: 7px; height: 7px; }
/* the legend pointers: brass ▼ before Max, blue ▲ before You */
.colhead :is(.ch-max, [data-col="max"]):not(:has(svg))::before,
.colhead :is(.ch-you, [data-col="you"]):not(:has(svg))::before {
  content: '';
  flex: none;
  width: 7px;
  height: 6px;
}
.colhead :is(.ch-max, [data-col="max"]):not(:has(svg))::before {
  background: var(--brass);
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.colhead :is(.ch-you, [data-col="you"]):not(:has(svg))::before {
  background: var(--blue);
  -webkit-clip-path: polygon(50% 0, 100% 100%, 0 100%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.colhead :is(.ch-max, [data-col="max"]) svg { color: var(--brass); fill: currentColor; }
.colhead :is(.ch-you, [data-col="you"]) svg { color: var(--blue); fill: currentColor; }

.group-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 20px var(--row-x) 8px;
  border-bottom: var(--hair) solid rgba(150, 215, 255, .10);
  font: 600 var(--fs-subhead)/var(--lh-subhead) var(--font-ui);
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   5.5 Vernier gauge — .gauge (+ .mini)
   y 0–16 Max label · 17–26 Max pointer · 26 baseline · 26–38 ticks ·
   26–31 gap band · 27–36 You pointer · 42–58 You label and numerals.
   Labels and numerals keep inside the box: centred on their x, sliding to
   flush-left / flush-right over the outer 10% of the scale.
   -------------------------------------------------------------------------- */
.gauge {
  --g-ease: var(--dur-data) var(--ease-out);
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 60px;
  margin: 0;
  color: var(--ink);
}
.gauge:has(> .g-cap) { height: auto; padding-top: 60px; }
.gauge::before {                                        /* baseline */
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 26px;
  height: 1px;
  background: var(--rule-strong);
}
.gauge:has(> .g-base)::before { display: none; }
.gauge > .g-base { position: absolute; left: 0; right: 0; top: 26px; height: 1px; background: var(--rule-strong); }
.gauge > :is(svg:not(:is(.g-ptr, .g-max-p, .g-you-p, .g-max, .g-you, .g-max-l, .g-you-l)), .g-ticks) {
  position: absolute;
  left: 0;
  top: 26px;
  width: 100%;
  height: 12px;
  overflow: visible;
}
.gauge > svg:not(:is(.g-ptr, .g-max-p, .g-you-p, .g-max, .g-you, .g-max-l, .g-you-l)) :is(line, path),
.gauge .g-ticks :is(line, path) {
  vector-effect: non-scaling-stroke;
  shape-rendering: crispEdges;
  stroke: var(--rule-strong);
  stroke-width: 1;
}
.gauge :is(.maj, .major, .t10) { stroke: var(--ink-3); }

.g-gap {
  position: absolute;
  z-index: 1;
  top: 26px;
  left: var(--x-you, 0%);
  width: max(0px, calc(var(--x-max, 0%) - var(--x-you, 0%)));
  height: 5px;
  background: var(--hatch-gap);
  opacity: .45;
  transition: left var(--g-ease), width var(--g-ease);
}

/* pointers: drawn by CSS unless the markup already is an SVG triangle */
:is(.g-max-p, .g-ptr.max, .g-max:not(.g-max-l)) {
  position: absolute;
  z-index: 2;
  top: 17px;
  left: var(--x, 0%);
  width: 10px;
  height: 9px;
  margin-left: -5px;
  transition: left var(--g-ease);
}
:is(.g-max-p, .g-ptr.max, .g-max:not(.g-max-l)):not(svg) {
  background: var(--brass);
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
svg:is(.g-max-p, .g-ptr.max, .g-max) { color: var(--brass); fill: var(--brass); overflow: visible; }

:is(.g-you-p, .g-ptr.you, .g-you:not(.g-you-l)) {
  position: absolute;
  z-index: 3;
  top: 25.5px;
  left: var(--x, 0%);
  width: 13px;
  height: 12px;
  margin-left: -6.5px;
  transition: left var(--g-ease);
}
:is(.g-you-p, .g-ptr.you, .g-you:not(.g-you-l)):not(svg) {           /* 1px page-colour keyline */
  background: var(--eyelet, var(--bg));
  -webkit-clip-path: polygon(50% 0, 100% 100%, 0 100%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
:is(.g-you-p, .g-ptr.you, .g-you:not(.g-you-l)):not(svg)::before {
  content: '';
  position: absolute;
  left: 1.5px;
  right: 1.5px;
  top: 1.5px;
  bottom: 1px;
  background: var(--blue);
  -webkit-clip-path: polygon(50% 0, 100% 100%, 0 100%);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
svg:is(.g-you-p, .g-ptr.you, .g-you) {
  top: 27px;
  width: 10px;
  height: 9px;
  margin-left: -5px;
  color: var(--blue);
  fill: var(--blue);
  stroke: var(--eyelet, var(--bg));
  stroke-width: 1;
  paint-order: stroke;
  overflow: visible;
}

/* labels and numerals */
:is(.g-max-l, .g-you-l, .g-num, .g-n) {
  position: absolute;
  z-index: 2;
  left: var(--x, 0%);
  translate: calc(clamp(-50%, calc(var(--x, 50%) * -5), 0%) + clamp(-50%, calc((90% - var(--x, 50%)) * 5), 0%)) 0;
  white-space: nowrap;
  transition: left var(--g-ease), translate var(--g-ease), opacity var(--dur-state) var(--ease-out);
}
:is(.g-max-l, .g-you-l) {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font: 600 13px/16px var(--font-data);       /* gauge type is fixed chrome */
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.g-max-l { top: 0; }
.g-you-l { top: 42px; }
:is(.g-num, .g-n) {
  top: 43px;
  font: 500 var(--fs-dxs)/var(--lh-dxs) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
}
:is(.g-num, .g-n):is(.hide, .is-hidden, .near, [aria-hidden="true"].hide) { opacity: 0; }
:is(.g-max-l, .g-you-l, .g-num, .g-n):is(.is-start, .start, [data-al="start"]) { translate: 0 0; }
:is(.g-max-l, .g-you-l, .g-num, .g-n):is(.is-end, .end, [data-al="end"]) { translate: -100% 0; }
:is(.g-max-l, .g-you-l) svg { flex: none; width: 6px; height: 6px; }

.g-cap {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  color: var(--ink-2);
}
.g-cap svg { flex: none; width: 12px; height: 12px; }
.g-cap :is(.ok, .check, .ico-check) { color: var(--green); }
.g-cap :is(.lock, .ico-lock) { color: var(--brass-text); }
.gauge + .g-cap { margin-top: 6px; }

/* compact gauge (loadout sheet): 40px, no numerals, no caption, max label only */
.gauge.mini { height: 40px; }
.gauge.mini:has(> .g-cap) { padding-top: 40px; }
.gauge.mini > :is(svg:not(:is(.g-ptr, .g-max-p, .g-you-p, .g-max, .g-you, .g-max-l, .g-you-l)), .g-ticks) { height: 8px; }
.gauge.mini :is(.g-num, .g-n, .g-cap, .g-you-l) { display: none; }

/* --------------------------------------------------------------------------
   5.6 Build ledger — .bl (+ .compact) and .bl-total
   -------------------------------------------------------------------------- */
.bl {
  margin: 0;
  padding: 0;
  list-style: none;
}
.bl > :is(li, .bl-line, .bl-row) {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: start;
  box-sizing: border-box;
  min-height: 64px;
  padding: 10px 0;
}
.bl:not(.compact) > :is(li, .bl-line, .bl-row) + :is(li, .bl-line, .bl-row)::before {
  content: '';
  position: absolute;
  top: 0;
  left: 28px;
  right: 0;
  height: var(--hair);
  background: var(--rule);
}
/* letter circle (matches the balloon on the plate) */
:is(.bl-let, .bl-letter) {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: 1px solid var(--ink-2);
  border-radius: 50%;
  font: 600 11px/1 var(--font-data);
  font-stretch: var(--wd-semi);
  color: var(--ink-2);
}
.bl > * > :is(.bl-let, .bl-letter) { grid-column: 1; grid-row: 1 / span 4; margin-top: 1px; }
:is(.bl-let, .bl-letter):is(.none, .dash, :empty) {
  border: 0;
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  color: var(--ink-3);
}
:is(.bl-let, .bl-letter):empty::before { content: '\2013\2013'; }

.bl > * > :is(.bl-main, .bl-body) { grid-column: 2; min-width: 0; display: flex; flex-direction: column; }
.bl > * > :is(.bl-slot, .att-slot) { grid-column: 2; grid-row: 1; }
.bl > * > :is(.bl-name, .att-name) { grid-column: 2; grid-row: 2; }
.bl > * > :is(.bl-fx, .att-fx) { grid-column: 2; grid-row: 3; }
.bl > * > :is(.bl-note, .att-src) { grid-column: 2; grid-row: 4; }
.bl > * > :is(.bl-lv, .att-lvl) { grid-column: 3; grid-row: 1 / span 2; align-self: start; }

:is(.bl-slot, .att-slot) {
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  color: var(--ink-2);
}
:is(.bl-name, .att-name) {
  min-width: 0;
  font: 600 var(--fs-headline)/var(--lh-headline) var(--font-ui);
  color: var(--ink);
  overflow-wrap: anywhere;
}
:is(.bl-fx, .att-fx) {
  display: flex;
  flex-wrap: wrap;
  column-gap: 10px;
  margin-top: 2px;
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-stretch: var(--wd-semi);
  color: var(--ink-3);
}
:is(.bl-note, .att-src) {
  margin-top: 2px;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  color: var(--ink-3);
}
:is(.bl-lv, .att-lvl) {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  white-space: nowrap;
  text-align: right;
}
:is(.bl-lv, .att-lvl) svg { flex: none; width: 10px; height: 10px; }
/* not yet unlocked */
.bl > .locked :is(.bl-name, .att-name) { color: var(--ink-3); }
.bl > .locked :is(.bl-lv, .att-lvl),
:is(.bl-lv, .att-lvl):is(.locked, .lock) { color: var(--brass-text); }
/* Apex kits: a brass-text "Apex" label in place of the slot */
.bl > .apex :is(.bl-slot, .att-slot),
.bl-apex {
  font-weight: 600;
  color: var(--brass-text);
}

/* compact lines (hero): 36px min. Part names wrap rather than truncate (the hero is the most shared
   surface); letter, slot and level stay on the first line. */
/* Laid out as a wrapping flex line (not a grid) so Dynamic Type never truncates the slot ("Muz…") or breaks a
   part name mid-word: at default sizes letter · slot · name · level share one line exactly as on a grid
   (20 + 8 + 88 + 8 + name + 8 + level); at larger text the name and level drop to a second line under the slot,
   indented past the letter. */
.bl.compact > :is(li, .bl-line, .bl-row) {
  --bl-slot-w: 88px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  column-gap: 8px;
  row-gap: 2px;
  min-height: 36px;
  padding: 8px 0 8px 28px;
}
.bl.compact > * > :is(.bl-let, .bl-letter) { position: absolute; top: 8px; left: 0; margin-top: 0; }
.bl.compact > * > :is(.bl-slot, .att-slot),
.bl.compact > * > :is(.bl-main, .bl-body) > :is(.bl-slot, .att-slot) {
  flex: 0 0 auto;
  min-width: var(--bl-slot-w);
  padding-top: 1px;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.bl.compact > * > :is(.bl-name, .att-name),
.bl.compact > * > :is(.bl-main, .bl-body) > :is(.bl-name, .att-name) {
  flex: 1 1 7em;
  min-width: 0;
  font-size: var(--fs-subhead);
  line-height: var(--lh-subhead);
  font-weight: 500;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: break-word;
  -webkit-hyphens: manual;
  hyphens: manual;
}
.bl.compact > * > :is(.bl-lv, .att-lvl) { flex: none; margin-left: auto; padding-top: 1px; }
.bl.compact > * > :is(.bl-fx, .att-fx, .bl-note, .att-src) { display: none; }
.bl.compact > * > :is(.bl-main, .bl-body) { flex: 1 1 auto; min-width: 0; flex-direction: row; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.bl.compact > * > :is(.bl-main, .bl-body) > :is(.bl-fx, .att-fx, .bl-note, .att-src) { display: none; }

/* total under the double rule */
.bl-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 8px;
  row-gap: 2px;
  margin: 0;
  padding: 10px 0 0;
  border-top: 3px double var(--rule-strong);
  font: 600 var(--fs-headline)/var(--lh-headline) var(--font-ui);
  color: var(--ink);
}
.bl-total > :first-child { flex: 1 1 auto; min-width: 0; }
.bl-total :is(b, strong, .bl-total-v, .v) {
  font: 600 var(--fs-dl)/var(--lh-dl) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  white-space: nowrap;
}
.bl-total :is(.delta, em, .d) { font-style: normal; }
.bl-total > :is(p, small, .bl-sub, .sub, .bl-figs) {
  flex: 1 0 100%;
  margin: 0;
  /* "TTK 296 ms · Mag 30 · 5/5 parts" is a phrase: Archivo with tabular figures, not mono */
  font: 500 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.bl + .bl-total,
.bl + * + .bl-total { margin-top: 0; }

/* --------------------------------------------------------------------------
   5.13 Stat bars — .sbar (base ink-3, gain blue, loss hatched oxblood)
   -------------------------------------------------------------------------- */
.sbar {
  position: relative;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 40px;
  column-gap: 12px;
  align-items: center;
  min-height: 36px;
  padding: 4px 0;
  box-sizing: border-box;
}
.sbar + .sbar { border-top: var(--hair) solid rgba(150, 215, 255, .08); }
.sbar-l {
  min-width: 0;
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font-ui);
  color: var(--ink-2);
}
.sbar-l sup { font-size: .75em; line-height: 0; color: var(--ink-3); }
/* † after an estimate (pick rate, the range card): small, raised, and never taller than the line */
.dag { font-size: .7em; line-height: 0; vertical-align: super; color: var(--ink-3); margin-left: 1px; }
.sbar-t {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: var(--rule);
  overflow: hidden;
}
.sbar-t > * {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 0;
  transition: width var(--dur-data) var(--ease-out), left var(--dur-data) var(--ease-out);
}
.sbar-t > :is(.base, .b) { z-index: 1; background: var(--ink-3); border-radius: 3px 0 0 3px; }
.sbar-t > :is(.gain, .now:not(.neg), .up) { z-index: 1; background: linear-gradient(90deg, var(--accent-hi), var(--blue)); border-radius: 0 3px 3px 0; }
.sbar-t > :is(.loss, .now.neg, .down) { z-index: 2; background: var(--hatch-loss); }
/* "the part that is yours" reads by shape as well as hue: the gain stands 2px proud of the 4px base, with a 2px
   bench-coloured notch where it starts (the sheet is --bg too). A loss gets the same notch. No gain, no notch. */
.sbar-t { overflow: visible; }
.sbar-t > :is(.gain, .now:not(.neg), .up) { top: -2px; bottom: -2px; box-shadow: -2px 0 0 var(--surface), 0 0 6px rgba(56, 170, 255, .45); }
.sbar-t > :is(.loss, .now.neg, .down) { box-shadow: -2px 0 0 var(--surface); }
.sbar-v {
  font: 500 var(--fs-dm)/var(--lh-dm) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}
.sbar-v :is(em, small, .delta, i) {
  display: block;
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-style: normal;
  color: var(--ink-3);
}
.sbar-v :is(em, small, .delta, i).pos { color: var(--green); }
.sbar-v :is(em, small, .delta, i).neg { color: var(--red); }

/* --------------------------------------------------------------------------
   7.13 Map-fit rows (diverging around 50) — .mfit. Each row leads with a
   generated skyline thumbnail (Art.mapThumb: size, verticality, overhead).
   Above-average bars are frost with a glow; below-average are red, flat.
   Columns: thumb · name · bar · value · word. The name, value and word
   columns are in em of the row font, so they grow with Dynamic Type
   ("Shoot House", "100", "Toughest") instead of truncating.
   -------------------------------------------------------------------------- */
.mfit { --mfit-cols: 44px minmax(0, 5.6em) minmax(40px, 1fr) 2em 3.4em; position: relative; margin: 0; padding: 0; list-style: none; }
.mfit > :is(.mfit-row, button, li),
.mfit-row {
  position: relative;
  display: grid;
  grid-template-columns: var(--mfit-cols);
  column-gap: 10px;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;            /* each row opens its map: a 44pt target */
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: left;
}
/* a row without a thumbnail (older markup) keeps the name in the first column */
.mfit-row:not(:has(> .mfit-th)) { grid-template-columns: minmax(0, 6.2em) minmax(40px, 1fr) 2em 3.4em; }
.mfit-row + .mfit-row { box-shadow: inset 0 var(--hair) 0 rgba(150, 215, 255, .06); }
.mfit > button:active,
.mfit-row:is(button):active { background: rgba(92, 200, 255, .08); }
.mfit-th {
  display: block;
  width: 44px;
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45);
}
.mfit-th > svg { display: block; width: 100%; height: 100%; }
.mfit-n {
  min-width: 0;
  font: 400 var(--fs-subhead)/var(--lh-subhead) var(--font-ui);
  color: var(--ink-2);
  white-space: normal;          /* map names wrap at larger text; never cut */
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}
:is(.mfit-row, .mfit > *):is(.top, .top3) .mfit-n { font-weight: 600; color: var(--ink); }
.mfit-bar {
  --v: 50;
  position: relative;
  align-self: stretch;
  min-height: 36px;
  background: none;
  overflow: visible;
}
.mfit-bar::before {                                    /* the average line at 50 */
  content: '';
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 1px;
  margin-left: -.5px;
  background: rgba(150, 215, 255, .22);
}
.mfit-bar > i {
  position: absolute;
  top: 50%;
  height: 8px;
  margin-top: -4px;
  border-radius: 0 4px 4px 0;
  left: min(50%, calc(var(--v) * 1%));
  width: max(calc((var(--v) - 50) * 1%), calc((50 - var(--v)) * 1%));
  background: linear-gradient(90deg, var(--accent-hi), var(--blue));
  box-shadow: 0 0 8px rgba(56, 170, 255, .55);
  transition: left var(--dur-data) var(--ease-out), width var(--dur-data) var(--ease-out);
}
.mfit-bar > i:is(.neg, .down, .lo),
:is(.mfit-row, .mfit > *):is(.neg, .below, .lo, .worst) .mfit-bar > i { background: var(--red); box-shadow: none; border-radius: 4px 0 0 4px; }
.mfit-bar > i:is(.pos, .up, .hi) { background: linear-gradient(90deg, var(--accent-hi), var(--blue)); }
.mfit-v,
:is(.mfit-row, .mfit > *) > b {
  font: 600 var(--fs-dm)/var(--lh-dm) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
}
.mfit-note,
:is(.mfit-row, .mfit > *) > em {
  font: 600 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  font-style: normal;
  color: var(--green);
  white-space: nowrap;
}
:is(.mfit-note, :is(.mfit-row, .mfit > *) > em):is(.bad, .neg, .worst, .tough) { color: var(--red); }
/* "Best" on a below-average bar, "Toughest" on an above-average one: relative only, so neither green nor red */
.mfit .mfit-note.muted { color: var(--ink-2); }
/* the "avg 50" label rides the bar column: the header keeps the row font size so its em columns match the
   rows, and the dataXS type goes on the label itself */
:is(.mfit-avg, .mfit-h) {
  display: grid;
  grid-template-columns: var(--mfit-cols, minmax(0, 6.2em) minmax(40px, 1fr) 2em 3.4em);
  column-gap: 10px;
  margin-bottom: 2px;
  font-size: var(--fs-body);
}
:is(.mfit-avg, .mfit-h) > * {
  grid-column: 3;
  justify-self: center;
  white-space: nowrap;
  text-align: center;
  font: 500 var(--fs-dxs)/var(--lh-dxs) var(--font-data);
  font-stretch: var(--wd-semi);
  color: var(--ink-2);
}
.mfit:not(:has(.mfit-th)) :is(.mfit-avg, .mfit-h) { grid-template-columns: minmax(0, 6.2em) minmax(40px, 1fr) 2em 3.4em; }
.mfit:not(:has(.mfit-th)) :is(.mfit-avg, .mfit-h) > * { grid-column: 2; }

/* --------------------------------------------------------------------------
   5.15 Rating history chart — .chart (inline SVG, 100% × 140)
   -------------------------------------------------------------------------- */
.chart { position: relative; display: block; width: 100%; touch-action: pan-y; }
.chart > svg,
svg.chart { display: block; width: 100%; height: 140px; overflow: visible; }
.chart :is(.grid, .ch-grid) :is(line, path),
.chart line:is(.grid, .gl) {
  stroke: var(--rule);
  stroke-width: .5;
  shape-rendering: crispEdges;
}
.chart text {
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  font-stretch: var(--wd-semi);
  fill: var(--ink-3);
}
.chart :is(.line, .ch-line, .sp-line, polyline) {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart :is(.pt, .ch-pt, circle:not(.cur-dot)) {
  fill: var(--bg);
  stroke: var(--ink);
  stroke-width: 1.5;
}
.chart :is(.pt, .ch-pt, circle):is(.up, .buff) { fill: var(--green); stroke: var(--green); }
.chart :is(.pt, .ch-pt, circle):is(.down, .nerf) { fill: var(--red); stroke: var(--red); }
.chart :is(.pm, .ch-pm, .patch) :is(line, path),
.chart line:is(.pm, .ch-pm, .patch) {
  stroke: var(--rule-strong);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.chart text:is(.pl, .ch-pl) { fill: var(--ink-3); }
.chart text:is(.last, .ch-last, .tv) { font-size: 13px; font-weight: 600; fill: var(--ink); }
.chart :is(.cur, .ch-cur) { stroke: var(--ink-2); stroke-width: 1; }
.chart :is(.readout, .ch-read) {
  position: absolute;
  top: 0;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--ink);
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-stretch: var(--wd-semi);
  color: var(--bg);
  white-space: nowrap;
  pointer-events: none;
}
.chart :is(rect.readout, rect.ch-read) { fill: var(--ink); }
.chart :is(text.readout, text.ch-read) { fill: var(--bg); }
.chart.draw :is(.line, .ch-line)[pathLength] {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: e2-ink var(--dur-chart) var(--ease-out) forwards;
}
/* the change list under the chart */
.chg {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.chg > * {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  color: var(--ink-2);
}
.chg svg { flex: none; width: 7px; height: 7px; }

/* --------------------------------------------------------------------------
   5.16 Sparkline — .spark (Balance watch and patch review only)
   -------------------------------------------------------------------------- */
.spark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-width: 0;
}
.spark svg { display: block; flex: none; width: 44px; height: 14px; overflow: visible; }
.spark :is(.sp-line, polyline) { fill: none; stroke: var(--ink-3); stroke-width: 1.25; stroke-linejoin: round; stroke-linecap: round; }
.spark .sp-base { fill: none; stroke: var(--rule); stroke-width: .5; stroke-dasharray: none; }
.spark :is(.sp-dot, circle) { fill: var(--ink-2); stroke: none; }
.spark:is(.s-up, .up) :is(.sp-dot, circle) { fill: var(--green); }
.spark:is(.s-down, .down) :is(.sp-dot, circle) { fill: var(--red); }
.spark :is(b, .sp-d) {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font: 600 var(--fs-dm)/var(--lh-dm) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.spark:is(.s-up, .up) :is(b, .sp-d) { color: var(--green); }
.spark:is(.s-down, .down) :is(b, .sp-d) { color: var(--red); }
.spark :is(b, .sp-d) svg { width: 7px; height: 7px; fill: currentColor; }

/* --------------------------------------------------------------------------
   5.17 Range card — .rangecard (a ruled plate with a pencil range fan)
   -------------------------------------------------------------------------- */
.rangecard,
.paper.rangecard {
  aspect-ratio: auto;
  height: 190px;
  padding: 0;
}
.rangecard > svg { width: 100%; height: 100%; }
.rangecard :is(.band, [data-band]) { transition: fill-opacity 300ms var(--ease-out), opacity 300ms var(--ease-out); }
:is(.rc-legend, .rangecard + .legend) {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 8px;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  color: var(--ink-2);
}
:is(.rc-legend, .rangecard + .legend) > * { display: inline-flex; align-items: baseline; gap: 6px; }
/* only the percentage is data; the band name ("Mid") stays Archivo */
:is(.rc-legend, .rangecard + .legend) > * > :is(b, .d-s) {
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Definition table (published numbers) — .deftable
   -------------------------------------------------------------------------- */
.deftable {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}
.deftable.two { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.deftable > :is(div, li, .dt-row) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin: 0;
  border-bottom: var(--hair) solid var(--rule);
}
.deftable > :is(div, li, .dt-row):last-child { border-bottom: 0; }
.deftable.two > :is(div, li, .dt-row):nth-last-child(2):nth-child(odd) { border-bottom: 0; }
/* Dynamic Type: the label never shrinks below its longest word. When label and value no longer fit side by
   side, the value drops under its label, right-aligned, instead of overprinting it. The 0 basis keeps the
   default layout ("Sprint to / fire" wraps beside "180 ms" exactly as before). */
.deftable > :is(div, li, .dt-row) { flex-wrap: wrap; column-gap: 12px; row-gap: 0; }
.deftable :is(dt, .dt-l),
.deftable > :is(div, li, .dt-row) > :first-child {
  flex: 1 1 0%;
  margin: 0;
  min-width: auto;
  font: 400 var(--fs-callout)/var(--lh-callout) var(--font-ui);
  color: var(--ink-2);
}
.deftable :is(dd, .dt-v),
.deftable > :is(div, li, .dt-row) > :last-child:not(:first-child) {
  flex: none;
  margin: 0 0 0 auto;
  font: 500 var(--fs-dm)/var(--lh-dm) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}
.deftable :is(dd, .dt-v) :is(small, .u, i),
.deftable > * > :last-child :is(small, .u, i) {
  margin-left: .3em;
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-style: normal;
  color: var(--ink-3);
}
/* damage profile: mono pairs "30 · 0–25 m" */
.dmgprof {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  min-height: 36px;
  align-items: center;
  border-top: var(--hair) solid var(--rule);
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
.dmgprof :is(b, strong) { font-weight: 600; color: var(--ink); }
.deftable + .dmgprof { border-top: var(--hair) solid var(--rule); }

/* --------------------------------------------------------------------------
   5.24 How it compares — .traits (weapon sheet, after Build)
   Ledger lines in two groups. The sign is plain text in the data face, the
   ledger's own good/bad language (as .delta): + in verdigris for a strength,
   − in oxblood for a weakness, never boxed, so it reads without colour and
   never looks like an edit control. The label is Archivo at body size; the
   detail is a footnote phrase whose measurements (.num) are Martian Mono and
   whose counts stay in Archivo. Hairlines between lines are inset to the
   text column. An empty group, or the whole section, says why in --ink-2.
   -------------------------------------------------------------------------- */
.traits-lead {
  margin: 12px 0 0;
  font: 400 var(--fs-body)/var(--lh-body) var(--font-ui);
  color: var(--ink-2);
}
.traits-h {
  margin: 12px 0 0;
  font: 600 var(--fs-subhead)/var(--lh-subhead) var(--font-ui);
  color: var(--ink-2);
}
.traits-top + .traits-h { margin-top: 16px; }
:is(.traits-list, .trait-none) + .traits-h { margin-top: 20px; }
.traits-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.trait {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  column-gap: 8px;
  align-items: start;
  margin: 0;
  padding: 10px 0;
}
.trait + .trait::before {
  content: '';
  position: absolute;
  top: 0;
  left: 28px;
  right: 0;
  height: var(--hair);
  background: var(--rule);
}
/* the sign sits on the label's first line: same size and line height, so it aligns at any text size */
.trait-mark {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin-top: 0;
  font: 600 var(--fs-body)/var(--lh-body) var(--font-data);
  text-align: center;
}
.trait.pos .trait-mark { color: var(--green); }
.trait.neg .trait-mark { color: var(--red); }
.trait-l {
  grid-column: 2;
  min-width: 0;
  font: 400 var(--fs-body)/var(--lh-body) var(--font-ui);
  color: var(--ink);
  overflow-wrap: break-word;
}
/* an estimated basis: a plain muted word after the label, never a pill */
.trait-est {
  margin-left: 4px;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  color: var(--ink-3);
  white-space: nowrap;
}
.trait-d {
  grid-column: 2;
  min-width: 0;
  margin-top: 2px;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  overflow-wrap: break-word;
}
.traits .num {
  font-family: var(--font-data);
  font-weight: 400;
  font-stretch: var(--wd-semi);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* an empty group: the reason as a line of the list, in the label column */
.trait-none {
  margin: 0;
  padding: 10px 0 10px 28px;
  font: 400 var(--fs-body)/var(--lh-body) var(--font-ui);
  color: var(--ink-2);
}
:is(.traits-list, .trait-none, .traits-lead) + .foot { margin-top: 8px; }
/* what wasn't compared, behind a plain link-styled disclosure (44pt tall, no marker) */
.traits-more { margin: 4px 0 0; }
.traits-more > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}
.traits-more > summary::-webkit-details-marker { display: none; }
.traits-more > summary::after { display: none; }
.traits-more > .foot { margin-top: 0; }

/* --------------------------------------------------------------------------
   Deltas — .delta (+ .pos, .neg): inline dataS, colour + sign, never boxed
   -------------------------------------------------------------------------- */
.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data);
  font-stretch: var(--wd-semi);
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  white-space: nowrap;
}
.delta.pos { color: var(--green); }
.delta.neg { color: var(--red); }
.delta svg { flex: none; width: 7px; height: 7px; fill: currentColor; }
.delta + .delta { margin-left: 10px; }
/* the old chip class, flattened */
.fx { background: none; padding: 0; font: 500 var(--fs-ds)/var(--lh-ds) var(--font-data); font-stretch: var(--wd-semi); }
.fx.pos { color: var(--green); }
.fx.neg { color: var(--red); }

/* --------------------------------------------------------------------------
   Narrow phones (SPEC §8.1): 64px thumbs at 341–389, 56px at 320
   -------------------------------------------------------------------------- */
@media (max-width: 389px) {
  .wrow,
  .colhead {
    --num-col: minmax(max(40px, 1.35rem), max-content);
    grid-template-columns: 64px minmax(0, 1fr) var(--num-col) var(--num-col);
    column-gap: 10px;
  }
  .wrow::after { left: calc(var(--row-x) + 64px + 10px); }
  .wrow.plain { grid-template-columns: 64px minmax(0, 1fr); }
  .thumb,
  .paper.thumb { width: 64px; height: 36px; }
  /* 12px gutter: two condensed digits at 10px ("28") fit inside it */
  .thumb .plate-no { width: 12px; font-size: 10px; letter-spacing: -.3px; }
  .thumb:has(> .plate-no) > :is(svg, .sketch) { margin-left: 12px; width: calc(100% - 12px); }
  .sbar { grid-template-columns: 88px minmax(0, 1fr) 40px; column-gap: 10px; }
  .bl.compact > :is(li, .bl-line, .bl-row) { --bl-slot-w: 76px; }
}
@media (max-width: 340px) {
  .wrow,
  .colhead {
    --num-col: minmax(max(38px, 1.35rem), max-content);
    grid-template-columns: 56px minmax(0, 1fr) var(--num-col) var(--num-col);
    column-gap: 8px;
  }
  .wrow::after { left: calc(var(--row-x) + 56px + 8px); }
  .wrow.plain { grid-template-columns: 56px minmax(0, 1fr); }
  .thumb,
  .paper.thumb { width: 56px; height: 32px; }
  .mfit { --mfit-cols: 36px minmax(0, 5.6em) minmax(34px, 1fr) 2em 3.4em; }
  .mfit-th { width: 36px; height: 24px; }
}

/* --------------------------------------------------------------------------
   Reduced motion: sketches render final with the wash present; data changes
   are instant (the --dur tokens already go to 0 for transitions).
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sketch.draw :is(.i1, .i2, .fills, .hl path, .callouts *),
  .sketch .hl .wipe,
  .paper .fig,
  .paper .note,
  .chart.draw * {
    animation: none !important;
    stroke-dashoffset: 0 !important;
    -webkit-clip-path: none !important;
    clip-path: none !important;
  }
  .sketch.draw :is(.fills, .callouts *) { opacity: 1 !important; }
}
:root[data-motion="reduce"] :is(.sketch.draw :is(.i1, .i2, .fills, .hl path, .callouts *), .sketch .hl .wipe, .paper .fig, .paper .note, .chart.draw *) {
  animation: none !important;
  stroke-dashoffset: 0 !important;
  -webkit-clip-path: none !important;
  clip-path: none !important;
}
:root[data-motion="reduce"] .sketch.draw :is(.fills, .callouts *) { opacity: 1 !important; }
