/*
 * The battle simulator.
 *
 * Colours come from Bulma's own scheme variables rather than from literals, so the page follows the
 * site's light/dark switch without a second palette to keep in step. The only two literals are the
 * gate's amber and the "wired" green, which are states rather than surfaces.
 */

/* Nothing on this page may widen the document. Wide content (the results table) scrolls inside its own
   container instead; see .bsim-table-scroll. */
.bsim {
    overflow-x: clip;
}

.bsim-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.bsim-balance {
    margin-bottom: 1rem;
}

.bsim-balance .select,
.bsim-balance select {
    max-width: 100%;
}

/* Who computed the number. Always visible, never inside a result panel — a reader who has scrolled
   past the banner should still be able to find out what answered. */
.bsim-engine {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .3rem .7rem;
    border-radius: 999px;
    border: 1px solid var(--bulma-border);
    font-size: .8rem;
    white-space: nowrap;
}

.bsim-engine__dot {
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: #d9a441;
}

.bsim-engine.is-wired .bsim-engine__dot {
    background: #4caf7d;
}

.bsim-notice {
    border-left: 3px solid #d9a441;
    background: var(--bulma-scheme-main-bis);
    padding: .9rem 1rem;
}

/* A notice is drawn only where the port cannot answer a visitor (no engine, or a game reference waiting for
   approval), and it is a sentence or two: it has no fold. */

/*
 * The page's "there is more here" controls are one control: a chevron and a name, quiet until pointed
 * at — the stand-in box's, the run box's "Sweep and rank" and "What the pickers offer" under a build.
 * None of them is a link (nothing navigates), so none is underlined or link-coloured; the chevron turns
 * when it is open.
 */
.bsim-standins.is-foldable .bsim-standin-reveal,
.bsim-more > summary {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .15rem 0;
    border: 0;
    background: none;
    color: var(--bulma-text-weak);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
}

.bsim-standins.is-foldable .bsim-standin-reveal::before,
.bsim-more > summary::before {
    content: '';
    width: .38rem;
    height: .38rem;
    margin-left: .1rem;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
}

.bsim-standin-reveal[aria-expanded="true"]::before,
.bsim-more[open] > summary::before {
    transform: translateY(-.1rem) rotate(45deg);
}

.bsim-standin-reveal:hover,
.bsim-standin-reveal[aria-expanded="true"],
.bsim-more > summary:hover,
.bsim-more[open] > summary {
    color: var(--bulma-text-strong);
}

.bsim-standin-reveal:focus-visible,
.bsim-more > summary:focus-visible {
    outline: 2px solid var(--bulma-link-text, #3273dc);
    outline-offset: 2px;
    border-radius: 3px;
}

.bsim-box {
    padding: 1.1rem 1.15rem;
}

.bsim-box__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.bsim-box__head .title {
    margin-bottom: .5rem;
}

/*
 * THE SWAP, between the two chairs. The chairs are one builder twice, so the only thing on the page that is
 * about both is that the two builds can change places.
 *
 * It is a flex item of no width between the two columns, so it takes nothing from either, and the button
 * hangs in the gap the columns leave — sticky, a little above the middle of the window, because a chair is
 * taller than a screen and the swap should not have to be scrolled back to. Where the chairs stack (under
 * 769 px) it is a row of its own between them, pulled into the gap so it adds no height, and the arrows turn
 * to point up and down.
 */
.bsim-swap {
    position: relative;
    z-index: 5;
    flex: none;
    width: 0;
    padding: 0;
}

.bsim-swap__b {
    position: sticky;
    top: 42vh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin: 9rem 0 2rem;
    padding: 0;
    border: 1px solid var(--bulma-border);
    border-radius: 50%;
    background: var(--bulma-scheme-main);
    color: var(--bulma-text-weak);
    font-size: .8rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
    transform: translateX(-50%);
    cursor: pointer;
    transition: color .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.bsim-swap__b:hover,
.bsim-swap__b:focus-visible {
    outline: none;
    border-color: var(--bulma-link-text, #3273dc);
    color: var(--bulma-text-strong);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bulma-link-text, #3273dc) 30%, transparent), 0 2px 8px rgba(0, 0, 0, .25);
}

@media (prefers-reduced-motion: no-preference) {
    .bsim-swap__b i {
        transition: transform .25s ease;
    }

    .bsim-swap__b:active i {
        transform: rotate(180deg);
    }
}

.bsim-load {
    display: flex;
    gap: .4rem;
}

.bsim-hint {
    font-size: .82rem;
    color: var(--bulma-text-weak);
    margin: .25rem 0 .8rem;
}

/* ── the assembler ───────────────────────────────────────────────────────────────────────────── */

/* The folded chair, by name: one row an axie — place, name, class, rune, charms — over the count line. The
   rows are what a reader who has just loaded a team is looking for; the count is what the fold promises. */
.bsim-roster {
    list-style: none;
    margin: 0 0 .4rem;
    padding: 0;
    display: grid;
    gap: .3rem;
}

.bsim-roster__axie {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem .5rem;
    color: var(--bulma-text);
    font-size: .84rem;
}

.bsim-roster__name {
    font-weight: 600;
}

.bsim-roster__rune {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.bsim-roster__charms {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
}

.bsim-roster__charm-name {
    font-size: .76rem;
    color: var(--bulma-text-weak);
}

/* Whether this build can be run, and how far the simulator has confirmed it, before it is run. The edge is
   the answer's colour: neutral until there is one, green for every piece confirmed, blue for close matches,
   amber for unconfirmed pieces (it still runs), red for a build that cannot be run. */
.bsim-readiness {
    font-size: .82rem;
    padding: .4rem .6rem;
    border-radius: 4px;
    border-left: 3px solid var(--bulma-border);
    background: var(--bulma-scheme-main-bis);
    margin-bottom: .7rem;
}

/* The gear repair sits under the line that says the build cannot be run, because it is that line's own
   answer. Ghost, not primary: it edits the reader's build, and a control that does that is offered rather
   than urged. */
.bsim-gear-strip {
    margin: -.35rem 0 .7rem;
}

.bsim-readiness.is-green {
    border-left-color: #4caf7d;
}

.bsim-readiness.is-admitted {
    border-left-color: #4a8fd0;
}

.bsim-readiness.is-warn {
    border-left-color: #d9a441;
}

.bsim-readiness.is-stopped {
    border-left-color: #d9534f;
}

/* ── running ─────────────────────────────────────────────────────────────────────────────────── */

.bsim-actions {
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    margin-top: .8rem;
}

.bsim-progress {
    margin-top: .7rem;
}

.bsim-status {
    font-size: .8rem;
    color: var(--bulma-text-weak);
    min-height: 1.1rem;
    margin-top: .4rem;
}

.bsim-standin-list {
    font-size: .82rem;
    display: grid;
    gap: .3rem;
}

/*
 * The stand-in box's fold, and unlike the banner's it is not a phone-only rule.
 *
 * The banner is 317 px at 1440 above a 1,596 px assembler and is left whole there; this box is 1,245 px at
 * 1440 and 1,797 px at 390 once a rate is in — the tallest single element on the page — and it stands
 * ABOVE the gate and the results in the document at every width, so the pixels it costs are pixels between
 * a reader and the number the method belongs to. Measured on the shipped rendering of a twelve-row answer:
 * the page is 4,311 → 3,510 px at 1440 and 8,805 → 7,472 px at 390 with the sentences folded away.
 *
 * What folds is the SENTENCE and never the row: every departure is still named (twelve heads, 445 px at
 * 1440 and 464 px at 390), because each row is a separate claim rather than one paragraph with a lead. The
 * readings this was chosen over are in `foldStandIns`'s own comment with their numbers.
 *
 * `is-foldable` is the script's, exactly as the banner's is: with no script every sentence renders.
 */
.bsim-standin-reveal {
    display: none;
}

.bsim-standins.is-foldable .bsim-standin__what {
    display: none;
}

.bsim-standins.is-foldable.is-open .bsim-standin__what {
    display: inline;
}

/* The control is the page's one disclosure (see `.bsim-standin-reveal`); only its place is its own. */
.bsim-standins.is-foldable .bsim-standin-reveal {
    margin-top: .7rem;
}

/*
 * Closed, the twelve names are a STRIP and not a column — the same twelve names, four lines shorter.
 *
 * Cycle 20 chose "heads only, one per line" over four rivals and every one of them was a fold that dropped
 * or cut a claim (a six-line clamp left ONE of twelve at 390; the gate's first-K left four; a two-line clamp
 * cut every sentence mid-word). It never priced the two readings that keep all twelve names and only change
 * how they are laid out, and both are smaller than the column. Measured on one rendered page at this base
 * (cycle 24, a green build assembled from the readable set, each reading applied inline and undone before
 * the next — every "undone" cell reproduces the shipped one to the pixel):
 *
 *      the closed box       1440     430     390     360      names   sentences   clipped
 *      shipped column       446 px   466     466     486        12        0          0
 *      two columns          299      319     319     339        12        0          0
 *      three columns        250      270     290     309        12        0          0
 *      a flowed strip       199      241     241     282        12        0          0
 *
 * and the page with it: 1,511 → 1,263 px at 1440, 1,899 → 1,674 at 430, 1,993 → 1,767 at 390, 2,032 → 1,829
 * at 360 — 248 px at 1440 (16.4%) and 226 at 390 (11.3%), more than the rank field (124 / 142) and the gear
 * note (0 / 111) that cycle 23 took off this page together. The strip is the smallest reading that still
 * NAMES ALL TWELVE, which is the rule the column was chosen under and the rule this keeps.
 *
 * It is scoped to `:not(.is-open)` for the reason the fold itself is scoped to `.is-foldable`: opening the
 * box must give back the shipped rows, and it does — the open box measures 1,273 px at 1440 and 1,824 at 390
 * with the strip loaded, which is the shipped open box to the pixel. The separator is a `::after` on the row
 * rather than text, so a reader's screen reader still meets twelve list items and never a middot.
 */
.bsim-standins.is-foldable:not(.is-open) .bsim-standin-list {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

/* Each name is a tag — its own outline is what separates it from the next, so the strip needs no middot
   between two names, in the text or out of it. Flat and unlit: a tag is a name, not a control. */
.bsim-standins.is-foldable:not(.is-open) .bsim-standin-list li {
    padding: .1rem .55rem;
    border: 1px solid var(--bulma-border-weak);
    border-radius: 6px;
    background: var(--bulma-scheme-main-bis);
    font-size: .78rem;
    line-height: 1.5;
}

.bsim-standins.is-foldable:not(.is-open) .bsim-standin-list li strong {
    font-weight: 600;
    color: var(--bulma-text);
}

/* Open, each departure is a row of its own between hairlines, at a line length a sentence reads at. */
.bsim-standins.is-open .bsim-standin-list {
    gap: 0;
}

.bsim-standins.is-open .bsim-standin-list li {
    padding: .5rem 0;
    border-top: 1px solid var(--bulma-border-weak);
    line-height: 1.5;
}

.bsim-standins.is-open .bsim-standin-list li:last-child {
    border-bottom: 1px solid var(--bulma-border-weak);
}

.bsim-standins.is-open .bsim-standin-list li {
    max-width: 100ch;
}

/* ── the gate ────────────────────────────────────────────────────────────────────────────────── */

/* What a result rests on, inside the results box: one sentence with its tone on the edge, and the pieces
   behind it one click away. `data-tone` is the script's: warn — a rate over pieces the engine could not
   confirm; stop — nothing ran; note — close matches only, or notes about the build. */
.bsim-gate {
    margin: 0 0 .9rem;
    padding: .55rem .75rem;
    border-radius: 6px;
    border-left: 3px solid var(--bulma-border);
    background: var(--bulma-scheme-main-bis);
}

.bsim-gate[data-tone="warn"] {
    border-left-color: #d9a441;
    background: rgba(217, 164, 65, .09);
}

.bsim-gate[data-tone="stop"] {
    border-left-color: #d9534f;
    background: rgba(217, 83, 79, .08);
}

.bsim-gate__top {
    display: flex;
    align-items: baseline;
    gap: .55rem;
    flex-wrap: wrap;
}

.bsim-gate__icon {
    display: none;
    font-size: .85rem;
}

.bsim-gate[data-tone="warn"] .bsim-gate__icon {
    display: inline-block;
    color: #d9a441;
}

.bsim-gate[data-tone="stop"] .bsim-gate__icon {
    display: inline-block;
    color: #d9534f;
}

.bsim-gate__lead {
    flex: 1 1 16rem;
    margin: 0;
    font-size: .88rem;
}

.bsim-gate__toggle {
    flex: none;
}

.bsim-gate__body {
    margin-top: .6rem;
    padding-top: .55rem;
    border-top: 1px solid var(--bulma-border-weak);
}

.bsim-gate-list {
    display: grid;
    gap: .35rem;
}

.bsim-gate-item {
    display: grid;
    grid-template-columns: 4.5rem minmax(7rem, 14rem) 3.4rem 1fr;
    gap: .6rem;
    align-items: baseline;
    font-size: .84rem;
    padding: .25rem 0;
    border-bottom: 1px solid var(--bulma-border-weak);
}

/* Which chair carries it. The engine's gate merges both builds on purpose — a rate is just as wrong when
   the unread text is the opponent's — but only one of them is the reader's to change. */
.bsim-gate__chair {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bulma-text-weak);
}

/* One heading per reason, carrying what every row under it costs a rate. Full-width, because it is a
   sentence about a group and not a fifth column of a row. */
.bsim-gate-head {
    display: grid;
    grid-template-columns: minmax(9rem, 12rem) 1fr;
    gap: .6rem;
    align-items: baseline;
    margin-top: .6rem;
    padding-top: .4rem;
    border-top: 1px solid var(--bulma-border);
}

.bsim-gate-head:first-child {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
}

.bsim-gate-head__label {
    font-weight: 600;
    font-size: .82rem;
}

.bsim-gate-head__why {
    font-size: .78rem;
    color: var(--bulma-text-weak);
}

.bsim-gate-more {
    margin-top: .5rem;
}

/* The admitted group's own control sits inside the list, under its heading, so the rows it opens are read
   as that group's and not as the panel's. It is not a two-column heading — it is one control — and it must
   not inherit the grid that would strand it in the left column at 9rem. */
.bsim-gate-head--control {
    display: block;
    margin-top: .35rem;
    padding-top: 0;
    border-top: 0;
}

.bsim-gate-head--control .bsim-gate-more {
    margin-top: 0;
}

.bsim-gate__kind {
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .1rem .35rem;
    border-radius: 3px;
    background: var(--bulma-scheme-main-ter);
    color: var(--bulma-text-weak);
    justify-self: start;
}

.bsim-gate__name {
    font-weight: 600;
}

/* The card's own sentence, opened by a tap.

   The row's `title` is unreachable on touch (0 of 41 sampled frames) and the site's shared data-tooltip
   bubble is unreachable on touch once a matchup has run (0 of 41 at 390, against 41 of 41 before one and
   41 of 41 at 1440), so this is the only route to it on a phone. It spans the whole row rather than sitting
   in a column because it is a sentence, and it costs nothing until it is opened: the same ten-row panel is
   2,001 px at 390 with the reveal closed and 2,001 px without it, against 2,343 px with every sentence
   printed inline. */
.bsim-gate__reveal {
    margin-left: .35rem;
    padding: 0 .3rem;
    border: 1px solid var(--bulma-border);
    border-radius: 3px;
    background: none;
    font: inherit;
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bulma-text-weak);
    cursor: pointer;
}

.bsim-gate__reveal:hover,
.bsim-gate__reveal[aria-expanded="true"] {
    color: var(--bulma-text-strong);
    border-color: var(--bulma-text-weak);
}

.bsim-gate__text {
    grid-column: 1 / -1;
    font-size: .78rem;
    color: var(--bulma-text-weak);
    padding-top: .15rem;
}

.bsim-gate__why {
    color: var(--bulma-text-weak);
}

/* ── the results ─────────────────────────────────────────────────────────────────────────────── */

/* The answer is scrolled to after a press (`revealResults`); the fixed header must not sit on its heading. */
.bsim-results {
    scroll-margin-top: 4.5rem;
}

.bsim-table-scroll {
    overflow-x: auto;
}

/* One matchup is the answer card; its one table row is that card over again, so the table is put away.
   The row stays in the DOM — one rendering path for a verdict, two shapes to read it in. */
.bsim-results.is-single .bsim-table-scroll {
    display: none;
}

/*
 * One matchup's answer: the rate large on the left, what it is over in the middle, the two first-mover
 * seats on the right. Three columns where there is room and a stack where there is not — a container
 * query, because the box is as wide as the page's column, not the viewport.
 */
.bsim-results {
    container-type: inline-size;
}

.bsim-answer {
    display: grid;
    grid-template-columns: minmax(11rem, auto) minmax(0, 1fr) auto;
    gap: 1.1rem 1.75rem;
    align-items: center;
    margin: .2rem 0 .95rem;
}

.bsim-answer__main {
    display: grid;
    gap: .15rem;
    justify-items: start;
}

.bsim-answer__rate {
    font-size: 2.9rem;
    line-height: 1;
    font-weight: 700;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    color: var(--bulma-text-strong);
}

.bsim-answer__rate.is-none {
    font-size: 1.7rem;
    color: var(--bulma-text-weak);
}

.bsim-answer__label {
    font-size: .8rem;
    color: var(--bulma-text-weak);
}

.bsim-answer__main .bsim-conf {
    margin-top: .45rem;
}

.bsim-answer__detail {
    min-width: 0;
}

.bsim-answer__bar {
    height: .7rem;
    border-radius: 4px;
}

.bsim-answer__scale {
    display: flex;
    justify-content: space-between;
    margin: .2rem 0 .45rem;
    font-size: .66rem;
    color: var(--bulma-text-weak);
    font-variant-numeric: tabular-nums;
}

.bsim-answer__ci,
.bsim-answer__n,
.bsim-answer__real {
    margin: 0;
    font-size: .82rem;
    color: var(--bulma-text-weak);
    font-variant-numeric: tabular-nums;
}

.bsim-answer__ci strong {
    color: var(--bulma-text-strong);
}

.bsim-answer__n,
.bsim-answer__real {
    margin-top: .2rem;
}

.bsim-answer__real {
    cursor: help;
}

.bsim-answer__seats {
    display: grid;
    grid-template-columns: repeat(2, minmax(7.5rem, 1fr));
    gap: .6rem;
}

.bsim-seat {
    display: grid;
    gap: .1rem;
    padding: .55rem .75rem;
    border: 1px solid var(--bulma-border-weak);
    border-radius: 6px;
    background: var(--bulma-scheme-main-bis);
}

.bsim-seat__k {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--bulma-text-weak);
}

.bsim-seat__v {
    font-size: 1.25rem;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    color: var(--bulma-text-strong);
}

.bsim-seat__v.is-none {
    color: var(--bulma-text-weak);
}

.bsim-seat__n {
    font-size: .7rem;
    color: var(--bulma-text-weak);
    font-variant-numeric: tabular-nums;
}

@container (max-width: 46rem) {
    .bsim-answer {
        grid-template-columns: minmax(0, 1fr);
    }

    .bsim-answer__main {
        grid-template-columns: auto 1fr;
        align-items: baseline;
        column-gap: .6rem;
    }

    .bsim-answer__main .bsim-conf {
        grid-column: 1 / -1;
    }
}

.bsim-table {
    font-size: .84rem;
}

.bsim-table th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--bulma-text-weak);
    font-weight: 600;
}

.bsim-col-rank {
    width: 3.5rem;
    font-variant-numeric: tabular-nums;
}

/* A result with no ladder in it has no rank to print.

   `showResults` puts this class on the box when the server's own answer is `rankMode: "assembled"`, which is
   the only mode where both chairs are builds assembled here: the rank cell is an em dash on every row of
   such an answer, under a heading naming a thing the answer has none of. Measured after a real assembled run
   at this base — the column is 45 px of a 507 px table inside a 337 px wrapper at 390, so this takes the
   table to 461 px and the scroll a phone reader has to drag from 170 px to 124 px, with Gate, the rate and
   both seats each starting 46 px earlier; at 1440 it is 56 px of a 1,307 px table in a 1,307 px wrapper and
   the Opponent column absorbs every pixel of it (1,307 px either way).

   The cell is emitted either way, as with the bar and the census below — the client keeps no second copy of
   what a row carries — and this is keyed on the ANSWER rather than on a width, which is what makes it a
   different question from the standing refusal in the phone rule: rank is hidden here because this answer
   has none, not because the screen is small, and a sweep's thousand rows keep it at every width. */
.bsim-results.is-no-rank .bsim-col-rank {
    display: none;
}

.bsim-col-rate,
.bsim-col-order {
    width: 7rem;
    white-space: nowrap;
}

.bsim-col-bar {
    width: 12rem;
}

.bsim-col-gate {
    width: 8rem;
}

.bsim-col-census {
    width: 6.5rem;
    white-space: nowrap;
}

.bsim-rate {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* The interval, printed as its two bounds. It was `.bsim-pm` and a "± half the width" until cycle 18, which
   is a symmetric restatement of an asymmetric interval and left the scale on 485 of 664 measured rate cells
   — see `rateCell` in battleSim.js for that measurement.

   `block`, and the line is what makes the honest reading cheaper than the wrong one. Two bounds are eleven
   characters where "±3.3%" is five, and inline they took the rate cell from 112 to 146 px: measured on the
   rendered row, the table went 512 → 618 px and at 360 and 375 the `Win rate` column stopped being wholly
   visible (4 of 8 → 3). On its own line the cell is bounded by the widest of three short strings instead of
   the sum of two, so the table is 507 px — five px NARROWER than the ± it replaces — with the same four
   columns visible at every phone width, and the row does not grow at all there (68 px either way; it
   already wraps). The whole cost is 18 px of row height at 1440, where the row is 45 → 63 px and the page
   4,252 → 4,270. */
.bsim-ci {
    display: block;
    color: var(--bulma-text-weak);
    font-size: .78rem;
}

/* Never a rate without what it was measured over: n is the battles that named a winner, not the battles
   that were run, and 91 of 160 is not 160. */
.bsim-n {
    display: block;
    font-size: .68rem;
    color: var(--bulma-text-weak);
}

/* The second number: what real games the engine rated like this one actually came to. Its own line under the
   denominator, quieter than the rate and louder than nothing — it is a reading OF the rate above it, not a
   rival to it, and a reader who never looks at it must still be able to read the cell. `is-apart` is the
   half of the curve whose interval does not take in the base rate; where it is absent the engine's own
   sentence says the corpus cannot tell that band from an average game, and the colour says it too. */
.bsim-calib {
    display: block;
    font-size: .68rem;
    color: var(--bulma-text-weak);
    font-variant-numeric: tabular-nums;
    cursor: help;
    opacity: .75;
}

.bsim-calib.is-apart {
    opacity: 1;
    color: #d9a441;
}

/* And where the rows agree, the reading is said once above the table instead of once a row (cycle 29).
   The cells stay in the DOM — the same rule the refusals fold follows — and the summary above the table is
   what a reader reads: 344 of 347 rows of a whole-ladder sweep carry the identical sentence, and printing it
   344 times costs 5,660 px of table at 1440 and 117 px of the table's own horizontal drag at 390. */
.bsim-results.is-bands-folded #bsim-rows .bsim-calib {
    display: none;
}

/* The summary draws the reading with the cell's own node, so the selector above is scoped to the table:
   the band's own `.bsim-calib` sits inside this line and stays visible, inline rather than on its own. */
.bsim-bands .bsim-calib {
    display: inline;
    font-size: inherit;
}

/* A standing fact about rates, not a finding about this run: quiet, so the amber stays the warning's. */
.bsim-decided.bsim-bands {
    color: var(--bulma-text-weak);
}

.bsim-census {
    font-variant-numeric: tabular-nums;
    cursor: help;
}

/* Games were lost to draws, the turn cap or a throw. The rate rests on fewer battles than were run. */
.bsim-census.is-lossy {
    color: #d9a441;
}

/* The denominator, when the denominator is the finding: the line above the table that says how many of this
   run's battles named a winner at all. Same amber as a lossy census cell, because it is the same fact one
   size up — not a warning colour, since nothing here is wrong; the run is simply mostly draws. */
.bsim-decided {
    margin: 0 0 .6rem;
    font-size: .84rem;
    color: #d9a441;
    font-variant-numeric: tabular-nums;
}

/* The sweep's fold: one control above the table, and one class on the results box that hides the rows
   that could not be run. `display: none` and not the `hidden` attribute, because `.table` restores
   `display: table-row` on a <tr> and the attribute's UA rule loses to it. The rows stay in the DOM and in
   every count the page makes — the fold is a reading of the table, never an edit of it. */
.bsim-refusals {
    margin: 0 0 .6rem;
}

.bsim-results.is-refusals-folded .bsim-row--refused {
    display: none;
}

/* "not run" is not 0%. It has no bar and no number, only these two words. */
.bsim-notrun {
    color: var(--bulma-text-weak);
    font-style: italic;
}

.bsim-barcell {
    min-width: 10rem;
}

.bsim-bar {
    position: relative;
    height: .55rem;
    border-radius: 3px;
    background: var(--bulma-scheme-main-ter);
}

/* The interval is the bar; the point estimate is only a tick on it. */
.bsim-bar__span {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 3px;
    background: rgba(76, 175, 125, .45);
}

.bsim-bar__tick {
    position: absolute;
    top: -2px;
    bottom: -2px;
    width: 2px;
    background: var(--bulma-text);
}

/* How far the pieces behind a rate are confirmed — the answer card's mark and the table's Pieces column.
   One reading, four tones: every piece confirmed, close matches, unconfirmed pieces (the warning), not run. */
.bsim-conf {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .76rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}

.bsim-conf::before {
    content: '';
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: currentColor;
}

.bsim-conf.is-ok {
    color: #4caf7d;
}

.bsim-conf.is-close {
    color: #4a8fd0;
}

.bsim-conf.is-warn {
    color: #d9a441;
}

.bsim-conf.is-stop {
    color: var(--bulma-text-weak);
    font-weight: 400;
    font-style: italic;
}

.bsim-conf.is-stop::before {
    display: none;
}

/* ── the team picker ─────────────────────────────────────────────────────────────────────────── */

.bsim-load-status {
    min-height: 1rem;
    margin: .15rem 0 0;
    font-size: .78rem;
    color: var(--bulma-text-weak);
}

.bsim-load-status.is-error {
    color: #d9534f;
}

/* ── the run: two lanes ──────────────────────────────────────────────────────────────────────── */

/*
 * One box under both chairs, two questions — rate it, or play it. Nothing in it builds a team, which is why
 * it is under the teams.
 *
 * The two are LANES of one surface, split by one hairline, not two bordered cards inside a card. Both have
 * the same anatomy, four children in one order: a name and one line, a sheet of rows (the question on the
 * left, its answers on the right), the lane's one action, and what that action reported.
 *
 * The lanes are SUBGRIDS of one four-row grid, which is what keeps the two actions on one row. A lane that
 * pushed its own action to its own bottom kept that baseline only while both reports were one line: a
 * sweep's progress bar or a status that wraps grew one lane's foot and lifted its buttons 23 px above the
 * other lane's. With the rows shared, a report grows its ROW and both actions stay where they are.
 *
 * The box drops its own padding: the lanes carry it, and the strip under them runs edge to edge.
 */
.bsim-run {
    margin-top: 1.25rem;
    padding: 0;
    overflow: hidden;
}

.bsim-run__lanes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr auto auto;
}

.bsim-group {
    display: grid;
    grid-row: span 4;
    grid-template-rows: subgrid;
    align-content: start;
    min-width: 0;
    padding: 1.1rem 1.15rem .85rem;
}

/* The second lane keeps a wider gutter on the hairline's side, so its questions do not start on the line. */
.bsim-group + .bsim-group {
    border-left: 1px solid var(--bulma-border-weak);
    padding-left: 1.4rem;
}

.bsim-group:first-child {
    padding-right: 1.4rem;
}

.bsim-group__head {
    margin-bottom: 1rem;
}

/* A lane's name is a box's name: the size and weight "Your build" and "Opponent" are set in. */
.bsim-group__title {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--bulma-text-strong);
}

.bsim-group__sub {
    margin-top: .15rem;
    font-size: .82rem;
    color: var(--bulma-text-weak);
}

.bsim-group > .bsim-sheet {
    align-self: start;
}

.bsim-group > .bsim-actions {
    margin-top: 1.15rem;
    align-items: center;
    gap: .5rem;
}

/* The lane's action is the largest control in it, and a step under Bulma's default so it does not outweigh
   the lane's own name. */
.bsim-group > .bsim-actions .button {
    font-size: .9rem;
}

/* What the action reported: a sweep's progress, then the line. One line of room is always held, so the
   first message does not move the strip under the lanes. */
.bsim-report {
    min-height: 1.6rem;
}

.bsim-report .bsim-progress {
    height: .375rem;
    margin: .7rem 0 0;
}

.bsim-report .bsim-progress::-webkit-progress-value {
    background-color: var(--bulma-link-text, #3273dc);
}

.bsim-report .bsim-progress::-moz-progress-bar {
    background-color: var(--bulma-link-text, #3273dc);
}

.bsim-report .bsim-status {
    margin-top: .45rem;
    max-width: 68ch;
}

/* A report of more than one sentence: one to a line. */
.bsim-status__line {
    display: block;
}

.bsim-status__line + .bsim-status__line {
    margin-top: .15rem;
}

/* The refusal's own repair, under the line that names what it takes off. Ghost, like the gear strip under
   "Your build": it edits the reader's builds, so it is offered rather than urged. */
.bsim-repair {
    margin: .2rem 0 0 -.55rem;
}

/* The sheet: one question a row, its name in a column of its own so the answers line up down the lane.
   The SHEET is the size container its rows ask about, never the lane: containment makes a box an
   independent formatting context, and a lane that is one stops being a subgrid — measured, the two actions
   came apart by 84 px the moment the lane carried `container-type`. */
.bsim-sheet {
    container-type: inline-size;
    display: grid;
    gap: .55rem;
}

.bsim-row {
    display: grid;
    grid-template-columns: 6.25rem minmax(0, 1fr);
    align-items: center;
    gap: .3rem .9rem;
}

.bsim-row__k {
    font-size: .8rem;
    line-height: 1.25;
    color: var(--bulma-text-weak);
}

label.bsim-row__k[data-tooltip] {
    cursor: help;
}

.bsim-row__v {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
    min-width: 0;
}

.bsim-row__v .input[type="number"] {
    width: 4.8rem;
    font-variant-numeric: tabular-nums;
}

/* What the run will play: a sentence in the answers' column, weak while a chair is not ready. */
.bsim-matchup {
    margin: 0;
    font-size: .84rem;
    line-height: 1.9rem;
}

.bsim-matchup.is-waiting {
    color: var(--bulma-text-weak);
}

.bsim-row__help {
    flex-basis: 100%;
    max-width: 62ch;
    font-size: .76rem;
    line-height: 1.4;
    color: var(--bulma-text-weak);
}

/* A question the chosen mode does not ask: still in its place, plainly not asked. */
.bsim-row.is-off {
    opacity: .38;
}

.bsim-row.is-off .bsim-seg__b {
    cursor: default;
}

/* And it shows no answer as chosen: the mode did not ask. */
.bsim-row.is-off .bsim-seg__b[aria-checked="true"] {
    background: none;
    box-shadow: none;
    color: var(--bulma-text-weak);
}

/* A lane too narrow for the two columns puts the question over its answers. */
@container (max-width: 25rem) {
    .bsim-row {
        grid-template-columns: minmax(0, 1fr);
        margin-bottom: .25rem;
    }

    .bsim-more .bsim-row__k {
        padding-top: 0;
    }
}

/*
 * The segments: a select of two or three answers, drawn as its answers (`segmented` in battleSim.js), and
 * the battle count's presets. The lit segment is the part editor's stage switch's own tint, so "this one is
 * chosen" reads the same everywhere on the page. As tall as the small input beside it.
 */
.bsim-seg {
    display: flex;
    flex: 1 1 auto;
    gap: 2px;
    min-width: 0;
    padding: 2px;
    border: 1px solid var(--bulma-border);
    border-radius: 7px;
    background: var(--bulma-scheme-main-bis);
}

.bsim-seg__b {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    min-height: 1.6rem;
    text-align: center;
    text-wrap: balance;
    padding: .15rem .55rem;
    border: 0;
    border-radius: 5px;
    background: none;
    color: var(--bulma-text-weak);
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.bsim-seg__b:hover:not(:disabled) {
    color: var(--bulma-text-strong);
}

.bsim-seg__b[aria-checked="true"],
.bsim-seg__b[aria-pressed="true"] {
    background: color-mix(in srgb, var(--bulma-link-text, #3273dc) 28%, var(--bulma-scheme-main));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bulma-link-text, #3273dc) 55%, transparent);
    color: var(--bulma-text-strong);
}

.bsim-seg__b:focus-visible {
    outline: 2px solid var(--bulma-link-text, #3273dc);
    outline-offset: 1px;
}

/* The ladder-only questions, one quiet line until they are wanted — the page's one disclosure (see
   `.bsim-standin-reveal`), on a <summary> whose own marker is taken off. */
.bsim-more > summary {
    list-style: none;
}

.bsim-more > summary::-webkit-details-marker {
    display: none;
}

/* The same line under a build, over the note about what the gear pickers offer and leave out. */
.bsim-gear-about {
    margin-top: .2rem;
}

.bsim-gear-about > .bsim-hint {
    margin: .1rem 0 0;
    max-width: 80ch;
}

.bsim-more[open] > summary {
    margin-bottom: .45rem;
}

/* Bulma sizes every box by `* { box-sizing: inherit }` from the root, and a <details>' content sits in a
   slot (`::details-content`) that `*` does not match — so inside one the chain breaks and an input is its
   height PLUS its padding: 42 px beside the 30 px one above it, measured. Restated where the chain breaks. */
.bsim-more > * {
    box-sizing: border-box;
}

.bsim-more .bsim-row {
    align-items: start;
}

.bsim-more .bsim-row + .bsim-row {
    margin-top: .7rem;
}

.bsim-more .bsim-row__k {
    padding-top: .4rem;
}

/* What is about the BUILD rather than about running it: one strip along the bottom of the box. */
.bsim-utility {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .2rem 1.25rem;
    padding: .55rem 1.15rem;
    border-top: 1px solid var(--bulma-border-weak);
    background: var(--bulma-scheme-main-bis);
    font-size: .8rem;
    color: var(--bulma-text-weak);
}

.bsim-utility__note {
    margin-left: auto;
}

.bsim-textbtn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .2rem 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: .8rem;
    color: var(--bulma-text-weak);
    cursor: pointer;
}

.bsim-textbtn i {
    font-size: .7rem;
}

.bsim-textbtn:hover {
    color: var(--bulma-text-strong);
}

.bsim-textbtn:focus-visible {
    outline: 2px solid var(--bulma-link-text, #3273dc);
    outline-offset: 2px;
    border-radius: 3px;
}

@media (max-width: 768px) {
    /* The engine's name is a sentence, not a word, and on a phone a nowrap pill pushes the whole document
       sideways. Measured at 390px: the page scrolled horizontally until this rule existed. */
    .bsim-engine {
        white-space: normal;
        max-width: 100%;
    }

    .bsim-gate-item,
    .bsim-gate-head {
        grid-template-columns: 1fr;
        gap: .15rem;
    }

    /* On a phone the two pickers stack under the part's name rather than beside each other: a select
       narrow enough to sit two-across at 390px is a select whose option text is unreadable. */
    
    

    

    

    /* The interval bar is the one column that carries no number of its own, so it is the one that goes when
       there is not room for eight.

       Measured in headless Chromium at 390 on a green matchup when this rule landed (cycle 12): the results
       table was 743 px inside a 337 px wrapper — 406 px of horizontal scroll — and three of the eight
       columns were wholly visible (rank, opponent, the headline rate, which ended at x=238). The next 160 px
       were this bar, so the two columns a reader most needs after the headline — the first-mover seats —
       started at x=398 and x=498, off screen. Dropping the bar put MOVING FIRST at x=238 and MOVING SECOND
       at x=338.

       RE-DERIVED at the cycle-18 composed tree rather than carried forward, on a live green matchup (18.2%
       over 33 of 100), because the cell beside it changed in cycle 18 and the numbers here had not: shipped,
       the table is 507 px in the 337 px wrapper with 170 px of scroll and four of eight columns wholly
       visible; with this rule removed by DOM surgery on the same rendered row it is 667 px with 330 px of
       scroll — 185 -> 345 at 375, 200 -> 360 at 360 — and reveals no extra column. So the bar is 160 px of
       scroll saved on every phone width and 0 px of the table that ships. Not at 1440, where it is 192 px of
       a 1,307 px table inside a 1,307 px wrapper with 8 of 8 columns visible and no scroll to save.

       It costs the least of any column that could go: the bar draws rate.low .. rate.high with a tick at
       rate.rate, and the cell beside it prints those same two bounds in words since cycle 18 (`.bsim-ci`,
       which is what makes this rule safe — it was "the rate and the interval's half-width as ±" when this
       comment was written, and the ± was itself wrong), so nothing here is the only place a number appears.
       Its own tooltip is a `title`, which shows nothing on touch at all (measured: 0 of 41 sampled frames on
       a tap), so on the widths this rule fires at the bar's own reading was unreachable anyway. The rank and
       opponent columns were the rival — they are 128 px together and carry no rate either — but a sweep is a
       thousand rows and they are what tells one row from another. The cell is emitted either way; this hides
       it, so nothing in the client has to know about the breakpoint.

       The seats it buys back are not interchangeable: over the 360 whole matchups of this page's own
       population at this base (DrawCensusTest, 400 x 40) the two orders differ by a mean of 21.0 points,
       signed -16.5 against the chair that moves first. */
    .bsim-col-bar,
    .bsim-barcell {
        display: none;
    }

    /* And `Decided` goes too, because the rate cell now prints the same count on every row.

       It was refused in cycle 11 on two numbers: it duplicates the "n of requested" the headline already
       prints (Wilson.pooled's n IS census.decisive) but it was believed to be the only denominator on the
       rows that quote no rate — 32 of 400 readable matchups at this base, 24 one-seat and 8 deciding
       nothing. That belief is measured false: the line above the table carries the count on every one of
       them, by construction, and both shapes were read live ("9 of 100 battles named a winner — 91 drew …
       All of them were decided in one seat", and "No battle named a winner — 20 drew"). The rate cell
       carries it on the row as well since this cycle, at a measured cost of 0 px.

       Measured in headless Chromium at 390 on a live one-seat matchup: the table goes 577 px to 507 px and
       the horizontal scroll 240 px to 170 px; on a matchup that decided nothing, 571 to 507 and 234 to 170.
       Four columns are wholly visible either way — this reveals none, and that is what cycle 11 refused it
       for. What it buys is where the scroll ENDS: `Moving second` is the last column now, so a reader who
       drags the table sideways for the seats stops there instead of at a column repeating the rate cell's
       own second line.

       Not at 1440, and that is the reason for the breakpoint rather than a deletion: there the table is
       1,307 px inside a 1,307 px wrapper with no scroll to save, so hiding this column buys nothing and
       costs the labelled heading and the census tooltip a pointer reader can actually open — 8 of 8 columns
       wholly visible becomes 7 of 8. The cell is emitted either way, as with the bar. */
    .bsim-col-census {
        display: none;
    }

    .bsim-play {
        grid-template-columns: 1fr;
    }

    /* The chairs stack, and the swap is a row between them that adds no height. */
    .bsim-swap {
        display: flex;
        justify-content: center;
        width: auto;
        height: 0;
    }

    .bsim-swap__b {
        position: relative;
        top: auto;
        margin: -1.15rem 0 0;
        transform: none;
    }

    .bsim-swap__b i {
        transform: rotate(90deg);
    }

    .bsim-swap__b:active i {
        transform: rotate(270deg);
    }

    /* One lane over the other, each in plain flow — there is no second lane beside it to share rows
       with — and the hairline between them turns with them. */
    .bsim-run__lanes,
    .bsim-group {
        display: block;
    }

    .bsim-group,
    .bsim-group:first-child,
    .bsim-group + .bsim-group {
        padding: 1rem 1.15rem .7rem;
    }

    .bsim-group + .bsim-group {
        border-left: 0;
        border-top: 1px solid var(--bulma-border-weak);
    }

    .bsim-utility__note {
        flex-basis: 100%;
        margin-left: 0;
    }
}
