/* Coordinated appearance for the existing Swarm, including its tools. */
:root, :root[data-theme="night"] {
  color-scheme:dark;
  --browser-color:#090a0d; --bg:#090a0d; --ink:#d8dfe9; --muted:#909cab;
  --line:#bbcce024; --ice:#a9cfee; --panel:#101219ee;
  --scene-center:#12151c; --scene-mid:#0c0e13; --scene-edge:#08090c;
  --shade:#090a0dba; --vignette:#05060988;
  --nav:#bdc8d7; --hover-ink:#eef4ff; --focus:#a9cfee;
  --tagline:#7d899b; --hint:#788698; --pill:#10141abb; --pill-ink:#a8b7c9; --zoom:#0d1016a8; --zoom-label:#9aa9bb;
  --panel-border:#afc2db25; --panel-shadow:#0006; --panel-ink:#c5cfdd; --panel-copy:#99a8bb; --eyebrow:#8090a6; --subtle:#8290a5;
  --row-hover:#bcd7ff09; --panel-link:#a5b9d0; --mode-ink:#96a6bb; --selected:#a8beed20; --selected-ink:#d5dff4;
  --action-border:#b4d1f63a; --action:#a9cfee09; --primary:#9ebfef15; --primary-ink:#dae9fa; --action-hover:#bdd5ff18;
  --input:#070a10; --label:#94a5bb; --result:#d7e7f7; --note:#748399;
  --tier:#a8bdde08; --tier-letter:#baafdc; --tier-button:#aabacf;
  --reaction:#122031; --reaction-ink:#a9b8d0; --reaction-ready:#234636; --reaction-ready-ink:#d6f7e7; --reaction-wait:#191b2e;
  --draw-hint:#b1bdd4; --draw-selected:#c6d5ed; --draw-confirm:#cce8f4; --toast:#151b25f0; --toast-ink:#c3d1e4; --story:#cbd5e5;
  --pearl-start:#d7e9f3; --pearl-mid:#b4c6e1; --pearl-end:#bdb2dd; --pearl-glow:#a9cfee42; --pearl-ring:#c3d8ee33;
  --scene-primary:185,217,237; --scene-secondary:187,173,231; --scene-third:165,204,189; --scene-fourth:214,187,145;
  --scene-label:188,205,226; --scene-dust:169,190,217; --scene-dust-accent:171,177,205;
  --picker-bg:#10141ac9; --picker-border:#bbcce024;
}
/* Electric blue: blue-black space, ion-blue accents and cold highlights. */
:root[data-theme="neon"] {
  color-scheme:dark;
  --browser-color:#050a18; --bg:#050a18; --ink:#dceaff; --muted:#90acd4;
  --line:#4b8fff42; --ice:#58a6ff; --panel:#0b1429f2;
  --scene-center:#0a1835; --scene-mid:#070e20; --scene-edge:#040812;
  --shade:#050c1bcf; --vignette:#02061566;
  --nav:#b1cefa; --hover-ink:#f0f7ff; --focus:#80baff;
  --tagline:#839fc7; --hint:#88a1c7; --pill:#0c1831d9; --pill-ink:#b1cefa; --zoom:#09162dcf; --zoom-label:#9ebee9;
  --panel-border:#4b8fff48; --panel-shadow:#0008; --panel-ink:#d2e3ff; --panel-copy:#9cb8df; --eyebrow:#8aaedf; --subtle:#8fa8cc;
  --row-hover:#3984ff14; --panel-link:#8ebeff; --mode-ink:#96b3df; --selected:#377dff2b; --selected-ink:#d3e8ff;
  --action-border:#5795ff66; --action:#377dff10; --primary:#377dff26; --primary-ink:#dbeaff; --action-hover:#3984ff30;
  --input:#060e20; --label:#9ab8e3; --result:#d2e8ff; --note:#879fc4;
  --tier:#4b8fff10; --tier-letter:#aac9ff; --tier-button:#a4c4f3;
  --reaction:#102447; --reaction-ink:#b4d3ff; --reaction-ready:#124b3e; --reaction-ready-ink:#b6ffdb; --reaction-wait:#17243f;
  --draw-hint:#add2ff; --draw-selected:#86bdff; --draw-confirm:#c2dfff; --toast:#10203bf5; --toast-ink:#c7dfff; --story:#c6dcff;
  --pearl-start:#dfedff; --pearl-mid:#579fff; --pearl-end:#356eff; --pearl-glow:#3984ff99; --pearl-ring:#6da7ff80;
  --scene-primary:82,190,255; --scene-secondary:112,170,255; --scene-third:164,244,113; --scene-fourth:255,192,94;
  --scene-label:184,212,255; --scene-dust:89,146,244; --scene-dust-accent:113,187,255;
  --picker-bg:#0b1830e6; --picker-border:#4b8fff48;
}
/* Warm grey paper with ink-dark copy and clearer controls, still translucent. */
:root[data-theme="paper"] {
  color-scheme:light;
  --browser-color:#e5e0d6; --bg:#e5e0d6; --ink:#22323d; --muted:#475760;
  --line:#3d526569; --ice:#245b76; --panel:#e5e0d6f2;
  --scene-center:#f0ece3; --scene-mid:#e5e0d6; --scene-edge:#d7d1c5;
  --shade:#dcd5c8b8; --vignette:#80786b14;
  --nav:#283f4e; --hover-ink:#123e57; --focus:#205d7d;
  --tagline:#48565a; --hint:#45545c; --pill:#ebe6dadc; --pill-ink:#293f4f; --zoom:#e8e2d6d9; --zoom-label:#344c5b;
  --panel-border:#344b6266; --panel-shadow:#293b4930; --panel-ink:#263b49; --panel-copy:#3b505d; --eyebrow:#455862; --subtle:#465864;
  --row-hover:#344f6818; --panel-link:#205771; --mode-ink:#3d5464; --selected:#3e668128; --selected-ink:#193e55;
  --action-border:#385b787d; --action:#37597510; --primary:#315e7828; --primary-ink:#193e55; --action-hover:#37597526;
  --input:#f6f2e9; --label:#3b515f; --result:#214a60; --note:#485963;
  --tier:#3c607416; --tier-letter:#635071; --tier-button:#294d63;
  --reaction:#d6e0e2; --reaction-ink:#294c5c; --reaction-ready:#c3d7c9; --reaction-ready-ink:#204d35; --reaction-wait:#ddd5c6;
  --draw-hint:#314d60; --draw-selected:#214f6b; --draw-confirm:#28536a; --toast:#e9e3d7f5; --toast-ink:#2c495c; --story:#304b5b;
  --pearl-start:#829aaa; --pearl-mid:#3b607a; --pearl-end:#6c5a80; --pearl-glow:#526d7b24; --pearl-ring:#395c7680;
  --scene-primary:30,67,91; --scene-secondary:84,53,103; --scene-third:34,78,61; --scene-fourth:108,67,25;
  --scene-label:34,50,61; --scene-dust:61,76,82; --scene-dust-accent:89,68,108;
  --picker-bg:#e9e3d7e6; --picker-border:#344b6266;
}

/* Multicolor neon light on the original dark graphite field. */
:root[data-theme="neon-green"] {
  color-scheme:dark;
  --browser-color:#060b10; --bg:#060b10; --ink:#e6f4f7; --muted:#9bacbc;
  --line:#39e8ff55; --ice:#39e8ff; --panel:#101923f2;
  --neon-cyan:#39e8ff; --neon-pink:#ff4fd8; --neon-violet:#ab7cff; --neon-lime:#b6ff44;
  --scene-center:#101b20; --scene-mid:#0b1217; --scene-edge:#070b0d;
  --shade:#060b10bf; --vignette:#03070c55;
  --nav:#c8e6ee; --hover-ink:#f5fcff; --focus:#b6ff44;
  --tagline:#96aebc; --hint:#a9bdc9; --pill:#101923b3; --pill-ink:#c8e6ee; --zoom:#10192399; --zoom-label:#c6d7e6;
  --panel-border:#ab7cff66; --panel-shadow:#0008; --panel-ink:#e6f4f7; --panel-copy:#b5c5d2; --eyebrow:#ab7cff; --subtle:#a7b6c8;
  --row-hover:#39e8ff15; --panel-link:#64edff; --mode-ink:#b7cadb; --selected:#ab7cff30; --selected-ink:#f3eaff;
  --action-border:#39e8ff88; --action:#39e8ff12; --primary:#ff4fd8; --primary-ink:#190d20; --action-hover:#ab7cff30;
  --input:#0a111b; --label:#bfcede; --result:#b6ff44; --note:#a6bacb;
  --tier:#ab7cff10; --tier-letter:#d3b6ff; --tier-button:#8defff;
  --reaction:#182139; --reaction-ink:#d3b6ff; --reaction-ready:#b6ff44; --reaction-ready-ink:#152108; --reaction-wait:#292138;
  --draw-hint:#c3e8ee; --draw-selected:#ff4fd8; --draw-confirm:#b6ff44; --toast:#101923f5; --toast-ink:#e6f4f7; --story:#d5e4ef;
  --pearl-start:#b6ff44; --pearl-mid:#39e8ff; --pearl-end:#ff4fd8; --pearl-glow:#39e8ff99; --pearl-ring:#ff4fd880;
  --scene-primary:57,232,255; --scene-secondary:255,79,216; --scene-third:171,124,255; --scene-fourth:182,255,68;
  --scene-label:207,226,240; --scene-dust:110,160,180; --scene-dust-accent:57,232,255;
  --picker-bg:#101923cc; --picker-border:#ab7cff66;
}
/* Sakura dusk: a static sky, soft pink light and sparse CSS petals. */
:root[data-theme="anime"] {
  color-scheme:dark;
  --browser-color:#18243f; --bg:#18243f; --ink:#e4e7f8; --muted:#a5b2ce;
  --line:#c2bde842; --ice:#e4bbdb; --panel:#1c2943f2;
  --scene-center:#2b3658; --scene-mid:#1c2b48; --scene-edge:#121d34;
  --shade:#121b32b8; --vignette:#09132b44;
  --nav:#c7ceea; --hover-ink:#fff2f5; --focus:#f4c6d8;
  --tagline:#a0adc9; --hint:#a9b6d0; --pill:#202e49d9; --pill-ink:#d2d6f0; --zoom:#22334dd6; --zoom-label:#bcc9e6;
  --panel-border:#c2bde83b; --panel-shadow:#08112488; --panel-ink:#e2dff3; --panel-copy:#bcc7df; --eyebrow:#c5abc9; --subtle:#b0bdd7;
  --row-hover:#dfbbe313; --panel-link:#e4c2e1; --mode-ink:#b5c4df; --selected:#d8a6cc24; --selected-ink:#ffe1ed;
  --action-border:#d6b6e34c; --action:#c4b5f00c; --primary:#f2baca1d; --primary-ink:#ffe6e7; --action-hover:#dfbbe322;
  --input:#15223a; --label:#c3cde3; --result:#ffe1df; --note:#a7b7cf;
  --tier:#c8b7eb10; --tier-letter:#efbfdc; --tier-button:#c7d7ee;
  --reaction:#263b56; --reaction-ink:#d0e1f3; --reaction-ready:#30544d; --reaction-ready-ink:#d1f0df; --reaction-wait:#3a3552;
  --draw-hint:#dce0f4; --draw-selected:#f7d5e3; --draw-confirm:#ffe0d8; --toast:#22314df5; --toast-ink:#ede4f5; --story:#e0dced;
  --pearl-start:#fff1dc; --pearl-mid:#f3c9df; --pearl-end:#aebfed; --pearl-glow:#edbadb66; --pearl-ring:#efc6dc70;
  --scene-primary:165,207,239; --scene-secondary:238,175,207; --scene-third:190,181,242; --scene-fourth:243,205,166;
  --scene-label:220,220,245; --scene-dust:180,196,227; --scene-dust-accent:238,187,219;
  --picker-bg:#213049e6; --picker-border:#c2bde83b;
}
/* Ember: warm copper light in charcoal space, without extra animated layers. */
:root[data-theme="ember"] {
  color-scheme:dark;
  --browser-color:#130d0b; --bg:#130d0b; --ink:#f7e8da; --muted:#c0a48f;
  --line:#e9aa7040; --ice:#ffc17c; --panel:#211610f2;
  --scene-center:#2b1b12; --scene-mid:#1b120e; --scene-edge:#100b09;
  --shade:#130d0bc9; --vignette:#08050455;
  --nav:#ebcdb0; --hover-ink:#fff6eb; --focus:#ffce94;
  --tagline:#b49b86; --hint:#bca28f; --pill:#2a1b14db; --pill-ink:#edceb1; --zoom:#25180fd6; --zoom-label:#d4b69b;
  --panel-border:#e9aa7040; --panel-shadow:#0007; --panel-ink:#f0dcc8; --panel-copy:#cbb19a; --eyebrow:#d6ad87; --subtle:#bca38e;
  --row-hover:#ffbd7510; --panel-link:#f2c38f; --mode-ink:#cdb197; --selected:#ec9e5725; --selected-ink:#ffe4c7;
  --action-border:#edb47555; --action:#ffbd750b; --primary:#e9985724; --primary-ink:#ffe6ce; --action-hover:#ffbd7524;
  --input:#130e0b; --label:#ceb198; --result:#ffe2bf; --note:#b39b86;
  --tier:#e8af7610; --tier-letter:#ebbea7; --tier-button:#d7bca1;
  --reaction:#3b271b; --reaction-ink:#f1d0a9; --reaction-ready:#284234; --reaction-ready-ink:#d5f3d9; --reaction-wait:#352126;
  --draw-hint:#f1cfaa; --draw-selected:#ffd5a1; --draw-confirm:#ffe5c5; --toast:#2b1e16f5; --toast-ink:#f6ddbf; --story:#ecd3bc;
  --pearl-start:#fff1d6; --pearl-mid:#ffc17c; --pearl-end:#cf774b; --pearl-glow:#edaa6259; --pearl-ring:#ffd0a04d;
  --scene-primary:250,190,112; --scene-secondary:229,158,174; --scene-third:165,207,181; --scene-fourth:192,175,226;
  --scene-label:231,206,177; --scene-dust:183,143,107; --scene-dust-accent:239,179,112;
  --picker-bg:#281b13e6; --picker-border:#e9aa7040;
}
/* Ultraviolet: violet-black space, orchid accents and cool spectral sparks. */
:root[data-theme="ultraviolet"] {
  color-scheme:dark;
  --browser-color:#0e0919; --bg:#0e0919; --ink:#ede5ff; --muted:#b4a2d2;
  --line:#b68cf747; --ice:#c6a1ff; --panel:#1a112df2;
  --scene-center:#25163e; --scene-mid:#160e28; --scene-edge:#0b0715;
  --shade:#0e0919c9; --vignette:#07041055;
  --nav:#d8c5f6; --hover-ink:#fbf5ff; --focus:#dfbaff;
  --tagline:#b09bcf; --hint:#b5a3d0; --pill:#24173bd9; --pill-ink:#dccaf8; --zoom:#211333d6; --zoom-label:#c7b0e7;
  --panel-border:#b68cf747; --panel-shadow:#0008; --panel-ink:#e5d6fc; --panel-copy:#c2acde; --eyebrow:#d1a8ed; --subtle:#b7a2d1;
  --row-hover:#c19aff14; --panel-link:#d5b2ff; --mode-ink:#c4afdf; --selected:#a56bf02a; --selected-ink:#eddaff;
  --action-border:#c39af765; --action:#b68cff10; --primary:#ad79ef26; --primary-ink:#f1e2ff; --action-hover:#c19aff2b;
  --input:#110b21; --label:#c5b0e0; --result:#f3ddff; --note:#ac99c7;
  --tier:#b68cf712; --tier-letter:#e4b4e5; --tier-button:#cbb6e9;
  --reaction:#2d1c4a; --reaction-ink:#e1cafb; --reaction-ready:#25423b; --reaction-ready-ink:#c9f3dc; --reaction-wait:#3d2144;
  --draw-hint:#dcc4ff; --draw-selected:#e1bdff; --draw-confirm:#efd8ff; --toast:#291a40f5; --toast-ink:#ecd9ff; --story:#dbc9ef;
  --pearl-start:#f6e6ff; --pearl-mid:#c995ff; --pearl-end:#8660dc; --pearl-glow:#b582f96b; --pearl-ring:#dbb2ff59;
  --scene-primary:187,162,255; --scene-secondary:245,163,219; --scene-third:116,218,235; --scene-fourth:240,203,145;
  --scene-label:218,199,247; --scene-dust:155,124,203; --scene-dust-accent:200,157,244;
  --picker-bg:#231637e6; --picker-border:#b68cf747;
}
/* Glacier: a cool daylight option with ink-dark sparks and restrained glow. */
:root[data-theme="glacier"] {
  color-scheme:light;
  --browser-color:#e7f2f7; --bg:#e7f2f7; --ink:#243f54; --muted:#425e73;
  --line:#4a78953b; --ice:#256e96; --panel:#f4fbfef5;
  --scene-center:#f6fcff; --scene-mid:#e7f2f7; --scene-edge:#d4e5ef;
  --shade:#dcebf3c9; --vignette:#6e9db81a;
  --nav:#365b73; --hover-ink:#143c58; --focus:#1d628c;
  --tagline:#425e73; --hint:#425e73; --pill:#f4fbfee8; --pill-ink:#345b75; --zoom:#f1f9fee0; --zoom-label:#426780;
  --panel-border:#577f993b; --panel-shadow:#2d506622; --panel-ink:#25465b; --panel-copy:#46677b; --eyebrow:#425e73; --subtle:#425e73;
  --row-hover:#4d8aae12; --panel-link:#236583; --mode-ink:#425e73; --selected:#5f9bbe24; --selected-ink:#234e6a;
  --action-border:#527e9e50; --action:#5993b40c; --primary:#5598bc21; --primary-ink:#215775; --action-hover:#5993b425;
  --input:#fbfeff; --label:#41647b; --result:#254f6b; --note:#425e73;
  --tier:#5881a110; --tier-letter:#6c5482; --tier-button:#315f7d;
  --reaction:#dcebf5; --reaction-ink:#295575; --reaction-ready:#d4eadd; --reaction-ready-ink:#285a42; --reaction-wait:#e3e1ef;
  --draw-hint:#345f7a; --draw-selected:#23688e; --draw-confirm:#235a78; --toast:#f1f9fff5; --toast-ink:#305772; --story:#375a72;
  --pearl-start:#c4e5f5; --pearl-mid:#629fc0; --pearl-end:#527bad; --pearl-glow:#6aa1be38; --pearl-ring:#548aae55;
  --scene-primary:39,87,125; --scene-secondary:109,71,133; --scene-third:31,98,96; --scene-fourth:133,77,35;
  --scene-label:42,74,98; --scene-dust:70,104,131; --scene-dust-accent:74,102,152;
  --picker-bg:#f1f9fee8; --picker-border:#4a78953b;
}
.anime-atmosphere { display:none; position:fixed; inset:0; overflow:hidden; isolation:isolate; pointer-events:none; }
:root[data-theme="anime"] .anime-atmosphere {
  display:block;
  background:radial-gradient(ellipse 65% 12% at 84% 23%,#b9a5d311,transparent 80%),radial-gradient(ellipse 85% 13% at 18% 77%,#a7c4e30d,transparent 76%),radial-gradient(ellipse 95% 42% at 50% 110%,#d298bd1c,transparent 72%);
}
.anime-atmosphere:after {
  content:""; position:absolute; top:17%; right:13%; width:30px; height:30px; border-radius:50%;
  box-shadow:-7px 5px 0 0 #f4d8c37d; transform:rotate(-18deg);
}
/* A sparse, screen-space layer behind the canvas, never a Spark or hit target. */
.sakura-petals { position:absolute; inset:0; pointer-events:none; }
.sakura-petal {
  --x:8%; --size:8px; --fall:38s; --delay:-8s; --alpha:.22; --flutter:7s;
  position:absolute; top:-24px; left:var(--x); width:var(--size); height:calc(var(--size) * 1.35);
  opacity:0; animation:sakura-drift var(--fall) var(--delay) linear infinite;
}
.sakura-petal:before {
  content:""; display:block; width:100%; height:100%;
  border-radius:85% 15% 80% 25%;
  background:linear-gradient(135deg,#ffe1eb 8%,#e6a5c5 85%);
  /* A small cleft at the broad tip gives the petal its sakura silhouette. */
  clip-path:polygon(0 0,38% 0,49% 14%,61% 0,100% 0,100% 100%,0 100%);
  animation:sakura-flutter var(--flutter) var(--delay) ease-in-out infinite;
}
.sakura-petal:nth-child(2) { --x:26%; --size:6px; --fall:47s; --delay:-31s; --alpha:.15; --flutter:8s; }
.sakura-petal:nth-child(3) { --x:46%; --size:10px; --fall:41s; --delay:-19s; --alpha:.23; --flutter:9s; }
.sakura-petal:nth-child(4) { --x:65%; --size:7px; --fall:50s; --delay:-43s; --alpha:.17; --flutter:7.5s; }
.sakura-petal:nth-child(5) { --x:85%; --size:9px; --fall:43s; --delay:-12s; --alpha:.20; --flutter:8.5s; }
.sakura-petal:nth-child(6) { --x:15%; --size:11px; --fall:44s; --delay:-36s; --alpha:.21; --flutter:9.5s; }
.sakura-petal:nth-child(7) { --x:36%; --size:7px; --fall:52s; --delay:-25s; --alpha:.16; --flutter:8s; }
.sakura-petal:nth-child(8) { --x:56%; --size:8px; --fall:39s; --delay:-4s; --alpha:.19; --flutter:7.5s; }
.sakura-petal:nth-child(9) { --x:74%; --size:6px; --fall:49s; --delay:-34s; --alpha:.15; --flutter:9s; }
.sakura-petal:nth-child(10) { --x:92%; --size:10px; --fall:46s; --delay:-24s; --alpha:.22; --flutter:8.5s; }
@keyframes sakura-drift {
  0% { transform:translate3d(-4vw,0,0); opacity:0; }
  12%,82% { opacity:var(--alpha); }
  50% { transform:translate3d(2vw,52vh,0); }
  100% { transform:translate3d(9vw,calc(100vh + 48px),0); opacity:0; }
}
@keyframes sakura-flutter {
  0%,100% { transform:translateX(-5px) rotate(-28deg) scaleX(.85); }
  50% { transform:translateX(5px) rotate(52deg) scaleX(.45); }
}
.still .sakura-petal,.still .sakura-petal:before,
.anime-atmosphere[data-paused] .sakura-petal,.anime-atmosphere[data-paused] .sakura-petal:before { animation-play-state:paused; }
@media(max-width:640px) { .sakura-petal:nth-child(n+6) { display:none; } }
@media(prefers-reduced-motion:reduce) { .sakura-petals { display:none; } }
:root[data-theme="anime"] #grain { opacity:.23; }
:root[data-theme="anime"] .pearl { box-shadow:0 0 12px var(--pearl-glow),0 0 24px #e4b4e022; }
@media(max-width:640px) { .anime-atmosphere:after { top:17%; right:14%; width:22px; height:22px; box-shadow:-5px 4px 0 0 #f4d8c36b; } }
html { background:var(--bg); }
body { background:radial-gradient(ellipse at 47% 43%,var(--scene-center) 0%,var(--scene-mid) 43%,var(--scene-edge) 100%); }
button:focus-visible,a:focus-visible,select:focus-visible,input:focus-visible { outline-color:var(--focus); }
button:hover:not(:disabled) { color:var(--hover-ink); }
:root[data-theme="paper"] button:active:not(:disabled),:root[data-theme="glacier"] button:active:not(:disabled) { filter:brightness(.9); }
#vignette { background:radial-gradient(ellipse at center,transparent 38%,var(--vignette) 100%); }
/* The living field continues behind the transparent header in every theme. */
.nav-button { color:var(--nav); }
.pearl { background:linear-gradient(130deg,var(--pearl-start),var(--pearl-mid) 48%,var(--pearl-end)); box-shadow:0 0 9px var(--pearl-glow); }
.pearl:after { border-color:var(--pearl-ring); }
.bottom-shade { background:linear-gradient(transparent,var(--shade)); }
.tagline { color:var(--tagline); }
.hint { color:var(--hint); }
.pill { background:var(--pill); }
.pill button { color:var(--pill-ink); }
.zoom .icon { background:var(--zoom); }
.zoom .home { color:var(--zoom-label); }
.panel { border-color:var(--panel-border); box-shadow:0 20px 70px var(--panel-shadow); color:var(--panel-ink); }
.panel p { color:var(--panel-copy); }
.panel .eyebrow { color:var(--eyebrow); }
.subtle { color:var(--subtle); }
.spark-link:hover { background:var(--row-hover); }
.panel-link { color:var(--panel-link); }
#sparkContent .action { border-color:var(--action-border); background:var(--action); }
#sparkContent .action.primary { color:var(--primary-ink); background:var(--primary); }
#sparkContent .action:hover { background:var(--action-hover); }
#sparkContent input { background:var(--input); }
#sparkContent label { color:var(--label); }
.result { color:var(--result)!important; }
.preview-note { color:var(--note)!important; }
#sparkContent > p[style] { color:var(--story)!important; }
.tier-row { background:var(--tier); }
.tier-letter { color:var(--tier-letter); }
.tier-row button { color:var(--tier-button); }
.reaction-pad { color:var(--reaction-ink); background:var(--reaction); }
.reaction-pad.ready { color:var(--reaction-ready-ink); background:var(--reaction-ready); }
.reaction-pad.wait { background:var(--reaction-wait); }
#drawHint { color:var(--draw-hint); }
#drawToolbar .color[aria-pressed=true] i { outline-color:var(--draw-selected); }
#drawToolbar .confirm { color:var(--draw-confirm); }
#toast { background:var(--toast); color:var(--toast-ink); }
:root[data-theme="paper"] #grain,:root[data-theme="glacier"] #grain { mix-blend-mode:multiply; opacity:.13; }
:root[data-theme="paper"] #drawToolbar .color i,:root[data-theme="glacier"] #drawToolbar .color i { box-shadow:0 0 0 1px #51657c66; }
:root[data-theme="neon"] #grain,:root[data-theme="neon-green"] #grain { opacity:.36; }
:root[data-theme="neon"] .pearl { box-shadow:0 0 9px var(--pearl-glow),0 0 20px #317aff40; }
:root[data-theme="neon-green"] #sparkContent .action.primary:hover { background:#ff86e5; color:var(--primary-ink); }
:root[data-theme="neon-green"] .theme-choice[aria-pressed=true] { border-color:var(--neon-cyan); background:#ab7cff20; box-shadow:0 0 10px #39e8ff28; }
:root[data-theme="neon-green"] .pearl { box-shadow:0 0 9px var(--pearl-glow),0 0 22px #ff4fd844; }
/* Give the four neon hues consistent roles without tinting the whole surface. */
:root[data-theme="neon-green"] #journeyButton { color:var(--neon-pink); border-color:#ff4fd899; box-shadow:0 0 14px #ff4fd814; }
:root[data-theme="neon-green"] #sharedSwarmButton { color:var(--neon-cyan); border-color:#39e8ff80; }
:root[data-theme="neon-green"] :is(#createButton,#soundToggle,#soundButton) { color:var(--neon-lime); }
:root[data-theme="neon-green"] :is(#accountLink,#motionButton,#pauseButton) { color:var(--neon-violet); }
:root[data-theme="neon-green"] #zoomOut { color:var(--neon-cyan); border-color:#39e8ff80; }
:root[data-theme="neon-green"] #zoomIn { color:var(--neon-pink); border-color:#ff4fd880; }
/* Keep the theme swatches centered over the zoom readout. */
body { --theme-dock-width:202px; }
.theme-picker, .zoom { width:var(--theme-dock-width); max-width:calc(100vw - 32px); }
.zoom { display:grid; grid-template-columns:auto minmax(0,1fr) auto; }
.zoom .home { min-width:0; }
#motionPanel .theme-picker { margin-inline:auto; }
.theme-picker {
  position:fixed; z-index:6; right:clamp(16px,3.5vw,55px); bottom:calc(70px + env(safe-area-inset-bottom,0px));
  display:block; padding:0; border:0;
  background:transparent;
}
.theme-options {
  position:relative; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:4px; padding:3px;
  overflow:visible;
}
.theme-choice {
  display:flex; align-items:center; justify-content:center; flex:0 0 auto; width:100%; height:32px;
  padding:0; border:1px solid transparent; border-radius:8px; color:var(--muted); font-size:9px; line-height:1;
  letter-spacing:.02em; transition:background-color .18s ease,color .18s ease,border-color .18s ease;
}
.theme-choice[aria-pressed=true] { background:transparent; border-color:var(--muted); color:var(--selected-ink); }
.theme-choice:hover:not(:disabled) { background:var(--row-hover); color:var(--hover-ink); }
.theme-choice[aria-pressed=true]:hover { background:var(--row-hover); }
.theme-choice:focus-visible { outline:2px solid var(--focus); outline-offset:2px; }
.theme-swatch { display:block; width:22px; height:8px; border-radius:4px; border:1px solid #91a3b8; background:#151b23; }
[data-theme-choice="paper"] .theme-swatch { background:linear-gradient(110deg,#f0ece3,#c5bca9); border-color:#6d776f; }
[data-theme-choice="neon"] .theme-swatch { background:#3984ff; border-color:#82b8ff; box-shadow:0 0 5px #317aff66; }
[data-theme-choice="neon-green"] .theme-swatch { background:linear-gradient(110deg,#39e8ff,#ab7cff 36%,#ff4fd8 65%,#b6ff44); border-color:#d2c5ff; box-shadow:0 0 7px #ab7cff66; }
[data-theme-choice="anime"] .theme-swatch { background:linear-gradient(100deg,#91b9e0,#dfb5db 65%,#f1d1af); border-color:#d2bddd; box-shadow:0 0 5px #d5a7dc25; }
[data-theme-choice="ember"] .theme-swatch { background:linear-gradient(100deg,#643b29,#f4b56d); border-color:#dfad84; }
[data-theme-choice="ultraviolet"] .theme-swatch { background:linear-gradient(100deg,#6945aa,#d29af6); border-color:#bf9be8; }
[data-theme-choice="glacier"] .theme-swatch { background:linear-gradient(100deg,#f3fcff,#a3c9e1); border-color:#709eb9; }
.in-draw .theme-picker { display:none; }
.panel-open .theme-picker { visibility:hidden; }
@media(max-width:640px) {
  .theme-picker { right:16px; }
  .theme-choice { width:36px; height:36px; }
  .theme-swatch { width:20px; }
  .tagline { left:16px; transform:none; }
}
@media(max-width:399px) {
  body { --theme-dock-width:130px; }
  body > .theme-picker { width:122px; right:calc(16px + (var(--theme-dock-width) - 122px) / 2); }
  body > .theme-picker .theme-options { grid-template-columns:repeat(3,36px); }
}
@media(prefers-reduced-motion:reduce) { .theme-choice { transition:none; } }



@media(min-width:540px) and (max-height:500px) and (orientation:landscape) {
  #motionPanel .theme-picker { width:242px; }
}
