/* Build Creator styling.
 *
 * Everything is scoped under #adoh-build, because this markup is rendered twice: once as the
 * standalone page and once by the WordPress shortcode INSIDE the site theme. An unscoped rule here
 * would leak into the theme, and a theme rule that beats a scoped one is a visible bug rather than
 * a silent one.
 *
 * The palette is defined once on the block itself rather than on :root, for the same reason.
 */

#adoh-build {
    /* light */
    --bc-bg: #f4f1ea;
    --bc-panel: #fffdf8;
    --bc-panel-2: #efe9dd;
    --bc-ink: #221d16;
    --bc-ink-soft: #5d5346;
    --bc-line: #d9d0be;
    --bc-line-strong: #bfb39a;
    --bc-gold: #8a6a1f;
    --bc-on-gold: #fffdf8;
    --bc-gold-soft: #f0e3c2;
    --bc-good: #2e6b40;
    --bc-bad: #9d2f26;
    --bc-bad-soft: #f8e4e1;
    --bc-warn: #8a5a10;
    --bc-shadow: 0 1px 2px rgba(34, 29, 22, .08), 0 6px 20px rgba(34, 29, 22, .06);
    --bc-radius: 10px;

    color: var(--bc-ink);
    background: var(--bc-bg);
    font: 15px/1.5 "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

@media (prefers-color-scheme: dark) {
    #adoh-build:not([data-theme="light"]) {
        --bc-bg: #16161a;
        --bc-panel: #1f1f25;
        --bc-panel-2: #2a2a32;
        --bc-ink: #ece7dd;
        --bc-ink-soft: #a49c8e;
        --bc-line: #34343d;
        --bc-line-strong: #4a4a56;
        --bc-gold: #d9b45e;
        --bc-on-gold: #1d1710;
        --bc-gold-soft: #3a3020;
        --bc-good: #6cc08a;
        --bc-bad: #e98177;
        --bc-bad-soft: #3a2320;
        --bc-warn: #d8a75e;
        --bc-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
    }
}

#adoh-build[data-theme="dark"] {
    --bc-bg: #16161a;
    --bc-panel: #1f1f25;
    --bc-panel-2: #2a2a32;
    --bc-ink: #ece7dd;
    --bc-ink-soft: #a49c8e;
    --bc-line: #34343d;
    --bc-line-strong: #4a4a56;
    --bc-gold: #d9b45e;
    --bc-on-gold: #1d1710;
    --bc-gold-soft: #3a3020;
    --bc-good: #6cc08a;
    --bc-bad: #e98177;
    --bc-bad-soft: #3a2320;
    --bc-warn: #d8a75e;
    --bc-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .3);
}

#adoh-build *,
#adoh-build *::before,
#adoh-build *::after { box-sizing: inherit; }

/* THE HIDDEN GUARD - the interface does not work without this rule.
 *
 * The browser's own `[hidden] { display: none }` is specificity (0,1,0). Every rule in this file
 * is scoped `#adoh-build ...`, which is (1,1,0) or more - so any rule here that sets `display`
 * beats it, and `el.hidden = true` silently stops hiding that element.
 *
 * That is not theoretical: it shipped. `.bc-loading` (flex), `.bc-main` (grid) and `.bc-modal`
 * (flex) all set display, so the first browser to open the tool showed the loading panel, the
 * fully-rendered interface AND an empty export dialog stacked on top of each other, and read as
 * "stuck on Reading the module's classes..." - while everything had in fact loaded correctly.
 *
 * `!important` rather than source order, because a tie on specificity would leave this depending
 * on where in the file it sits. ui_smoke.js asserts this rule is here; do not remove it.
 */
#adoh-build [hidden] { display: none !important; }

#adoh-build h1, #adoh-build h2, #adoh-build h3 {
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
}

/* ------------------------------------------------------------------ header */

#adoh-build .bc-top {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--bc-line);
    background: var(--bc-panel);
}

#adoh-build .bc-top h1 {
    font-size: 21px;
    letter-spacing: .01em;
}

#adoh-build .bc-sub {
    margin: 2px 0 0;
    overflow-wrap: anywhere;
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

#adoh-build .bc-top-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ------------------------------------------------------------------ buttons */

#adoh-build .bc-btn {
    font: inherit;
    font-size: 14px;
    padding: 7px 14px;
    border: 1px solid var(--bc-line-strong);
    border-radius: 7px;
    background: var(--bc-panel-2);
    color: var(--bc-ink);
    cursor: pointer;
    transition: background .12s, border-color .12s;
}

#adoh-build .bc-btn:hover:not(:disabled) { border-color: var(--bc-gold); }
#adoh-build .bc-btn:disabled { opacity: .45; cursor: not-allowed; }
#adoh-build .bc-btn:focus-visible { outline: 2px solid var(--bc-gold); outline-offset: 2px; }

/* Light mode's gold is dark and dark mode's is light, so the ink that sits on it is its own
 * token rather than one value that would be unreadable in one of the two themes. */
#adoh-build .bc-btn-primary {
    background: var(--bc-gold);
    border-color: var(--bc-gold);
    color: var(--bc-on-gold);
    font-weight: 600;
}

#adoh-build .bc-btn-small { font-size: 13px; padding: 5px 10px; }
#adoh-build .bc-btn-quiet { background: transparent; color: var(--bc-ink-soft); }

/* ------------------------------------------------------------------ loading */

#adoh-build .bc-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 70px 20px;
    color: var(--bc-ink-soft);
}

#adoh-build .bc-spinner {
    width: 26px; height: 26px;
    border: 2px solid var(--bc-line);
    border-top-color: var(--bc-gold);
    border-radius: 50%;
    animation: bc-spin .8s linear infinite;
}

@keyframes bc-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    #adoh-build .bc-spinner { animation-duration: 3s; }
}

/* ------------------------------------------------------------------ layout */

#adoh-build .bc-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    grid-template-areas:
        "steps     steps"
        "character sheet"
        "abilities sheet"
        "levels    sheet";
    /* The sheet spans the last three rows, so without this its height is shared out between them
     * and the panels on the left drift apart - a tall sheet (a monk with thirty feats) opened a
     * gap of a few hundred pixels between the character panel and the abilities. Letting the
     * levels row absorb the slack keeps the two above it tight against their content. */
    grid-template-rows: auto auto auto 1fr;
    align-items: start;
    gap: 16px;
    padding: 16px 20px 40px;
    max-width: 1320px;
    margin: 0 auto;
}

#adoh-build .bc-steps    { grid-area: steps; }
#adoh-build .bc-character { grid-area: character; }
#adoh-build .bc-abilities { grid-area: abilities; }
#adoh-build .bc-levels    { grid-area: levels; }
#adoh-build .bc-sheet     { grid-area: sheet; position: sticky; top: 14px; }

@media (max-width: 960px) {
    #adoh-build .bc-main {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "steps" "character" "abilities" "levels" "sheet";
        padding-left: 16px;
        padding-right: 16px;
    }
    #adoh-build .bc-sheet { position: static; }
}

/* The creation checklist. Present only while creation is unfinished, so it is a prompt rather
 * than furniture the reader learns to ignore. */
#adoh-build .bc-steps {
    border: 1px solid var(--bc-gold);
    background: var(--bc-gold-soft);
    border-radius: var(--bc-radius);
    padding: 10px 14px;
}

#adoh-build .bc-steps-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

#adoh-build .bc-step-chip {
    font-size: 12.5px;
    padding: 2px 10px;
    border-radius: 99px;
    border: 1px solid var(--bc-line-strong);
    color: var(--bc-ink-soft);
    white-space: nowrap;
}
#adoh-build .bc-step-chip.bc-step-done { color: var(--bc-good); border-color: var(--bc-good); }
#adoh-build .bc-step-chip.bc-step-now {
    background: var(--bc-gold);
    border-color: var(--bc-gold);
    color: var(--bc-on-gold);
    font-weight: 600;
}

#adoh-build .bc-steps-todo {
    margin: 7px 0 0;
    font-size: 13px;
    color: var(--bc-ink);
}

#adoh-build .bc-tab:disabled { opacity: .4; cursor: not-allowed; }

#adoh-build .bc-panel {
    background: var(--bc-panel);
    border: 1px solid var(--bc-line);
    border-radius: var(--bc-radius);
    box-shadow: var(--bc-shadow);
    padding: 14px 16px;
}

#adoh-build .bc-panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

#adoh-build .bc-panel-head h2 {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--bc-ink-soft);
}

#adoh-build .bc-hint {
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    margin: 10px 0 0;
}

#adoh-build .bc-empty {
    color: var(--bc-ink-soft);
    font-style: italic;
    margin: 6px 0 0;
}

/* ------------------------------------------------------------------ character bar */

#adoh-build .bc-character {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

#adoh-build .bc-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
#adoh-build .bc-field-name { flex: 1 1 220px; min-width: 0; }

/* An input carries an intrinsic width from its `size`, which a flex item will not shrink past on
 * its own - so it has to be told it may. */
#adoh-build .bc-field input[type="text"],
#adoh-build .bc-field select { min-width: 0; width: 100%; }

#adoh-build .bc-field label {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--bc-ink-soft);
}

#adoh-build input[type="text"],
#adoh-build select {
    font: inherit;
    font-size: 14px;
    padding: 6px 9px;
    border: 1px solid var(--bc-line-strong);
    border-radius: 6px;
    background: var(--bc-panel-2);
    color: var(--bc-ink);
    max-width: 100%;
}

#adoh-build select { cursor: pointer; }

#adoh-build .bc-align { display: flex; gap: 6px; }

#adoh-build .bc-race-note {
    flex: 1 1 100%;
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    border-top: 1px dashed var(--bc-line);
    padding-top: 9px;
}

#adoh-build .bc-race-note strong { color: var(--bc-ink); font-weight: 600; }

/* ------------------------------------------------------------------ abilities */

#adoh-build .bc-points {
    font-size: 13px;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    color: var(--bc-ink-soft);
}
#adoh-build .bc-points.bc-over { color: var(--bc-bad); font-weight: 700; }

#adoh-build .bc-ability-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
}

@media (max-width: 620px) {
    #adoh-build .bc-ability-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 470px) {
    #adoh-build .bc-ability-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

#adoh-build .bc-ability {
    border: 1px solid var(--bc-line);
    border-radius: 8px;
    padding: 8px 6px;
    text-align: center;
    background: var(--bc-panel-2);
}

#adoh-build .bc-ability-name {
    font-size: 11px;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--bc-ink-soft);
}

#adoh-build .bc-ability-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin: 3px 0 1px;
}

#adoh-build .bc-step {
    font: inherit;
    width: 22px; height: 22px;
    line-height: 1;
    border: 1px solid var(--bc-line-strong);
    border-radius: 5px;
    background: var(--bc-panel);
    color: var(--bc-ink);
    cursor: pointer;
    padding: 0;
}
#adoh-build .bc-step:disabled { opacity: .35; cursor: default; }

#adoh-build .bc-ability-value {
    font-size: 19px;
    font-weight: 700;
    min-width: 28px;
    font-variant-numeric: tabular-nums;
}

/* A score the race moved reads differently from one the points alone bought. */
#adoh-build .bc-ability-value.bc-ability-racial { color: var(--bc-gold); }

#adoh-build .bc-ability-final {
    font-size: 12px;
    color: var(--bc-ink-soft);
    font-variant-numeric: tabular-nums;
}
#adoh-build .bc-ability-final b { color: var(--bc-gold); font-weight: 700; }

/* ------------------------------------------------------------------ levels */

#adoh-build .bc-level-actions { display: flex; gap: 6px; flex-wrap: wrap; }

#adoh-build .bc-level-list { display: flex; flex-direction: column; gap: 4px; }

#adoh-build .bc-level {
    border: 1px solid var(--bc-line);
    border-radius: 8px;
    background: var(--bc-panel-2);
    overflow: hidden;
}

#adoh-build .bc-level.bc-open { border-color: var(--bc-gold); }
#adoh-build .bc-level.bc-has-problem { border-left: 3px solid var(--bc-bad); }

#adoh-build .bc-level-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    width: 100%;
    padding: 7px 10px;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

#adoh-build .bc-level-head:hover { background: var(--bc-gold-soft); }

#adoh-build .bc-lv {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--bc-ink-soft);
    min-width: 26px;
    font-variant-numeric: tabular-nums;
}

/* The class and its level is the one thing a reader scans this list for, so it never gives up
 * space to the summary beside it - it was being squeezed to "Bar..." while a row of granted
 * proficiencies took the width. The cap is there so a long name on a phone still cannot push the
 * rest of the row off screen. */
#adoh-build .bc-level-class {
    flex: 0 0 auto;
    max-width: 45%;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#adoh-build .bc-level-gains {
    flex: 1 1 0;
    min-width: 0;
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#adoh-build .bc-level-flag {
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 99px;
    white-space: nowrap;
}
#adoh-build .bc-flag-todo { background: var(--bc-gold-soft); color: var(--bc-warn); }
#adoh-build .bc-flag-bad  { background: var(--bc-bad-soft); color: var(--bc-bad); }

#adoh-build .bc-level-body {
    padding: 4px 10px 12px;
    border-top: 1px dashed var(--bc-line);
}

/* the ability increase a level grants ------------------------------------- */

#adoh-build .bc-ability-pick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 10px 0 4px;
    padding: 8px 10px;
    border: 1px solid var(--bc-gold);
    background: var(--bc-gold-soft);
    border-radius: 8px;
}

#adoh-build .bc-ability-pick-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--bc-ink-soft);
    margin-right: 4px;
}

#adoh-build .bc-ability-pick-hint {
    font-size: 12px;
    color: var(--bc-warn);
    margin-left: auto;
}

#adoh-build .bc-ability-opt {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    font: inherit;
    font-size: 13px;
    padding: 3px 10px;
    border: 1px solid var(--bc-line-strong);
    border-radius: 99px;
    background: var(--bc-panel);
    color: var(--bc-ink);
    cursor: pointer;
}
#adoh-build .bc-ability-opt:hover { border-color: var(--bc-gold); }
#adoh-build .bc-ability-opt-on {
    background: var(--bc-gold);
    border-color: var(--bc-gold);
    color: var(--bc-on-gold);
    font-weight: 600;
}
#adoh-build .bc-ability-opt-name { letter-spacing: .04em; }
#adoh-build .bc-ability-opt-to {
    font-size: 11.5px;
    opacity: .75;
    font-variant-numeric: tabular-nums;
}

/* Skill points left over are not a debt - they carry - so they read quieter than what is owed. */
#adoh-build .bc-flag-spare {
    background: transparent;
    border: 1px solid var(--bc-line);
    color: var(--bc-ink-soft);
}

/* the alignment shift a level may carry ------------------------------------
 *
 * Styled like the ability picker above it, because it is the same kind of thing: a decision the
 * level offers that is neither a feat nor a skill. It turns gold only when a shift is actually
 * set, so a reader scrolling levels can see which ones cost tokens.
 */

#adoh-build .bc-shift {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 10px 0 4px;
    padding: 8px 10px;
    border: 1px dashed var(--bc-line-strong);
    border-radius: 8px;
}

#adoh-build .bc-shift-on {
    border-style: solid;
    border-color: var(--bc-gold);
    background: var(--bc-gold-soft);
}

#adoh-build .bc-shift-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--bc-ink-soft);
    margin-right: 4px;
}

#adoh-build .bc-align-axis {
    font: inherit;
    font-size: 13px;
    padding: 3px 6px;
    color: var(--bc-ink);
    background: var(--bc-panel);
    border: 1px solid var(--bc-line-strong);
    border-radius: 6px;
}

#adoh-build .bc-shift-hint,
#adoh-build .bc-shift-cost {
    font-size: 12px;
    color: var(--bc-ink-soft);
    margin-left: auto;
}

#adoh-build .bc-shift-cost { color: var(--bc-warn); }

#adoh-build .bc-shift-clear {
    font: inherit;
    font-size: 12px;
    padding: 2px 8px;
    color: var(--bc-ink-soft);
    background: transparent;
    border: 1px solid var(--bc-line-strong);
    border-radius: 99px;
    cursor: pointer;
}

#adoh-build .bc-shift-clear:hover { color: var(--bc-ink); border-color: var(--bc-ink-soft); }

#adoh-build .bc-flag-shift { background: var(--bc-gold-soft); color: var(--bc-warn); }

/* What a shift would have to reach for this class, under the reason it is shut. */
#adoh-build .bc-choice-shift {
    flex: 1 1 100%;
    font-size: 11.5px;
    color: var(--bc-warn);
    text-align: right;
}

#adoh-build .bc-align-note {
    flex: 1 1 100%;
    font-size: 12px;
    color: var(--bc-warn);
}

/* why a tab is shut, said in the body and not only in a tooltip ------------- */

#adoh-build .bc-order-note {
    margin: 10px 0 4px;
    padding: 7px 10px;
    font-size: 12.5px;
    color: var(--bc-warn);
    background: var(--bc-gold-soft);
    border-left: 3px solid var(--bc-gold);
    border-radius: 0 6px 6px 0;
}

/* The same shape for advice rather than a bar: nothing is waiting on it. */
#adoh-build .bc-order-soft {
    color: var(--bc-ink-soft);
    background: transparent;
    border-left-color: var(--bc-line-strong);
}

/* the game's own icons, out of one sprite sheet ---------------------------
 *
 * Size and offset are set inline by app.js, which is the only thing that knows how many columns
 * the sheet has. What belongs here is only how an icon sits next to the words beside it.
 */

#adoh-build .bc-icon {
    display: inline-block;
    flex: none;
    vertical-align: middle;
    background-repeat: no-repeat;
    /* Nearest-neighbour: these are small hand-drawn icons and smoothing turns them to mush at
       the sizes they are shown here. */
    image-rendering: pixelated;
    border-radius: 3px;
}

/* A choice row puts the icon first, so the names still line up in a column. */
#adoh-build .bc-choice .bc-icon { margin-right: 7px; }

#adoh-build .bc-chip .bc-icon { margin-right: 5px; }

#adoh-build .bc-skill-table .bc-icon { margin-right: 6px; }
#adoh-build .bc-skill-name { vertical-align: middle; }

#adoh-build .bc-ability-name {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* A disabled row's icon is dimmed with it, or the picture reads as available while the text does
   not. */
#adoh-build .bc-choice:disabled .bc-icon { opacity: .45; }

/* On a level row the icon sits between the number and the class name. */
#adoh-build .bc-level-head .bc-icon { margin: 0 7px 0 2px; }

/* And on the sheet, before the name in the left half of the row. */
#adoh-build .bc-kv .bc-icon { margin-right: 6px; }

/* What a score started at, beside what it is now - so a gain reads as a gain. */
#adoh-build .bc-kv-gain {
    font-size: 11px;
    color: var(--bc-ink-soft);
    margin-left: 8px;
    font-variant-numeric: tabular-nums;
}

#adoh-build .bc-tabs {
    display: flex;
    gap: 4px;
    margin: 10px 0;
    flex-wrap: wrap;
}

#adoh-build .bc-tab {
    font: inherit;
    font-size: 13px;
    padding: 4px 11px;
    border: 1px solid var(--bc-line);
    border-radius: 99px;
    background: var(--bc-panel);
    color: var(--bc-ink-soft);
    cursor: pointer;
}
#adoh-build .bc-tab[aria-selected="true"] {
    background: var(--bc-gold);
    border-color: var(--bc-gold);
    color: var(--bc-on-gold);
    font-weight: 600;
}
#adoh-build .bc-tab .bc-tab-count { opacity: .75; font-size: 11.5px; }

#adoh-build .bc-tab-panel { min-height: 40px; }

/* choice lists ------------------------------------------------------------ */

#adoh-build .bc-search {
    width: 100%;
    margin-bottom: 8px;
}

#adoh-build .bc-choices {
    max-height: 340px;
    overflow-y: auto;
    border: 1px solid var(--bc-line);
    border-radius: 8px;
    background: var(--bc-panel);
}

#adoh-build .bc-choice {
    display: flex;
    align-items: baseline;
    gap: 8px;
    width: 100%;
    padding: 6px 10px;
    border: 0;
    border-bottom: 1px solid var(--bc-line);
    background: none;
    font: inherit;
    font-size: 13.5px;
    color: inherit;
    text-align: left;
    cursor: pointer;
}
#adoh-build .bc-choice:last-child { border-bottom: 0; }
#adoh-build .bc-choice:hover:not(:disabled) { background: var(--bc-gold-soft); }
#adoh-build .bc-choice:disabled { cursor: not-allowed; opacity: .78; }
#adoh-build .bc-choice.bc-taken { background: var(--bc-gold-soft); }

#adoh-build .bc-choice-name { font-weight: 600; }
#adoh-build .bc-choice-why {
    font-size: 12px;
    color: var(--bc-bad);
    margin-left: auto;
    text-align: right;
}
#adoh-build .bc-choice-tag {
    font-size: 11px;
    color: var(--bc-ink-soft);
    border: 1px solid var(--bc-line);
    border-radius: 99px;
    padding: 0 6px;
}

/* feat groups and the availability filter ---------------------------------- */

#adoh-build .bc-feat-group { margin-bottom: 10px; }

#adoh-build .bc-feat-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--bc-ink-soft);
    margin-bottom: 4px;
}

#adoh-build .bc-filter {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    margin-bottom: 8px;
    cursor: pointer;
}
#adoh-build .bc-filter input { cursor: pointer; }

/* pager -------------------------------------------------------------------- */

#adoh-build .bc-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    flex-wrap: wrap;
}

#adoh-build .bc-pager-count {
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* chips ------------------------------------------------------------------- */

#adoh-build .bc-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }

#adoh-build .bc-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12.5px;
    padding: 2px 4px 2px 9px;
    border: 1px solid var(--bc-line-strong);
    border-radius: 99px;
    background: var(--bc-panel);
}
#adoh-build .bc-chip.bc-chip-auto { border-style: dashed; color: var(--bc-ink-soft); padding-right: 9px; }

#adoh-build .bc-chip-x {
    font: inherit;
    line-height: 1;
    border: 0;
    background: none;
    color: var(--bc-ink-soft);
    cursor: pointer;
    padding: 0 4px;
    border-radius: 99px;
}
#adoh-build .bc-chip-x:hover { color: var(--bc-bad); }

#adoh-build .bc-slot-note {
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    margin-bottom: 8px;
}
#adoh-build .bc-slot-note b { color: var(--bc-gold); }

/* skills ------------------------------------------------------------------ */

/* Bounded like the choice lists. All 29 skills in one unbounded table pushed the levels below it
 * several screens down, so opening Skills on level 1 hid the rest of the build. */
#adoh-build .bc-skill-scroll {
    max-height: 340px;
    /* Both axes. Five columns of skill do not fit a phone, and a table that overflows its parent
     * widens the whole document - which is what made every panel above it scroll sideways. A table
     * inside its own scroller is the one exception to "the page never scrolls horizontally". */
    overflow: auto;
    border: 1px solid var(--bc-line);
    border-radius: 8px;
    background: var(--bc-panel);
}

#adoh-build .bc-skill-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

/* The header has to stay put, or scrolling the table loses which column is which. */
#adoh-build .bc-skill-table thead th {
    position: sticky;
    top: 0;
    background: var(--bc-panel);
    z-index: 1;
}
#adoh-build .bc-skill-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bc-ink-soft);
    font-weight: 600;
    padding: 4px 6px;
    border-bottom: 1px solid var(--bc-line);
}
#adoh-build .bc-skill-table td {
    padding: 3px 6px;
    border-bottom: 1px solid var(--bc-line);
}
#adoh-build .bc-skill-table tr.bc-cross td:first-child { color: var(--bc-ink-soft); }
#adoh-build .bc-skill-table tr.bc-unavailable { opacity: .4; }
#adoh-build .bc-skill-table .bc-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 12.5px;
}
#adoh-build .bc-rank-cell { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
#adoh-build .bc-rank-val { min-width: 20px; text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ sheet */

#adoh-build .bc-sheet h2 {
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--bc-ink-soft);
    margin-bottom: 8px;
}

#adoh-build .bc-sheet-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--bc-ink);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: 2px;
}

#adoh-build .bc-sheet-sub {
    font-size: 12.5px;
    color: var(--bc-ink-soft);
    margin-bottom: 10px;
}

#adoh-build .bc-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

#adoh-build .bc-stat {
    border: 1px solid var(--bc-line);
    border-radius: 7px;
    padding: 6px 8px;
    background: var(--bc-panel-2);
}
#adoh-build .bc-stat-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--bc-ink-soft);
}
#adoh-build .bc-stat-value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
#adoh-build .bc-stat-value small { font-size: 12px; font-weight: 400; color: var(--bc-ink-soft); }

#adoh-build .bc-sheet-section { margin-top: 12px; }
#adoh-build .bc-sheet-section > h3 {
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--bc-ink-soft);
    margin-bottom: 5px;
    border-bottom: 1px solid var(--bc-line);
    padding-bottom: 3px;
}

#adoh-build .bc-kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; padding: 1px 0; }
#adoh-build .bc-kv span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
#adoh-build .bc-kv-soft span:last-child { font-weight: 400; color: var(--bc-ink-soft); }

#adoh-build .bc-problems { margin-top: 12px; }
#adoh-build .bc-problem {
    font-size: 12.5px;
    padding: 5px 8px;
    border-left: 3px solid var(--bc-bad);
    background: var(--bc-bad-soft);
    border-radius: 0 5px 5px 0;
    margin-bottom: 4px;
}
#adoh-build .bc-problem b { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
#adoh-build .bc-all-clear {
    font-size: 13px;
    color: var(--bc-good);
    padding: 6px 8px;
    border-left: 3px solid var(--bc-good);
    border-radius: 0 5px 5px 0;
}

/* One block per casting class: a heading, then its slots indented under it. */

#adoh-build .bc-cast {
    margin: 0 0 10px;
    padding-left: 9px;
    border-left: 2px solid var(--bc-line);
}

#adoh-build .bc-cast:last-child { margin-bottom: 2px; }

#adoh-build .bc-cast-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

#adoh-build .bc-cast-name { font-weight: 600; }

#adoh-build .bc-cast-cl {
    font-size: 11.5px;
    color: var(--bc-ink-soft);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

#adoh-build .bc-slots-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

#adoh-build .bc-slots-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--bc-ink-soft);
    padding-bottom: 1px;
    white-space: nowrap;
}

/* The level and its slot count share one column, so they cannot drift apart. */
#adoh-build .bc-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

#adoh-build .bc-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 26px;
    padding: 1px 3px;
    border-radius: 5px;
    background: var(--bc-panel-2);
}

#adoh-build .bc-slot-level {
    font-size: 9.5px;
    line-height: 1.3;
    color: var(--bc-ink-soft);
}

#adoh-build .bc-slot-count {
    font-size: 12px;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

#adoh-build .bc-slot-none { color: var(--bc-ink-soft); }

/* ------------------------------------------------------------------ modal */

#adoh-build .bc-modal {
    position: fixed;
    inset: 0;
    background: rgba(12, 10, 7, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 9999;
}

#adoh-build .bc-modal-box {
    background: var(--bc-panel);
    border: 1px solid var(--bc-line-strong);
    border-radius: var(--bc-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
    width: min(760px, 100%);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}

#adoh-build .bc-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--bc-line);
}
#adoh-build .bc-modal-head h2 { font-size: 16px; }

#adoh-build .bc-close {
    font: inherit;
    font-size: 24px;
    line-height: 1;
    border: 0;
    background: none;
    color: var(--bc-ink-soft);
    cursor: pointer;
    padding: 0 4px;
}
#adoh-build .bc-close:hover { color: var(--bc-ink); }

#adoh-build .bc-modal-body { padding: 14px 16px 18px; overflow-y: auto; }

#adoh-build .bc-export-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

#adoh-build textarea.bc-out {
    width: 100%;
    min-height: 230px;
    font: 12.5px/1.45 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    padding: 10px;
    border: 1px solid var(--bc-line-strong);
    border-radius: 7px;
    background: var(--bc-panel-2);
    color: var(--bc-ink);
    resize: vertical;
}

/* ------------------------------------------------------------------ toast */

#adoh-build .bc-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    background: var(--bc-ink);
    color: var(--bc-bg);
    padding: 9px 18px;
    border-radius: 99px;
    font-size: 13.5px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .3);
    z-index: 10000;
}

/* ------------------------------------------------------------------ print
 *
 * The PDF export is the browser's own print dialog, so the print stylesheet IS the PDF layout.
 * Everything interactive comes off the page and the level list opens out in full.
 */

@media print {
    #adoh-build {
        --bc-bg: #fff;
        --bc-panel: #fff;
        --bc-panel-2: #fff;
        --bc-ink: #000;
        --bc-ink-soft: #444;
        --bc-line: #bbb;
        --bc-line-strong: #999;
        --bc-shadow: none;
        font-size: 10.5pt;
        background: #fff;
    }
    #adoh-build .bc-top-actions,
    #adoh-build .bc-level-actions,
    #adoh-build .bc-tabs,
    #adoh-build .bc-tab-panel,
    #adoh-build .bc-modal,
    #adoh-build .bc-toast,
    #adoh-build .bc-step,
    #adoh-build .bc-chip-x,
    #adoh-build .bc-hint { display: none !important; }

    #adoh-build .bc-main {
        display: block;
        padding: 0;
        max-width: none;
    }
    #adoh-build .bc-panel {
        border: 0;
        box-shadow: none;
        padding: 0;
        margin-bottom: 14px;
        break-inside: avoid;
    }
    #adoh-build .bc-sheet { position: static; }
    #adoh-build .bc-level { break-inside: avoid; border-color: #ddd; }
    #adoh-build .bc-level-body { display: none !important; }
    #adoh-build .bc-stat-grid { grid-template-columns: repeat(4, 1fr); }
}