:root {
    /* Every skin is dark, and saying so lets the browser draw its native controls (the
       select, a scrollbar) to match instead of in their light defaults. */
    color-scheme: dark;
    --color-canvas: #15110d;
    --color-panel: #211a14;
    --color-panel-raised: #2b2118;
    --color-text: #f3e7cc;
    --color-text-muted: #b9aa8c;
    --color-accent: #d0a85a;
    --color-accent-strong: #edc978;
    /* The text an accent-filled control carries. It is read from the accent rather than
       from the page's own text color, so a skin that fills a button with something other
       than the accent states the pair together. */
    --color-on-accent: #17110b;
    --color-border: #6f5633;
    --color-danger: #d47a72;
    --color-success: #83a86b;
    /* A critical success is green like an ordinary success and brighter than one, so that
       the recent-rolls panel tells the two tiers apart by color as well as by their text. */
    --color-critical: #a9dd63;
    /* What an effect is drawn in: what is helping a character and what is working against
       them. Both read from the palette's own success and danger, which every skin already
       values, so a skin only states these where it wants them apart from those. */
    --color-buff: var(--color-success);
    --color-debuff: var(--color-danger);
    --font-body: ui-sans-serif, system-ui, sans-serif;
    --font-display: ui-serif, Georgia, serif;
    /* One type scale: the page title is `--text-xl`, and `--text-xs` is the size of a section
       label and a badge alone. */
    --text-xs: 0.6875rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.125rem;
    --text-xl: 1.625rem;
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    /* Every control in a row stands at one of two heights, so a select, an input and a button
       side by side line up. */
    --control-h: 2.375rem;
    --control-h-sm: 1.875rem;
    --radius-control: 0.5rem;
    --radius-card: 0.75rem;
    --radius-surface: 1rem;
    /* The small corner of a mark drawn at the size of a glyph: a pip's and an effect symbol's
       focus ring, and a battle map token's name label. */
    --radius-mark: 0.25rem;
    /* The fully rounded ends of a badge, whatever its height. */
    --radius-pill: 999px;
    /* A hairline softer than the border, for fields, empty states and the rules that separate
       one thing from the next. */
    --line: color-mix(in srgb, var(--color-border) 55%, transparent);
    /* The ground of a card inside a panel: a step from the panel towards the raised panel. */
    --color-card: color-mix(in srgb, var(--color-panel-raised) 70%, var(--color-panel));
    /* The longest line prose is set at. */
    --measure: 68ch;
    --shell-nav-width: 15rem;
    --shell-widget-width: 17rem;
    /* The shadow under what floats over the page: the dialog, a popover card, the battle map's
       drawer, a token's card and its toolbar, each edged by the full border, since a hairline
       is too faint against a dimmed backdrop or a card. A panel or a card in the flow casts
       none. */
    --shadow-float: 0 0.5rem 1.5rem rgb(0 0 0 / 0.2);
    /* The button has a color of its own because a skin may draw it in something other than
       the accent. The default skin sets it to the accent the rules below read before, so it
       renders exactly as it did. */
    --color-button: var(--color-accent);
    --color-button-hover: var(--color-accent-strong);
    /* The grounds of the tinted kinds of button: an ordinary action is tinted in the accent and
       a destructive one in the danger color, each stronger under the pointer. Mixed with
       transparency, so they sit on a panel or a raised panel alike. The hover stops at 22%: a
       stronger tint takes the accent text under 4.5:1 on Travels' raised panel. */
    --color-button-tint: color-mix(in srgb, var(--color-accent) 16%, transparent);
    --color-button-tint-hover: color-mix(in srgb, var(--color-accent) 22%, transparent);
    --color-danger-tint: color-mix(in srgb, var(--color-danger) 16%, transparent);
    --color-danger-tint-hover: color-mix(in srgb, var(--color-danger) 22%, transparent);
    /* The text of a danger-tinted button: the danger color lightened towards the text, since
       the danger itself falls under 4.5:1 on its own tint over most skins' raised panels. */
    --color-danger-text: color-mix(in srgb, var(--color-danger) 70%, var(--color-text));
    /* The text a danger-filled button carries. Every skin's danger is a light red, so one dark
       value reads on all of them. */
    --color-on-danger: #1a0f0d;
    /* The surface a field, a stat box, a placeholder, an image frame and a disabled button are
       recessed into: the canvas, except on a skin whose canvas is lighter than its panels. */
    --color-well: var(--color-canvas);
    /* What the modal dialog dims the page behind it with. */
    --color-backdrop: rgb(0 0 0 / 0.6);
    /* A battle map's grid: a light line over a dark halo, so it reads over a dark cave floor
       and a bright snowfield alike. It is drawn over the uploaded image rather than over a
       skin's surfaces, so it does not follow the palette. */
    --color-battle-grid: rgb(255 255 255 / 0.4);
    --color-battle-grid-halo: rgb(0 0 0 / 0.3);
    /* The surface around a battle map, beyond the edges of its image. */
    --color-battle-workspace: var(--color-well);
    /* A battle map token is a coin: a colored ring between two dark rims, so a light ring
       reads over a bright floor and the rims over a dark one. A player character's ring is its
       class color; the others are fixed, as the grid's are, since they lie over the uploaded
       image. The name under a coin is light text on the rim color. */
    --color-token-rim: rgb(0 0 0 / 0.85);
    /* The fill of a faded dot on a scene's mini-map: the rim's color made opaque, so its gray
       letters read over a bright image as over a dark one. */
    --color-token-faded: rgb(0 0 0);
    --color-token-companion: #7fd18b;
    --color-token-npc-shared: #e6c36a;
    --color-token-npc-private: #c9a0ff;
    --color-token-name: rgb(255 255 255 / 0.95);
    /* An adversary's ring is one arc per square of its progress track: the ticked arcs in the
       fill color, the others in the track color, over the coin's dark rim. */
    --color-token-adversary-fill: #ef6a5f;
    --color-token-adversary-track: rgb(255 255 255 / 0.4);
    /* A custom token's ring and icon where it carries no color of its own. */
    --color-token-custom: #5ec8d8;
    /* The thin light outline around a custom token's icon, so an icon in a dark color still
       reads on the coin's dark center. */
    --color-token-emblem-outline: rgb(255 255 255 / 0.7);
    /* The sheen over a coin's ring: light at its upper left, a soft highlight band, and shade at
       its lower right, translucent so every ring keeps its own hue. */
    --color-token-sheen-light: rgb(255 255 255 / 0.32);
    --color-token-sheen-band: rgb(255 255 255 / 0.18);
    --color-token-sheen-dark: rgb(0 0 0 / 0.32);
}

/* The Frostmoor skin: a slate canvas under steel-gray panels, with bone text, an ice-blue
   accent and steel buttons, chosen to sit opposite the default skin's amber on umber. This
   block redefines tokens and nothing else — no selector here and no rule the default skin
   does not have, because a skin is a set of values; anything that needed a rule of its own
   would be a missing token on `:root` instead. Every surface is a flat color. */
[data-skin="frost"] {
    --color-canvas: #0f1319;
    --color-panel: #1a2029;
    --color-panel-raised: #242c38;
    --color-text: #e6ecf2;
    --color-text-muted: #a3b0bf;
    --color-accent: #8ec5e6;
    --color-accent-strong: #b8def5;
    --color-on-accent: #eef3f8;
    --color-border: #3d4a5c;
    /* The warm colors are kept warm on purpose: a refusal and a success read as the same
       things they are on the default skin, only against slate. */
    --color-danger: #ea837c;
    --color-success: #8fcc8c;
    --color-critical: #cdf27f;
    --color-backdrop: rgb(4 7 12 / 0.7);
    --shadow-float: 0 0.5rem 1.5rem rgb(0 0 0 / 0.5);
    --color-button: #34495f;
    --color-button-hover: #41596f;
}

/* The Arcana Aurora skin, after a fantasy MMO interface the user brought: a warm near-black
   canvas behind plum panels, with rose-gold hairlines, rose buttons and an orchid accent.
   Every skin is dark, so hue is what tells them apart: amber on umber, ice on slate, orchid
   on plum. */
[data-skin="arcana"] {
    --color-canvas: #14100f;
    --color-panel: #1e161c;
    --color-panel-raised: #2a1e28;
    --color-text: #f1e6ea;
    --color-text-muted: #b2a0aa;
    --color-accent: #d477b3;
    --color-accent-strong: #eaa0d0;
    --color-on-accent: #f6eaf0;
    --color-border: #8c6a58;
    --color-danger: #e8766a;
    --color-success: #8fcf86;
    --color-critical: #c9ec7a;
    --color-backdrop: rgb(12 6 10 / 0.75);
    --shadow-float: 0 0.5rem 1.5rem rgb(0 0 0 / 0.55);
    --color-button: #6e3a5a;
    --color-button-hover: #85476e;
}

/* The Sapphire Sky skin, after a second interface mock the user brought: navy panels under a
   near-black indigo canvas, gold hairlines, a gold accent for links and marked pips, and
   deep teal buttons carrying white text. Gold rather than blue as the accent is what keeps
   it apart from Frostmoor, whose accent is ice. */
[data-skin="sapphire"] {
    --color-canvas: #111420;
    --color-panel: #1c2136;
    --color-panel-raised: #232b48;
    --color-text: #eef1f8;
    --color-text-muted: #aab3cc;
    --color-accent: #dcb964;
    --color-accent-strong: #f0d58a;
    --color-on-accent: #f2fbff;
    --color-border: #a88a52;
    --color-danger: #ef8a80;
    --color-success: #8fd39a;
    --color-critical: #c8ef7c;
    --color-backdrop: rgb(5 8 18 / 0.75);
    --shadow-float: 0 0.5rem 1.5rem rgb(0 0 0 / 0.5);
    --color-button: #16596e;
    --color-button-hover: #1a6d87;
}

/* The Travels and Trepidation skin, after a third mock the user brought: dark brown panels on
   a lighter, smoky brown canvas — the one skin whose canvas is lighter than its panels,
   which is what the mock does and what keeps it apart from Emberlight's near-black umber —
   with stone-gray hairlines, bone text and a burnt-orange accent and buttons. */
[data-skin="travels"] {
    --color-canvas: #3a332b;
    --color-panel: #1f1b19;
    --color-panel-raised: #2d2723;
    --color-text: #e6dccb;
    --color-text-muted: #b7ab9b;
    --color-accent: #ee9448;
    --color-accent-strong: #f4a45c;
    --color-on-accent: #fbefe2;
    --color-border: #6b6157;
    --color-danger: #f08a92;
    --color-success: #7fbf6c;
    --color-critical: #dcf27a;
    --color-backdrop: rgb(20 16 12 / 0.7);
    --shadow-float: 0 0.5rem 1.5rem rgb(0 0 0 / 0.5);
    --color-button: #8a4119;
    --color-button-hover: #9c4a1c;
    /* Darker than both panels, the canvas here being lighter than either. */
    --color-well: #181513;
}

/* One color per class, the banner's body color lightened where it needed it to read as
   text on the dark panels — Rogue's banner is black, so its color here is a light gray.
   Each value clears 4.5:1 against every skin's `--color-panel` and `--color-panel-raised`,
   every skin being dark. Sapphire's raised panel is the worst ground of the ten and so the
   one every value is bounded by. Warrior and Druid sit higher above that floor than they
   need to: a class sharing a primary domain with one of them takes the deeper color of the
   pair, and with these two at the floor there was no room under them to take it in.
   They style the directory's class name, through the rule under them, and a player
   character's token ring on the battle map page and its dot on a scene's mini-map, through the
   token ring rules, which alone fall back to the accent. The character form's subclass
   `<option>`s carry the same attribute for `character-form.js` to filter on, so the rule under
   them names the span rather than the attribute alone and leaves that select untouched.
   The four classes under the nine key to the domain each shares with one of the nine, the
   first-listed breaking a tie, so each is a sibling of the class it shares that domain with:
   the Assassin takes Blade's red beside the Warrior's, the Brawler Valor's orange beside the
   Guardian's, and the Witch Sage's green beside the Druid's — Sage being the one domain the
   Witch shares, its first-listed Dread having no class among the nine to anchor to. Two of
   them are the deeper of their pair, which at this floor is
   bought with chroma and hue rather than with darkness — there is no room under 4.5:1 for a
   blood red or a forest green — and the Brawler is the paler of its pair instead, which the
   floor gives away freely. The Warlock has no sibling, Dread being new: its value is the
   domain's own #2C2A67 lightened along its own indigo hue until it clears the floor, the
   treatment the Rogue's black banner gets. */
[data-class="bard"] { --color-class: #d376b6; }
[data-class="rogue"] { --color-class: #959599; }
[data-class="sorcerer"] { --color-class: #a587cd; }
[data-class="druid"] { --color-class: #82bc86; }
[data-class="ranger"] { --color-class: #d8dce3; }
[data-class="warrior"] { --color-class: #e09a96; }
[data-class="guardian"] { --color-class: #dd7b25; }
[data-class="seraph"] { --color-class: #e0b73a; }
[data-class="wizard"] { --color-class: #7397d5; }
[data-class="assassin"] { --color-class: #f2684a; }
[data-class="brawler"] { --color-class: #f0c096; }
[data-class="warlock"] { --color-class: #8e8be0; }
[data-class="witch"] { --color-class: #38a492; }
span[data-class] { color: var(--color-class); }

/* Every box that scrolls, the side columns, the dialog and the battle map's drawer among them,
   draws a thin scrollbar in the muted text over no track. `scrollbar-color` inherits and
   `scrollbar-width` does not, so both are set on every element. */
* {
    box-sizing: border-box;
    scrollbar-color: color-mix(in srgb, var(--color-text-muted) 45%, transparent) transparent;
    scrollbar-width: thin;
}

/* The `hidden` attribute is mapped to `display: none` only by the UA stylesheet, so any
   author rule setting `display` on an element wins over it regardless of specificity —
   `button { display: inline-block }` below would keep a hidden button visible. The
   attribute needs an author rule of its own to hold. */
[hidden] { display: none !important; }

html {
    background: var(--color-canvas);
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.5;
    /* The stream's jump links are plain same-page anchors; this is what makes the move
       between its ends readable rather than a cut. */
    scroll-behavior: smooth;
}
/* A reader who asks for reduced motion gets the instant jump the anchor performs by itself. */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

/* Body text is set on the body rather than the root, so the root keeps the browser's size and
   every `rem` in this file, spaces and control heights included, stays measured against it. */
body { font-size: var(--text-base); margin: 0; min-width: 20rem; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--color-text); font-family: var(--font-display); line-height: 1.15; }
h1 { font-size: var(--text-xl); }
/* An `h2` naming a section inside a panel, beside other sections, is drawn as a small label in
   the body font. One that is a title carries `title` and keeps the display font: a scene's, a
   world's or a release's name, and a heading over a form or a stretch of prose standing on its
   own (the sign-in forms, the account's forms, the rolls guide, the long rest's list). The
   eyebrow over a page, the sub-headings inside a panel (the directory's groups, the widget
   column's loadout) and the character form's fieldset legends are the same label. */
h2.title { font-size: var(--text-lg); }
h2:not(.title), .eyebrow, .character-directory h3, .character-widget h3, .character-form legend {
    color: var(--color-text-muted);
    font: 700 var(--text-xs)/1.3 var(--font-body);
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
/* The browser default (~1.17em) sits so close to --text-lg that a feature name inside a
   section reads as a second section title; base size keeps the levels apart. */
h3 { font-size: var(--text-base); }
a { color: var(--color-accent-strong); }
a:hover { color: var(--color-text); }

/* Every button, and every link drawn as one, is one of five kinds. A bare one is secondary: an
   action that does something, tinted in the accent. `primary` is filled, for the one action that
   completes a form or a page; `quiet` is text alone, for Cancel, Close and light row actions;
   `danger` is tinted in the danger color, and `danger solid` filled with it, for the confirming
   button of a confirmation; `icon` is a square holding one glyph. `compact` is the small size of
   any of them. Every kind has the same box, a transparent border included, so kinds and fields
   side by side stand at one height. The kind selectors are wrapped in `:where` so each weighs
   one class, which the disabled rule below outweighs; `.danger` also names the composer's count
   hint, which the wrapper keeps out. */
button, .button {
    align-items: center;
    appearance: none;
    background: var(--color-button-tint);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    color: var(--color-accent-strong);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 600;
    gap: var(--space-2);
    justify-content: center;
    min-height: var(--control-h);
    padding: var(--space-1) var(--space-4);
    text-align: center;
    text-decoration: none;
}
button:hover, .button:hover { background: var(--color-button-tint-hover); color: var(--color-accent-strong); }
:where(button, .button).primary { background: var(--color-button); color: var(--color-on-accent); font-weight: 700; }
:where(button, .button).primary:hover { background: var(--color-button-hover); color: var(--color-on-accent); }
:where(button, .button).quiet { background: transparent; padding-inline: var(--space-2); }
:where(button, .button).danger { background: var(--color-danger-tint); color: var(--color-danger-text); }
:where(button, .button).danger:hover { background: var(--color-danger-tint-hover); color: var(--color-danger-text); }
:where(button, .button).solid { background: var(--color-danger); color: var(--color-on-danger); font-weight: 700; }
:where(button, .button).solid:hover {
    background: color-mix(in srgb, var(--color-danger) 85%, var(--color-text));
    color: var(--color-on-danger);
}
.compact, .card-controls > form > button, .card-controls > .button {
    font-size: var(--text-sm);
    min-height: var(--control-h-sm);
    padding: 0 var(--space-3);
}
/* Under a card every control in its row is small, and every one but the destructive one is
   quiet. The row's own controls are its links and the buttons of its one-button forms; the
   child combinators keep the form inside an open Rewrite fold out, so its submit keeps its own
   kind. The `:where` keeps this at one class's weight, so a button's hover tint still shows. */
:where(.card-controls > form > button, .card-controls > .button):not(.danger) { background: transparent; }
:where(button, .button).icon { flex: none; padding: 0; width: var(--control-h); }
:where(button, .button).icon.compact { width: var(--control-h-sm); }
button:disabled, button:disabled:hover {
    background: var(--color-well);
    border-color: var(--line);
    color: var(--color-text-muted);
    cursor: not-allowed;
    font-weight: 600;
}
:is(a, button, input, textarea, select, summary, .battle-map-token, .battle-map-viewport):focus-visible {
    outline: 2px solid var(--color-accent-strong);
    outline-offset: 2px;
}

form { display: grid; gap: var(--space-3); }
/* A form is a grid and would stretch a button standing in it across the form; a button is sized
   to its label and starts the row instead. Two or more actions share an `.action-row`. The scene
   form's map upload button stands in the grid of the map's fields rather than in the form. */
form > :is(button, .button), .map-picture-fields > button { justify-self: start; }
/* The form's gap stands between one field and the next; a label sits close over the field it
   names, and a hint, in the muted small size, close under it. A label wrapping its own checkbox
   or radio carries no `for` and keeps the full gap. */
form > label[for] { margin-bottom: calc(var(--space-1) - var(--space-3)); }
/* The one-row forms lay their label out beside the field instead. */
:is(.scene-switcher, .battle-map-level-menu) > label[for] { margin-bottom: 0; }
:is(form, fieldset) > p.muted { font-size: var(--text-sm); }
form > :is(input, select, textarea) + p.muted { margin-top: calc(var(--space-1) - var(--space-3)); }
label { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 700; }
/* Fields stand at a control's height on the well. A select has no width of its own: a form's
   grid stretches it across the column, and in a flex row it is sized by its options. It draws
   its own chevron in place of the browser's, which ignores the skin. */
input, textarea, select {
    background: var(--color-well);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    color: var(--color-text);
    font: inherit;
    height: var(--control-h);
    max-width: 100%;
    padding: 0 var(--space-3);
}
input, textarea { width: 100%; }
textarea { height: auto; min-height: 9rem; padding: var(--space-2) var(--space-3); resize: vertical; }
select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--color-text-muted) 50%),
        linear-gradient(135deg, var(--color-text-muted) 50%, transparent 50%);
    background-position: calc(100% - 1rem) 50%, calc(100% - 0.6875rem) 50%;
    background-repeat: no-repeat;
    background-size: 0.3125rem 0.3125rem;
    padding-right: var(--space-8);
}
/* The file picker's own button is drawn as a small secondary button inside the field. */
input[type="file"] { padding: calc((var(--control-h) - var(--control-h-sm)) / 2 - 1px); }
input[type="file"]::file-selector-button {
    background: var(--color-button-tint);
    border: 0;
    border-radius: var(--radius-control);
    color: var(--color-accent-strong);
    cursor: pointer;
    font: inherit;
    font-size: var(--text-sm);
    font-weight: 600;
    height: var(--control-h-sm);
    margin-inline-end: var(--space-3);
    padding: 0 var(--space-3);
}
input[type="file"]::file-selector-button:hover { background: var(--color-button-tint-hover); }
/* A color input's swatch fills the control inside the input's own border: the input, the
   swatch's wrapper and the swatch carry no padding or border of their own, which browsers draw
   by default around the color. Each pseudo-element has a rule of its own, since a selector a
   browser does not know drops the whole rule it is listed in. */
input[type="color"] { padding: 0; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: var(--radius-card); }
input[type="color"]::-moz-color-swatch { border: none; border-radius: var(--radius-card); }
/* The size rules above are for the fields text is typed into. A checkbox or a radio is a 1rem
   glyph in the accent: stretched to the row, it would stand centered in a box the width of the
   row and push the label beside it to the far edge. */
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--color-accent);
    flex: none;
    height: 1rem;
    padding: 0;
    width: 1rem;
}

.notice {
    background: color-mix(in srgb, var(--color-danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-danger) 55%, transparent);
    border-radius: var(--radius-card);
    color: var(--color-text);
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
}
/* The one notice that reports something that worked rather than something that was refused.
   It reuses the box above and repaints it, so the two cannot drift apart in shape. */
.notice.success {
    background: color-mix(in srgb, var(--color-success) 12%, transparent);
    border-color: color-mix(in srgb, var(--color-success) 55%, transparent);
}
/* A list or a field with nothing in it yet. It is not a notice: nothing failed, so it is a
   dashed outline in the muted color rather than a tinted box. */
.empty {
    border: 1px dashed var(--line);
    border-radius: var(--radius-card);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    padding: var(--space-4);
    text-align: center;
}

/* The auto side margins center these pages, but they also switch off the stretch a grid
   item would otherwise get, leaving the box sized to its own content: the character form
   then narrows as soon as a lightweight NPC hides the stat grid. An explicit width fills
   the column up to the cap instead, so the content no longer sets the page width. */
.landing, .world-picker, .form-page {
    margin: var(--space-12) auto;
    max-width: 42rem;
    padding: 0 var(--space-4);
    width: 100%;
}
.landing, .world-picker, .form-page, .world-overview { display: grid; gap: var(--space-6); }
/* A panel: the panel color on the canvas, told apart from it by tone rather than by a border,
   which is what lets Travels' canvas sit lighter than its panels. A panel holding a page's
   content takes the widest padding, and one in a narrow column or a grid of several less. On the
   home page the log-in and register forms, each under its heading, are panels; Log out is
   a lone button and takes none. */
.landing h2 + form, .world-picker, .world-overview, .location-page, .table-stream, .form-page,
.character-sheet, .shell-widgets section {
    background: var(--color-panel);
    border-radius: var(--radius-surface);
    padding: var(--space-8);
}
.landing h2 + form, .world-card { padding: var(--space-6); }
/* The standalone pages' prose (the rolls guide's paragraphs and lead, the changelog's releases,
   the account's notes) is held to the reading measure inside its panel; the world cards' grid
   takes the panel's width. */
.world-picker > :is(p, ul, section, article):not(.world-cards) { max-width: var(--measure); }
.shell-widgets section { padding: var(--space-4); }
/* A card: a box inside a panel, a step lighter than it and likewise unbordered. */
.world-card, .character-directory, .character-form fieldset, .composer, .map-form, .scene-card,
.progress-track, .domain-card, .carried-item, .character-experience, .character-effect,
.character-saying {
    background: var(--color-card);
    border: 0;
    border-radius: var(--radius-card);
}
.world-cards { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.world-card { display: grid; gap: var(--space-3); }
/* One release on the changelog. The reset takes the margins off headings and paragraphs, so
   the entry spaces its own parts; the list keeps its bullets and its indent and gives up only
   the margins the grid already draws. */
.release, .guide-example { display: grid; gap: var(--space-2); }
.release ul { margin: 0; }
/* Releases follow one another down the page, each parted from the last by the hairline. */
.release + .release { border-top: 1px solid var(--line); padding-top: var(--space-6); }
/* The markup guide's lead: the paragraph a reader is meant to read before the markup, set
   off by a rule down its edge rather than by the notice box, which reports refusals. */
.guide-lead {
    border-inline-start: 3px solid var(--color-accent);
    display: grid;
    gap: var(--space-2);
    padding-inline-start: var(--space-4);
}
/* A guide example's own text — the text to type and the text it is stored as — sits in a
   well so it reads as something to copy. The stacking is the release list's rule above. */
.guide-example code {
    background: var(--color-well);
    border-radius: var(--radius-control);
    padding: var(--space-2) var(--space-3);
}
.description { overflow-wrap: anywhere; white-space: pre-wrap; color: var(--color-text-muted); }
.muted { color: var(--color-text-muted); }

.world-shell {
    display: grid;
    gap: var(--space-6);
    grid-template-columns: minmax(0, var(--shell-nav-width)) minmax(0, 1fr) minmax(0, var(--shell-widget-width));
    margin: 0 auto;
    max-width: 120rem;
    min-height: 100vh;
    padding: var(--space-6);
}

.shell-nav, .shell-content, .shell-widgets { align-self: start; }
/* Both side columns stay in view beside a long stream, each scrolling on its own where it is
   taller than the window. What opens from them (an effect's card) is a popover in the top
   layer, which their overflow does not clip. */
.shell-nav, .shell-widgets {
    max-height: calc(100vh - 2 * var(--space-4));
    max-height: calc(100dvh - 2 * var(--space-4));
    overflow-y: auto;
    position: sticky;
    top: var(--space-4);
}
/* The navigation is not a panel: it stands on the canvas, and only its rows take a ground. */
.shell-nav { display: grid; gap: var(--space-6); padding: var(--space-2); }
.shell-nav header, .shell-nav nav, .shell-widgets { display: grid; gap: var(--space-3); }
/* The world's name heads the navigation without being a heading: the page's own `h1` is the
   one heading of its level, so this paragraph carries the look an `h1` there had. */
.shell-nav .world-name {
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: bold;
    line-height: 1.15;
}
.shell-nav a { text-decoration: none; }
/* Every link in the navigation is a row, whether it is a top-level destination, a location or
   a table in a list, or an entry of the Game Master's fold: the raised panel's ground under the
   pointer, and that ground with the accent in bold on the link to the page being read. */
.shell-nav nav a {
    border-radius: var(--radius-card);
    color: var(--color-text);
    display: block;
    overflow-wrap: anywhere;
    padding: var(--space-1) var(--space-2);
}
.shell-nav nav a:hover { background: var(--color-panel-raised); color: var(--color-text); }
.shell-nav nav a[aria-current="page"] {
    background: var(--color-panel-raised);
    color: var(--color-accent-strong);
    font-weight: 700;
}
.shell-nav ul { display: grid; gap: var(--space-1); list-style: none; margin: 0; padding: 0; }
/* A button or a fold's summary in the navigation stands on the canvas rather than a panel, and
   the accent on the hover tint falls under 4.5:1 over Travels' canvas, the one lighter than its
   panels; the text color holds there. `:where` keeps the button's at the weight of
   `button:hover`, so a kind's own hover still wins; the summary's outweighs the fold's own
   color. */
:where(.shell-nav) button:hover, .shell-nav summary:hover { color: var(--color-text); }
/* A location holding posts this reader has not been past. The dot is drawn by the element
   itself, which holds nothing but the text a screen reader is given instead of it. */
.unread {
    background: var(--color-accent);
    border-radius: 50%;
    display: inline-block;
    height: 0.5em;
    margin-inline-start: var(--space-2);
    vertical-align: middle;
    width: 0.5em;
}
.shell-nav .gm-menu { border-top: 1px solid var(--line); margin-top: var(--space-2); padding-top: var(--space-4); }
.shell-content { display: grid; gap: var(--space-6); min-width: 0; }

.world-overview section, .location-page, .table-stream { display: grid; gap: var(--space-4); }
.map-form { padding: var(--space-4); }
.world-map, .location-image {
    background: var(--color-well);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    height: auto;
    max-width: 100%;
}
.scene-setting { display: grid; gap: var(--space-4); }
.scene-setting summary { cursor: pointer; width: fit-content; }
/* The grid gap above reaches only the summary and the fold's content box, so the content's own
   items sit flush. The paragraph after a picture or a mini-map takes its own margin; `~` rather
   than `+` because a level row and its script can stand between the mini-map and the text. */
.scene-setting > :is(.location-image, .mini-map) ~ p { margin-top: var(--space-3); }
.location-image { display: block; margin-inline: auto; max-height: 25rem; object-fit: contain; }
/* A scene's battle map drawn small in its setting, framed and bounded as the location's art is.
   Each token is a dot filled with its ring's color (the map page's `data-ring` rules below),
   rimmed and lettered in the rim's color, the rim's width written on each circle in proportion
   to its radius. The SVG is scaled down from the image's pixels, so the grid's strokes keep one
   screen width through `vector-effect`. */
.mini-map { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; margin: 0; }
.mini-map a { max-width: 100%; min-width: 0; }
.mini-map a > svg {
    background: var(--color-well);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    display: block;
    height: auto;
    max-height: 25rem;
    max-width: 100%;
    width: auto;
}
/* The row stepping a mini-map's levels, `‹ Level name ›`: the name is centered between the two
   buttons and cut short where it is long, so stepping moves neither button. */
.mini-map-levels {
    align-items: center;
    display: grid;
    gap: var(--space-2);
    grid-template-columns: auto minmax(0, 1fr) auto;
    margin-top: var(--space-2);
}
.mini-map-level-name { overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.mini-map-grid { opacity: 0.75; }
.mini-map-grid path { fill: none; vector-effect: non-scaling-stroke; }
.mini-map-grid .grid-halo { stroke: var(--color-battle-grid-halo); stroke-width: 3px; }
.mini-map-grid .grid-line { stroke: var(--color-battle-grid); stroke-width: 1px; }
.mini-map-token[data-ring="adversary"] { --token-ring: var(--color-token-adversary-fill); }
.mini-map-token circle { fill: var(--token-ring); stroke: var(--color-token-rim); }
.mini-map-token text { dominant-baseline: central; fill: var(--color-token-rim); font-family: var(--font-body); font-weight: 700; text-anchor: middle; }
/* A custom dot whose color is dark (`battle_map::is_dark_color`) is lettered light. A faded dot
   keeps its own lettering below. */
.mini-map-token.is-dark:not(.is-faded) text { fill: var(--color-token-name); }
/* A faded dot is drawn inverted and opaque: filled with the faded token, rimmed and lettered in
   its ring's color made gray, so it reads over any image and is not taken for a light ring. */
.mini-map-token.is-faded { filter: grayscale(1); }
.mini-map-token.is-faded circle { fill: var(--color-token-faded); stroke: var(--token-ring); }
.mini-map-token.is-faded text { fill: var(--token-ring); }
.shell-widgets section { display: grid; gap: var(--space-2); }
.world-date, .shell-widgets p { color: var(--color-text-muted); }

.character-directory, .character-form fieldset, .composer { padding: var(--space-4); }
/* A fieldset's legend is its card's label, inside the card: a floated legend is laid out as the
   fieldset's first child rather than over its top edge, and in a grid it takes the whole row. */
.character-form legend { float: left; grid-column: 1 / -1; margin-bottom: var(--space-3); padding: 0; width: 100%; }
/* The row of buttons a panel or a form ends with, the primary first, and the controls under one
   card. Inside this row the buttons are flex items, sized by their own labels. */
.directory-actions, .action-row, .card-controls {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}
/* A table's seating, which opens its page. The list of who sits there is plain text with a
   control beside each name, and the row under it holds whatever this viewer may do to the
   table itself.

   The list carries the columns and each seat spans them as a subgrid, so the name column is
   as wide as the longest name and every control starts at the same x whatever the name beside
   it reads. A seat with no control for this viewer simply leaves its second cell empty. The
   name column's floor is 0 rather than its content, because a name runs to 120 characters and
   a bare `max-content` track never wraps: one long name would push the controls off the page
   instead of wrapping under itself. */
.table-seating { display: grid; gap: var(--space-4); }
.table-members {
    display: grid;
    gap: var(--space-2) var(--space-4);
    grid-template-columns: minmax(0, max-content) max-content;
    list-style: none;
    margin: 0;
    padding: 0;
}
.table-members li {
    align-items: baseline;
    display: grid;
    grid-column: span 2;
    grid-template-columns: subgrid;
}
/* The table's own actions, in one line under the seating. `baseline` is what lines the
   rename fold's summary up with the controls beside it and keeps them there while it is
   open, which `center` would not. */
.table-actions { align-items: baseline; display: flex; flex-wrap: wrap; gap: var(--space-4); }
.character-table-wrap, .invite-table-wrap { overflow-x: auto; }
.character-table, .invite-table { border-collapse: collapse; width: 100%; }
.character-table th, .character-table td, .invite-table th, .invite-table td {
    border-bottom: 1px solid var(--line);
    padding: var(--space-2);
    text-align: left;
    vertical-align: middle;
}
.character-table th, .invite-table th { color: var(--color-text-muted); font-size: var(--text-sm); }
/* The world overview's directory holds up to three tables, each 100% wide with automatic
   layout, so each spreads its spare width over its own columns and their columns do not line
   up. Where the card's content box is at least 60rem wide (62rem with its padding), the first
   three columns (the character, the status and the player or creator) take the same fixed
   widths in every table and the rest share what is left. Below that the fixed widths would
   squeeze the player-character table's last three columns to their minimum, so the automatic
   layout stays. The card is a size container so that the condition follows its own width, which
   the side columns change as well as the window; its width already comes from the overview's
   column rather than its content, and every table scrolls inside its own wrapper. Only the
   header row carries `th` cells, so the counting follows the columns. A long unbroken word,
   such as a name without spaces, would otherwise widen its column in that one table, so the
   cells break such words; `anywhere` rather than `break-word` because only `anywhere` also
   lowers the cell's minimum content width, which is what the automatic layout holds the
   declared width against. */
.character-directory { container: character-directory / inline-size; }
@container character-directory (min-width: 60rem) {
    .character-directory .character-table th:nth-child(1) { width: 15rem; }
    .character-directory .character-table th:nth-child(2) { width: 6rem; }
    .character-directory .character-table th:nth-child(3) { width: 11rem; }
    .character-directory .character-table td { overflow-wrap: anywhere; }
}
.character-cell { align-items: center; display: flex; gap: var(--space-3); }
.directory-portrait {
    border-radius: var(--radius-control);
    flex: 0 0 44px;
    height: 44px;
    object-fit: cover;
    width: 44px;
}
.stacked-pair { display: grid; gap: var(--space-1); }
.character-summary { align-items: flex-start; display: flex; gap: var(--space-3); margin-top: var(--space-3); }
.character-widget img { aspect-ratio: 1; border-radius: var(--radius-control); flex: 0 0 4rem; object-fit: cover; width: 4rem; }
.character-sheet { container-type: inline-size; display: grid; gap: var(--space-6); }
/* Half a line under the section title and between features; the global margin reset
   would otherwise set the feature names hard against both. */
.rule-features { display: grid; gap: var(--space-2); }
/* The sheet's header: the portrait, then the kind, the name, the level line and the status
   stacked beside it, and the sheet's own actions at the right edge, which wrap under the rest
   where the row has no room for them. */
.character-sheet > header { align-items: flex-start; display: flex; flex-wrap: wrap; gap: var(--space-4); }
.character-sheet > header > div:not(.action-row, .portrait) {
    display: grid;
    flex: 1 1 14rem;
    gap: var(--space-1);
    justify-items: start;
}
.sheet-actions { justify-content: flex-end; margin-left: auto; }
/* The sheet's actions are a narrow column beside the name, too narrow for Mark deceased's
   question, so while that fold is open the row takes a line of the header to itself and the
   question wraps to the header's width. */
.sheet-actions:has(> details.confirm[open]) { flex-basis: 100%; }
.character-sheet .portrait {
    border-radius: var(--radius-surface);
    flex: none;
    height: 7rem;
    object-fit: cover;
    width: 7rem;
}
.portrait-placeholder {
    align-content: center;
    background: var(--color-well);
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    text-align: center;
}
.stat-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); }
/* An NPC form with the stats box unchecked hides the grid; a PC form has no such checkbox,
   so its grid is always shown. */
form:has(input[name="has_stats"]:not(:checked)) .stat-grid { display: none; }
/* A note inside a grid takes a whole row rather than one cell beside the inputs. */
.stat-grid p { grid-column: 1 / -1; margin: 0; }
/* The six traits are one row of boxes on the well, three to a row where the sheet is narrow:
   the sheet is a size container, so this follows its own width in the dialog and on the page
   alike. The dt lays the trait's name and the spellcast die out as a row; the die never
   shrinks, and overflow-wrap is what lets the word break inside its box at the narrowest
   track, a flex item's min-content width being otherwise the whole word. */
.stats { display: grid; gap: var(--space-2); grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; }
@container (max-width: 34rem) {
    .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.stats dt {
    align-items: center;
    color: var(--color-text-muted);
    display: flex;
    font-size: var(--text-sm);
    gap: var(--space-1);
    overflow-wrap: anywhere;
}
.stats div { background: var(--color-well); border-radius: var(--radius-card); padding: var(--space-2) var(--space-3); }
.stats dd { font: 700 var(--text-lg)/1.2 var(--font-display); margin: 0; }
.status { text-transform: capitalize; }

/* Text for a screen reader and nothing else: each pip is a square with no writing on it, so
   the button carries what clicking it will do where only a reader that needs it will find it.
   The size and the clip are what keep it out of the layout without hiding it from the
   accessibility tree, which `display: none` would do. */
.visually-hidden {
    clip-path: inset(50%);
    height: 1px;
    min-height: 0;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}
/* One pool: its name and count above, its pips below. The row is the unit htmx swaps, so it
   is what the write answers with and nothing outside it moves. */
/* The sheet lays its pools out side by side, as many to a row as fit; the sidebar's copy of the
   same rows keeps one to a row, its column being narrow. */
.pool-tracks { display: grid; gap: var(--space-3); }
.character-sheet .pool-tracks { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
/* The heading and a failed read's notice each take the whole row: the tracks flow around them
   otherwise, leaving either stranded in one column beside a pool. */
.character-sheet .pool-tracks > h2,
.character-sheet .pool-tracks > .notice { grid-column: 1 / -1; }
/* The Identity list is one row of facts across the sheet, each its muted term over its value,
   wrapping onto further lines where the sheet is narrow. */
.character-identity dl {
    display: flex;
    flex-wrap: wrap;
    font-size: var(--text-sm);
    gap: var(--space-2) var(--space-8);
    margin: 0;
}
.character-identity dl > div { display: flex; flex-direction: column; }
/* The features run in two columns under the identity where the sheet is at least 44rem wide,
   one column below that: the sheet is a size container, so this follows its width in the
   dialog and on the page alike. Each section stays whole in one column, and the browser
   balances the two columns' heights. */
@container (min-width: 44rem) {
    .sheet-features { column-gap: var(--space-8); columns: 2; }
}
.sheet-features > section { break-inside: avoid; }
.sheet-features > section + section { margin-top: var(--space-4); }
/* Each listed feature is one paragraph, its name in bold in the display font running into its
   text, as a one-line feature's name is printed. */
.rule-features article > * { display: inline; }
.rule-features h3, .feature-name {
    font-family: var(--font-display);
    font-size: inherit;
    font-weight: 700;
    line-height: inherit;
}
.rule-features h3 { margin-right: 0.35em; }
.character-identity dt { color: var(--color-text-muted); }
.character-identity dd { margin: 0; }
.pool-track, .resource-track { display: grid; gap: var(--space-1); }
.pool-summary { align-items: baseline; display: flex; gap: var(--space-2); margin: 0; }
.pool-name { font-family: var(--font-display); }
.pool-count { color: var(--color-text-muted); font-size: var(--text-sm); }
/* Each pip is its own form, so the row lays the forms out rather than the buttons. */
.pips { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.pips form { display: contents; }
/* Every pip is a symbol rather than a box: a heart for HP, a shield for Armor, a spark for
   Hope, a bolt for Stress, an eight-armed star for Chaos, a sword for a progress track and a
   hexagonal token for a class resource. The pip is the icon alone, sized to the square the
   boxes used to have. Each symbol is drawn twice, once per state, and each drawing carries its
   own fills, fill opacities and stroke widths: an empty pip is an outline barely tinted, a
   filled one the same outline more strongly tinted with a highlight line over it. So nothing
   about the drawing is set here — a rule here would fight a presentation attribute the body
   carries — and this file supplies only the color, which the bodies read as `currentColor`.
   `fill-rule` is no longer set either; every body fills as drawn under the default `nonzero`. */
.pip, .effect-icon {
    background: none;
    border: 0;
    border-radius: var(--radius-mark);
    display: block;
    font-size: 1.25rem;
    line-height: 0;
    min-height: 0;
    padding: 0;
}
.pip { color: var(--color-text-muted); }
/* A marked pip is the accent, which is the one color this app spends on what is in play. */
.pip.filled { color: var(--color-accent-strong); }
button.pip:hover { background: none; color: var(--color-accent-strong); }

/* The directions a scene's end may send the Chaos dial, in one row under its tally. Every button
   in it is an ordinary button of the same size, so the recommended direction is marked by a ring
   drawn outside its border, which changes no box and so moves nothing beside it. The ring is a
   shadow rather than an outline, leaving `outline` to the focus rule, which would otherwise be
   outranked on the recommended button. The token toolbar marks the size and level a token has
   now with the same ring. */
.scene-controls .recommended, .token-toolbar [aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-accent-strong); }

/* The Chaos dial in the shell's widget column. It is read here and moved only at a scene's
   end, so the row carries no buttons and the spacing is all this rule sets. */
.chaos-widget .chaos-track { margin-top: var(--space-2); }

/* What the group is fighting through, above the stream that narrates it. Tracks sit side by
   side: two share a row of the content column, and a third wraps under them. */
.track-list { display: grid; gap: var(--space-3); }
/* The same grid holds a character's domain cards and what it carries, on the sheet: a loadout
   is three cards and a vault a handful, so two share a row and the rest wrap under them. */
.track-grid, .card-grid {
    display: grid;
    gap: var(--space-3);
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.track-grid:empty, .card-grid:empty { display: none; }
/* A track's box in the scene's list: its name's line (the name, the kind's badge and the count),
   with the archive control at that line's right edge, then its pips and a finished track's line,
   each on a line of its own, ordered after the archive control's open confirmation, which so
   stands directly under the name's line. The token toolbar's lean copy keeps its own row. The grid stretches
   the box to its row's height, and a wrapping flex container would share that extra height
   between its lines; `align-content: start` keeps the lines packed at the top instead. */
.track-grid > .progress-track { align-content: start; align-items: center; flex-flow: row wrap; }
.track-grid > .progress-track > .pool-summary { flex: 1 1 0; flex-wrap: wrap; min-width: 0; }
.track-grid > .progress-track > :is(.pips, p.muted) { flex-basis: 100%; order: 2; }
/* One box in either grid. The grid stretches a box to the height of the tallest one on its
   row, and the box lays its own content out as a flex column: the text stacks from the top and
   `align-items: start` sizes each child by its content instead of stretching it across the box,
   which is what keeps the controls row and the pip rows the width of what they hold. Any height
   left over by the row goes to whichever child claims it, which is the rule below. */
.progress-track, .domain-card, .carried-item, .character-experience, .character-effect,
.character-saying {
    align-items: start;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
}
/* The controls under a card, an item, an Experience, an effect or a saying, the Rewrite fold
   first among them. `margin-top: auto` absorbs the box's surplus height above the controls, so
   the group sits at the bottom of the box and the controls of every box on a row line up,
   however much text each one carries above them. */
.card-controls { margin-top: auto; }

/* A character's domain cards, what it carries and the milestones behind it, on the sheet. All
   of them sit in the same boxes the tracks do. */
.domain-cards, .character-items, .character-experiences, .character-milestones,
.character-effects, .character-sayings {
    display: grid;
    gap: var(--space-3);
}
/* A heading row: the heading at the left, the controls (the folds that add to the section, a
   Game Master's milestone controls, the link editing a location, a scene's buttons) at the
   right, wrapping under it where the row is narrow. Every line the row wraps to keeps its
   controls at the right edge. Opening a fold moves no control: its content stands under the
   whole row, across the section's width. The rules here are the fallback for a browser without
   `::details-content`, where an open fold takes a line of its own with its summary at the right
   edge and a control after it stands under its content. */
.section-head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    justify-content: flex-end;
}
.section-head > :is(h1, h2) { margin-right: auto; }
.section-head > details[open] { flex-basis: 100%; }
.section-head > details[open] > summary { margin-left: auto; }
/* `display: contents` drops the fold's own box, so its summary and its content slot are items of
   the row and the fold's `flex-basis` above has no box to act on. The open summary's
   `margin-left: auto` would split the row's free space with the heading's and pull the summary
   away from the controls before it, so it is reset. An open fold's content takes a full line,
   and `order` places it after every control of the row: the fold stays one element in the
   markup, so focus still goes from a summary to its content and then to the next control. A
   closed fold's content is no item at all, since as an item of no height it would still claim a
   wrapped line and the row's gap. That gap is the one space between the controls and the
   content, so a form or grid opening the content drops the margin it takes under a summary
   elsewhere (the `.scene-form` rule below, which this one outweighs). Where a row holds two
   folds, they share an HTML `name`, so at most one is open under it.
   A confirming fold (`details.confirm`) stands in a flex row of controls the same way: the sheet's
   actions, a track's name line, a scene's Chaos directions, a token in the drawer's list. Its
   content is given no width of its own (`contain: inline-size`), so the sentence wraps to the
   row rather than widening it, which in the sheet's header would move the row's controls. */
@supports selector(::details-content) {
    :is(.section-head > details, details.confirm) { display: contents; }
    :is(.section-head > details, details.confirm)[open]::details-content { flex-basis: 100%; order: 1; }
    :is(.section-head > details, details.confirm):not([open])::details-content { display: none; }
    details.confirm[open]::details-content { contain: inline-size; }
    .section-head > details[open] > summary { margin-left: 0; }
    .section-head > details > summary + :is(form, .card-grid, .track-grid) { margin-top: 0; }
}

/* An item's picture: a thumbnail on its row, framed on the well the other recessed surfaces
   use, and the whole image in a popover card opened from it. The thumbnail is decorative — the
   button beside it carries the name — and the card's image is the one that describes itself. */
.item-thumb {
    background: var(--color-well);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-control);
    display: block;
    line-height: 0;
    min-height: 0;
    padding: 0;
}
/* `button:hover` paints every button a tinted ground, which would swallow the frame this one
   is drawn as. The class with the hover pseudo-class outweighs the element with it, so naming
   the well again here is what keeps the frame, and an effect's symbol, which has the same
   shape, keeps the well under the pointer the same way. */
.item-thumb:hover, .effect-icon:hover { background: var(--color-well); }
.item-thumb img { border-radius: var(--radius-control); height: 3.5rem; object-fit: cover; width: 3.5rem; }
.item-image-card img { border-radius: var(--radius-control); display: block; max-height: 80vh; }

/* An item may print two perk lines: the one its weapon type carries, which is the same text
   for every weapon of that type, and the enchantment its owner wrote. The tint is what tells
   the written line from the derived one where an item carries both. */
.item-enchantment { color: var(--color-accent-strong); }

/* Which way an effect cuts, which is the one place its kind becomes a color. The sheet tints
   the word beside the name and the sidebar tints the symbol; both read the same token. */
.effect-buff { color: var(--color-buff); }
.effect-debuff { color: var(--color-debuff); }
/* The effects on the reader's own character, under its pools in the widget column: one symbol
   each, drawn like a marked pip and tinted by kind, opening a card that names the effect and
   prints its note. The symbol is decorative — the button carries the name as text. As with a
   pip, the drawing carries its own strokes and fill opacity, so this file sets only the
   color the body reads as `currentColor`; the box is the pip's, with the pip's rule. */
.effect-icons {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    list-style: none;
    margin: var(--space-3) 0 0;
    padding: 0;
}
/* Hovering a symbol must not take its kind's color off it or put a button's ground behind it.
   `button:hover` carries one element and one pseudo-class and so outweighs the kind's class on
   its own; adding the element to the kind's selector outweighs it back, which is what
   `button.pip:hover` does for a pip. The well is the ground the symbol takes instead (with the
   item thumbnail's hover, above). */
button.effect-buff:hover { color: var(--color-buff); }
button.effect-debuff:hover { color: var(--color-debuff); }
/* Where anchor positioning exists the card opens against the symbol that opened it, exactly as
   a roll's card opens against its chip. Every symbol carries the same anchor name, so each
   effect's own `<li>` confines that name to the one pair — without the scope the name resolves
   across the whole list and a card lands beside another effect's symbol. Both properties are
   required, a browser with the name but not the scope doing exactly that; without either the
   card stays centered in the viewport, which the top layer makes safe. */
@supports (anchor-name: --effect-icon) and (anchor-scope: --effect-icon) {
    .effect-icons li { anchor-scope: --effect-icon; }
    .effect-icon { anchor-name: --effect-icon; }
    .effect-card {
        margin: var(--space-1) 0 0 0;
        position-anchor: --effect-icon;
        position-area: bottom span-right;
        position-try-fallbacks: flip-block, flip-inline;
    }
}
/* The inventory form asks for an enchantment only where the item was marked magical, and for
   the choice between an enchantment on top of the weapon type's perk and one replacing it only
   where the item is both a weapon and magical. The trait a weapon is swung with is asked for
   only where the item is a weapon at all. Hiding is the whole of what this does: a hidden
   field still submits what it holds, and the write reads the checkbox rather than the text, so
   unticking the box is what makes an item mundane again. A browser without `:has` shows every
   field, which is a form that still works. */
form:has(input[name="magical"]:not(:checked))
    :is(.enchantment-label, .enchantment-field, .replaces-choice),
form:has(select[name="weapon_type"] option[value=""]:checked)
    :is(.replaces-choice, .attack-trait-label, .attack-trait-field) {
    display: none;
}
/* A checkbox and its words on one line, the form's grid laying out the pair rather than each. */
.magical-choice, .replaces-choice, .checkbox-line {
    align-items: center;
    display: flex;
    gap: var(--space-2);
}
/* The cards in hand, in the shell's widget column: names alone, under the pools. */
.loadout-list { display: grid; gap: var(--space-1); list-style: none; margin: 0; padding: 0; }

/* The level-up screen: the options a milestone may buy, one radio each, with the fields that
   option needs under it. */
.milestone-picks { display: grid; gap: var(--space-3); }
.milestone-option { display: grid; gap: var(--space-2); }
.milestone-option > label { align-items: baseline; display: flex; gap: var(--space-2); }
.milestone-fields { display: grid; gap: var(--space-2); padding-left: var(--space-4); }
/* Only the chosen option's fields are shown, and only the one training that names an
   Experience asks for one. Hiding is the whole of what this does: no field here is `required`,
   and the write reads only the fields of the pick it was given, so a browser without `:has`
   shows every field and the form still works. */
.milestone-option:not(:has(input[name="pick"]:checked)) .milestone-fields,
.milestone-training:not(:has(option[value="intelligent"]:checked))
    .milestone-training-experience {
    display: none;
}
/* Each completed milestone as the sheet lists it: what it bought, in one line. The list is
   ordered, so the browser draws the numbers; the marker is muted to sit behind the line the
   way the counts beside a tracker's name do. */
.milestone-list { display: grid; gap: var(--space-1); margin: 0; padding-left: var(--space-6); }
.milestone-list li::marker { color: var(--color-text-muted); font-size: var(--text-sm); }

.action-row form { display: inline; }

/* A post is prose rather than a box: posts are parted by a hairline with the stream's gap
   above it and the post's own padding below, the two the same. */
.post-stream { display: grid; gap: var(--space-6); }
.post {
    border-top: 1px solid var(--line);
    column-gap: var(--space-4);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    padding-top: var(--space-6);
}
/* The header dissolves into the post's grid, so the portrait takes a left column of its own
   beside the byline and the body, which stack in the right one, spaced by a margin. */
.post-header { display: contents; }
.post > *, .post-header > * { grid-column: 2; }
.post-portrait {
    align-self: start;
    border-radius: var(--radius-control);
    grid-column: 1;
    grid-row: 1 / span 2;
    height: 44px;
    object-fit: cover;
    width: 44px;
}
.post-byline { align-items: baseline; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.post > .post-body { margin-top: var(--space-3); }
/* The author's Edit and Delete stand at the end of the byline, at the column's right edge. */
.post-byline .post-controls { margin-left: auto; }
/* Sized close to body text so it fits the byline, and bold so the actor's name is still
   the part that stands out in it. */
.post-byline .sheet-link {
    font-family: var(--font-display);
    font-size: var(--text-base);
    font-weight: 700;
}
/* .post-source names where a post in a merged stream was written, and reads as a byline
   detail rather than as the post's own heading. */
.post-time, .post-author, .post-edited, .post-source { color: var(--color-text-muted); font-size: var(--text-sm); }
/* The body is set in the text color rather than the muted one `.description` gives it. It runs
   to 133ch, about twice the reading measure, so that a post uses most of a wide column; past
   that a line grows long enough that the eye loses its way back to the start of the next one,
   so the limit stays. A narrower column, or a parent held to its own width, wraps it sooner. */
.post-body { color: var(--color-text); line-height: 1.65; margin: 0; max-width: 133ch; }
/* Wide enough for the composer this also carries: a post runs to 4000 characters, so a
   narrower textarea would cost more in writing comfort than the width saves. Content
   taller than the viewport scrolls inside the dialog rather than out of it: the dialog clips
   to its rounded corners and its body is what scrolls, so the scrollbar stays inside the
   corners. The body is a column item allowed to shrink below its content to the dialog's
   maximum height. `display` is set on the open dialog alone, since on the closed one it would
   override the browser's `display: none` and show it. */
.sheet-popover {
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-surface);
    box-shadow: var(--shadow-float);
    color: var(--color-text);
    max-height: 85vh;
    max-width: 54rem;
    overflow: hidden;
    padding: 0;
    width: 92vw;
}
.sheet-popover[open] { display: flex; flex-direction: column; }
/* A sheet fragment is one panel that spaces its own children; a post form is several
   sibling elements that do not, and paragraphs have no margin of their own here. */
.popover-body { display: grid; gap: var(--space-3); }
/* Positioned so that what is absolutely positioned inside it (a visually hidden label, the
   composer's empty preview region) scrolls with it rather than adding overflow to the
   dialog, which clips. */
.sheet-popover > .popover-body { min-height: 0; overflow: auto; padding: var(--space-4); position: relative; }
/* The dialog is the sheet's panel there, so the sheet drops the ground and padding it takes on
   a page of its own. */
.popover-body > .character-sheet { background: none; padding: 0; }
.sheet-popover::backdrop { background: var(--color-backdrop); }
/* The line saying an htmx write failed, held at the bottom of the window whatever the scroll.
   It lies over the page, so the notice's tint is laid over the panel color to stay opaque.
   Empty, it keeps no padding or border and so draws nothing, while staying in the
   accessibility tree, which a live region has to be before its text arrives. The dialog's copy
   is fixed too: a modal dialog does not clip it, and it renders in the dialog's top layer. */
.request-failure {
    background: linear-gradient(color-mix(in srgb, var(--color-danger) 12%, transparent) 0 0),
        var(--color-panel);
    bottom: var(--space-4);
    box-shadow: var(--shadow-float);
    left: var(--space-4);
    margin: 0 auto;
    max-width: 36rem;
    position: fixed;
    right: var(--space-4);
    z-index: 5;
}
.request-failure:empty { border: 0; box-shadow: none; padding: 0; }
/* While a line shows, the page keeps room for it at the bottom, and the dialog's scrolling body
   for the dialog's own, so nothing is left under it at the end of a scroll: the line's rendered
   height and the offset it stands at. post-stream.js measures the height, which grows as a long
   message wraps, into `--failure-height` on the body and on the dialog, whose body inherits it. */
body:has(> .request-failure:not(:empty)),
.sheet-popover:has(> .request-failure:not(:empty)) > .popover-body {
    padding-bottom: calc(var(--failure-height, 0px) + var(--space-4));
}
.post-controls { display: flex; gap: var(--space-3); font-size: var(--text-sm); }
/* The actor picker shows a single name, so it is sized to its content rather than to the
   form column: `justify-self` is what stops a grid item from stretching. */
.composer select { justify-self: start; max-width: min(100%, 22rem); }
/* The remaining-characters hint. post-stream.js unhides it for the last stretch of the
   limit and adds `danger` closer to it; the muted color comes from the class the server
   renders alongside, and the two-class selector is what lets `danger` win over it. */
.composer-count, .composer-hint { font-size: var(--text-sm); margin: 0; }
.composer-hint { overflow-wrap: anywhere; }
.composer-count.danger { color: var(--color-danger); }
/* The region a composer's Preview fills, last in the form. Empty, it is taken out of flow: an
   absolutely positioned child is no grid item, so it takes no track and no row gap, and the
   form ends where it did before. It stays rendered rather than hidden, since a live region that
   appears together with its text is not reliably announced. */
.composer-preview:empty { position: absolute; }
/* The preview block, set apart from the composer by tone alone. Its body is the stream's own
   rendering; post-stream.js adds `outdated` when the text or the actor changes under it. */
.post-preview {
    background: var(--color-well);
    border-radius: var(--radius-card);
    display: grid;
    gap: var(--space-3);
    padding: var(--space-4);
}
.post-preview .notice { display: grid; gap: var(--space-2); }
.preview-unread { display: grid; gap: var(--space-1); margin: 0; padding-left: var(--space-4); }
.preview-unread code { overflow-wrap: anywhere; }
.post-preview.outdated > :not(.eyebrow, .preview-outdated) { opacity: 0.5; }
/* The button that opens the fuller roll examples and the chip a roll's label is set in look
   the same: the type of the text around them, a thin outline and no fill, so neither reads as
   a badge. `popovertarget` is the whole mechanism in both, so each works with scripting off
   and takes focus like any other button; the chip is a label for a hidden button (see
   `roll_card`). Only how each sits in its line differs, which is what the rules below carry. */
.hint-more, .roll-chip {
    background: none;
    border: 1px solid var(--color-border);
    color: inherit;
    font: inherit;
    padding: 0 var(--space-2);
}
/* The button keeps the chip's line box rather than a control's height and radius. */
.hint-more { border-radius: var(--radius-control); display: inline-block; min-height: 0; }
.hint-more:hover, .roll-chip:hover, .roll-chip:has(+ .roll-chip-button:focus-visible) {
    background: none;
    border-color: var(--color-accent);
    color: var(--color-accent-strong);
}
/* The button a chip labels is visually hidden and cannot show a focus ring, so the chip shows
   the one `:focus-visible` gives a button. */
.roll-chip:has(+ .roll-chip-button:focus-visible) {
    outline: 2px solid var(--color-accent-strong);
    outline-offset: 2px;
}
/* The hint's button follows the sentence it was written after. */
.hint-more { margin-inline-start: var(--space-2); }
/* The examples themselves. The card takes the same box as a roll's breakdown (see
   `.roll-card` below) but no anchor name, so it opens centered in the top layer; Esc and a
   click outside close it. Each example is the markup to type with a line on what it shows. */
.hint-examples { display: grid; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.hint-examples li { display: grid; font-size: var(--text-sm); gap: var(--space-1); }
.hint-examples code { color: var(--color-text); }
.hint-examples code, .guide-example code { overflow-wrap: anywhere; }
.hint-examples span { color: var(--color-text-muted); }
.stream-pages, .stream-ends {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
}
.stream-pages { font-size: var(--text-sm); }
.stream-ends { justify-content: space-between; }
/* The page links, the export and the jump are quiet compact buttons. `margin-left: auto` keeps
   the export and the jump together at the end of the row, with the row's own gap between them. */
.stream-export { margin-left: auto; }
/* The switcher is sized by its content rather than stretched across the card, so the one-field
   form takes a single row rather than stacking a full-width input and button the way the world
   and character forms do. */
.scene-switcher { align-items: baseline; display: flex; flex-wrap: wrap; gap: var(--space-3); }
.scene-switcher select { max-width: min(100%, 26rem); }
/* A fold's summary is drawn by what the fold is for. One that opens a form to add or change
   something is a section's action, a small secondary button with its disclosure marker kept
   inside it. One whose main content is a list or a menu (the vault, what is carried, the
   finished tracks, the Game Master's navigation) carries `quiet` on its `<details>`, even where
   a form stands at its end, and draws the same button without its ground, as does a Rewrite
   among a card's own controls. The battle map bar's two folds keep the hover tint while open,
   their drawer hanging from the bar rather than under the summary. */
.scene-form > summary, .battle-map-controls > summary {
    background: var(--color-button-tint);
    border-radius: var(--radius-control);
    color: var(--color-accent-strong);
    cursor: pointer;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--control-h-sm);
    padding: 0 var(--space-3);
    width: fit-content;
}
.scene-form.quiet > summary, .card-controls > .scene-form > summary { background: transparent; }
.scene-form > summary:hover, .battle-map-controls > summary:hover,
.battle-map-controls[open] > summary { background: var(--color-button-tint-hover); }
/* An open Rewrite fold takes the whole width of its card, the other controls wrapping under it. */
.card-controls:has(> details[open]) { align-self: stretch; }
.card-controls > details[open] { flex-basis: 100%; }
.scene-state { width: fit-content; }
/* A confirming fold's summary carries the kinds of the button it stands for, and with them that
   button's box, which is not a list item and so draws no marker; WebKit draws its own. The
   sentence stands over the form whose submit is the act. */
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm > p { margin-bottom: var(--space-2); }
/* A fold's own form, and the grid of cards or tracks a quiet fold opens on, stands under its
   summary; a form further in, under a card inside the vault or the carried fold, keeps its place
   in its row. */
.scene-form > :is(form, .card-grid, .track-grid) { margin-top: var(--space-3); }
/* The battle map's form holds no element of its own, its fields standing inside the scene form
   and naming it, so it takes no room. */
.scene-form form:empty { display: none; }
/* The edit form's choice between a scene image and a battle map shows the chosen one's fields
   alone, and while the map is chosen hides the scene form's own submit button, so the upload is
   the one action shown. A browser without `:has` shows both, and each still posts to its own
   route. */
.picture-choice { border: 0; display: grid; gap: var(--space-2); margin: 0; min-inline-size: 0; padding: 0; }
.picture-choice legend { color: var(--color-text-muted); font-size: var(--text-sm); font-weight: 700; padding: 0; }
.scene-picture-fields, .map-picture-fields { display: grid; gap: var(--space-2); }
.picture-choice:has(input[name="picture_kind"][value="map"]:checked) .scene-picture-fields,
.picture-choice:has(input[name="picture_kind"][value="image"]:checked) .map-picture-fields,
.scene-form form:has(input[name="picture_kind"][value="map"]:checked) > button[type="submit"] {
    display: none;
}
.cast-list { display: grid; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.cast-list li { align-items: center; display: flex; gap: var(--space-2); }
.cast-portrait { border-radius: var(--radius-control); flex: 0 0 32px; height: 32px; object-fit: cover; width: 32px; }
/* A roll stands inside the prose it was written in, so the chip is inline; the body around
   it is `pre-wrap`, which the chip and the card both opt out of, so a label's own line
   breaks and space runs render the same in either. Each tier sets one tint, which the
   card's verdict and the panel's line read. */
.roll-critical { --roll-tint: var(--color-critical); }
.roll-success-hope { --roll-tint: var(--color-success); }
.roll-success-fear { --roll-tint: var(--color-accent); }
.roll-failure-hope { --roll-tint: var(--color-text-muted); }
.roll-failure-fear { --roll-tint: var(--color-danger); }
/* A reaction is judged outside the Hope and Fear economy, so its three tiers take the plain
   readings of the same tints: the critical keeps the one criticals are known by, and success
   and failure take the palette's green and red with nothing between them. */
.roll-reaction-critical { --roll-tint: var(--color-critical); }
.roll-reaction-success { --roll-tint: var(--color-success); }
.roll-reaction-failure { --roll-tint: var(--color-danger); }
/* A fate check answers a question rather than beating a Difficulty, so its four tiers take the
   plain yes and no readings of the same green and red. */
.fate-yes-and, .fate-yes { --roll-tint: var(--color-success); }
.fate-no, .fate-no-and { --roll-tint: var(--color-danger); }
/* The wrapper only groups a chip with its own card; it must not become a box of its own in
   the middle of the prose. */
.roll { display: inline; }
/* The chip is the roll's label set in the reader's prose, so a post reads as a post and
   everything the roll consisted of stays in the card behind it. It is an inline element, so
   a label longer than the room left on its line breaks across lines like the words around
   it, and `box-decoration-break: clone` gives each line's piece its own border and padding.
   Its padding is inline only (see the shared rule above), which keeps the outline off the
   text without growing the line box; the margin keeps two chips written back to back from
   painting one border against the other. */
.roll-chip {
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    cursor: pointer;
    display: inline;
    margin-inline: var(--space-1);
    white-space: normal;
}
/* The card is a popover, so it is drawn in the top layer: however long the breakdown, it
   cannot stretch a post or push the stream around. Its laid-out state is the default here
   because a browser without the Popover API ignores both the `popover` attribute and the
   `popovertarget` on the chip: the button opens nothing, so the card is left standing in the
   flow under it as a breakdown the reader can still read. */
.roll-card, .hint-card, .effect-card, .item-image-card {
    background: var(--color-panel-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-float);
    color: var(--color-text);
    display: grid;
    gap: var(--space-2);
    max-height: 80vh;
    max-width: min(26rem, 92vw);
    overflow-y: auto;
    padding: var(--space-4);
    white-space: normal;
}
/* A closed popover must not lay itself out, so a card is hidden until it is opened. The rule
   states the closed state rather than the open one on purpose, and is the whole feature guard:
   a browser that does not know `:popover-open` cannot parse the selector, and an invalid
   selector makes the browser drop the rule it belongs to. Such a browser is exactly the one
   that ignores the `popover` attribute and the chip's `popovertarget` as well, so dropping
   this rule leaves the card laid out in the flow under the chip, which is the fallback. */
.roll-card:not(:popover-open), .hint-card:not(:popover-open),
.effect-card:not(:popover-open), .item-image-card:not(:popover-open) { display: none; }
.roll-card-name { font-family: var(--font-display); font-weight: 700; }
.roll-card-question { font-style: italic; }
.roll-card-tier { color: var(--roll-tint); font-weight: 700; }
/* A critical card holds the dice and this line and nothing else, so the verdict is set in
   capitals there. The casing is presentation only: the tier's own label stays as it is
   written, which is what the rolls panel and everything else read. The compound selector is
   what keeps the panel's one-line entry out of it. */
.roll-card-tier.roll-critical, .roll-card-tier.roll-reaction-critical,
.roll-card-tier.fate-yes-and, .roll-card-tier.fate-no-and { text-transform: uppercase; }
/* The word marking a reaction sits in the verdict's line but is not part of the verdict, so
   it is set back to the body weight and the muted color while the tier keeps the tint. */
.roll-card-kind { color: var(--color-text-muted); font-weight: 400; }
.roll-breakdown { display: grid; font-size: var(--text-sm); gap: var(--space-1); list-style: none; margin: 0; padding: 0; }
.roll-breakdown li { display: flex; gap: var(--space-4); justify-content: space-between; }
/* A die's row carries its icon and its name. Only the icon is tinted: the words stay in the
   card's own text color, so the die is named at full contrast whatever the tint does. */
.roll-die { align-items: center; display: inline-flex; gap: var(--space-2); }
.roll-die-hope, .roll-die-fear, .roll-die-fate, .roll-die-combo { display: inline-flex; }
/* .muted dims a row by its color, and the combo die reads no currentColor, so a die below the
   hit is dimmed by opacity instead. */
.roll-breakdown li.muted .roll-die-combo { opacity: .45; }
/* The same silhouette beside a trait the character's subclass casts with. The icon is
   decorative and the visually-hidden text beside it is what names it, so the color carries
   nothing on its own. */
.spellcast-die { display: inline-flex; flex-shrink: 0; }
.roll-breakdown .roll-total { border-top: 1px solid var(--line); font-weight: 700; padding-top: var(--space-1); }
/* Where anchor positioning exists the card opens against the chip that opened it. Every
   chip carries the same anchor name, so the wrapper confines each name to its own roll —
   without that scope the name resolves across the whole stream and a card lands beside
   somebody else's chip. Both properties are required here because a browser with the name
   but not the scope would do exactly that; without either the card stays centered in the
   viewport, which the top layer makes safe. */
@supports (anchor-name: --roll-chip) and (anchor-scope: --roll-chip) {
    .roll { anchor-scope: --roll-chip; }
    .roll-chip { anchor-name: --roll-chip; }
    .roll-card {
        margin: var(--space-1) 0 0 0;
        position-anchor: --roll-chip;
        position-area: bottom span-right;
        position-try-fallbacks: flip-block, flip-inline;
    }
}

/* One line per roll, in the narrow widget column: the actor, what was rolled, and how it
   landed, each on its own row so a long name or label wraps instead of squeezing the tier. */
.roll-log { display: grid; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.roll-log li { display: grid; gap: 0; }
.roll-log-name { font-family: var(--font-display); }
.roll-log-tier { color: var(--roll-tint); font-size: var(--text-sm); }

/* The scene being read, as one card: the switcher, the header, the setting, the row of the
   scene's controls (a heading row without a heading) and its end, each spanning the card. The
   second track is the switcher's when the card is wide enough to give the header the first row's
   left side and the switcher its right; otherwise nothing stands in it alone, so it takes no
   width and every item spans the card, the switcher first, as the markup has them. The track
   grows to at most 30rem, the label beside a select at its 26rem limit, and the button shown
   without scripting wraps under the select where the three do not fit. The switcher's
   `min-width: 0` is what keeps a long option from squeezing the header: a grid item's automatic
   minimum is its min-content width, which for the select is its longest option, and the track
   never shrinks below its item's minimum, whatever its 30rem limit.
   The card is a size container so that the condition follows its own width, which the side
   columns change as well as the window. The containment also means the card no longer takes its
   width from its content at all: a long option label in the picker, or a word wider than the
   card, no longer widens the card or the page's column with it, which without the containment
   made the location page wider than a phone's screen. What does not fit overflows the card. */
.scene-card {
    container: scene-card / inline-size;
    display: grid;
    gap: var(--space-4);
    grid-template-columns: minmax(0, 1fr) fit-content(30rem);
    padding: var(--space-4);
}
.scene-card > * { grid-column: 1 / -1; }
.scene-card > .scene-switcher { min-width: 0; }
/* 44rem leaves the header at least 13rem beside the switcher at its widest, enough for a long
   name to wrap over two or three lines with its badges under it. Every other item is placed
   after the first row, which the two fill. Both stand at the row's top rather than stretching to
   its height, which the switcher raises without scripting when its button wraps under the
   select; a stretched header would spread the name and the date apart. */
@container scene-card (min-width: 44rem) {
    .scene-card > .scene-header { align-self: start; grid-column: 1; grid-row: 1; }
    .scene-card > .scene-switcher { align-self: start; grid-column: 2; grid-row: 1; }
}
/* Every line of the header breaks anywhere: the name, the badges and the in-world date inherit
   it. A grid or flex item's automatic minimum width is its min-content width, its longest word,
   so a name, a table name or a date with no break opportunity would widen the header over the
   switcher beside it, or the page past a phone's screen. `anywhere`, unlike `break-word`, lowers
   the min-content width to one character, so no item here needs a `min-width: 0` as well. */
.scene-header { display: grid; gap: var(--space-1); overflow-wrap: anywhere; }
/* The scene's name with its badges beside it, wrapping under it where the name is long. */
.scene-title { align-items: center; display: flex; flex-wrap: wrap; gap: var(--space-2); }
/* Every badge is one pill: a 16% tint of its tone behind text in the tone, the tone muted unless
   a badge sets its own. The badges are an NPC's visibility in the directory, a character's
   status there and on its sheet, a scene's table, kind and closed mark in its header and on the
   battle map's bar, a progress track's kind, and the facts beside a card's, an item's, an
   Experience's and an effect's name. A long table name wraps inside its pill rather than
   pushing the header wider. The fit-content width keeps a pill sized to its text where a grid
   or a column flex container would stretch it to the column; it still shrinks to the space
   available, so the wrapping holds. */
.visibility-badge, .scene-table, .scene-kind, .scene-closed, .status, .track-kind,
:is(.domain-card, .carried-item, .character-effect) .pool-count, .character-experience .pool-count:last-child {
    --tone: var(--color-text-muted);
    align-items: center;
    background: color-mix(in srgb, var(--tone) 16%, transparent);
    border-radius: var(--radius-pill);
    color: var(--tone);
    display: inline-flex;
    font-size: var(--text-xs);
    font-weight: 700;
    letter-spacing: 0.02em;
    min-height: 1.375rem;
    padding: 0 var(--space-2);
    width: fit-content;
}
.visibility-badge.shared, .status[data-status="alive"] { --tone: var(--color-success); }
/* The danger and the bane colors are lightened towards the text as the destructive button's
   text is, since either falls under 4.5:1 on its own tint. */
.status[data-status="deceased"] { --tone: var(--color-danger-text); }
.character-effect .effect-buff { --tone: var(--color-buff); }
.character-effect .effect-debuff { --tone: color-mix(in srgb, var(--color-debuff) 70%, var(--color-text)); }
/* An Experience's value is the number a roll adds, so its pill is a size larger and in the
   accent: the text one step up the scale, the height and side padding grown to match. */
.character-experience .pool-count:last-child {
    --tone: var(--color-accent-strong);
    font-size: var(--text-sm);
    min-height: 1.625rem;
    padding: 0 var(--space-3);
}

/* The battle map page fills the window: a bar along the top and the map below it, with no
   page scroll. Without battle-map.js the frame scrolls the map at its own size; the script adds
   `is-enhanced`, clips the frame and moves the board with a transform instead. */
.battle-map-body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.battle-map-body > .notice:not(.request-failure) { margin: var(--space-2) var(--space-4) 0; }
.battle-map-page, .battle-map-main { display: flex; flex: 1; flex-direction: column; min-height: 0; }
.battle-map-bar {
    align-items: center;
    background: var(--color-panel);
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
    padding: var(--space-2) var(--space-4);
    position: relative;
}
.battle-map-bar h1 { font-size: var(--text-lg); }
/* The zoom toolbar and the level shown (a GET form). */
.battle-map-zoom, .battle-map-level-menu { display: flex; gap: var(--space-1); }
.battle-map-level-menu label { align-self: center; }
.battle-map-level-menu select { max-width: 14rem; min-width: 0; }
/* A long level name with no space in it shrinks to the bar's width rather than widening the page. */
.battle-map-level-menu { max-width: 100%; min-width: 0; }
.battle-map-controls { margin-left: auto; }
/* The two folds sit together at the bar's end: only the first takes the free space. */
.battle-map-controls ~ .battle-map-controls { margin-left: 0; }
/* A drawer hangs from the bar rather than from its fold, so it opens below the bar at its right
   edge wherever the wrapped bar has put the fold's summary, and stays on screen at any width. */
/* What floats over the battle map, its drawer, a token's card and toolbar and a status line, is
   the raised panel inside the full border with the floating shadow. */
.battle-map-drawer, .battle-map-card, .token-toolbar, .battle-map-status-lines .battle-map-status:not(:empty) {
    background: var(--color-panel-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-float);
}
.battle-map-drawer {
    display: grid;
    gap: var(--space-4);
    max-height: 80vh;
    overflow: auto;
    padding: var(--space-4);
    position: absolute;
    right: var(--space-4);
    top: calc(100% + var(--space-2));
    width: min(22rem, calc(100vw - 2 * var(--space-4)));
    z-index: 2;
}
/* The drawer's column and its forms' columns are held to the drawer's width: an `auto` column
   grows to its widest item's min-content width, which for a select is its longest option, so a
   long track or character name would push every field past the drawer's edge. A select held to
   the column cuts its own long option instead. */
.battle-map-drawer, .battle-map-drawer form { grid-template-columns: minmax(0, 1fr); }
/* The drawer's parts, each a form, or a list under its label, are parted by the hairline. An
   empty state keeps its own dashed edge, and the note under the levels list stays with it. */
.battle-map-drawer > :not(:first-child, h2 + *, .empty, .battle-map-levels-list + p) {
    border-top: 1px solid var(--line);
    padding-top: var(--space-4);
}
/* A grid field with the −1 and +1 buttons battle-map.js reveals beside it. */
.grid-field { display: flex; gap: var(--space-1); }
.grid-field input { flex: 1; min-width: 0; }
/* The token layer covers the board and is not clipped, so a token on a square past the image's
   edge stays visible; between tokens it lets the pointer through to the frame, which pans.
   Each token is sized and placed by battle-map.js in the image's pixels, and its ring, rims,
   monogram and name scale with its width. */
.battle-map-tokens { inset: 0; pointer-events: none; position: absolute; }
.battle-map-token {
    border-radius: 50%;
    container-type: inline-size;
    pointer-events: auto;
    position: absolute;
    z-index: 1;
}
.battle-map-token, .mini-map-token { --token-ring: var(--color-token-rim); }
.battle-map-token[data-ring="pc"], .mini-map-token[data-ring="pc"] { --token-ring: var(--color-class, var(--color-accent)); }
.battle-map-token[data-ring="companion"], .mini-map-token[data-ring="companion"] { --token-ring: var(--color-token-companion); }
.battle-map-token[data-ring="npc-shared"], .mini-map-token[data-ring="npc-shared"] { --token-ring: var(--color-token-npc-shared); }
.battle-map-token[data-ring="npc-private"], .mini-map-token[data-ring="npc-private"] { --token-ring: var(--color-token-npc-private); }
/* A custom token's color is set on its element as `--token-custom`, from its state on the map
   page and inline on the mini-map; it rings the token and colors its icon. */
.battle-map-token[data-ring="custom"], .mini-map-token[data-ring="custom"] { --token-ring: var(--token-custom, var(--color-token-custom)); }
.battle-map-token[data-ring="custom"] .token-emblem {
    color: var(--token-custom, var(--color-token-custom));
    filter: drop-shadow(0 0 1.5cqi var(--color-token-emblem-outline));
}
/* Movable tokens stand over the others and a deceased character's under them. A focused token
   stands over every other, so the one under a stack takes the pointer once Tab reaches it. */
.battle-map-token[role="button"] { cursor: pointer; }
.battle-map-token.is-movable { cursor: grab; z-index: 2; }
.battle-map-token.is-deceased, .battle-map-token.is-archived { filter: grayscale(1); opacity: 0.55; z-index: 0; }
.battle-map-token.is-dragging { cursor: grabbing; z-index: 3; }
.battle-map-token:focus { z-index: 3; }
.token-coin {
    background: var(--color-panel) center / cover no-repeat;
    border: 7cqi solid var(--token-ring);
    border-radius: 50%;
    box-shadow: 0 0 0 3cqi var(--color-token-rim), inset 0 0 0 3cqi var(--color-token-rim);
    box-sizing: border-box;
    display: grid;
    height: 90%;
    margin: 5%;
    place-items: center;
    width: 90%;
}
/* The ring's sheen, a painted metal look: a layer over the coin's border box, cut down to the
   border by its mask, so it covers neither the picture nor the emblem inside, nor the rims. Its
   z-index lifts it over the adversary's arcs, which are drawn after the coin on the same border, so
   they take the sheen as every other ring does. It takes no pointer and no room. An engine
   without unprefixed `mask-composite` draws no sheen, rather than a gradient over the whole coin. */
.token-coin { position: relative; }
@supports (mask-composite: exclude) {
    .token-coin::after {
        background:
            linear-gradient(135deg, transparent 20%, var(--color-token-sheen-band) 27%, transparent 34%),
            linear-gradient(135deg, var(--color-token-sheen-light), transparent 45% 55%, var(--color-token-sheen-dark));
        background-origin: border-box;
        border: 7cqi solid transparent;
        border-radius: 50%;
        content: "";
        inset: -7cqi;
        mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
        mask-composite: exclude;
        place-self: stretch;
        pointer-events: none;
        position: absolute;
        z-index: 1;
    }
}
.token-monogram { color: var(--color-text); font-size: 34cqi; font-weight: 700; line-height: 1; }
.token-emblem { color: var(--color-token-adversary-fill); display: block; height: 60cqi; width: 60cqi; }
/* Laid over the coin's border box, so a radius of 46 in the 100-unit square centers each arc on
   the coin's 7cqi border, which is 7.8 units of that square. */
.token-ring { height: 90%; inset: 5%; pointer-events: none; position: absolute; width: 90%; }
.token-ring circle { fill: none; stroke: var(--color-token-adversary-track); stroke-width: 7.8; }
.token-ring circle.is-filled { stroke: var(--color-token-adversary-fill); }
/* A name is cut short at one and a half times the token's width (for a one-square token, a
   quarter square into each neighboring square), which holds a two-word name such as "Rook
   Ashgrove"; the whole name is the token's `aria-label`. The label takes no pointer, so the
   squares it overhangs keep theirs. */
.token-name {
    background: var(--color-token-rim);
    border-radius: var(--radius-mark);
    color: var(--color-token-name);
    /* A name keeps one size whatever the token's: battle-map.js sets its squares as `--token-size`. */
    font-size: calc(16cqi / var(--token-size, 1));
    left: 50%;
    max-width: 150cqi;
    overflow: hidden;
    padding: 0 2cqi;
    pointer-events: none;
    position: absolute;
    text-overflow: ellipsis;
    top: 96%;
    transform: translateX(-50%);
    unicode-bidi: plaintext;
    white-space: nowrap;
}
/* An empty status line keeps its place in the accessibility tree, so what it is given next is
   announced; only its box collapses. */
.battle-map-status:empty { margin: 0; }
.battle-map-status { margin: var(--space-2) var(--space-4) 0; }
/* battle-map.js moves the visible status lines here, over the frame's top edge, so writing or
   clearing one never moves the map. They let the pointer through to the map, and an empty line
   draws nothing while staying a live region. */
.battle-map-status-lines {
    display: grid;
    gap: var(--space-2);
    inset: var(--space-2) var(--space-2) auto;
    justify-items: start;
    pointer-events: none;
    position: absolute;
    z-index: 1;
}
.battle-map-status-lines .battle-map-status { margin: 0; }
.battle-map-status-lines .battle-map-status:not(:empty) { padding: var(--space-1) var(--space-3); }
/* What a token's card says, drawn by battle-map.js beside the token under the pointer or with
   focus. It takes no pointer, so it never stands between the pointer and a token, and so cannot
   scroll: each effect's note is cut to one line at the card's width, the sheet holding it whole,
   the columns' zero minimum letting a note be narrower than its text. */
.battle-map-card {
    display: grid;
    font-size: var(--text-sm);
    gap: var(--space-1);
    grid-template-columns: minmax(0, 1fr);
    max-height: calc(100vh - 16px);
    max-width: 18rem;
    overflow: hidden;
    padding: var(--space-2) var(--space-3);
    pointer-events: none;
    position: fixed;
    z-index: 4;
}
.battle-map-card[hidden] { display: none; }
.battle-map-card p, .battle-map-card ul { margin: 0; }
.battle-map-card ul { display: grid; gap: var(--space-1); grid-template-columns: minmax(0, 1fr); list-style: none; padding: 0; }
.battle-map-card .battle-map-card-counts { display: flex; flex-wrap: wrap; gap: 0 var(--space-3); }
/* A count's symbol, a marked pip's, at the size of the text beside it. */
.battle-map-card-counts li { align-items: center; display: flex; gap: var(--space-1); }
.battle-map-card-counts .pip { font-size: 1.15em; }
.battle-map-card-name { font-family: var(--font-display); font-weight: 700; }
.battle-map-card-standing { color: var(--color-danger); }
.battle-map-card-note { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A custom token's note is printed whole, wrapping at the card's width, a long word included. */
.battle-map-card-custom-note { overflow-wrap: anywhere; }
/* The selected token is ringed by a dashed outline, a focused one keeping its solid one. */
.battle-map-token.is-selected:not(:focus-visible) { outline: 2px dashed var(--color-accent-strong); outline-offset: 2px; z-index: 3; }
/* The selected token's toolbar, one low strip battle-map.js lays under the token on the card's
   surface. It never grows past the window: a row wraps, and what still does not fit scrolls. */
.token-toolbar {
    font-size: var(--text-sm);
    max-height: calc(100vh - 16px);
    max-width: calc(100vw - 16px);
    overflow: auto;
    padding: var(--space-1) var(--space-2);
    position: fixed;
    z-index: 4;
}
.token-toolbar-panel, .token-toolbar-panel > form, .token-toolbar .pool-track,
.token-toolbar .resource-track, .token-toolbar .progress-track {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-2);
}
.token-toolbar .progress-track { background: none; flex-direction: row; padding: 0; }
.token-toolbar-count { align-items: center; display: inline-flex; gap: var(--space-1); }
.token-toolbar [aria-disabled="true"] { cursor: default; }
.battle-map-levels-list { display: grid; gap: var(--space-4); list-style: none; margin: 0; padding: 0; }
.battle-map-levels-list li { display: grid; gap: var(--space-2); justify-items: start; }
.battle-map-roster { display: grid; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.battle-map-roster li { align-items: center; display: flex; flex-wrap: wrap; gap: var(--space-2); }
.battle-map-roster span { flex: 1 0 100%; min-width: 0; overflow-wrap: anywhere; }
.battle-map-empty { display: grid; gap: var(--space-4); max-width: 32rem; padding: var(--space-6) var(--space-4); }
.battle-map-viewport {
    background: var(--color-battle-workspace);
    flex: 1;
    min-height: 0;
    overflow: auto;
    position: relative;
}
.battle-map-viewport.is-enhanced { cursor: grab; overflow: hidden; touch-action: none; user-select: none; }
.battle-map-viewport.is-dragging { cursor: grabbing; }
.battle-map-viewport.is-drawing-square { cursor: crosshair; }
/* While a square is drawn, tokens take no pointer, so no token's card opens over the box. */
.battle-map-viewport.is-drawing-square .battle-map-token { pointer-events: none; }
/* The box a Game Master drags over one square of the map to align the grid, in the image's
   pixels on the board, its border kept one screen width at any zoom as the grid's lines are. */
.battle-map-square-draw {
    border: calc(2px / var(--zoom, 1)) dashed var(--color-battle-grid);
    box-shadow: 0 0 0 calc(2px / var(--zoom, 1)) var(--color-battle-grid-halo);
    pointer-events: none;
    position: absolute;
    z-index: 4;
}
/* Drawn inside the frame, which reaches the window's bottom edge. */
.battle-map-viewport:focus-visible { outline-offset: -2px; }
.battle-map-viewport.is-enhanced .battle-map-board { transform-origin: 0 0; }
.battle-map-board { position: relative; width: max-content; }
.battle-map-board img { display: block; max-width: none; }
.battle-map-grid { height: 100%; inset: 0; overflow: hidden; pointer-events: none; position: absolute; width: 100%; }
/* The zoom is a CSS transform on the board, an HTML ancestor of the SVG, which
   `vector-effect` does not undo: the widths divide by the scale battle-map.js sets as `--zoom`. */
.battle-map-grid path { fill: none; }
.battle-map-grid .grid-halo { stroke: var(--color-battle-grid-halo); stroke-width: calc(3px / var(--zoom, 1)); }
.battle-map-grid .grid-line { stroke: var(--color-battle-grid); stroke-width: calc(1px / var(--zoom, 1)); }

/* The shell's first focusable element, jumping past the navigation to the page's content. It is
   out of sight, as `.visually-hidden` is, until it takes focus, and then stands at the top left
   over the page as a button. The button's tint is translucent, so it is laid over the panel
   color there, as the request failure line's is, and the page behind does not show through. */
.skip-link { left: var(--space-2); position: absolute; top: var(--space-2); z-index: 10; }
.skip-link:focus { background: linear-gradient(var(--color-button-tint) 0 0), var(--color-panel); }
.skip-link:not(:focus) {
    clip-path: inset(50%);
    height: 1px;
    min-height: 0;
    overflow: hidden;
    white-space: nowrap;
    width: 1px;
}

/* The link to the navigation, which stands below the page's content at phone width. */
.menu-link { display: none; }

/* The widget column moves under the content, where it no longer stays in view. */
@media (max-width: 62rem) {
    .world-shell { grid-template-columns: minmax(12rem, var(--shell-nav-width)) minmax(0, 1fr); }
    .shell-widgets {
        grid-column: 1 / -1;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        max-height: none;
        overflow-y: visible;
        position: static;
    }
}

/* One column: the page's content first, then the navigation and the widgets, neither of them
   staying in view, with a link at the top jumping to the navigation. */
@media (max-width: 44rem) {
    .world-shell { grid-template-columns: 1fr; padding: var(--space-4); }
    .shell-content { order: -1; }
    .shell-nav { max-height: none; overflow-y: visible; position: static; }
    .shell-widgets { grid-column: auto; grid-template-columns: 1fr; }
    .menu-link { display: inline-block; margin: var(--space-4) var(--space-4) 0; }
    .world-picker, .world-overview, .location-page, .table-stream, .form-page, .character-sheet {
        padding: var(--space-4);
    }
    .landing, .form-page { margin: var(--space-8) auto; }
    /* A panel standing on its own keeps a gutter from the screen's edges. */
    main.world-picker, main.form-page { margin: var(--space-8) var(--space-4); width: auto; }
}
