/* Epsilook — the theme layer.
 *
 * Every colour in this file comes from a token declared here: no rule below
 * this block names a colour of its own. A theme is therefore one block that
 * re-declares the palette and nothing else:
 *
 *     :root[data-theme="<id>"] { --bg: ...; --text: ...;  }
 *
 * plus one {id, label} line in `themes` in js/config.js, which is the picker's
 * registry. Those two places, nothing more — and the picker appears by itself
 * once a second theme exists.
 *
 * Three palettes ship: dark, and two light ones (moonwell, vellum) that differ
 * only in the hue their surfaces and washes are built from.
 *
 * Three conventions keep a palette at one value per colour:
 *   - a colour that is ALSO composited at an alpha is declared as a bare
 *     "R, G, B" triple (--gold-rgb), used as rgba(var(--gold-rgb), 0.08).
 *     Its solid form is derived from the triple in the last block here, so a
 *     theme still sets the colour once.
 *   - shadows keep their per-site alphas and scale as a family through
 *     --shadow-strength: a light theme turns that one number down instead of
 *     restating every shadow.
 *   - low-alpha TINTS (state fills, hairline rules, segment dividers) scale
 *     the same way through --wash-strength, because the same alpha does not
 *     carry the same signal on a light surface: the 13% gold wash that moves a
 *     dark row by 1.40:1 moves a light row by 1.20:1. Light turns the number
 *     UP where it turns --shadow-strength down.
 *
 * data-theme lives on <html>, set by js/theme.js and replayed by the inline
 * script in index.html before first paint. An UNSET attribute is dark — the
 * look the app has always shipped — which is why `defaultTheme` in config.js
 * must name the same theme as the bare :root palette here.
 */

/* ------------------------------------------------------------ dark (default) */

:root, :root[data-theme="dark"] {
    /* surfaces and lines */
    --bg: #0e1116;
    --bg-panel: #161b23;
    --bg-row: #131820;
    --bg-row-hover: #1a212c;
    --border: #262d38;
    /* stronger edge for interactive controls (search bar, select, buttons) so
       their boundary clears WCAG 1.4.11's 3:1 — ~3.3:1 on the page bg */
    --border-ctrl: #626b7a;
    /* washes that lift a surface on a dark theme and shade it on a light one:
       chip fills, pill backgrounds, hairline column rules */
    --overlay-rgb: 255, 255, 255;
    /* shadows: colour + how strongly the whole family lands */
    --shadow-rgb: 0, 0, 0;
    --shadow-strength: 1;
    /* and how strongly the low-alpha tints land (see the header) */
    --wash-strength: 1;
    --backdrop: rgba(5, 7, 11, 0.65);
    /* checkerboard behind a texture preview, so alpha reads as alpha */
    --checker-a: #1c232e;
    --checker-b: #10141b;

    /* text */
    --text: #cfd6e0;
    --text-dim: #7c8694;
    /* spell names — the one string that outranks body text */
    --text-strong: #e8edf4;
    /* the "no value" marker: a readable dim (opacity .5 was ~2.3:1, failing 1.4.3) */
    --text-muted: #7f8996;
    /* action glyphs living inside pills (3D cube, ▶ play, ⧉/.lo/.morph copies).
       Brighter than --text-dim so the small controls read clearly against the
       row without competing with the pill's colored label. */
    --tag-btn: #a9b4c4;

    /* accents: the app's own gold, the exclusion red, the text selection.
       The gold is the GAME's gold — #ffd100 is what FrameXML paints its
       highlights in (43 of the colour declarations on wowdev's Font page) and
       what Wowhead paints its result counts in, so the one accent this app
       shares with everything else in the ecosystem is spelled the same way.
       It also measures better than the hand-picked #f0c34c it replaced:
       12.19:1 on the row against 10.70:1. Dark only — both light palettes
       declare their own gold, because a light surface has no room for this
       one (1.33:1 there). */
    --gold-rgb: 255, 209, 0;
    --gold-dim: #a8842f;
    --danger-rgb: 224, 112, 112;
    --select-rgb: 72, 130, 220;
    --select-border-rgb: 120, 170, 240;

    /* content families — one tone per kind of thing a column shows */
    --model-rgb: 127, 184, 240;
    --sound: #8fd48f;
    --soundkit-rgb: 95, 175, 143;
    --animkit-rgb: 201, 154, 224;
    --fx-rgb: 127, 201, 208;
    --anim: #d8b4e8;
    --mech: #e0a878;
    /* auras sit one shade from the effects that deliver them */
    --mech-aura: #f0d68d;
    /* the priceless invisibility: a cool accent that never reads as a hit */
    --priceless: #aab4ee;
    --priceless-border: #6f7bd6;
    --priceless-rgb: 123, 138, 214;

    /* item quality — the classic WoW ramp */
    --q-poor: #9d9d9d;
    --q-common: #ffffff;
    --q-uncommon: #1eff00;
    --q-rare: #0070dd;
    --q-epic: #a335ee;
    --q-legendary: #ff8000;
    --q-artifact: #e6cc80;
    --q-heirloom: #00ccff;

    /* How loudly a shape carries the colour family it belongs to: how much of
       --tone fills it, how much of --tone its border is mixed with, and how
       much of --tone survives in its label. Dark asks for almost nothing — a
       pastel tone on near-black already reads, and --ink-mix at 100% means the
       label IS the tone, exactly as it always has been.

       One fill per surface, loudest last: the field a kit box lays its pills
       on, a pill itself, and a group's head, which leads them. */
    --group-fill: 2%;
    --tone-fill: 3%;
    --head-fill: 9%;
    --tone-edge: 0%;
    --ink-mix: 100%;

    /* How far a secondary label may step back by alpha — a summon's control
       word, the "−" on a tab. A dark label sits at 8:1 and can give a quarter
       of itself away and still clear AA. A light one is engineered to ~5:1 on
       the loudest fill it ever lands on and has NO such headroom: the light
       palettes set this to 1 and let those labels stay secondary through size
       alone. Do not dim them by alpha there — measured against a hit's gold
       wash, even 0.9 puts the control word on a summon pill under 4.5:1. */
    --dim: 0.75;

    /* Wowhead's button. Their logo goes on it, so it keeps their brand orange
       in every theme — but the SURFACE under the logo has to belong to the page
       it sits on. Pinning these to one dark pair (which they were) is what put
       a black button on a light page. */
    --wh-bg-top: #2b1c12;
    --wh-bg-bottom: #1d130c;
    --wh-border: #4a2e1e;
    --wh-hover-rgb: 192, 64, 0;
}

/* -------------------------------------------------------------- light: two
 *
 * Both light palettes were generated, not picked, and they share one structure;
 * only the hue differs (moonwell 280°, vellum 84°). Four rules produced every
 * number below, and they are worth knowing before editing any of them:
 *
 *  1. NOTHING IS WHITE, and nothing is grey. The page sits at L*≈.91 and the
 *     table row — the biggest area on screen, and the thing that actually
 *     glares — at L*≈.97 rather than 1.0, with real chroma in both. This is
 *     the whole answer to "painful": the first light palette was rejected for
 *     brightness, and dropping a near-white row to a tinted one costs a
 *     legible tone only ~.025 of lightness. Softness here is nearly free.
 *  2. THE FAMILY TOKENS COLOUR THE PILL, not the label. Each is a vivid
 *     mid-tone (L*=.60, near the chroma ceiling for its hue) that FILLS its
 *     pill, and the label is that tone walked toward the ink by --ink-mix.
 *     A first pass had it the other way round — the token was the label and
 *     the fill was a dilution of it — and the pills came out grey, because a
 *     colour dark enough to be 11px text has almost no chroma left to give and
 *     a quarter of it is nothing at all. Fill and small text want opposite
 *     things from a colour; one token can only serve both by deriving one end.
 *  3. EVERY TONE KEEPS ITS DARK-THEME HUE, so model-blue, fx-cyan,
 *     animkit-violet and mech-orange stay as separable here as they are on
 *     black. Pairs that share a hue there (anim/animkit, sound/soundkit) stay
 *     apart by chroma here too — the same relationship, not the same numbers.
 *  4. GOLD BECOMES BRONZE, and stays out of the pill scheme. There is no dark
 *     yellow — yellow at a legible lightness is olive — so the gold family
 *     shifts toward amber (88° → 70°) and mech opens out to 46° to keep the
 *     warm tones apart. Gold is small text in two dozen places and is the
 *     search-hit wash, so it is solved dark rather than made vivid.
 *
 * The floor every label was solved against is not the page. It is the loudest
 * thing that ever sits under it: its own pill, its own group head, or a search
 * hit's gold wash. Solve there and AA holds everywhere — verified by walking
 * every text node on the page, compositing its ancestors' alphas down to an
 * opaque colour and measuring, over a battery of ~20 queries (~18k pills) on
 * both palettes. Re-run that before shipping a change to any fill percentage:
 * two fills that stack are a floor nothing was solved against.
 *
 * Deliberately NOT light: --checker-a/b, the chequerboard behind a texture
 * preview. It exists so alpha reads as alpha, and WoW's particle textures are
 * bright-on-transparent — on a light chequerboard they would vanish. The
 * preview is a lightbox, not a page surface, so it stays dark in every theme.
 *
 * Wowhead's embedded tooltip needs nothing from us either way: it paints its
 * own dark tooltip.png on the inner cells, so it stays a dark panel on a light
 * page and its white/gold text keeps reading. (Verified in the DOM, 2026-07-25
 * — the older note claiming it had no background of its own was wrong.)
 */

/* Moonwell — a cool violet-slate light. The dark theme's sibling: same cerebral
   register, inverted, and a cool field is what makes the bronze accent carry.
   Named for the night-elf pools, not for a spell school: "arcane" already means
   something specific in this game and a theme must not claim it. */
:root[data-theme="moonwell"] {
    --bg: #dedfe9;
    --bg-panel: #edeef6;
    --bg-row: #f3f4f9;
    --bg-row-hover: #e1e5ff;
    --border: #c0c2d5;
    --border-ctrl: #7376c8;
    --overlay-rgb: 34, 38, 115;
    --shadow-rgb: 26, 31, 85;
    --shadow-strength: 0.45;
    --wash-strength: 1.7;
    --backdrop: rgba(23, 28, 78, 0.4);
    --checker-a: #31323b;
    --checker-b: #1f2026;
    --text: #2e344c;
    --text-dim: #363e70;
    --text-strong: #121632;
    --text-muted: #3f4874;
    --tag-btn: #2f376c;
    --gold-rgb: 121, 75, 0;
    --gold-dim: #a9721d;
    --danger-rgb: 166, 25, 43;
    --select-rgb: 136, 182, 252;
    --select-border-rgb: 21, 123, 245;
    --model-rgb: 32, 132, 214;
    --sound: #229a30;
    --soundkit-rgb: 75, 144, 117;
    --animkit-rgb: 185, 40, 237;
    --fx-rgb: 34, 144, 153;
    --anim: #9c67b3;
    --mech: #c85c1d;
    --mech-aura: #a3772b;
    /* the priceless invisibility: light needs no separate solid — the ink is
       the fill's own colour, unlike dark where the text runs a shade paler */
    --priceless: #6870e8;
    --priceless-rgb: 104, 112, 232;
    --priceless-border: #676ef6;
    --q-poor: #7f8085;
    --q-common: #6c6e76;
    --q-uncommon: #279a1e;
    --q-rare: #1e7eeb;
    --q-epic: #a93bf5;
    --q-legendary: #bf641d;
    --q-artifact: #a1782b;
    --q-heirloom: #228dae;
    --group-fill: 8%;
    --tone-fill: 28%;
    --head-fill: 38%;
    --tone-edge: 78%;
    --ink-mix: 66%;
    --dim: 1;
    --wh-bg-top: #ffe7dd;
    --wh-bg-bottom: #facebd;
    --wh-border: #b26b4f;
    --wh-hover-rgb: 192, 64, 0;
}

/* Vellum — warm parchment, the game's own questlog idiom. Sepia ink, a bronze
   that finally belongs, and cool families reading as jewel tones on sand. */
:root[data-theme="vellum"] {
    --bg: #e9dfcc;
    --bg-panel: #f6eede;
    --bg-row: #f9f4ea;
    --bg-row-hover: #fbe5bc;
    --border: #d4c19d;
    --border-ctrl: #907a4e;
    --overlay-rgb: 94, 36, 1;
    --shadow-rgb: 71, 29, 7;
    --shadow-strength: 0.45;
    --wash-strength: 1.7;
    --backdrop: rgba(64, 26, 6, 0.4);
    --checker-a: #3a3221;
    --checker-b: #261f12;
    --text: #4a2e1f;
    --text-dim: #543d32;
    --text-strong: #2e0e00;
    --text-muted: #59453c;
    --tag-btn: #4d362a;
    --gold-rgb: 121, 75, 0;
    --gold-dim: #ab731d;
    --danger-rgb: 166, 25, 43;
    --select-rgb: 136, 182, 252;
    --select-border-rgb: 21, 123, 245;
    --model-rgb: 32, 132, 214;
    --sound: #229a30;
    --soundkit-rgb: 75, 144, 117;
    --animkit-rgb: 185, 40, 237;
    --fx-rgb: 34, 144, 153;
    --anim: #9c67b3;
    --mech: #c85c1d;
    --mech-aura: #a3772b;
    /* the priceless invisibility: light needs no separate solid — the ink is
       the fill's own colour, unlike dark where the text runs a shade paler */
    --priceless: #6870e8;
    --priceless-rgb: 104, 112, 232;
    --priceless-border: #676ef6;
    --q-poor: #82807b;
    --q-common: #756d69;
    --q-uncommon: #279a1e;
    --q-rare: #1e7eeb;
    --q-epic: #a93bf5;
    --q-legendary: #bf641d;
    --q-artifact: #a1782b;
    --q-heirloom: #228dae;
    --group-fill: 8%;
    --tone-fill: 28%;
    --head-fill: 38%;
    --tone-edge: 78%;
    --ink-mix: 66%;
    --dim: 1;
    --wh-bg-top: #ffe7dd;
    --wh-bg-bottom: #facebd;
    --wh-border: #b46c50;
    --wh-hover-rgb: 192, 64, 0;
}

/* ----------------------------------------------------------------- derived */

/* Follows whichever palette won above — a theme never restates these. */
:root {
    --gold: rgb(var(--gold-rgb));
    --danger: rgb(var(--danger-rgb));
    --model: rgb(var(--model-rgb));
    --soundkit: rgb(var(--soundkit-rgb));
    --animkit: rgb(var(--animkit-rgb));
    --fx: rgb(var(--fx-rgb));
    /* faint column separators keep tall uneven rows readable */
    --border-faint: rgba(var(--overlay-rgb), calc(0.045 * var(--wash-strength)));

    /* The content family in play. Anything that shows one — a pill, a search
     * chip, a target icon — names it once here and reads it back as a colour
     * through:
     *
     *     color-mix(in oklab, var(--tone) var(--ink-mix), black)
     *
     * which is the tone taken down to a dark version of itself. That is what
     * lets ONE palette token per family do the two jobs a single colour cannot
     * do at once: FILL a shape (wants it light and saturated) and be 11px TEXT
     * on that fill (wants it dark). At --ink-mix: 100% the two are the same
     * colour and nothing has moved — which is the dark palette.
     *
     * The mix partner is BLACK, not the palette's own ink, and that is load-
     * bearing: mixing in oklab toward black scales lightness and chroma
     * together and leaves the hue untouched, so a label stays the colour of its
     * family. Mixing toward --text-strong instead rotates every hue toward the
     * ink's and flattens whichever families sit opposite it — on parchment it
     * turned the fx cyan grey and the priceless periwinkle pink.
     *
     * That mix is spelled out at each site on purpose. It CANNOT be hoisted
     * into a custom property here: var() inside a custom property is
     * substituted where the property is DECLARED, not where it is used, so a
     * --tone-text declared on :root would freeze at the :root --tone below and
     * paint every family the same ink. It was written that way once and every
     * label came out grey. */
    --tone: var(--text);

    font-size: 15px;
}

/* THE FAMILY A COLUMN SHOWS. Declared on the cell so that every shape inside
   inherits it — the kit box, its head, a compact group and the capsule in it.
   Only leaf pills re-declare it, for their own kind (a sound file inside a
   soundkit group is --sound, not --soundkit), and the "+N more" control stays
   deliberately out of it: it is chrome, not content.

   This is what a group's colour hangs on. Tinting the head from four
   `.c-x .kit-head` rules used to be the whole story, which is why the shapes
   that have no head to tint — a compact group, and the capsule inside it —
   came out grey while the pills beside them were coloured. Dark hid that: at
   3% fill, a family tint and a neutral one look the same. */
.c-models {
    --tone: var(--model);
}

.c-sounds {
    --tone: var(--soundkit);
}

.c-animations {
    --tone: var(--animkit);
}

.c-fx {
    --tone: var(--fx);
}

/* The Mechanics column gained the non-visual category groups (seat, invis,
   detect, keybind, speed), so it needs a column tone like the other four —
   without it a group head and its capsule fall back to the :root tone and
   render grey next to their own coloured pills. */
.c-mechanics {
    --tone: var(--fx);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.45;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

/* keyboard focus indicator — :focus-visible keeps it off mouse clicks, so the
   resting look is unchanged; the gold ring only appears during Tab navigation */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 1px; /* hugs the control — no bleed into neighbouring text */
}

/* the search input already shows focus via #qbar:focus-within */
#q:focus-visible {
    outline: none;
}

/* densely-packed controls: ring sits right on the edge so it never reaches a
   neighbour (export/command buttons, in-pill glyph buttons) */
#export button:focus-visible,
.cmd:focus-visible,
.icon-btn:focus-visible,
.tag-copy:focus-visible,
.tag-play:focus-visible,
.tag-view:focus-visible {
    outline-offset: 0;
}

/* sticky header cell would clip an outset ring — inset it instead */
#results th[data-sort] > button:focus-visible {
    outline-offset: -2px;
}

/* visually hidden but exposed to assistive tech (live query mirror, etc.) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

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

header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.6rem 0.4rem;
}

h1 {
    margin: 0;
    font-size: 1.6rem;
    letter-spacing: 0.06em;
    color: var(--gold);
    text-shadow: 0 0 18px rgba(var(--gold-rgb), 0.25);
    display: inline;
}

.tagline {
    display: inline;
    margin: 0 0 0 0.7rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* the header's right-hand controls — the theme picker, then the version
   selector with its logo. They wrap under one another before the header does */
.header-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.4rem 1.1rem;
    min-width: 0;
}

#theme-wrap, #version-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* both wraps ship hidden and are un-hidden only when there is a choice to make
   (2+ themes / 2+ visible packs) — and an author `display` beats the `hidden`
   attribute's UA rule, so it has to be said explicitly here */
#theme-wrap[hidden], #version-wrap[hidden] {
    display: none;
}

.header-controls label {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* the expansion logo: game art with its own transparent background, so it
   needs no chrome — it sits flush beside the selector and collapses to
   nothing when the build has no mapped logo.
   It is decorative (aria-hidden), so it shrinks rather than widening the
   header, and steps aside entirely once the header gets tight. */
#version-logo {
    display: flex;
    align-items: center;
    line-height: 0;
    min-width: 0;
}

#version-logo canvas {
    display: block;
    max-width: 100%;
    object-fit: contain;
}

@media (max-width: 900px) {
    #version-logo {
        display: none;
    }
}

select {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border-ctrl);
    border-radius: 6px;
    padding: 0.3rem 0.5rem;
}

/* ------------------------------------------------------------ search bar */

main {
    padding: 0 1.6rem 2rem;
}

#searchbox {
    padding: 0.8rem 0 0.4rem;
    position: relative;
}

.bar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* the chip search bar: committed tags + the text input */
/* min-width:0 defeats the flex `min-width:auto` default: without it the bar
 * refuses to shrink below the widest thing inside it, and a long chip being
 * typed (sizeInput sets an explicit ch width) drags it off the screen edge
 * instead of wrapping. Every step from here down to #q needs the same escape
 * hatch, hence the min-width/max-width pairs below. */
#qbar {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-ctrl);
    border-radius: 10px;
    cursor: text;
}

#qbar:focus-within {
    border-color: var(--gold-dim);
    box-shadow: 0 0 0 3px rgba(var(--gold-rgb), 0.12);
}

/* only the true trailing gap (nothing after it) fills the rest of the
 * line; a gap before or between chips hugs its content instead, so it
 * doesn't shove the chips after it away */
/* position: relative makes this the offsetParent of both #q and the highlight
   backdrop, so syncHighlight can copy the input's box in one coordinate system */
#editwrap {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    max-width: 100%;
    min-width: 0;
}

#editwrap.fill {
    flex: 1;
    min-width: 10rem;
}

/* font-family/line-height don't inherit into form controls — set them so the
 * text being typed is metrically identical to the free-text chip it becomes
 * on commit (see .qchip.qfree), with no font swap or vertical jump */
/* max-width caps sizeInput's explicit ch width at the bar's own width, so a
 * long value scrolls inside the input (native caret tracking) rather than
 * widening the pill past the screen edge */
#q {
    flex: 1;
    min-width: 6rem;
    max-width: 100%;
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.2;
    padding: 0.15rem 0;
    color: var(--text);
    background: none;
    border: none;
    outline: none;
}

#q::placeholder {
    color: var(--text-dim);
}

/* The highlight backdrop. Every metric here is #q's, because a glyph that lands
   one pixel off the character it colours reads as a rendering bug; the box
   itself is copied from the input at runtime (syncHighlight). Inert by
   construction — the input above it owns every interaction. */
#qhl {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    white-space: pre;
    font-family: inherit;
    font-size: 1.1rem;
    line-height: 1.2;
    padding: 0.15rem 0;
    color: var(--text);
}

/* Only while there is something to draw: an empty input must keep its
   placeholder, and a browser with the backdrop hidden must keep readable text
   rather than a transparent one. */
#editwrap.hl #q {
    color: transparent;
    caret-color: var(--text);
}

/* selected text redraws itself above the backdrop, so a selection still shows
   the words rather than a bare highlight block */
#editwrap.hl #q::selection {
    color: var(--text);
}

#editwrap:not(.fill):not(.editing) #q {
    min-width: 1ch;
}

/* the chip being typed hugs its content instead of filling the line.
 * the label's descent now sets the pill's bottom edge (see #editwrap's
 * baseline alignment), so the block padding is trimmed to keep this pill the
 * same height as the committed chips beside it */
#editwrap.editing {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    padding: 0.05rem 0.55rem;
    border: 1px solid var(--gold-dim);
    border-radius: 999px;
    background: rgba(var(--gold-rgb), calc(0.07 * var(--wash-strength)));
}

/* shrink-to-fit, not flex:0 0 auto: sizeInput gives the input an explicit ch
 * width, and the field label shares this row, so a percentage max-width can't
 * express "the pill minus the label" — only flex-shrink can. Without the 1 the
 * text spills out past the pill's right edge once the value gets long. */
#editwrap.editing #q {
    flex: 0 1 auto;
    min-width: 4ch;
}

#editlabel {
    margin-right: 0.35rem;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 0.95rem;
    color: var(--gold);
    white-space: nowrap;
}

/* committed chips.
 * baseline, not center: the field label is monospace and the value isn't, and
 * the two fonts sit at different heights within an equally-tall line box — so
 * centering the boxes visibly lifts the label above the text it labels */
.qchip {
    display: inline-flex;
    align-items: baseline;
    max-width: 100%;
    padding: 0.12rem 0.3rem 0.12rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(var(--overlay-rgb), calc(0.05 * var(--wash-strength)));
    font-size: 0.98rem;
    cursor: pointer;
}

/* Free text is a chip only in the model — on screen it must be indis-
 * tinguishable from words still in the input: same metrics and padding as #q,
 * no box, no hover tint, and the bar's own I-beam rather than a pointer.
 * It stays click-to-edit; the click target just isn't advertised. */
.qchip.qfree {
    border: none;
    background: none;
    padding: 0.15rem 0;
    border-radius: 6px;
    font-size: 1.1rem;
    line-height: 1.2;
    cursor: text;
}

.qchip.qfree .qchip-text {
    max-width: 36rem;
}

/* bar-wide selection: chips picked up by Ctrl+A / drag / Shift+arrows read
 * as one highlighted run together with the input's own selected text */
#q::selection {
    background: rgba(var(--select-rgb), 0.45);
}

.qchip.selected {
    background: rgba(var(--select-rgb), 0.35);
    border-color: rgba(var(--select-border-rgb), 0.7);
}

.qchip.qfree.selected {
    background: rgba(var(--select-rgb), 0.45);
    border-radius: 4px;
}

/* exclusion chips */
.qchip.not {
    border-color: rgba(var(--danger-rgb), 0.5);
    background: rgba(var(--danger-rgb), calc(0.08 * var(--wash-strength)));
}

.qchip.not.selected {
    background: rgba(var(--select-rgb), 0.35);
}

#editwrap.editing.not {
    border-color: rgba(var(--danger-rgb), 0.65);
    background: rgba(var(--danger-rgb), calc(0.08 * var(--wash-strength)));
}

#editwrap.not #editlabel {
    color: var(--danger);
}

/* the field label doubles as the include/exclude toggle — a slightly
 * larger, clearly-hoverable target since it's a small chip sub-region */
.qchip-field, #editlabel {
    cursor: pointer;
    border-radius: 999px;
}

.qchip-field:hover, #editlabel:hover {
    text-decoration: underline;
    background: rgba(var(--overlay-rgb), calc(0.08 * var(--wash-strength)));
}

.qchip-field {
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 0.88em;
    margin: -0.12rem 0.3rem -0.12rem -0.15rem;
    padding: 0.12rem 0.3rem 0.12rem 0.4rem;
}

.qchip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 24rem;
}

/* ---- what the query grammar recognises, marked in place -------------------
   ONE SHAPE, because the grammar has one: a word, optionally followed by its
   value. `attach chest`, `boneset upper body`, `seat >2`, `count >4` are all
   the same thing, so they all draw the same way — a subtle capsule around the
   word and its value together, the word tinted and the value plain. A word
   with no value (`missile`, `caster`) is just the tint.

   Nothing is ever marked wrong. Anything the grammar does not recognise is an
   ordinary text search, and is drawn as ordinary text.

   These style spans in two places at once: inside a committed chip (real DOM,
   native title tooltips) and inside #qhl (the input's backdrop, where app.js
   serves the tooltip by hit-test). One rule set for both is the point.

   METRICS ARE OFF-LIMITS IN THE BACKDROP. The caret and the native selection
   follow the input's own unstyled text, so anything that changes an advance
   width there — weight, italics, letter-spacing, padding — slides the visible
   glyphs out from under the caret. Colour, background and text-decoration are
   free; weight lives under `.qchip-text`, where there is no caret to betray. */
.bar-tok {
    border-radius: 3px;
}

/* app.js sets .hover on the backdrop span under the pointer — the backdrop is
   pointer-events: none, so :hover can never fire there on its own */
.bar-tok.hover, .qchip-text .bar-tok:hover {
    background: rgba(var(--overlay-rgb), calc(0.14 * var(--wash-strength)));
}

.qchip-text .bar-tok {
    cursor: help;
}

.bar-kw, .bar-alt, .bar-num {
    color: var(--gold);
}

/* weight only where there is no caret to slide out from under (see above) */
.qchip-text .bar-kw,
.qchip-text .bar-alt {
    font-weight: 650;
}

/* the capsule: a word and its value, held together by one faint fill. The
   halves are separate spans only so the word can be tinted and the value not —
   and so an alternation INSIDE the value can get its gold bar (`attach
   hand|chest`), which splits the value into more pieces still. They must read
   as one object, hence the shared background, the rounding on the capsule's two
   outside corners only, and -m for every piece in between. */
.bar-cap-l, .bar-cap-m, .bar-cap-r {
    background: rgba(var(--overlay-rgb), calc(0.10 * var(--wash-strength)));
}

/* the caret is inside this one (app.js .on): the capsule brightens so arrowing
   across the bar SHOWS where the value begins and ends. Background only — a
   border or padding here would shift the glyphs out from under the caret, which
   is the one thing the backdrop may never do. */
.bar-cap-l.on, .bar-cap-m.on, .bar-cap-r.on {
    background: rgba(var(--gold-rgb), calc(0.20 * var(--wash-strength)));
    box-shadow: inset 0 -1px 0 var(--gold-dim);
}

.bar-cap-l {
    border-radius: 4px 0 0 4px;
}

.bar-cap-r {
    border-radius: 0 4px 4px 0;
}

/* squared on both sides: .bar-tok's own radius would nick the shared fill */
.bar-cap-m {
    border-radius: 0;
}

.bar-phrase {
    text-decoration: underline dotted var(--gold-dim);
    text-underline-offset: 3px;
}

/* a glyph, not text — centre it rather than sitting it on the chip's baseline */
.qchip-x {
    align-self: center;
    margin-left: 0.3rem;
    padding: 0 0.35rem;
    color: var(--text-dim);
    font-size: 1.05em;
    border-radius: 50%;
}

.qchip-x:hover {
    color: var(--danger);
    background: rgba(var(--danger-rgb), calc(0.12 * var(--wash-strength)));
}

/* Field colours for chips, the edit label and suggestions. Each rule names its
   family in --tone and this one turns it into readable text — the same
   --tone -> --ink-mix path a pill's label takes. */
.qchip-field, .suggest-field {
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
}

.f-model .qchip-field, .suggest-field.f-model {
    --tone: var(--model);
}

.f-sound .qchip-field, .suggest-field.f-sound {
    --tone: var(--sound);
}

.f-soundkit .qchip-field, .suggest-field.f-soundkit {
    --tone: var(--soundkit);
}

.f-animkit .qchip-field, .suggest-field.f-animkit {
    --tone: var(--animkit);
}

.f-anim .qchip-field, .suggest-field.f-anim {
    --tone: var(--anim);
}

.f-fx .qchip-field, .suggest-field.f-fx {
    --tone: var(--fx);
}

.f-mech .qchip-field, .suggest-field.f-mech {
    --tone: var(--mech);
}

.f-name .qchip-field, .suggest-field.f-name {
    color: var(--gold);
}

.f-id .qchip-field, .suggest-field.f-id {
    color: var(--gold);
}

/* autocomplete dropdown */
#suggest {
    position: absolute;
    z-index: 5;
    margin-top: 0.25rem;
    min-width: 18rem;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(var(--shadow-rgb), calc(0.5 * var(--shadow-strength)));
    overflow: hidden;
}

.suggest-item {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    width: 100%;
    text-align: left;
    padding: 0.45rem 0.9rem;
}

.suggest-item:hover, .suggest-item.selected {
    background: rgba(var(--gold-rgb), calc(0.08 * var(--wash-strength)));
}

.suggest-field {
    font-family: Consolas, "Cascadia Mono", monospace;
}

/* typing "-mod" suggests an EXCLUSION, so the suggestion has to look like the
   chip it would make — the minus is already in the input, and offering a plain
   "model:" for it reads as the app ignoring what was typed */
.suggest-field.not {
    color: var(--danger);
}

.suggest-hint {
    color: var(--text-dim);
    font-size: 0.85em;
}

#help-btn {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 1px solid var(--border-ctrl);
    background: var(--bg-panel);
    color: var(--text-dim);
    font-weight: 600;
}

#help-btn:hover {
    color: var(--gold);
    border-color: var(--gold-dim);
}

#tabs {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

/* split field pills: "+ Label" includes, the "−" half excludes */
#tabs .tab {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--text-dim);
}

#tabs .tab[hidden] {
    display: none;
}

#tabs .tab:hover {
    border-color: var(--border);
}

#tabs .tab-inc {
    padding: 0.32rem 0.5rem 0.32rem 0.9rem;
    border-radius: 999px 0 0 999px;
}

#tabs .tab-inc::before {
    content: "+ ";
    opacity: 0.55;
}

#tabs .tab-inc:hover {
    color: var(--text);
}

#tabs .tab-exc {
    padding: 0.32rem 0.7rem 0.32rem 0.5rem;
    border-left: 1px solid transparent;
    border-radius: 0 999px 999px 0;
    opacity: var(--dim);
}

#tabs .tab:hover .tab-exc {
    border-left-color: var(--border);
}

#tabs .tab-exc:hover {
    color: var(--danger);
    opacity: 1;
}

#tabs .tab.active {
    color: var(--gold);
    border-color: var(--gold-dim);
    background: rgba(var(--gold-rgb), calc(0.08 * var(--wash-strength)));
}

#tabs .tab.active-not {
    color: var(--danger);
    border-color: rgba(var(--danger-rgb), 0.5);
    background: rgba(var(--danger-rgb), calc(0.08 * var(--wash-strength)));
}

#tabs .tab.active-not .tab-exc {
    opacity: 1;
}

#status {
    margin-top: 0.45rem;
    min-height: 1.3em;
    color: var(--text-dim);
    font-size: 0.9rem;
}

/* -------------------------------------------------------- help dialog

   AN ANATOMY DIAGRAM OF A QUERY. The dialog's one idea is that the bar already
   draws six marks and nothing ever named them, so the specimen at the top is a
   real rendered query and the legend under it names its parts — with every
   swatch drawn by the HIGHLIGHTER'S OWN CLASSES (.bar-kw, .bar-cap-*,
   .bar-phrase, .bar-alt, .qchip-field) rather than by lookalike rules here.
   That is what makes it impossible for the legend to describe a mark the bar
   draws differently. Hovering either side lights the other; see app/help.ts.

   No colour token is invented below. Everything comes from the theme layer, so
   all three palettes get this for free. */
#help {
    width: min(72rem, calc(100vw - 3rem));
    max-height: calc(100vh - 3rem);
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0;
    box-shadow: 0 18px 60px rgba(var(--shadow-rgb), calc(0.55 * var(--shadow-strength)));
}

#help::backdrop {
    background: var(--backdrop);
}

/* the title bar stays put while the body scrolls — on a short viewport the
   close button must never be the thing you have to scroll back up to find */
.help-top {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1.4rem 0.7rem;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border);
    border-radius: 14px 14px 0 0;
}

.help-top h2 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gold);
    letter-spacing: 0.03em;
}

#help-close {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-dim);
    padding: 0.1rem 0.45rem;
    border-radius: 6px;
}

#help-close:hover {
    color: var(--danger);
    background: rgba(var(--danger-rgb), calc(0.12 * var(--wash-strength)));
}

.help-body {
    overflow-y: auto;
    max-height: calc(100vh - 7rem);
    padding: 0 1.4rem 1.3rem;
}

/* One band per question a reader arrives with, separated by a rule rather than
   by a box: eight equal panels is what made the old version unreadable — every
   section looked as important as every other. */
.help-band {
    padding: 1rem 0 0.1rem;
}

.help-band + .help-band {
    border-top: 1px solid var(--border);
}

#help h3 {
    margin: 0 0 0.35rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--gold);
}

/* the sentence that sets up a band — never the explanation itself, which is
   the job of the worked example under it */
.help-lead {
    margin: 0 0 0.7rem;
    font-size: 0.86rem;
    line-height: 1.5;
    color: var(--text-dim);
    max-width: 62ch;
}

.help-lead b, .help-rule b {
    color: var(--text);
    font-weight: 600;
}

/* the closing qualifier of a band: the thing you need only once you have read
   the examples, so it sits after them and steps back */
.help-rule {
    margin: 0.7rem 0 0;
    font-size: 0.8rem;
    line-height: 1.55;
    color: var(--text-dim);
    max-width: 74ch;
}

#help code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 0.3rem;
    font-size: 0.88em;
}

#help kbd {
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 0 0.35rem;
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 0.85em;
    white-space: nowrap;
}

/* ------------------------------------------------ the specimen + legend */

/* The specimen is the real bar at reading size — same fill, same outline, same
   chips — so what the dialog dissects is visibly the thing on the page above
   it, not a picture of it. */
#help-specimen.ex-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.5rem 0.7rem;
    font-size: 1.02rem;
    background: var(--bg);
    border: 1px solid var(--border-ctrl);
    border-radius: 10px;
    cursor: pointer;
    text-align: left;
}

#help-specimen.ex-chips:hover,
#help-specimen.ex-chips:focus-visible {
    border-color: var(--gold-dim);
    background: rgba(var(--gold-rgb), calc(0.05 * var(--wash-strength)));
}

.legend {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(19rem, 100%), 1fr));
    gap: 0.2rem 1.4rem;
}

.legend li {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 0.22rem 0.4rem;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--text-dim);
    cursor: default;
}

.legend b {
    color: var(--text);
    font-weight: 600;
    white-space: nowrap;
}

/* THE SWATCH IS THE MARK: highlighter classes on real text, so it cannot come
   to look different from the bar. It takes --text rather than inheriting the
   row's --text-dim for the same reason — a capsule's value half is ordinary
   chip text in the bar — and because dim over the capsule's own fill measures
   3.5:1 on the dark palette, the known --text-dim-on-a-wash failure. */
.legend-swatch {
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 0.95em;
    white-space: pre;
    color: var(--text);
}

.legend-swatch.f-model {
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
    font-weight: 600;
}

.legend-swatch.legend-not {
    color: var(--danger);
    font-weight: 600;
}

/* CROSS-HIGHLIGHT. Hovering a legend row (or a part of the specimen) lights
   the matching thing at the other end and quiets everything else, which is the
   whole reason the legend beats a list of definitions: it points.
   Colour and opacity only — nothing moves, so there is no motion to reduce. */
.help-anatomy.lit .legend li,
.help-anatomy.lit #help-specimen .exchip {
    opacity: 0.4;
    transition: opacity 0.12s ease;
}

.help-anatomy.lit .legend li.lit,
.help-anatomy.lit #help-specimen .exchip:has([data-mark].lit),
.help-anatomy.lit #help-specimen .exchip.lit {
    opacity: 1;
}

.legend li.lit {
    background: rgba(var(--gold-rgb), calc(0.10 * var(--wash-strength)));
}

/* THE LIT PART OF THE SPECIMEN IS UNDERLINED, NOT RINGED, and that is not a
   taste call. A capsule is drawn in several adjacent spans, so a ring per span
   would draw internal walls through the one shape it is meant to point at,
   while adjacent underlines merge into a single continuous rule. It also keeps
   clear of the fills these marks already carry — stacking a second fill over a
   capsule or an excluded chip is the two-fills trap the theme section warns
   about. The chip-level mark keeps a ring, because there it IS one shape. */
#help-specimen [data-mark].lit {
    box-shadow: inset 0 -2px 0 var(--gold);
}

#help-specimen .exchip.not[data-mark].lit {
    box-shadow: 0 0 0 2px var(--gold);
    border-radius: 999px;
}

/* -------------------------------------------------- query / meaning pairs */

/* Two queries that differ by one pair of quotes, stacked so the difference is
   the only thing that moves. These answer "why did my search do that", so the
   pairs are aligned in a column and read down. */
.help-pairs {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.3rem;
}

/* TWO CONTRASTS, SIDE BY SIDE — but each one still stacked, which is the whole
   constraint. Column flow is what buys both: items 1-2 fill the left column and
   3-4 the right, so the two queries of a contrast stay one above the other and
   the quotes are still the only thing that moves. Laying them out in ROWS would
   halve the height just as well and put a paragraph of meaning between the two
   queries you are meant to be comparing. */
@media (min-width: 56rem) {
    .help-pairs {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: repeat(2, auto);
        grid-auto-flow: column;
        gap: 0.3rem 2.2rem;
    }
}

/* TWO COLUMNS, so the queries stack in one column and their meanings in
   another: this band exists to show that two queries differ by one pair of
   quotes, and that only reads if the difference is the ONLY thing that moves.
   max-content sizes the first column to the widest query rather than to each
   row's own. */
.help-pairs li {
    display: grid;
    grid-template-columns: minmax(0, max-content) 1fr;
    align-items: center;
    gap: 0.15rem 0.6rem;
}

/* narrow: the meaning drops under its query and indents, so it still reads as
   belonging to the one above rather than to the one below */
@media (max-width: 34rem) {
    .help-pairs li {
        grid-template-columns: 1fr;
    }

    .help-pairs span {
        padding-left: 0.8rem;
    }
}

.help-pairs span {
    font-size: 0.8rem;
    color: var(--text-dim);
    line-height: 1.4;
}

/* Stacked (narrow), the two contrasts need saying apart, because nothing else
   does it: a gap wide enough to read as "new question" and narrow enough to
   stay one list. Side by side the columns already say it. */
@media (max-width: 55.99rem) {
    .help-pairs li.pair-break {
        margin-top: 0.75rem;
    }
}

/* an example dropped into a sentence — it must sit on the text's baseline
   rather than starting a new block */
.help-inline.ex-chips {
    vertical-align: baseline;
}

/* ----------------------------------------------------------- vocabulary */

/* The words a column offers, generated from the same registry autocomplete
   reads (app/help.ts). Each is a real search button, so the row doubles as the
   fastest way into the data — and each carries the registry's own hint as its
   tooltip, which is where the detail went when the prose came out. */
#help-vocab {
    display: grid;
    gap: 0.3rem;
}

.vocab-row {
    display: grid;
    grid-template-columns: 5.2rem 1fr;
    align-items: baseline;
    gap: 0.5rem;
}

.vocab-field {
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 0.78rem;
    font-weight: 600;
    text-align: right;
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
    cursor: help;
}

/* the shared row is not a column, so it must not borrow a column's colour */
.vocab-shared .vocab-field {
    font-family: inherit;
    font-weight: 500;
    font-style: italic;
    color: var(--text-dim);
}

.vocab-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.vocab-word {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.05rem 0.42rem;
    font-size: 0.78rem;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}

.vocab-word:hover,
.vocab-word:focus-visible {
    color: var(--gold);
    border-color: var(--gold-dim);
    background: rgba(var(--gold-rgb), calc(0.10 * var(--wash-strength)));
}

.vocab-shared {
    margin-top: 0.15rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--border);
}

/* A word that says nothing on its own gets a blank to fill in — the value half
   of a capsule, empty. Clicking it starts the word in the bar with the caret
   there (see the help dialog's click handler) rather than running it. */
.vocab-word.takes-value::after {
    content: "";
    width: 0.85em;
    border-bottom: 1px dashed currentColor;
    opacity: 0.55;
    margin-bottom: 0.22em;
    align-self: flex-end;
}

/* the target glyphs ride their word at text size */
.vocab-word .ticon svg {
    width: 0.95em;
    height: 0.95em;
}

/* ------------------------------------------------------------- key map */

/* The gesture bands are a KEY MAP, not prose — the same shape app/tooltip.ts
   renders a pill's gesture lines as, so the help and the tooltips teach in one
   voice. It is a <dl> because that is what it is. */
.help-keys {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
    gap: 0.2rem 2rem;
}

.help-keys dl {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: baseline;
    gap: 0.22rem 0.7rem;
    margin: 0;
    font-size: 0.8rem;
}

.help-keys dt {
    text-align: right;
    color: var(--text);
    white-space: nowrap;
}

.help-keys dd {
    margin: 0;
    color: var(--text-dim);
}

/* ------------------------------------------- worked examples, both homes */

/* An example redrawn as the CHIPS it makes (decorateExamples). The button stops
   being a code box and becomes the bar's own row of tags, so reading the help
   and reading the search bar are the same act. Metrics are the chips' own —
   this is static DOM, so weight and padding are free here.

   IT IS DRAWN AS A MINIATURE SEARCH BAR — same panel fill, same rounded
   outline, borrowed from #qbar above. Without it two chips sitting side by side
   read as two separate examples, which is exactly backwards for the ones whose
   whole point is that several tags combine into ONE query. */
#help .ex-chips,
.es-examples button.ex-chips {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.3rem;
    font-family: inherit;
    font-size: 0.8rem;
    color: var(--text);
    background: var(--bg-panel);
    border: 1px solid var(--border-ctrl);
    border-radius: 8px;
    padding: 0.15rem 0.4rem;
    cursor: pointer;
}

#help .ex-chips:hover,
#help .ex-chips:focus-visible,
.es-examples button.ex-chips:hover,
.es-examples button.ex-chips:focus-visible {
    background: rgba(var(--gold-rgb), calc(0.08 * var(--wash-strength)));
    border-color: var(--gold-dim);
}

.exchip {
    display: inline-flex;
    align-items: baseline;
    padding: 0.05rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
}

/* free text is not a box in the bar either — it must not become one here */
.exchip.exfree {
    border: none;
    background: none;
    padding: 0.05rem 0;
}

.exchip.not {
    border-color: rgba(var(--danger-rgb), 0.5);
    background: rgba(var(--danger-rgb), calc(0.08 * var(--wash-strength)));
}

.exchip .qchip-field {
    cursor: inherit;
    margin-right: 0.3rem;
    padding: 0;
}

.exchip .qchip-field:hover {
    text-decoration: none;
    background: none;
}

.exchip .bar-tok {
    cursor: inherit;
}

/* --------------------------------------------------------------- toolbar */

#toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.4rem 0 0.6rem;
}

#filters, #columns {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.9rem;
}

#filters {
    gap: 0.4rem;
}

/* ------------------------------------------------- the column rack

   ONE IDENTITY COLOUR, DECLARED ONCE, WORN BY BOTH SURFACES: the chip in the
   rack and the column's own header cell. That shared colour is what lets the
   two be recognised as one object, and it is why this is --col-tone and not
   the --tone the cells already carry. THE TWO ARE NOT THE SAME SCALE and must
   not be merged: .c-sounds is --soundkit, .c-animations is --animkit, and
   .c-fx and .c-mechanics are BOTH --fx — a set of five that contains a
   duplicate, which is fine for tinting a group box and useless as identity,
   since two headers would come out the same colour. --tone is left exactly as
   it is; every pill in the table reads it. */
.c-models, #columns .col-chip[data-col="models"] {
    --col-tone: var(--model);
}

.c-sounds, #columns .col-chip[data-col="sounds"] {
    --col-tone: var(--sound);
}

.c-animations, #columns .col-chip[data-col="animations"] {
    --col-tone: var(--anim);
}

.c-fx, #columns .col-chip[data-col="fx"] {
    --col-tone: var(--fx);
}

.c-mechanics, #columns .col-chip[data-col="mechanics"] {
    --col-tone: var(--mech);
}

/* Its own line, hard against the table, with a rule above it: the rack belongs
   to the table below rather than to the toolbar it sits in, and adjacency is
   the cheapest half of saying so. */
#columns {
    flex: 1 0 100%;
    flex-wrap: wrap;
    gap: 0.6rem;
    border-top: 1px solid var(--border);
    margin-top: 0.15rem;
    padding-top: 0.5rem;
}

#cols-rack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

/* The gestures, in print. The row this replaces kept both of them in a `title`
   and the complaint was exactly that nothing said either one out loud — so the
   hint is stated rather than hovered for, and it earns its place in the space
   the toolbar was already wasting. */
#cols-hint {
    margin: 0 0 0 auto;
    color: var(--text-dim);
    font-size: 0.82em;
}

/* A HANDLE, NOT A PILL — square-ish where the table's pills are round, because
   this is chrome that edits content and the two should not be read as the same
   kind of thing. It is also what separates the rack at a glance from the
   tri-state FILTER chips one line up, which are pills and mean something else
   entirely. */
#columns .col-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font: inherit;
    color: var(--text);
    background: color-mix(in srgb, var(--col-tone) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--col-tone) 55%, var(--border));
    border-radius: 8px;
    padding: 0.2rem 0.45rem 0.2rem 0.35rem;
    line-height: 1.5;
    cursor: grab;
    user-select: none;
    transition: background-color 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
    /* the drag is pointer-driven, so the browser must not claim a horizontal
       swipe for scrolling before pointermove is seen */
    touch-action: none;
}

#columns .col-chip:hover {
    background: color-mix(in srgb, var(--col-tone) 20%, transparent);
    border-color: var(--col-tone);
    transform: translateY(-1px);
}

#columns .col-chip:active {
    cursor: grabbing;
    transform: none;
}

/* SIX DOTS, DRAWN RATHER THAN DRAWN FROM. The app's icon set is seven 24×24
   line-art glyphs with a process behind it (build/icons) and this is a texture,
   not a picture of anything, so it adds nothing to that set. It stays lit at
   rest: a handle that only appears on hover is a handle nobody knows is there,
   which is the fault being fixed. */
.col-grip {
    flex: none;
    width: 6px;
    height: 12px;
    background-image: radial-gradient(currentColor 45%, transparent 47%);
    background-size: 3px 4px;
    color: var(--text-dim);
}

#columns .col-chip:hover .col-grip {
    color: var(--text);
}

/* THE SWITCH. A track and a knob — the one on/off vocabulary nobody has to be
   taught. What it replaces was a solid border against a dashed one, which is a
   difference you have to be told to look for before you can see it. */
.col-switch {
    flex: none;
    position: relative;
    width: 24px;
    height: 14px;
    border-radius: 999px;
    background: var(--col-tone);
    transition: background-color 0.14s ease;
}

.col-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--bg);
    transition: left 0.14s ease;
}

/* OFF: the knob slides home, the track goes neutral, the tone drains from the
   chip and the name steps back. Four signals for one fact, because this is the
   fact the old row asked a dashed border to carry alone. */
#columns .col-chip.off {
    color: var(--text-dim);
    background: none;
    border-color: var(--border);
}

#columns .col-chip.off:hover {
    color: var(--text);
    border-color: var(--border-ctrl);
    background: rgba(var(--overlay-rgb), calc(0.08 * var(--wash-strength)));
}

#columns .col-chip.off .col-switch {
    background: var(--border-ctrl);
}

#columns .col-chip.off .col-switch::after {
    left: 2px;
}

#columns .col-chip.dragging {
    opacity: 0.45;
}

/* WHERE IT WILL LAND, on the side the pointer is on. An inset shadow rather
   than a border: a border would widen the chip and shove its neighbours
   sideways while the pointer is trying to aim at them. */
#columns .col-chip.drop-before {
    box-shadow: inset 3px 0 0 var(--gold);
}

#columns .col-chip.drop-after {
    box-shadow: inset -3px 0 0 var(--gold);
}

/* THE OTHER END OF THE TIE. Each payload column's header sits on a rule in its
   own identity colour — the same colour its chip wears — so the rack and the
   table read as one set of five things rather than two unrelated rows of five.
   It costs no layout: `#results th` already draws a 2px bottom border and only
   its COLOUR changes here. The three bookkeeping headers (#, ID, Name) keep the
   neutral border, which is true — they are not columns the rack can move. */
#results th.c-models,
#results th.c-sounds,
#results th.c-animations,
#results th.c-fx,
#results th.c-mechanics {
    border-bottom-color: color-mix(in srgb, var(--col-tone) 60%, var(--border));
}

/* AND THE TIE, DEMONSTRATED. Point at a chip and its column lights all the way
   down the table; point at a header and its chip lights back. A relationship
   you watch happen needs no legend, and here it is the only thing that can
   work: the table is far wider than its wrapper and scrolls, so a chip can
   never be positioned over the column it controls.

   A VEIL, NOT A FILL — color-mix with transparent, so it lies OVER the row and
   the row's own colour (and its hover) still reads through. An opaque tint
   would take the row's hover away from exactly the column being pointed at. */
#results.lit-models td.c-models,
#results.lit-sounds td.c-sounds,
#results.lit-animations td.c-animations,
#results.lit-fx td.c-fx,
#results.lit-mechanics td.c-mechanics {
    background: color-mix(in srgb, var(--col-tone) 8%, transparent);
}

#results.lit-models th.c-models,
#results.lit-sounds th.c-sounds,
#results.lit-animations th.c-animations,
#results.lit-fx th.c-fx,
#results.lit-mechanics th.c-mechanics {
    border-bottom-color: var(--col-tone);
    color: var(--text-strong);
}

/* the return path: hovering a header lights that column's chip, which is how a
   reader finds out the rack is what moves the thing under their pointer */
#columns .col-chip.lit {
    background: color-mix(in srgb, var(--col-tone) 20%, transparent);
    border-color: var(--col-tone);
}

#columns .col-chip.off.lit {
    background: rgba(var(--overlay-rgb), calc(0.08 * var(--wash-strength)));
    border-color: var(--border-ctrl);
}

/* tri-state filter buttons: any -> only-with (gold ✓) -> only-without (red ✕) */
#filters .tri {
    cursor: pointer;
    user-select: none;
    font: inherit;
    color: var(--text-dim);
    background: none;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.08rem 0.6rem 0.08rem 0.5rem;
    line-height: 1.5;
}

#filters .tri::before {
    content: "•";
    margin-right: 0.35rem;
    opacity: 0.45;
}

#filters .tri:hover {
    border-color: var(--border);
}

#filters .tri[data-state="with"] {
    color: var(--gold);
    border-color: var(--gold-dim);
}

#filters .tri[data-state="with"]::before {
    content: "✓";
    opacity: 1;
}

#filters .tri[data-state="without"] {
    color: var(--danger);
    border-color: var(--danger);
}

#filters .tri[data-state="without"]::before {
    content: "✕";
    opacity: 1;
}

#export {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    color: var(--text-dim);
    font-size: 0.9rem;
}

#export button {
    padding: 0.22rem 0.7rem;
    border: 1px solid var(--border-ctrl);
    border-radius: 6px;
    background: var(--bg-panel);
    color: var(--text);
    font-size: 0.85em;
    transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}

#export button:hover {
    border-color: var(--gold-dim);
    color: var(--gold);
    box-shadow: 0 0 10px rgba(var(--gold-rgb), 0.15);
}

.export-sep {
    width: 1px;
    align-self: stretch;
    background: var(--border);
}

/* ----------------------------------------------------------------- table */

.table-wrap {
    overflow-x: auto;
}

/* SCOPED TO #results ON PURPOSE — every rule in this section is. Bare `table`
   / `th` / `td` / `tbody tr` selectors also hit any table the page does not
   own: Wowhead's embedded tooltip is built from one, and it was picking up the
   sticky opaque `th` background (a rectangle that ignores their border), our
   cell padding, our column rules and width:100%. The results table is the only
   table the app has, so nothing here needs to be global. */
#results {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

#results th {
    text-align: left;
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.45rem 0.6rem;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 2;
}

/* the sortable header's interactive part is a real <button> (keyboard-
   operable); it fills the cell so the whole header stays clickable, and
   inherits the th's uppercase/spacing so it looks identical to a plain th */
#results th[data-sort] {
    padding: 0;
}

#results th[data-sort] > button {
    width: 100%;
    padding: 0.45rem 0.6rem;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

#results th[data-sort]:hover {
    color: var(--text);
}

#results th.sorted {
    color: var(--gold);
}

#results th .arrow {
    font-size: 0.7em;
}

#results td {
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

/* faint column separators keep tall uneven rows readable */
#results td:not(:last-child), #results th:not(:last-child) {
    border-right: 1px solid var(--border-faint);
}

#results tbody tr {
    background: var(--bg-row);
}

#results tbody tr:hover {
    background: var(--bg-row-hover);
    box-shadow: inset 3px 0 0 var(--gold-dim);
}

/* #results-prefixed like the cell rules above it, and for the same reason: its
   font-size and text-align have to keep outranking `#results th`, exactly as
   the bare `.c-idx` outranked the bare `th`. The other .c-* rules set only
   widths, which no cell rule competes for. */
#results .c-idx {
    width: 2.5rem;
    color: var(--text-dim);
    font-size: 0.85em;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

#results th.c-idx {
    text-align: right;
}

.c-id {
    width: 6.25rem;
}

/* Carries the command strip under the name, so the floor is "one nowrap strip
   of command buttons", not the name text. min-width states that intent; the
   strip's own min-content width enforces it, so adding a command to
   CFG.spellCommands widens the column instead of wrapping the strip. */
.c-name {
    min-width: 17rem;
    max-width: 24rem;
}

/* matches .kit-files' line-height below, so a bare model pill (no kit
   wrapper of its own) comes out exactly as tall as a sound/animation one */
.c-models {
    min-width: 14rem;
    line-height: 1.15;
}

.c-sounds {
    min-width: 16rem;
}

.c-animations {
    min-width: 12rem;
}

.c-fx {
    min-width: 13.5rem;
}

.c-mechanics {
    min-width: 10rem;
}

.id-copy {
    color: var(--gold);
    font-variant-numeric: tabular-nums;
}

.id-copy:hover {
    text-decoration: underline;
}

/* The ID cell's pill: the id itself, with the expansion that introduced it as a
   sub-tag. The pill carries no family tone — identity is not a content family,
   the same call the delivery line makes. */
.tag.spellid {
    align-items: center;
    background: none;
    border: 0;
    display: flex;
    gap: 3px;
    padding: 0;
}

/* the id keeps the gold it had before it became a pill — the copy segment's
   own colour is declared later than .id-copy, so this has to out-specify it */
.tag.spellid > .id-copy {
    color: var(--gold);
    font-size: inherit;
}

/* The expansion sub-tag. HIDDEN AT REST and revealed on row hover, because
   every spell has one: drawn always it would be 276,332 repetitions of a fact
   nobody asked for, and it would be the widest thing in a column sized to a
   6-digit number. It stays drawn when it is a HIT, so filtering by expansion
   shows what it selected — the same "light up when it is what you asked for"
   rule the pills and the delivery line follow. `.era` rides on the note kind's
   own `.tag-attach` class, so it inherits that styling and overrides only the
   placement. */
.tag.spellid > .era {
    /* The note kind is built to sit BETWEEN a label and a copy button, so it
       arrives with chip padding and an ellipsis clamp. Here it is a prefix to
       the id — one unit, not two — so all of that comes off. */
    max-width: none;
    overflow: visible;
    padding: 0;
}

/* The id's copy segment asks for a left divider, which is right when it trails
   a label and wrong here: the expansion in front of it is an attribute of the
   id, not a neighbouring control. (The icon's own divider is already handled —
   `.tag > :first-child[data-sep="left"]` suppresses it for whatever leads.) */
.tag.spellid > .id-copy {
    border-left: 0;
    /* the copy segment's own left padding is for sitting after a divider;
       here it would just push the id off its expansion */
    padding-left: 0;
}

/* Sized by HEIGHT with the width free, because the set is deliberately mixed:
   Vanilla and TBC are square-ish sigils, everything from Wrath on is a wordmark
   at its own aspect. This is the wiki's own inline treatment. */
.tag.spellid > .era img {
    display: block;
    height: 15px;
    width: auto;
    /* Held just short of full so eleven wordmarks down a column read as a quiet
       attribute of the ids rather than as eleven pieces of competing art. The
       gold id stays the loudest thing in the cell, which is what it is for. */
    opacity: 0.72;
}

.tag.spellid:hover > .era img {
    opacity: 1;
}

.tag.spellid > .era.hit {
    /* the segment's own `.tag-attach.hit` gold is for TEXT; an image cannot
       take a colour, so a matched expansion is marked by lifting the art out
       of its resting dimness instead */
    opacity: 1;
}

.spell-name {
    color: var(--text-strong);
    font-weight: 600;
    /* THE POSITIONING CONTEXT FOR .desc-mark, and it is this block rather than
       the cell on purpose. A <td> stretches to whatever the table gives it, so
       anchoring to the cell sent the mark to the far right the moment every
       other column was hidden and the name column took the whole width. This
       block is width-capped, so the mark lands in the same place whatever the
       column layout is — which was the point of pinning it at all.

       The gutter is reserved on EVERY row, not only the ones with a mark: a
       long name must never run under the glyph, and a padding that came and
       went would make the right edge ragged down the column. */
    position: relative;
    max-width: 24rem;
    padding-right: 1.5rem;
}

.spell-name-link {
    color: inherit;
    text-decoration: none;
}

.spell-name-link:hover {
    color: var(--gold);
}

/* The spell's icon — §3y.

   IT IS A CONTROL NOW, not decoration: icons are shared by 27.7 spells on
   average, so "everything that looks like this" is a real question and the
   picture is the obvious place to ask it. That is also why it had to leave the
   Wowhead anchor it used to sit inside — see spellIcon() in render.ts.

   THE FRAME IS ON THE BUTTON AND THE PICTURE IS ON THE IMG. Keeping them apart
   is what lets the border change colour on hover and on a hit without the
   image's box moving: a border-WIDTH that came and went would nudge the name
   beside it, and a column of names that shifts on hover is worse than no
   affordance at all. */
.icon-btn {
    display: inline-flex;
    margin-right: 0.4rem;
    padding: 0;
    border: 1px solid rgba(var(--overlay-rgb), 0.14);
    border-radius: 3px;
    background: rgba(var(--shadow-rgb), calc(0.3 * var(--shadow-strength)));
    vertical-align: -5px;
    cursor: pointer;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

/* Hover says "this does something" and nothing more — it must NOT borrow the
   gold a hit uses, or the two states become one and the border stops carrying
   information the moment the pointer is anywhere near it. Brightening the same
   overlay token is the quietest thing that still reads as a response. */
.icon-btn:hover {
    border-color: rgba(var(--overlay-rgb), 0.5);
}

/* A hit is gold plus a halo, so it is findable scanning DOWN a column of fifty
   rows rather than only once you are already looking at it — the same job
   .desc-mark.hit does, which can do it with colour alone because it sits in a
   fixed corner. An icon sits at a different x on every row. */
.icon-btn.hit,
.icon-btn.hit:hover {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold);
}

.spell-icon {
    display: block;
    width: 20px;
    height: 20px;
    /* one inside the button's 3px, so the corners nest instead of clipping */
    border-radius: 2px;
}

/* "This spell says what it does" — §3x.

   PINNED TO THE TOP-RIGHT OF .spell-name, not trailed after the link (user,
   2026-08-10). Following the link put it at a different x on every row, which
   makes a column whose whole job is to be scanned something you have to hunt
   down; a fixed corner reads as a column of its own without costing one.

   Resting tone is --tag-btn, the token for "a small glyph living in a row",
   and NOT --text-dim: DECISIONS.md records --text-dim over a hit wash as a
   whole family of dark-theme contrast failures, and the cheap half of that fix
   is a new element simply declining to opt in. */
.desc-mark {
    position: absolute;
    top: 0.15rem;
    right: 0;
    display: inline-flex;
    /* a real <button>, so the browser's chrome has to be taken off it */
    padding: 0;
    border: 0;
    background: none;
    color: var(--tag-btn);
    /* TAP TARGET. A 13px glyph is not a touch target, and on a phone the tap is
       the ONLY way to reach the panel — hover does not exist there. The box is
       grown with padding-box space rather than a bigger icon so the glyph keeps
       its size and its corner. */
    inset-block-start: 0;
    padding: 0.35rem 0.3rem;
    margin: -0.35rem -0.3rem 0 0;
    cursor: pointer;
}

.desc-mark:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: -2px;
    border-radius: 3px;
}

.desc-mark:hover {
    color: var(--text-strong);
}

.desc-mark svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
}

.desc-mark.hit {
    color: var(--gold);
}

.spell-sub {
    color: var(--text-dim);
    font-size: 0.85em;
}

/* The delivery line — how the spell is cast, in words, under its name.
   NO COLOUR HERE ON PURPOSE: colour in this app names a content family, and
   delivery is identity rather than content (see docs/PILLS.md). Weight is the
   only typography — the number and its load-bearing word read at --text, the
   rest at --text-dim. */
.delivery {
    font-size: 0.85em;
    color: var(--text-dim);
    margin-top: 1px;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.34em;
    align-items: baseline;
}

.delivery .d-v {
    color: var(--text);
    font-weight: 600;
}

.delivery .d-sep {
    opacity: 0.55;
}

/* The segment the query asked for. GOLD IS NOT A CONTENT COLOUR, which is why
   this does not contradict the rule above: every other tone in the app names a
   family of content, gold names "this is your match", and the delivery line is
   as entitled to say that as a pill is.
   IT IS `mark.hl`'s WASH, deliberately — the name two lines up highlights its
   matched letters exactly this way, and one cell must not have two idioms for
   the same statement. The label is lifted off --text-dim while it holds,
   because dim text on a hit wash is this app's one standing contrast failure
   (see CLAUDE.md); at --text it is the same composite mark.hl already ships. */
.delivery .d-seg.hit {
    background: rgba(var(--gold-rgb), calc(0.28 * var(--wash-strength)));
    border-radius: 3px;
    padding: 0 3px;
    margin: 0 -1px;
}

.delivery .d-seg.hit .d-l {
    color: var(--text);
}

mark.hl {
    background: rgba(var(--gold-rgb), calc(0.28 * var(--wash-strength)));
    color: inherit;
    border-radius: 3px;
    padding: 0 1px;
}

#results td.empty {
    text-align: center;
    vertical-align: middle;
}

/* "no value" marker — a readable dim (was opacity .5 ≈ 2.3:1, failed 1.4.3) */
.none {
    color: var(--text-muted);
}

/* column hiding */
#results.hide-models .c-models {
    display: none;
}

#results.hide-sounds .c-sounds {
    display: none;
}

#results.hide-animations .c-animations {
    display: none;
}

#results.hide-fx .c-fx {
    display: none;
}

#results.hide-mechanics .c-mechanics {
    display: none;
}

/* the wowhead link is the strip's last segment — same slab, same divider, so
   the row carries one object rather than a control plus a stray icon */
.cmd-row .wh-cmd {
    width: 1.5rem;
    height: auto;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.12s, background-color 0.12s;
}

/* it does NOT invert like a command does — the favicon is a coloured image,
   and a gold plate behind it reads as a swatch rather than a hover */
.cmd-row .wh-cmd:hover {
    opacity: 1;
    background: rgba(var(--overlay-rgb), calc(0.10 * var(--wash-strength)));
}

.cmd-row .wh-cmd img {
    width: 1rem;
    height: 1rem;
}

/* kit boxes: the kit id as a tinted head segment, its files flowing
 * (and wrapping) beside it — one consistent shape for 1 or 10 files */
.kit-group {
    display: flex;
    align-items: stretch;
    max-width: 100%;
    margin: 0.18rem 0;
    border: 1px solid color-mix(in srgb, var(--tone) var(--tone-edge), var(--border));
    border-radius: 8px;
    background: color-mix(in srgb, var(--tone) var(--group-fill), transparent);
    overflow: hidden;
}

.kit-group:first-of-type {
    margin-top: 0.05rem;
}

.kit-group:last-of-type {
    margin-bottom: 0.05rem;
}

/* Stretch so the header tag (and its full-height hover buttons) fill the whole
   strip, even when kit-files wraps to multiple lines and grows taller.

   The head is tinted by the column's family, one step LOUDER than the field its
   pills lie on, so a group always reads head-then-contents. One rule now, from
   the inherited --tone: it used to be four `.c-x .kit-head` rules whose alphas
   differed by a point or two each, and one knob is worth more than that tuning. */
.kit-head {
    display: flex;
    align-items: stretch;
    flex: none;
    background: color-mix(in srgb, var(--tone) var(--head-fill), transparent);
}

.kit-head .tag, .kit-head .tag.hit {
    border: none;
    background: none;
    margin: 0;
    border-radius: 0;
}

.kit-group.hit {
    border-color: var(--gold-dim);
}

.kit-group.hit .kit-head {
    background: rgba(var(--gold-rgb), calc(0.13 * var(--wash-strength)));
}

.kit-files {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.12rem 0.25rem;
    padding: 0.15rem 0.4rem;
    border-left: 1px solid var(--border);
    line-height: 1.15;
}

.kit-files .tag {
    margin: 0;
}

/* models aren't grouped under a kit, but should still come out the same
   height as sound files and animations (both always seen at this size) */
.kit-files .tag, .c-models .tag {
    font-size: 0.82em;
}

.kit-files .tag-label, .c-models .tag-label {
    padding: 0.06rem 0.4rem;
}

.kit-files .tag-copy, .c-models .tag-copy {
    padding: 0.26rem 0.35rem 0.06rem 0.3rem;
}

/* +0.2rem top = the baseline nudge */
.c-models .tag-view {
    padding: 0.06rem 0.3rem 0.06rem 0.45rem;
}

.kit-files .tag-play {
    padding: 0.06rem 0.32rem;
}

/* single-item (or head-only, e.g. freeze/camo) groups render compact: ONE
   tag-shaped pill instead of a box — the category word leads, the lone item's
   tag melts into the pill (chrome stripped, its capsule below is the section
   divider).

   THE HEAD READS AT FULL STRENGTH, exactly as it does on a full-width group.
   It was dimmed to 0.8 once, on the reasoning that a category word prefixing
   its value is a qualifier like the control word on a summon pill. It is not:
   it is the same head, saying the same thing, and only the item count decided
   which shape it got — so dimming made the identical word two brightnesses
   depending on how many siblings it happened to have. The capsule around the
   item is what separates category from value (PILLS.md §4); it does not need
   a brightness gradient's help.

   SIZE MATCHES A FULL GROUP, for the same reason. The container carries NO
   font-size: the head sizes via .tag / .c-models .tag and the lone item via
   .kit-files .tag, the exact rules a full-width group uses — so text and icons
   come out identical whether the group has one item or ten. A container
   font-size here (0.82em once) compounded with the inner .tag ems and shrank
   the head below even a standalone pill. Do not re-add one. */
.kit-group.compact {
    display: inline-flex;
    align-items: center;
    width: auto;
    max-width: 100%;
    vertical-align: top;
    margin: 0.1rem 0.25rem 0.1rem 0;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tone) var(--group-fill), transparent);
}

/* The head paints nothing of its own here — the group IS its surface. That
   surface is the kit box's FIELD, not the head's own fill, because the item's
   .tag lies on top of it and the two fills stack: field + pill lands right
   about where a full group's head does, which is the loudest floor every label
   was solved against. Give this the head's fill instead and the stack goes
   past that floor, taking the dim labels on a summon pill under AA. */
.kit-group.compact .kit-head {
    background: none;
}

.kit-group.compact.hit {
    background: rgba(var(--gold-rgb), calc(0.10 * var(--wash-strength)));
}

.kit-group.compact .kit-head:not(:last-child) .tag-label {
    padding-right: 0.4rem;
}

/* The lone item sits in its own rounded capsule inside the pill — attached yet
   distinct; head-only pills (freeze/camo) have no capsule.

   The capsule is a FRAME, not a surface: it draws the edge and clips to it
   (overflow + radius), and the fill inside comes from the item's own .tag, so a
   sound file compacted is the same green as the same file in a full group. Give
   the capsule a fill of its own and it would be the COLUMN's family — teal
   around a green label — because --tone here is the group's, not the item's. */
.kit-group.compact .kit-files {
    flex: none;
    padding: 0;
    margin: 2px;
    border: 1px solid color-mix(in srgb, var(--tone) var(--tone-edge), var(--border));
    border-radius: 999px;
    overflow: hidden;
}

.kit-group.compact .kit-files:has(> .tag.hit) {
    border-color: var(--gold-dim);
}

/* squared off and flush: the capsule's own radius and overflow shape it */
.kit-group.compact .kit-files .tag {
    border: none;
    margin: 0;
    border-radius: 0;
}

/* tags */

/* A pill is coloured by its OWN family, fill and edge included — not just its
   label. Both come from --tone (set per pill kind below), through the two
   theme tokens --tone-fill and --tone-edge, so how loudly pills carry their
   colour is a property of the palette and not of any pill type. On dark that
   is a 3% lift and a neutral border, the look the app has always had; a light
   palette turns both up, because a pale surface needs the colour in the shape
   rather than in eight-pixel-tall text. */
.tag {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    margin: 0.1rem 0.25rem 0.1rem 0;
    border: 1px solid color-mix(in srgb, var(--tone) var(--tone-edge), var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--tone) var(--tone-fill), transparent);
    font-size: 0.86em;
    overflow: hidden;
}

/* target-type icons (who the content plays on) — a run of small glyphs on
   the pill's left edge, before the label. Not buttons: they carry a title
   and nothing else, so they must not eat clicks meant for the pill. */
.ticons {
    display: inline-flex;
    align-items: center;
    gap: 0.1em;
    padding: 0 0.1rem 0 0.45rem;
    flex: none;
}

.ticon {
    display: block;
    cursor: help;
}

/* The query named a target type this row carries. The gold goes BEHIND the
   glyphs, never on them: these icons are the one segment whose colour already
   carries the meaning (caster dim, target mech, area fx, never-caster danger),
   so tinting them gold would trade a type distinction for a state one. Same
   move as .tag.hit, which washes a pill without touching its label. */
.ticons.hit {
    background: rgba(var(--gold-rgb), calc(0.16 * var(--wash-strength)));
    box-shadow: inset 0 0 0 1px var(--gold-dim);
    border-radius: 999px;
    /* the wash needs room to read as a shape, and the pill's own left padding
       is what it borrows — so the icons do not shift when they light up */
    padding-right: 0.28rem;
    padding-left: 0.3rem;
    margin-left: 0.15rem;
}

.ticon svg {
    width: 0.82em;
    height: 0.82em;
    display: block;
}

.t-caster {
    color: var(--text-dim);
}

.t-target {
    --tone: var(--mech);
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
}

.t-notcaster {
    color: var(--danger);
}

.t-area {
    --tone: var(--fx);
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
}

/* a label straight after the icons doesn't need its own left padding */
.ticons + .tag-label {
    padding-left: 0.3rem;
}

/* the same glyphs inline in the help dialog's legend */
.legend-icon {
    display: inline-block;
    vertical-align: -0.15em;
}

.legend-icon svg {
    width: 1em;
    height: 1em;
    display: block;
}

/* Section dividers. Which side of a segment carries one is declared with the
   segment KIND in pills.js (sep: "left" | "right" | "none") and rendered as
   data-sep, so a new kind draws its divider by saying so rather than by
   repeating a border rule. The line is quieter between a segment and the text
   it qualifies (role="meta") than around the action buttons at the pill's
   edges, which are separate controls. */
.tag {
    --seg-divider: var(--border);
}

.tag [data-role="meta"] {
    --seg-divider: rgba(var(--overlay-rgb), calc(0.12 * var(--wash-strength)));
}

.tag [data-sep="left"] {
    border-left: 1px solid var(--seg-divider);
}

.tag [data-sep="right"] {
    border-right: 1px solid var(--seg-divider);
}

/* A divider separates two segments, so the outer edges never carry one — a
   border on the first or last child draws a line down the pill's own rim. It
   only came up once the spell-link chip put its id (a copy segment, which asks
   for a left divider) FIRST, but the rule belongs to the divider system rather
   than to that pill: any kind can now lead or trail without a special case. */
.tag > :first-child[data-sep="left"] {
    border-left: 0;
}

.tag > :last-child[data-sep="right"] {
    border-right: 0;
}

/* where on the model a row plays (M2 attachment point). A quiet segment
   between the label and the copy button — it qualifies the model rather than
   naming it, so it reads dimmer and smaller than the label it follows.
   Beams and missiles span two points and render "Source → Dest". */
.tag-attach {
    padding: 0.12rem 0.45rem;
    font-size: 0.86em;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 14rem;
}

.tag-attach:hover {
    text-decoration: underline;
    color: inherit;
}

.tag-attach.hit {
    color: var(--gold);
}

/* A missile's flight path. Reads exactly like .tag-attach — same dim weight,
   same divider — but clamps at 9rem rather than 14: the per-spell script names
   ("5.2 Legendary Scenario - Throw Axes") run past 40 characters, and a pill
   already spends its width on the model name and the attachment pair. The full
   name is on the tooltip, so nothing is lost to the ellipsis. */
.tag-motion {
    padding: 0.12rem 0.45rem;
    font-size: 0.86em;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 9rem;
}

.tag-motion:hover {
    text-decoration: underline;
    color: inherit;
}

.tag-motion.hit {
    color: var(--gold);
}

.tag-label {
    padding: 0.12rem 0.55rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 24rem;
}

.tag-label:hover {
    text-decoration: underline;
}

/* the connector in an anim-replacement pill — a dim, inert arrow between two
   equally-weighted labels, tight so "Stand → StealthStand" reads as one pair.
   Specific enough to beat `.tag .tag-label` (which paints the label the tone). */
.tag .tag-label.swap-arrow {
    padding-inline: 0.1rem;
    color: var(--text-dim);
    pointer-events: none;
}

.tag .tag-label.swap-arrow:hover {
    text-decoration: none;
}

/* dotted underline = mouseover shows a texture preview (hover pointers only —
   the preview never initializes on touch, so no affordance there either) */
@media (hover: hover) {
    .tag-label[data-tex-fid] {
        text-decoration: underline dotted;
        text-decoration-color: rgba(var(--overlay-rgb), 0.4);
        text-underline-offset: 2px;
    }

    .tag-label[data-tex-fid]:hover {
        text-decoration-color: currentColor;
    }
}

/* A pill's TONE is the colour family its name reads in. One variable, set
   once per pill kind and inherited by every segment that wants it — so a new
   pill type either reuses a tone (nothing to write here) or adds one line,
   instead of a rule per segment class. Item quality and the priceless accent
   override --tone through the same channel further down. */
.tag {
    --tone: var(--text);
}

.tag.model, .tag.model-head {
    --tone: var(--model);
}

.tag.sound {
    --tone: var(--sound);
}

.tag.soundkit {
    --tone: var(--soundkit);
}

.tag.animkit {
    --tone: var(--animkit);
}

.tag.anim {
    --tone: var(--anim);
}

.tag.mechanic {
    --tone: var(--mech);
}

/* Aura mechanics: same family as spell effects, one shade apart. The aura is
   what the spell actually DOES — it leads its pill and carries the weight,
   while the APPLY_AURA that delivers it trails as a dim .tag-attach. */
.tag.mechanic.aura {
    --tone: var(--mech-aura);
}

.tag.fx, .tag.fx-head {
    --tone: var(--fx);
}

.tag .tag-label {
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
}

.tag.mechanic.aura .tag-label {
    font-weight: 600;
}

/* control word on summon pills (guardian/pet/...) — dimmed beside the
   name, a button of its own: clicking searches that control type */
.tag-ctrl {
    padding: 0.12rem 0.55rem 0.12rem 0;
    margin-left: -0.2rem;
    font-size: 0.92em;
    opacity: var(--dim);
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
    white-space: nowrap;
}

.tag-ctrl:hover {
    text-decoration: underline;
    opacity: 1;
}

/* tint dot on beam texture pills — the chain's own RGB */
.fx-swatch {
    flex: none;
    width: 0.62em;
    height: 0.62em;
    margin-left: 0.5rem;
    border-radius: 50%;
    border: 1px solid rgba(var(--overlay-rgb), 0.35);
}

.fx-swatch + .tag-label {
    padding-left: 0.35rem;
}

/* screen pills can carry several dots (fog + multiply + addition) */
.fx-swatch + .fx-swatch {
    margin-left: 0.18rem;
}

/* swatches with a hover panel hint at it like texture labels do */
@media (hover: hover) {
    .fx-swatch[data-color]:hover {
        border-color: rgba(var(--overlay-rgb), 0.8);
    }
}


/* the buttons stretch to the pill's full height so their hover highlight
   (and separator border) fills the whole section; the glyph re-centers via
   inline-flex. Asymmetric vertical padding on .tag-copy sinks its smaller
   text 0.1rem, onto the label's baseline — flex-centering alone leaves it
   ~1.5px high, and align-items: baseline can't fix it (the label's
   overflow:hidden makes flexbox use its box bottom). The ▶ is a centered
   geometric glyph, not baseline text — it stays symmetric. */
.tag-copy, .tag-play, .tag-view {
    align-self: stretch;
    display: inline-flex;
    align-items: center;
}

.tag-copy {
    padding: 0.32rem 0.45rem 0.12rem 0.35rem;
    color: var(--tag-btn);
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 0.92em;
    white-space: nowrap;
}

.tag-copy:hover {
    color: var(--gold);
    background: rgba(var(--gold-rgb), calc(0.1 * var(--wash-strength)));
}

/* ▶ on sound file tags — streams the sound from Wowhead's CDN */
.tag-play {
    padding: 0.12rem 0.4rem;
    color: var(--tag-btn);
    font-size: 0.85em;
    white-space: nowrap;
}

.tag-play:hover {
    color: var(--gold);
    background: rgba(var(--gold-rgb), calc(0.1 * var(--wash-strength)));
}

.tag-play.playing {
    color: var(--gold);
}

.tag-play.loading {
    animation: play-pulse 0.9s ease-in-out infinite;
}

@keyframes play-pulse {
    50% {
        opacity: 0.35;
    }
}

/* cube icon on model tags — links out to the WoW.tools model viewer. An
   SVG glyph like ▶ (flex-centered, symmetric padding), on the pill's
   left edge. */
.tag-view {
    padding: 0.12rem 0.4rem 0.12rem 0.5rem;
    color: var(--tag-btn);
    text-decoration: none;
}

.tag-view svg {
    width: 1.1em;
    height: 1.1em;
    display: block;
}

.tag-view:hover {
    color: var(--gold);
    background: rgba(var(--gold-rgb), calc(0.1 * var(--wash-strength)));
    text-decoration: none;
}

/* the pill's corners curve inward — edge buttons need extra outer padding
   so their glyphs don't crowd the rounded border */
.tag-play:first-child {
    padding-left: 0.55rem;
}

.tag-copy:last-child {
    padding-right: 0.6rem;
}

.kit-files .tag-play:first-child {
    padding-left: 0.45rem;
}

.kit-files .tag-copy:last-child {
    padding-right: 0.5rem;
}

.tag.hit {
    border-color: var(--gold-dim);
    background: rgba(var(--gold-rgb), calc(0.10 * var(--wash-strength)));
}

/* an invisibility nothing detects — the priceless case. A distinct cool accent
   (not gold, so it never reads as a search hit) and non-interactive; a search
   hit still overrides it in gold. */
.tag.fx.priceless:not(.hit) {
    border-color: var(--priceless-border);
    background: rgba(var(--priceless-rgb), calc(0.12 * var(--wash-strength)));
}

.tag.fx.priceless {
    --tone: var(--priceless);
}

.tag.fx.priceless .tag-label {
    cursor: default;
}

/* Fileless marker pill (equipped-weapon sentinel, SpellVisualEffectName Type
   3–10): no filename, no fid buttons. Italic label reads it as a descriptor
   rather than a real model name. */
.tag.model.synthetic .tag-label {
    font-style: italic;
}

/* The `icon` SEGMENT, wherever a pill uses one: an item's inventory art
   (SpellVisualEffectName Type 1) and a spell-link chip's spell icon. It sits
   flush against the label with nothing between them, so the two read as one
   unit — "the swatch or icon is part of the name" (docs/PILLS.md §2). When it
   links out it is wrapped in an anchor (.item-icon-link) which must not add any
   box of its own.

   Scoped to the SEGMENT, not to the item pill that was once its only caller:
   this describes the shape of an icon in a pill, so a second pill type using
   one inherits it rather than restating it. */
.tag .item-icon {
    width: 1.15em;
    height: 1.15em;
    border-radius: 2px;
    flex: 0 0 auto;
    border: 1px solid rgba(var(--shadow-rgb), calc(0.45 * var(--shadow-strength)));
}

.tag .item-icon-link {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
}

.tag .item-icon-link:hover .item-icon {
    outline: 1px solid var(--gold);
}

/* space before the icon (loose from the target glyphs) goes on the pill's
   DIRECT child — the bare img on a nameless item, or the link wrapper on a
   named one — so a wrapped img gets no extra inset of its own */
.tag > .item-icon,
.tag > .item-icon-link {
    margin-left: 0.3rem;
}

.tag > .item-icon + .tag-label,
.tag > .item-icon-link + .tag-label {
    padding-left: 0.3rem;
}

/* Spell-link chip (SpellEffect.EffectTriggerSpell): another SPELL, shown in the
   Mechanics column. It reuses the column's own --mech family rather than
   claiming a palette token of its own — the icon is what distinguishes it from
   the enum pills beside it, and a new token would need contrast-walking in
   three palettes to say nothing new. */
.tag.mech.link {
    --tone: var(--mech);
}

/* A link chip carries more than any other pill in the column — an icon, a spell
   name, an id, target icons, the joining words and three commands — and the
   column's width is set by whatever the widest chip needs. So its two
   variable-length parts are clamped here rather than at the call site (the
   .tag-motion precedent above): the name to 7rem and the joining words to 5rem,
   both with the full text on the tooltip every text segment already composes.
   Measured on 9.2.7: unclamped, the widest chip was 358px and made Mechanics
   449px against the 364px it wanted with no links at all. */
.tag.link .tag-label.link-name {
    max-width: 7rem;
}

.tag.link .tag-attach.link-kind {
    max-width: 5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* AN ID SHOWN AS ITS OWN COPY BUTTON — the spell-link chip (spellLinkTag) and
   a NAMED sound kit (kitTag). Both reached the same shape for the same reason:
   once a pill has a better identity to print (a spell name, Blizzard's kit
   name), printing the id beside a separate ⧉ spends width saying the same
   thing twice. Generalised from `.link-id` on 2026-08-06 when the kit pill
   became the second caller — one rule, so the two cannot drift apart.

   Tabular figures so a column of chips does not shimmer, and note-sized
   because it is a value being shown rather than an action being offered — the
   gold on hover is what says it is clickable, exactly as .id-copy does in the
   Name column.

   IT KEEPS THE COPY SEGMENT'S OWN COLOUR, and that is a contrast call, not an
   oversight. Dimming it to --text-dim (the obvious way to say "quieter than the
   commands beside it") measured 3.16:1 against 4.5 on the dark palette: a link
   chip that MATCHES sits in a compact hit group, so the group's gold wash and
   the pill's own stack into a background nothing was solved against — the trap
   the theme section warns about. The size and the tabular figures carry the
   distinction on their own, and the default copy colour clears AA at 5.6:1. */
.tag-copy.pill-id {
    font-variant-numeric: tabular-nums;
    font-size: 0.86em;
}

/* THE ⧉ IS THE AFFORDANCE, AND THE CHIP NEEDED IT (user's ask, 2026-08-04).
   The id has been the copy button since this chip shipped, and the entry above
   argues that a ⧉ *beside* a printed id spends width saying the same thing
   twice — which is still true. What was missing is that every other id-bearing
   pill in the app (display, item, object, creature, kit, fid) wears a ⧉, so an
   id with none reads as a printed value and the control was invisible until
   hover. Marking the same button rather than adding a second one keeps the
   original argument intact and costs one glyph.

   ::after rather than markup, so the copied text stays exactly the id: the
   glyph is decoration, the button already carries its own aria-label, and
   nothing in the pill builders has to know about it. */
.tag-copy.pill-id::after {
    content: "⧉";
    margin-left: 0.22em;
    font-size: 0.92em;
    opacity: 0.55;
}

.tag-copy.pill-id:hover::after {
    opacity: 1;
}

/* Area-gate chip (SpellCastingRequirements.RequiredAreasID): WHERE the spell
   refuses to cast, shown in the Mechanics column under an `only in` head. Same
   call as the link chip above — it reuses the column's own --mech family rather
   than claiming a palette token, because what distinguishes it from the enum
   pills beside it is the head, and a new token would need contrast-walking in
   three palettes to say nothing new.

   The name is clamped for the same reason the link name is: an area name runs to
   48 characters (Hillsbrad Foothills (Southshore vs. Tarren Mill)) and one long
   one would set the whole column's width. 8rem covers the 95th percentile at 23
   characters; the rest ellipsis with the full name on the tooltip every text
   segment already composes — the .tag-motion precedent, PILLS.md §5. Slightly
   wider than the link chip's 7rem because this chip carries far less: no icon,
   no id, no target icons, no joining words, and two commands rather than three. */
.tag.mech.area {
    --tone: var(--mech);
}

.tag.area .tag-label.area-name {
    max-width: 8rem;
}

/* Named item labels are coloured by item quality (the classic WoW ramp),
   which overrides the default model blue through the pill's tone. Nameless
   items set no quality class and keep --model. */
.tag.model.item.q-poor {
    --tone: var(--q-poor);
}

.tag.model.item.q-common {
    --tone: var(--q-common);
}

.tag.model.item.q-uncommon {
    --tone: var(--q-uncommon);
}

.tag.model.item.q-rare {
    --tone: var(--q-rare);
}

.tag.model.item.q-epic {
    --tone: var(--q-epic);
}

.tag.model.item.q-legendary {
    --tone: var(--q-legendary);
}

.tag.model.item.q-artifact {
    --tone: var(--q-artifact);
}

.tag.model.item.q-heirloom,
.tag.model.item.q-token {
    --tone: var(--q-heirloom);
}

/* pills/groups the height clamp hides (layoutRow toggles .overflow directly).
   The cell prefix lifts specificity above .kit-group.compact / .kit-files .tag
   so an overflow pill or a compact group is always hidden. Scoped like every
   other cell rule, which leaves the file with no bare table selectors at all —
   see the Wowhead tooltip note above for why that matters. */
#results td .tag.overflow, #results td .kit-group.overflow {
    display: none;
}

/* "+N more" expander — one consistent pronounced pill across every column
   (was two very different looks: a dim text link and a tinted group pill) */
.more {
    display: inline-flex;
    align-items: center;
    margin: 0.18rem 0.25rem 0.1rem 0;
    padding: 0.1rem 0.5rem;
    color: var(--text);
    background: rgba(var(--overlay-rgb), calc(0.06 * var(--wash-strength)));
    border: 1px solid var(--border-ctrl);
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    white-space: nowrap;
}

.more:hover {
    color: var(--gold);
    background: rgba(var(--gold-rgb), calc(0.12 * var(--wash-strength)));
    border-color: var(--gold-dim);
}

/* command buttons: one compact line under the spell name (see .c-name), never
   wrapping — so adding a command to CFG.spellCommands widens the strip rather
   than folding it onto a second line */

/* ONE segmented control per row, not four buttons.
 *
 * What made the keycap version shout was never the borders alone, it was the
 * count: four separate objects, each ringed, filled, shadowed and bevelled, on
 * every one of ~60 rows. Stripping all of it off went as far the other way —
 * four grey words under a name read as a footnote, not as something you click.
 *
 * So the ink is spent ONCE, on the strip, and the affordance is per command:
 * a single quiet slab holds the four, divided by hairlines, and a segment
 * lights only under the pointer. Three shared rules replace eight button
 * edges, and the row gains one object instead of four.
 *
 * The shape is the app's own: `.tag` already builds a pill out of segments
 * with [data-sep] hairlines between them, so the strip reads as family. What
 * keeps it from competing with those pills is that it carries no --tone at all
 * — monospace text on a neutral wash, with the gold '.' as its only colour.
 *
 * It also came out NARROWER, not wider: 216px against the borderless version's
 * 233px, because the segments buy their padding back from the gaps that used to
 * sit between them. Both are under .c-name's declared 17rem, so the Name column
 * is now floored by that rule rather than by the strip, and the table's width
 * is unchanged either way (measured: 1977px before and after).
 */

.cmd-row {
    /* inline, so the strip is only as wide as its commands */
    display: inline-flex;
    align-items: stretch;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin-top: 0.32rem;
    border-radius: 6px;
    /* an overlay wash lifts this off a dark row and sinks it into a light one,
       so the slab reads as a surface of its own in every palette */
    background: rgba(var(--overlay-rgb), calc(0.07 * var(--wash-strength)));
}

/* the ends are rounded by their segments, NOT by overflow:hidden on the strip:
   a clipped focus ring is not a focus ring */
.cmd-row > :first-child {
    border-radius: 6px 0 0 6px;
}

.cmd-row > :last-child {
    border-radius: 0 6px 6px 0;
}

.cmd {
    padding: 0.14rem 0.45rem;
    text-align: center;
    border: 0;
    background: none;
    color: var(--text);
    font-size: 0.72rem;
    font-weight: 500;
    font-family: Consolas, "Cascadia Mono", monospace;
    white-space: nowrap;
    transition: color 0.12s, background-color 0.12s, transform 0.06s;
}

/* the segment dividers — one hairline between neighbours, shared. Same wash
   as a pill's own meta divider (.tag [data-role="meta"]), for the same reason:
   a hairline is a low-alpha tint and scales with --wash-strength, so it does
   not need a colour of its own in any palette */
.cmd + .cmd, .cmd-row .wh-cmd {
    border-left: 1px solid rgba(var(--overlay-rgb), calc(0.12 * var(--wash-strength)));
}

/* the command sigil — the one mark that says "this is a command" */
.cmd-dot {
    color: var(--gold);
}

/* Hover INVERTS the segment rather than tinting it — and that is a contrast
   decision as much as a visual one. A gold WASH under gold text works on dark
   and collapses on the light palettes, where --gold is a dark bronze and the
   wash is made of the same bronze: measured 3.69:1 on moonwell, under AA, and
   no alpha fixes it because the slab has already spent the headroom (a resting
   dot sits at 5.45:1 there). Inverting sidesteps the stack entirely — the text
   lands on solid gold instead of on gold-over-slab-over-row — and measures
   10.7:1 dark / 6.78 moonwell / 6.79 vellum. One rule, three palettes, no
   per-theme branch.

   The sigil goes with it: on a gold fill a gold dot would disappear, and by
   then the whole segment is the accent, so it has nothing left to mark. */
.cmd:hover {
    background: var(--gold);
    color: var(--bg-row);
}

.cmd:hover .cmd-dot {
    color: inherit;
}

/* pressed shrinks in place: the strip is a slab of adjacent segments, so a
   translate would push one of them out through its edge, and any recolour of
   the gold would eat the contrast the inversion just bought */
.cmd:active {
    transform: scale(0.94);
}

/* wowhead links */

.wowhead {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 1.5rem;
    height: 1.5rem;
    margin: 0.08rem 0.25rem 0.08rem 0;
    border: 1px solid var(--wh-border);
    border-radius: 7px;
    background: linear-gradient(180deg, var(--wh-bg-top), var(--wh-bg-bottom));
    transition: border-color 0.12s, box-shadow 0.12s;
}

.wowhead img {
    width: 1rem;
    height: 1rem;
}

.wowhead:hover {
    border-color: rgb(var(--wh-hover-rgb));
    box-shadow: 0 0 10px rgba(var(--wh-hover-rgb), 0.45);
}

.tag .wowhead {
    width: auto;
    height: auto;
    margin: 0;
    border: none;
    border-left: 1px solid var(--border);
    border-radius: 0;
    background: none;
    padding: 0.12rem 0.45rem 0.12rem 0.4rem;
    align-self: stretch;
}

.tag .wowhead:hover {
    background: rgba(var(--wh-hover-rgb), 0.18);
    box-shadow: none;
}

.tag .wowhead img {
    width: 0.85rem;
    height: 0.85rem;
}

/* Their embedded tooltip (.wowhead-tooltip, injected by tooltips.js and styled
   by their universal.css) is DELIBERATELY not styled here. It draws its own
   border, icon and text colours but sets no background, so the page's shows
   through — which is how it comes out of Wowhead, and it stays that way.
   Worth knowing before writing a light palette: white name and gold body text
   on a light surface is unreadable, and the fix is not ours to make. */

/* wowhead link on a pill's LEFT edge (morph pills): divider flips sides,
   extra outer padding clears the rounded corner */
.tag .wowhead:first-child {
    border-left: none;
    border-right: 1px solid var(--border);
    padding: 0.12rem 0.4rem 0.12rem 0.5rem;
}

#empty-note {
    color: var(--text-dim);
    padding: 1.6rem 0.5rem;
}

#sentinel {
    height: 1px;
}

/* ------------------------------------------------------- empty state */

#empty-state {
    max-width: 44rem;
    margin: 2.5rem auto;
    padding: 1.6rem 2rem;
    text-align: center;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 14px;
}

#empty-state[hidden] {
    display: none;
}

#empty-state h2 {
    margin: 0 0 0.5rem;
    color: var(--gold);
    font-size: 1.25rem;
}

#empty-state p {
    margin: 0.4rem 0;
    color: var(--text-dim);
}

#empty-state .es-try {
    margin-top: 1rem;
    color: var(--text);
}

.es-examples {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    justify-content: center;
    margin: 0.6rem 0 1rem;
}

.es-examples button {
    padding: 0.3rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    --tone: var(--model);
    color: color-mix(in oklab, var(--tone) var(--ink-mix), black);
    font-family: Consolas, "Cascadia Mono", monospace;
    font-size: 0.86rem;
    transition: border-color 0.12s, color 0.12s, box-shadow 0.12s;
}

.es-examples button:hover {
    border-color: var(--gold-dim);
    color: var(--gold);
    box-shadow: 0 0 10px rgba(var(--gold-rgb), 0.18);
}

.es-hint {
    font-size: 0.86rem;
}

.es-hint code {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 0.3rem;
    font-size: 0.9em;
}

/* ---------------------------------------------------------------- footer */

footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    padding: 0.8rem 1.6rem 1.2rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

footer span:nth-child(2) {
    text-align: center;
}

footer span:last-child {
    text-align: right;
}

footer a {
    color: var(--text-dim);
}

@media (max-width: 900px) {
    footer {
        grid-template-columns: 1fr;
    }

    footer span, footer span:last-child {
        text-align: center;
    }
}

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

#loading {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

#loading[hidden] {
    display: none;
}

.load-card {
    text-align: center;
    width: min(26rem, 80vw);
}

.load-logo {
    font-size: 2rem;
    letter-spacing: 0.08em;
    color: var(--gold);
    text-shadow: 0 0 24px rgba(var(--gold-rgb), 0.35);
    margin-bottom: 1.2rem;
}

.load-track {
    height: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
}

#load-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
    transition: width 0.15s;
}

#load-text {
    margin-top: 0.7rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

#load-error {
    margin-top: 0.7rem;
    color: var(--danger);
    font-size: 0.9rem;
}

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

#toast {
    position: fixed;
    left: 50%;
    bottom: 1.6rem;
    transform: translateX(-50%) translateY(1rem);
    background: var(--bg-panel);
    border: 1px solid var(--gold-dim);
    color: var(--text);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s, transform 0.18s;
    max-width: min(30rem, 90vw);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    box-shadow: 0 8px 28px rgba(var(--shadow-rgb), calc(0.4 * var(--shadow-strength)));
    z-index: 20;
}

#toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ------------------------------------------------- the app's tooltip
 *
 * Built by app/tooltip.ts out of the string the composer was already
 * writing (pills.ts §tip). Two things carry it, and neither is ornament:
 *
 *  - the LEFT EDGE is the hovered pill's own --tone, so the panel says which
 *    column it came from before a word of it is read. Set inline by the
 *    controller; the fallback is for anything the read comes back empty on.
 *  - the GESTURE HALF is a two-column map, not a paragraph. It always was a
 *    key-to-action mapping — `title` is what flattened it into prose.
 *
 * Measured on --bg-panel across all three palettes: what 14.69/15.31/15.44,
 * detail 11.81/10.61/10.70, keys 4.69/8.73/8.71, dt 8.24/9.64/9.70 — every
 * role over 4.5 — and the --tone edge 8.24/3.41/3.41 over the 3:1 it needs
 * as a non-text mark. Motion is handled by the blanket reduced-motion rule
 * at the end of this file.
 */

/* IT IS A POPOVER, so it can paint over a modal <dialog>. The help dialog is
   in the TOP LAYER, which no z-index reaches over, and its generated words
   carry their descriptions as tooltips — so the panel has to be promoted to
   that layer too (see app/tooltip.ts). The UA's popover defaults have to come
   off first: `inset: 0` + `margin: auto` would centre it in the viewport, and
   its border/padding would stack under ours. The z-index stays for the browser
   that has no popover, where the panel is an ordinary fixed box. */
#tip {
    position: fixed;
    inset: auto;
    top: 0;
    left: 0;
    margin: 0;
    width: max-content;
    overflow: visible;
    /* above the sticky table header (10), the toast (20) and the texture
       preview (30) — it is the topmost thing and it can afford to be,
       because pointer-events: none means it never eats a click */
    z-index: 40;
    pointer-events: none;
    max-width: min(24rem, 90vw);
    padding: 0.5rem 0.65rem;
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
    border-left: 3px solid var(--tone, var(--border-ctrl));
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(var(--shadow-rgb), calc(0.5 * var(--shadow-strength)));
    font-size: 0.86rem;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.1s;
}

#tip.show {
    opacity: 1;
}

#tip[hidden] {
    display: none;
}

/* the UA gives an open popover `display: block`; ours needs the same box it
   had as a plain div, and `:popover-open` is what re-states it */
#tip:popover-open {
    display: block;
}

#tip p {
    margin: 0;
}

.tip-what {
    color: var(--text-strong);
    font-weight: 600;
    /* a model path or a flight-path name runs long, and the panel is the one
       place in the app that has room to show it whole */
    overflow-wrap: anywhere;
}

.tip-detail {
    color: var(--text);
}

/* THE PINNED PANEL'S WAY OUT, AND IT EXISTS ONLY WHERE IT IS NEEDED.
   A pointer can leave a tooltip; a finger cannot, so a panel a tap pinned open
   has no exit on a phone. Hidden by default and on any fine pointer — there it
   would be clutter on every tooltip in the app.

   44px is the tap target, not the glyph: the × is drawn at a readable size and
   the box around it is what the thumb actually has to hit. */
.tip-close {
    display: none;
}

/* The chip hangs 26px into the panel's top-right, so the FIRST block gets a
   gutter and nothing else does. Padding the whole panel would indent every
   line on a screen that has none to spare; padding the top left an empty row
   with an x floating in it. Only the text the button actually covers moves. */
#tip.pinned.by-touch > :first-child {
    padding-right: 1.9rem;
}

/* INSIDE the corner, not hanging off it. Outside, the chip clipped at the
   viewport edge — place() already parks the panel 8px from it, so a button
   reaching 14px further sat half off a phone screen. Inside costs nothing
   extra: the first block's gutter above is what it sits in. */
#tip.pinned.by-touch .tip-close {
    position: absolute;
    top: 2px;
    right: 2px;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-panel);
    color: var(--text-dim);
    cursor: pointer;
}

#tip.pinned.by-touch .tip-close svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
}

#tip.pinned.by-touch .tip-close:active {
    color: var(--text-strong);
    border-color: var(--gold);
}

/* A SECTIONED tooltip — today only the description mark, which can carry three
   different voices about one spell (the cast, the state it applies, the raid
   guide's note). The rule and the label do the separating: three paragraphs of
   prose with nothing between them read as one rambling paragraph, which is
   exactly how it shipped.

   The rule sits BETWEEN sections only, so a single-section tip is untouched
   and every other tooltip in the app renders exactly as it did. */
.tip-section + .tip-section {
    margin-top: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--border);
}

/* Small, spaced and dim: it names the voice without competing with it. Sentence
   case would read as prose and get skimmed as part of the body — the caps and
   the tracking are what make it scan as a heading at 11px. */
.tip-label {
    margin-bottom: 0.15rem;
    color: var(--text-dim);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

/* Prose runs long here, unlike the one-line tips this panel was built for. */
#tip .tip-section .tip-detail {
    max-width: 46ch;
    line-height: 1.4;
}

/* The matched run inside a tooltip's prose. `mark`'s UA default is black on
   yellow, which is unreadable on every one of the three palettes, so it is
   fully restated rather than tinted. */
#tip mark {
    background: rgba(var(--gold-rgb), 0.22);
    color: var(--text-strong);
    border-radius: 2px;
    padding: 0 1px;
}

.tip-keys {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem 0.6rem;
    margin: 0.45rem 0 0;
    padding-top: 0.4rem;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.92em;
}

/* the wrapper exists only to pair a dt with its dd in the markup; the grid
   is what actually aligns them, so it steps out of the box tree */
.tip-keys > div {
    display: contents;
}

/* THE GESTURE IS A KEYCAP, the same one the help dialog's "Clicks and keys"
   band draws — so a gesture looks like a gesture wherever the app names one,
   and the eye can find the actionable half of a panel without reading it. The
   bottom border is the whole trick: one extra pixel reads as a key's edge. */
.tip-keys dt {
    color: var(--tag-btn);
    white-space: nowrap;
    justify-self: start;
    background: var(--bg);
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 0 0.3rem;
    font-size: 0.94em;
}

.tip-keys dd {
    margin: 0;
    /* the caps have their own box now, so the text beside them needs nudging
       back onto their optical centre line */
    padding-top: 0.06rem;
}

@media (max-width: 900px) {
    header, main, footer {
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }
}

/* ------------------------------------------- texture hover preview */

#texpreview {
    position: fixed;
    z-index: 30;
    display: none;
    padding: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 28px rgba(var(--shadow-rgb), calc(0.55 * var(--shadow-strength)));
    pointer-events: none; /* never traps the mouse away from the pill */
}

/* checkerboard behind the canvas so alpha reads as alpha */
#texpreview .tex-img {
    line-height: 0;
    background: repeating-conic-gradient(var(--checker-a) 0% 25%, var(--checker-b) 0% 50%) 0 0 / 16px 16px;
    border-radius: 3px;
    overflow: hidden;
}

/* a caption wider than the image would otherwise strand it against the left
   edge with bare checkerboard beside it */
#texpreview canvas {
    display: block;
    margin: 0 auto;
}

/* color-swatch hover: a large patch of the color in the same panel — 100%
   width so a long caption never leaves checkerboard beside the patch */
#texpreview .tex-color {
    width: 100%;
    min-width: 140px;
    height: 90px;
    border-radius: 3px;
}

#texpreview .tex-dims {
    margin-top: 4px;
    font-size: 0.76rem;
    color: var(--text-dim);
    text-align: right;
    line-height: 1;
}

/* ------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}
