:root { --preferred-kai: "Kaiti SC", "Kaiti TC", "STKaiti", "KaiTi", "\6977\4F53", "KaiTi_GB2312"; }
/* Single palette authority shared by both chart tools. Geometry remains page-specific. */
:root:is([data-skin="antique"],[data-theme="antique"]) {
  color-scheme:light;
  --theme-ink:#403528;
  --theme-muted:#716149;
  --theme-line:#c2ad86;
  --theme-paper:#efe3c9;
  --theme-accent:#755337;
  --theme-back:#d7c8aa;
  --theme-edge:#a18c68;
  --theme-grid:#ac9570;
  --theme-soft:#e3d4b5;
  --theme-field:#f7eedb;
  --theme-button:#68503a;
  --theme-hover:#513d2b;
  --theme-wx-wood-bg:#dce5ce;
  --theme-wx-wood-fg:#365b42;
  --theme-wx-fire-bg:#edd5ce;
  --theme-wx-fire-fg:#963e48;
  --theme-wx-earth-bg:#e7d9b9;
  --theme-wx-earth-fg:#6b542b;
  --theme-wx-metal-bg:#f5f1e5;
  --theme-wx-metal-fg:#655c44;
  --theme-wx-water-bg:#d5e0e8;
  --theme-wx-water-fg:#355c7b;
  --theme-wx-yang-fg:#963e48;
  --theme-wx-yin-fg:#355c7b;
  --theme-board:#efe3c9;
  --theme-palace:#efe3c9;
  --theme-palace-alt:#e3d4b5;
  --theme-palace-head:#e3d4b5;
  --theme-palace-name:#755337;
  --theme-board-ink:#403528;
  --theme-board-muted:#716149;
  --theme-board-rule:#c2ad86;
  --theme-heading:#493725;
  --theme-button-ink:#fffaf0;
  --theme-semantic:#963e48;
  --theme-current-bg:#ead2b8;
  --theme-ground:none;
}
:root:is([data-skin="crimson"],[data-theme="crimson"]) {
  color-scheme:dark;
  --theme-ink:#f7e9da;
  --theme-muted:#d7b6a6;
  --theme-line:#86504b;
  --theme-paper:#56282f;
  --theme-accent:#efd0a0;
  --theme-back:#281719;
  --theme-edge:#b88b62;
  --theme-grid:#b88b62;
  --theme-soft:#69333a;
  --theme-field:#452027;
  --theme-button:#eed6af;
  --theme-hover:#fae7c8;
  --theme-wx-wood-bg:#294e40;
  --theme-wx-wood-fg:#d2ead8;
  --theme-wx-fire-bg:#8b3542;
  --theme-wx-fire-fg:#ffe1db;
  --theme-wx-earth-bg:#6b5134;
  --theme-wx-earth-fg:#f8e4b2;
  --theme-wx-metal-bg:#e7d7b5;
  --theme-wx-metal-fg:#453422;
  --theme-wx-water-bg:#324f64;
  --theme-wx-water-fg:#dbedfa;
  --theme-wx-yang-fg:#ffe2ce;
  --theme-wx-yin-fg:#d5e7ff;
  --theme-board:#73323b;
  --theme-palace:#662b34;
  --theme-palace-alt:#70313a;
  --theme-palace-head:#50242c;
  --theme-palace-name:#f5d7a2;
  --theme-board-ink:#faeee0;
  --theme-board-muted:#e0bdac;
  --theme-board-rule:#a77458;
  --theme-heading:#efd0a0;
  --theme-button-ink:#56282f;
  --theme-semantic:#ffb5a5;
  --theme-current-bg:#8b3542;
  --theme-ground:radial-gradient(ellipse at 50% 0,#583037,transparent 75%);
}
:root:is([data-skin="wood"],[data-theme="wood"]) {
  color-scheme:dark;
  --theme-ink:#e5dcc8;
  --theme-muted:#b9ad95;
  --theme-line:#635640;
  --theme-paper:#29251f;
  --theme-accent:#c3aa76;
  --theme-back:#191713;
  --theme-edge:#756344;
  --theme-grid:#807052;
  --theme-soft:#393227;
  --theme-field:#302b23;
  --theme-button:#b49a65;
  --theme-hover:#c4aa74;
  --theme-wx-wood-bg:#314b40;
  --theme-wx-wood-fg:#bfd6bb;
  --theme-wx-fire-bg:#58343b;
  --theme-wx-fire-fg:#f0c2c7;
  --theme-wx-earth-bg:#504631;
  --theme-wx-earth-fg:#e2cc97;
  --theme-wx-metal-bg:#d9d6ca;
  --theme-wx-metal-fg:#494536;
  --theme-wx-water-bg:#293f52;
  --theme-wx-water-fg:#c0d5e6;
  --theme-wx-yang-fg:#f4bbb3;
  --theme-wx-yin-fg:#b9d7ed;
  --theme-board:#29251f;
  --theme-palace:#29251f;
  --theme-palace-alt:#393227;
  --theme-palace-head:#393227;
  --theme-palace-name:#c3aa76;
  --theme-board-ink:#e5dcc8;
  --theme-board-muted:#b9ad95;
  --theme-board-rule:#635640;
  --theme-heading:#d1b985;
  --theme-button-ink:#251e14;
  --theme-semantic:#ef9c8d;
  --theme-current-bg:#48302b;
  --theme-ground:repeating-linear-gradient(92deg,#ffffff02 0 1px,transparent 1px 13px),linear-gradient(90deg,#171511,#282117 48%,#191612);
}
:root:is([data-skin="song"],[data-theme="song"]) {
  color-scheme:light;
  --theme-ink:#263f40;
  --theme-muted:#526d6c;
  --theme-line:#b4cac5;
  --theme-paper:#fafbf7;
  --theme-accent:#315b59;
  --theme-back:#dce9e5;
  --theme-edge:#91aaa5;
  --theme-grid:#94b2aa;
  --theme-soft:#e5efea;
  --theme-field:#ffffff;
  --theme-button:#375e5b;
  --theme-hover:#264b49;
  --theme-wx-wood-bg:#d8e9de;
  --theme-wx-wood-fg:#244d38;
  --theme-wx-fire-bg:#f3e0db;
  --theme-wx-fire-fg:#843c42;
  --theme-wx-earth-bg:#eae4cc;
  --theme-wx-earth-fg:#60502c;
  --theme-wx-metal-bg:#edf0e9;
  --theme-wx-metal-fg:#4b584f;
  --theme-wx-water-bg:#dcebf0;
  --theme-wx-water-fg:#2e566d;
  --theme-wx-yang-fg:#8c3c38;
  --theme-wx-yin-fg:#315d7a;
  --theme-board:#f6faf6;
  --theme-palace:#f8fbf8;
  --theme-palace-alt:#edf5ef;
  --theme-palace-head:#dcebe4;
  --theme-palace-name:#244d4c;
  --theme-board-ink:#243e3f;
  --theme-board-muted:#516e68;
  --theme-board-rule:#a9c4b9;
  --theme-heading:#315553;
  --theme-button-ink:#fafbf7;
  --theme-semantic:#963f3d;
  --theme-current-bg:#f7e7e1;
  --theme-ground:linear-gradient(120deg,#d9e7e2,#eff4ed 55%,#d8e7e3);
}
:root:is([data-skin="pine"],[data-theme="pine"]) {
  color-scheme:dark;
  --theme-ink:#edf4e9;
  --theme-muted:#bdd1c3;
  --theme-line:#41685a;
  --theme-paper:#163e34;
  --theme-accent:#e3cd93;
  --theme-back:#0c211c;
  --theme-edge:#a49a6c;
  --theme-grid:#a49a6c;
  --theme-soft:#225143;
  --theme-field:#10352d;
  --theme-button:#d9c58d;
  --theme-hover:#eedeb0;
  --theme-wx-wood-bg:#2e6551;
  --theme-wx-wood-fg:#d9f2dc;
  --theme-wx-fire-bg:#6b3d42;
  --theme-wx-fire-fg:#ffe1db;
  --theme-wx-earth-bg:#675b36;
  --theme-wx-earth-fg:#fff0bb;
  --theme-wx-metal-bg:#e1dfc5;
  --theme-wx-metal-fg:#394c3c;
  --theme-wx-water-bg:#235367;
  --theme-wx-water-fg:#d9effb;
  --theme-wx-yang-fg:#ffe1cd;
  --theme-wx-yin-fg:#d7eaff;
  --theme-board:#1c5042;
  --theme-palace:#17483c;
  --theme-palace-alt:#1c5143;
  --theme-palace-head:#10382f;
  --theme-palace-name:#e8d79e;
  --theme-board-ink:#eef5e9;
  --theme-board-muted:#bfd6c7;
  --theme-board-rule:#7e916c;
  --theme-heading:#e3cd93;
  --theme-button-ink:#163e34;
  --theme-semantic:#ffb6a6;
  --theme-current-bg:#6b3d42;
  --theme-ground:radial-gradient(ellipse at 50% 0,#285246,transparent 75%);
}
:root:is([data-skin="indigo"],[data-theme="indigo"]) {
  color-scheme:dark;
  --theme-ink:#EDF1F4;
  --theme-muted:#B6C9DB;
  --theme-line:#607992;
  --theme-paper:#1A304A;
  --theme-accent:#A9C2D6;
  --theme-back:#101E30;
  --theme-edge:#829DB8;
  --theme-grid:#829DB8;
  --theme-soft:#2C4967;
  --theme-field:#14273E;
  --theme-button:#A9C2D6;
  --theme-hover:#C4D6E5;
  --theme-board:#203852;
  --theme-palace:#203852;
  --theme-palace-alt:#243F5C;
  --theme-palace-head:#2C4967;
  --theme-palace-name:#D8E5EF;
  --theme-board-ink:#EDF1F4;
  --theme-board-muted:#B6C9DB;
  --theme-board-rule:#607992;
  --theme-wx-wood-bg:#294C44;
  --theme-wx-wood-fg:#D5EBDE;
  --theme-wx-fire-bg:#663E4A;
  --theme-wx-fire-fg:#FFE0D8;
  --theme-wx-earth-bg:#5C5039;
  --theme-wx-earth-fg:#F3E4BD;
  --theme-wx-metal-bg:#C9D4DE;
  --theme-wx-metal-fg:#26384B;
  --theme-wx-water-bg:#294F70;
  --theme-wx-water-fg:#D7ECFF;
  --theme-wx-yang-fg:#F4B9A6;
  --theme-wx-yin-fg:#BFDDFF;
  --theme-heading:#D8E5EF;
  --theme-button-ink:#14273E;
  --theme-semantic:#F4B9A6;
  --theme-current-bg:#663E4A;
  --theme-ground:none;
}

/* The six-palace application keeps its established variable names. */
:root[data-skin] {
  --ink:var(--theme-ink);
  --muted:var(--theme-muted);
  --line:var(--theme-line);
  --paper:var(--theme-paper);
  --accent:var(--theme-accent);
  --back:var(--theme-back);
  --edge:var(--theme-edge);
  --grid:var(--theme-grid);
  --soft:var(--theme-soft);
  --field:var(--theme-field);
  --button:var(--theme-button);
  --hover:var(--theme-hover);
  --board:var(--theme-board);
  --palace:var(--theme-palace);
  --palace-alt:var(--theme-palace-alt);
  --palace-head:var(--theme-palace-head);
  --palace-name:var(--theme-palace-name);
  --board-ink:var(--theme-board-ink);
  --board-muted:var(--theme-board-muted);
  --board-rule:var(--theme-board-rule);
  --wx-wood-bg:var(--theme-wx-wood-bg);
  --wx-wood-fg:var(--theme-wx-wood-fg);
  --wx-fire-bg:var(--theme-wx-fire-bg);
  --wx-fire-fg:var(--theme-wx-fire-fg);
  --wx-earth-bg:var(--theme-wx-earth-bg);
  --wx-earth-fg:var(--theme-wx-earth-fg);
  --wx-metal-bg:var(--theme-wx-metal-bg);
  --wx-metal-fg:var(--theme-wx-metal-fg);
  --wx-water-bg:var(--theme-wx-water-bg);
  --wx-water-fg:var(--theme-wx-water-fg);
  --wx-yang-fg:var(--theme-wx-yang-fg);
  --wx-yin-fg:var(--theme-wx-yin-fg);
}
