/* Site-audit standard: no "hangers" (a second line holding only a word or two), no serif fallback, no overflow of fixed tables.
   Zero-specificity :where() so any page rule still wins; text-wrap only changes how lines break. */
/* Look v3 (owner decision, option B). The tokens are the same values as in xag-theme.css (a test keeps them equal); they are repeated here because the generated pages load this file but not xag-theme.css. */
@font-face { font-family: "Carlito"; font-style: normal; font-weight: 400; font-display: swap; src: local("Carlito"), local("Carlito Regular"), url("/fonts/carlito-400.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Carlito"; font-style: normal; font-weight: 700; font-display: swap; src: local("Carlito Bold"), url("/fonts/carlito-700.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --xag-font-body: Calibri, Carlito, "Segoe UI", Arial, "Noto Sans Thai", "Leelawadee UI", "Noto Sans SC", "Microsoft YaHei", "Noto Sans KR", "Malgun Gothic", sans-serif;
  --xag-fs-body: 1rem;
  --xag-lh-body: 1.55;
  --xag-h-sec: #b45309;
  --xag-h-sec-size: clamp(1.2rem, 0.6rem + 3vw, 1.3125rem);
  --xag-h-sub: #92400e;
  --xag-h-sub-size: 1.125rem;
  --xag-h-dot: #0369a1;
}
html[data-theme="dark"], html[data-theme="glass"], html[data-theme="brite"] { --xag-h-sec: #fbbf24; --xag-h-sub: #fde68a; --xag-h-dot: #38bdf8; }

/* COLOUR ROLES (owner order: consistency). One set of semantic colour tokens for every per-feature stylesheet, defined for Light, Dark, Glassy and Brite.
   Stylesheets use var(--xag-c-*) instead of a hex colour; test/ui-colours.test.mjs keeps hard-coded colours out, test/colour-roles.test.mjs checks WCAG AA of every text/surface pair in every theme.
   Light values are the page's own colours; Dark and Glassy follow the generated dark palette; Brite follows brite.css (no yellow/orange/red there: gold and warnings become green, errors fluoro yellow). */
:root {
  --xag-c-bg: #f7f8fb;
  --xag-c-surface: #ffffff;
  --xag-c-surface-2: #eef4f8;
  --xag-c-surface-3: #e2e8f0;
  --xag-c-accent-bg: #e0e7ff;
  --xag-c-ok-bg: #dcfce7;
  --xag-c-warn-bg: #fef3c7;
  --xag-c-bad-bg: #fee2e2;
  --xag-c-purple-bg: #f3e8ff;
  --xag-c-text: #0b1c2d;
  --xag-c-text-2: #3d4f63;
  --xag-c-text-3: #556477;
  --xag-c-accent-text: #1e40af;
  --xag-c-teal-text: #14566f;
  --xag-c-ok-text: #0f6b3a;
  --xag-c-warn-text: #78350f;
  --xag-c-bad-text: #b91c1c;
  --xag-c-purple-text: #581c87;
  --xag-c-line: #cbd5e1;
  --xag-c-line-soft: #e2e8f0;
  --xag-c-line-strong: #5b6b7d;
  --xag-c-ok-line: #15803d;
  --xag-c-warn-line: #b45309;
  --xag-c-bad-line: #b91c1c;
  --xag-c-teal-line: #0e7490;
  --xag-c-purple-line: #7e22ce;
  --xag-c-accent: #304adc;
  --xag-c-on-accent: #ffffff;
  --xag-c-inverse: #0b1c2d;
  --xag-c-on-inverse: #ffffff;
  --xag-c-gold: #b86e00;
  --xag-c-solid-teal: #1d6b8a;
  --xag-c-solid-ok: #1b7f43;
  --xag-c-solid-bad: #d92d20;
  --xag-c-solid-warn: #e0831f;
  --xag-c-solid-purple: #7c3aed;
  --xag-c-solid-pink: #c2398f;
  --xag-c-solid-cyan: #0aa5a8;
  --xag-c-on-solid: #ffffff;
  --xag-c-white: #ffffff;
  --xag-c-black: #000000;
  --xag-c-on-bright: #0b1c2d;
  --xag-c-on-yellow: #111111;
  --xag-c-scrim: rgba(7, 20, 51, 0.72);
  --xag-c-seal-1: #ffe08a;
  --xag-c-seal-2: #ffb000;
  --xag-c-seal-3: #e08a00;
  --xag-c-shadow-sm: 0 2px 8px rgba(11, 28, 45, .10);
  --xag-c-shadow: 0 8px 28px rgba(11, 28, 45, .14);
  --xag-radius-s: 10px;
  --xag-radius: 16px;
  --xag-radius-l: 24px;
  --xag-radius-pill: 999px;
}
html[data-theme="dark"] {
  --xag-c-bg: #071433;
  --xag-c-surface: #10306b;
  --xag-c-surface-2: #0b1f4d;
  --xag-c-surface-3: #143270;
  --xag-c-accent-bg: #143a7f;
  --xag-c-ok-bg: #0f4a2c;
  --xag-c-warn-bg: #5b3a05;
  --xag-c-bad-bg: #6e1d1d;
  --xag-c-purple-bg: #3b2a6b;
  --xag-c-text: #eaf1ff;
  --xag-c-text-2: #c4d4f0;
  --xag-c-text-3: #b4c6ec;
  --xag-c-accent-text: #7fd0ff;
  --xag-c-teal-text: #7fd0ff;
  --xag-c-ok-text: #6ee7a0;
  --xag-c-warn-text: #fde68a;
  --xag-c-bad-text: #fecaca;
  --xag-c-purple-text: #d8b4fe;
  --xag-c-line: #3566b8;
  --xag-c-line-soft: #2b55a3;
  --xag-c-line-strong: #9fbdf0;
  --xag-c-ok-line: #4ade80;
  --xag-c-warn-line: #fcd34d;
  --xag-c-bad-line: #f87171;
  --xag-c-teal-line: #7fd0ff;
  --xag-c-purple-line: #c4b5fd;
  --xag-c-accent: #ffb000;
  --xag-c-on-accent: #1a1100;
  --xag-c-inverse: #071433;
  --xag-c-on-inverse: #ffffff;
  --xag-c-gold: #ffb000;
  --xag-c-solid-teal: #1d6b8a;
  --xag-c-solid-ok: #1b7f43;
  --xag-c-solid-bad: #d92d20;
  --xag-c-solid-warn: #e0831f;
  --xag-c-solid-purple: #7c3aed;
  --xag-c-solid-pink: #c2398f;
  --xag-c-solid-cyan: #0aa5a8;
  --xag-c-on-solid: #ffffff;
  --xag-c-white: #ffffff;
  --xag-c-black: #000000;
  --xag-c-on-bright: #0b1c2d;
  --xag-c-on-yellow: #111111;
  --xag-c-scrim: rgba(7, 20, 51, 0.72);
  --xag-c-seal-1: #ffe08a;
  --xag-c-seal-2: #ffb000;
  --xag-c-seal-3: #e08a00;
  --xag-c-shadow-sm: 0 2px 8px rgba(3, 10, 30, .45);
  --xag-c-shadow: 0 10px 30px rgba(3, 10, 30, .45);
}
html[data-theme="glass"] {
  --xag-c-bg: #071433;
  --xag-c-surface: #10306b;
  --xag-c-surface-2: #0b1f4d;
  --xag-c-surface-3: #143270;
  --xag-c-accent-bg: #143a7f;
  --xag-c-ok-bg: #0f4a2c;
  --xag-c-warn-bg: #5b3a05;
  --xag-c-bad-bg: #6e1d1d;
  --xag-c-purple-bg: #3b2a6b;
  --xag-c-text: #eaf1ff;
  --xag-c-text-2: #c4d4f0;
  --xag-c-text-3: #b4c6ec;
  --xag-c-accent-text: #7fd0ff;
  --xag-c-teal-text: #7fd0ff;
  --xag-c-ok-text: #6ee7a0;
  --xag-c-warn-text: #fde68a;
  --xag-c-bad-text: #fecaca;
  --xag-c-purple-text: #d8b4fe;
  --xag-c-line: #3566b8;
  --xag-c-line-soft: #2b55a3;
  --xag-c-line-strong: #9fbdf0;
  --xag-c-ok-line: #4ade80;
  --xag-c-warn-line: #fcd34d;
  --xag-c-bad-line: #f87171;
  --xag-c-teal-line: #7fd0ff;
  --xag-c-purple-line: #c4b5fd;
  --xag-c-accent: #ffb000;
  --xag-c-on-accent: #1a1100;
  --xag-c-inverse: #071433;
  --xag-c-on-inverse: #ffffff;
  --xag-c-gold: #ffb000;
  --xag-c-solid-teal: #1d6b8a;
  --xag-c-solid-ok: #1b7f43;
  --xag-c-solid-bad: #d92d20;
  --xag-c-solid-warn: #e0831f;
  --xag-c-solid-purple: #7c3aed;
  --xag-c-solid-pink: #c2398f;
  --xag-c-solid-cyan: #0aa5a8;
  --xag-c-on-solid: #ffffff;
  --xag-c-white: #ffffff;
  --xag-c-black: #000000;
  --xag-c-on-bright: #0b1c2d;
  --xag-c-on-yellow: #111111;
  --xag-c-scrim: rgba(7, 20, 51, 0.72);
  --xag-c-seal-1: #ffe08a;
  --xag-c-seal-2: #ffb000;
  --xag-c-seal-3: #e08a00;
  --xag-c-surface: rgba(16,48,107, var(--gl-a, 1));
  --xag-c-surface-2: rgba(11,31,77, var(--gl-a, 1));
  --xag-c-surface-3: rgba(20,50,112, var(--gl-a, 1));
  --xag-c-accent-bg: rgba(20,58,127, var(--gl-a, 1));
  --xag-c-ok-bg: rgba(15,74,44, var(--gl-a, 1));
  --xag-c-warn-bg: rgba(91,58,5, var(--gl-a, 1));
  --xag-c-bad-bg: rgba(110,29,29, var(--gl-a, 1));
  --xag-c-purple-bg: rgba(59,42,107, var(--gl-a, 1));
  --xag-c-shadow-sm: 0 2px 8px rgba(3, 10, 30, .45);
  --xag-c-shadow: 0 10px 30px rgba(3, 10, 30, .45);
}
/* Brite never applies to the header, menu panels and footer: they keep the Dark, then the Glassy role values (owner 2026-11-04) */
html[data-theme="brite"] .site-header,
html[data-theme="brite"] footer,
html[data-theme="brite"] .xag-menu,
html[data-theme="brite"] .xag-admin-menu {
  --xag-c-bg: #071433;
  --xag-c-surface: #10306b;
  --xag-c-surface-2: #0b1f4d;
  --xag-c-surface-3: #143270;
  --xag-c-accent-bg: #143a7f;
  --xag-c-ok-bg: #0f4a2c;
  --xag-c-warn-bg: #5b3a05;
  --xag-c-bad-bg: #6e1d1d;
  --xag-c-purple-bg: #3b2a6b;
  --xag-c-text: #eaf1ff;
  --xag-c-text-2: #c4d4f0;
  --xag-c-text-3: #b4c6ec;
  --xag-c-accent-text: #7fd0ff;
  --xag-c-teal-text: #7fd0ff;
  --xag-c-ok-text: #6ee7a0;
  --xag-c-warn-text: #fde68a;
  --xag-c-bad-text: #fecaca;
  --xag-c-purple-text: #d8b4fe;
  --xag-c-line: #3566b8;
  --xag-c-line-soft: #2b55a3;
  --xag-c-line-strong: #9fbdf0;
  --xag-c-ok-line: #4ade80;
  --xag-c-warn-line: #fcd34d;
  --xag-c-bad-line: #f87171;
  --xag-c-teal-line: #7fd0ff;
  --xag-c-purple-line: #c4b5fd;
  --xag-c-accent: #ffb000;
  --xag-c-on-accent: #1a1100;
  --xag-c-inverse: #071433;
  --xag-c-on-inverse: #ffffff;
  --xag-c-gold: #ffb000;
  --xag-c-solid-teal: #1d6b8a;
  --xag-c-solid-ok: #1b7f43;
  --xag-c-solid-bad: #d92d20;
  --xag-c-solid-warn: #e0831f;
  --xag-c-solid-purple: #7c3aed;
  --xag-c-solid-pink: #c2398f;
  --xag-c-solid-cyan: #0aa5a8;
  --xag-c-on-solid: #ffffff;
  --xag-c-white: #ffffff;
  --xag-c-black: #000000;
  --xag-c-on-bright: #0b1c2d;
  --xag-c-scrim: rgba(7, 20, 51, 0.72);
  --xag-c-seal-1: #ffe08a;
  --xag-c-seal-2: #ffb000;
  --xag-c-seal-3: #e08a00;
  --xag-c-shadow-sm: 0 2px 8px rgba(3, 10, 30, .45);
  --xag-c-shadow: 0 10px 30px rgba(3, 10, 30, .45);
}
html[data-theme="brite"] .site-header,
html[data-theme="brite"] footer,
html[data-theme="brite"] .xag-menu,
html[data-theme="brite"] .xag-admin-menu {
  --xag-c-bg: #071433;
  --xag-c-surface: #10306b;
  --xag-c-surface-2: #0b1f4d;
  --xag-c-surface-3: #143270;
  --xag-c-accent-bg: #143a7f;
  --xag-c-ok-bg: #0f4a2c;
  --xag-c-warn-bg: #5b3a05;
  --xag-c-bad-bg: #6e1d1d;
  --xag-c-purple-bg: #3b2a6b;
  --xag-c-text: #eaf1ff;
  --xag-c-text-2: #c4d4f0;
  --xag-c-text-3: #b4c6ec;
  --xag-c-accent-text: #7fd0ff;
  --xag-c-teal-text: #7fd0ff;
  --xag-c-ok-text: #6ee7a0;
  --xag-c-warn-text: #fde68a;
  --xag-c-bad-text: #fecaca;
  --xag-c-purple-text: #d8b4fe;
  --xag-c-line: #3566b8;
  --xag-c-line-soft: #2b55a3;
  --xag-c-line-strong: #9fbdf0;
  --xag-c-ok-line: #4ade80;
  --xag-c-warn-line: #fcd34d;
  --xag-c-bad-line: #f87171;
  --xag-c-teal-line: #7fd0ff;
  --xag-c-purple-line: #c4b5fd;
  --xag-c-accent: #ffb000;
  --xag-c-on-accent: #1a1100;
  --xag-c-inverse: #071433;
  --xag-c-on-inverse: #ffffff;
  --xag-c-gold: #ffb000;
  --xag-c-solid-teal: #1d6b8a;
  --xag-c-solid-ok: #1b7f43;
  --xag-c-solid-bad: #d92d20;
  --xag-c-solid-warn: #e0831f;
  --xag-c-solid-purple: #7c3aed;
  --xag-c-solid-pink: #c2398f;
  --xag-c-solid-cyan: #0aa5a8;
  --xag-c-on-solid: #ffffff;
  --xag-c-white: #ffffff;
  --xag-c-black: #000000;
  --xag-c-on-bright: #0b1c2d;
  --xag-c-scrim: rgba(7, 20, 51, 0.72);
  --xag-c-seal-1: #ffe08a;
  --xag-c-seal-2: #ffb000;
  --xag-c-seal-3: #e08a00;
  --xag-c-surface: rgba(16,48,107, var(--gl-a, 1));
  --xag-c-surface-2: rgba(11,31,77, var(--gl-a, 1));
  --xag-c-surface-3: rgba(20,50,112, var(--gl-a, 1));
  --xag-c-accent-bg: rgba(20,58,127, var(--gl-a, 1));
  --xag-c-ok-bg: rgba(15,74,44, var(--gl-a, 1));
  --xag-c-warn-bg: rgba(91,58,5, var(--gl-a, 1));
  --xag-c-bad-bg: rgba(110,29,29, var(--gl-a, 1));
  --xag-c-purple-bg: rgba(59,42,107, var(--gl-a, 1));
  --xag-c-shadow-sm: 0 2px 8px rgba(3, 10, 30, .45);
  --xag-c-shadow: 0 10px 30px rgba(3, 10, 30, .45);
}
html[data-theme="brite"] {
  --xag-c-bg: #012456;
  --xag-c-surface: #01306e;
  --xag-c-surface-2: #012a5e;
  --xag-c-surface-3: #023d8a;
  --xag-c-accent-bg: #023d8a;
  --xag-c-ok-bg: #05431f;
  --xag-c-warn-bg: #4a3300;
  --xag-c-bad-bg: #3a4400;
  --xag-c-purple-bg: #2a2a7a;
  --xag-c-text: #ffffff;
  --xag-c-text-2: #6dff9e;
  --xag-c-text-3: #55e888;
  --xag-c-accent-text: #00e5ff;
  --xag-c-teal-text: #00e5ff;
  --xag-c-ok-text: #39ff88;
  --xag-c-warn-text: #fde68a;
  --xag-c-bad-text: #d4ff00;
  --xag-c-purple-text: #c9c9ff;
  --xag-c-line: #0aa0d8;
  --xag-c-line-soft: #0b7fb4;
  --xag-c-line-strong: #00e5ff;
  --xag-c-ok-line: #39ff88;
  --xag-c-warn-line: #fcd34d;
  --xag-c-bad-line: #d4ff00;
  --xag-c-teal-line: #00e5ff;
  --xag-c-purple-line: #a5a5ff;
  --xag-c-accent: #ffb000;
  --xag-c-on-accent: #1a1100;
  --xag-c-inverse: #001a40;
  --xag-c-on-inverse: #ffffff;
  --xag-c-gold: #39ff88;
  --xag-c-solid-teal: #00e5ff;
  --xag-c-solid-ok: #39ff88;
  --xag-c-solid-bad: #d4ff00;
  --xag-c-solid-warn: #39ff88;
  --xag-c-solid-purple: #a5a5ff;
  --xag-c-solid-pink: #ff9ad5;
  --xag-c-solid-cyan: #00e5ff;
  --xag-c-on-solid: #012456;
  --xag-c-white: #ffffff;
  --xag-c-black: #000000;
  --xag-c-on-bright: #0b1c2d;
  --xag-c-on-yellow: #111111;
  --xag-c-scrim: rgba(7, 20, 51, 0.72);
  --xag-c-seal-1: #ffe08a;
  --xag-c-seal-2: #ffb000;
  --xag-c-seal-3: #e08a00;
  --xag-c-shadow-sm: 0 2px 8px rgba(0, 10, 32, .5);
  --xag-c-shadow: 0 10px 30px rgba(0, 10, 32, .5);
}


/* Calibri everywhere except code and drawings. !important so the older per-class Baskerville / Manrope / Inter rules give way; zero specificity inside :where. */
html body, html body :where(*:not(code, pre, kbd, samp, tt, svg, svg *, canvas, .mono, [class*="mono"])) { font-family: var(--xag-font-body) !important; }
html body { font-size: var(--xag-fs-body); }
html:not([lang="th"]) body { line-height: var(--xag-lh-body); }
:where(code, pre, kbd, samp) { font-family: ui-monospace, Consolas, Menlo, monospace; }
/* Section headings: bright yellow (dark themes) or dark amber (light), bold, 21px, with a small dot unless the heading already starts with an icon.
   Page titles (h1, .page-title, gold banner headings) are NOT touched and stay as they are. :not(#xag) lifts the specificity above the page's own #id rules without !important, so fit-line.js can still shrink a heading. */
html body :is(h2, .ia-h2, .ds-cat-title, .ds-more-title):not(#xag, .page-title, .xag-gold-heading, .xl-head, .xl-title, .xag-no-sec, :is(header, footer, nav, .site-header, .xag-no-sec) *) {
  color: var(--xag-h-sec) !important; font-size: var(--xag-h-sec-size); font-weight: 700 !important; line-height: 1.3;
}
html body :is(h3, h4, .tt-title, .tt-h, .xcs-h):not(#xag, .xag-no-sec, :is(header, footer, nav, .site-header, .xag-no-sec) *) {
  color: var(--xag-h-sub) !important; font-size: var(--xag-h-sub-size); font-weight: 700 !important; line-height: 1.3;
}
html body :is(h2, .ia-h2, .ds-cat-title, .ds-more-title):not(#xag, .page-title, .xag-gold-heading, .xl-head, .xl-title, .xag-no-sec, .xh-ic, :is(header, footer, nav, .site-header, .xag-no-sec) *, :has(> svg:first-child, > img:first-child))::before,
html body :is(h3, h4, .tt-title, .tt-h, .xcs-h):not(#xag, .xag-no-sec, .xh-ic, :is(header, footer, nav, .site-header, .xag-no-sec) *, :has(> svg:first-child, > img:first-child))::before {
  content: ""; display: inline-block; width: .42em; height: .42em; margin-inline-end: .5em; border-radius: 50%; vertical-align: .12em; background: var(--xag-h-sub-dot, var(--xag-h-dot));
}
html body :is(h2, .ia-h2, .ds-cat-title, .ds-more-title):not(#xag, .xh-ic)::before { --xag-h-sub-dot: var(--xag-h-sec); }
:where(button, input, select, textarea) { font-family: inherit; }
/* a two-line paragraph or list item is balanced, so its second line is never a lone word or two (longer paragraphs fall back to normal wrapping) */
html body :is(p, li, dd, blockquote):not(#xag) { text-wrap: balance; }
:where(h1, h2, h3, h4, h5, h6, label, summary, figcaption, th, td, li, dt, dd, button, .pills, [class*="badge"], [class*="chip"], [class*="pill"], [class*="title"], [class*="note"], [class*="hint"], [class*="desc"]:not(textarea), .btn) { text-wrap: balance; }
:where(p, blockquote) { text-wrap: pretty; }
.xp-news-c { font-size: clamp(13px, 3.4vw, 14px); line-height: 1.35; }
.slot-wrap { overflow-x: auto; max-width: 100%; }
.slot-table th, .slot-table td { white-space: nowrap; }
.ai-note { font-size: .85em; opacity: .85; margin: .4rem 0; }
/* one-line fits for rows that otherwise leave a lone chip or cell word on a second line */
@media (max-width: 640px) {
  .pills { flex-wrap: nowrap; overflow-x: auto; gap: 4px; scrollbar-width: none; }
  .pills > .pill { flex: 0 0 auto; font-size: .7rem; padding: .1rem .45rem; }
  .sp-cmp-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .sp-cmp th, .sp-cmp td { white-space: nowrap; }
}
/* contrast: buttons and links that inherited a colour from the theme reset */
html[data-theme] .sp-btn.alt { color: var(--link, #1d4ed8); }
html[data-theme="light"] :where(.sp-badge) { color: #8a5200; border-color: #8a5200; }
html[data-theme="light"] a:where(.mk-back, [href*="/marketplace/terms"], [href*="seller-agreement"], [href*="/marketplace/takedown"]) { color: #1d4ed8; }
html:not([data-theme="light"]) a:where([href*="/marketplace/takedown"]) { color: #9fd8ff; }
/* the floating chat button must never cover the last footer links */
footer { padding-bottom: max(4.5rem, env(safe-area-inset-bottom)); }
body:not([data-page=admin]):not([data-page=classroom]) { padding-bottom: max(4.5rem, env(safe-area-inset-bottom)); }
/* short classed paragraphs (notes, leads, intros, card text) break evenly; body paragraphs keep text-wrap: pretty */
:where(p[class]) { text-wrap: balance; }
.nb { white-space: nowrap; }

/* ==== TIDY A: one look for yellow boxes, dialogs, button rows and close buttons (owner order 2026-11-02) ====
   1) Yellow boxes: every text inside a yellow-filled component is near-black (--xag-c-on-yellow, #111), headings included, in every theme.
      The section-heading rule above paints h2 yellow in the dark themes: that gave a yellow heading on the yellow welcome pop-up. Add a new yellow
      component to YELLOW_BOXES below (or give it the class xag-yellow); never colour its text yourself. */
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout, .xag-yellow):not(#xag) { --xag-n: var(--xag-c-on-yellow); color: var(--xag-c-on-yellow); }
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout, .xag-yellow) :is(h1, h2, h3, h4, h5, h6, p, li, span, label, small, strong, em, a, div, ol, ul):not(#xag) { color: var(--xag-c-on-yellow) !important; }
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout, .xag-yellow) :is(h1, h2, h3, h4, h5, h6):not(#xag)::before { background: var(--xag-c-on-yellow) !important; }
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout, .xag-yellow) :is(h2, h3):not(#xag) { font-size: 1.2rem; }
/* 2) Button rows: the buttons of one box sit next to each other on ONE row (the third, "Don't show again", used to drop below the row). They wrap only
      when the box is too narrow. The row and the links block stay separate in the markup (vendored module); the box becomes a wrapping flex line. */
html body :is(.xag-ob-tour, .xag-ob-howto):not(#xag) { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; column-gap: .5rem; }
html body :is(.xag-ob-tour, .xag-ob-howto):not(#xag) > * { flex: 0 0 100%; min-width: 0; }
html body :is(.xag-ob-tour, .xag-ob-howto):not(#xag) > :is(.xag-ob-tour-row, .xag-ob-links, .xag-ob-got) { flex: 0 1 auto; margin: .3rem 0 .15rem; }
html body :is(.xag-ob-tour, .xag-ob-howto):not(#xag) > .xag-ob-tour-row { flex-wrap: nowrap; }
html body :is(.xag-ob-tour, .xag-ob-howto):not(#xag) > .xag-ob-links { flex-wrap: nowrap; }
html body :is(.xag-ob-tour, .xag-ob-howto):not(#xag) > :is(.xag-ob-star, .xag-ob-arrow) { flex: 0 0 auto; }
html body .xag-ob-welcome :is(.xag-ob-tour-row, .xag-ob-links) button { white-space: nowrap; }
@media (max-width: 480px) {
  html body :is(.xag-ob-welcome, .xag-ob-tour):not(#xag) > :is(.xag-ob-tour-row, .xag-ob-links) { flex-wrap: wrap; justify-content: center; }
}
/* any other box or dialog with a row of buttons: same rule, one row, wrapping only when narrow */
.xag-btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
/* 3) ONE close button for every dialog and pop-out: a circle with a clear X, same size and ring everywhere. The X is drawn by the style (the old text
      glyph is hidden), the ring and fill follow the button's own text colour, so it reads on white, navy and Brite panels alike. */
:root { --xag-close-size: 44px; --xag-text-shadow: 0 1px 2px rgba(5, 15, 60, 0.6), 0 2px 12px rgba(5, 15, 60, 0.45); --xag-ban-1: 40px; --xag-ban-2: 22px; --xag-ban-3: 16px; }
@media (max-width: 640px) { :root { --xag-ban-1: 28px; --xag-ban-2: 18px; --xag-ban-3: 14px; } }
html body :is(.modal-close, .xt-x, .xn-x, .xp-x, .mk-x, .xcg-x, .xag-as-x, .xag-close, .xag-ob-howto-skip, .xag-ob-tour-skip):not(#xag) {
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--xag-close-size); height: var(--xag-close-size); min-width: var(--xag-close-size); min-height: var(--xag-close-size); padding: 0; margin: 0;
  border: 2px solid currentColor; border-radius: 50%;
  background: color-mix(in srgb, currentColor 10%, transparent); font-size: 0 !important; line-height: 0; cursor: pointer; position: absolute; top: .5rem; right: .5rem;
}
html body :is(.modal-close, .xt-x, .xn-x, .xp-x, .mk-x, .xcg-x, .xag-as-x, .xag-close, .xag-ob-howto-skip, .xag-ob-tour-skip):not(#xag)::before {
  content: ""; display: block; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 3l10 10M13 3L3 13'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M3 3l10 10M13 3L3 13'/%3E%3C/svg%3E") center / contain no-repeat;
}
html body :is(.modal-close, .xt-x, .xn-x, .xp-x, .mk-x, .xcg-x, .xag-as-x, .xag-close, .xag-ob-howto-skip, .xag-ob-tour-skip):not(#xag):is(:hover, :focus-visible) { background: color-mix(in srgb, currentColor 22%, transparent); }
html body :is(.modal-close, .xt-x, .xn-x, .xp-x, .mk-x, .xcg-x, .xag-as-x, .xag-close, .xag-ob-howto-skip, .xag-ob-tour-skip):not(#xag):focus-visible { outline: 3px solid currentColor; outline-offset: 2px; }
/* OWNER 2026-11-08: the close X of the sign-in pop-up (and every .modal-close) is WHITE: a blue disc with a white X, readable on Light, Glassy and Brite (no dark ink on a dark panel). */
html body .modal-close:not(#xag):not(#xag2):not(#xag3) { background: rgb(26, 61, 129) !important; color: rgb(255, 255, 255) !important; border-color: rgb(255, 255, 255) !important; }
html body .modal-close:not(#xag):not(#xag2):not(#xag3):is(:hover, :focus-visible) { background: rgb(40, 84, 170) !important; }
/* POP-UP CORNER (owner 2026-11-04): ONE corner for every pop-up, dialog, tour and banner. The close X is the top-right-most element (44px round, ring and X in the text colour, so AA on any panel including the yellow Welcome box).
   A decorative star or badge sits to the LEFT of the X with a clear gap and never overlaps the X or the title text (the title keeps a right padding for both). scripts/parity-sweep.mjs checks it at 1280 and 390. */
:root { --xag-corner-gap: .5rem; --xag-corner-star: 34px; }
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout) .xag-ob-star { top: var(--xag-corner-gap); right: calc(var(--xag-close-size) + 2 * var(--xag-corner-gap)); width: var(--xag-corner-star); height: var(--xag-corner-star); z-index: 1; }
html body .xag-ob-welcome h2 { padding-right: calc(var(--xag-close-size) + var(--xag-corner-star) + 3 * var(--xag-corner-gap)); min-height: var(--xag-close-size); box-sizing: border-box; }
html body :is(.xag-ob-tour, .xag-ob-howto):has(> :is(.xag-ob-tour-skip, .xag-ob-howto-skip)) > :is(h2, h3, .xag-ob-tour-step) { padding-right: calc(var(--xag-close-size) + var(--xag-corner-star) + 3 * var(--xag-corner-gap)); }
/* the sign-in box has tabs along its top edge: leave room so the close button never sits on them */
html body .modal-box:has(> .modal-close):not(#xag) { padding-top: 3.4rem; }
/* 4) Visible tooltip for icon-only header buttons (data-tip); the text is also the button's accessible name */
.xag-hint { position: relative; }
.xag-hint:is(:hover, :focus-visible)::after {
  content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; z-index: 2147483000; padding: .25rem .6rem; border-radius: 8px; white-space: nowrap; pointer-events: none;
  background: var(--xag-c-inverse); color: var(--xag-c-on-inverse); font: 600 .78rem/1.3 var(--xag-font-body); box-shadow: var(--xag-c-shadow-sm);
}
.xag-hint[aria-expanded="true"]::after { display: none; }

/* ===== GLASS LEVELS (owner 2026-11-03: 10% less glass) =====
   Every glassy surface reads its fill and blur from these two tokens (a card is white at 12% on the navy page, blur 11px); themes.css (--white, --gl-a, --gl-blur) and the
   per-feature stylesheets use them, so the level is changed here only. */
:root { --xag-glass-fill: rgba(255, 255, 255, .12); --xag-glass-blur: blur(11px) saturate(1.15); }

/* ===== MENU THEME (owner 2026-11-03) =====
   ONE look for every menu: main menu, account menu, language and appearance lists, search results, Studio and admin menus.
   Panel fill = --xag-menu-rgb at --xag-menu-alpha (92% opaque on navy, a hint of blur); rows: 44px, a 24px icon column, 12px gap, label in Calibri 600, one hover,
   one active state (gold text), thin dividers, small group headings. The items differ, the theme is the same. */
:root {
  --xag-menu-alpha: .98; --xag-menu-blur: blur(6px); --xag-menu-rgb: 255, 255, 255; --xag-menu-ink: #0b1c2d; --xag-menu-hover: rgba(29, 78, 216, .1);
  --xag-menu-line: rgba(11, 28, 45, .14); --xag-menu-head: #3d4f63; --xag-menu-active: #b45309; --xag-menu-row-h: 44px;
}
html[data-theme="dark"], html[data-theme="glass"] {
  --xag-menu-alpha: .92; --xag-menu-rgb: 16, 48, 107; --xag-menu-ink: #eaf1ff; --xag-menu-hover: rgba(255, 255, 255, .12); --xag-menu-line: rgba(125, 211, 252, .28);
  --xag-menu-head: #fde68a; --xag-menu-active: #fbbf24;
}
html[data-theme="brite"] .site-header,
html[data-theme="brite"] footer,
html[data-theme="brite"] .xag-menu,
html[data-theme="brite"] .xag-admin-menu {
  --xag-menu-alpha: .92; --xag-menu-rgb: 16, 48, 107; --xag-menu-ink: #eaf1ff; --xag-menu-hover: rgba(255, 255, 255, .12); --xag-menu-line: rgba(125, 211, 252, .28);
  --xag-menu-head: #fde68a; --xag-menu-active: #fbbf24;
}
html body :is(.nav-main, .chip-drop, .frame-pop, .search-panel, .xt-menu, .xag-menu, .xag-admin-menu):not(#xag) {
  background: rgba(var(--xag-menu-rgb), var(--xag-menu-alpha)); color: var(--xag-menu-ink); border: 1px solid var(--xag-menu-line);
  -webkit-backdrop-filter: var(--xag-menu-blur); backdrop-filter: var(--xag-menu-blur); box-shadow: 0 12px 32px rgba(3, 10, 30, .4);
}
html body :is(.nav-main a, .nav-main .nav-gh, .chip-drop button, .chip-drop a, .frame-pop button, .frame-pop a.xh-item, .xag-menu a, .xag-menu button, .xag-admin-menu a, .xag-admin-menu button, #xagFeedback .xag-ob-fb button):not(#xag) {
  display: flex; align-items: center; gap: 12px; box-sizing: border-box; width: 100%; min-height: var(--xag-menu-row-h); margin: 0; padding: 0 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--xag-menu-ink); text-align: left; text-decoration: none; cursor: pointer;
  font: 600 .95rem/1.25 var(--xag-font-body); letter-spacing: 0; text-transform: none; text-shadow: none; box-shadow: none; opacity: 1;
}
html body :is(.nav-main a, .nav-main .nav-gh, .chip-drop button, .chip-drop a, .frame-pop button, .frame-pop a.xh-item, .xag-menu a, .xag-menu button, .xag-admin-menu a, .xag-admin-menu button, #xagFeedback .xag-ob-fb button):not(#xag):is(:hover, :focus-visible) {
  background: var(--xag-menu-hover); color: var(--xag-menu-ink);
}
html body :is(.nav-main a, .chip-drop button, .chip-drop a, .frame-pop button, .frame-pop a.xh-item, .xag-menu a, .xag-admin-menu a):not(#xag):is([aria-current], [aria-checked="true"], .active) {
  color: var(--xag-menu-active); background: var(--xag-menu-hover);
}
html body :is(.nav-main, .chip-drop, .frame-pop, .xag-menu, .xag-admin-menu) :is(a, button):not(#xag)::before { content: none; }
html body :is(.nav-main, .chip-drop, .frame-pop) :is(a, button) .xi { color: inherit; }
html body :is(.nav-main, .chip-drop, .frame-pop, #xagFeedback) :is(a, button) span { font: inherit; }
html body :is(.nav-main .nav-divider, .chip-drop hr, .frame-pop hr):not(#xag) { border: 0; border-top: 1px solid var(--xag-menu-line); margin: 4px 0; }
html body :is(.nav-main .nav-gh, .nav-main .nav-apps-h):not(#xag) { font-weight: 700; }
html body :is(.chip-drop, .frame-pop):not(#xag) { padding: 8px; gap: 2px; }
html body #xagFeedback { padding: 0; margin: 0; width: 100%; align-self: stretch; }
html body #xagFeedback .xag-ob-fb { display: flex; flex-direction: column; align-items: stretch; gap: 2px; margin: 0; padding: 0; }
html body #xagFeedback .xag-ob-fb button { justify-content: flex-start; min-width: 0; height: auto; border-radius: 10px; }
html body #xagFeedback .xag-ob-fb button[aria-pressed="true"] { color: var(--xag-menu-active); box-shadow: none; }
html body #xagFeedback .xag-ob-fb button .xi { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
html body #xagFeedback .xag-ob-fbp { margin: 4px 0; max-width: 100%; font-family: var(--xag-font-body); }
html body :is(.chip-drop, .frame-pop) label.xh-viewas { display: flex; align-items: center; gap: 12px; min-height: var(--xag-menu-row-h); padding: 0 12px; font: 600 .95rem/1.25 var(--xag-font-body); color: var(--xag-menu-ink); }
html body :is(.chip-drop, .frame-pop) label.xh-viewas > span { white-space: nowrap; flex: none; }
/* THEMED SELECT in the account menu (owner 2026-11-04): navy glass fill, light text, pill radius, our chevron; the same in every theme and on phone and desktop. */
:root { --xag-select-fill: rgba(16, 48, 107, .92); --xag-select-ink: #eaf1ff; --xag-select-line: rgba(125, 211, 252, .45);
  --xag-select-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23eaf1ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
html body :is(.chip-drop, .frame-pop) label.xh-viewas select:not(#xag) {
  font: inherit; font-size: .9rem; flex: 1 1 auto; min-width: 0; min-height: 40px; appearance: none; -webkit-appearance: none; cursor: pointer;
  padding: 0 36px 0 14px; border-radius: var(--xag-btn-radius); border: 1.5px solid var(--xag-select-line); color: var(--xag-select-ink); color-scheme: dark;
  background: var(--xag-select-fill) var(--xag-select-chev) no-repeat right 10px center / 18px 18px;
}
html body :is(.chip-drop, .frame-pop) label.xh-viewas select:not(#xag) option { background: var(--xag-select-fill); color: var(--xag-select-ink); }

/* Select options on Dark and Glassy (the popup list was drawn grey by the browser): the same navy glass tokens as the themed select above; the fields themselves are covered by FORM FIELDS further down. */
:where(html[data-theme="dark"], html[data-theme="glass"]) :where(select option, select optgroup) { background-color: var(--xag-select-fill); color: var(--xag-select-ink); }
/* the selected language chip in the yellow welcome box: the box's own navy button fill, never the near-black ink */
html body .xag-ob-welcome:not(#xag) .xag-ob-chip[aria-pressed="true"] { background: var(--xag-ybox-btn-fill) !important; color: var(--xag-ybox-btn-ink) !important; border-color: var(--xag-ybox-btn-fill) !important; }
html body :is(.chip-drop, .frame-pop) label.xh-viewas select:not(#xag):focus-visible { outline: 3px solid #fdd835; outline-offset: 2px; }

/* ===== ACCOUNT BUTTON (owner 2026-11-03): a person symbol in the gold ring, never the user's initial (it looked like a close button). The initial stays in the menu header. ===== */
:root { --xag-ic-person: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8z M4 21c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E"); }
html body .site-header .user-chip:not(#xag)::before, html body .user-chip:not(#xag)::before {
  content: ""; display: block; flex: none; width: 24px; height: 24px; background: currentColor;
  -webkit-mask: var(--xag-ic-person) center / contain no-repeat; mask: var(--xag-ic-person) center / contain no-repeat;
}
html body .site-header .user-chip:not(#xag) { font-size: 0 !important; color: #1a1100; }

/* ===== PILL SHAPE FOR ALL BUTTONS (owner 2026-11-03) =====
   Every button and button-like link takes --xag-btn-radius (a pill). Left alone: menu rows (their own 10px row), form fields, table cells, calendar/slot grids, the round close X and other icon circles.
   scripts/pill-sweep.mjs lists any clickable element that is still square. */
html body :is(button, [role="button"], a.btn, .btn, [class*="btn-"]:is(a, button, label), input[type="button"], input[type="submit"], input[type="reset"], summary.btn, .xag-ob-chip, .xag-ob-tour-row button, .xag-ob-howto button, .xag-ob-howto-link):not(
  #xag, .nav-main *, .chip-drop *, .frame-pop *, .xag-menu *, .xag-admin-menu *, #xagFeedback .xag-ob-fb *, td *, th *, [role="gridcell"], [role="tab"], [role="option"], [role="menuitem"], [role="switch"], [role="checkbox"],
  .modal-close, .xt-x, .xn-x, .xp-x, .mk-x, .xcg-x, .xag-as-x, .xag-close, .xag-ob-howto-skip, .xag-ob-tour-skip, .slot, .cal-day, .xag-pill-keep) { border-radius: var(--xag-btn-radius, 999px); }

/* ===== POP-UP CORNER (owner 2026-11-03): the star and the close X never overlap; star sits left of the X in the same row, the party popper left of the star ===== */
html body .xag-ob-welcome:not(#xag) .xag-ob-star { top: .6rem; right: 4rem; }
html body .xag-ob-welcome:not(#xag) h2 { padding-right: 8rem; }
html body .xag-ob-welcome:not(#xag)::before {
  content: ""; position: absolute; top: .65rem; right: 7.1rem; width: 28px; height: 28px; background: currentColor; pointer-events: none;
  -webkit-mask: var(--xag-ic-party) center / contain no-repeat; mask: var(--xag-ic-party) center / contain no-repeat; transform-origin: 20% 90%;
}
@media (prefers-reduced-motion: no-preference) { html body .xag-ob-welcome:not(#xag)::before { animation: xag-party 1.6s ease-in-out 3 .4s; } }
@keyframes xag-party { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-12deg) scale(1.12); } 50% { transform: rotate(8deg) scale(1.06); } 75% { transform: rotate(-6deg) scale(1.1); } }
html body :is(.xag-ob-tour, .xag-ob-howto):not(#xag) .xag-ob-star { right: 3.6rem; }
@media (max-width: 480px) { html body .xag-ob-welcome:not(#xag) h2 { padding-right: 7.5rem; font-size: 1.15rem; } }
:root { --xag-ic-party: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20l4-11 7 7z M12 5l1-2 M16 8l2-1 M17 4v.01 M20 11l2 .5 M14 3v.01'/%3E%3C/svg%3E"); }

/* SALES TABLE tokens (xag-plan.css): paid tier lit purple/gold, free tier calm navy */
:root { --xag-plan-line-c: #a78bfa; --xag-plan-navy: #10306b; --xag-plan-ink: #fff; --xag-plan-gold: #fbbf24; --xag-plan-badge-ink: #1b1300; --xag-plan-light-bg: #fff; --xag-plan-light-ink: #1e1b4b; --xag-plan-light-free-ink: #0b1c2d; }

/* XAG EDUSPEAK (agreed 2026-11-04): hot pink glow. Dark/glass: bright pink on tinted navy glass. Light only: deeper magenta (Brite is a dark theme and keeps the dark pink; Brite never applies to EduSpeak) so the text stays readable (AA, test/eduspeak.test.mjs). */
:root { --xag-eduspeak: #ff2d9b; --xag-eduspeak-text: #ff5db8; --xag-eduspeak-glow: rgba(255, 45, 155, .55); --xag-eduspeak-fill: rgba(11, 28, 45, .78); --xag-eduspeak-sig: #ffc2e3; --xag-eduspeak-pad-y: 9px; --xag-eduspeak-pad-x: 15px; --xag-eduspeak-gap: 5px; --xag-eduspeak-edge: 38px; }
html[data-theme="light"] { --xag-eduspeak: #d6177f; --xag-eduspeak-text: #b10b66; --xag-eduspeak-glow: rgba(214, 23, 127, .38); --xag-eduspeak-fill: rgba(255, 255, 255, .9); --xag-eduspeak-sig: #7a0a47; }

/* HEADER ICONS ARE WHITE, UNCONDITIONALLY (owner 2026-11-05: black menu lines seen on a phone in dark mode).
   Cause: the SPA drew the three menu lines as a white background cut out with a mask. A phone browser's automatic dark mode (Chrome Android "force dark") darkens
   light backgrounds, so those lines went dark on the navy disc; the same browser leaves explicit gradient lines and strokes alone. Rule: the menu lines are three explicit gradient
   bars in the token below (never currentColor, never a mask), the Back arrow and Menu svgs stroke the same token, and the buttons declare color-scheme: dark and forced-color-adjust: none.
   test/header-icons.browser.test.mjs checks every line in light and dark, with phone emulation. */
:root { --xag-header-ico: #fff; --xag-header-disc: #0b1c2d; }
html body .site-header :is(.menu-toggle, #menuToggle.menu-toggle, .xag-back, .xag-trust-shield) { color: var(--xag-header-ico) !important; -webkit-text-fill-color: var(--xag-header-ico); color-scheme: dark; forced-color-adjust: none; }
html body .site-header :is(.menu-toggle, #menuToggle.menu-toggle)::before,
html body .site-header :is(.menu-toggle, #menuToggle.menu-toggle)[aria-expanded="true"]::before {
  content: ""; display: block; flex: none; width: 18px; height: 14px; -webkit-mask: none !important; mask: none !important; background-color: transparent !important;
  background-image: linear-gradient(var(--xag-header-ico), var(--xag-header-ico)), linear-gradient(var(--xag-header-ico), var(--xag-header-ico)), linear-gradient(var(--xag-header-ico), var(--xag-header-ico)) !important;
  background-size: 100% 2px, 100% 2px, 100% 2px !important; background-position: 0 0, 0 50%, 0 100% !important; background-repeat: no-repeat !important; border-radius: 1px;
}
html body .site-header :is(.menu-toggle, #menuToggle.menu-toggle, .xag-back) svg, html body .site-header :is(.menu-toggle, #menuToggle.menu-toggle, .xag-back) svg * { stroke: var(--xag-header-ico) !important; color: var(--xag-header-ico) !important; }
html body .site-header :is(.menu-toggle, #menuToggle.menu-toggle, .xag-back):is(:hover, :focus-visible, :active, [aria-expanded="true"]) { color: var(--xag-header-ico) !important; }

/* NO AUTOMATIC DARK MODE (owner 2026-11-05: the 27 years seal and the white QR turned pale, and the menu lines dark, on a phone). A phone browser's automatic dark mode ("force dark") inverts
   the colours of any page that does not declare its colour scheme. Root level "only light" is the documented opt-out (tested: the same page stays unchanged); the Dark, Glassy and Brite themes
   keep their own root declaration (color-scheme: dark) because they are written dark. One rule here for every page. */
html { color-scheme: only light; }

/* COURSE CATEGORY TOKENS (owner 2026-11-04): one accent colour per course/listing category, 3:1 or better on white and navy (test/cat-accent.test.mjs); the rule that uses them is xag-cards.css "COURSE CARD ACCENT" */
:root {
  --xag-cat-default: #2f8fe0;
  --xag-cat-foundations: #2f8fe0; --xag-cat-communication: #8a66ea; --xag-cat-classroom: #17995a; --xag-cat-safety: #e8506f; --xag-cat-growth: #bb7700;
  --xag-cat-offer: #17995a; --xag-cat-need: #bb7700; --xag-cat-event: #2f8fe0; --xag-cat-exchange: #0e97a5; --xag-cat-partnership: #8a66ea; --xag-cat-project: #d84aa3;
  --cat: var(--xag-cat-default);
  --xag-cat-idle: #7b8794;
  --xag-cat-news: #2f8fe0; --xag-cat-polls: #8a66ea; --xag-cat-access: #bb7700;
}

/* ===== YELLOW BOX STANDARD + POP-UP FORMAT (owner 2026-11-05) =====
   ONE yellow box for every intro, welcome, tutorial, tip, hint and notice: .xag-ybox (also the module classes .xag-ob-welcome / -howto / -tour / -callout and .xag-yellow).
   Fixed tokens --xag-ybox-*: the box is the same in Dark, Glassy, Studio, Light and Brite (the classes are in YBOX in scripts/gen-brite.mjs, so Brite never styles them; every declaration below is !important).
   Layout: coloured icon slot LEFT (INTRO = party popper, tutorial step = number badge, everything else = gold star), text, the box's own buttons and links, round 44px close X top-right (the old corner star is gone: the star is the left icon).
   The icon is a real element .xag-ybox-ico (variant --party / --star / --num), added by onboarding-edu.js (ensureYbox); inline SVG, no emoji font.
   BELOW THE HEADER: pop-ups sit under the sticky header (--xag-header-h, measured by onboarding-edu.js, 64px / 56px default) plus --xag-pop-gap, never under it, on desktop and phone; anchors use scroll-padding-top.
   Z-INDEX SCALE (tokens): banner 2, sticky 200, popup 450 (yellow boxes), header 500, menu 600, modal 9000, toast 9500. Audit: node scripts/popup-sweep.mjs. */
:root {
  --xag-ybox-fill: #fde047; --xag-ybox-border: #0f1b3d; --xag-ybox-ink: #111111; --xag-ybox-radius: 20px; --xag-ybox-pad-y: 1.1rem; --xag-ybox-pad-x: 1.25rem;
  --xag-ybox-shadow: 0 10px 28px rgba(15, 27, 61, .28), 0 2px 6px rgba(15, 27, 61, .18); --xag-ybox-icon: 40px; --xag-ybox-gap: .75rem; --xag-ybox-btn-fill: #0f1b3d; --xag-ybox-btn-ink: #ffffff;
  --xag-ybox-num-fill: #0f1b3d; --xag-ybox-num-ink: #fde047;
  --xag-header-h: 64px; --xag-pop-gap: .5rem;
  --xag-z-banner: 2; --xag-z-sticky: 200; --xag-z-popup: 450; --xag-z-header: 500; --xag-z-menu: 600; --xag-z-modal: 9000; --xag-z-toast: 9500;
  --xag-ybox-ico-party: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M5 36L12 13l15 15z' fill='%23f59e0b' stroke='%230f1b3d' stroke-width='1.8' stroke-linejoin='round'/%3E%3Cpath d='M8.5 26l9.5 9.5M10.4 20.6l12 12' stroke='%23ec4899' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M18 8l1.6-4M26 14l4-2M29 6v.01M33 20l4 1M22 3v.01' stroke='%232563eb' stroke-width='2.6' stroke-linecap='round'/%3E%3Crect x='24' y='7' width='5' height='3' rx='1' transform='rotate(35 26 8)' fill='%2316a34a'/%3E%3Crect x='31' y='13' width='5' height='3' rx='1' transform='rotate(-25 33 14)' fill='%23ec4899'/%3E%3Crect x='14' y='3' width='5' height='3' rx='1' transform='rotate(60 16 4)' fill='%2316a34a'/%3E%3Ccircle cx='35' cy='26' r='2' fill='%232563eb'/%3E%3Ccircle cx='20' cy='11' r='1.8' fill='%23ec4899'/%3E%3C/svg%3E");
  --xag-ybox-ico-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 3.5l4.9 10.4 11.3 1.4-8.3 7.8 2.2 11.2L20 28.7 9.9 34.3l2.2-11.2-8.3-7.8 11.3-1.4z' fill='%23f5b800' stroke='%230f1b3d' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M20 9l2.6 5.7' stroke='%23fff3b0' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
@media (max-width: 560px) { :root { --xag-header-h: 56px; } }
html { scroll-padding-top: calc(var(--xag-header-h) + var(--xag-pop-gap) + 8px); }
:target { scroll-margin-top: calc(var(--xag-header-h) + var(--xag-pop-gap) + 8px); }

/* the box: fill, border, ink, radius, padding, shadow */
html body :is(.xag-ybox, .xag-yellow, .xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout):not(#xag) {
  --xag-y: var(--xag-ybox-fill) !important; --xag-n: var(--xag-ybox-ink) !important; box-sizing: border-box;
  background: var(--xag-ybox-fill) !important; background-image: none !important; color: var(--xag-ybox-ink) !important; border: 2px solid var(--xag-ybox-border) !important;
  border-radius: var(--xag-ybox-radius) !important; padding: var(--xag-ybox-pad-y) var(--xag-ybox-pad-x) .6rem !important; box-shadow: var(--xag-ybox-shadow) !important;
  -webkit-backdrop-filter: none !important; backdrop-filter: none !important; filter: none !important; text-shadow: none !important;
}
html body :is(.xag-ybox, .xag-yellow):not(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout):not(#xag) { position: relative; }
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout, .xag-ybox, .xag-yellow):not(#xag) :is(h1, h2, h3, h4, p, li, span, label, small, strong, em, a, div):not(.xag-ybox-ico) { color: var(--xag-ybox-ink) !important; text-shadow: none !important; }
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout, .xag-ybox, .xag-yellow):not(#xag) :is(h1, h2, h3):not(#xag)::before { display: none !important; }
html body :is(.xag-ob-welcome .xag-ob-w-go, .xag-ob-tour .xag-ob-tour-next, .xag-ob-howto .xag-ob-got, .xag-ob-callout .xag-ob-got):not(#xag) { background: var(--xag-ybox-btn-fill) !important; color: var(--xag-ybox-btn-ink) !important; border-color: var(--xag-ybox-btn-fill) !important; }
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout, .xag-ybox, .xag-yellow):not(#xag) > :is(.xag-close, .xag-ob-wx, .xag-ob-howto-skip, .xag-ob-tour-skip) { top: var(--xag-corner-gap); right: var(--xag-corner-gap); color: var(--xag-ybox-ink) !important; z-index: 2; }
/* the old corner star and the old right-hand party popper are replaced by the left icon slot */
html body :is(.xag-ob-welcome, .xag-ob-tour, .xag-ob-howto, .xag-ob-callout) .xag-ob-star { display: none !important; }
html body .xag-ob-welcome:not(#xag)::before { content: none !important; animation: none !important; }
/* icon slot (left, coloured, never themed) */
html body .xag-ybox-ico {
  position: absolute; top: var(--xag-ybox-pad-y); left: var(--xag-ybox-pad-x); z-index: 1; box-sizing: border-box; display: flex; align-items: center; justify-content: center; flex: none; pointer-events: none;
  width: var(--xag-ybox-icon); height: var(--xag-ybox-icon); background: center / contain no-repeat; font: 800 1.15rem/1 var(--xag-font-body, Calibri, sans-serif);
}
html body .xag-ob-welcome:not(#xag) > .xag-ybox-ico { grid-column: auto !important; grid-row: auto !important; }   /* an abs-positioned grid child with a column takes the content edge as its corner */
html body .xag-ybox-ico--party { background-image: var(--xag-ybox-ico-party); }
html body .xag-ybox-ico--star { background-image: var(--xag-ybox-ico-star); }
html body .xag-ybox-ico.xag-ybox-ico--num:not(#xag) { border-radius: 50%; background: var(--xag-ybox-num-fill); border: 2px solid var(--xag-ybox-border); color: var(--xag-ybox-num-ink) !important; }
html body .xag-ob-tour:not(#xag) > .xag-ob-tour-step { border: 0 !important; background: none !important; box-shadow: none !important; border-radius: 0; }
@media (prefers-reduced-motion: no-preference) { html body .xag-ybox-ico--party { animation: xag-party 1.6s ease-in-out 3 .4s; transform-origin: 20% 90%; } }
/* text beside the icon: the first heading, the tour step row, or the first paragraph of a heading-less tip */
html body :is(.xag-ob-welcome, .xag-ob-howto, .xag-ybox, .xag-yellow):not(.xag-ob-tour):not(#xag) > :is(h1, h2, h3) { padding-left: calc(var(--xag-ybox-icon) + var(--xag-ybox-gap)) !important; padding-right: calc(var(--xag-close-size) + var(--xag-corner-gap)) !important; min-height: var(--xag-ybox-icon); box-sizing: border-box; display: flex; align-items: center; margin-top: 0; }
html body .xag-ob-tour:not(#xag) > .xag-ob-tour-step { padding-left: calc(var(--xag-ybox-icon) + var(--xag-ybox-gap)) !important; padding-right: calc(var(--xag-close-size) + var(--xag-corner-gap)) !important; min-height: var(--xag-ybox-icon); }
html body .xag-ob-callout:not(#xag):not(:has(h2, h3)) > p:first-of-type { padding-left: calc(var(--xag-ybox-icon) + var(--xag-ybox-gap)); padding-right: calc(var(--xag-close-size) + var(--xag-corner-gap)); min-height: var(--xag-ybox-icon); display: flex; align-items: center; box-sizing: border-box; }
/* below the header: the welcome box was centred with a transform that its entrance animation cancelled (it dropped off the bottom and, in short windows, under the header). Now centred in the free area UNDER the header. */
html body .xag-ob-welcome:not(#xag) {
  position: fixed !important; z-index: var(--xag-z-popup) !important; transform: none !important; inset: calc(var(--xag-header-h) + var(--xag-pop-gap)) 0 var(--xag-pop-gap) 0 !important; margin: auto !important; height: fit-content !important;
  width: min(30rem, calc(100vw - 16px)) !important; max-height: calc(100dvh - var(--xag-header-h) - 2 * var(--xag-pop-gap)) !important; overflow: auto;
}
@media (max-width: 480px) { html body .xag-ob-welcome:not(#xag) { inset: auto 8px var(--xag-pop-gap) 8px !important; width: auto !important; margin: 0 !important; } }
html body :is(.xag-ob-tour, .xag-ob-callout):not(#xag) { z-index: var(--xag-z-popup) !important; max-width: min(30rem, calc(100vw - 16px)); }
/* EduSpeak keeps clear of the yellow box on phones (the box is a bottom sheet there) */
@media (max-width: 640px) { body:has(.xag-ob-welcome) .xes { visibility: hidden; } }

/* FORM FIELDS (owner 2026-11-05: no black or neutral grey surfaces): a text field, select or textarea without its own styling took the browser's dark-scheme grey (#3b3b3b). Zero specificity (:where), so any page or component that styles its fields keeps its look; the default is the theme's surface and text colours. */
:where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"], [type="hidden"]), select, textarea) { background-color: var(--xag-c-surface-2); color: var(--xag-c-text); border-color: var(--xag-c-line); }

/* GLOW STANDARD (owner 2026-11-05): ONE factor for every category glow. Value = the old glow x 1.15 (menu icons 55% / 85%, tile edge 55%, tile shadow 75%).
   Used by the main-menu icons (xag-menu.css) and the policy points tiles on hover, focus and active (xag-points.css). Change the factor once to change all. */
:root { --xag-glow-strength: 1.15; --xag-glow-icon: calc(55% * var(--xag-glow-strength)); --xag-glow-icon-hi: calc(85% * var(--xag-glow-strength)); --xag-glow-tile-edge: calc(55% * var(--xag-glow-strength)); --xag-glow-tile: calc(75% * var(--xag-glow-strength)); }

/* header band is always the full page width (audit 2026-11-06): a page-local header{max-width} rule or the default 8px body margin made it narrower (/profile-link/, /reference/, /connect/, /teacher-voice/) */
:where(body) { margin: 0; }
html body .site-header:not(#xag) { max-width: none; margin-inline: 0; }
