/* Hearth prestige polish v3 (Tom signed 13 Nov 14:20; spec PRESTIGE-SPEC-v3.md, the v3 block wins over v1/v2).
   PAINT ONLY: border-color, box-shadow, background-image layering, border-radius, color and text-shadow, plus press / hover /
   focus states. No width, height, padding, margin, border-width or font-size changes, so nothing moves (geometry is checked
   by tests/prestige-v3-1114.test.js: 0 elements moved).
   DARK THEMES ONLY: every rule is under html[data-theme="dark"]; light / parchment palettes keep their look (spec: a gold glow
   on a light page reads as yellow fuzz, and the neutral shadow was not tested there).
   Every colour goes through the theme: the accent is var(--gold) (so it follows any dark palette and the Frost test theme),
   black / white are the theme tokens --c-black / --c-white, the warm whites are shades of var(--ink). No new colours.
   Why one layer file loaded last (not edits spread through ui.css / home-v2.css / dark.css as the spec suggested): the dark-
   only gate has to sit on every rule, and dark.css (loaded last until now) already wins with html:root[data-palette]x4 body
   and !important; one file with the same weight, after it, is the one place to read, gate and switch off. */

html[data-theme="dark"] {
  --pr-line:   color-mix(in srgb, var(--gold) 14%, transparent);   /* hairline: groups, panels, row dividers */
  --pr-line-2: color-mix(in srgb, var(--gold) 30%, transparent);   /* controls: buttons, chips, tiles, stat boxes */
  --pr-hl:     inset 0 1px 0 rgb(from var(--c-white) r g b / 0.06);                                   /* 1 px top edge light */
  --pr-sh-1:   0 1px 2px rgb(from var(--c-black) r g b / 0.45), 0 3px 8px rgb(from var(--c-black) r g b / 0.28);    /* rows, buttons, groups */
  --pr-sh-2:   0 2px 4px rgb(from var(--c-black) r g b / 0.40), 0 12px 28px rgb(from var(--c-black) r g b / 0.38);  /* cards, tiles, sheets */
  --pr-glow:   0 0 0 1px color-mix(in srgb, var(--gold) 55%, transparent), 0 0 18px color-mix(in srgb, var(--gold) 20%, transparent); /* "this one" only */
  /* v3: the gold top edge catches the light (raised surfaces only); the shadow under it stays natural (neutral black) */
  --pr-edge-glow: inset 0 1px 0 color-mix(in srgb, var(--gold) 42%, transparent), 0 -1px 4px color-mix(in srgb, var(--gold) 22%, transparent), 0 0 5px color-mix(in srgb, var(--gold) 16%, transparent);
  --pr-sheen:  linear-gradient(180deg, rgb(from var(--c-white) r g b / 0.035) 0%, rgb(from var(--c-white) r g b / 0) 38%, rgb(from var(--c-black) r g b / 0.10) 100%);
  --pr-label-ink: color-mix(in srgb, var(--gold) 62%, var(--ink-soft, var(--ink)));
  --pr-ease:   120ms cubic-bezier(.2, .7, .2, 1);
  --pr-focus:  0 0 0 2px var(--page), 0 0 0 4px var(--gold);
  --pr-brass:  linear-gradient(180deg, color-mix(in srgb, var(--gold) 78%, var(--c-white)) 0%, var(--gold) 52%, color-mix(in srgb, var(--gold) 80%, var(--c-black)) 100%);
  --pr-brass-sh: inset 0 1px 0 rgb(from color-mix(in srgb, var(--ink) 30%, var(--c-white)) r g b / 0.55), inset 0 -1px 0 rgb(from var(--c-black) r g b / 0.25), 0 1px 2px rgb(from var(--c-black) r g b / 0.5), 0 4px 12px color-mix(in srgb, var(--gold) 18%, transparent);
  --pr-engrave: 0 1px 0 rgb(from var(--ink) r g b / 0.35);
  --pr-head-sh: 0 1px 0 rgb(from var(--c-black) r g b / 0.55);
}

/* ---- 1 + 2: three gold strengths, one clean edge instead of a double ring ---- */
/* Home: the small buttons (Join game, the menu, Paper sheet) */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .hv-home :is(.hv-join, .hv-mb, .hv-paper) { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-hl), var(--pr-sh-1) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .hv-home .hv-join { border-color: color-mix(in srgb, var(--gold) 70%, transparent) !important; }
/* Home: doors and hero cards (v3: the gold top edge catches the light); the GM door and the picked hero keep the glow */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .hv-home .hv-door { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-edge-glow), var(--pr-sh-2) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .hv-home .hv-door.hv-d-dm { border-color: color-mix(in srgb, var(--gold) 75%, transparent) !important; box-shadow: var(--pr-hl), var(--pr-glow), var(--pr-sh-2) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .hv-home .hv-card { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-edge-glow), var(--pr-sh-2) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .hv-home .hv-card.hv-on { border-color: color-mix(in srgb, var(--gold) 80%, transparent) !important; box-shadow: var(--pr-hl), var(--pr-glow), var(--pr-sh-2) !important; }
/* groups, panels, rows */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-card, .u-grp) { border-color: var(--pr-line) !important; box-shadow: var(--pr-hl), var(--pr-sh-1) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .u-card.u-raised { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-edge-glow), var(--pr-sh-2) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-row + .u-row, .u-list > * + *) { border-top-color: var(--pr-line) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .u-lead { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-hl) !important; }
/* the digital sheet: colour and shadow only (the locked frame's geometry is untouched) */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-cs3-st, .u-cs3-ab, .u-cs3-coin, .u-cs3-chip, .u-cs3-ring, .u-cs3-hb, .u-cs3-insp, .u-cs3-cam, .u-cs3-heart, .u-cs3-xpb, .u-cs3-slb) { border-color: var(--pr-line-2) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .u-cs3-slb { box-shadow: var(--pr-hl) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .u-cs3-tile { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-edge-glow), var(--pr-sh-1) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-cs3-skills, .u-cs-atk, .u-cs3-card) { border-color: var(--pr-line) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .u-cs3-card { box-shadow: var(--pr-edge-glow), var(--pr-sh-2) !important; }
/* (the sheet's attack / damage pills .u-cs-roll keep their full gold: they are its main actions) */
/* dialogs, pop-ups, the one-shot builder, controls. The sheet's More-tile pop-ups (.hx-sh) keep Jenny's sheet-colours edge, so
   all six (Rest, Conditions, Effects, Notes, Hit dice, Dice) stay one look (tests/ui-themes) */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.dialog:not(.dialog-backdrop.hx-sh .dialog), .home-modal) { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-hl), 0 -10px 40px rgb(from var(--c-black) r g b / 0.55) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.os-stepbtn, .os-chip, .home-modal-x, .u-btn:not(.u-primary)) { border-color: var(--pr-line-2) !important; box-shadow: var(--pr-hl) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.os-chip.sel, .u-pv.u-on) { border-color: var(--gold) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .os-output { border-color: var(--pr-line) !important; }

/* ---- 5: calm panels (a neutral sheen over the existing fill; the surface texture stays; tests/prestige-v3-1114 checks the
   panel's own background images are still there under the sheen) ---- */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-card:not(.u-raised), .u-grp) { background-image: var(--pr-sheen), var(--tex, none) !important; } /* .u-raised has its own fill: kept */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .os-panel { background-image: var(--pr-sheen), var(--tex, none) !important; }

/* ---- 7: one radius scale (identity shapes keep theirs: the hero arch, the doors, pills, round buttons, the sheet frame) ---- */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-btn, .os-chip, .os-stepbtn, .btn) { border-radius: var(--r-sm) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-card, .u-grp) { border-radius: var(--r-md) !important; }
/* dialogs keep their shape (a sheet on a phone: top corners only; a centred card from 600 px and every confirm: all corners),
   only on the scale: 20 px -> --r-xl 22 */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .dialog { border-radius: var(--r-xl) var(--r-xl) 0 0 !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .dialog-backdrop.confirm-backdrop .dialog { border-radius: var(--r-xl) !important; }
@media (min-width: 600px) { html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .dialog { border-radius: var(--r-xl) !important; } }

/* ---- 4: engraved brass primary ---- */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-btn.u-primary, .btn.primary, .os-chip.sel) { background-image: var(--pr-brass) !important; box-shadow: var(--pr-brass-sh) !important; text-shadow: var(--pr-engrave); }

/* ---- 6: quieter, warmer section labels (colour only: same size, weight and case; Tom 2 Nov one type style) ---- */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-t-label.u-gl, .u-sec-h .u-t-label, .os-lbl) { color: var(--pr-label-ink) !important; }

/* ---- 8: engraved headings, and the states ---- */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-t-h3, .rules-home-title, .hv-door b, .u-cs3-mh h2) { text-shadow: var(--pr-head-sh); }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-btn, .u-chip, .u-row, .u-cs3-tile, .u-cs3-st, .u-cs3-ab, .os-chip, .os-stepbtn, .btn, .hv-join, .hv-mb, .hv-paper, .hv-door) { transition: transform var(--pr-ease), box-shadow var(--pr-ease), border-color var(--pr-ease), filter var(--pr-ease); }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-btn, .u-chip, .u-row, .u-cs3-tile, .u-cs3-st, .u-cs3-ab, .os-chip, .os-stepbtn, .btn, .hv-join, .hv-mb, .hv-paper, .hv-door):active { transform: translateY(1px); filter: brightness(.94); }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-btn, .u-chip, .u-row, .u-cs3-tile, .u-cs3-st, .u-cs3-ab, .os-chip, .os-stepbtn, .btn, .hv-join, .hv-mb, .hv-paper, .hv-door):focus-visible { outline: none !important; box-shadow: var(--pr-focus) !important; }
@media (hover: hover) {
  html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-btn, .u-chip, .u-row, .u-cs3-tile, .u-cs3-st, .u-cs3-ab, .os-chip, .os-stepbtn, .btn, .hv-join, .hv-mb, .hv-paper, .hv-door):hover:not(.u-primary):not(.primary):not(.sel) { border-color: color-mix(in srgb, var(--gold) 55%, transparent) !important; }
}
@media (prefers-reduced-motion: reduce) {
  html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body :is(.u-btn, .u-chip, .u-row, .u-cs3-tile, .u-cs3-st, .u-cs3-ab, .os-chip, .os-stepbtn, .btn, .hv-join, .hv-mb, .hv-paper, .hv-door) { transition: none !important; transform: none !important; }
}
html[data-motion="reduced"][data-theme="dark"] body :is(.u-btn, .u-chip, .u-row, .u-cs3-tile, .u-cs3-st, .u-cs3-ab, .os-chip, .os-stepbtn, .btn, .hv-join, .hv-mb, .hv-paper, .hv-door) { transition: none !important; transform: none !important; }

/* ---- chrome: the tab bar and toasts ---- */
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .u-tabbar { border-top-color: var(--pr-line) !important; box-shadow: 0 -1px 0 rgb(from var(--c-black) r g b / 0.6), 0 -10px 24px rgb(from var(--c-black) r g b / 0.45) !important; }
html:root[data-theme="dark"][data-palette][data-palette][data-palette][data-palette] body .hearth-toast { border-color: var(--pr-line-2) !important; }
