/*
 * Anima theme: Bootstrap 5.3 colour-mode overrides.
 *
 * Dark  "Storm & Steel"     - the Anima: Beyond Fantasy cover: armour shadow, storm sky, logo crimson.
 * Light "Parchment & Ink"   - the book's interior pages: parchment, ink, rust chapter art.
 *
 * Colours sampled from the cover / pages (see tasks/extracted/README.md); contrast checked to WCAG AA.
 */

:root {
    --anima-font-display: "Cinzel", Georgia, "Times New Roman", serif;
}

/* ------------------------------------------------------------------ Dark */
[data-bs-theme="dark"] {
    color-scheme: dark;

    /* The logo's #c82425 glows on near-black, so dark mode uses the logo's shadowed tones:
       oxblood for fills, a dusty crimson for red text (4.7:1 on the page background). */
    --anima-crimson: #8e1f22;          /* fills: buttons, accents */
    --anima-crimson-hover: #a3272a;
    --anima-crimson-rgb: 142, 31, 34;
    --anima-crimson-text: #c7625d;     /* brand, titles, links */
    --anima-accent: #9fb4b8;           /* storm sky / logo wings */
    --anima-accent-rgb: 159, 180, 184;
    --anima-surface: #1a2326;
    --anima-raised: #243034;           /* armour steel */

    --bs-body-bg: #0f1517;             /* armour shadow */
    --bs-body-bg-rgb: 15, 21, 23;
    --bs-body-color: #d6dcdd;          /* storm sky */
    --bs-body-color-rgb: 214, 220, 221;
    --bs-emphasis-color: #f1f4f4;
    --bs-emphasis-color-rgb: 241, 244, 244;
    --bs-secondary-color: #8f9c9e;
    --bs-secondary-color-rgb: 143, 156, 158;
    --bs-secondary-bg: #243034;
    --bs-secondary-bg-rgb: 36, 48, 52;
    --bs-tertiary-bg: #1a2326;
    --bs-tertiary-bg-rgb: 26, 35, 38;
    --bs-border-color: #34413f;
    --bs-border-color-translucent: rgba(159, 180, 184, 0.15);

    --bs-primary: var(--anima-crimson);
    --bs-primary-rgb: var(--anima-crimson-rgb);
    --bs-primary-text-emphasis: #d98580;
    --bs-primary-bg-subtle: #2b1314;
    --bs-primary-border-subtle: #5a1c1e;

    --bs-link-color: #c7625d;
    --bs-link-color-rgb: 199, 98, 93;
    --bs-link-hover-color: #d98580;
    --bs-link-hover-color-rgb: 217, 133, 128;

    --bs-heading-color: #eef1f1;
    --bs-focus-ring-color: rgba(var(--anima-crimson-rgb), 0.35);
}

/* ----------------------------------------------------------------- Light */
[data-bs-theme="light"] {
    color-scheme: light;

    --anima-crimson: #9e1c1d;          /* deeper logo crimson, readable on parchment */
    --anima-crimson-hover: #841617;
    --anima-crimson-rgb: 158, 28, 29;
    --anima-crimson-text: #9e1c1d;
    --anima-accent: #7c3528;           /* rust chapter art */
    --anima-accent-rgb: 124, 53, 40;
    --anima-surface: #fbf8f1;
    --anima-raised: #efe7d7;

    --bs-body-bg: #f4efe4;             /* parchment */
    --bs-body-bg-rgb: 244, 239, 228;
    --bs-body-color: #2a2522;          /* ink */
    --bs-body-color-rgb: 42, 37, 34;
    --bs-emphasis-color: #120f0d;
    --bs-emphasis-color-rgb: 18, 15, 13;
    --bs-secondary-color: #6f655b;
    --bs-secondary-color-rgb: 111, 101, 91;
    --bs-secondary-bg: #efe7d7;
    --bs-secondary-bg-rgb: 239, 231, 215;
    --bs-tertiary-bg: #fbf8f1;
    --bs-tertiary-bg-rgb: 251, 248, 241;
    --bs-border-color: #d9cfbd;
    --bs-border-color-translucent: rgba(124, 53, 40, 0.15);

    --bs-primary: var(--anima-crimson);
    --bs-primary-rgb: var(--anima-crimson-rgb);
    --bs-primary-text-emphasis: #6e1314;
    --bs-primary-bg-subtle: #f3dcd6;
    --bs-primary-border-subtle: #dfaaa2;

    --bs-link-color: #9e1c1d;
    --bs-link-color-rgb: 158, 28, 29;
    --bs-link-hover-color: #6e1314;
    --bs-link-hover-color-rgb: 110, 19, 20;

    --bs-heading-color: #1d1916;
    --bs-focus-ring-color: rgba(var(--anima-crimson-rgb), 0.3);
}

/* ------------------------------------------------------------ Typography */
h1, h2, h3, h4, h5, h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6,
.navbar-brand,
.anima-display {
    font-family: var(--anima-font-display);
    letter-spacing: 0.02em;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.08em;
}

.navbar-brand .anima-brand-mark {
    color: var(--anima-crimson-text);
}

/* Theme toggle shows the mode it switches to; CSS-driven so it's right before any JS runs. */
[data-bs-theme="dark"] .theme-icon-to-dark,
[data-bs-theme="light"] .theme-icon-to-light {
    display: none;
}

/* ------------------------------------------------------------ Components */
.card,
.list-group-item,
.modal-content,
.dropdown-menu {
    --bs-card-bg: var(--anima-surface);
    --bs-list-group-bg: var(--anima-surface);
    --bs-modal-bg: var(--anima-surface);
    --bs-dropdown-bg: var(--anima-surface);
}

.navbar.anima-navbar {
    background-color: var(--anima-surface);
    border-bottom: 1px solid var(--bs-border-color);
}

/* Bootstrap compiles button colours at build time; route them through the theme variables. */
.btn-primary {
    --bs-btn-bg: var(--anima-crimson);
    --bs-btn-border-color: var(--anima-crimson);
    --bs-btn-hover-bg: var(--anima-crimson-hover);
    --bs-btn-hover-border-color: var(--anima-crimson-hover);
    --bs-btn-active-bg: var(--anima-crimson-hover);
    --bs-btn-active-border-color: var(--anima-crimson-hover);
    --bs-btn-disabled-bg: var(--anima-crimson);
    --bs-btn-disabled-border-color: var(--anima-crimson);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-focus-shadow-rgb: var(--anima-crimson-rgb);
}

.btn-outline-primary {
    --bs-btn-color: var(--bs-link-color);
    --bs-btn-border-color: var(--anima-crimson);
    --bs-btn-hover-bg: var(--anima-crimson);
    --bs-btn-hover-border-color: var(--anima-crimson);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--anima-crimson-hover);
    --bs-btn-active-border-color: var(--anima-crimson-hover);
    --bs-btn-active-color: #fff;
    --bs-btn-focus-shadow-rgb: var(--anima-crimson-rgb);
    --bs-btn-disabled-color: var(--bs-secondary-color);
    --bs-btn-disabled-border-color: var(--bs-border-color);
}

/* Progress bars (DP limits) use the theme's crimson, not Bootstrap's compiled blue. */
.progress {
    --bs-progress-bar-bg: var(--anima-crimson);
    --bs-progress-bg: var(--anima-raised);
}

.btn-outline-secondary {
    --bs-btn-color: var(--bs-secondary-color);
    --bs-btn-border-color: var(--bs-border-color);
    --bs-btn-hover-bg: var(--bs-secondary-bg);
    --bs-btn-hover-border-color: var(--bs-border-color);
    --bs-btn-hover-color: var(--bs-body-color);
    --bs-btn-active-bg: var(--bs-secondary-bg);
    --bs-btn-active-border-color: var(--bs-border-color);
    --bs-btn-active-color: var(--bs-body-color);
}

.form-control,
.form-select {
    background-color: var(--anima-raised);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--anima-raised);
    border-color: rgba(var(--anima-crimson-rgb), 0.6);
    box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

.form-check-input:checked {
    background-color: var(--anima-crimson);
    border-color: var(--anima-crimson);
}

.text-accent {
    color: var(--anima-accent) !important;
}

/* Inline SVG icons sit on the text baseline like the icon font would. */
svg.bi {
    display: inline-block;
    vertical-align: -0.125em;
}

/* Popovers follow the surface colours */
.popover {
    --bs-popover-bg: var(--anima-surface);
    --bs-popover-header-bg: var(--anima-raised);
    --bs-popover-border-color: var(--bs-border-color);
}

/* A sheet value with a breakdown popover: dotted underline hints there's more */
.anima-stat {
    min-width: 2rem;
    border-bottom: 1px dotted var(--bs-secondary-color) !important;
    border-radius: 0;
    line-height: 1.2;
}

/* Accordions: surfaces and a chevron in the theme's colours (Bootstrap's icon is a fixed blue SVG) */
.accordion {
    --bs-accordion-bg: var(--anima-surface);
    --bs-accordion-border-color: var(--bs-border-color);
    --bs-accordion-active-bg: var(--bs-primary-bg-subtle);
    --bs-accordion-active-color: var(--bs-primary-text-emphasis);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

.accordion-button::after {
    background-image: none !important;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' d='M2 5L8 11L14 5'/%3e%3c/svg%3e") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' d='M2 5L8 11L14 5'/%3e%3c/svg%3e") center / contain no-repeat;
}

.nav-tabs {
    --bs-nav-tabs-link-active-bg: var(--anima-surface);
    --bs-nav-tabs-link-active-border-color: var(--bs-border-color) var(--bs-border-color) var(--anima-surface);
}

/* ⓘ rule explanations (Icon::info) */
.anima-info {
    line-height: 1;
    vertical-align: baseline;
}

.anima-info:hover {
    color: var(--anima-crimson-text) !important;
}

.anima-info:focus-visible,
.anima-stat:focus-visible {
    outline: 2px solid var(--anima-crimson);
    outline-offset: 2px;
    box-shadow: none;
}

/* ------------------------------------------------------------ Characters */
.anima-character-card {
    transition: border-color 0.15s ease-in-out;
}

.anima-character-card:hover,
.anima-character-card:focus-visible {
    border-color: var(--anima-crimson);
}

/* Portrait thumbnail beside the name; portraits are taller than wide, shown whole */
.anima-character-avatar {
    width: 4.5rem;
}

.min-w-0 {
    min-width: 0;
}

/* Characteristic roller dice (js/characteristic-roller.js) */
.cr-die {
    background-color: var(--anima-raised);
    border-color: var(--bs-border-color) !important;
    color: var(--bs-body-color);
    min-width: 2.25rem;
}

.cr-die-new {
    animation: cr-die-in 0.25s ease-out;
}

@keyframes cr-die-in {
    from { transform: rotate(-90deg) scale(0.4); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.cr-die-rolling {
    font-variant-numeric: tabular-nums;
    animation: cr-die-shake 0.12s linear infinite alternate;
    border-color: var(--anima-crimson) !important;
}

@keyframes cr-die-shake {
    from { transform: rotate(-8deg) translateY(-1px); }
    to   { transform: rotate(8deg) translateY(1px); }
}

/* Method 3: a landed die flying from the tray into its characteristic */
.cr-flyer {
    position: fixed;
    z-index: 2000;
    margin: 0;
    pointer-events: none;
    background-color: var(--anima-crimson);
    color: #fff;
    border-color: var(--anima-crimson) !important;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.35);
}

.cr-landed {
    animation: cr-landed 0.6s ease-out;
}

@keyframes cr-landed {
    from { box-shadow: 0 0 0 0.35rem rgba(var(--anima-crimson-rgb), 0.55); border-color: var(--anima-crimson); }
    to   { box-shadow: 0 0 0 0 rgba(var(--anima-crimson-rgb), 0); }
}

/* Drag & drop assignment (methods 1 and 2) */
.cr-tray {
    min-height: 2.75rem;
    padding: 0.4rem;
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.cr-draggable,
.cr-slot-value {
    cursor: grab;
    touch-action: none;     /* let pointer events drive the drag on touch screens */
    user-select: none;
}

.cr-selected {
    outline: 2px solid var(--anima-crimson);
    outline-offset: 2px;
}

.cr-dragging {
    opacity: 0.35;
}

.cr-ghost {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(1.15);
    background-color: var(--anima-crimson);
    color: #fff;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.35);
}

.cr-slot {
    width: 100%;
    min-height: 4.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.35rem 0.25rem;
    color: var(--bs-body-color);
    background-color: var(--anima-raised);
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    transition: border-color 0.15s, background-color 0.15s;
    container-type: inline-size;    /* lets the name scale to the slot's width */
}

.cr-slot.cr-filled {
    border-style: solid;
}

.cr-slot-name {
    font-family: var(--anima-font-display);
    font-weight: 600;
    letter-spacing: 0.03em;
    font-size: min(1rem, 11cqi);    /* full names ("Constitution", ~7.75em wide) fit narrow slots */
    white-space: nowrap;
}

.cr-slot-value {
    font-size: 0.875rem;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background-color: rgba(var(--anima-crimson-rgb), 0.2);
    color: var(--bs-body-color);
    font-variant-numeric: tabular-nums;
}

.cr-drop-hover {
    border-color: var(--anima-crimson) !important;
    background-color: rgba(var(--anima-crimson-rgb), 0.12);
}

/* Psychic powers: a quieter red than the discipline buttons above them. */
.ld-psy-power {
    opacity: 0.75;
    --bs-btn-disabled-opacity: 0.5;     /* earlier-level patterns: dimmer still */
}

.ld-psy-power.ld-psy-earlier {
    opacity: 0.5;                       /* earlier-level powers (still clickable: they open the power modal) */
}

/* Sheet: sections can be moved (js/sheet-layout.js): a grip before each header, live reordering. */
.anima-grip {
    display: flex;
    align-items: center;
    padding: 0 0.15rem 0 0.5rem;
    border: 0;
    background-color: var(--bs-accordion-btn-bg);
    color: var(--bs-secondary-color);
    cursor: grab;
    touch-action: none;             /* the pointer drags the section instead of scrolling */
}

.accordion-header:has(.accordion-button:not(.collapsed)) .anima-grip {
    background-color: var(--bs-accordion-active-bg);
}

.anima-grip:hover,
.anima-grip:focus-visible {
    color: var(--anima-crimson-text);
}

.anima-grip:focus-visible {
    outline: 2px solid var(--anima-crimson);
    outline-offset: -2px;
}

/* Header split around an Edit pencil (Advantages / Disadvantages): title toggle, pencil, then the
   badge + chevron as a second toggle filling the rest. */
.anima-head-title {
    width: auto;
    flex: 0 0 auto;
    padding-right: 0.35rem;
}

.anima-head-title::after {
    display: none;                  /* the chevron is on the second toggle */
}

.anima-head-rest {
    flex: 1 1 auto;
    padding-left: 0;
}

.anima-head-action {
    display: flex;
    align-items: center;
    padding: 0 0.25rem;
    border: 0;
    background-color: var(--bs-accordion-btn-bg);
    color: var(--bs-secondary-color);
}

.accordion-header:has(.accordion-button:not(.collapsed)) .anima-head-action,
.accordion-header:has(.accordion-button:not(.collapsed)) .anima-grip {
    background-color: var(--bs-accordion-active-bg);
    box-shadow: inset 0 calc(-1 * var(--bs-accordion-border-width)) 0 var(--bs-accordion-border-color);   /* the open toggle's underline */
}

.anima-head-action:hover,
.anima-head-action:focus-visible {
    color: var(--anima-crimson-text);
}

.anima-head-action:focus-visible {
    outline: 2px solid var(--anima-crimson);
    outline-offset: -2px;
}

.anima-column {
    min-height: 3rem;               /* an emptied column can still take sections back */
}

.anima-sorting,
.anima-sorting * {
    cursor: grabbing !important;
    user-select: none;
}

.anima-sorting .anima-column {
    outline: 1px dashed var(--bs-border-color);
    outline-offset: 4px;
    border-radius: var(--bs-border-radius);
}

.anima-section.anima-moving {
    opacity: 0.6;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.35);
}

/* Sheet: the portrait, shown whole (uploads are portrait-shaped); the empty placeholder is 3:4. */
.anima-portrait-frame {
    overflow: hidden;
    border-top-left-radius: var(--bs-card-inner-border-radius);
    border-top-right-radius: var(--bs-card-inner-border-radius);
    background-color: var(--anima-raised);
}

.anima-portrait-frame img {
    width: 100%;
    height: auto;
    display: block;
}

.anima-portrait-empty {
    aspect-ratio: 3 / 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--bs-secondary-color);
}

.anima-portrait-empty svg {
    width: 4rem;
    height: 4rem;
    opacity: 0.5;
}

/* Sheet: the "DP · XP" line opens the Experience modal. */
.anima-xp:hover,
.anima-xp:focus-visible {
    color: var(--anima-crimson-text) !important;
}

/* Sheet: psychic powers maintained in an Innate Slot stand out from the other (subtle) pills. */
.anima-power-pill.anima-maintained {
    opacity: 1;
    font-weight: 600;
    box-shadow: 0 0 0 2px var(--anima-crimson-text);
}

/* The power modal opens on top of the Spend DP modal (its backdrop is raised in js/level-dp.js). */
#psyPowerModal,
#kiTechModal {
    z-index: 1065;
}

/* Sheet: a level without a class glows until one is picked (Spend DP stays disabled until then). */
.anima-needs-choice {
    border-color: var(--anima-crimson-text);
    animation: anima-glow 1.6s ease-in-out infinite;
}

@keyframes anima-glow {
    0%, 100% { box-shadow: 0 0 0 0.1rem rgba(var(--anima-crimson-rgb), 0.35); }
    50%      { box-shadow: 0 0 0.6rem 0.2rem rgba(var(--anima-crimson-rgb), 0.75); }
}

@media (prefers-reduced-motion: reduce) {
    .anima-needs-choice {
        animation: none;
        box-shadow: 0 0 0.4rem 0.15rem rgba(var(--anima-crimson-rgb), 0.6);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cr-die-new,
    .cr-die-rolling,
    .cr-landed { animation: none; }
}

/* ----------------------------------------------------------------- Login */
.anima-auth {
    min-height: calc(100vh - 57px);
    display: flex;
    align-items: center;
    padding: 2rem 1rem;
}

.anima-auth .card {
    width: 100%;
    max-width: 24rem;
    margin: 0 auto;
    border-top: 3px solid var(--anima-crimson);
}

.anima-title {
    font-family: var(--anima-font-display);
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--anima-crimson-text);
}

.anima-subtitle {
    font-family: var(--anima-font-display);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--anima-accent);
}

/* Combat / Health's collapsible cards (decision 36): the header is the toggle; the chevron turns when closed. */
.anima-card-toggle { color: var(--bs-body-color); background-color: var(--bs-card-cap-bg, var(--bs-tertiary-bg)); }
.anima-card-chevron { transition: transform .15s ease; }
.anima-card-toggle.collapsed .anima-card-chevron { transform: rotate(-90deg); }

/* Arrange mode (decision 37, js/arranger.js): items fold to their title bar with big move buttons. */
.anima-move { display: none; }
.anima-arranging .anima-move { display: flex; flex-wrap: wrap; gap: .5rem; padding: .5rem .75rem; border-top: 1px solid var(--bs-border-color); }
.anima-arranging .anima-move .btn { min-width: 2.75rem; min-height: 2.5rem; }
.anima-arranging .accordion-collapse,
.anima-arranging .anima-card-item > :not(.card-header):not(.anima-move) { display: none !important; }
.anima-arranging .accordion-header .accordion-button,
.anima-arranging .anima-head-action { pointer-events: none; }
.anima-arranging .accordion-header .accordion-button::after { display: none; }
.anima-card-item .card-header .anima-grip { margin-left: -.25rem; }
/* Arranging the sheet: the portrait isn't movable, so it steps aside (on phones it comes first). */
.anima-arranging .anima-portrait { display: none; }

/* Combat Table modal (decision 38): the current result's row and AT column, and their crossing. */
.anima-combat-table thead th { background: var(--anima-raised); }
.anima-combat-table .anima-ct-row > *,
.anima-combat-table .anima-ct-col { --bs-table-bg-state: rgba(var(--anima-accent-rgb), .18); }
.anima-combat-table .anima-ct-hit { --bs-table-bg-state: rgba(var(--anima-crimson-rgb), .55); font-weight: 700; outline: 2px solid var(--anima-crimson-text); outline-offset: -2px; }
.anima-combat-table thead th { box-shadow: 0 -.75rem 0 var(--anima-raised); }      /* no row peeking above the sticky header */
/* Combat tab cards fold by their title (decision 42), like the Sheet's cards. */
.anima-card-fold { color: var(--bs-body-color); }
.anima-card-fold:hover { color: var(--bs-body-color); }
.anima-card-fold.collapsed .anima-card-chevron { transform: rotate(-90deg); }
.anima-card-fold .anima-card-chevron { transition: transform .15s; font-size: .85em; color: var(--bs-secondary-color); }
.anima-arranging .anima-card-fold { pointer-events: none; }
.anima-arranging .anima-card-fold .anima-card-chevron { display: none; }
/* Ki Technique builder (decision 43): the cost stays in view while the form scrolls. */
@media (min-width: 992px) { .anima-sticky-top { position: sticky; top: 0; } }

/* Combat tab: Life Points / Fatigue on the button row (decision 44). The bar is a range input (the knob drags);
   --pct is the fill, data-tone its colour; the number in the bar opens a panel to type an amount. */
.anima-vital { flex: 1 1 18rem; min-width: 0; }
.anima-vital-bar { height: 1.6rem; --vital-fill: var(--anima-crimson); --vital-track: var(--bs-secondary-bg); }
.anima-vital-bar[data-tone="between"] { --vital-fill: var(--bs-warning); }
.anima-vital-bar[data-tone="dead"] { --vital-fill: var(--bs-danger); }
.anima-vital-range { -webkit-appearance: none; appearance: none; position: absolute; inset: 0; width: 100%; height: 100%;
    margin: 0; background: transparent; cursor: pointer; touch-action: none; }
.anima-vital-range::-webkit-slider-runnable-track { height: 100%; border-radius: .4rem;
    background: linear-gradient(to right, var(--vital-fill) 0 var(--pct, 0%), var(--vital-track) var(--pct, 0%) 100%); }
.anima-vital-range::-moz-range-track { height: 100%; border-radius: .4rem;
    background: linear-gradient(to right, var(--vital-fill) 0 var(--pct, 0%), var(--vital-track) var(--pct, 0%) 100%); }
.anima-vital-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 1.1rem; height: 2rem; margin-top: -.2rem;
    border-radius: .35rem; background: var(--bs-emphasis-color); border: 2px solid var(--bs-body-bg); box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.anima-vital-range::-moz-range-thumb { width: 1.1rem; height: 2rem; border-radius: .35rem; background: var(--bs-emphasis-color);
    border: 2px solid var(--bs-body-bg); box-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.anima-vital-range:focus-visible { outline: 2px solid var(--anima-crimson-text); outline-offset: 3px; border-radius: .4rem; }
.anima-vital-zero { position: absolute; top: -3px; bottom: -3px; width: 2px; transform: translateX(-1px);
    background: var(--bs-emphasis-color); opacity: .55; pointer-events: none; }
.anima-vital-value { position: absolute; left: .35rem; top: 50%; transform: translateY(-50%); z-index: 2;
    border: 0; border-radius: .3rem; padding: .05rem .4rem; line-height: 1.2; font-size: .85rem; font-weight: 600;
    background: rgba(0, 0, 0, .45); color: #fff; cursor: text; }
.anima-vital-value:hover, .anima-vital-value:focus-visible { background: rgba(0, 0, 0, .7); text-decoration: underline dotted; }
.anima-vital-bubble { position: absolute; bottom: calc(100% + .45rem); transform: translateX(-50%); z-index: 3; pointer-events: none;
    padding: .1rem .45rem; border-radius: .3rem; font-size: .8rem; font-weight: 600;
    background: var(--bs-emphasis-color); color: var(--bs-body-bg); white-space: nowrap; }
.anima-vital-pop { position: absolute; top: calc(100% + .4rem); left: 0; z-index: 1030; width: 15rem; }
.anima-vital-value.anima-vital-value-end { left: auto; right: .35rem; }
/* The page's save status in the navbar (decision 44): fixed width, so text changes move nothing. */
.anima-page-status { width: 13rem; text-align: right; }
.anima-page-status:empty { visibility: hidden; }
/* Combat tab Ki pools (decision 45): the value inside the bar. */
.anima-ki-bar { height: 1.1rem; }
.anima-ki-bar-value { position: absolute; left: .4rem; top: 50%; transform: translateY(-50%); font-size: .75rem; font-weight: 600;
    line-height: 1; color: #fff; text-shadow: 0 0 3px rgba(0, 0, 0, .8); pointer-events: none; }
/* Selected items in list groups (Admin > Classes): the site's crimson, not Bootstrap's blue. */
.list-group-item.active { background-color: var(--anima-crimson); border-color: var(--anima-crimson); color: #fff; }
/* Admin > Classes (decision 49): a value better than the worst book value, and its key in the title row. */
.anima-better { border-color: var(--anima-crimson-text) !important; box-shadow: 0 0 0 1px var(--anima-crimson-text); }
.anima-better-key { display: inline-block; width: .9rem; height: .9rem; vertical-align: -.1rem; border-radius: .2rem;
    border: 1px solid var(--anima-crimson-text); box-shadow: 0 0 0 1px var(--anima-crimson-text); }
/* The alert box (decision 196): between the name and the level, never taller than that row; it scrolls inside. */
.anima-alerts { position: relative; flex: 1 1 16rem; align-self: stretch; min-width: 12rem; min-height: 3.6rem; }
.anima-alerts-list { position: absolute; inset: 0; overflow-y: auto; margin: 0; padding: .3rem .6rem; list-style: none;
    font-size: .8125rem; line-height: 1.35; border: 1px solid rgba(var(--anima-crimson-rgb), .45); border-radius: .4rem;
    background: rgba(var(--anima-crimson-rgb), .08);
    scrollbar-width: thin; scrollbar-color: rgba(var(--anima-crimson-rgb), .55) transparent; }
.anima-alerts-list li + li { margin-top: .15rem; }
.anima-alerts-list .anima-alert-source { font-weight: 600; color: var(--anima-crimson-text); }
.anima-alerts-list::-webkit-scrollbar { width: 6px; }
.anima-alerts-list::-webkit-scrollbar-track { background: transparent; }
.anima-alerts-list::-webkit-scrollbar-thumb { background: rgba(var(--anima-crimson-rgb), .55); border-radius: 3px; }
.anima-alerts-list::-webkit-scrollbar-thumb:hover { background: rgba(var(--anima-crimson-rgb), .8); }
@media (max-width: 575.98px) { .anima-alerts { order: 3; flex-basis: 100%; } }
/* In effect chips (decision 197): muted, one wrapping line under the alerts. */
.anima-alerts-list .anima-in-effect { line-height: 1.9; }
.anima-alerts-list .anima-in-effect .badge { font-size: .75rem; cursor: help; }
/* Essentials under the Tracked Resources bars (decision 200): hover for the parts; the AT line smaller. */
.anima-essential { cursor: help; white-space: nowrap; }
.anima-essentials-at { font-size: .75rem; }

/* Natural Magic calculator (decision 201): one cell per d10 roll, five a row on narrow screens. */
.anima-nm-strip {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: .25rem;
}
.anima-nm-cell {
    padding: .25rem .2rem;
    text-align: center;
    line-height: 1.15;
    cursor: default;
}
.anima-nm-label {
    font-size: .7rem;
    overflow-wrap: anywhere;
}
@media (max-width: 575.98px) {
    .anima-nm-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

/* Spend DP's admin purchase list (decision 190): its own short scroll box, so the modal's top stays in view. */
.anima-audit-list { max-height: 9rem; }
