@font-face {
  font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('fonts/plus-jakarta-sans-vietnamese.woff2') format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('fonts/plus-jakarta-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 200 800; font-display: swap;
  src: url('fonts/plus-jakarta-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ════════════════════════════════════════════════════════
   TOKENS — light is the base; dark redefines tokens only.
   Brand palette (icons/BRAND.md): Dill, Skewer, Brine, Smoke, Light wood.
   Every text token is checked against every surface it sits on —
   lowest pair is 4.67:1 light, 4.76:1 dark (WCAG AA normal text).
   Dark mode is deliberately neutral and softer: warm greys, not
   green-tinted, and no near-white text.
   ink4 is decorative only — never used for text.
   ════════════════════════════════════════════════════════ */
:root {
  color-scheme: light;
  --ground:      #F4EBD9;
  --surface:     #FFFCF6;
  --qr-ink:      #1E2A1A;   /* QR codes stay dark on light in every theme: scanners need it */
  --qr-ground:   #FFFCF6;
  --raised:      #F0E7D4;
  --sunken:      #EAE0CB;
  --border:      #DED2BA;
  --border-firm: #C8B99C;

  --ink:         #1E2A1A;   /* Smoke — 14.6:1 on surface */
  --ink2:        #434E3E;   /*  8.6:1 */
  --ink3:        #5C6455;   /*  4.7:1 even on --sunken */
  --ink4:        #ABA48F;   /*  decorative only — never text */

  --accent:      #2F6A2C;   /* Dill — 6.4:1 on surface; white on it 6.5:1 */
  --accent-hi:   #275A25;
  --accent-soft: #E4ECD8;
  --accent-line: #B5CBA6;
  --on-accent:   #FFFFFF;

  --ball:        #D69A55;
  --on-ball:     #1E2A1A;

  --good:        #2F6A2C;
  --good-soft:   #E4ECD8;
  --warn:        #7A5A10;
  --warn-soft:   #FAF0D9;
  --warn-line:   #DEC88A;
  --bad:         #8E3324;
  --bad-soft:    #F8EAE4;

  --hdr-bg:      #1E2A1A;
  --hdr-ink:     #F4EBD9;
  --hdr-ink2:    #BDB6A1;   /*  7.4:1 on hdr-bg (Smoke) */
  --hdr-line:    #36432F;
  --hdr-hover:   #2A3825;

  /* Division colours: Dill, Skewer, blue — ≥4.6:1 on surface, soft, raised, sunken */
  --div1: #2F6A2C; --div1-soft: #E4ECD8;
  --div2: #8A561C; --div2-soft: #F6E9D8;
  --div3: #2D5B98; --div3-soft: #E4EBF6;
  /* Avatar art (pickMark): dill, sage, mint, fern, skewer, light wood, butter
     and clay as a ground tint and a shape tint. Initials in --av-ink ≥7.8:1. */
  --av-ink: var(--ink);
  --av0: #E2E8DA; --av0-hi: #ACC2A5;
  --av1: #EBEEE1; --av1-hi: #C5D5B9;
  --av2: #E9EFE5; --av2-hi: #BFD7C4;
  --av3: #E6ECDC; --av3-hi: #B8CEAB;
  --av4: #F4E9DB; --av4-hi: #DFC6A9;
  --av5: #F9EEDF; --av5-hi: #EFD5B6;
  --av6: #F7EFDC; --av6-hi: #E9D8AB;
  --av7: #F3E5DC; --av7-hi: #DBBBAB;

  /* Podium medals. Rank numbers on them are large bold text (≥3:1). */
  --gold:   #D4A72C;
  --silver: #B9BCB4;
  --bronze: #B9814A;
  --on-medal: #1E2A1A;

  --r:    10px;
  --rs:   7px;
  --rlg:  14px;
  --rxs:  5px;    /* small inline controls: tap-to-edit names and scores, ▲▼ */
  --sh:   0 1px 2px rgba(20,30,24,.07), 0 2px 6px rgba(20,30,24,.05);
  --shm:  0 4px 18px rgba(20,30,24,.10), 0 1px 4px rgba(20,30,24,.06);
  /* Focus: a surface band inside an accent band, so one of them is ≥3:1 on any ground, the dark header included.
     Themes change --accent, never --ring. */
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);

  /* One family, self-hosted (public/fonts, OFL). Variable 200–800, so every
     weight used here renders exactly. --fd marks display roles (names,
     scores, headings), --fu running UI text; same face, kept as two
     tokens so roles stay greppable. */
  --fd:   'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --fu:   'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --tr:   150ms cubic-bezier(.4,0,.2,1);
}

@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  color-scheme: dark;
  --ground:      #161715;
  --surface:     #1F201E;
  --qr-ink:      #1E2A1A;   /* QR codes stay dark on light in every theme: scanners need it */
  --qr-ground:   #FFFCF6;
  --raised:      #272826;
  --sunken:      #1A1B19;
  --border:      #323330;
  --border-firm: #42433F;

  --ink:         #D2CCC0;   /* warm grey — 10.2:1 on surface */
  --ink2:        #B5AFA3;   /*  7.5:1 */
  --ink3:        #9A958A;   /*  5.0:1 even on --raised */
  --ink4:        #575851;

  --accent:      #86AE81;   /*  muted Dill — 6.5:1 on surface */
  --accent-hi:   #97BB92;
  --accent-soft: #252D23;
  --accent-line: #3E4C3B;
  --on-accent:   #141A13;

  --ball:        #C99A64;
  --on-ball:     #1E1C18;

  --good:        #86AE81;
  --good-soft:   #232B21;
  --warn:        #CDAE62;
  --warn-soft:   #29261C;
  --warn-line:   #4A4330;
  --bad:         #D99484;
  --bad-soft:    #2E2321;

  --hdr-bg:      #141513;
  --hdr-ink:     #D2CCC0;
  --hdr-ink2:    #A39E92;
  --hdr-line:    #2C2D2A;
  --hdr-hover:   #222320;

  --div1: #86AE81; --div1-soft: #252D23;   /* ≥5.6:1 */
  --div2: #CFA170; --div2-soft: #2E2720;
  --div3: #8EA9CF; --div3-soft: #222730;
  /* Avatar art: muted pastel discs on dark (a little dimmer than the names
     beside them, 8:1 on the surface), so initials switch to dark ink (≥4.8:1) */
  --av-ink: #1E2A1A;
  --av0: #AAAC97; --av0-hi: #859876;
  --av1: #B3B39E; --av1-hi: #9EAB8A;
  --av2: #B1B4A2; --av2-hi: #98AE96;
  --av3: #AEB199; --av3-hi: #91A57C;
  --av4: #BCAE98; --av4-hi: #B89D7A;
  --av5: #C1B39C; --av5-hi: #C8AB87;
  --av6: #C0B499; --av6-hi: #C2AF7C;
  --av7: #BBAA99; --av7-hi: #B4927C;

  --gold:   #C9A043;
  --silver: #A8AAA3;
  --bronze: #B07A45;
  --on-medal: #1E1C18;

  --sh:   0 1px 2px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.28);
  --shm:  0 4px 18px rgba(0,0,0,.5), 0 1px 4px rgba(0,0,0,.35);
}}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ground:      #161715;
  --surface:     #1F201E;
  --qr-ink:      #1E2A1A;   /* QR codes stay dark on light in every theme: scanners need it */
  --qr-ground:   #FFFCF6;
  --raised:      #272826;
  --sunken:      #1A1B19;
  --border:      #323330;
  --border-firm: #42433F;

  --ink:         #D2CCC0;
  --ink2:        #B5AFA3;
  --ink3:        #9A958A;
  --ink4:        #575851;

  --accent:      #86AE81;
  --accent-hi:   #97BB92;
  --accent-soft: #252D23;
  --accent-line: #3E4C3B;
  --on-accent:   #141A13;

  --ball:        #C99A64;
  --on-ball:     #1E1C18;

  --good:        #86AE81;
  --good-soft:   #232B21;
  --warn:        #CDAE62;
  --warn-soft:   #29261C;
  --warn-line:   #4A4330;
  --bad:         #D99484;
  --bad-soft:    #2E2321;

  --hdr-bg:      #141513;
  --hdr-ink:     #D2CCC0;
  --hdr-ink2:    #A39E92;
  --hdr-line:    #2C2D2A;
  --hdr-hover:   #222320;

  --div1: #86AE81; --div1-soft: #252D23;   /* ≥5.6:1 */
  --div2: #CFA170; --div2-soft: #2E2720;
  --div3: #8EA9CF; --div3-soft: #222730;
  /* Avatar art: muted pastel discs on dark (a little dimmer than the names
     beside them, 8:1 on the surface), so initials switch to dark ink (≥4.8:1) */
  --av-ink: #1E2A1A;
  --av0: #AAAC97; --av0-hi: #859876;
  --av1: #B3B39E; --av1-hi: #9EAB8A;
  --av2: #B1B4A2; --av2-hi: #98AE96;
  --av3: #AEB199; --av3-hi: #91A57C;
  --av4: #BCAE98; --av4-hi: #B89D7A;
  --av5: #C1B39C; --av5-hi: #C8AB87;
  --av6: #C0B499; --av6-hi: #C2AF7C;
  --av7: #BBAA99; --av7-hi: #B4927C;

  --gold:   #C9A043;
  --silver: #A8AAA3;
  --bronze: #B07A45;
  --on-medal: #1E1C18;

  --sh:   0 1px 2px rgba(0,0,0,.4), 0 2px 6px rgba(0,0,0,.28);
  --shm:  0 4px 18px rgba(0,0,0,.5), 0 1px 4px rgba(0,0,0,.35);
}

/* ── Birthday themes (F006) ─────────────────────────────────────
   Each theme is keyed by data-occasion-theme, set on <html> while
   birthday mode is on and on the dialog's swatches, so a swatch
   draws from its own theme. A new theme copies all three blocks
   and registers in BDAY_THEMES (core.js).

   Berry: Berry replaces Dill as the accent and a deep plum takes the header.
   --good stays Dill, so results still read as green. Checked like the
   base tokens: berry ≥5.4:1 on every light surface and 7.1:1 under
   white; dark berry ≥6.7:1 on every dark surface and its soft tint.
   Both dark blocks must hold identical values. */
[data-occasion-theme="berry"] {
  --accent:      #A3255C;
  --accent-hi:   #8C1F4F;
  --accent-soft: #F6E3E9;
  --accent-line: #E3B4C6;
  --on-accent:   #FFFFFF;
  --hdr-bg:      #3B1E2D;   /* hdr-ink 12.6:1, hdr-ink2 7.8:1 */
  --hdr-ink2:    #C9B6BE;
  --hdr-line:    #55304A;
  --hdr-hover:   #4A2639;
  --bday-pop:    #E58BB0;   /* confetti only */
  --bday-sheen:  rgba(255,255,255,.22);   /* decorative highlights, never behind text alone */
  --bday-shine:  rgba(255,255,255,.55);
  --bday-card:   rgba(212,167,44,.45);   /* gold corner on the birthday player's card; ink stays >9:1 over it */
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"])[data-occasion-theme="berry"],
  :root:not([data-theme="light"]) [data-occasion-theme="berry"] {
  --accent:      #E39AB8;
  --accent-hi:   #EBAFC7;
  --accent-soft: #33242B;
  --accent-line: #573A47;
  --on-accent:   #141A13;
  --hdr-bg:      #1E1519;   /* hdr-ink 11.2:1, hdr-ink2 6.6:1 */
  --hdr-ink2:    #A89A9F;
  --hdr-line:    #35262D;
  --hdr-hover:   #2A1D23;
  --bday-pop:    #B65C85;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(201,160,67,.28);
}}
:root[data-theme="dark"][data-occasion-theme="berry"],
:root[data-theme="dark"] [data-occasion-theme="berry"] {
  --accent:      #E39AB8;
  --accent-hi:   #EBAFC7;
  --accent-soft: #33242B;
  --accent-line: #573A47;
  --on-accent:   #141A13;
  --hdr-bg:      #1E1519;   /* hdr-ink 11.2:1, hdr-ink2 6.6:1 */
  --hdr-ink2:    #A89A9F;
  --hdr-line:    #35262D;
  --hdr-hover:   #2A1D23;
  --bday-pop:    #B65C85;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(201,160,67,.28);
}

/* Ocean: a sea blue replaces Dill as the accent and deep navy takes the
   header. Ocean ≥5.3:1 on every light surface and 7.0:1 under white;
   dark ocean ≥6.7:1 on every dark surface and its soft tint. Header
   ink 12.9:1 light, 11.0:1 dark; hdr-ink2 7.9:1 and 7.1:1. */
[data-occasion-theme="ocean"] {
  --accent:      #1D5C96;
  --accent-hi:   #174C7D;
  --accent-soft: #E1ECF6;
  --accent-line: #AECBE6;
  --on-accent:   #FFFFFF;
  --hdr-bg:      #15263B;
  --hdr-ink2:    #AFBCCB;
  --hdr-line:    #27405E;
  --hdr-hover:   #1C3250;
  --bday-pop:    #6FB3E8;   /* confetti only */
  --bday-sheen:  rgba(255,255,255,.22);
  --bday-shine:  rgba(255,255,255,.55);
  --bday-card:   rgba(111,179,232,.40);   /* sky corner on the birthday player's card; ink stays >9:1 over it */
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"])[data-occasion-theme="ocean"],
  :root:not([data-theme="light"]) [data-occasion-theme="ocean"] {
  --accent:      #86B3DE;
  --accent-hi:   #9BC2E6;
  --accent-soft: #1F2933;
  --accent-line: #36495C;
  --on-accent:   #141A13;
  --hdr-bg:      #131A22;
  --hdr-ink2:    #9CA6B0;
  --hdr-line:    #253240;
  --hdr-hover:   #1B2530;
  --bday-pop:    #4E86B8;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(78,134,184,.30);
}}
:root[data-theme="dark"][data-occasion-theme="ocean"],
:root[data-theme="dark"] [data-occasion-theme="ocean"] {
  --accent:      #86B3DE;
  --accent-hi:   #9BC2E6;
  --accent-soft: #1F2933;
  --accent-line: #36495C;
  --on-accent:   #141A13;
  --hdr-bg:      #131A22;
  --hdr-ink2:    #9CA6B0;
  --hdr-line:    #253240;
  --hdr-hover:   #1B2530;
  --bday-pop:    #4E86B8;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(78,134,184,.30);
}

/* Garden: a fresh green a step from Dill, a deep forest header and lime
   confetti. Garden ≥5.3:1 on every light surface and 7.0:1 under white;
   dark garden ≥6.4:1 on every dark surface and its soft tint. Header
   ink 12.0:1 light, 11.0:1 dark; hdr-ink2 7.6:1 and 7.2:1. */
[data-occasion-theme="garden"] {
  --accent:      #266538;
  --accent-hi:   #1F5530;
  --accent-soft: #E0EEDF;
  --accent-line: #A9CDB0;
  --on-accent:   #FFFFFF;
  --hdr-bg:      #173022;
  --hdr-ink2:    #B3C2B5;
  --hdr-line:    #2A4636;
  --hdr-hover:   #203B2B;
  --bday-pop:    #A6CF5E;   /* confetti only */
  --bday-sheen:  rgba(255,255,255,.22);
  --bday-shine:  rgba(255,255,255,.55);
  --bday-card:   rgba(212,167,44,.45);   /* gold corner on the birthday player's card; ink stays >9:1 over it */
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"])[data-occasion-theme="garden"],
  :root:not([data-theme="light"]) [data-occasion-theme="garden"] {
  --accent:      #84B78E;
  --accent-hi:   #97C4A0;
  --accent-soft: #1E2B22;
  --accent-line: #364C3C;
  --on-accent:   #141A13;
  --hdr-bg:      #121B15;
  --hdr-ink2:    #9DA89F;
  --hdr-line:    #23332A;
  --hdr-hover:   #1A271F;
  --bday-pop:    #7F9F48;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(201,160,67,.28);
}}
:root[data-theme="dark"][data-occasion-theme="garden"],
:root[data-theme="dark"] [data-occasion-theme="garden"] {
  --accent:      #84B78E;
  --accent-hi:   #97C4A0;
  --accent-soft: #1E2B22;
  --accent-line: #364C3C;
  --on-accent:   #141A13;
  --hdr-bg:      #121B15;
  --hdr-ink2:    #9DA89F;
  --hdr-line:    #23332A;
  --hdr-hover:   #1A271F;
  --bday-pop:    #7F9F48;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(201,160,67,.28);
}

/* Harvest: pumpkin under a chestnut header, ochre confetti. Pumpkin ≥5.0:1
   on every light surface and its soft tint, 6.5:1 under white; dark pumpkin
   ≥6.7:1 on every dark surface and its soft tint. Header ink 14.1:1 light,
   11.2:1 dark; hdr-ink2 8.2:1 and 6.5:1. Pumpkin sits near --bad in light
   mode, so a loss must also say so in words wherever it shows. */
[data-occasion-theme="harvest"] {
  --accent:      #9A4510;
  --accent-hi:   #82390C;
  --accent-soft: #F6E4D6;
  --accent-line: #E3BC9C;
  --on-accent:   #FFFFFF;
  --hdr-bg:      #2B1A12;
  --hdr-ink2:    #C2B3A6;
  --hdr-line:    #45301F;
  --hdr-hover:   #3A2518;
  --bday-pop:    #E0A030;   /* confetti only */
  --bday-sheen:  rgba(255,255,255,.22);
  --bday-shine:  rgba(255,255,255,.55);
  --bday-card:   rgba(196,90,40,.26);   /* maple corner on the birthday player's card; ink stays >9:1 over it */
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"])[data-occasion-theme="harvest"],
  :root:not([data-theme="light"]) [data-occasion-theme="harvest"] {
  --accent:      #E8A06A;
  --accent-hi:   #EEB385;
  --accent-soft: #33261C;
  --accent-line: #5A3E2A;
  --on-accent:   #141A13;
  --hdr-bg:      #1E1610;
  --hdr-ink2:    #A89A8C;
  --hdr-line:    #33261C;
  --hdr-hover:   #2A1F16;
  --bday-pop:    #B8862E;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(196,90,40,.22);
}}
:root[data-theme="dark"][data-occasion-theme="harvest"],
:root[data-theme="dark"] [data-occasion-theme="harvest"] {
  --accent:      #E8A06A;
  --accent-hi:   #EEB385;
  --accent-soft: #33261C;
  --accent-line: #5A3E2A;
  --on-accent:   #141A13;
  --hdr-bg:      #1E1610;
  --hdr-ink2:    #A89A8C;
  --hdr-line:    #33261C;
  --hdr-hover:   #2A1F16;
  --bday-pop:    #B8862E;
  --bday-sheen:  rgba(255,255,255,.35);
  --bday-shine:  rgba(255,255,255,.45);
  --bday-card:   rgba(196,90,40,.22);
}
