/* The tool pages' shared component layer: the Dungeon, Map and Battlemap Generators and the campaign page's Dungeons and
 * World Map tabs wear the site's own look (the Race, Class and Monster Generators, the buy window, the account pages).
 *
 * One mechanism, loaded after each page's own stylesheet and scoped by `body.tool-ui` (base.html `body_class`):
 *   1. tokens        the site's palette, once (gold #e7bf8f, cream #f6e6c9, panels #151f25 / #0e171c);
 *   2. the page tokens of each tool (`--dungeon-accent`, `--mg-*`) are pointed at them, so what the pages already draw
 *      with their accent is gold, not teal;
 *   3. the window   every dialog is the Monster Generator's "Create new monster": Bootstrap `.modal-content`, either in
 *                   a Bootstrap `.modal` or inside a `<dialog class="tool-dialog">` (floating panels use the same frame);
 *   4. controls     selects, text and number fields, checkboxes, radios, switches, ranges;
 *   5. buttons, tabs, segmented controls and chips, panel headings, notices, empty states and links.
 * A page's own stylesheet keeps its layout; it does not restate colours, borders or type that live here.
 */

body.tool-ui,
.tool-scope {
    --tool-gold: #e7bf8f;
    --tool-gold-soft: rgba(231, 191, 143, 0.14);
    --tool-gold-line: rgba(231, 191, 143, 0.4);
    --tool-cream: #f6e6c9;
    --tool-cream-muted: rgba(246, 230, 201, 0.72);
    --tool-ink: #152734;
    --tool-panel: #151f25;
    --tool-panel-deep: #0e171c;
    --tool-modal: rgb(9, 14, 16);
    --tool-unselected: #26333a;
    --tool-danger: #e06b6b;
    --tool-font: "Raleway", sans-serif;
    --tool-radius-field: 6px;
    --tool-radius-pill: 25px;
    --tool-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23f6e6c9' stroke-width='1' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l5 5 5-5'/%3E%3C/svg%3E");
    --tool-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='none' stroke='%23152734' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3 6-6'/%3E%3C/svg%3E");
}

/* --- 2. The pages' own tokens, pointed at the site's palette -------------------------------------------------------- */

body.tool-ui .dungeon-generator {
    --dungeon-text: var(--tool-cream);
    --dungeon-border: var(--tool-gold-line);
    --dungeon-surface: var(--tool-panel-deep);
    font-family: var(--tool-font);
}

body.tool-ui .map-generator {
    --mg-border: var(--tool-gold-line);
    font-family: var(--tool-font);
}

/* --- 3. The window ------------------------------------------------------------------------------------------------- */

body.tool-ui .modal-content,
body.tool-ui dialog.tool-dialog .modal-content {
    margin-top: 0;
    border: 1px solid var(--tool-gold) !important;
    border-radius: var(--bs-modal-border-radius, 0.5rem);
    background: var(--tool-modal);
    color: var(--tool-cream);
    font-family: var(--tool-font);
    font-size: 1rem;
}

body.tool-ui .modal-header,
body.tool-ui .modal-footer {
    border: 0;
}

body.tool-ui .modal-title {
    margin: 0;
    color: #fff;
    font-family: var(--tool-font);
    font-size: 1.125rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    line-height: 1.5;
    text-transform: uppercase;
}

/* The close cross: white, no ring or box around it. */
body.tool-ui .modal .btn-close,
body.tool-ui dialog.tool-dialog .btn-close {
    background-color: transparent;
    box-shadow: none;
    filter: invert(1) grayscale(1) brightness(1.4);
    opacity: 0.85;
}

body.tool-ui .modal .btn-close:hover,
body.tool-ui dialog.tool-dialog .btn-close:hover {
    opacity: 1;
}

body.tool-ui .modal .btn-close:focus-visible,
body.tool-ui dialog.tool-dialog .btn-close:focus-visible {
    outline: 2px solid var(--tool-gold);
    outline-offset: 2px;
}

body.tool-ui .modal-body,
body.tool-ui dialog.tool-dialog .modal-body {
    color: var(--tool-cream);
    font-size: 1rem;
}

body.tool-ui .modal-body p,
body.tool-ui dialog.tool-dialog .modal-body p {
    color: var(--tool-cream);
}

body.tool-ui .modal-body .form-text,
body.tool-ui dialog.tool-dialog .modal-body .form-text {
    color: var(--tool-cream-muted) !important;
}

body.tool-ui .modal .form-label,
body.tool-ui dialog.tool-dialog .form-label,
body.tool-ui dialog.tool-dialog .dungeon-field > span {
    margin-bottom: 0.5rem;
    color: var(--tool-cream);
    font-size: 1rem;
    text-transform: none;
}

/* A <dialog> is only the positioned shell of the window; the `.modal-content` inside it is the window. Bootstrap defines the
   window's measures on `.modal`, which a <dialog> is not: the same values here. */
body.tool-ui dialog.tool-dialog {
    --bs-modal-padding: 1rem;
    --bs-modal-header-padding: 1rem 1rem;
    --bs-modal-header-padding-x: 1rem;
    --bs-modal-header-padding-y: 1rem;
    --bs-modal-header-border-width: 0;
    --bs-modal-footer-gap: 0.5rem;
    --bs-modal-footer-border-width: 0;
    --bs-modal-title-line-height: 1.5;
    --bs-modal-border-radius: 0.5rem;
    --bs-modal-inner-border-radius: 0.5rem;
    --bs-modal-border-width: 1px;
    width: min(560px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: none;
    /* Centred in the viewport both ways, as a modal <dialog> is by default (the window keeps 16px from the edges through
       its own max-height). */
    margin: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    color: var(--tool-cream);
}

body.tool-ui dialog.tool-dialog.dungeon-dialog--wide {
    width: min(760px, calc(100vw - 24px));
}

body.tool-ui dialog.tool-dialog::backdrop {
    background: rgba(5, 10, 12, 0.72);
}

body.tool-ui dialog.tool-dialog .modal-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 32px);
    margin: 0;
}

body.tool-ui dialog.tool-dialog .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: var(--bs-modal-header-padding);
}

body.tool-ui dialog.tool-dialog .modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: var(--bs-modal-padding);
}

body.tool-ui dialog.tool-dialog .modal-body > * + * {
    margin-top: 12px;
}

body.tool-ui dialog.tool-dialog .modal-body > :last-child,
body.tool-ui dialog.tool-dialog .modal-body p {
    margin-bottom: 0;
}

body.tool-ui dialog.tool-dialog .modal-footer {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 0;
    padding: 12px 16px;
}

body.tool-ui .modal-titles {
    min-width: 0;
    flex: 1 1 auto;
}

/* The window's name goes under its title, in the body's voice, not after a colon in the title. */
body.tool-ui .tool-dialog-subtitle {
    margin: 2px 0 0;
    color: var(--tool-cream-muted);
}

/* --- 4. Controls --------------------------------------------------------------------------------------------------- */

body.tool-ui :is(select, input:not([type]), input[type="text"], input[type="search"], input[type="number"], input[type="email"],
    input[type="url"], input[type="password"], textarea):not(.dungeon-title-input, .mg-title-input) {
    border: 1px solid var(--tool-cream);
    border-radius: var(--tool-radius-field);
    background-color: var(--tool-panel);
    color: var(--tool-cream);
    font-family: var(--tool-font);
}

body.tool-ui :is(select, input[type="text"], input[type="search"], input[type="number"], textarea):focus {
    border-color: var(--tool-gold);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(231, 191, 143, 0.18);
}

body.tool-ui :is(select, input, textarea)::placeholder {
    color: var(--tool-cream-muted);
    opacity: 0.7;
}

body.tool-ui :is(select, input, textarea):disabled {
    border-color: rgba(246, 230, 201, 0.25);
    background-color: var(--tool-panel);
    color: rgba(246, 230, 201, 0.45);
    cursor: not-allowed;
}

/* Every select: dark, cream-edged, no native arrow, the site's thin chevron. */
body.tool-ui select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2rem;
    background-image: var(--tool-chevron);
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 16px 16px;
    text-overflow: ellipsis;
}

body.tool-ui select option {
    background-color: var(--tool-panel);
    color: var(--tool-cream);
}

body.tool-ui select[multiple],
body.tool-ui select[size]:not([size="1"]) {
    padding-right: 0.75rem;
    background-image: none;
}

body.tool-ui textarea {
    resize: vertical;
}

/* The corner grip a textarea draws is the browser's: the site's own are the same, kept quiet. */
body.tool-ui textarea {
    scrollbar-width: thin;
}

/* A colour chooser is a swatch in a field, not the browser's button. */
body.tool-ui input[type="color"] {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    min-height: 34px;
    padding: 3px;
    border: 1px solid var(--tool-cream);
    border-radius: var(--tool-radius-field);
    background-color: var(--tool-panel);
    cursor: pointer;
}

body.tool-ui input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

body.tool-ui input[type="color"]::-webkit-color-swatch {
    border: 0;
    border-radius: 3px;
}

body.tool-ui input[type="color"]::-moz-color-swatch {
    border: 0;
    border-radius: 3px;
}

/* Checkbox and radio: a 16px dark box with a cream edge, gold when chosen (the Monster page, the account pages). */
body.tool-ui :is(input[type="checkbox"], input[type="radio"]):not([role="switch"], .form-switch .form-check-input) {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 1rem;
    height: 1rem;
    padding: 0;
    border: 1px solid var(--tool-cream);
    border-radius: 3px;
    background-color: var(--tool-panel);
    background-position: center;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    vertical-align: middle;
    cursor: pointer;
    accent-color: var(--tool-gold);
}

body.tool-ui input[type="radio"]:not([role="switch"]) {
    border-radius: 50%;
}

body.tool-ui input[type="checkbox"]:not([role="switch"], .form-switch .form-check-input):checked {
    border-color: var(--tool-gold);
    background-color: var(--tool-gold);
    background-image: var(--tool-tick);
}

body.tool-ui input[type="radio"]:not([role="switch"]):checked {
    border-color: var(--tool-gold);
    background-color: var(--tool-gold);
    background-image: none;
    box-shadow: inset 0 0 0 3px var(--tool-panel);
}

body.tool-ui :is(input[type="checkbox"], input[type="radio"]):not([role="switch"]):focus-visible {
    outline: 2px solid var(--tool-gold);
    outline-offset: 2px;
    box-shadow: none;
}

body.tool-ui :is(input[type="checkbox"], input[type="radio"]):disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* A switch: dark and gold-edged, gold when on. */
body.tool-ui .form-switch .form-check-input,
body.tool-ui input[role="switch"] {
    width: 2em;
    height: 1.1em;
    border: 1px solid var(--tool-gold);
    border-radius: 2em;
    background-color: var(--tool-panel);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23f6e6c9'/%3E%3C/svg%3E");
    background-position: left center;
    background-repeat: no-repeat;
    background-size: contain;
}

body.tool-ui .form-switch .form-check-input:checked,
body.tool-ui input[role="switch"]:checked {
    background-color: var(--tool-gold);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23152734'/%3E%3C/svg%3E");
    background-position: right center;
}

body.tool-ui .form-switch .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(231, 191, 143, 0.3);
}

/* A range: a thin track and a gold thumb. */
body.tool-ui input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    height: 18px;
    padding: 0;
    border: 0;
    background: transparent;
    accent-color: var(--tool-gold);
}

body.tool-ui input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(246, 230, 201, 0.28);
}

body.tool-ui input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(246, 230, 201, 0.28);
}

body.tool-ui input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px;
    border: 2px solid var(--tool-panel);
    border-radius: 50%;
    background: var(--tool-gold);
}

body.tool-ui input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border: 2px solid var(--tool-panel);
    border-radius: 50%;
    background: var(--tool-gold);
}

body.tool-ui input[type="range"]:focus-visible {
    outline: 2px solid var(--tool-gold);
    outline-offset: 3px;
}

body.tool-ui input[type="range"]:disabled {
    opacity: 0.45;
}

/* --- 5. Buttons ---------------------------------------------------------------------------------------------------- */

/* The site's buttons (styles9.css .btn-buy, campaign_generator2.css .btn-close-dnd): gold pill with dark text, dark pill with a
   gold edge; 16px, regular weight, upper case, 38px high. Icon-only buttons keep their round shape and size. */
:is(body.tool-ui, .tool-scope) :is(.btn-buy, .btn-close-dnd):not(.dungeon-icon-btn):not(.btn-icon) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 38px;
    padding: 0.375rem 0.9rem;
    border-radius: var(--tool-radius-pill);
    font-family: var(--tool-font);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    text-transform: uppercase;
    white-space: normal;
}

/* In a header's row the label stays on one line; the row makes room (a narrower screen folds its buttons into a menu). */
:is(body.tool-ui, .tool-scope) :is(.dungeon-header-actions, .bm-header, .mg-header-actions, .mg-toolbar) :is(.btn-buy, .btn-close-dnd) {
    white-space: nowrap;
}

:is(body.tool-ui, .tool-scope) .btn-buy {
    border: 1px solid var(--tool-cream);
    background-color: var(--tool-gold);
    color: var(--tool-ink);
}

:is(body.tool-ui, .tool-scope) .btn-buy:is(:focus-visible, :active) {
    border-color: var(--tool-gold);
    background-color: var(--tool-ink);
    color: var(--tool-gold);
}

@media (hover: hover) {
    :is(body.tool-ui, .tool-scope) .btn-buy:hover {
        border-color: var(--tool-gold);
        background-color: var(--tool-ink);
        color: var(--tool-gold);
    }
}

:is(body.tool-ui, .tool-scope) .btn-close-dnd {
    border: 1px solid var(--tool-gold);
    background-color: var(--tool-panel);
    color: var(--tool-gold);
}

:is(body.tool-ui, .tool-scope) .btn-close-dnd:is(:focus-visible, :active) {
    background-color: var(--tool-gold);
    color: var(--tool-panel);
}

@media (hover: hover) {
    :is(body.tool-ui, .tool-scope) .btn-close-dnd:hover {
        background-color: var(--tool-gold);
        color: var(--tool-panel);
    }
}

:is(body.tool-ui, .tool-scope) :is(.btn-buy, .btn-close-dnd):disabled,
:is(body.tool-ui, .tool-scope) :is(.btn-buy, .btn-close-dnd)[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

:is(body.tool-ui, .tool-scope) .modal-footer .btn {
    margin: 0;
}

/* --- Links --------------------------------------------------------------------------------------------------------- */

:is(body.tool-ui, .tool-scope) :is(.dungeon-note, .dungeon-key, .dungeon-link, .mg-note, .modal-body) a:not(.btn) {
    color: var(--tool-gold);
    text-decoration: underline;
    text-underline-offset: 2px;
}

:is(body.tool-ui, .tool-scope) :is(.dungeon-note, .dungeon-key, .dungeon-link, .mg-note, .modal-body) a:not(.btn):hover {
    color: var(--tool-cream);
}

/* --- Tabs, segmented controls, chips and tools: the chosen one is gold ----------------------------------------------- */

/* The site's tabs (the Race page's "Your Races | Public Races"): the chosen tab is gold with dark text, the others dark grey. */
body.tool-ui :is(.dungeon-side-tab, .bm-side-tab, .mg-tab, .bm-picker-tab, .dungeon-floor-tab) {
    border-color: transparent;
    border-bottom-width: 1px;
    border-radius: 6px 6px 0 0;
    background: var(--tool-unselected);
    color: var(--tool-cream);
    font-family: var(--tool-font);
    font-weight: 400;
}

body.tool-ui :is(.dungeon-side-tab, .bm-side-tab, .mg-tab, .bm-picker-tab, .dungeon-floor-tab):hover {
    color: #fff;
}

body.tool-ui :is(.dungeon-side-tab, .bm-side-tab, .mg-tab, .bm-picker-tab, .dungeon-floor-tab)[aria-selected="true"] {
    border-color: var(--tool-gold);
    background: var(--tool-gold);
    color: var(--tool-ink);
}

/* Segmented controls, chips, toggles and tools: gold when on. */
body.tool-ui :is(
    .bm-segment[aria-checked="true"],
    .bm-condition-level[aria-pressed="true"],
    .bm-kind[aria-checked="true"],
    .bm-ready-size.is-on,
    .bm-armed-options .is-on,
    .bm-bar-modes b.is-on,
    .bm-map-actions .bm-tb-btn[aria-pressed="true"],
    .bm-strip-btn.is-active,
    .bm-strip-btn[aria-pressed="true"],
    .dungeon-mode[aria-pressed="true"],
    .dungeon-template[aria-pressed="true"],
    .dungeon-small-btn.is-active,
    .dungeon-map-actions .dungeon-icon-btn[aria-pressed="true"],
    [data-layers-toggle].is-active,
    .mg-seg[aria-pressed="true"],
    .mg-mode[aria-pressed="true"],
    .mg-tool[aria-pressed="true"]
) {
    border-color: var(--tool-gold);
    background: var(--tool-gold);
    color: var(--tool-ink);
}

body.tool-ui :is(
    .bm-segment[aria-checked="true"],
    .bm-condition-level[aria-pressed="true"],
    .bm-kind[aria-checked="true"],
    .bm-map-actions .bm-tb-btn[aria-pressed="true"],
    .dungeon-mode[aria-pressed="true"],
    .dungeon-map-actions .dungeon-icon-btn[aria-pressed="true"],
    .mg-seg[aria-pressed="true"],
    .mg-mode[aria-pressed="true"],
    .mg-tool[aria-pressed="true"]
) :is(i, span, b, svg) {
    color: inherit;
}

/* --- Panels, headings, notices and empty states ---------------------------------------------------------------------- */

/* One treatment for the three tools' header panels and cards: the Dungeon and Battlemap Generators' header panel. */
body.tool-ui :is(.dungeon-header, .dungeon-panel, .bm-header, .mg-header, .mg-toolbar) {
    border: 1px solid rgba(242, 192, 128, 0.16);
    border-radius: 8px;
    background: var(--tool-panel-deep);
}

/* Panel headings: upper case, light, a little letter-spacing, as the site's own. */
body.tool-ui :is(.dungeon-generator, .map-generator) :is(h2, h3):not(.modal-title),
body.tool-ui :is(.dungeon-collapsible-toggle, .dungeon-accordion-toggle, .bm-section-toggle, .bm-kind-heading, .mg-group > summary,
    .dungeon-random-more > summary, .dungeon-template-group summary, .bm-picture-change > summary) {
    font-family: var(--tool-font);
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

body.tool-ui .bm-kind-accordion .bm-kind-heading {
    color: var(--tool-cream);
    background: transparent;
    box-shadow: none;
}

/* Notices are gold-edged dark cards. */
body.tool-ui :is(.dungeon-plan-note, .bm-plan-note, .mg-plan-note) {
    border: 1px solid var(--tool-gold-line);
    border-radius: 8px;
    background: var(--tool-panel);
    color: var(--tool-cream);
}

body.tool-ui :is(.dungeon-plan-note, .bm-plan-note, .mg-plan-note) :is(strong, a) {
    color: var(--tool-gold);
}

/* A toast is a small gold-edged card. */
body.tool-ui :is(.dungeon-toast, .bm-toast, .mg-toast) {
    border: 1px solid var(--tool-gold-line);
    background: var(--tool-modal);
    color: var(--tool-cream);
    font-family: var(--tool-font);
}

/* --- The Map Generator's page chrome ---------------------------------------------------------------------------------- */

/* The header and the toolbar are panels on the page, as the Dungeon Generator's header is, not bars cut across it. */
body.tool-ui .map-generator {
    gap: 12px;
    padding: 12px var(--mg-gutter) 0;
}

body.tool-ui .map-generator .mg-header {
    padding: 16px 20px;
}

body.tool-ui .map-generator .mg-toolbar {
    top: 8px;
    padding: 8px 12px;
}

body.tool-ui .map-generator .mg-body {
    overflow: hidden;
    border: 1px solid rgba(242, 192, 128, 0.16);
    border-radius: 8px;
}

body.tool-ui .map-generator .mg-plan-note {
    padding: 10px 16px;
    font-size: 1rem;
}

body.tool-ui .map-generator .mg-title-input {
    color: #fff1cf;
}

/* The empty map: the site's card, not a serif one. */
body.tool-ui .map-generator .mg-empty-title {
    font-weight: 400;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* --- The windows and floating panels that are not Bootstrap modals --------------------------------------------------- */

body.tool-ui :is(dialog.mg-export, dialog.mg-dungeon, dialog.mg-city, .dungeon-layers-panel, .mg-shortcuts, .bm-shortcuts) {
    border: 1px solid var(--tool-gold);
    border-radius: 0.5rem;
    background: var(--tool-modal);
    color: var(--tool-cream);
    font-family: var(--tool-font);
}

body.tool-ui :is(.mg-export-title, .mg-dungeon-title, .mg-city-title) {
    margin: 0;
    color: #fff;
    font-family: var(--tool-font);
    font-size: 1.125rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

/* --- Field labels in the tools' side panels: cream, regular, in sentence case ----------------------------------------- */

body.tool-ui :is(.dungeon-field > span, .dungeon-field--check > span, .mg-field-label, .mg-select label, .mg-range-label,
    .mg-inline-field span, .bm-field-label, .dungeon-share-choices legend) {
    color: var(--tool-cream);
    font-size: 0.9rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

/* The close cross of a floating panel is the window's: a bare cross, no ring. */
body.tool-ui :is(.dungeon-layers-panel, .mg-shortcuts, .mg-export, .mg-dungeon, .mg-city) :is(.dungeon-icon-btn, .mg-icon-btn)[aria-label^="Close"] {
    border-color: transparent;
    background: transparent;
    color: #fff;
}

/* A link in running text on the campaign's tool tabs. */
.tool-scope a.tool-link {
    color: var(--tool-gold);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tool-scope a.tool-link:hover {
    color: var(--tool-cream);
}

/* The size note's tier mark wears the site's gold. */
.tool-scope .cw-tier-premium {
    border-color: var(--tool-gold);
    background: var(--tool-gold);
    color: var(--tool-ink);
}

/* Buttons that are not pills (chips, toggles, tools, small buttons): the site's type, regular weight. */
body.tool-ui :is(.dungeon-btn, .dungeon-icon-btn, .dungeon-small-btn, .dungeon-tool, .dungeon-swatch, .dungeon-template, .bm-tb-btn,
    .bm-strip-btn, .bm-kind, .bm-segment, .mg-btn, .mg-icon-btn, .mg-tool, .mg-mode, .mg-seg, .mg-tab) {
    font-family: var(--tool-font);
    font-weight: 400;
}

/* A row of pills in a side panel keeps each label on one line and wraps the row instead. */
body.tool-ui :is(.dungeon-panel-actions, .dungeon-card-actions, .dungeon-history-actions) {
    flex-wrap: wrap;
}

body.tool-ui :is(.dungeon-panel-actions, .dungeon-card-actions, .dungeon-history-actions) :is(.btn-buy, .btn-close-dnd) {
    white-space: nowrap;
}
