/*
  Legendary Designer workspace (plugins/legendary-designer.html).

  Everything to the first marked block is a faithful lift of Legendary UI's source of record,
  Docs\Legendary\ui\designer\round3\workspace.html, rebuilt whole by scratchpad\relift.py
  rather than patched. Loads after legendary-designer.css.

  The only change when lifting: the mock drives layout from <body>; on the live page the body
  belongs to the site, so those state classes go on .ld-page.
*/

/* Mock scaffolding only, not part of the shipped CSS: on the live page the
   body belongs to the site and already has no margin. Here .ld-page is a div
   inside <body>, so the browser default 8px margin came back when the state
   classes moved off <body>, which made the page 374px wide in a 390px
   viewport and pushed the hero 24px past the right edge. */
body { margin: 0; background: #0d0f12; }

/* ------------------------------------------------------------------------
   Round 3 additions. These are candidates for designer.css once the owner
   approves the layout; they are kept here so the approved sheet is not
   disturbed before then.
   ---------------------------------------------------------------------- */

/* A grid track's minimum is auto, and an auto minimum means "as big as my
   content, whatever the container says". That has now bitten three times in
   this one component: the middle track of .r3-fx-id, the implicit column of
   .r3-fx-ids above it, and this row, where the shell has an explicit height
   but an implicit auto row, so at 1024x768 the row took its content's 724px
   inside a 629px shell and the dock stretched past the status bar. The
   symptom is always something further in overflowing and looking guilty.
   Wherever a track is meant to be constrained by its container rather than
   by its content, say minmax(0, ...) and mean it.

   Legendary Web's find and fix. Theirs was scoped to min-width 921px; it
   does not need to be, because the phone block later in this sheet already
   overrides grid-template-rows to auto 1fr, so declaring the desktop value
   in the base rule gets the same result with one less breakpoint to keep in
   step with the other one. */
.ld-page .r3 {
  display: grid;
  grid-template-columns: 52px 1fr clamp(380px, 21vw, 580px);
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - var(--ld-topbar-h) - 30px);
  min-height: 0;
}

/* ---- left tool rail: workspace view modes, not steps ---- */
.ld-page .r3-rail {
  background: var(--ld-surface);
  border-right: 1px solid var(--ld-line);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0; gap: 6px;
}
.ld-page .r3-tool {
  width: 36px; height: 36px; border-radius: var(--ld-r);
  border: 1px solid transparent; background: transparent;
  color: var(--ld-faint);
  display: grid; place-items: center; cursor: pointer;
}
.ld-page .r3-tool:hover { color: var(--ld-text); background: var(--ld-surface-2); }
.ld-page .r3-tool.is-on {
  color: var(--ld-accent);
  background: var(--ld-accent-wash);
  border-color: var(--ld-accent-line);
}
.ld-page .r3-rail-gap { flex: 1; }

/* ---- centre workspace ------------------------------------------------
   One state, always the design. The workbar names what you are looking at
   and stops; it used to switch with the dock, which is how the centre came
   to feel like it was being taken away and given back.
   -------------------------------------------------------------------- */
.ld-page .r3-work {
  position: relative; min-width: 0;
  display: grid; grid-template-rows: 40px minmax(0, 1fr);
  background: var(--ld-bg);
}
.ld-page .r3-workbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  border-bottom: 1px solid var(--ld-line-soft);
  background: var(--ld-surface);
  position: relative; z-index: 3;
}
.ld-page .r3-crumb {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; font-weight: 600; color: var(--ld-text);
}
.ld-page .r3-crumb span { color: var(--ld-faint); font-weight: 500; }
.ld-page .r3-canvas { position: relative; min-height: 0; overflow: hidden; }

/* ---- the living backdrop ---------------------------------------------
   Four layers, all decoration, all pointer-events: none and aria-hidden,
   none of them ever reachable by the keyboard.

   plate   the generated forge, drifting slowly and parallaxing least
   haze    a soft cloud that parallaxes most, so the room has depth
   sweep   a single wide band of light crossing every 19s
   embers  one canvas, about seventy particles, drawn in one pass

   The plate is dark on purpose, darkened again after generation, because
   the dock and the facts column have to stay the brightest things on the
   screen. The vignette on top of all of it is what keeps the hero readable
   wherever the plate happens to be bright.
   -------------------------------------------------------------------- */
.ld-page .r3-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ld-page .r3-bg-plate,
.ld-page .r3-bg-haze,
.ld-page .r3-bg-sweep,
.ld-page .r3-bg-embers,
.ld-page .r3-vignette { position: absolute; will-change: transform; }

/* Two properties, one per size, and the media query swaps which one is
   read rather than redeclaring the same one. The first version declared
   --r3-plate twice, at the top and again in the phone block, which means a
   single override in a later sheet beats both and hands phones the 2048
   wide plate: the exact opposite of what the phone override is for.
   Legendary Web caught that during the lift.

   Both values are relative here so the mock renders from the files beside
   it, and site-absolute on the live page, where they are served from
   /images/legendary/stage/ to match the site's /images/items/ convention.
   An override has to name both, and if it names only one the other 404s
   visibly rather than quietly serving the wrong size. */
.ld-page {
  --r3-plate: url("/images/legendary/stage/plate.webp");
  --r3-plate-sm: url("/images/legendary/stage/plate-half.webp");
}

.ld-page .r3-bg-plate {
  inset: -5%;
  background: var(--r3-plate) center 62% / cover no-repeat;
  transform: translate3d(var(--par-x, 0px), var(--par-y, 0px), 0) scale(1.04);
  animation: r3-drift 54s ease-in-out infinite alternate;
}
.ld-page .r3-bg-haze {
  inset: -14%;
  background:
    radial-gradient(42% 30% at 32% 66%, rgba(145, 170, 200, .085), transparent 70%),
    radial-gradient(38% 26% at 68% 72%, rgba(120, 150, 185, .07), transparent 72%);
  transform: translate3d(calc(var(--par-x, 0px) * 2.6), calc(var(--par-y, 0px) * 2.6), 0);
  animation: r3-haze 37s ease-in-out infinite alternate;
}
.ld-page .r3-bg-sweep {
  top: -30%; bottom: -30%; left: -40%; width: 34%;
  background: linear-gradient(100deg, transparent, rgba(190, 215, 240, .055) 45%, transparent);
  transform: translate3d(-40%, 0, 0) rotate(9deg);
  animation: r3-sweep 19s linear infinite;
}
.ld-page .r3-bg-embers { inset: 0; width: 100%; height: 100%; }
.ld-page .r3-vignette {
  inset: 0;
  background:
    radial-gradient(76% 70% at 50% 56%, transparent 34%, rgba(5, 7, 13, .5) 78%, rgba(5, 7, 13, .84) 100%),
    linear-gradient(to top, rgba(5, 7, 13, .5), transparent 34%);
}

@keyframes r3-drift {
  from { transform: translate3d(var(--par-x, 0px), var(--par-y, 0px), 0) scale(1.04); }
  to   { transform: translate3d(calc(var(--par-x, 0px) - 18px), calc(var(--par-y, 0px) - 10px), 0) scale(1.075); }
}
@keyframes r3-haze {
  from { transform: translate3d(calc(var(--par-x, 0px) * 2.6), calc(var(--par-y, 0px) * 2.6), 0) scale(1); opacity: .8; }
  to   { transform: translate3d(calc(var(--par-x, 0px) * 2.6 + 40px), calc(var(--par-y, 0px) * 2.6 - 16px), 0) scale(1.1); opacity: 1; }
}
@keyframes r3-sweep {
  0%   { transform: translate3d(-40%, 0, 0) rotate(9deg); }
  55%  { transform: translate3d(360%, 0, 0) rotate(9deg); }
  100% { transform: translate3d(360%, 0, 0) rotate(9deg); }
}

/* ---- the stage -------------------------------------------------------
   The hero sits on the plinth the plate was generated around, so the art
   and the layout agree about where the floor is: the podium is pushed down
   to 54% of the pane and the image sits on top of the ring rather than
   floating in the middle of the frame.
   -------------------------------------------------------------------- */
.ld-page .r3-stagewrap {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 20vw, 540px);
  height: 100%; min-height: 0;
}
.ld-page .r3-stagepane {
  position: relative; min-width: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  justify-items: center; align-items: center;
  padding: clamp(12px, 1.6vw, 34px);
}
.ld-page .r3-podium {
  position: relative;
  width: min(74%, 58vh); aspect-ratio: 1;
  display: grid; place-items: center;
  transform: translateY(4%);
}

/* The aura is the one piece of the stage that carries data. --aura-h is the
   hue of the strongest perk's state and --aura-i runs 0 to 1 on perk count
   and mean potency: the live page sets both on .r3-podium, and everything
   else here is a function of them, so a weak design glows faintly and a
   stacked one lights the room. Values in this mock: three perks, mean 77%
   of their live medians, one of them far over its cap. */
.ld-page .r3-aura {
  position: absolute; inset: -16%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 54%,
      hsla(var(--aura-h, 168), 72%, 62%, calc(.52 * var(--aura-i, .5))) 0%,
      hsla(var(--aura-h, 168), 72%, 55%, calc(.26 * var(--aura-i, .5))) 38%,
      transparent 70%);
  filter: blur(calc(10px + 22px * var(--aura-i, .5)));
  animation: r3-breathe 5.4s ease-in-out infinite;
  pointer-events: none;
}
/* the light the aura throws on the plinth top: an ellipse, not a circle,
   because the plate's camera is slightly above the floor */
.ld-page .r3-aura-pool {
  position: absolute; left: 50%; bottom: 6%;
  width: 72%; height: 15%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side,
    hsla(var(--aura-h, 168), 70%, 66%, calc(.5 * var(--aura-i, .5))), transparent 72%);
  filter: blur(7px);
  animation: r3-breathe 5.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes r3-breathe {
  0%, 100% { opacity: .82; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.045); }
}
.ld-page .r3-aura-pool { transform-origin: 50% 100%; }

.ld-page .r3-hero {
  position: relative;
  width: 86%; aspect-ratio: 1;
  display: grid; place-items: center;
}
.ld-page .r3-hero img {
  width: 100%; height: 100%; object-fit: contain;
  filter:
    drop-shadow(0 22px 30px rgba(0, 0, 0, .78))
    drop-shadow(0 0 calc(10px + 26px * var(--aura-i, .5)) hsla(var(--aura-h, 168), 70%, 60%, calc(.4 * var(--aura-i, .5))));
}

/* ---- perk emblems docked around the item -----------------------------
   The facts column lists the perks; this shows them. Each emblem is placed
   on an arc by its own --a, counter-rotated so the art stays upright, and
   ringed in its range state's colour so the stage says the same thing the
   rows say without a word of text.
   -------------------------------------------------------------------- */
/* Each emblem hangs off an arm the size of the podium, rotated by its own
   angle, with the emblem pinned to the top of the arm and counter-rotated
   so the art stays upright. The radius is then half the podium whatever
   the podium happens to be, which a translate() percentage cannot do:
   percentages there resolve against the element's own box. */
.ld-page .r3-emblems { position: absolute; inset: -7%; pointer-events: none; }
.ld-page .r3-emblem-arm {
  position: absolute; inset: 0;
  display: grid; justify-items: center; align-items: start;
  transform: rotate(var(--a));
  pointer-events: none;
}
.ld-page .r3-emblem {
  position: relative;
  width: clamp(46px, 3.7vw, 76px); aspect-ratio: 1;
  border: 0; padding: 0; background: transparent;   /* or ButtonFace paints over the disc */
  font: inherit; color: inherit; cursor: pointer;
  transform: rotate(calc(-1 * var(--a)));
  pointer-events: auto;
  animation: r3-float 7s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.ld-page .r3-emblem-disc {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid var(--em, var(--ld-accent-line));
  background: radial-gradient(circle at 50% 36%, rgba(28, 34, 42, .96), rgba(10, 13, 18, .94));
  box-shadow: 0 0 18px -4px var(--em, var(--ld-accent-dim)), inset 0 0 14px -6px var(--em, var(--ld-accent-dim));
  display: grid; place-items: center;
}
.ld-page .r3-emblem-disc img { width: 64%; height: 64%; object-fit: contain; }
.ld-page .r3-emblem-val {
  position: absolute; left: 50%; top: calc(100% + 5px);
  transform: translateX(-50%);
  padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--ld-line);
  background: rgba(8, 11, 16, .86);
  font-size: clamp(9.5px, .62vw, 12.5px); font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--em, var(--ld-accent));
  white-space: nowrap;
}
.ld-page .r3-emblem.is-in { --em: var(--ld-accent); }
.ld-page .r3-emblem.is-below { --em: var(--ld-warn); }
.ld-page .r3-emblem.is-above { --em: var(--ld-bad); }
/* the stage's half of the same decision: a second ring outside the first,
   same colour, so far reads as above with more of it */
.ld-page .r3-emblem.is-far { --em: var(--ld-bad); }
.ld-page .r3-emblem.is-far .r3-emblem-disc::after {
  content: ""; position: absolute; inset: -5px;
  border-radius: 50%; border: 1px solid var(--em);
  opacity: .5;
}
.ld-page .r3-emblem.is-free {
  --em: var(--ld-line);
  opacity: .72;
}
.ld-page .r3-emblem.is-free .r3-emblem-disc {
  border: 1px dashed rgba(183, 190, 207, .42);
  box-shadow: none;
  background: rgba(10, 13, 18, .55);
  color: var(--ld-muted);
}
.ld-page .r3-emblem:hover { z-index: 4; }
.ld-page .r3-emblem:hover .r3-emblem-disc {
  border-color: var(--ld-text);
  box-shadow: 0 0 26px -3px var(--em, var(--ld-accent-dim));
}
@keyframes r3-float {
  0%, 100% { transform: rotate(calc(-1 * var(--a))) translateY(0); }
  50%      { transform: rotate(calc(-1 * var(--a))) translateY(-5px); }
}

/* the caption under the podium: what it is, in one line */
.ld-page .r3-stage-caption {
  display: grid; justify-items: center; gap: 5px;
  padding-bottom: clamp(4px, 1vh, 16px);
  text-align: center;
}
.ld-page .r3-stage-name {
  font-family: Cinzel, Georgia, serif; font-weight: 700;
  font-size: clamp(17px, 1.35vw, 32px);
  letter-spacing: .01em;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .8);
}
.ld-page .r3-stage-sub {
  display: flex; align-items: center; gap: 8px;
  font-size: clamp(10.5px, .72vw, 14px); color: var(--ld-muted);
}

/* ---- facts column ----------------------------------------------------
   Unchanged by round 7 except that it now sits on the stage rather than
   beside a swapping view, so it gets a backdrop blur to lift off the plate.
   -------------------------------------------------------------------- */
.ld-page .r3-itemfacts {
  border-left: 1px solid var(--ld-line-soft);
  background: rgba(10, 13, 18, .72);
  backdrop-filter: blur(9px);
  overflow-y: auto; min-height: 0;
  padding: clamp(18px, 1.4vw, 34px);
  display: flex; flex-direction: column; justify-content: space-evenly;
}
.ld-page .r3-fact-group { flex: 0 0 auto; margin-bottom: 18px; }
.ld-page .r3-fact-label {
  font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ld-faint); margin-bottom: 9px;
}
.ld-page .r3-fact {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: clamp(8px, .8vh, 14px) 0;
  border-bottom: 1px solid var(--ld-line-soft);
  font-size: clamp(12.5px, .78vw, 17px);
}
.ld-page .r3-fact:last-child { border-bottom: 0; }
.ld-page .r3-fact-k { color: var(--ld-muted); }
.ld-page .r3-fact-v { font-weight: 600; }
.ld-page .r3-users { display: flex; gap: 7px; flex-wrap: wrap; }
.ld-page .r3-user {
  width: clamp(42px, 3.2vw, 64px); aspect-ratio: 1; border-radius: var(--ld-r-sm);
  border: 1px solid var(--ld-line-soft); background: var(--ld-surface-2);
  display: grid; place-items: center; overflow: hidden;
}
.ld-page .r3-user img { width: 86%; height: 86%; object-fit: contain; }

/* ---- panels as editors -----------------------------------------------
   A split body: row one is the controls, row two scrolls. Without this the
   whole body scrolled, so searching an item meant scrolling back up to the
   search field you had just typed in.
   -------------------------------------------------------------------- */
/* The fourth time this page has been caught by auto as a minimum, and the
   first on the horizontal axis. A grid item's min-width is auto, so the
   controls row took the select's intrinsic width, which is the width of its
   longest option: Legendary Web measured 413px inside a 379px body at
   1024x768, clipping the dropdown and the right of the tile grid, with an
   ancestor hiding the overflow so there was not even a scrollbar to give it
   away. Both axes of a split body are now explicitly zero-min. */
.ld-page .r3-panel-body.is-split {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden; padding-bottom: 0;
}
.ld-page .r3-panel-body.is-split > * { min-width: 0; }
.ld-page .r3-panel-scroll { overflow-y: auto; min-height: 0; padding-bottom: 13px; }

/* the native select, dressed to match ld-search */
.ld-page .r3-select { position: relative; display: inline-flex; flex: 0 1 auto; min-width: 0; }
.ld-page .r3-select select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 12px; font-weight: 500;
  color: var(--ld-text);
  background: var(--ld-surface-2);
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r);
  padding: 0 26px 0 10px; height: 30px;
  width: 100%; min-width: 0;
  cursor: pointer;
}
.ld-page .r3-select select:hover { border-color: var(--ld-accent-line); }
.ld-page .r3-select svg {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  color: var(--ld-faint); pointer-events: none;
}

/* what is currently chosen, and what choosing it costs you: the count is
   the one number that makes a designer change their mind about an item */
.ld-page .r3-chosen {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  margin-top: 10px; padding: 8px 10px;
  border: 1px solid var(--ld-accent-line);
  border-radius: var(--ld-r);
  background: var(--ld-accent-wash);
}
.ld-page .r3-chosen-art {
  width: 42px; aspect-ratio: 1; border-radius: var(--ld-r-sm);
  background: var(--ld-surface); border: 1px solid var(--ld-line-soft);
  display: grid; place-items: center; overflow: hidden;
}
.ld-page .r3-chosen-art img { width: 88%; height: 88%; object-fit: contain; }
.ld-page .r3-chosen-name { display: block; font-size: 12.5px; font-weight: 600; }
.ld-page .r3-chosen-meta { display: block; font-size: 10.5px; color: var(--ld-faint); margin-top: 2px; }
.ld-page .r3-chosen-use {
  font-size: 10.5px; font-weight: 600; color: var(--ld-accent);
  text-align: right; line-height: 1.3; max-width: 92px;
}

/* a complete section glows at its head. Quiet: an inset bar and a tick,
   not a colour wash, because four of the five are usually complete and a
   dock of five lit panels is a dock with no signal in it. */
.ld-page .r3-done-tick { display: none; color: var(--ld-accent); }
.ld-page .r3-panel.is-done .r3-done-tick { display: grid; place-items: center; }
.ld-page .r3-panel.is-done .r3-panel-head {
  box-shadow: inset 3px 0 0 var(--ld-accent), inset 0 0 26px -14px var(--ld-accent);
}
.ld-page .r3-panel.is-done.is-open .r3-panel-head { box-shadow: inset 3px 0 0 var(--ld-accent); }

/* recipe: a component carries the skin it is made from, so its thumbnail is
   the skin render rather than the base item's icon */
.ld-page .ld-slot-art.is-skin { border-color: var(--ld-accent-line); }
.ld-page .ld-kind.is-writein {
  color: var(--ld-warn);
  border-color: rgba(255, 179, 71, .38);
}
.ld-page .r3-writein {
  font-size: 11.5px; color: var(--ld-muted);
  border: 1px dashed var(--ld-line); border-radius: var(--ld-r);
  padding: 7px 10px; margin-top: 2px;
}

/* ---- right: the panel dock ---- */
.ld-page .r3-dock {
  background: var(--ld-surface);
  border-left: 1px solid var(--ld-line);
  display: flex; flex-direction: column;
  min-height: 0;
}
/* belt and braces on the grid item itself, so the dock may shrink to the row
   rather than the row growing to the dock */
.ld-page .r3 > .r3-dock { min-height: 0; }
/* A closed panel is exactly its 38px header and never shrinks: with the open
   panel free to grow, flex-shrink was squashing the closed headers to 18px
   and clipping their labels. Only the open panel flexes. */
.ld-page .r3-panel {
  display: flex; flex-direction: column;
  border-bottom: 1px solid var(--ld-line);
  flex: 0 0 auto;
}
.ld-page .r3-panel.is-open { flex: 1 1 auto; min-height: 0; }
.ld-page .r3-panel-head {
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 12px;
  background: var(--ld-surface-2);
  border: 0; width: 100%;
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--ld-text);
  cursor: pointer; flex: none;
}
.ld-page .r3-panel-head:hover { background: var(--ld-surface-3); }
.ld-page .r3-panel.is-open .r3-panel-head { background: var(--ld-surface-3); }
.ld-page .r3-caret { color: var(--ld-faint); display: grid; place-items: center; flex: none; transition: none; }
.ld-page .r3-panel.is-open .r3-caret { color: var(--ld-accent); transform: rotate(90deg); }
.ld-page .r3-panel-sum {
  margin-left: auto;
  font-size: 11px; font-weight: 500; color: var(--ld-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 190px;
}
.ld-page .r3-panel-body {
  overflow-y: auto; min-height: 0;
  padding: 13px 12px;
}
.ld-page .r3-panel:not(.is-open) .r3-panel-body { display: none; }

/* ---- perk layers list ---- */
.ld-page .r3-layers { display: grid; gap: 5px; }
.ld-page .r3-layer {
  display: grid; grid-template-columns: 14px 28px 1fr auto auto;
  align-items: center; gap: 9px;
  padding: 7px 8px;
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r);
  background: var(--ld-surface-2);
}
.ld-page .r3-layer.is-sel {
  border-color: var(--ld-accent);
  background: var(--ld-accent-wash);
}
.ld-page .r3-grip { color: var(--ld-faint); cursor: grab; display: grid; place-items: center; }
.ld-page .r3-layer-ico {
  width: 28px; height: 28px; border-radius: 5px;
  background: var(--ld-surface-3);
  display: grid; place-items: center; overflow: hidden;
}
.ld-page .r3-layer-ico img { width: 26px; height: 26px; object-fit: contain; }
.ld-page .r3-layer-name { font-size: 12.5px; font-weight: 600; min-width: 0; }
.ld-page .r3-layer-val { font-size: 12.5px; font-weight: 700; color: var(--ld-accent); }
.ld-page .r3-layer-x {
  width: 20px; height: 20px; border: 0; background: transparent;
  color: var(--ld-faint); display: grid; place-items: center; cursor: pointer;
}
/* the drop line shown while a perk is being dragged in from the grid */
.ld-page .r3-drop {
  height: 2px; border-radius: 1px; background: var(--ld-accent);
  box-shadow: 0 0 10px var(--ld-accent-dim);
  margin: 1px 0;
}
.ld-page .r3-ghost {
  display: grid; grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 9px;
  padding: 7px 8px;
  border: 1px dashed var(--ld-accent-line);
  border-radius: var(--ld-r);
  background: rgba(125, 211, 192, .07);
  opacity: .9;
}

/* ---- the 54 perk grid ---- */
.ld-page .r3-gridhead {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 14px 0 9px;
}
.ld-page .r3-perkgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(74px, 5.6vw, 112px), 1fr));
  gap: 6px;
}
.ld-page .r3-perk {
  position: relative;
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r);
  background: var(--ld-surface-2);
  padding: 7px 4px 6px;
  display: grid; justify-items: center; gap: 5px;
  cursor: grab;
}
.ld-page .r3-perk:hover { border-color: var(--ld-accent-line); background: var(--ld-accent-wash); }
.ld-page .r3-perk.is-used { opacity: .4; cursor: default; }
/* 38px, not 26: this icon style carries real detail and goes to mush below
   about 36px. Checked on a contact sheet at both sizes before choosing. */
.ld-page .r3-perk-ico {
  width: clamp(38px, 3vw, 58px); aspect-ratio: 1; height: auto;
  display: grid; place-items: center;
  color: var(--ld-muted);
}
.ld-page .r3-perk-ico img { width: 100%; height: 100%; object-fit: contain; }
.ld-page .r3-perk-name {
  font-size: 9.5px; font-weight: 600; line-height: 1.15;
  color: var(--ld-muted); text-align: center;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.ld-page .r3-perk.is-used .r3-perk-name { color: var(--ld-faint); }

/* ---- base item picker inside its panel ---- */
.ld-page .r3-itemgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(84px, 6.4vw, 128px), 1fr));
  gap: 7px; margin-top: 10px;
}
.ld-page .r3-itemtile {
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r);
  background: var(--ld-surface-2);
  padding: 8px 5px 7px;
  display: grid; justify-items: center; gap: 5px;
  cursor: grab;
}
.ld-page .r3-itemtile:hover { border-color: var(--ld-accent-line); background: var(--ld-accent-wash); }
.ld-page .r3-itemtile.is-on {
  border-color: var(--ld-accent);
  background: var(--ld-accent-wash);
  box-shadow: 0 0 0 1px var(--ld-accent);
}
.ld-page .r3-itemtile-art { width: clamp(54px, 4.2vw, 84px); aspect-ratio: 1; display: grid; place-items: center; }
.ld-page .r3-itemtile-art img { width: 94%; height: 94%; object-fit: contain; }
.ld-page .r3-itemtile-name {
  font-size: 9.5px; font-weight: 600; color: var(--ld-muted); text-align: center; line-height: 1.2;
}



/* ---- Discard, with the confirm on the control -------------------------
   Built on .ld-btn so it sits in the topbar's rhythm, with its own class
   for the two states. See _src/round8_discard.py for the reasoning.
   -------------------------------------------------------------------- */
.ld-page .r3-discard {
  position: relative;
  overflow: hidden;              /* so the timer bar is clipped to the radius */
  transition: color .12s ease, border-color .12s ease, background-color .12s ease;
}
.ld-page .r3-discard[disabled] { opacity: .42; cursor: not-allowed; }

/* Both labels occupy the same cell, so the button is as wide as its widest
   state and nothing in the topbar moves when it arms. Same for the glyphs. */
.ld-page .r3-discard-labels,
.ld-page .r3-discard-ico { display: grid; }
.ld-page .r3-discard-labels > *,
.ld-page .r3-discard-ico > * { grid-area: 1 / 1; }
.ld-page .r3-discard-ico { width: 14px; height: 14px; place-items: center; }
.ld-page .r3-discard .at-armed { visibility: hidden; }
.ld-page .r3-discard.is-armed .at-idle { visibility: hidden; }
.ld-page .r3-discard.is-armed .at-armed { visibility: visible; }
/* capture only: .ld-page.is-discarding arms the control so the state can be
   rendered. On the live page the class is on the button and nowhere else. */
.ld-page.is-discarding .r3-discard .at-idle { visibility: hidden; }
.ld-page.is-discarding .r3-discard .at-armed { visibility: visible; }
.ld-page.is-discarding .r3-discard {
  color: var(--ld-bad); border-color: var(--ld-bad);
  background: rgba(255, 92, 72, .12);
}
.ld-page.is-discarding .r3-discard .r3-discard-timer { animation: r3-disarm 4s linear forwards; }

/* Armed. Colour is the least of the four signals rather than the only one:
   the word changes, the glyph changes, and the bar below says how long it
   stays this way. */
/* No weight change when it arms. The bolder label was a fifth signal on
   top of word, glyph, colour and timer, and it was the only one that broke
   the width guarantee: font-weight applies to the whole button, so both
   labels re-measure bolder and the shared cell sizes to the bolder pair.
   Legendary Web measured the hole at 1.2px, 158.203 idle against 159.438
   armed at 1024.

   1.2px is nothing to look at. The reason it goes is that "arming moves
   nothing" is a guarantee other people build on, and a guarantee that is
   nearly true is worse than a slightly weaker design that is exactly true.
   The weight was the most redundant of the five signals, so it is the one
   that pays. */
.ld-page .r3-discard.is-armed {
  color: var(--ld-bad);
  border-color: var(--ld-bad);
  background: rgba(255, 92, 72, .12);
}
.ld-page .r3-discard-timer {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--ld-bad);
  transform: scaleX(0); transform-origin: left center;
}
.ld-page .r3-discard.is-armed .r3-discard-timer {
  animation: r3-disarm 4s linear forwards;
}
@keyframes r3-disarm {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}
@media (prefers-reduced-motion: reduce) {
  /* The timeout still runs; only the countdown stops being drawn. A
     destructive control left armed is a worse outcome than a missing
     animation, so this is the one place the behaviour does not follow the
     preference, and the bar holds at full width so the state still reads. */
  .ld-page .r3-discard.is-armed .r3-discard-timer {
    animation: none !important; transform: scaleX(1);
  }
}


/* ==== Help: the shell. LEGENDARY WEB'S, NOT FOR LIFTING ================
   A stand-in for their shell so this mock renders. They own
   .ld-help-scrim, .ld-help-panel, .ld-help-head and the Escape,
   scrim-click and focus-trap behaviour behind them. The z-index is the
   shared token, and both size caps are divided by --ld-zoom because a
   length inside a scaled element is in unscaled pixels.
   ===================================================================== */
.ld-page .ld-help-scrim {
  position: fixed; inset: 0; z-index: var(--ld-over-site);
  display: none; place-items: center;
  padding: clamp(10px, 3vh, 48px);
  background: rgba(3, 5, 9, .8);
  backdrop-filter: blur(7px);
}
.ld-page.is-help .ld-help-scrim { display: grid; animation: r3-fade .22s ease both; }

.ld-page .ld-help-panel {
  position: relative;
  /* Only the viewport term is divided. vw and vh measure the viewport,
     which is outside the scaled subtree, so inside it they have to be
     converted. The pixel caps must not be: they are in the same units as
     everything inside this panel, all of which scales with it, so
     dividing them shrinks the box while its contents keep their size.
     That is what happened at 3072, where the panel came out 38% by 50% of
     the screen with all six cards scrolling inside it.

     Round 8 taught me that a composition has to scale as a whole or not
     at all, and this is the same rule from the other side: the panel and
     its contents are one composition, so the panel is sized in their
     units, and only the measurement that comes from outside is converted.
     Legendary Web caught it, having made it themselves in the drafts
     dialog two sets earlier. */
  width: min(calc(92vw / var(--ld-zoom, 1)), 1180px);
  height: min(calc(88vh / var(--ld-zoom, 1)), 860px);
  display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto;
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r-lg);
  background: var(--ld-surface);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .9);
  overflow: hidden;
}
.ld-page .ld-help-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px clamp(18px, 1.6vw, 28px);
  border-bottom: 1px solid var(--ld-line);
  background: var(--ld-surface-2);
}
.ld-page .ld-help-title {
  font-family: Cinzel, Georgia, serif; font-weight: 700;
  font-size: clamp(16px, 1.25vw, 23px);
}

/* ==== Help: the walkthrough. MINE, THIS IS THE PART TO LIFT ===========
   One step at a time: a stepper, a card, and two buttons.
   ===================================================================== */

/* ---- the stepper -----------------------------------------------------
   Six numbers on a rule, so the modal answers "where am I" and "how many
   left" before it is read. Done ones tick and stay lit, which is the part
   that makes it feel like progress rather than paging.
   -------------------------------------------------------------------- */
.ld-page .r3-hs {
  display: flex; align-items: center; justify-content: center;
  gap: 0; padding: clamp(14px, 2vh, 24px) clamp(18px, 2vw, 40px);
  border-bottom: 1px solid var(--ld-line-soft);
  background: rgba(255, 255, 255, .012);
}
.ld-page .r3-hs-dot {
  position: relative; flex: none;
  width: clamp(28px, 2.3vw, 38px); height: clamp(28px, 2.3vw, 38px);
  border-radius: 50%;
  border: 1px solid var(--ld-line);
  background: var(--ld-surface-2);
  color: var(--ld-faint);
  display: grid; place-items: center;
  font-size: clamp(11px, .82vw, 14px); font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: color .18s ease, border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.ld-page .r3-hs-bar {
  flex: 1 1 auto; height: 1px; min-width: 10px;
  background: var(--ld-line);
}
.ld-page .r3-hs-dot .at-tick { display: none; }
/* done */
.ld-page .r3-hs-dot.is-done {
  border-color: var(--ld-accent-line);
  background: var(--ld-accent-wash);
  color: var(--ld-accent);
}
.ld-page .r3-hs-dot.is-done .at-num { display: none; }
.ld-page .r3-hs-dot.is-done .at-tick { display: block; }
.ld-page .r3-hs-bar.is-done { background: var(--ld-accent-line); }
/* current */
.ld-page .r3-hs-dot.is-now {
  border-color: var(--ld-accent);
  background: var(--ld-accent);
  color: var(--ld-accent-ink);
  box-shadow: 0 0 0 4px var(--ld-accent-wash), 0 0 18px -2px var(--ld-accent-dim);
}

/* ---- the card --------------------------------------------------------
   One step, with its own surface and a clear margin from the panel, so
   the step is obviously a thing sitting on the modal rather than more
   modal. That separation is the whole complaint from round 8.
   -------------------------------------------------------------------- */
/* The card is sized by its content and centred, not stretched to the
   panel: a card with 300px of empty surface under its diagram is the same
   dead space the owner objected to, wearing a border. All six share a
   min-height so the modal does not jump between steps. */
.ld-page .r3-hc-stack {
  position: relative; min-height: 0; display: grid;
  place-items: center; overflow-y: auto;
}
.ld-page .r3-hc {
  grid-area: 1 / 1;
  display: none;
  grid-template-rows: auto auto auto;
  align-content: center; justify-items: center;
  width: min(100%, 820px);
  /* Never taller than the space it is in. The clamp is a floor for looks,
     not a claim on the panel, and 44vh measures the unscaled viewport, so
     inside a zoomed subtree it can ask for more room than the stack has
     and force a scroll by its own minimum rather than by its content.
     Capping it at 100% of the stack means a tight viewport shrinks the
     card instead, and only real content overflow scrolls. */
  min-height: min(clamp(300px, 44vh, 470px), 100%);
  margin: clamp(14px, 2vh, 26px) clamp(16px, 2vw, 40px);
  padding: clamp(16px, 2.4vh, 32px) clamp(18px, 2vw, 40px) clamp(14px, 2vh, 28px);
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r-lg);
  background: var(--ld-surface-2);
  overflow: hidden;
}
/* The slide only. The first version faded in from opacity 0, which means
   the card a player is meant to read is invisible for the first frame and
   stays invisible on a throttled or backgrounded tab: round 8's empty
   modal again, one component later. Legendary Web found it by reading the
   computed opacity in the same tick as a step change.

   The general form, which is worth more than this fix: content a player
   has to read never gets an entry animation that starts from invisible.
   Motion may move it, tint it or scale it. It may not hide it. */
.ld-page .r3-hc.is-now { display: grid; animation: r3-hc-in .32s cubic-bezier(.2, .8, .25, 1) both; }
@keyframes r3-hc-in {
  from { transform: translateX(14px); }
  to   { transform: none; }
}
.ld-page .r3-hc-title {
  margin: 0; text-align: center;
  font-size: clamp(19px, 1.7vw, 32px); font-weight: 700; letter-spacing: -.01em;
}
.ld-page .r3-hc-line {
  margin: 7px 0 0; text-align: center;
  font-size: clamp(12.5px, .88vw, 17px); color: var(--ld-muted);
}

/* The visual: one control, built from the sheet's own classes, with the
   stage's aura behind it at a fraction of its strength. Subtle backdrop
   was the instruction and it is also the only safe amount: this is a
   diagram, and a diagram with weather in it is a picture. */
.ld-page .r3-hc-art {
  position: relative;
  align-self: center; justify-self: center;
  width: 100%; max-width: 600px;
  margin-top: clamp(16px, 2.6vh, 32px);
  padding: clamp(22px, 3.2vh, 40px) clamp(20px, 2.2vw, 36px);
  border: 1px solid var(--ld-line-soft);
  border-radius: var(--ld-r-lg);
  background: rgba(8, 11, 16, .55);
  display: grid; place-items: center;
}
.ld-page .r3-hc-art::before {
  content: ""; position: absolute; inset: 0;
  border-radius: var(--ld-r-lg);
  background: radial-gradient(60% 70% at 50% 60%, hsla(var(--h, 168), 60%, 55%, .12), transparent 72%);
  pointer-events: none;
}
.ld-page .r3-hc-art > * { position: relative; width: 100%; }

/* The specimen is shown larger than it is in the app. A control at life
   size inside a card inside a modal reads as small, and it is the one
   thing on the card the player is meant to look at. */
/* Four across on a desktop card, two on a phone. This was an inline
   style, which no media query can reach: at 390 the fourth tile was
   clipped by the card edge and nothing could override it. */
.ld-page .r3-hc-art .r3-itemgrid.r3-hc-four { grid-template-columns: repeat(4, 1fr); }
.ld-page .r3-hc-art .r3-itemgrid { gap: 12px; }
.ld-page .r3-hc-art .r3-itemtile { padding: 12px 8px 10px; }
.ld-page .r3-hc-art .r3-itemtile-art { width: clamp(64px, 6vw, 104px); }
.ld-page .r3-hc-art .r3-itemtile-name { font-size: 11.5px; }
.ld-page .r3-hc-art .ld-input,
.ld-page .r3-hc-art .ld-textarea { font-size: 15px; }
.ld-page .r3-hc-art .ld-field-label { font-size: 11.5px; }
.ld-page .r3-hc-art .ld-band { --ld-band-h: 76px; }
.ld-page .r3-hc-art .ld-perk-ico { width: 34px; height: 34px; }
.ld-page .r3-hc-art .ld-perk-name { font-size: 16px; }
.ld-page .r3-hc-art .ld-perk-value { font-size: 22px; }
.ld-page .r3-hc-art .ld-slot-name { font-size: 14.5px; }

/* ---- the pointer -----------------------------------------------------
   A ring that wraps its target rather than being positioned over it, so
   there are no coordinates and nothing to drift when the control changes
   size. The arrow hangs off the ring, not off the card.
   -------------------------------------------------------------------- */
.ld-page .r3-hc-point {
  position: relative; display: block;
  border-radius: var(--ld-r);
  box-shadow: 0 0 0 2px var(--ld-accent), 0 0 0 7px var(--ld-accent-wash);
  animation: r3-hc-pulse 2.4s ease-in-out infinite;
}
@keyframes r3-hc-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--ld-accent), 0 0 0 7px var(--ld-accent-wash); }
  50%      { box-shadow: 0 0 0 2px var(--ld-accent), 0 0 0 11px rgba(125, 211, 192, .05); }
}
.ld-page .r3-hc-arrow {
  position: absolute; z-index: 2;
  color: var(--ld-accent);
  pointer-events: none;
}
.ld-page .r3-hc-arrow.at-left { right: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
.ld-page .r3-hc-arrow.at-below { top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }

/* ---- the footer ------------------------------------------------------ */
.ld-page .r3-hf {
  display: flex; align-items: center; gap: 12px;
  padding: clamp(12px, 1.6vh, 20px) clamp(18px, 2vw, 40px);
  border-top: 1px solid var(--ld-line);
  background: var(--ld-surface-2);
}
.ld-page .r3-hf-count {
  font-size: 12px; color: var(--ld-faint); font-variant-numeric: tabular-nums;
}
.ld-page .r3-hf .ld-btn[disabled] { opacity: .4; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .ld-page .r3-hc.is-now { animation: none; }
  .ld-page .r3-hc-point { animation: none; }
}

@media (max-width: 920px) {
  .ld-page .ld-help-panel { width: 100%; height: 100%; border-radius: 0; border: 0; }
  .ld-page .ld-help-scrim { padding: 0; }
  /* The stepper stays, as asked, but at 390 six numbers plus five rules is
     a line of specks: the dots shrink and the rules carry the width. */
  .ld-page .r3-hs { padding: 11px 12px; }
  .ld-page .r3-hs-dot { width: 24px; height: 24px; font-size: 11px; }
  /* The card fills the phone rather than floating in the middle of it:
     empty modal above and below one card is the dead space again. */
  .ld-page .r3-hc {
    margin: 10px; padding: 16px 14px 14px;
    align-self: stretch; justify-self: stretch;
    width: auto; min-height: 0;
  }
  .ld-page .r3-hc-art .r3-itemgrid.r3-hc-four { grid-template-columns: repeat(2, 1fr); }
  .ld-page .r3-hc-art { margin-top: 14px; padding: 12px 6px; max-width: none; }
  .ld-page .r3-hf { padding: 11px 12px; }
  .ld-page .r3-hf .ld-btn { flex: 1 1 auto; justify-content: center; }
}

/* ---- keyboard focus --------------------------------------------------
   Legendary Web found .r3-forge-again had a hover state and nothing for
   focus. Auditing the rest, that was not one omission: of every control
   added across rounds 3 to 7, exactly one had a focus ring, .r3-fx-perk,
   and I wrote that one only because I had just argued that an affordance a
   mouse alone can reach is half an affordance. The argument was right and I
   then applied it once.

   The forge is what makes it urgent rather than tidy: it holds now instead
   of redirecting, so it is a modal moment a keyboard user can land in, and
   "Start another design" may be the first thing they reach.

   :focus-visible rather than :focus, so a mouse click does not leave a ring
   behind, and one ring for every control, because a focus ring that differs
   per control is one people stop trusting.

   The matching rules for the ld- controls and for .ld-search are in
   designer.css as of this round, on the Director's ruling, since the sheet
   had no focus-visible rule at all and the gap was in every page using it.
   Only the r3- controls are here.
   -------------------------------------------------------------------- */
.ld-page .r3-tool:focus-visible,
.ld-page .r3-panel-head:focus-visible,
.ld-page .r3-itemtile:focus-visible,
.ld-page .r3-perk:focus-visible,
.ld-page .r3-emblem:focus-visible,
.ld-page .r3-layer-x:focus-visible,
.ld-page .r3-select select:focus-visible,
.ld-page .r3-forge-link:focus-visible,
.ld-page .ld-help-btn:focus-visible,
.ld-page .r3-discard:focus-visible,
.ld-page .r3-forge-again:focus-visible {
  outline: 2px solid var(--ld-accent);
  outline-offset: 2px;
}
/* The emblems sit on a dark plate rather than a panel, so the ring needs
   something behind it to separate from the backdrop. */
.ld-page .r3-emblem:focus-visible { border-radius: 50%; box-shadow: 0 0 0 5px rgba(5, 7, 13, .75); }

/* ---- perk edit modal -------------------------------------------------
   Editing a perk is a large job, so it gets a large surface over the
   workspace instead of taking the workspace over. The shared perk card is
   used unchanged inside it; the only thing that changes is --ld-band-h, the
   token added to designer.css, which scales the whole control for this
   context while the inspector and the staff editor keep 56px.
   -------------------------------------------------------------------- */
.ld-page .r3-scrim {
  /* Above the site header, which is sticky at 100. This read 40, which is
     the bug Legendary Web found on the live page: the navigation sits over
     the open modal and stays clickable. */
  position: fixed; inset: 0; z-index: var(--ld-over-site);
  background: rgba(5, 7, 13, .72);
  display: grid; place-items: center;
  padding: 4vh 4vw;
}
.ld-page:not(.is-modal) .r3-scrim { display: none; }

.ld-page .r3-modal {
  width: min(1180px, 82vw);
  max-height: 92vh;
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--ld-surface);
  border: 1px solid var(--ld-line);
  border-radius: 14px;
  box-shadow: 0 40px 110px rgba(0, 0, 0, .75);
  overflow: hidden;
}
.ld-page .r3-modal-head {
  display: flex; align-items: center; gap: 14px;
  padding: clamp(14px, 1.4vw, 26px) clamp(18px, 1.8vw, 34px);
  border-bottom: 1px solid var(--ld-line);
  background: var(--ld-surface-2);
}
.ld-page .r3-modal-ico {
  width: clamp(46px, 4vw, 76px); aspect-ratio: 1;
  border-radius: var(--ld-r);
  background: var(--ld-surface-3);
  display: grid; place-items: center; flex: none; overflow: hidden;
}
.ld-page .r3-modal-ico img { width: 88%; height: 88%; object-fit: contain; }
.ld-page .r3-modal-title { font-size: clamp(18px, 1.5vw, 30px); font-weight: 700; }
.ld-page .r3-modal-kicker {
  font-size: clamp(10px, .7vw, 13px); font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ld-faint);
  margin-bottom: 4px;
}
.ld-page .r3-modal-body {
  display: grid; grid-template-columns: 1fr clamp(280px, 22vw, 420px);
  min-height: 0; overflow: hidden;
}
.ld-page .r3-modal-main {
  padding: clamp(18px, 2vw, 40px) clamp(18px, 2vw, 40px) clamp(14px, 1.4vw, 28px);
  display: flex; flex-direction: column; justify-content: center;
  gap: clamp(14px, 1.6vh, 30px);
  min-width: 0; overflow-y: auto;
}
.ld-page .r3-modal-side {
  border-left: 1px solid var(--ld-line-soft);
  background: rgba(255, 255, 255, .012);
  padding: clamp(16px, 1.6vw, 30px);
  overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column; justify-content: space-evenly;
}
.ld-page .r3-modal-foot {
  display: flex; align-items: center; gap: 10px;
  padding: clamp(12px, 1.1vw, 22px) clamp(18px, 1.8vw, 34px);
  border-top: 1px solid var(--ld-line);
  background: var(--ld-surface-2);
}
.ld-page .r3-modal-desc {
  margin: 0; color: var(--ld-muted);
  font-size: clamp(13px, .85vw, 18px); line-height: 1.6;
}
.ld-page .r3-modal .ld-perk-card { border-bottom: 0; padding: 0; }
/* the one line that scales the shared control */
.ld-page .r3-modal .ld-band { --ld-band-h: clamp(56px, 11vh, 132px); }
.ld-page .r3-modal .ld-perk-name { font-size: clamp(14px, 1vw, 20px); }
.ld-page .r3-modal .ld-perk-value { font-size: clamp(20px, 1.9vw, 38px); font-weight: 700; }
.ld-page .r3-modal .ld-band-note { font-size: clamp(11px, .76vw, 16px); margin-top: 9px; }
.ld-page .r3-modal .ld-slider-row { margin-bottom: clamp(10px, 1.2vh, 22px); }

/* ---- status strip ---- */
.ld-page .r3-status {
  display: flex; align-items: center; gap: 18px;
  height: 30px; padding: 0 14px;
  background: var(--ld-surface);
  border-top: 1px solid var(--ld-line);
  font-size: 10.5px; font-weight: 500; color: var(--ld-faint);
}
.ld-page .r3-status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ld-accent); }
/* The one place that says what is still missing. Web's constraint: if the
   dock survives, the line lives here and nowhere else. */
.ld-page .r3-needs { color: var(--ld-warn); font-weight: 600; }


/* ======================================================== facts column ===
   The only companion to the hero now that the card view is going, so it
   carries the design rather than listing it.

   The potency bar is the piece that does the work. Its track runs 0 to
   --p-scale, which is the largest of the global cap, this value, and the
   live maximum. Legendary Web widened my original rule, correctly: mine was
   cap unless the value exceeds it, which pushes the lane off the end of the
   track whenever the live maximum is above the cap and the value is not.
   Live values do go past the cap as a matter of course: the owner's own test
   rifle carries Beast Bane at 162%. Inside the track sit the live range as a lane and the median
   as a tick, and the fill is coloured by where the value falls:
     is-in     within the live range
     is-below  under it
     is-above  over it, which includes anything past the cap
   ======================================================================== */

/* The column is a stack of fixed things with slack between them, not a set
   of panes dividing the height up. Perks sit at the top of their space and
   the chips at the bottom; whatever is left over stays empty, which is what
   room for another perk looks like.

   --r3-row-h is the owner's "about the base item card", measured rather than
   derived: that card is 89px at 1920x1080 and 78px at 1024x768, and the
   token is the straight line between the two, clamped at both ends. Deriving
   it from the card's own clamps would be wrong, because the card's height
   comes from its text block, not from its thumbnail.

   overflow-y stays auto rather than hidden so a fourth perk or a very long
   name degrades into a scroll rather than being clipped. */
.ld-page .r3-facts-rich {
  --r3-row-h: clamp(78px, 65px + 1.25vw, 89px);
  display: flex; flex-direction: column;
  gap: clamp(12px, 1.2vh, 22px);
  padding: clamp(16px, 1.4vw, 32px);
  overflow-y: auto; min-height: 0;
}

.ld-page .r3-fx-title {
  font-family: Cinzel, Georgia, serif; font-weight: 700;
  font-size: clamp(20px, 1.5vw, 34px); line-height: 1.15;
  margin: 0;
}
.ld-page .r3-fx-sub {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 7px;
  font-size: clamp(11px, .72vw, 14px); color: var(--ld-faint);
}

/* the identity row: one row now, carrying the item's art or the skin's
   render once a skin is attached, with the skin name as its secondary line */
/* A grid track's minimum is auto, so a bare 1fr grows to min-content instead
   of shrinking and the row pushes past its column. Both the implicit column
   of .r3-fx-ids and the middle column of .r3-fx-id need minmax(0, 1fr);
   fixing only the inner one does nothing, because the outer one is still
   free to grow. Found by Legendary Web at 1024, where the facts column hits
   its 320px floor and the slack runs out. */
.ld-page .r3-fx-ids { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.ld-page .r3-fx-id {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 11px;
  padding: clamp(8px, .8vh, 14px) clamp(10px, .8vw, 16px);
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r-lg);
  background: var(--ld-surface-2);
}
.ld-page .r3-fx-thumb {
  width: clamp(38px, 3vw, 58px); aspect-ratio: 1; flex: none;
  border-radius: var(--ld-r);
  background: var(--ld-surface);
  border: 1px solid var(--ld-line-soft);
  display: grid; place-items: center; overflow: hidden;
}
.ld-page .r3-fx-thumb img { width: 86%; height: 86%; object-fit: contain; }
.ld-page .r3-fx-k {
  display: block;
  font-size: clamp(9.5px, .62vw, 12px); font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ld-faint);
}
.ld-page .r3-fx-v {
  display: block;
  font-size: clamp(13px, .88vw, 18px); font-weight: 600;
  margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* An id or a shortname should never wrap, whatever else happens to the row.
   Measured at the column's 320px floor it does not wrap today, because the
   track is auto and takes its min-content, but that is a property of the
   current content rather than a guarantee: a longer note would wrap and look
   broken. Legendary Web's rule, adopted as insurance rather than as a fix. */
/* The skin name wraps rather than truncating, per the owner. Clamped to two
   lines: wrapping freely would let one absurd name push the column past the
   no-scroll requirement at 1024x768, and two lines is what "onto a second
   line" asks for. The item name above it still truncates on one line. */
.ld-page .r3-fx-sec {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-top: 3px;
  font-size: clamp(11px, .72vw, 15px); color: var(--ld-muted);
  overflow: hidden;
  white-space: normal;
}
.ld-page .r3-fx-note {
  font-size: clamp(10.5px, .68vw, 13px); color: var(--ld-faint);
  white-space: nowrap;
}

/* perks, the rich rows */
/* The list takes exactly the height of its rows and is never squeezed. It
   used to be flex: 1 1 auto with min-height: 0, which was right while the
   rows stretched to share the space; with fixed rows that pair lets the
   container shrink under its own content, and at 1024x768 the four rows
   overflowed it and sat on top of the chips. Measured: container 221.6px,
   last row ending 102px below the top of the chips. Now the column scrolls
   in that case instead, which is what overflow-y: auto is there for, and
   the chips still sit at the bottom whenever there is slack. */
.ld-page .r3-fx-perks {
  display: flex; flex-direction: column; gap: 8px;
  justify-content: flex-start;
  flex: 0 0 auto;
}
/* The rows open the perk modal, so they are buttons rather than divs: a div
   takes no keyboard focus, and an affordance only a mouse can reach is half
   an affordance. The hover and focus states say "this does something"
   without a word of text. */
.ld-page .r3-fx-perk {
  font: inherit; color: inherit; text-align: left; width: 100%;
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "icon name value" "icon bar bar" "icon foot foot";
  align-items: center;
  gap: 3px clamp(10px, .9vw, 16px);
  padding: clamp(9px, .9vh, 16px) clamp(11px, .9vw, 18px);
  border: 1px solid var(--ld-line);
  border-radius: var(--ld-r-lg);
  background: var(--ld-surface-2);
  /* Fixed, never stretched. A row that grows with the space says the perk
     got more important when a slot was freed, and rows of different heights
     on different designs are hard to compare. */
  flex: 0 0 auto; height: var(--r3-row-h);
}
.ld-page .r3-fx-perk-ico {
  grid-area: icon;
  width: clamp(34px, 2.7vw, 54px); aspect-ratio: 1;
  display: grid; place-items: center;
}
.ld-page .r3-fx-perk-ico img { width: 100%; height: 100%; object-fit: contain; }
.ld-page .r3-fx-perk-name {
  grid-area: name;
  font-size: clamp(12.5px, .85vw, 18px); font-weight: 600;
}
.ld-page .r3-fx-perk-val {
  grid-area: value;
  font-size: clamp(14px, 1vw, 22px); font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ld-page .r3-fx-perk.is-in .r3-fx-perk-val { color: var(--ld-accent); }
.ld-page .r3-fx-perk.is-below .r3-fx-perk-val { color: var(--ld-warn); }
.ld-page .r3-fx-perk.is-above .r3-fx-perk-val,
.ld-page .r3-fx-perk.is-far .r3-fx-perk-val { color: var(--ld-bad); }

.ld-page .r3-fx-bar {
  grid-area: bar;
  position: relative;
  height: clamp(8px, .9vh, 14px);
  border-radius: 4px;
  background: #10141a;
  overflow: hidden;
}
.ld-page .r3-fx-lane {
  position: absolute; top: 0; bottom: 0;
  background: rgba(125, 211, 192, .16);
  border-left: 1px solid rgba(125, 211, 192, .5);
  border-right: 1px solid rgba(125, 211, 192, .5);
}
/* The fill is painted under the markers. Source order put it last, so on an
   over-cap value it covered the cap tick, hiding the one marker that matters
   in exactly the case the colour is warning about. */
.ld-page .r3-fx-lane { z-index: 0; }
.ld-page .r3-fx-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; z-index: 1; }
.ld-page .r3-fx-median { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--ld-accent); opacity: .9; z-index: 2; }
.ld-page .r3-fx-cap {
  position: absolute; top: -1px; bottom: -1px; width: 2px;
  background: var(--ld-warn); z-index: 3;
  box-shadow: 0 0 0 1px rgba(16, 20, 26, .9);
}
.ld-page .r3-fx-perk.is-in .r3-fx-fill { background: var(--ld-accent); }
.ld-page .r3-fx-perk.is-below .r3-fx-fill { background: var(--ld-warn); }
.ld-page .r3-fx-perk.is-above .r3-fx-fill { background: var(--ld-bad); }
/* Far is a degree of above, not another kind of problem, so it keeps the
   colour and takes a second channel. The hatch reads as a bar that ran out
   of track rather than one that is merely long, which is exactly what more
   than one and a half times the live maximum means. No new legend key: the
   colour already said too high and the texture only says much. */
.ld-page .r3-fx-perk.is-far .r3-fx-fill {
  background: repeating-linear-gradient(115deg,
    var(--ld-bad) 0 7px, rgba(255, 92, 72, .5) 7px 14px);
}
.ld-page .r3-fx-perk-foot {
  grid-area: foot;
  display: flex; justify-content: space-between; gap: 10px;
  font-size: clamp(10px, .64vw, 13px); color: var(--ld-faint);
}
.ld-page .r3-fx-perk-foot b { font-weight: 600; }
.ld-page .r3-fx-perk.is-below .r3-fx-perk-foot b { color: var(--ld-warn); }
.ld-page .r3-fx-perk.is-above .r3-fx-perk-foot b,
.ld-page .r3-fx-perk.is-far .r3-fx-perk-foot b { color: var(--ld-bad); }

.ld-page .r3-fx-perk:hover {
  border-color: var(--ld-accent-line);
  background: var(--ld-surface-3);
}
.ld-page .r3-fx-perk:hover .r3-fx-perk-name { color: var(--ld-text); }
.ld-page .r3-fx-perk:focus-visible {
  outline: 2px solid var(--ld-accent);
  outline-offset: 2px;
  border-color: var(--ld-accent);
}
.ld-page .r3-fx-perk:active { background: var(--ld-surface-2); }

/* A free slot is a card of its own rather than a gap, so the column reads
   as "three perks and room for one more" instead of "three perks and some
   leftover space". It is a button, and it opens the Perks panel, which is
   the thing the designer wants next. Dotted rather than dashed, and at the
   row height, so it sits in the rhythm without pretending to be a perk. */
.ld-page .r3-fx-perk.is-empty {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  height: var(--r3-row-h); flex: 0 0 auto;
  border: 1px dotted var(--ld-line);
  background: transparent;
  color: var(--ld-faint);
}
.ld-page .r3-fx-perk.is-empty:hover {
  border-color: var(--ld-accent-line);
  background: var(--ld-accent-wash);
  color: var(--ld-muted);
}
.ld-page .r3-fx-empty-main {
  display: flex; align-items: center; gap: 7px;
  font-size: clamp(12px, .8vw, 16px); font-weight: 600;
}
.ld-page .r3-fx-empty-sub {
  font-size: clamp(10px, .64vw, 13px);
  letter-spacing: .1em; text-transform: uppercase;
}

/* The live-set chips, returning with labels that say what they mean. At the
   column's 320px floor a full sentence will not sit beside another, so they
   stack; at 1920 two will share a row. Each chip wraps its own text rather
   than clipping it, because a chip that explains itself is useless truncated. */
.ld-page .r3-fx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.ld-page .r3-fx-chip {
  display: inline-flex; align-items: center; gap: 8px;
  flex: 1 1 auto;
  padding: clamp(6px, .6vh, 10px) clamp(10px, .8vw, 15px);
  border-radius: var(--ld-r-lg);
  border: 1px solid var(--ld-line);
  background: var(--ld-surface-2);
  font-size: clamp(11px, .72vw, 14px); color: var(--ld-muted);
  line-height: 1.35;
}
.ld-page .r3-fx-chip b { color: var(--ld-text); font-weight: 700; }
.ld-page .r3-fx-chip svg { color: var(--ld-faint); flex: none; }
/* Neutral is the default and the overwhelming majority. A chip takes a
   colour only when it names something the designer has to act on, which
   leaves amber and red meaning one thing each wherever they appear. There is
   no "fine" colour: a chip that is simply reporting a number is neutral, and
   the green tick that used to sit on "skin not taken" is gone, because being
   unremarkable is not an achievement worth a colour. */
.ld-page .r3-fx-chip.is-warn { border-color: rgba(255, 179, 71, .34); background: rgba(255, 179, 71, .08); }
.ld-page .r3-fx-chip.is-warn b, .ld-page .r3-fx-chip.is-warn svg { color: var(--ld-warn); }
.ld-page .r3-fx-chip.is-bad { border-color: rgba(255, 107, 107, .34); background: rgba(255, 107, 107, .08); }
.ld-page .r3-fx-chip.is-bad b, .ld-page .r3-fx-chip.is-bad svg { color: var(--ld-bad); }

.ld-page .ld-perk-value.is-below,
.ld-page .r3-layer-val.is-below { color: var(--ld-warn); }
.ld-page .ld-perk-value.is-above,
.ld-page .ld-perk-value.is-far,
.ld-page .r3-layer-val.is-above,
.ld-page .r3-layer-val.is-far { color: var(--ld-bad); }
.ld-page .r3-modal .ld-perk-value.is-in { color: var(--ld-accent); }

/* ============================================================== legend ===
   Five keys for the band, each a real miniature of the thing it names rather
   than a sentence about it. One wrapped row under the slider.
   ======================================================================== */
.ld-page .r3-legend {
  display: flex; flex-wrap: wrap;
  gap: clamp(8px, .8vw, 18px) clamp(14px, 1.2vw, 26px);
  padding-top: clamp(10px, 1vh, 18px);
  border-top: 1px solid var(--ld-line-soft);
}
.ld-page .r3-legend-key {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: clamp(10.5px, .68vw, 14px); color: var(--ld-muted);
}
.ld-page .r3-legend-art {
  position: relative; flex: none;
  width: 22px; height: 14px;
  border-radius: 2px;
  background: #10141a;
  overflow: hidden;
}
.ld-page .r3-legend-art i { position: absolute; display: block; }
.ld-page .r3-legend-bars i {
  bottom: 0; width: 3px; background: #2b3542;
}
.ld-page .r3-legend-bars i:nth-child(1) { left: 2px; height: 40%; }
.ld-page .r3-legend-bars i:nth-child(2) { left: 7px; height: 75%; background: var(--ld-accent-dim); }
.ld-page .r3-legend-bars i:nth-child(3) { left: 12px; height: 55%; background: var(--ld-accent-dim); }
.ld-page .r3-legend-bars i:nth-child(4) { left: 17px; height: 30%; }
.ld-page .r3-legend-lane i {
  top: 0; bottom: 0; left: 5px; width: 12px;
  background: rgba(125, 211, 192, .18);
  border-left: 1px solid rgba(125, 211, 192, .65);
  border-right: 1px solid rgba(125, 211, 192, .65);
}
.ld-page .r3-legend-median i { top: 0; bottom: 0; left: 10px; width: 1px; background: var(--ld-accent); }
.ld-page .r3-legend-cap i { top: 2px; bottom: 2px; right: 3px; width: 2px; background: var(--ld-warn); }
.ld-page .r3-legend-state i:nth-child(1) { top: 3px; bottom: 3px; left: 3px; width: 6px; border-radius: 2px; background: var(--ld-warn); }
.ld-page .r3-legend-state i:nth-child(2) { top: 3px; bottom: 3px; right: 3px; width: 6px; border-radius: 2px; background: var(--ld-bad); }


/* ======================================================= moments ========
   Four of them. Each is a class on .ld-page, each one cleans up after
   itself, and each is written so that the frame it is captured in is a
   frame a player would actually see.
   ===================================================================== */

/* ---- 1. the skin reveal ---------------------------------------------
   Applying a skin should land like the item changed, not like an image
   was swapped. A flash from inside the item, a bright wipe passing down
   it, and the item coming back up out of white. 820ms end to end.
   ------------------------------------------------------------------- */
.ld-page .r3-hero-flash,
.ld-page .r3-hero-wipe {
  position: absolute; inset: 0;
  opacity: 0; pointer-events: none;
}
.ld-page .r3-hero-flash {
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%,
    rgba(255, 255, 255, .92) 0%,
    hsla(var(--aura-h, 168), 80%, 72%, .55) 28%,
    transparent 62%);
  transform: scale(.5);
}
.ld-page .r3-hero-wipe {
  background: linear-gradient(to bottom,
    transparent 42%,
    hsla(var(--aura-h, 168), 90%, 84%, .85) 50%,
    transparent 58%);
  mix-blend-mode: screen;
}
.ld-page.is-reveal .r3-hero img { animation: r3-rematerialise .82s cubic-bezier(.2, .7, .25, 1) both; }
.ld-page.is-reveal .r3-hero-flash { animation: r3-flash .82s cubic-bezier(.15, .8, .3, 1) both; }
.ld-page.is-reveal .r3-hero-wipe { animation: r3-wipe .62s ease-out .06s both; }
.ld-page.is-reveal .r3-aura,
.ld-page.is-reveal .r3-aura-pool { animation: r3-surge .82s ease-out both; }

@keyframes r3-rematerialise {
  0%   { opacity: .15; filter: brightness(4) blur(7px); transform: scale(1.06); }
  38%  { opacity: 1;   filter: brightness(2.1) blur(1.5px); transform: scale(1.015); }
  100% { opacity: 1;   filter: none; transform: scale(1); }
}
@keyframes r3-flash {
  0%   { opacity: 0; transform: scale(.5); }
  18%  { opacity: 1; transform: scale(1.12); }
  100% { opacity: 0; transform: scale(1.5); }
}
@keyframes r3-wipe {
  from { opacity: .95; transform: translateY(-62%); }
  to   { opacity: 0;   transform: translateY(62%); }
}
@keyframes r3-surge {
  0%   { opacity: 1; transform: scale(1.3); }
  100% { opacity: .9; transform: scale(1); }
}

/* ---- 2. adding a perk ------------------------------------------------
   The icon leaves the grid you clicked and arrives on the item, which is
   the whole point: the perk went somewhere. --fx and --fy are where it
   starts, as a translation from where it lands, so the live page can set
   them from the real tile's rect and the mock can hard-code a plausible
   one and still be captured frame by frame.
   ------------------------------------------------------------------- */
/* left and top are where it LANDS, and the negative margin makes them the
   centre of the disc rather than its corner, so the landing point can be
   written as the emblem's own centre. */
.ld-page .r3-fly {
  position: fixed; left: 0; top: 0;
  width: clamp(46px, 3.7vw, 76px); aspect-ratio: 1;
  margin: calc(clamp(46px, 3.7vw, 76px) / -2);
  display: none; place-items: center;
  pointer-events: none; z-index: 60;
}
.ld-page.is-addperk .r3-fly { display: grid; animation: r3-fly .72s cubic-bezier(.3, .1, .2, 1) both; }
.ld-page .r3-fly-disc {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid var(--ld-accent);
  background: radial-gradient(circle at 50% 36%, rgba(30, 38, 46, .98), rgba(10, 13, 18, .96));
  box-shadow: 0 0 26px -4px var(--ld-accent-dim);
  display: grid; place-items: center;
}
.ld-page .r3-fly-disc img { width: 64%; height: 64%; object-fit: contain; }
@keyframes r3-fly {
  0%   { transform: translate(var(--fx), var(--fy)) scale(.52); opacity: 0; }
  12%  { opacity: 1; }
  70%  { transform: translate(calc(var(--fx) * .04), calc(var(--fy) * .04)) scale(1.18); opacity: 1; }
  100% { transform: translate(0, 0) scale(1); opacity: 0; }
}
/* the slot it lands in, and the aura taking the hit */
.ld-page.is-addperk .r3-emblem.is-landing { animation: r3-land .5s cubic-bezier(.2, 1.5, .4, 1) .52s both; }
.ld-page.is-addperk .r3-aura,
.ld-page.is-addperk .r3-aura-pool { animation: r3-pulse .9s cubic-bezier(.2, .8, .3, 1) .5s both; }
@keyframes r3-land {
  0%   { transform: rotate(calc(-1 * var(--a))) scale(.3); opacity: 0; }
  60%  { transform: rotate(calc(-1 * var(--a))) scale(1.2); opacity: 1; }
  100% { transform: rotate(calc(-1 * var(--a))) scale(1); opacity: 1; }
}
@keyframes r3-pulse {
  0%   { transform: scale(1); opacity: .85; }
  26%  { transform: scale(1.22); opacity: 1; }
  100% { transform: scale(1); opacity: .9; }
}

/* ---- 3. potency breathing -------------------------------------------
   Dragging a slider changes a number; this is what makes the number feel
   like it belongs to the item. The aura's cycle shortens and deepens
   while a drag is live, and settles back when it commits.
   ------------------------------------------------------------------- */
.ld-page.is-tuning .r3-aura,
.ld-page.is-tuning .r3-aura-pool { animation-duration: 1.5s; }
.ld-page.is-tuning .r3-hero img { transition: filter .18s linear; }

/* ---- 4. the forge ----------------------------------------------------
   Submitting is the end of the job, so it is the one moment allowed to
   take the screen. A ring off the plinth, and the card the design becomes
   rising into the middle.

   It has no timer and it does not hand itself off. Legendary Web found
   that the designer was navigating away in the same tick it announced
   ld:submitted, so the whole moment ran and was destroyed before a single
   frame of it reached anyone, without erroring. The page holds here now,
   and the player leaves by choosing one of the two exits on the card.

   An earlier version of this comment claimed a close button and a
   dismissable scrim, and there were neither. Both exits are real and both
   are on the card, which is where a player is already looking.
   ------------------------------------------------------------------- */
.ld-page .r3-forge {
  position: absolute; inset: 0; z-index: 30;
  display: none; place-items: center;
  background: rgba(4, 6, 11, .72);
  backdrop-filter: blur(5px);
}
.ld-page.is-forge .r3-forge { display: grid; animation: r3-fade .34s ease both; }
.ld-page .r3-forge-ring {
  position: absolute; left: 50%; top: 56%;
  width: 24vmin; aspect-ratio: 1; margin: -12vmin;
  border-radius: 50%;
  border: 2px solid hsla(var(--aura-h, 168), 85%, 76%, .9);
}
.ld-page.is-forge .r3-forge-ring { animation: r3-shock 1.05s cubic-bezier(.1, .7, .25, 1) both; }
.ld-page .r3-forge-card { position: relative; display: grid; justify-items: center; gap: 14px; }
.ld-page.is-forge .r3-forge-card { animation: r3-rise .66s cubic-bezier(.2, .8, .25, 1) .22s both; }
.ld-page .r3-forge .ld-card { width: clamp(300px, 24vw, 520px); }
.ld-page .r3-forge-acts {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  justify-content: center;
}
.ld-page .r3-forge-link {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: var(--ld-accent);
  text-decoration: none;
}
.ld-page .r3-forge-link:hover { text-decoration: underline; }
.ld-page .r3-forge-again {
  font: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--ld-muted); background: transparent;
  border: 1px solid var(--ld-line); border-radius: var(--ld-r);
  padding: 7px 14px; cursor: pointer;
}
.ld-page .r3-forge-again:hover { border-color: var(--ld-accent-line); color: var(--ld-text); }
@keyframes r3-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes r3-shock {
  0%   { transform: scale(.1); opacity: 0; border-width: 5px; }
  14%  { opacity: 1; }
  100% { transform: scale(7); opacity: 0; border-width: 1px; }
}
@keyframes r3-rise {
  from { transform: translateY(26px) scale(.94); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ==================================================== feedback =========
   The small things, which are most of the difference between a tool that
   answers and one that sits there.
   ===================================================================== */

/* tiles lift. 90ms, transform only, and the shadow is on the tile rather
   than a filter, because a drop-shadow filter on a grid of sixty tiles is
   sixty more layers to composite. */
.ld-page .r3-itemtile,
.ld-page .r3-perk {
  transition: transform .09s ease, border-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}
.ld-page .r3-itemtile:hover,
.ld-page .r3-perk:not(.is-used):hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .9);
}
.ld-page .r3-itemtile:active,
.ld-page .r3-perk:active { transform: translateY(0); }

/* the band's thumb leaves a trail while it moves: a soft glow pinned to
   the thumb, widened by .is-tuning, so a drag reads as a drag */
.ld-page .ld-band-thumb { transition: box-shadow .14s ease; }
.ld-page.is-tuning .ld-band-thumb {
  box-shadow: 0 0 0 4px var(--ld-accent-wash), 0 0 22px 2px var(--ld-accent-dim);
}
.ld-page .r3-band-trail {
  position: absolute; bottom: 16.1%; height: 62.5%;
  border-radius: 3px;
  background: linear-gradient(to right, transparent, var(--ld-accent-wash));
  opacity: 0; transition: opacity .18s ease;
  pointer-events: none;
}
.ld-page.is-tuning .r3-band-trail { opacity: 1; }

/* the chips arrive rather than appearing, one after another, 40ms apart.
   Short enough that it is never something you wait for. */
.ld-page .r3-fx-chip { animation: r3-chipin .34s ease both; }
.ld-page .r3-fx-chip:nth-child(2) { animation-delay: .04s; }
.ld-page .r3-fx-chip:nth-child(3) { animation-delay: .08s; }
.ld-page .r3-fx-chip:nth-child(4) { animation-delay: .12s; }
@keyframes r3-chipin {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ==================================================== reduced motion ===
   Everything above is decoration over information that is also carried by
   colour, ring and text, so under prefers-reduced-motion it all simply
   stops. The embers canvas is not drawn at all, which the script checks
   for itself rather than relying on this block.
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  .ld-page .r3-bg-plate,
  .ld-page .r3-bg-haze,
  .ld-page .r3-bg-sweep,
  .ld-page .r3-aura,
  .ld-page .r3-aura-pool,
  .ld-page .r3-emblem,
  .ld-page .r3-fx-chip,
  .ld-page .r3-hero img,
  .ld-page .r3-hero-flash,
  .ld-page .r3-hero-wipe,
  .ld-page .r3-fly,
  .ld-page .r3-forge-ring,
  .ld-page .r3-forge-card { animation: none !important; }
  .ld-page .r3-bg-sweep { display: none; }
  .ld-page .r3-fly { display: none !important; }
  .ld-page .r3-itemtile:hover,
  .ld-page .r3-perk:hover { transform: none; }
  .ld-page * { transition-duration: .01ms !important; }
}

/* ================================================================ phone ===
   The same markup folded at 920px, so one page serves both. What changes and
   why:

   - the rail and the workbar crumbs go; the tab bar from designer.css takes
     over navigation
   - the hero keeps the top third and stays put while everything else scrolls
   - the facts column stacks under the hero rather than being dropped: on the
     Base item and Skin states those facts are the point of the centre, and a
     phone that hides them shows an item and nothing about it
   - the dock becomes the page, so the open panel sizes to its content
     instead of flexing; a flexing panel inside a scrolling page gives you a
     scroll within a scroll
   - the topbar wraps instead of overflowing: brand, name and three buttons do
     not fit 390px, and the page hides its own overflow, so the submit button
     was being clipped rather than wrapped
   ======================================================================== */

@media (max-width: 920px) {
/* A grid item's min-width is auto, so any track can be blown out by its
   content's min-content width. The facts column alone is clamp(320px, ...)
   wide on desktop and that was enough to push the whole document past 390px,
   clipping the submit button and the right of every row. Every box in the
   chain gets min-width 0. */
.ld-page .r3,
.ld-page .r3-work,
.ld-page .r3-canvas,
.ld-page .r3-stagewrap,
.ld-page .r3-stagepane,
.ld-page .r3-itemfacts,
.ld-page .r3-dock,
.ld-page .r3-panel,
.ld-page .r3-panel-body { min-width: 0; max-width: 100%; }

.ld-page .r3 {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  height: auto;
}
.ld-page .r3-rail { display: none; }

/* Legendary Web's wrap, kept as sent: brand, name and three buttons do not
   fit 390px and the page hides its own overflow, so the primary action was
   being clipped. Breaking the spacer to a full row is neater than hiding
   controls, so this is theirs rather than mine. */
.ld-page .ld-topbar { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px 10px; }
.ld-page .ld-topbar > * { min-width: 0; }
.ld-page .ld-topbar .ld-spacer { flex: 0 0 100%; height: 0; }
/* Grow to share the row, never shrink below the label. flex: 1 1 auto let
   them shrink, which on a wrapped bar is the same clipping as on a wide
   one, just harder to notice. */
.ld-page .ld-topbar .ld-btn { flex: 1 0 auto; justify-content: center; }

/* hero pinned to the top third, facts stacked under it */
.ld-page .r3-work { grid-template-rows: auto; }
.ld-page .r3-workbar { display: none; }
.ld-page .r3-canvas { overflow: visible; }
/* The stage stacks: the podium keeps the top of the page, the facts follow
   it. The backdrop stays, scaled down, because it is the thing that makes
   the phone page feel like the desktop one rather than a list of fields. */
.ld-page .r3-stagewrap {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  height: auto;
}
.ld-page .r3-stagepane {
  height: auto; padding: 10px 12px 14px;
  border-bottom: 1px solid var(--ld-line-soft);
}
/* 2048 pixels of backdrop for a 390 pixel viewport is four times what the
   screen can show, on the devices least able to afford it. The query swaps
   which property is read, rather than redeclaring the desktop one. */
.ld-page .r3-bg-plate { background-image: var(--r3-plate-sm); }
.ld-page .r3-podium { width: min(84%, 40vh); transform: none; }
.ld-page .r3-emblem { width: 40px; margin: -20px; --r: 56%; }
.ld-page .r3-emblem-val { font-size: 9.5px; }
.ld-page .r3-itemfacts { border-left: 0; padding: 14px; backdrop-filter: none; }

/* the dock becomes the page */
.ld-page .r3-dock { border-left: 0; border-top: 1px solid var(--ld-line); }
.ld-page .r3-panel.is-open { flex: 0 0 auto; }
.ld-page .r3-panel-body { overflow: visible; }
/* A scroll region inside a page that already scrolls is a trap on a phone,
   so the split bodies go back to one flow and the grids run full length. */
.ld-page .r3-panel-body.is-split { display: block; overflow: visible; padding-bottom: 13px; }
.ld-page .r3-panel-scroll { overflow: visible; min-height: 0; padding-bottom: 0; }
.ld-page .r3-panel-head { height: 44px; }
.ld-page .r3-perkgrid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
.ld-page .r3-itemgrid { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }

.ld-page .r3-status { height: auto; padding: 8px 12px; flex-wrap: wrap; gap: 8px 16px; }

/* the modal is a full screen sheet, single column */
.ld-page .r3-scrim { padding: 0; }
.ld-page .r3-modal {
  width: 100%; max-height: 100vh; height: 100vh;
  border-radius: 0; border: 0;
}
.ld-page .r3-modal-body { grid-template-columns: 1fr; grid-template-rows: auto auto; overflow-y: auto; }
.ld-page .r3-modal-main { justify-content: flex-start; }
.ld-page .r3-modal-side { border-left: 0; border-top: 1px solid var(--ld-line-soft); }
.ld-page .r3-modal .ld-band { --ld-band-h: 84px; }
.ld-page .r3-modal-foot { flex-wrap: wrap; }
}

/* ================================================================= mine ===
   Only what UI's standalone source cannot carry: rules that depend on the
   surrounding site, rules for markup that is ours rather than the mock's, and
   one gap their source leaves. Anything they take into workspace.html is
   deleted here rather than kept in two places.

   Round seven took most of what used to live here. Gone, because the source now
   owns them: the one-view routing and the rail guard (the per-panel centre
   views no longer exist), the picker row (the search and category select are in
   the source's Base item panel), the panel-head cursor, and the whole fixed
   perk row block including the placeholder and the shrink guards, which UI
   rebuilt around --r3-row-h, .r3-fx-empty and a minmax(0, 1fr) on .r3-fx-ids.
   Their row height is measured against the base item card at two widths; mine
   tracked viewport height and drifted, so theirs wins outright.
   ========================================================================= */

/* The --ld-over-site token and the perk scrim rule that uses it have moved to
   UI's designer.css, where a constant shared by every overlay in the system
   belongs. The scrim's own z-index now comes from their workspace source. My
   copies are gone rather than kept alongside. */

/* The walkthrough's styling is UI's now, in their source, so the placeholder
   that stood in while it was being drawn is gone. The shell's behaviour, the
   Escape and scrim rules and the focus trap, stays in the script where it
   always was. */

/* ---- this page does not scroll as a whole ----
   The owner's: a wheel that misses a panel must not move the page behind it.
   Scoped to .ld-designer-page, a class on this page's own <body>, which sits
   outside the build:header and build:footer blocks and so is ours to mark.
   That scope is why this lives here rather than in designer.css, which the
   staff pages also load: nothing here can reach them.

   The footer is hidden rather than removed, because build-site inlines
   _footer.html into every page and that file is not this page's to edit.

   The lock stops at the phone fold. Below 921px the shell becomes one flow
   and the page scroll IS the way through it, so locking there would make the
   dock unreachable rather than tidy. */
.ld-designer-page .site-footer { display: none; }
@media (min-width: 921px) {
  /* Both elements, because the scrolling element here is the documentElement,
     not the body: overflow: hidden on body alone left the page still scrolling
     and measured as fixed only if you asked the body. :has keeps the rule tied
     to this page even though this sheet is loaded by no other. */
  :root:has(> .ld-designer-page),
  .ld-designer-page { overflow: hidden; }
}

/* ---- the stage caption may not drag the stage wider than the screen ----
   Mine, and sent to UI for their sheet. A sixty character name rendered at
   display size needs 1007px, and .r3-stage-name had nothing stopping it, so
   at 375 the caption, the podium, the hero and the emblems were all dragged
   to 1007px wide and clipped by an ancestor rather than scrolling. Measured
   identical on the live bytes, so this is not new to set z; it is just the
   first set where anyone typed a long enough name to see it.

   It wraps rather than truncating, because unlike the crumb this is the one
   place the design's name is shown at full size and in full, and clamped to
   two lines so one absurd name cannot push the caption over the dock. */
.ld-page .r3-stage-caption { max-width: 100%; min-width: 0; }
.ld-page .r3-stage-name {
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

/* ---- a new component's description has room to be written ----
   Three rows growing to six, the growth done in script. The row is a grid, so
   the field is aligned to the top rather than centred: a six row box centred
   against a 52px thumbnail drags the thumbnail into the middle of the text. */
.ld-page .ld-slot.is-new { align-items: start; }
.ld-page .ld-slot.is-new .ld-slot-art { margin-top: 2px; }
.ld-page .ld-newdesc {
  resize: none;
  line-height: 1.45;
  min-height: 0;
  font-family: inherit;
}

/* ---- the split panel body may not size itself to its content ----
   The fourth time this page has been caught by auto as a minimum, and the
   first on the horizontal axis. .r3-panel-body.is-split is a grid, a grid
   item's min-width is auto, and the Base item controls row contains a <select>
   whose intrinsic width is its longest option. That made the implicit column
   413px inside a 379px body at 1024x768: the category dropdown and the right
   edge of the tile grid were clipped, and because an ancestor hides overflow
   there was no scrollbar to show for it, so the panel looked merely cramped
   rather than broken. Invisible at 1920, where the dock is wide enough to
   absorb it.

   The select is UI's markup but the option text is ours, so the cheapest
   honest fix is to stop the column sizing to content and let the select
   shrink. Sent to UI to fold into the source. */
.ld-page .r3-panel-body.is-split { grid-template-columns: minmax(0, 1fr); }
.ld-page .r3-panel-body.is-split > * { min-width: 0; }
.ld-page .r3-select { min-width: 0; }
.ld-page .r3-select select { width: 100%; min-width: 0; }

/* The walkthrough's zoom divisors are upstream now.

   This block held the panel cap divided by --ld-zoom. Legendary UI took it
   into their source, and found the half of it I had missed: the step's own
   min-height is inside the scaled element too, so with the panel divided and
   the step not, the plate slot flattened from 2.4 to about 1.7 and cropped a
   quarter off the bottom of every plate. Both divisors now come from the lift
   rather than from here, which is where they belong: the composition has to
   scale as a whole. Nothing of mine is needed, so nothing of mine is kept. */

/* ---- the round-eight walkthrough overrides are gone with the round-eight
       walkthrough ----

   This block forced .r3-help-step and .r3-help-plate visible, because their
   sheet hid a step until a script marked it and we never lifted the script.
   Round nine replaced that component outright: the owner rejected the
   scrolling list and Legendary UI rebuilt it as a stepper, and the classes
   those two rules targeted now appear nowhere in their source. Rules that
   match nothing are worse than no rules, because the next person reading
   them believes something is being held in place.

   The lesson they were written for is not gone, and the new component needed
   it too. */

/* ---- the card does not start invisible ----

   Measured, not assumed: .r3-hc.is-now carries
   animation: r3-hc-in .32s ... both, whose first keyframe is opacity 0, and
   reading the card's computed opacity in the same tick as a step change
   gives 0. In a healthy browser it is 1 again 320ms later and nobody
   notices. On a throttled, backgrounded or slow tab it is the empty modal
   the owner reported in round eight, one component later.

   So the fade comes off and the slide stays: same keyframes, same duration,
   same easing, minus the opacity pair. The card is opacity 1 at every
   moment, including the one before the animation runs and the one where it
   never runs at all.

   This is the rule Web Director put on the checklist after round eight, and
   it is worth stating in one line because it will come up again: content a
   player has to read does not get an entry animation that starts from
   invisible. Motion may move it, tint it or scale it. It may not hide it. */
/* ---- the round-nine fixes are upstream; only the scrollbar one is mine ----

   Two rules lived here and are gone, because Legendary UI took both into
   their source in round9-help-fixes.diff: the card's entry animation no
   longer starts from invisible, and the panel's cap divides only its
   viewport term. Keeping copies here would recreate the exact divergence
   the ownership ruling just closed, so the copies go and the lift carries
   them.

   One correction worth keeping, because I wrote the wrong reason into this
   file and it shipped. I said a pixel cap "is already a screen measurement".
   It is not: inside a zoomed subtree a px scales like everything else, which
   is why 1180px renders at 1770. The reason it must not be divided is that
   it is in the same units as the panel's contents, which all scale with it,
   so dividing the box while its contents keep their size is what produced a
   dialog at 38% of the screen with everything scrolling inside it. Only the
   viewport term is converted, because vw and vh measure something outside
   the scaled subtree. Applied to a radius or a shadow offset, my version
   would have given the wrong answer; theirs gives the right one everywhere. */

/* The card is exactly as wide as the stack, margins included, so the moment a
   vertical scrollbar appears it takes 4px off the stack's client width and
   the card can be nudged sideways by those 4px. Nothing is overflowing: the
   content measures exactly 390 in a 390 box, and the scrollbar is the whole
   difference. Hiding the cross axis is the fix; overflow-y is already auto
   here, so this cannot promote it from visible and reintroduce the phantom
   scrollbar I caused on the Hall tabs doing exactly this. */
.ld-page .r3-hc-stack { overflow-x: hidden; }

/* ---- fitting the site page ----
   UI's .r3 sizes itself to the viewport, which is right for a mock that owns
   the screen. Here the site's own sticky header sits above the page, so a shell
   sized to 100vh overflows by exactly the header's height, the page scrolls,
   and the tool rail slides under that header and stops taking clicks. The
   division by --ld-zoom is the matching trick at 4K, where 100vh inside a
   zoomed element still counts unscaled pixels. Rows are UI's, including the
   minmax(0, 1fr) that stops the dock sizing itself to its content. */
.ld-page .r3 {
  height: calc((100vh - var(--zl-header-bottom, 64px)) / var(--ld-zoom, 1) - var(--ld-topbar-h) - 30px);
  min-height: 420px;
}
@media (max-width: 920px) {
  .ld-page .r3 { height: auto; min-height: 0; }
}

/* The range colours for the layers list and the modal readout used to live
   here. They are back in UI's source with "far" added, so they are gone from
   MINE rather than held in both places. Worth knowing how they went missing:
   they were in the round 4b cap-tag block, which sat inside the centre-view
   CSS that round seven deleted whole, and nothing noticed because the same
   rules existed here and the page went on looking right. A duplicate hid a
   deletion. */

/* The forge's exits, and every other control's focus ring, are UI's now. They
   audited the whole page rather than patching the one button I reported and
   found that exactly one control in five rounds had a focus state, so there is
   a single :focus-visible rule for all of them in the source. Nothing left
   here. */

/* ---- the potency figure as a field ----
   Mine; UI has not designed this one yet. The figure in the perk modal is now
   typeable, so it is an input wearing the figure's clothes: same size, weight
   and colour, no browser chrome, and the state colour still applies. It has to
   say it is editable without shouting, so the affordance is a quiet underline
   that firms up on hover and becomes an accent ring on focus. Width is in ch so
   it holds "1.5 hp/s" as well as "37.5%" without the row shifting as the value
   changes. */
.ld-page .r3-modal .ld-perk-value-input {
  width: 7.5ch;
  padding: 2px 4px;
  text-align: right;
  font: inherit; font-size: inherit; font-weight: inherit; color: inherit;
  background: transparent;
  border: 0; border-bottom: 1px dashed var(--ld-line);
  border-radius: var(--ld-r-sm, 6px) var(--ld-r-sm, 6px) 0 0;
  cursor: text;
}
.ld-page .r3-modal .ld-perk-value-input:hover { border-bottom-color: var(--ld-accent); background: rgba(255, 255, 255, .03); }
.ld-page .r3-modal .ld-perk-value-input:focus,
.ld-page .r3-modal .ld-perk-value-input:focus-visible {
  outline: 2px solid var(--ld-accent); outline-offset: 2px;
  border-bottom-color: transparent; background: rgba(255, 255, 255, .04);
}

/* ---- recipe rows: the name gets the room, the quantity does not ----
   Mine. designer.css lays a row out as 52px 1fr auto auto, and both the owner's
   complaints come from that: the quantity is a number input, which defaults to
   about twenty characters wide in an auto track and takes room the name needed,
   and the name is a select whose 1fr track cannot shrink below its content, so
   it ends up squeezed to "Abyss...". The quantity never exceeds two digits, so
   it is sized for three. A write-in row has no select and two text fields
   instead, so it splits the room between them rather than leaving the
   description its intrinsic width. */
.ld-page .ld-slot { grid-template-columns: 52px minmax(0, 1fr) auto auto; }
.ld-page .ld-slot > select,
.ld-page .ld-slot > .ld-input:not(.ld-stepper-value) { width: 100%; min-width: 0; }
.ld-page .ld-slot .ld-stepper-value {
  width: 5.5ch; min-width: 0; flex: 0 0 auto;
  text-align: center; padding-left: 4px; padding-right: 4px;
}
.ld-page .ld-slot.is-new { grid-template-columns: 52px minmax(0, 1fr) minmax(0, 1.5fr) auto; }

/* ---- the page cannot be shoved sideways ----
   Mine, and a one-word correction to UI's rule rather than a new design.

   designer.css has, under @media (max-width: 760px):

     .ld-page { overflow-x: hidden; }

   overflow-x: hidden forces the used value of overflow-y from visible to auto, and that forced
   auto is the whole bug. It makes main.ld-page a scroll container nobody asked for. The stage
   layers hang 42px past each edge at 390 (the aura, the aura pool and the two emblem arms, not
   the bg layers, which .r3-bg already clips), so that container has a scrollWidth of 457 against
   a clientWidth of 390, and every dialog's focus() scrolled the page 67px right and left it
   there, with no horizontal scrollbar for the player to put it back with.

   overflow-x: clip clips exactly the same pixels, does not force the other axis, and creates no
   scroll container at all, so scrollLeft cannot leave 0 for anyone. Forcing it to 200 in the
   console leaves it at 0. The page's vertical scrolling is unaffected because it was never this
   element's: it is the document's, and always was.

   At UI's own breakpoint, deliberately, so the two rules cannot drift apart. */
@media (max-width: 760px) {
  .ld-page { overflow-x: clip; }
}

/* ---- the topbar fits on the line it is given ----
   Mine, and the other half of the pair-word breakpoint in designer.css. Both halves are at 1360
   on purpose: one width, so there is no band where the bar is half collapsed.

   "New design" becomes "New". The markup already carries both labels for the phone, so this is
   the page's own mechanism starting earlier rather than a new one, and it is what buys 1024 its
   room: the bar needed 1059 of a 1024 line and this is about 52 of it.

   The readout is the only control in the bar whose width is data. Every other one is a fixed
   label; this one is the player's Steam name, and it is as wide as they chose to make it, so no
   budget worked out against "Local Harness" at 100px survives contact with a real account. The
   cap bounds it without taking it away: a name that fits is untouched, a long one ends in an
   ellipsis, and the bar stops depending on who is signed in.

   1360 to 1460 with designer.css's half, on the owner's ruling. The two move together for the
   reason in the first line of this comment: one width, or there is a band where the bar is half
   collapsed. The measurement behind 1460 is in designer.css beside the other half. */
@media (max-width: 1460px) {
  .ld-page .ld-topbar .ld-only-desktop { display: none; }
  .ld-page .ld-topbar .ld-only-phone { display: initial; }
  /*
    .ld-topbar, not .ld-page. Two elements wear this class: the topbar's player name and the live
    legendary count in the facts column. Set 1 wrote this rule unscoped and capped both, so the
    count read "74 live legen..." at 1280, measured scrollWidth 125 against clientWidth 108. The
    facts column was never part of the topbar's budget and nothing about it should have changed.
  */
  .ld-page .ld-topbar .ld-readout {
    max-width: 110px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}

/* ---- and below 1120, the two things that are not the design ----
   Mine. The 1360 tier above is not enough at the worst corner: editing a design at 1024 still
   needed 1104 of a 1024 line, because edit mode carries Withdraw and two longer labels.

   The brand drops its second word, which is UI's own 760 rule starting earlier, and the readout
   goes rather than being capped. Below 1120 there is nothing left that is not about the design
   in front of the player, and their own name is the last thing they need while they are editing
   it. Both come back the moment the line is long enough to hold them. */
@media (max-width: 1120px) {
  .ld-page .ld-brand-text span { display: none; }
  /* Scoped for the same reason as the cap above: unscoped, this took the live
     legendary count off the facts column entirely below 1120. */
  .ld-page .ld-topbar .ld-readout { display: none; }
}

/* ---- the shortname beside the name, not instead of it ----
   Mine. Your designs listed a recipe as "3 x tarp_3794317122" because the modal never used the
   two indexes the Recipe panel uses. It names them now and keeps the id in small faint type,
   because staff and the owner read these threads with shortnames in hand and throwing the id
   away would cost them something real. */
.ld-page .ld-mine-recipe .ld-mine-id { color: var(--ld-faint); font-size: 0.82em; }

/* ---- Withdraw asks twice ----
   Mine. Withdrawing was one click for the only action on this page a player cannot undo: the
   design leaves Suggested, the votes stop, and there is no way back. It now arms like Discard.

   These four rules mirror UI's .r3-discard ones rather than extending them, because those are
   theirs and live in their part of this sheet. If UI generalises the pattern, these come out
   rather than being kept in step. Both labels share one grid cell for the reason written on the
   Discard button: arming must not change the button's width, or confirming a withdraw shoves
   the topbar sideways, which is bug 3 again. */
.ld-page .ld-wd-labels { display: grid; }
.ld-page .ld-wd-labels > * { grid-area: 1 / 1; }
.ld-page .ld-wd .at-armed { visibility: hidden; }
.ld-page .ld-wd.is-armed .at-idle { visibility: hidden; }
.ld-page .ld-wd.is-armed .at-armed { visibility: visible; }
/* Armed reads as the destructive thing it is, in the sheet's own bad colour. */
.ld-page .ld-wd.is-armed { color: var(--ld-bad); border-color: rgba(255, 92, 72, .55); }

/* ================================================== set two, the cosmetics ==
   All mine, all scoped to .ld-page, and none of it changes a shape UI designed.

   ---- the empty state is a sentence, not a tile ----
   "Nothing on this item yet." is written into .r3-itemgrid, which is a grid of
   narrow tiles, so it took one tile's column and wrapped to almost one word per
   line: measured 186px wide and 183px TALL at 1920, and 117 by 209 at 390. It
   spans the whole grid now, which is what a sentence in a grid of pictures
   wants. */
.ld-page .r3-itemgrid > .ld-empty { grid-column: 1 / -1; }

/* And the padding, because spanning the grid only fixed half of it: .ld-empty is
   designed as a whole panel's empty state, 48px of padding and height 100%, so
   the sentence sat in a 156px tall band of nothing.

   is-quiet is the class these inline notes already carry and it had no rule
   anywhere, declared and never implemented, so this is the modifier doing what
   its name says rather than a new one. It covers the layers list's "No perk
   yet" note as well, which had the same band under it. If UI takes is-quiet
   into their source, this comes out. */
.ld-page .ld-empty.is-quiet {
  height: auto; padding: 12px 4px; gap: 6px;
}

/* ---- a link wearing a button's clothes keeps the link's underline ----
   "Open in designer" is an anchor so it can be opened in a new tab, which is
   right, but the site underlines anchors and buttons are not underlined. The
   hover state is the button's own, so there is nothing to put back. */
.ld-page .ld-mine-edit,
.ld-page .ld-mine-edit:hover { text-decoration: none; }

/* ---- the layers list row opens with the keyboard ----
   The name cell is a real button now, for the reason already written on the
   facts column's copy of this control. These rules only take the browser's
   button chrome off it: it has to sit in the row's five column grid looking
   exactly as it did, because the row is UI's design and this is a semantics
   fix, not a visual one. The focus ring is the sheet's own, inherited from the
   single :focus-visible rule UI wrote for every control on the page. */
.ld-page .r3-layer > button.r3-layer-name {
  border: 0; padding: 0; margin: 0;
  background: transparent; color: inherit;
  font: inherit; font-size: 12.5px; font-weight: 600;
  text-align: left; min-width: 0; cursor: pointer;
}

/* ---- phone tap targets ----
   Measured at 390: Designs 53x31, Drafts 86x32, Help 100x33, New 98x33, and
   .ld-icon-btn, which is every dialog's Close, 32x32 at every width. All of
   them are raised together rather than the three QA named, because raising one
   of a row of identical controls leaves a 33px button beside a 44px one.

   min-height, not height: the topbar buttons are flex items with their own
   padding, and a fixed height would fight it. The 48px topbar at this width
   holds a 44px control with its padding. */
@media (max-width: 760px) {
  .ld-page .ld-topbar .ld-btn,
  .ld-page .ld-topbar .ld-icon-btn,
  .ld-page .ld-icon-btn { min-height: 44px; min-width: 44px; }
}

/* ---- the save indicator when the account is full ----
   Warn, not bad. The design is written here and the player loses nothing by
   carrying on; what they cannot do is keep it on the account until a slot
   frees, and the dot beside it is the only thing on screen that says so, since
   the needs line reclaims the status bar on the next render. */
.ld-page [data-ld-saved].is-bad { color: var(--ld-warn); }
.ld-page [data-ld-saved].is-bad .r3-status-dot { background: var(--ld-warn); }

/* ---- the crumb in edit mode, below 1360 ----
   Mine. The crumbs box is the one child of the topbar that shrinks and the status
   tag inside it does not, so the tag overflowed a container with no clipping and
   painted over the controls to its right. Measured editing an owned Suggested
   design: the box is 60px wide at 1024 and 142 at 1280, "Hall of Legends" is
   squeezed to 51px and wraps onto three lines, the name crumb measures 0 at 1024,
   1120 and 1280, and the tag sits outside the box at x=218 and x=277, eighteen
   pixels over the player chip at 1280.

   The tag goes, and the link and chevron with it, which is UI's own rule at 760
   raised to the width where the problem starts. Nothing is lost by hiding the tag:
   at 1024 the status is already on screen twice, in the crumbs at (218,70) and in
   the facts column at (341,195), both visible, so the facts column simply becomes
   the only place it is rather than the second place.

   What this buys, and the reason it is worth more than just stopping the overlap:
   the box is left to the design's NAME, which is the one thing in that bar the
   player needs and the one thing that measured 0 wide at three of the four widths.
   It already has its ellipsis from the base rule. */
@media (max-width: 1599px) {
  .ld-page .ld-crumbs a,
  .ld-page .ld-crumbs > svg { display: none; }
}
/* The tag holds on longer than the link does, because it is the wider of the two and the one
   that leaves the name nothing. Measured editing a design whose name is 86px at full: with the
   tag shown the name is 0 at 1366, 1440, 1500, 1540 and 1550, and 44 at 1600; it is 86 at 1700.
   Hidden to 1699 and the name has its full width at every one of those widths.

   1360 was the number in set 3 and it was not measured. It was set 1's topbar tier, taken because
   it was there, and the band from 1361 up is the cost of that: the tag came back on while the box
   was still too narrow to hold it, overflowed, and painted over the player chip by 53px at 1366.
   Both numbers here come from the table above instead. */
@media (max-width: 1699px) {
  .ld-page .ld-crumbs .ld-tag { display: none; }
}
/* ---- the way back out of "no skin" ----
   Mine. The chosen no-skin state says what was chosen and offers the way back;
   without the second half the only route to a real skin would be to type into
   the field and hope, with the design still reading "no skin" until the fetch
   landed. One row, the panel's own button, nothing new to look at. */
.ld-page .ld-skin-actions { margin-top: 10px; }

/* ==== set 7: the staff panels in the dock ============================
   Mine. Four panels under Recipe, shown only when the page was opened on
   someone else's design by somebody who may see it. They borrow the dock's
   own parts wherever there is one to borrow: ld-field for the inputs,
   r3-fact-group for the facts, ld-lines for the messages, so there is no
   second idea in here about what a panel looks like. */

/* The panels are hidden by the attribute, and the attribute needs saying out
   loud: .ld-page .r3-panel sets display:flex, which beats the UA sheet's
   [hidden] { display: none } on specificity, so without this the four would
   have been on screen for every player. */
.ld-page .r3-panel[hidden] { display: none; }

/* Read only: the five design panel BODIES carry inert, which already stops
   every control in them, and this is the part that says so to the eye. The
   headers are deliberately untouched, so somebody who may only look can still
   open a panel and look. */
.ld-page .r3-panel-body.is-readonly { opacity: 0.68; }
.ld-page .r3-panel-body.is-readonly::selection { background: none; }

.ld-page .ld-staff-actions {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 2px;
}
/* An armed staff control wears the same red as the armed Discard, because it
   is the same promise: the next click is the one that does it. */
.ld-page .ld-staff-actions .ld-btn.is-armed {
  color: var(--ld-bad); border-color: var(--ld-bad);
  background: rgba(255, 92, 72, .12);
}

/* The submitter's own words, read only, never an input. */
.ld-page .ld-staff-notes {
  margin: 0; padding: 9px 11px;
  background: var(--ld-surface-2); border: 1px solid var(--ld-line); border-radius: 8px;
  font-size: 12px; line-height: 1.5; color: var(--ld-text); white-space: pre-wrap;
}

/* The history. Same list shape the review page gives it, which is where the
   markup comes from: plugins/legendary-revisions.js builds it for both. */
.ld-page .ld-staff-rev {
  list-style: none; margin: 8px 0 0; padding: 0;
  font-size: 11.5px; line-height: 1.5; color: var(--ld-text);
}
.ld-page .ld-staff-rev li {
  padding: 7px 0; border-top: 1px solid var(--ld-line);
}
.ld-page .ld-staff-rev li:first-child { border-top: 0; }
/* The class the shared revision markup uses for a comment and for "None yet".
   It is the staff sheet's name and this page does not load that sheet, so the
   one rule it needs lives here rather than the whole sheet being pulled in. */
.ld-page .ld-st-muted { color: var(--ld-faint); }

/* The staff controls join the phone tap target rule set 2 established. Measured
   at 390 before this: the five status buttons and the archive pair all came out
   33px tall, against the 44px every other control on this page was raised to.
   Raising only some of a row leaves a 33px button beside a 44px one, which is
   the reason that rule raised them all together in the first place. */
@media (max-width: 760px) {
  .ld-page .ld-staff-actions .ld-btn { min-height: 44px; }
}

/* The staff badge in the crumbs. Accent rather than a status colour: it says
   whose design this is, not what state it is in, and the status tag is right
   beside it saying that. It wears .ld-tag so set 4's 1700 rule hides it with
   the tag it sits next to, which is the whole reason it is not a new class. */
.ld-page .ld-crumbs .ld-staff-badge {
  color: var(--ld-accent); border-color: var(--ld-accent);
}
.ld-page .ld-crumbs .ld-staff-badge > i { background: var(--ld-accent); }
.ld-page .ld-crumbs .ld-staff-badge[hidden] { display: none; }
