/* Holotype UI — arena.css
   PvP (ROADMAP §4): the header wallet chip, the mate-stage spend panel, and
   the battle-result modal with its round-by-round reveal. Linked after
   library.css. Reuses the shared .modal-backdrop / .modal chrome; only the
   battle-specific inner layout lives here. */

/* (The titlebar wallet chip was retired — discovery points + battle energy now
   live in the action dock as the resource plaque; see .dock-plaque in layout.css.) */

/* ---- Mate-stage spend panel ---- */
.mate-spend {
    margin: 12px auto 0;
    max-width: 300px;
    text-align: left;
    border-top: 1px solid var(--rule);
    padding-top: 10px;
}
.mate-spend[hidden] { display: none; }
.mate-spend-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    font-family: var(--font-serif);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--copper);
}
.mate-spend-balance {
    color: var(--gold-leaf);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: none;
}
.mate-spend-opt {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    color: var(--ink);
    cursor: pointer;
}
.mate-spend-opt input { margin-top: 3px; flex: none; }
.mate-spend-opt input:disabled { opacity: 0.4; }
.mate-spend-opt input:disabled + span { opacity: 0.5; }
.mate-spend-cost { color: var(--gold-leaf); font-size: 11px; margin-left: 4px; }
.mate-spend-hint { display: block; font-size: 11px; color: var(--ink-faint); }
/* The favour-element option pairs a label span with a select (not a checkbox);
   stack the picker under the label and indent it to line up with the others. */
.mate-spend-opt--select { flex-direction: column; align-items: stretch; gap: 5px; }
.mate-spend-opt--select[hidden] { display: none; }
.mate-spend-opt--select select {
    align-self: flex-start;
    margin-left: 22px;
    padding: 4px 8px;
    background: var(--bg-ink);
    border: 1px solid var(--rule-strong);
    border-radius: 1px;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 13px;
}
.mate-spend-opt--select select:disabled { opacity: 0.45; }

/* ---- Battle-result modal ---- */
/* (The old fixed-width `.battle-modal-content` shell was retired when both PvP
   modals moved onto the shared .stage-shell; the ceremony-round-2 dressing
   below lives directly on .battle-vs / .battle-side / .battle-portrait.) */
.battle-eyebrow { display: block; margin-bottom: 14px; }
/* The arena: a painterly landscape backdrop (chosen per matchup, set inline
   by JS) with the two combatants as cards sitting in it, facing off. */
.battle-vs {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 24px;
    /* A tall cinematic band — min-height so the landscape reads as a scene,
       not a strip, even before the cards size it. */
    min-height: 340px;
    margin-bottom: 18px;
    padding: 26px 24px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-ink) center / cover no-repeat;
    box-shadow: inset 0 0 0 1px var(--rule-strong);
}
/* Vignette wash so the cards stay legible over any landscape. */
.battle-vs::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center,
        rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.58));
    pointer-events: none;
}
/* Each combatant sits on a mounted specimen plate (the shared fj-plate recipe:
   parchment grain multiplied over dark vellum, hairline inset) instead of a
   flat translucent box. The old blur behind the panel is dropped — WebKit
   re-rasterizes that every frame during the strike animation (jitter); the
   opaque parchment reads richer over the landscape anyway. The .fj-cartouche
   corner filigree is added via the class in index.html. #258. */
.battle-side {
    position: relative;
    z-index: 1;
    flex: 0 1 320px;
    min-width: 0;
    align-self: center;
    padding: 16px 16px 18px;
    border-radius: 2px;
    background:
        url("/static/assets/plate-parchment.png") center / 240px repeat,
        linear-gradient(168deg, rgba(36, 26, 17, 0.95), rgba(21, 16, 10, 0.97));
    background-blend-mode: multiply, normal;
    border: 1px solid var(--rule-strong);
    box-shadow: var(--plate-inset), 0 6px 18px rgba(0, 0, 0, 0.5);
}
/* Specimen portrait — a double-rule mat (the fj-frame recipe) with a domed pin
   tacked in each upper corner, matching the hero card's photo treatment. */
.battle-portrait {
    position: relative;
    width: 100%;
    max-width: 260px;
    aspect-ratio: 1 / 1;
    margin: 0 auto 12px;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    overflow: hidden;
    background: var(--bg-ink);
    box-shadow:
        inset 0 0 0 1px var(--bg-vellum),
        inset 0 0 0 2px var(--rule),
        inset 0 2px 6px rgba(0, 0, 0, 0.55);
}
.battle-portrait::before,
.battle-portrait::after {
    content: "";
    position: absolute;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle at 34% 30%, #edc78c, #6e4f29 82%);
    box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.6);
    z-index: 3;
    pointer-events: none;
}
.battle-portrait::before { left: 8px; }
.battle-portrait::after  { right: 8px; }
.battle-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.battle-name { font-family: var(--font-serif); font-size: 17px; color: var(--ink); }
.battle-foe-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 0 5px;
    border: 1px solid var(--rule-strong);
    border-radius: 8px;
    font-family: var(--font-serif);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
    vertical-align: middle;
}
.battle-power {
    font-family: var(--font-serif);
    font-size: 11px;
    color: var(--ink-muted);
    letter-spacing: 0.04em;
}
/* .battle-vs-mark is defined once, below (the vs-cartouche emblem holder) —
   the old italic-"vs" text rule was folded into it (#258). */
/* Per-side stat summary shown in the preview (and kept during the reveal). */
.battle-stats {
    margin: 8px 0 0;
    display: grid;
    grid-template-columns: repeat(2, auto);
    justify-content: center;
    gap: 2px 14px;
}
.battle-stats:empty { display: none; }
.battle-stat {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    min-width: 50px;
    font-family: var(--font-serif);
    font-size: 11px;
}
.battle-stat-k { color: var(--ink-faint); letter-spacing: 0.06em; }
.battle-stat-v { color: var(--ink); font-variant-numeric: tabular-nums lining-nums; }
.battle-elems {
    grid-column: 1 / -1;
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 12px;
    font-family: var(--font-serif);
    font-size: 11px;
}
/* An elemental affinity: tiny role label + engraved glyph + name, all tinted
   by the element's colour (set inline on .elem-tag). */
.elem-tag { display: inline-flex; align-items: center; gap: 3px; text-transform: capitalize; }
.elem-tag svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linejoin: round;
    stroke-linecap: round;
}
.elem-role {
    font-size: 8px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-faint);
    margin-right: 1px;
}
.elem-name { color: inherit; }
.battle-rounds {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px 7px;
    min-height: 26px;
    margin: 4px 0 12px;
    line-height: 1;
}
/* Ceremony Phase 2 (#204): each strike pip is an engraved round WELL that hosts
   a screen-keyed pip-sheet glyph on a real child (.battle-pip-tex). The
   per-state border tint is the FALLBACK so the scoreboard still reads
   win/loss/dodge before pip-sheet.png exists. Animate only border-color +
   transform (WebKit-safe — no colour/filter transitions). */
.battle-pip {
    position: relative;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--rule-strong);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.55);
    transition: border-color var(--motion-quick), transform var(--motion-quick);
}
.battle-pip.is-pending { opacity: 0.5; }
.battle-pip.is-win { border-color: var(--gold-leaf); transform: translateY(-2px); }
.battle-pip.is-loss { border-color: var(--oxblood); }
.battle-pip.is-dodge { border-color: var(--ink-faint); opacity: 0.78; }
/* The engraved glyph: a 4-cell strip [pending ○ · hit ∧ · loss ∨ · dodge ╱],
   redrawn procedurally so the four states are unmistakable (the Flux dodge read
   like pending). Luminance-keyed transparent PNG composited with PLAIN ALPHA
   (screen made it faint); the cell is chosen per parent state via
   background-position. Own compositing layer; static per state. */
.battle-pip-tex {
    position: absolute;
    inset: 1px;
    border-radius: 50%;
    background: url("/static/assets/pip-sheet.png") no-repeat;
    background-size: 400% 100%;
    background-position: 0% center;     /* pending cell */
    pointer-events: none;
    transform: translateZ(0);
}
.battle-pip.is-win  .battle-pip-tex { background-position: 33.333% center; }
.battle-pip.is-loss .battle-pip-tex { background-position: 66.667% center; }
.battle-pip.is-dodge .battle-pip-tex { background-position: 100% center; }

/* Phase-2 reveal: a slim HP bar under each portrait that drains as the duel
   plays out. Shown only during the result reveal (hidden in the preview). */
.battle-hp {
    display: flex;
    align-items: center;
    gap: 7px;
    max-width: 220px;
    margin: -4px auto 8px;
}
.battle-hp[hidden] { display: none; }
/* An engraved brass channel — a recessed dark bed inside a brass rim (the rim +
   inset shadow read as a tooled gauge), tall enough to actually show, with a
   glossy draining fill. #204. */
.battle-hp-track {
    flex: 1 1 auto;
    height: 12px;
    border-radius: 7px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0.5));
    border: 1px solid var(--brass);
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.85),
        inset 0 0 0 1px rgba(0, 0, 0, 0.5),
        0 1px 0 rgba(255, 226, 170, 0.14);
}
.battle-hp-fill {
    height: 100%;
    width: 100%;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--gold-leaf), var(--copper));
    box-shadow: inset 0 1px 0 rgba(255, 242, 205, 0.45),
                inset 0 -2px 3px rgba(0, 0, 0, 0.3);
    transition: width 360ms cubic-bezier(0.4, 0, 0.2, 1), background 360ms ease;
}
/* Below ~30% the bar bleeds to oxblood — the "this creature is in trouble" tell. */
.battle-hp-fill.is-low { background: linear-gradient(180deg, #b0413f, var(--oxblood)); }
.battle-hp-num {
    flex: 0 0 auto;
    min-width: 26px;
    text-align: right;
    font-family: var(--font-serif);
    font-size: 12px;
    font-variant-numeric: tabular-nums lining-nums;
    color: var(--ink-muted);
}

/* Floating damage numbers that rise off the struck portrait. Outgoing (you
   hit the foe) reads gold; incoming (the foe hits you) reads oxblood; a dodge
   shows a faint "miss". Anchored to .battle-portrait (position: relative). */
.battle-dmg-float {
    position: absolute;
    left: 50%;
    top: 36%;
    transform: translate(-50%, 0);
    pointer-events: none;
    z-index: 4;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: 26px;
    line-height: 1;
    white-space: nowrap;
    animation: dmg-float 800ms ease-out forwards;
}
.battle-dmg-float.is-outgoing {
    color: var(--gold-leaf);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 10px var(--gold-leaf-glow);
}
.battle-dmg-float.is-incoming {
    color: var(--oxblood);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
}
.battle-dmg-float.is-crit { font-size: 35px; }
.battle-dmg-float.is-dodge {
    font-size: 15px;
    font-style: italic;
    font-weight: 400;
    color: var(--ink-faint);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
@keyframes dmg-float {
    0%   { opacity: 0; transform: translate(-50%, 8px) scale(0.8); }
    18%  { opacity: 1; transform: translate(-50%, 0) scale(1.06); }
    100% { opacity: 0; transform: translate(-50%, -36px) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
    .battle-hp-fill { transition: none; }
}

.battle-verdict {
    margin: 4px 0;
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.battle-verdict[hidden] { display: none; }
.battle-verdict.is-win {
    color: var(--gold-leaf);
    text-shadow: 0 0 12px var(--gold-leaf-glow);
}
.battle-verdict.is-loss { color: var(--oxblood); }
/* Reward strip — oxblood tooled-leather face with light gold text, matching the
   mating spend panel so the two ceremonies share one material language (#204
   port of the #203 leather). Self-contained (was .stage-plaque brass). */
.battle-reward {
    margin-bottom: 8px;
    padding: 8px 16px;
    border-radius: 3px;
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--gold-leaf);
    background-color: #3a1414;
    background-image:
        linear-gradient(rgba(26, 8, 8, 0.32), rgba(48, 16, 16, 0.18)),
        url("/static/assets/leather.png");
    background-size: cover; background-position: center;
    border: 1px solid #200a0a;
    box-shadow:
        inset 0 1px 0 rgba(255, 210, 170, 0.10),
        inset 0 0 0 1px rgba(0, 0, 0, 0.4),
        var(--bevel-raised);
}
.battle-reward[hidden] { display: none; }

/* ---- Arena Match (best-of-N counter-pick) ----
   Reuses the battle-modal chrome; adds the scoreboard, the counter-assign
   grid, and the per-bout heading. The bout duel itself reuses .battle-vs /
   .battle-hp / .battle-pip. */
.match-subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    color: var(--ink-muted);
    margin: -6px 0 12px;
}
/* Series scoreboard — one lozenge per contested position, lit as bouts land.
   Mounted on the shared brass plaque so the running tally reads as a struck
   scoreplate; the dark pips sit in it like recessed slots. #258. */
.match-scoreboard {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto 16px;
    padding: 8px 14px;
    min-height: 16px;
    background:
        url("/static/assets/plaque-brass.png") center / cover no-repeat,
        var(--brass-face);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius-sm);
    box-shadow: var(--bevel-raised);
}
.match-score-pip {
    width: 26px;
    height: 8px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--rule-strong);
    transition: background var(--motion-base), border-color var(--motion-base);
}
.match-score-pip.is-win {
    background: linear-gradient(90deg, var(--gold-leaf), var(--copper));
    border-color: var(--gold-leaf);
}
.match-score-pip.is-loss {
    background: var(--oxblood);
    border-color: var(--oxblood);
}
/* Counter-assign grid — one row per defender position: their champion, the
   "vs" mark, and a select for the creature you field against it. */
.match-assign[hidden] { display: none; }
.match-assign-intro {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 13.5px;
    color: var(--ink-muted);
    margin: 0 0 14px;
    line-height: 1.5;
}
.match-assign-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 6px;
}
.match-assign-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(14, 10, 7, 0.5);
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    box-shadow: var(--well-inset);   /* carved-in slot — shared material kit */
}
.match-foe-cell,
.match-you-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.match-you-cell { flex-direction: row-reverse; text-align: right; }
.match-assign-row img {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    background: var(--bg-ink);
    flex: 0 0 auto;
}
.match-cell-name {
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.match-cell-stats {
    font-family: var(--font-serif);
    font-size: 10.5px;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums lining-nums;
}
.match-pos-mark {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    color: var(--gold-leaf);
    flex: 0 0 auto;
}
.match-assign-row select {
    width: 100%;
    box-sizing: border-box;
    padding: 7px 9px;
    background: var(--bg-ink);
    border: 1px solid var(--rule-strong);
    border-radius: 1px;
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 13px;
    box-shadow: var(--well-inset);   /* carved field — shared material kit (PR 4) */
}
.match-assign-row select.is-dupe { border-color: var(--oxblood); }
/* Per-bout heading in the fight phase. */
.match-bout[hidden] { display: none; }
.match-bout-title {
    font-family: var(--font-serif);
    font-size: 13px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-feature-settings: "smcp", "lnum";
    color: var(--copper);
    margin-bottom: 10px;
}
/* "Find a Match" CTA on the Stable page. */
.stable-match-btn { margin-top: 4px; }

/* Phone: the 3-column counter-assign row (foe | vs | your pick) is too tight
   below ~560px — the "vs" collides with the foe name and the select truncates.
   Stack it: foe on top, a centered "vs" divider, your pick full-width below. */
@media (max-width: 560px) {
    .match-assign-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .match-assign-row .match-pos-mark { justify-self: center; }
    .match-you-cell { flex-direction: row; }
    .match-assign-row select { width: 100%; }
    /* Let the rank line stack rather than cram rating + record together. */
    .rank-line { flex-wrap: wrap; }
}

/* ---- Ladder rank banner (Stable page) ---- */
.stable-rank {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 18px;
    padding: 14px 16px;
    background: rgba(14, 10, 7, 0.5);
    border: 1px solid var(--rule-strong);
    border-left: 3px solid var(--gold-leaf);
    border-radius: 2px;
}
.stable-rank[hidden] { display: none; }
/* Tier badge — a hexagon-ish gold lozenge with the tier name. */
.rank-badge {
    flex: 0 0 auto;
    padding: 7px 14px;
    border-radius: 3px;
    background: linear-gradient(135deg, var(--gold-leaf), var(--copper));
    color: var(--bg-ink);
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-feature-settings: "smcp", "lnum";
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
}
.rank-meta { flex: 1 1 auto; min-width: 0; }
.rank-line {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}
.rank-rating {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--gold-leaf);
    font-variant-numeric: tabular-nums lining-nums;
}
.rank-record {
    font-family: var(--font-serif);
    font-size: 12px;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums lining-nums;
}
.rank-track {
    height: 7px;
    margin: 7px 0 5px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--rule-strong);
}
.rank-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--gold-leaf), var(--copper));
    transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
}
.rank-next {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 11.5px;
    color: var(--ink-faint);
}
/* Rating delta line on the match-result screen. */
.match-rating-delta {
    font-family: var(--font-serif);
    font-size: 15px;
    margin: 4px 0 2px;
    font-variant-numeric: tabular-nums lining-nums;
}
.match-rating-delta.is-up { color: var(--gold-leaf); }
.match-rating-delta.is-down { color: var(--oxblood); }
.match-rating-delta[hidden] { display: none; }

/* ---- Victory moment: verdict pop / defeat shake ----
   The win pays off with the engraved ray-burst (fx-rayburst, driven by
   _victoryRays → playRayBurst in JS) haloing behind the verdict plate instead
   of the old 8-dot CSS spark burst — the shared "discovery energy" payoff. */
@media (prefers-reduced-motion: no-preference) {
    .battle-verdict.is-win  { animation: verdict-pop 520ms cubic-bezier(0.2, 0.7, 0.2, 1); }
    .battle-verdict.is-loss { animation: verdict-shake 420ms ease-in-out; }
}
@keyframes verdict-pop {
    0%   { transform: scale(0.6); opacity: 0; }
    55%  { transform: scale(1.16); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes verdict-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(3px); }
}

/* ---- Battle/arena entrance (#258) ----
   On a fresh open (and each match bout) the two combatant plates slide in from
   their sides and the VS emblem stamps down — an anticipation beat before the
   strikes. JS (_armBattleEntrance) adds .battle-enter on the .battle-vs band
   and replays it via reflow. `both` fill holds the pre-delay opacity:0 so the
   sides don't flash before their staggered start. Gated on no-preference —
   reduced-motion just shows the populated band. Transform/opacity only. */
@media (prefers-reduced-motion: no-preference) {
    .battle-vs.battle-enter .battle-side--you {
        animation: battle-enter-l 280ms cubic-bezier(0.2, 0.7, 0.2, 1) 120ms both;
    }
    .battle-vs.battle-enter .battle-side--foe {
        animation: battle-enter-r 280ms cubic-bezier(0.2, 0.7, 0.2, 1) 240ms both;
    }
    .battle-vs.battle-enter .battle-vs-tex {
        animation: battle-stamp 240ms cubic-bezier(0.2, 0.7, 0.2, 1) 420ms both;
    }
}
@keyframes battle-enter-l {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes battle-enter-r {
    from { opacity: 0; transform: translateX(24px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes battle-stamp {
    from { opacity: 0; transform: scale(1.4); }
    60%  { opacity: 1; transform: scale(1); }
    to   { opacity: 1; transform: scale(1); }
}

/* Hit reaction — a quick nudge of whoever took the blow each round. The JS
   gates this on reduced-motion (it won't add the class), so no media query. */
.battle-portrait.vfx-hit { animation: vfx-hit 280ms ease-in-out; }
@keyframes vfx-hit {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}

/* ---- Elemental attack/ward VFX (Phase 3) ----
   Sprites are luminous-on-pure-black, keyed onto the scene with
   mix-blend-mode: screen. Overlaid on the struck portrait during the round
   reveal; JS gates all of this on reduced-motion and self-removes the nodes. */
.battle-portrait { position: relative; }
.fx-fx {
    position: absolute;
    /* Fills the portrait frame (which clips to its rounded square); the
       sprite's own glow fades into black, so the effect reads as impact
       over the creature rather than a hard-edged overlay. */
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    mix-blend-mode: screen;
    z-index: 3;
}
/* The incoming attack burst — slams in, then fades. */
.fx-burst { animation: fx-burst 700ms ease-out forwards; }
@keyframes fx-burst {
    0%   { opacity: 0; transform: scale(1.5); }
    22%  { opacity: 1; transform: scale(1); }
    70%  { opacity: 0.9; }
    100% { opacity: 0; transform: scale(0.94); }
}
/* The defender's ward — expands to meet the blow, holds, fades. */
.fx-ward { animation: fx-ward 700ms ease-out forwards; }
@keyframes fx-ward {
    0%   { opacity: 0; transform: scale(0.55); }
    30%  { opacity: 0.95; transform: scale(1.05); }
    65%  { opacity: 0.8; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.02); }
}

/* ---- Discovery Points modal (opened from the wallet chip) ---- */
.vp-modal-content { max-width: 520px; text-align: left; }
.vp-eyebrow { display: block; margin-bottom: 12px; }
.vp-balance {
    display: flex;
    align-items: baseline;
    gap: 16px;
    margin-bottom: 16px;
    font-family: var(--font-serif);
}
.vp-balance-points { font-size: 26px; color: var(--gold-leaf); }
.vp-balance-energy { font-size: 13px; color: var(--ink-muted); }
.vp-section-label {
    font-family: var(--font-serif);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-leaf);
    margin: 6px 0 8px;
}
.vp-energy-text {
    margin: 0 0 18px;
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.55;
}
.vp-cols { display: flex; gap: 22px; margin-bottom: 18px; }
.vp-col { flex: 1; min-width: 0; }
.vp-col h3 {
    margin: 0 0 6px;
    font-family: var(--font-serif);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--copper);
}
.vp-col ul { margin: 0; padding-left: 18px; }
.vp-col li { font-size: 13px; color: var(--ink); line-height: 1.5; margin-bottom: 4px; }
.vp-note { margin: 8px 0 0; font-size: 11px; font-style: italic; color: var(--ink-faint); line-height: 1.45; }
.vp-history-head {
    margin: 0 0 8px;
    font-family: var(--font-serif);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--copper);
    border-top: 1px solid var(--rule);
    padding-top: 14px;
}
/* Reserve the scrollbar gutter and inset the rows from it, so the system
   scrollbar never overlaps the right-aligned amount column. */
.vp-history { max-height: 220px; overflow-y: auto; scrollbar-gutter: stable; padding-right: 10px; }
.vp-history-empty { font-size: 13px; font-style: italic; color: var(--ink-faint); padding: 6px 0; }
.vp-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--rule);
    font-family: var(--font-serif);
}
.vp-row:last-child { border-bottom: 0; }
.vp-row-reason { font-size: 13px; color: var(--ink-muted); }
.vp-row-amt { font-size: 13px; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.vp-row-amt.is-earn { color: var(--gold-leaf); }
.vp-row-amt.is-spend { color: var(--oxblood); }

/* Stack the earn/spend columns on phones. */
@media (max-width: 560px) {
    .vp-cols { flex-direction: column; gap: 14px; }
}

/* ====== Breeding Lab (aligned-diff mating) ============================== */
/* (The old fixed-width `.breeding-lab-content` shell was retired when the lab
   moved onto the shared .stage-shell; #260 removed the dead rule.) */
.bl-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 14px;
}
.bl-eyebrow { display: inline; }
.bl-title {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--ink);
}
.bl-title em { font-style: normal; color: var(--copper); }
.bl-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--ink-faint);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
}
.bl-close:hover { color: var(--copper); }

/* ---- two cards + centre ---- */
.bl-cards {
    display: grid;
    grid-template-columns: 1fr 190px 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 16px;
}
/* The grid display overrides the bare [hidden] attribute, so guard it — the
   ceremony hides .bl-cards while the arc plays (#259). */
.bl-cards[hidden] { display: none; }
.bl-card-slot { min-width: 0; }
.bl-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding-top: 26px;
}
/* The lab's small "compare genomes" indicator — the engraved chiasma plate
   scaled down (the same copperplate art as the ceremony hero, #259). */
.bl-dish { width: 108px; height: 108px; }
.bl-dish-art {
    width: 100%; height: 100%;
    object-fit: contain;
    opacity: 0.82;
    pointer-events: none;
}
.bl-predict {
    text-align: center;
    font-family: var(--font-serif);
    font-size: 12px;
    color: var(--ink-muted);
    line-height: 1.5;
}
.bl-predict b { color: var(--gold-leaf); font-variant-numeric: lining-nums; }
.bl-predict .diff { color: var(--copper); }

/* ---- a parent card (compact genome-card) ---- */
.bl-card {
    --frame: #6b6356;
    background:
        linear-gradient(var(--bg-vellum), var(--bg-vellum)) padding-box,
        linear-gradient(var(--frame), var(--frame)) border-box;
    border: 6px solid transparent;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px var(--brass), inset 0 0 0 4px var(--bg-vellum),
                0 10px 26px rgba(0, 0, 0, 0.5);
}
.bl-card.rarity-uncommon { --frame: var(--brass); }
.bl-card.rarity-rare     { --frame: var(--copper); }
.bl-card.rarity-mythic   { --frame: var(--gold-leaf); }
.bl-card-bar {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 7px 11px 5px;
}
.bl-card-name { font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--ink); }
.bl-card-rar {
    font-family: var(--font-serif); font-size: 9px; letter-spacing: 0.14em;
    text-transform: uppercase; font-feature-settings: "smcp"; color: var(--ink-faint);
}
.bl-card-rar.rarity-uncommon { color: var(--brass); }
.bl-card-rar.rarity-rare     { color: var(--copper); }
.bl-card-rar.rarity-mythic   { color: var(--gold-leaf); }
.bl-card-art {
    margin: 0 6px;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border: 1px solid var(--rule-strong);
    background: var(--bg-ink);
}
.bl-card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bl-card-type { padding: 5px 11px 2px; font-family: var(--font-serif); font-size: 11px; color: var(--ink-muted); letter-spacing: 0.04em; }
.bl-card-stats {
    display: flex; gap: 9px; padding: 4px 11px 9px;
    font-family: var(--font-serif); font-size: 11px; color: var(--ink);
    font-variant-numeric: tabular-nums lining-nums; flex-wrap: wrap;
}
.bl-card-stats b { color: var(--copper); font-weight: 600; }

/* ---- the library picker (right pane until a mate is chosen) ---- */
.bl-picker-controls { display: flex; gap: 8px; margin-bottom: 9px; }
.bl-search, .bl-picker-controls select {
    font-family: var(--font-sans); font-size: 13px; padding: 6px 9px;
    background: var(--bg-ink); border: 1px solid var(--rule-strong);
    border-radius: 1px; color: var(--ink);
    box-shadow: var(--well-inset);   /* carved field — shared material kit (PR 4) */
}
.bl-search { flex: 1 1 auto; min-width: 0; }
.bl-search:focus, .bl-picker-controls select:focus {
    outline: none; border-color: var(--copper);
    box-shadow: var(--well-inset), 0 0 0 2px var(--copper-dim);
}
.bl-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding: 2px;
}
.bl-picker-tile {
    cursor: pointer; background: var(--bg-ink); border: 1px solid var(--rule-strong);
    border-radius: 1px; padding: 5px; text-align: left;
    transition: border-color var(--motion-quick), transform var(--motion-quick);
}
.bl-picker-tile:hover, .bl-picker-tile:focus-visible {
    outline: none; border-color: var(--copper); transform: translateY(-1px);
}
.bl-picker-tile img {
    width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
    background: var(--bg-vellum); border: 1px solid var(--rule);
}
.bl-picker-tile .bpt-name {
    margin-top: 4px; font-family: var(--font-serif); font-size: 11px; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bl-picker-tile .bpt-meta {
    font-family: var(--font-serif); font-size: 9.5px; color: var(--ink-muted);
    font-variant-numeric: tabular-nums lining-nums;
}
.bl-picker-tile .bpt-meta .mut { color: var(--gold-leaf); }
.bl-picker-empty { grid-column: 1/-1; font-family: var(--font-serif); font-style: italic; color: var(--ink-muted); font-size: 13px; padding: 12px 4px; }
.bl-mate-change {
    display: block; margin-top: 8px; width: 100%; padding: 5px;
    font-family: var(--font-serif); font-size: 10px; letter-spacing: 0.12em;
    text-transform: uppercase; font-feature-settings: "smcp"; background: transparent;
    color: var(--ink-faint); border: 1px solid var(--rule); border-radius: 1px; cursor: pointer;
}
.bl-mate-change:hover { border-color: var(--copper); color: var(--copper); }

/* ---- aligned genetic comparison ---- */
.bl-diff { background: rgba(14, 10, 7, 0.32); border: 1px solid var(--rule); border-radius: 3px; padding: 6px; margin-bottom: 14px; box-shadow: var(--well-inset); }
.bl-diff[hidden] { display: none; }
.bl-diff-head {
    display: grid; grid-template-columns: 1fr 150px 1fr 96px; gap: 10px;
    padding: 4px 10px 8px; font-family: var(--font-serif); font-size: 10px;
    letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); font-feature-settings: "smcp";
}
.bl-diff-head span:nth-child(1) { text-align: right; }
.bl-diff-head span:nth-child(2), .bl-diff-head span:nth-child(4) { text-align: center; }
.md-row {
    display: grid; grid-template-columns: 1fr 150px 1fr 96px; align-items: center; gap: 10px;
    padding: 8px 10px; border-top: 1px solid var(--rule); min-height: 40px;
}
.md-row:first-of-type { border-top: none; }
.md-row.differ { background: rgba(176, 124, 68, 0.10); }
.md-row.match { opacity: 0.62; }
.md-row.prize { box-shadow: inset 3px 0 0 var(--gold-leaf); }
.md-side { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.md-side.you { align-items: flex-end; text-align: right; }
.md-allele-line { white-space: nowrap; }
.md-allele { font-family: var(--font-mono); font-size: 12px; color: var(--copper); }
.md-allele.is-mut { color: var(--gold-leaf); }
.md-encodes { font-family: var(--font-serif); font-size: 10.5px; color: var(--ink-faint); line-height: 1.25; }
.md-locus { text-align: center; }
.md-locus-name { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-serif); font-weight: 600; font-size: 13px; color: var(--ink); }
.md-dot { width: 7px; height: 7px; border-radius: 50%; }
.md-dot--pigment { background: var(--copper); }
.md-dot--structure { background: var(--brass); }
.md-dot--morphology { background: var(--sage); }
.md-zyg { display: block; font-family: var(--font-serif); font-size: 8.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); font-feature-settings: "smcp"; margin-top: 2px; }
.md-prize-tag { display: block; font-size: 9px; color: var(--gold-leaf); margin-top: 1px; }
/* per-locus favour control */
.md-fav { display: flex; justify-content: center; gap: 3px; }
.md-fav button {
    width: 26px; height: 24px; border: 1px solid var(--rule-strong); background: var(--bg-ink);
    color: var(--ink-muted); border-radius: 2px; cursor: pointer; font-size: 13px; line-height: 1;
}
.md-fav button.on { background: var(--copper-dim); border-color: var(--copper); color: var(--copper); }
.md-fav .neutral { font-size: 10px; }
.md-row.match .md-fav { visibility: hidden; }

/* ---- spend bar ---- */
.bl-spend {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--bg-vellum); border: 1px solid var(--rule); border-radius: 3px; padding: 11px 14px;
    box-shadow: var(--plate-inset);   /* raised scored leaf — shared material kit */
}
.bl-spend[hidden] { display: none; }
/* (The brass `.bl-spend.stage-plaque` variant was dead — the markup only ever
   uses the oxblood-leather face below; #260 removed it.) */
/* Oxblood-leather face for the spend panel (#203) — a deep tooled
   leather with light gold-leaf / cream text (leather + the walnut button reads
   as a study/library). Self-contained: does NOT use .stage-plaque, which the
   battle verdict shares. Static colour/texture, no filter. */
.bl-spend.bl-spend--leather {
    padding: 12px 16px; border-radius: 3px;
    background-color: #3a1414;
    background-image:
        linear-gradient(rgba(26, 8, 8, 0.32), rgba(48, 16, 16, 0.18)),
        url("/static/assets/leather.png");
    background-size: cover; background-position: center;
    border: 1px solid #200a0a;
    box-shadow:
        inset 0 1px 0 rgba(255, 210, 170, 0.10),
        inset 0 0 0 1px rgba(0, 0, 0, 0.4),
        var(--bevel-raised);
    color: #ecdcc0;
}
.bl-spend--leather .bl-bal { color: var(--gold-leaf); font-weight: 600; }
.bl-spend--leather .bl-running { color: #d8c2a0; }
.bl-spend--leather .bl-running b { color: var(--brass); font-weight: 700; }
.bl-spend--leather .bl-opt { color: #ecdcc0; font-weight: 600; }
.bl-spend--leather .bl-cost { color: var(--gold-leaf); font-weight: 600; }
.bl-spend--leather .bl-confirm { border-color: var(--brass); }   /* pop on leather */
.bl-bal { font-family: var(--font-serif); font-size: 14px; color: var(--gold-leaf); }
.bl-running { font-family: var(--font-serif); font-size: 12px; color: var(--ink-muted); font-style: italic; }
.bl-running b { color: var(--copper); font-style: normal; }
.bl-opt { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-serif); font-size: 12px; color: var(--ink); cursor: pointer; }
.bl-opt--el[hidden] { display: none; }
.bl-spend select { background: var(--bg-ink); border: 1px solid var(--rule-strong); color: var(--ink); padding: 4px 7px; border-radius: 1px; font-size: 12px; box-shadow: var(--well-inset); }
.bl-cost { color: var(--gold-leaf); font-size: 11px; }
.bl-name {
    flex: 1 1 150px; min-width: 120px; box-sizing: border-box; padding: 7px 10px;
    background: var(--bg-ink); border: 1px solid var(--rule-strong); border-radius: 1px;
    color: var(--ink); font-family: var(--font-sans); font-size: 13px;
}
.bl-name:focus { outline: none; border-color: var(--copper); box-shadow: 0 0 0 2px var(--copper-dim); }
/* The confirm CTA always owns the full bottom row of the spend bar (flex-basis
   100% forces its own line) — so toggling the favour-element option can't push
   it around, and this important button reads as the modal's anchor. */
.bl-confirm {
    flex: 1 0 100%; margin-top: 3px;
    /* Walnut-wood textured CTA (#203 rework) — see the shared .btn-wood rule
       below; this only adds the spend-bar layout. */
    padding: 12px 18px; border-radius: 2px; cursor: pointer;
    font-family: var(--font-serif); font-weight: 600; font-size: 15px;
    letter-spacing: 0.02em;
}
.bl-confirm:disabled { opacity: 0.5; cursor: not-allowed; animation: none; }
/* A gentle throb (glow pulse only — no scale, so a full-width bar doesn't
   jiggle) keeps the eye on the action that lands the cross. */
@media (prefers-reduced-motion: no-preference) {
    .bl-confirm:not(:disabled) { animation: bl-confirm-throb 1.9s ease-in-out infinite; }
}
@keyframes bl-confirm-throb {
    0%, 100% { box-shadow: 0 0 0 0 var(--copper-dim); }
    50% { box-shadow: 0 0 14px 2px var(--copper-dim); }
}

/* ---- responsive: stack on phones ---- */
@media (max-width: 720px) {
    .bl-cards { grid-template-columns: 1fr; }
    .bl-center { order: 3; padding-top: 4px; }
    .bl-mate-slot { order: 2; }
    .bl-diff-head { display: none; }
    .md-row, .md-row.match { grid-template-columns: 1fr auto; grid-template-areas: "locus fav" "you you" "mate mate"; gap: 4px 10px; }
    .md-locus { grid-area: locus; text-align: left; }
    .md-fav { grid-area: fav; }
    .md-side.you { grid-area: you; align-items: flex-start; text-align: left; }
    .md-side:not(.you) { grid-area: mate; }
    .md-row.match .md-fav { display: none; }
}

/* ====== Mating ceremony (Breeding Lab, #259) ==========================
   The whole arc plays inside the lab's own .stage-body as #bl-ceremony:
   crossing → verdict → forming → reveal (or error). The engraved meiosis
   plate is the hero; gold "discovery energy" traces its lines via the masked
   sweep (.plate-energy, from #257). The reveal sub-view reuses the .reveal-*
   layout below. Replaces the old #cross-reveal conservatory overlay. */
.bl-ceremony { display: flex; flex-direction: column; min-height: 0; }
.bl-ceremony[hidden] { display: none; }   /* flex display overrides bare [hidden] */

/* crossing / verdict / forming — the living plate, centred. */
.bl-cer-cross {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 18px 0 8px;
    min-height: min(60vh, 460px);
}
.cer-plate {
    position: relative;
    width: min(360px, 62vmin);
    height: min(360px, 62vmin);
}
.cer-plate-art {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    opacity: 0.88;
    pointer-events: none;
}
/* de-novo energy sparks land here (playFxSheet target).
   NO z-index here — it must NOT form a stacking context. The injected .fx-sheet
   keys its pure-black sheet out via `mix-blend-mode: screen`, which needs to
   blend against the painted dark stage behind the plate. If .cer-sparks is a
   stacking context (any z-index), Chrome's GPU compositor isolates that screen
   blend from the stage — there's no painted backdrop inside the empty
   .cer-sparks — and the sheet renders as an OPAQUE BLACK BOX (the battle FX
   dodge this by mounting straight into the dark-backed .stage-shell). The
   sparks still paint above the .plate-energy sweep because .fx-sheet itself
   carries z-index:6 (> the sweep's 5). Headless Chrome hides this — it uses a
   different compositing path — so it must be checked in real (GPU) Chrome. */
.cer-sparks { position: absolute; inset: 0; pointer-events: none; }
/* The crossing sweep: a bright continuous pass along the engraving (the active
   beat). The dim slow --loop (from #257) is the "forming" wait. Both animate
   transform only; reduced-motion rests the flow off-plate. */
@media (prefers-reduced-motion: no-preference) {
    .plate-energy--cross .plate-energy-flow {
        animation: plate-sweep var(--plate-sweep-dur, 1700ms)
            cubic-bezier(0.4, 0, 0.2, 1) infinite;
    }
}
.bl-cer-caption {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 17px;
    color: var(--ink-muted);
    min-height: 24px;
    text-align: center;
}
.bl-cer-caption.is-mut { color: var(--gold-leaf); font-style: normal; }
.bl-cer-caption.is-forming { color: var(--copper); }

/* error sub-view */
.bl-cer-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 40px 0;
    min-height: min(50vh, 380px);
    text-align: center;
}
.bl-cer-error-msg {
    font-family: var(--font-serif);
    font-size: 15px;
    color: var(--oxblood);
    max-width: 40ch;
    line-height: 1.5;
}
.bl-cer-back {
    font-family: var(--font-serif); font-weight: 600;
    font-size: 15px; letter-spacing: 0.02em;
    padding: 11px 28px; border-radius: 2px; cursor: pointer;
}
.bl-cer-cross[hidden], .bl-cer-reveal[hidden], .bl-cer-error[hidden] { display: none; }

/* ---- Walnut-wood textured CTA — the SHARED .btn-wood class for both ceremony
   modals (mating Confirm/Continue, battle Fight/Retreat/Next; #203/#204). A
   dark fine-grain walnut face (btn-wood.webp — wide even grain, crisp at button
   scale) with a legibility scrim baked under light engraved text, so the CTAs
   read as tactile actions and stand out against the leather/landscape behind
   them. Static texture (no filter → WebKit-safe); hover lifts the scrim + warms
   the rim (colour only). In arena.css (loaded last) so it wins over the generic
   .primary / .secondary backgrounds when the class is added. ---- */
.btn-wood {
    background-color: #2a1b0d;
    background-image:
        linear-gradient(rgba(18, 12, 5, 0.50), rgba(38, 24, 11, 0.34)),
        url("/static/assets/btn-wood.webp");
    background-size: cover;
    background-position: center;
    color: #f3e7cf;
    border: 1px solid #24170b;
    box-shadow:
        inset 0 1px 0 rgba(255, 232, 188, 0.14),
        inset 0 0 0 1px rgba(0, 0, 0, 0.45),
        0 4px 12px rgba(0, 0, 0, 0.45);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.btn-wood:hover:not(:disabled) {
    background-image:
        linear-gradient(rgba(18, 12, 5, 0.34), rgba(44, 28, 13, 0.20)),
        url("/static/assets/btn-wood.webp");
    border-color: var(--brass);
    color: #fff4dd;
}

/* ============================================================================
   CEREMONY POLISH — Phase 0: the shared "living plate" stage shell + sprite FX
   (issue #202). The Breeding Lab, the Arena, and the close-up result card all
   become a full-screen *bounded floating plate* — an engraved specimen plate
   floating on a deep page scrim, capped on large monitors so it never reads
   sparse. These are reusable primitives; Phases 1 & 2 move their modals into
   them. Each art asset is wired with a CSS fallback so the UI renders correctly
   BEFORE the PNGs exist (same "generate out-of-band, then it lights up" pattern
   as the rest of generate_ui_assets.py).
   ========================================================================== */

/* The stage take-over: a deeper scrim than the standard 0.6 modal backdrop so
   the whole page recedes, with padding that lets the plate float clear of the
   viewport edges (the bounded-stage look). Reuses the shared .modal-backdrop
   machinery (the `hidden` toggle + flex centring from library.css). */
.modal-backdrop--stage {
    background: rgba(8, 6, 4, 0.86);
    padding: clamp(14px, 3.2vh, 44px) clamp(14px, 3vw, 52px);
}

/* The plate itself. NOT a `.modal` (so it inherits neither the 520px cap nor
   modal-pop-in) — it caps itself and uses the ceremony entrance below. A flex
   column: a fixed cartouche head + a body that fits the viewport (the body, not
   the page, scrolls if content ever exceeds the cap). */
.stage-shell {
    /* Tunables (the engraved frame slice is re-tuned once plate-ceremony.png
       exists — same per-asset slice idea as the rarity frames in card.css). */
    --stage-frame-width: clamp(18px, 3.4vmin, 38px);
    --stage-frame-slice: 20%;   /* the gilt band of plate-ceremony.png */

    position: relative;
    width: 100%;
    height: 100%;
    /* Bounded floating plate: fill most of the window, capped on big screens. */
    max-width: min(96vw, 1180px);
    max-height: min(94vh, 880px);
    display: flex;
    flex-direction: column;
    background: var(--bg-vellum);          /* shows behind the frame's scrollwork */
    color: var(--ink);
    border-radius: 3px;
    overflow: hidden;

    /* Engraved plate frame via border-image (proven convention from the card's
       rarity frames). The always-on box-shadow draws a visible hairline plate
       as the FALLBACK so a missing/absent PNG still frames cleanly. */
    border: var(--stage-frame-width) solid transparent;
    border-image: url("/static/assets/plate-ceremony.png")
        var(--stage-frame-slice) / 1 / 0 stretch;
    box-shadow:
        inset 0 0 0 1px var(--rule-strong),
        inset 0 0 0 var(--stage-frame-width) var(--bg-vellum),
        0 22px 70px rgba(0, 0, 0, 0.64);
}

/* Ceremony entrance — an iris/settle take-over (slower + weightier than the
   modal pop). Transform/opacity/clip-path only (no filter → WebKit-safe), and
   the motion token already carries its easing (no second timing function). */
@media (prefers-reduced-motion: no-preference) {
    .modal-backdrop--stage:not([hidden]) {
        animation: stage-scrim-in var(--motion-ceremony);
    }
    .modal-backdrop--stage:not([hidden]) .stage-shell {
        animation: stage-plate-in var(--motion-ceremony) both;
    }
}
@keyframes stage-scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes stage-plate-in {
    from { opacity: 0; transform: translateY(10px) scale(0.965);
           clip-path: inset(5% 5% 5% 5% round 3px); }
    to   { opacity: 1; transform: none;
           clip-path: inset(0 0 0 0 round 3px); }
}

/* The dismiss control — a corner ✕ sitting above the frame. */
.stage-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 4;
    background: none;
    border: none;
    color: var(--ink-faint);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    transition: color var(--motion-quick);
}
.stage-close:hover { color: var(--copper); }

/* The cartouche head — a centred title band. The fern flourish sits in its own
   band as a CROWN ABOVE the title (not behind it) so it never crosses or washes
   out the title text — the earlier full-bleed-behind-text version was
   unreadable. The asset is luminance-keyed to a real transparent PNG
   (scripts/key_alpha.py) so it composites with plain alpha — NO mix-blend-mode
   (screen-keying a near-black Flux ground showed an opaque box on WebKit). The
   ?v= stamp busts the 1-day /static TTL when the keyed bytes change (this dev-
   facing surface isn't auto-stamped like the real app's CSS/JS). Static (no
   :hover), so a pseudo-element is safe. */
.stage-head {
    position: relative;
    flex: none;
    padding: 40px 44px 13px;   /* top room for the fern crown */
    text-align: center;
    border-bottom: 1px solid var(--rule);
}
.stage-head::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: min(320px, 74%);
    height: 26px;              /* a thin band; the empty top/bottom crops away */
    background: url("/static/assets/cartouche-header.png?v=2") center / 100% auto no-repeat;
    opacity: 0.78;
    pointer-events: none;
}
.stage-eyebrow {
    display: block;
    font-family: var(--font-serif);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--copper);
}
.stage-title {
    margin: 2px 0 0;
    font-family: var(--font-serif);
    font-weight: 500;
    font-size: 22px;
    color: var(--ink);
}
.stage-title em { font-style: normal; color: var(--copper); }

/* The body — fits the viewport; only this region scrolls if content exceeds the
   capped plate (overflow-x pinned for the same scrollbar-sliver reason as
   .battle-modal-content above). */
.stage-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px 24px;
}

/* Phone: the plate goes near-full-bleed (the take-over is the whole screen),
   with a slimmer frame and square corners. */
@media (max-width: 760px) {
    .modal-backdrop--stage { padding: 0; }
    .stage-shell {
        max-width: 100vw;
        max-height: 100vh;
        border-width: 8px;
        border-radius: 0;
    }
    .stage-body { padding: 14px 14px 18px; }
}

/* Shared engraved brass plaque chrome — the outcome surface both modals reuse
   (the mating spend panel; the battle verdict/reward plate). Layers the brass
   texture OVER the --brass-face gradient so a missing PNG falls back to the
   gradient cleanly. */
.stage-plaque {
    background-image: url("/static/assets/plaque-brass.png"), var(--brass-face);
    background-size: cover, cover;
    background-position: center, center;
    border: 1px solid var(--rule-strong);
    border-radius: 2px;
    box-shadow: var(--bevel-raised);
    color: var(--bg-ink);
}

/* ---- Sprite-sheet FX (the new "discovery energy" mechanism, Phase 0) -------
   A one-shot frame animation keyed out of pure black via mix-blend-mode:
   screen. Stepped by translating a horizontal frame-strip left by one frame
   per step — transform/opacity ONLY (no filter), so it composites on the GPU
   and survives WebKit (verify on real iPad Safari before trusting it). The host
   sets --fx-frames/--fx-dur/--fx-src; the .fx-sheet-strip child is injected by
   playFxSheet() in app.js.

   Geometry: the strip is (frames x 100%) wide inside the square .fx-sheet
   viewport, and the sheet image is stretched to fill it (background-size:
   100% 100%), so each frame is exactly one viewport-width. translateX(-100%)
   is -100% of the strip's OWN width = the full strip; with steps(frames) the
   last held position lands on the final frame, and `forwards` keeps it. */
.fx-sheet {
    position: absolute;
    inset: 0;
    margin: auto;
    width: var(--fx-size, 100%);
    height: var(--fx-size, 100%);
    pointer-events: none;
    overflow: hidden;
    mix-blend-mode: screen;
    z-index: 6;
}
.fx-sheet-strip {
    height: 100%;
    width: calc(var(--fx-frames, 1) * 100%);
    background: var(--fx-src) left center / 100% 100% no-repeat;
    transform: translateX(0);
    will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
    .fx-sheet-strip {
        animation: fx-sheet-step var(--fx-dur, 700ms)
            steps(var(--fx-frames, 1)) forwards;
    }
}
@keyframes fx-sheet-step { to { transform: translateX(-100%); } }

/* ------------------------------------------------------------
   Masked energy sweep (#257) — gold-leaf "discovery energy" that travels along
   an engraved plate's OWN lines, delivering the #205 "living plate" metaphor.

   Mechanism: the keyed engraving PNG doubles as a STATIC CSS mask on
   .plate-energy (set inline per-plate via --plate-mask, so one rule serves any
   engraving); inside it a wide gold-gradient child (.plate-energy-flow) slides
   via transform. Because the mask only reveals where the engraving's alpha is,
   the travelling highlight shows ONLY on the engraved contours — the light
   crawls the lines. The engraving is shown as its own static <img> beneath;
   this layer just adds the moving glint.

   WebKit-safe (dock recipe, layout.css): real child on its own compositing
   layer (translateZ(0)), animates transform/opacity ONLY — no filter, no easing
   appended to a motion token. Under reduced-motion the flow rests off-plate
   (translateX(0)) so only the static engraving shows — no sweep. */
.plate-energy {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    -webkit-mask-image: var(--plate-mask);
    mask-image: var(--plate-mask);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    transform: translateZ(0);
    z-index: 5;
}
.plate-energy-flow {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    width: 250%;
    /* A single diagonal bright band at the child's centre; at rest (translateX
       0) it sits off the right of the plate, so nothing shows until it sweeps. */
    background: linear-gradient(
        105deg,
        transparent 42%,
        var(--gold-leaf-glow) 47%,
        rgba(244, 232, 190, 0.95) 50%,
        var(--gold-leaf-glow) 53%,
        transparent 58%);
    transform: translateX(0);
    will-change: transform;
}
@media (prefers-reduced-motion: no-preference) {
    /* Bright single pass — the crossing beat. */
    .plate-energy--pass .plate-energy-flow {
        animation: plate-sweep var(--plate-sweep-dur, 1500ms)
            cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
    /* Slow dim loop — the "form is being decided" wait. */
    .plate-energy--loop .plate-energy-flow {
        opacity: 0.5;
        animation: plate-sweep var(--plate-sweep-dur, 3200ms) linear infinite;
    }
}
/* Sweeps the bright band fully across the plate, left → right (see the geometry
   note above: child is 250% wide, band at its 50%, so -60% carries the band
   from just off the right edge to just off the left). */
@keyframes plate-sweep {
    from { transform: translateX(0); }
    to   { transform: translateX(-60%); }
}

/* ============================================================
   Engraved "glory" ray-burst — the drawn-gold ceremony PAYOFF (#266+).
   Replaces the soft particle motes/sparks (which read as modern game VFX in an
   engraved ink world) in both the mating verdict and the battle victory. Two
   rotated copies of the alpha-keyed engraved burst (fx-rayburst) bloom outward
   with an overshoot ease and fade, a thin engraved shockwave ring races out,
   and (mating only) the masked energy-sweep does a bright fast double-pass
   "flare" underneath. Composited with plain ALPHA (NOT mix-blend: screen), so
   the .cer-sparks black-box lesson does not apply — a stacking context here is
   harmless. Injected by playRayBurst() in app.js; self-gates on reduced-motion.
   ============================================================ */
.fx-rays-wrap { position: absolute; inset: 0; margin: auto; pointer-events: none;
    z-index: 7; }
.fx-rays {
    position: absolute; inset: 0; margin: auto;
    width: var(--rays-size, 340px); height: var(--rays-size, 340px);
    background: var(--rays-src) center / contain no-repeat;
    /* Hollow the hot convergence at the centre so the payoff reads as DRAWN
       radiating lines, not a glowing core — the rays fade in from ~8% radius.
       Also clears the middle so the cell / verdict plate stays legible. */
    -webkit-mask-image: radial-gradient(circle, transparent 0%, transparent 8%, #000 28%);
    mask-image: radial-gradient(circle, transparent 0%, transparent 8%, #000 28%);
    opacity: 0; transform: scale(0.5);
    will-change: transform, opacity;
}
.fx-rays-ring {
    position: absolute; inset: 0; margin: auto;
    width: calc(var(--rays-size, 340px) * 0.34);
    height: calc(var(--rays-size, 340px) * 0.34);
    border-radius: 50%;
    border: 1px solid var(--gold-leaf-glow, rgba(233, 199, 122, 0.6));
    opacity: 0; transform: scale(0.4);
    will-change: transform, opacity;
}
@media (prefers-reduced-motion: no-preference) {
    /* Bright inner burst: fast bloom + slight counter-rotate, quick fade. */
    .fx-rays--a { animation: rayburst-a var(--rays-dur, 1500ms)
        cubic-bezier(0.16, 1, 0.3, 1) forwards; }
    /* Wider ghost burst: rotated so its rays interleave the inner set (reads as
       twice the rays), dimmer, travels farther. */
    .fx-rays--b { animation: rayburst-b var(--rays-dur, 1500ms)
        cubic-bezier(0.16, 1, 0.3, 1) forwards; }
    .fx-rays-ring { animation: rayburst-ring var(--rays-dur, 1500ms)
        cubic-bezier(0.16, 1, 0.3, 1) forwards; }
    /* Verdict sweep-flare: two slow bright passes of the masked engraving. */
    .plate-energy--flare .plate-energy-flow {
        animation: plate-sweep 820ms cubic-bezier(0.4, 0, 0.2, 1) 2;
    }
}
@keyframes rayburst-a {
    0%   { opacity: 0;    transform: scale(0.4) rotate(-9deg); }
    26%  { opacity: 0.9;  transform: scale(1.0) rotate(-3deg); }
    100% { opacity: 0;    transform: scale(1.7) rotate(3deg); }
}
@keyframes rayburst-b {
    0%   { opacity: 0;    transform: scale(0.55) rotate(20deg); }
    32%  { opacity: 0.42; transform: scale(1.18) rotate(27deg); }
    100% { opacity: 0;    transform: scale(2.05) rotate(36deg); }
}
@keyframes rayburst-ring {
    0%   { opacity: 0;    transform: scale(0.3); }
    18%  { opacity: 0.5; }
    100% { opacity: 0;    transform: scale(1.9); }
}

/* ============================================================
   Ceremony reveal layout (#203 → #259)
   The reveal sub-view of #bl-ceremony: the hero specimen card (the live
   #card-mount, relocated in by JS and returned on close) beside a recap column
   — new discoveries + de-novo mutations, then the field notes. These .reveal-*
   classes are reused verbatim inside the breeding-lab stage now that the arc is
   one continuous surface (they no longer live in a standalone .reveal-stage
   modal). The lab stage-shell already caps at 96vh, so the body scrolls (slim
   bar) only on a short viewport.
   ============================================================ */
.reveal-stage-body {
    display: flex;
    flex-direction: row;
    align-items: safe center;   /* centre when it fits; fall back to top-align
                                   (no clipped card) when a short viewport scrolls */
    justify-content: center;
    gap: 28px;
    min-height: 0;
    /* The lab's own .stage-body is the scroll region now (the arc is one
       surface); this inner layout just flows, so no nested scrollbar. */
    overflow: visible;
}
.reveal-hero {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}
.reveal-hero > .card-mount { width: min(500px, 46vw); }
/* Recap column — discoveries/mutations, then field notes. Sizes naturally; the
   whole body scrolls (above) if the viewport can't fit hero + recap. */
.reveal-aside {
    flex: 0 1 400px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.reveal-block {
    background: rgba(0, 0, 0, 0.14);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 14px 16px;
}
.reveal-block-h {
    margin: 0 0 9px;
    font-family: var(--font-serif);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--copper);
}
/* Discoveries/mutations recap — a short list of chips/lines. */
.reveal-disc:empty { display: none; }
.reveal-disc ul { margin: 0; padding: 0; list-style: none; }
.reveal-disc li {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 0;
    font-family: var(--font-serif);
    font-size: 14px;
    color: var(--ink);
}
.reveal-disc li .rd-mark { color: var(--gold-leaf); flex: none; }
.reveal-disc li.is-quiet { color: var(--ink-muted); }
.reveal-notes-body {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-muted);
}
.reveal-notes-body.is-drafting { opacity: 0.7; }
@media (prefers-reduced-motion: no-preference) {
    .reveal-notes-body.is-drafting { animation: reveal-draft-pulse 1.6s ease-in-out infinite; }
}
@keyframes reveal-draft-pulse { 0%, 100% { opacity: 0.45; } 50% { opacity: 0.8; } }

/* Footer — opt-out checkbox (unchecked by default) + the dismiss CTA. */
.reveal-stage-foot {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px 16px;
    border-top: 1px solid var(--rule);
}
.reveal-dismiss {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-serif);
    font-size: 13px;
    color: var(--ink-muted);
    cursor: pointer;
}
.reveal-dismiss input { width: 15px; height: 15px; accent-color: var(--copper); cursor: pointer; }
/* Brass dismiss button — JS forwards it to the corner ✕ so it shares the single
   close path. Colour/border transitions only (no filter), per the WebKit recipe. */
.reveal-stage-cta {
    flex: none;
    padding: 9px 22px;
    font-family: var(--font-serif);
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--ink);
    background:
        linear-gradient(var(--bg-vellum), var(--bg-vellum)) padding-box,
        linear-gradient(var(--brass), var(--copper)) border-box;
    border: 2px solid transparent;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px var(--brass), 0 6px 16px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: color var(--motion-quick), border-color var(--motion-quick);
}
.reveal-stage-cta:hover { color: var(--copper); }

/* Phone: stack the hero above the recap; the whole body scrolls (slim bar). */
@media (max-width: 760px) {
    .reveal-stage-body { flex-direction: column; align-items: center; overflow-y: auto; }
    .reveal-hero > .card-mount { width: min(420px, 92vw); }
    .reveal-aside { max-width: 100%; width: min(420px, 92vw); overflow: visible; max-height: none; }
    .reveal-stage-foot { flex-direction: column-reverse; align-items: stretch; gap: 10px; }
}

/* ============================================================================
   CEREMONY POLISH — Phase 2: the battle / arena "living plate" chrome (#204).
   Both PvP modals (#battle-modal 1v1, #match-modal stable-vs-stable) now ride
   in the shared .stage-shell (full-screen plate frame + cartouche header from
   Phase 0). These rules add the Phase-2 art on top: the VS cartouche emblem,
   engraved HP chrome, victory/defeat verdict plates, and the brass reward
   plaque. Every asset is wired with a CSS fallback (a tinted box / the existing
   gradient / a hairline box-shadow) so the modals render correctly BEFORE the
   PNGs exist — same "generate out-of-band, then it lights up" pattern as
   Phase 0. WebKit-safe: texture layers sit on REAL children, animate nothing
   but opacity/border-color/transform, no filter anywhere.
   ========================================================================== */

/* The landscape band reads as a full scene behind the ceremony — it bleeds to
   the plate's inner edges rather than sitting as a boxed strip in the body. */
.battle-stage .stage-body > .battle-vs {
    margin: -20px -24px 18px;
    border-radius: 0;
}
.match-stage .match-bout-vs {
    margin-left: -24px;
    margin-right: -24px;
    border-radius: 0;
}
/* Keep the ceremony copy centred now that the body is no longer text-align
   centred (the old fixed-width .battle-modal-content was). */
.match-stage .match-subtitle,
.match-stage .match-bout-title { text-align: center; }

/* The VS cartouche emblem — the gold "VS"-in-a-laurel engraving (a
   luminance-keyed transparent PNG) on a REAL child filling the mark. The
   cartouche IS the VS; the literal "vs" text was removed from the markup (#258),
   so no font-size:0 hack is needed. Plain alpha, NOT mix-blend:screen (screen
   made the engraving faint). This is the single .battle-vs-mark rule — the old
   italic-text definition was folded in here. #204/#258. */
.battle-vs-mark {
    position: relative;
    z-index: 1;
    align-self: center;
    flex: 0 0 auto;
    width: 86px;
    height: 86px;
}
.battle-vs-tex {
    position: absolute;
    inset: 0;
    background: url("/static/assets/vs-cartouche.png") center / contain no-repeat;
    pointer-events: none;
}

/* HP chrome lives on the base .battle-hp-track rule now (a CSS engraved-brass
   channel). hp-chrome.png — a wide ornate rail — could not read squashed into a
   thin HP strip, so it's dropped in favour of the CSS treatment. #204. */

/* Verdict plate — the win/loss outcome becomes a framed engraved plate
   (plate-victory / plate-defeat as a border-image around the word on a dark
   panel; the black centre + filler vanish against the panel). The inset
   box-shadow hairline is the FALLBACK frame when the PNG is absent. The base
   .battle-verdict colour + the verdict-pop/shake animation are unchanged. */
.battle-verdict {
    width: fit-content;
    max-width: 100%;
    margin: 8px auto;
    padding: 10px 30px;
    border: 12px solid transparent;
    border-radius: 4px;
    /* Sit above the victory ray-burst (.fx-rays-wrap z-index:7) so the "Victory"
       plate stays legible — the rays halo BEHIND it, not over it. */
    position: relative;
    z-index: 8;
}
.battle-verdict.is-win {
    background-color: rgba(8, 6, 4, 0.66);
    border-image: url("/static/assets/plate-victory.png") 30% / 12px / 0 stretch;
    box-shadow: inset 0 0 0 1px var(--gold-leaf-glow), 0 6px 20px rgba(0, 0, 0, 0.5);
}
.battle-verdict.is-loss {
    background-color: rgba(8, 6, 4, 0.6);
    border-image: url("/static/assets/plate-defeat.png") 30% / 12px / 0 stretch;
    box-shadow: inset 0 0 0 1px var(--rule-strong), 0 6px 20px rgba(0, 0, 0, 0.5);
}

/* Reward + rating-delta sit on the shared brass plaque (.stage-plaque supplies
   the brass texture + dark ink; these add the plate's padding/centring). The
   up/down rating tint is restored to legible tones over brass. */
.battle-reward.stage-plaque,
/* The rating chip rides the .stage-plaque class (set in JS each result) but is
   re-keyed here to the oxblood leather face — matching the reward panel so the
   arena's chips share one material language (#204). */
.match-rating-delta.stage-plaque {
    width: fit-content;
    max-width: 100%;
    margin: 6px auto 8px;
    padding: 7px 18px;
    background-color: #3a1414;
    background-image:
        linear-gradient(rgba(26, 8, 8, 0.32), rgba(48, 16, 16, 0.18)),
        url("/static/assets/leather.png");
    background-size: cover; background-position: center;
    border: 1px solid #200a0a;
}
.match-rating-delta.stage-plaque.is-up { color: var(--gold-leaf); }
.match-rating-delta.stage-plaque.is-down { color: var(--oxblood); }

/* ---- Shared ceremony language ported from the mating modal (#204 / #205).
   (.btn-wood is defined once with the mating CTAs above; the battle Fight/Next/
   Find buttons just add the class.) ---- */

/* Let the arena modals use the viewport like the reveal modal does — raise the
   880px base cap so the duel fills a roomy screen (the base .stage-body already
   scrolls on short viewports). (#204 port of the #203 sizing fix.) */
.stage-shell.battle-stage,
.stage-shell.match-stage { max-height: 96vh; }

/* Retreat/Fight/Close/Next are a PINNED FOOTER — a direct flex child of the
   .stage-shell AFTER the scrolling .stage-body (see the markup note), so they
   stay anchored to the foot of the plate. Previously they lived inside the
   scroll body after .battle-verdict/.battle-reward and lurched downward (~130 px)
   the moment those un-hid; now the verdict/reward grow in the scroll region
   above while the action bar holds still. flex:none = fixed band; a top rule +
   faint scrim separate it from the body. */
.battle-stage > .modal-actions,
.match-stage > .modal-actions {
    flex: none;
    justify-content: center;
    gap: 12px;
    margin-top: 0;
    padding: 14px 24px 16px;
    border-top: 1px solid var(--rule);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.22));
}
@media (max-width: 760px) {
    .battle-stage > .modal-actions,
    .match-stage > .modal-actions { padding: 12px 14px 14px; }
}

/* Secondary actions inside the ceremony stages (Retreat / Close) — a dark ghost
   button. The global .secondary is a LIGHT surface that clashes with the dark
   arena + the walnut primary; this re-keys it dark so it reads as subordinate to
   the walnut CTA without breaking the dark aesthetic. Scoped to stage modals. */
.modal-backdrop--stage .modal-actions .secondary {
    background: rgba(0, 0, 0, 0.32);
    color: var(--ink);
    border: 1px solid var(--rule-strong);
    text-shadow: none;
}
.modal-backdrop--stage .modal-actions .secondary:hover:not(:disabled) {
    border-color: var(--copper);
    color: var(--copper);
    background: rgba(0, 0, 0, 0.44);
}
/* button.secondary carries display:inline-block (components.css) which
   out-specifies the UA [hidden] rule — so Retreat/Close (both .secondary)
   would NOT disappear when the JS sets .hidden (close lingers all through a
   duel; retreat lingers after it resolves). Restore [hidden] for the stage
   action bars, same patch as .tutorial-actions button[hidden]. */
.modal-backdrop--stage .modal-actions button[hidden] { display: none; }
