:root,
.wb-gam-scheme-light {
	/* Spacing scale (used by SpacingControl) */
	--wb-gam-space-0: 0;
	--wb-gam-space-xs: 4px;
	--wb-gam-space-sm: 8px;
	--wb-gam-space-md: 16px;
	--wb-gam-space-lg: 24px;
	--wb-gam-space-xl: 32px;
	--wb-gam-space-2xl: 48px;
	--wb-gam-space-3xl: 64px;

	/* Border radius scale (md/lg tuned to match assets/css/hub.css) */
	--wb-gam-radius-none: 0;
	--wb-gam-radius-sm: 6px;
	--wb-gam-radius-md: 10px;
	--wb-gam-radius-lg: 14px;
	--wb-gam-radius-xl: 18px;
	--wb-gam-radius-full: 9999px;

	/* Shadow presets (sm/md tuned to match assets/css/hub.css — softer than Tailwind defaults) */
	--wb-gam-shadow-none: none;
	--wb-gam-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
	--wb-gam-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
	--wb-gam-shadow-lg: 0 10px 24px rgba(0, 0, 0, 0.10);
	--wb-gam-shadow-xl: 0 20px 32px rgba(0, 0, 0, 0.12);

	/* Typography scale */
	--wb-gam-font-xs: 12px;
	--wb-gam-font-sm: 14px;
	--wb-gam-font-md: 16px;
	--wb-gam-font-lg: 18px;
	--wb-gam-font-xl: 20px;
	--wb-gam-font-2xl: 24px;
	--wb-gam-font-3xl: 30px;
	--wb-gam-font-4xl: 36px;
	--wb-gam-font-5xl: 48px;

	/* Font weights */
	--wb-gam-weight-normal: 400;
	--wb-gam-weight-medium: 500;
	--wb-gam-weight-semibold: 600;
	--wb-gam-weight-bold: 700;

	/* Line heights */
	--wb-gam-leading-tight: 1.25;
	--wb-gam-leading-normal: 1.5;
	--wb-gam-leading-relaxed: 1.75;

	/* Colors — neutral palette. Mapped to the host theme's color tokens so
	 * the plugin follows the theme's light/dark mode automatically. BuddyX
	 * and BuddyX Pro expose `--bx-color-*` and flip them under
	 * :root[data-bx-mode="dark"] (and prefers-color-scheme); consuming those
	 * here means cards/text/borders go dark with the theme. Any theme that
	 * doesn't define `--bx-color-*` falls back to the original light values,
	 * so behaviour is unchanged off the BuddyX family. Only NEUTRALS map to
	 * the theme — brand/semantic colors (accent, success, fire, medals) stay
	 * constant across modes. Muted/light text use color-mix so they keep a
	 * readable contrast against whichever surface the theme provides. */
	--wb-gam-color-white: var(--bx-color-bg-elevated, var(--reign-site-sections-bg-color, #ffffff));
	--wb-gam-color-text: var(--bx-color-fg, var(--reign-site-body-text-color, #1a1a2e));
	/* Secondary text is the theme text faded toward the card, but never below WCAG AA: on BuddyX's
	 * mid-grey #505050 text, 50% measured 2.4:1 and 70% 3.7:1; 80% clears 4.5:1 on the card and on
	 * the Hub's tinted stat tiles. */
	--wb-gam-color-text-muted: color-mix(in srgb, var(--bx-color-fg, var(--reign-site-body-text-color, #1a1a2e)) 84%, var(--bx-color-bg-elevated, var(--reign-site-sections-bg-color, #ffffff)));
	--wb-gam-color-text-light: color-mix(in srgb, var(--bx-color-fg, var(--reign-site-body-text-color, #1a1a2e)) 80%, var(--bx-color-bg-elevated, var(--reign-site-sections-bg-color, #ffffff)));
	--wb-gam-color-border: var(--bx-color-border, var(--reign-site-border-color, #e2e3ed));
	--wb-gam-color-border-hover: var(--bx-color-border, var(--reign-site-border-color, #c8c9d9));
	--wb-gam-color-surface: var(--bx-color-bg-elevated, var(--reign-site-sections-bg-color, #ffffff));
	--wb-gam-color-surface-hover: var(--bx-color-bg-muted, var(--reign-site-secondary-bg-color, #f7f7fb));
	--wb-gam-color-surface-alt: var(--bx-color-bg-muted, var(--reign-site-secondary-bg-color, #f1f5f9));
	--wb-gam-color-page: var(--bx-color-bg-page, var(--reign-site-secondary-bg-color, #f8fafc));
	/* Accent — follows the HOST THEME's link/accent colour before the brand purple.
	   Chain: site-owner override (--wbcom-link-color, from Settings > Appearance)
	   -> BuddyX (--bx-color-accent) -> Reign (--reign-site-button-bg-color) -> brand.
	   Until 1.6.4 the chain stopped at --wbcom-link-color, so on Reign every accent
	   in the plugin (buttons, icon chips, links) rendered brand purple while the
	   rest of the page used Reign's blue — the plugin looked bolted on rather than
	   part of the theme. */
	--wb-gam-color-accent: var(--wbcom-link-color, var(--bn-accent, var(--bx-color-accent, var(--reign-site-button-bg-color, #5b4cdb))));
	--wb-gam-color-accent-hover: var(--wbcom-link-hover-color, var(--bn-accent-600, var(--bx-color-accent-hover, var(--reign-site-button-bg-hover-color, #4338b2))));
	/* Tint backgrounds (icon chips, accent pills) are mixed OVER the theme
	 * surface so they're a faint light tint in light mode and a faint dark
	 * tint in dark mode — no opaque light blob on a dark card. */
	--wb-gam-color-accent-light: color-mix(in srgb, var(--wb-gam-color-accent) 14%, var(--wb-gam-color-surface));
	/* Accent text (point numbers, labels) is the accent blended half-way into an ink: the theme's
	 * text darkened toward black in light mode, the theme's light text in dark mode (redefined
	 * there). Blending with BuddyX's mid-grey #505050 text alone left an orange accent at 4.07:1 and
	 * yellow under 4:1; with the ink every accent tried (red, orange, yellow, green, cyan, violet)
	 * measures at least 4.5:1 on the card and on tinted rows, and keeps its hue. */
	--wb-gam-color-accent-ink: color-mix(in srgb, var(--wb-gam-color-text) 40%, #000000);
	--wb-gam-color-accent-text: color-mix(in srgb, var(--wb-gam-color-accent) 50%, var(--wb-gam-color-accent-ink));
	/* Follows the theme's accent, like every other accent tint (was a fixed brand-purple rgba). */
	--wb-gam-color-accent-ring: color-mix(in srgb, var(--wb-gam-color-accent) 20%, transparent);

	/* Colors — semantic. The solid hue stays constant; the `-bg` tint is
	 * mixed over the theme surface so status chips / podium rows / pills
	 * adapt to dark mode instead of showing an opaque light blob. (The
	 * `-soft` rgba variants were already surface-agnostic.) */
	--wb-gam-color-success: #0d9f6e;
	--wb-gam-color-success-bg: color-mix(in srgb, var(--wb-gam-color-success) 12%, var(--wb-gam-color-surface));
	/* #047857 measured 4.27:1 on its own tint over a cream owner card; this holds 5:1 there, 5.6:1 on white. */
	--wb-gam-color-success-strong: #046c4e;
	--wb-gam-color-success-soft: rgba(13, 159, 110, 0.12);

	/* League tier accents (cohort rank). These are deliberately literal -- bronze is
	 * bronze -- but they belong here rather than hardcoded inside a block stylesheet.
	 * As tokens the owner can rebrand a tier, and the dark-mode block below can lift
	 * the darker medals so Bronze and Obsidian do not disappear against a dark
	 * surface. Hardcoded in cohort-rank/style.css, they could do neither. */
	--wb-gam-tier-bronze: #b45309;
	--wb-gam-tier-silver: #6b7280;
	--wb-gam-tier-gold: #d97706;
	--wb-gam-tier-diamond: #2563eb;
	--wb-gam-tier-obsidian: #4b5563;
	--wb-gam-color-warning: #c2770e;
	--wb-gam-color-warning-bg: color-mix(in srgb, var(--wb-gam-color-warning) 12%, var(--wb-gam-color-surface));
	/* amber-800: #b45309 measured 3.97:1 as a bonus pill on the green tint of a completed challenge. */
	--wb-gam-color-warning-strong: #92400e;
	--wb-gam-color-warning-soft: rgba(245, 158, 11, 0.15);
	--wb-gam-color-danger: #ef4444;
	--wb-gam-color-danger-bg: color-mix(in srgb, var(--wb-gam-color-danger) 12%, var(--wb-gam-color-surface));
	--wb-gam-color-danger-strong: #b91c1c;
	--wb-gam-color-danger-soft: rgba(185, 28, 28, 0.10);
	/* blue-700: #2563eb measured 4.37:1 as 11px text on its own tint. */
	--wb-gam-color-info: #1d4ed8;
	--wb-gam-color-info-bg: color-mix(in srgb, var(--wb-gam-color-info) 12%, var(--wb-gam-color-surface));
	--wb-gam-color-info-soft: rgba(37, 99, 235, 0.10);

	/* Extra neutrals — surface-muted is the "card lifted off a panel"
	 * shade. Border-strong is the focus / hover stroke. Theme-mapped (see
	 * the neutral palette note above). */
	/* Rows on a card: the card's own surface, a step toward the ink. A theme's muted shade can sit on
	 * either side of its card (BuddyX: #fafafa on #fff at 1.04:1 in light, #101010 under #161616 in dark),
	 * so it cannot separate rows from their card in both modes. */
	--wb-gam-color-surface-muted: color-mix(in srgb, var(--wb-gam-color-text) 5%, var(--wb-gam-color-surface));
	--wb-gam-color-border-strong: var(--bx-color-border, var(--reign-site-border-color, #d1d5db));
	--wb-gam-color-locked-soft: rgba(156, 163, 175, 0.16);
	--wb-gam-color-primary-soft: color-mix(in srgb, var(--wb-gam-color-accent) 10%, transparent);

	/* Accent variants tied to per-block accent (fire, gold-soft). */
	--wb-gam-color-fire: #f59e0b;
	--wb-gam-color-fire-light: #f97316;
	--wb-gam-color-fire-strong: #b45309;
	--wb-gam-color-fire-soft: rgba(245, 158, 11, 0.15);
	--wb-gam-color-fire-gradient: linear-gradient(90deg, #f97316 0%, #f59e0b 100%);

	/* Streak heatmap — 4 intensity steps of the primary accent (purple
	 * family). Cell-0 is the empty state (border-strength), 1→4 ramps
	 * from soft to deepest. Kept distinct from the regular primary
	 * palette so heatmap legibility doesn't depend on theme accent. */
	--wb-gam-color-heatmap-0: var(--wb-gam-color-border);
	--wb-gam-color-heatmap-1: #c4b5fd;
	--wb-gam-color-heatmap-2: #a78bfa;
	--wb-gam-color-heatmap-3: #7c3aed;
	--wb-gam-color-heatmap-4: #4c1d95;

	/* Rank/medal palette (used by leaderboard, top-members, year-recap) */
	--wb-gam-color-gold: #b8860b;
	/* gray-600: #6b7280 measured 4.47:1 on the tinted leaderboard rows. */
	--wb-gam-color-silver: #4b5563;
	--wb-gam-color-bronze: #a0522d;
	/* A light ground for uploaded badge art (often dark line-art on transparent). Fixed on
	 * purpose: it does not flip in dark mode, because the art needs a light surface there most. */
	--wb-gam-color-art-tile: #f8fafc;
	/* Gold as TEXT (rank number, "1st place", badge counts, a badge behind white text). The medal
	 * gold is 3.25:1 on white and 2.9:1 on the cream first-place row; this ink is 5.37:1 and
	 * 4.78:1. Silver (4.83:1) and bronze (6.1:1) already pass. Dark mode uses the medal itself. */
	--wb-gam-color-gold-text: color-mix(in srgb, #b8860b 75%, #000000);

	/* Interaction states */
	--wb-gam-color-disabled: var(--wb-gam-color-surface-alt);
	--wb-gam-color-disabled-text: var(--wb-gam-color-text-light);
	--wb-gam-color-focus: #ffd54a;

	/* Responsive breakpoints (used by CSS generation utility) */
	--wb-gam-bp-tablet: 1024px;
	--wb-gam-bp-mobile: 767px;

	/* Transition. Aliases of the locked motion scale below: the plugin used to carry its own
	 * 150/300/500ms scale next to BuddyNext's 120/200/400ms, which is how one screen ended up
	 * with fourteen different durations. */
	--wb-gam-transition-fast: var(--wb-gam-dur-fast) var(--wb-gam-ease);
	--wb-gam-transition-normal: var(--wb-gam-dur) var(--wb-gam-ease);
	--wb-gam-transition-slow: var(--wb-gam-dur-slow) var(--wb-gam-ease);

	/* Z-index scale */
	--wb-gam-z-below: -1;
	--wb-gam-z-base: 0;
	--wb-gam-z-above: 1;
	--wb-gam-z-dropdown: 10;
	--wb-gam-z-overlay: 100;
	--wb-gam-z-modal: 1000;

	/* ── Shorthand aliases ──────────────────────────────────────────
	 * Per-block stylesheets in src/Blocks/<slug>/style.css consume
	 * these short names. Defined here (not frontend.css) so the
	 * `wb-gam-tokens` handle is sufficient — blocks no longer depend
	 * on the legacy `wb-gamification` (frontend.css) bundle being
	 * enqueued. */
	--wb-gam-primary: var(--wb-gam-color-accent);
	--wb-gam-primary-light: var(--wb-gam-color-accent-light);
	--wb-gam-primary-text: var(--wb-gam-color-accent-text);
	--wb-gam-text: var(--wb-gam-color-text);
	--wb-gam-text-secondary: var(--wb-gam-color-text-muted);
	--wb-gam-text-muted: var(--wb-gam-color-text-light);
	--wb-gam-border: var(--wb-gam-color-border);
	--wb-gam-card-bg: var(--wb-gam-color-surface);
	--wb-gam-card-bg-hover: var(--wb-gam-color-surface-hover);
	--wb-gam-radius: var(--wb-gam-radius-md);
	--wb-gam-radius-card: var(--wb-gam-radius-md);
	--wb-gam-shadow: var(--wb-gam-shadow-sm);
	--wb-gam-shadow-hover: var(--wb-gam-shadow-md);
	--wb-gam-gap: var(--wb-gam-space-md);
	--wb-gam-transition: var(--wb-gam-transition-fast);
	--wb-gam-gold: var(--wb-gam-color-gold);
	--wb-gam-silver: var(--wb-gam-color-silver);
	--wb-gam-bronze: var(--wb-gam-color-bronze);
	--wb-gam-fill: var(--wb-gam-color-accent);
	--wb-gam-recap-accent: var(--wb-gam-color-accent);
}

/* ── Popup system ───────────────────────────────────────────────────────────
 * The one home for every popup value: toast, banner, dialog, drawer, menu and the
 * Moment card. Designed in the Popup Atlas and agreed with the BuddyNext session.
 *
 * Every token reads BuddyNext first. The fallback is BuddyNext's own default, so the
 * plugin renders identically on a site without BuddyNext and follows BuddyNext's
 * numbers automatically when they change (BuddyNext also flips these in dark mode).
 * A popup stylesheet must use these tokens and never a literal; bin/check-motion-tokens.sh
 * fails the build on a raw duration or easing outside this file and popups.css.
 */
:root {
	/* Colour */
	--wb-gam-pop-surface: var(--bn-surface, var(--wb-gam-color-surface));
	--wb-gam-pop-text: var(--bn-text-1, var(--wb-gam-color-text));
	--wb-gam-pop-text-2: var(--bn-text-2, var(--wb-gam-color-text-muted));
	--wb-gam-pop-text-3: var(--bn-text-3, var(--wb-gam-color-text-light));
	--wb-gam-pop-line: var(--bn-line, var(--bn-border, var(--wb-gam-color-border)));
	--wb-gam-pop-subtle: var(--bn-bg-subtle, var(--wb-gam-color-surface-alt));
	--wb-gam-pop-accent: var(--bn-accent-500, var(--bn-accent, var(--wb-gam-color-accent)));
	/* Text ON the accent. Each theme pairs its button colour with a text colour (BuddyX's
	 * accent-inverse, Reign's button text), so read that pair before assuming white: Reign dark's
	 * #97c0ee button with white text measured 1.89:1, with Reign's own #111111 it is 9.97:1. */
	--wb-gam-pop-accent-fg: var(--bn-accent-fg, var(--bx-color-accent-inverse, var(--reign-site-button-text-color, #ffffff)));
	--wb-gam-pop-accent-100: var(--bn-accent-100, color-mix(in srgb, var(--wb-gam-pop-accent) 12%, var(--wb-gam-pop-surface)));
	--wb-gam-pop-accent-200: var(--bn-accent-200, color-mix(in srgb, var(--wb-gam-pop-accent) 24%, var(--wb-gam-pop-surface)));
	--wb-gam-pop-success: var(--bn-success, var(--wb-gam-color-success));
	--wb-gam-pop-success-bg: var(--bn-success-bg, var(--wb-gam-color-success-bg));
	--wb-gam-pop-danger: var(--bn-danger, var(--wb-gam-color-danger));
	--wb-gam-pop-danger-bg: var(--bn-danger-bg, var(--wb-gam-color-danger-bg));
	--wb-gam-pop-info: var(--bn-info, var(--wb-gam-color-info));
	--wb-gam-pop-info-bg: var(--bn-info-bg, var(--wb-gam-color-info-bg));
	/* The toast is BuddyNext's inverted surface: the text colour as the ground. */
	--wb-gam-pop-inv-bg: var(--bn-text-1, var(--wb-gam-color-text));
	--wb-gam-pop-inv-fg: var(--bn-bg, var(--wb-gam-color-page));

	/* Confetti: five stops of the community's accent plus white. Never a rainbow. */
	--wb-gam-cf-1: var(--bn-accent-500, var(--wb-gam-pop-accent));
	--wb-gam-cf-2: var(--bn-accent-400, color-mix(in srgb, var(--wb-gam-pop-accent) 65%, #ffffff));
	--wb-gam-cf-3: var(--bn-accent-600, color-mix(in srgb, var(--wb-gam-pop-accent) 85%, #20262e));
	--wb-gam-cf-4: var(--bn-accent-800, color-mix(in srgb, var(--wb-gam-pop-accent) 68%, #20262e));
	--wb-gam-cf-5: #ffffff;

	/* Shape and elevation */
	--wb-gam-pop-r-sm: var(--bn-r-sm, 5px);
	--wb-gam-pop-r-md: var(--bn-r-md, 10px);
	--wb-gam-pop-r-lg: var(--bn-r-lg, 14px);
	--wb-gam-pop-r-xl: var(--bn-r-xl, 20px);
	--wb-gam-pop-r-full: var(--bn-r-full, 9999px);
	--wb-gam-pop-shadow-md: var(--bn-shadow-md, 0 2px 4px rgba(0, 0, 0, 0.04), 0 8px 16px rgba(0, 0, 0, 0.06));
	--wb-gam-pop-shadow-lg: var(--bn-shadow-lg, 0 8px 16px rgba(0, 0, 0, 0.06), 0 24px 48px rgba(0, 0, 0, 0.12));
	--wb-gam-pop-scrim: var(--bn-overlay, color-mix(in srgb, #20262e 55%, transparent));
	--wb-gam-pop-blur: 2px;

	/* Layers. Never a literal in a stylesheet. */
	--wb-gam-pop-z-menu: var(--bn-z-menu, 99000);
	--wb-gam-pop-z-modal: var(--bn-z-modal, 100100);
	--wb-gam-pop-z-toast: var(--bn-z-toast, 100200);

	/* Buttons: BuddyNext's shared button. */
	--wb-gam-btn-h: var(--bn-btn-h, 40px);
	--wb-gam-btn-r: var(--bn-btn-r, var(--bn-r-md, 10px));
	--wb-gam-btn-py: var(--bn-btn-py, 8px);
	--wb-gam-btn-px: var(--bn-btn-px, 16px);

	/* Type */
	--wb-gam-pop-font: var(--bn-font-body, inherit);

	/* Motion: BuddyNext's three timings and two easings, plus the four keyframe timings
	 * BuddyNext's own toast, modal, dropdown and bounce-in use. */
	--wb-gam-dur-fast: var(--bn-dur-fast, 120ms);
	--wb-gam-dur: var(--bn-dur, 200ms);
	--wb-gam-dur-slow: var(--bn-dur-slow, 400ms);
	--wb-gam-dur-toast: 250ms;
	--wb-gam-dur-modal: 180ms;
	--wb-gam-dur-menu: 150ms;
	--wb-gam-dur-moment: 500ms;
	--wb-gam-delay-numeral: 300ms;
	--wb-gam-ease: var(--bn-ease, cubic-bezier(0.2, 0.8, 0.2, 1));
	--wb-gam-ease-out: var(--bn-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
	--wb-gam-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Dark-mode accent ───────────────────────────────────────────────────────
 * The THEME's accent still wins here. Only the final fallback changes: on a
 * dark surface the brand purple is lightened so glyphs, links, the level
 * progress bar and accent pills keep their punch and contrast.
 *
 * Until 1.6.4 this block set the lightened purple UNCONDITIONALLY — a per-mode
 * internal literal that overrode the whole theme chain. The result: on any dark
 * theme, every accent in the plugin painted brand purple regardless of what the
 * theme's accent was. On Reign (accent #97c0ee, a blue) the plugin's buttons and
 * icon chips came out purple against a blue-accented page, so it read as bolted
 * on rather than part of the theme. A theme-mapped token that a per-mode literal
 * later overwrites is not theme-mapped at all.
 *
 * Chain, unchanged from :root — only the tail differs:
 *   --wbcom-link-color            site-owner override (Settings > Appearance)
 *   --bx-color-accent            BuddyX / BuddyX Pro
 *   --reign-site-button-bg-color Reign (its ACCENT; --reign-site-link-color is
 *                                #ffffff in dark — that is link TEXT, not a brand
 *                                colour, and would give white-on-white buttons)
 *   lightened brand purple       themes exposing no accent token
 *
 * Scoped to the dark selectors the whole Wbcom theme family uses: data-bx-mode
 * (BuddyX, BuddyX Pro AND Reign 8.x all set it), the prefers-color-scheme auto
 * path, and the legacy .buddyx-dark-theme body class. accent-light / accent-text
 * cascade from --wb-gam-color-accent, so they follow automatically. */
:root[data-bx-mode="dark"],
:root[data-theme="dark"],
body.buddyx-dark-theme,
.wb-gam-scheme-dark {
	/* An owner's own accent (block setting) is any colour at all: #cc0000 half-mixed into the ink read
	 * 3.10:1 on Reign's dark surface. Pull it further toward the ink in dark; the theme accent keeps 50%. */
	--wb-gam-owner-accent-mix: 35%;
	--wb-gam-color-accent: var(--wbcom-link-color, var(--bn-accent, var(--bx-color-accent, var(--reign-site-button-bg-color, color-mix(in srgb, #5b4cdb 60%, #ffffff)))));
	--wb-gam-color-accent-hover: var(--wbcom-link-hover-color, var(--bn-accent-600, var(--bx-color-accent-hover, var(--reign-site-button-bg-hover-color, color-mix(in srgb, #5b4cdb 45%, #ffffff)))));
	--wb-gam-color-accent-ink: var(--wb-gam-color-text);

	/* Lift the dark medals. Bronze (#b45309) and Obsidian (#4b5563) are dark enough to
	 * sink into a dark surface -- the member's own league tier becomes the one thing
	 * they cannot read. Mixing toward white keeps each medal recognisably itself while
	 * restoring contrast. This is only expressible because the tiers are tokens. */
	--wb-gam-tier-bronze: color-mix(in srgb, #b45309 65%, #ffffff);
	--wb-gam-tier-silver: color-mix(in srgb, #6b7280 55%, #ffffff);
	--wb-gam-tier-obsidian: color-mix(in srgb, #4b5563 55%, #ffffff);

	/* The RANK medals needed exactly the same lift and never got it. The league tiers above were
	 * fixed; the rank palette sitting right beside them -- leaderboard positions 1/2/3, the
	 * top-members podium, year-recap -- kept its light-mode values and sank into the dark surface.
	 * Measured against a #161616 surface: silver #6b7280 = 3.74:1, bronze #a0522d = 3.22:1, both
	 * under the 4.5:1 WCAG AA floor. Gold clears it at 5.56:1 and is left as it is. */
	--wb-gam-color-silver: color-mix(in srgb, #6b7280 45%, #ffffff);
	--wb-gam-color-bronze: color-mix(in srgb, #a0522d 50%, #ffffff);
	--wb-gam-color-gold-text: color-mix(in srgb, var(--wb-gam-color-gold) 70%, #ffffff);

	/* Text on the lightened brand accent: white on it is 2.68:1, this ink is 6.37:1. A theme's
	 * own pair still wins. */
	--wb-gam-pop-accent-fg: var(--bn-accent-fg, var(--bx-color-accent-inverse, var(--reign-site-button-text-color, #1a1a2e)));

	/* Lift the "-strong" status inks, info and the deepest heatmap step for a dark surface. The
	 * light values measure 2.3:1 to 3.6:1 on #161616 / #1f2937 / #15181f (heatmap-4 1.3:1); the
	 * mixes below measure at least 5.2:1 on all three (heatmap-4 4.5:1), and stay recognisably
	 * green, amber, red, blue and violet. Warning is lifted to 50% so a bonus pill on the green tint
	 * of a completed challenge still clears 4.5:1 (60% measured 4.34:1 there). */
	--wb-gam-color-success-strong: color-mix(in srgb, #047857 60%, #ffffff);
	--wb-gam-color-warning-strong: color-mix(in srgb, #b45309 50%, #ffffff);
	--wb-gam-color-danger-strong: color-mix(in srgb, #b91c1c 55%, #ffffff);
	--wb-gam-color-fire-strong: color-mix(in srgb, #b45309 60%, #ffffff);
	--wb-gam-color-info: color-mix(in srgb, #2563eb 60%, #ffffff);
	--wb-gam-color-heatmap-4: color-mix(in srgb, #4c1d95 55%, #ffffff);
}
@media (prefers-color-scheme: dark) {
	:root[data-bx-mode="auto"] {
		--wb-gam-owner-accent-mix: 35%;
		--wb-gam-color-accent: var(--wbcom-link-color, var(--bn-accent, var(--bx-color-accent, var(--reign-site-button-bg-color, color-mix(in srgb, #5b4cdb 60%, #ffffff)))));
		--wb-gam-color-accent-hover: var(--wbcom-link-hover-color, var(--bn-accent-600, var(--bx-color-accent-hover, var(--reign-site-button-bg-hover-color, color-mix(in srgb, #5b4cdb 45%, #ffffff)))));
		--wb-gam-color-accent-ink: var(--wb-gam-color-text);

		/* Auto-mode is a dark surface too. Lifting the medals only on the explicit dark
		 * selectors would leave every owner who never touched the toggle reading 3.2:1 bronze. */
		--wb-gam-tier-bronze: color-mix(in srgb, #b45309 65%, #ffffff);
		--wb-gam-tier-silver: color-mix(in srgb, #6b7280 55%, #ffffff);
		--wb-gam-tier-obsidian: color-mix(in srgb, #4b5563 55%, #ffffff);
		--wb-gam-color-silver: color-mix(in srgb, #6b7280 45%, #ffffff);
		--wb-gam-color-bronze: color-mix(in srgb, #a0522d 50%, #ffffff);
		--wb-gam-color-gold-text: color-mix(in srgb, var(--wb-gam-color-gold) 70%, #ffffff);
		/* Text on the lightened brand accent: white on it is 2.68:1, this ink is 6.37:1. A theme's
		 * own pair still wins. */
		--wb-gam-pop-accent-fg: var(--bn-accent-fg, var(--bx-color-accent-inverse, var(--reign-site-button-text-color, #1a1a2e)));

		/* Lift the "-strong" status inks, info and the deepest heatmap step for a dark surface. The
		 * light values measure 2.3:1 to 3.6:1 on #161616 / #1f2937 / #15181f (heatmap-4 1.3:1); the
		 * mixes below measure at least 5.2:1 on all three (heatmap-4 4.5:1), and stay recognisably
		 * green, amber, red, blue and violet. */
		--wb-gam-color-success-strong: color-mix(in srgb, #047857 60%, #ffffff);
		--wb-gam-color-warning-strong: color-mix(in srgb, #b45309 50%, #ffffff);
		--wb-gam-color-danger-strong: color-mix(in srgb, #b91c1c 55%, #ffffff);
		--wb-gam-color-fire-strong: color-mix(in srgb, #b45309 60%, #ffffff);
		--wb-gam-color-info: color-mix(in srgb, #2563eb 60%, #ffffff);
		--wb-gam-color-heatmap-4: color-mix(in srgb, #4c1d95 55%, #ffffff);
	}
}

/* Label colour on accent buttons, picked from the accent's own lightness: dark text on a light accent
 * (white on an orange theme accent measured 2.59:1), white on a dark one. Overrides a theme's button
 * text pair, which is the one that failed. Browsers without relative colours keep the value above. */
@supports (color: oklch(from red l c h)) {
	/* The dark selectors too: they restore the theme's pair (BuddyX dark: white on its orange, 3.36:1). */
	:root,
	:root[data-bx-mode="dark"],
	:root[data-theme="dark"],
	body.buddyx-dark-theme,
	.wb-gam-scheme-light,
	.wb-gam-scheme-dark {
		--wb-gam-pop-accent-fg: oklch(from var(--wb-gam-pop-accent) round(1.07 - l) 0 0);
	}
	@media (prefers-color-scheme: dark) {
		:root[data-bx-mode="auto"] {
			--wb-gam-pop-accent-fg: oklch(from var(--wb-gam-pop-accent) round(1.07 - l) 0 0);
		}
	}
}

/* ── Owner card colour ──────────────────────────────────────────────────────
 * A block whose owner set a Card background carries .wb-gam-scheme-light or
 * .wb-gam-scheme-dark, picked from that colour (WBGam\Blocks\CSS::ink_for()). The
 * light or dark token set above is declared again on the block, so every token
 * built from the surface or the text resolves against the owner's card instead of
 * the page's mode: a cream card on a dark page reads as a light card. The block's
 * own rule (CSS.php) then pins text and surfaces to that card.
 * Popups and headings here follow the card, not BuddyNext or the theme. */
.wb-gam-scheme-light {
	color-scheme: light;
}
.wb-gam-scheme-dark {
	color-scheme: dark;
}
.wb-gam-scheme-light,
.wb-gam-scheme-dark {
	--wb-gam-pop-surface: var(--wb-gam-color-surface);
	--wb-gam-pop-text: var(--wb-gam-color-text);
	--wb-gam-pop-text-2: var(--wb-gam-color-text-muted);
	--wb-gam-pop-text-3: var(--wb-gam-color-text-light);
	--wb-gam-pop-subtle: var(--wb-gam-color-surface-alt);
	--wb-gam-pop-inv-bg: var(--wb-gam-color-text);
}
.wb-gam-scheme-light :is(h1, h2, h3, h4, h5, h6),
.wb-gam-scheme-dark :is(h1, h2, h3, h4, h5, h6) {
	color: inherit;
}
