/* ==========================================================================
   Tonewright themes
   Every component reads these variables, so a theme is just one block.
   ========================================================================== */

/* ---------- Frutiger Aero (default) ---------- */
[data-theme="aero"] {
  --bg-image: linear-gradient(#1c74cf 0%, #3fa6ec 30%, #8fd6fb 58%, #d5f3ff 76%);
  --panel: linear-gradient(rgba(255,255,255,.93), rgba(255,255,255,.58));
  --panel-solid: #ffffff;
  --panel-edge: rgba(255,255,255,.95);
  --panel-shadow: 0 12px 28px rgba(0,30,60,.30), inset 0 1px 0 rgba(255,255,255,.8);
  --card: linear-gradient(rgba(255,255,255,.96), rgba(226,245,255,.78));
  --text: #06325a; --text-dim: #3d6b92;
  --accent: #2a8ee0; --accent2: #7fdcff; --accent-soft: rgba(42,142,224,.16); --on-accent: #ffffff;
  --ok: #2e9b3a; --bad: #d6453d; --warn: #e8820c;
  --bar: linear-gradient(#e2f5ff 0%, #6cc0f5 48%, #2b8ad9 52%, #8fd6fb 100%);
  --bar-text: #ffffff; --bar-edge: #1d6fb7;
  --btn: linear-gradient(#f2f9ff 0%, #f2f9ff 46%, #d6edfc 50%, #9dd3f5 100%);
  --btn-text: #06325a; --btn-edge: #3a7db5; --btn-shine: .25;
  --go: linear-gradient(#eefbe8 0%, #eefbe8 46%, #bff0a0 50%, #3fbf2a 100%); --go-edge: #2a7d1b; --go-text: #0b3a10;
  --warnb: linear-gradient(#fff4e6 0%, #fff4e6 46%, #ffd09a 50%, #ff7a1a 100%); --warnb-edge: #b8621c; --warnb-text: #4a2000;
  --danger: linear-gradient(#fdeeee 0%, #fdeeee 46%, #ffd0d0 50%, #f06a6a 100%); --danger-edge: #a02727; --danger-text: #4a0000;
  --note: linear-gradient(#fff6c2 0%, #ffe34d 50%, #ffc107 100%); --note-text: #4a3500; --note-edge: #c99a06;
  --field: rgba(255,255,255,.96); --field-edge: #6fa9d6; --field-text: #06325a;
  --track: #cfe9fb;
  --fill: #2a8ee0;
  --thumb: radial-gradient(circle at 35% 30%, #ffffff 0, #bfe6ff 45%, #2a8ee0 100%); --thumb-edge: #1d6fb7;
  --display: #041524; --display-edge: #cfe9fb; --line: #9fe8ff; --line2: #ffb070;
  --radius: 16px; --radius-sm: 12px; --radius-xs: 8px;
  --font-head: "Trebuchet MS", Tahoma, sans-serif;
  --font-body: "Segoe UI", Tahoma, Verdana, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%2306325a'/></svg>");
  --scroll-thumb: linear-gradient(#bfe6ff, #2a8ee0); --scroll-track: rgba(255,255,255,.35);
  --tag-on: #d9f7c3; --tag-off: #ffe2c4; --tag-edge-on: #4f9b3a; --tag-edge-off: #d08a3c;
  --math-bg: rgba(255,255,255,.72); --math-edge: #6fa9d6;
  --c-root: #1f6fd0; --c-ratio: #d0601a; --c-hz: #2e8b3f; --c-beat: #a0309a;
  --glow: rgba(127,220,255,.9);
  --shape-fill: rgba(42,142,224,.22);
}

/* ---------- Dark Aero ---------- */
[data-theme="dark"] {
  --bg-image: radial-gradient(ellipse at 85% 0%, rgba(125,255,58,.16), transparent 45%), radial-gradient(ellipse at 10% 100%, rgba(60,160,30,.26), transparent 50%), linear-gradient(#000 0%, #03100a 55%, #000 100%);
  --panel: linear-gradient(rgba(22,28,24,.92), rgba(8,12,10,.86));
  --panel-solid: #0e130f;
  --panel-edge: rgba(125,255,58,.35);
  --panel-shadow: 0 14px 30px rgba(0,0,0,.7), 0 0 22px rgba(125,255,58,.10), inset 0 1px 0 rgba(255,255,255,.06);
  --card: linear-gradient(rgba(20,26,22,.95), rgba(6,10,8,.9));
  --text: #e6ffe9; --text-dim: #8fbf98;
  --accent: #7dff3a; --accent2: #2fd2ff; --accent-soft: rgba(125,255,58,.14); --on-accent: #041004;
  --ok: #7dff3a; --bad: #ff5a5a; --warn: #ffb13b;
  --bar: linear-gradient(#5a636b 0%, #1d2328 48%, #0b0e11 52%, #2a3036 100%);
  --bar-text: #b8ff8a; --bar-edge: #4cff2a;
  --btn: linear-gradient(#3a4147 0%, #20262b 48%, #0c0f12 52%, #1a1f24 100%);
  --btn-text: #d9ffe0; --btn-edge: #4cff2a; --btn-shine: .22;
  --go: linear-gradient(#3f6b35 0%, #24461d 48%, #10230b 52%, #2f7d25 100%); --go-edge: #7dff3a; --go-text: #eaffe0;
  --warnb: linear-gradient(#6b4a22 0%, #3d2a12 48%, #1d1307 52%, #7a4a14 100%); --warnb-edge: #ffb13b; --warnb-text: #ffe6c4;
  --danger: linear-gradient(#6b2a2a 0%, #3d1414 48%, #1d0707 52%, #7a1616 100%); --danger-edge: #ff5a5a; --danger-text: #ffd6d6;
  --note: linear-gradient(#fff3b0 0%, #ffd84d 50%, #e0a800 100%); --note-text: #2a1f00; --note-edge: #e0a800;
  --field: #0b0f0c; --field-edge: #2f7d25; --field-text: #e6ffe9;
  --track: #1c241e;
  --fill: #7dff3a;
  --thumb: radial-gradient(circle at 35% 30%, #f4fff0 0, #7dff3a 40%, #1d5a12 100%); --thumb-edge: #7dff3a;
  --display: #000; --display-edge: #2a4a2a; --line: #7dff3a; --line2: #2fd2ff;
  --radius: 10px; --radius-sm: 8px; --radius-xs: 5px;
  --font-head: "Trebuchet MS", Tahoma, sans-serif;
  --font-body: "Segoe UI", Tahoma, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%237dff3a'/></svg>");
  --scroll-thumb: linear-gradient(#7dff3a, #1d5a12); --scroll-track: rgba(0,0,0,.4);
  --tag-on: #1d3d12; --tag-off: #3d2a12; --tag-edge-on: #7dff3a; --tag-edge-off: #ffb13b;
  --math-bg: rgba(0,0,0,.45); --math-edge: #2f7d25;
  --c-root: #7fbfff; --c-ratio: #ffb070; --c-hz: #8dff8d; --c-beat: #e59bff;
  --glow: rgba(125,255,58,.8);
  --shape-fill: rgba(125,255,58,.16);
}

/* ---------- Modern (clean, flat, light) ---------- */
[data-theme="modern"] {
  --bg-image: linear-gradient(#f4f6fa, #f4f6fa);
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --panel-edge: #e3e8f0;
  --panel-shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 14px rgba(16,24,40,.06);
  --card: #ffffff;
  --text: #111827; --text-dim: #5b6575;
  --accent: #2563eb; --accent2: #93c5fd; --accent-soft: rgba(37,99,235,.12); --on-accent: #ffffff;
  --ok: #15803d; --bad: #dc2626; --warn: #b45309;
  --bar: #ffffff;
  --bar-text: #111827; --bar-edge: #e3e8f0;
  --btn: #ffffff;
  --btn-text: #111827; --btn-edge: #d0d5dd; --btn-shine: 0;
  --go: #2563eb; --go-edge: #1d4ed8; --go-text: #ffffff;
  --warnb: #ea580c; --warnb-edge: #c2410c; --warnb-text: #ffffff;
  --danger: #dc2626; --danger-edge: #991b1b; --danger-text: #ffffff;
  --note: #fef7c3; --note-text: #713b12; --note-edge: #fde272;
  --field: #ffffff; --field-edge: #d0d5dd; --field-text: #111827;
  --track: #e4e7ec;
  --fill: #2563eb;
  --thumb: radial-gradient(circle at 50% 50%, #ffffff 0, #ffffff 55%, #9ca3af 100%); --thumb-edge: #6b7280;
  --display: #0f172a; --display-edge: #334155; --line: #60a5fa; --line2: #fbbf24;
  --radius: 12px; --radius-sm: 10px; --radius-xs: 8px;
  --font-head: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%23111827'/></svg>");
  --scroll-thumb: #cfd6e0; --scroll-track: transparent;
  --tag-on: #ecfdf3; --tag-off: #fffaeb; --tag-edge-on: #6ce9a6; --tag-edge-off: #fec84b;
  --math-bg: #f9fafb; --math-edge: #e3e8f0;
  --c-root: #2563eb; --c-ratio: #ea580c; --c-hz: #15803d; --c-beat: #9333ea;
  --glow: rgba(37,99,235,.25);
  --shape-fill: rgba(37,99,235,.14);
}

/* ---------- Cherry blossom (cool vanilla, peach and pink) ---------- */
[data-theme="blossom"] {
  --bg-image: #fdf3ec;
  --panel: rgba(255,252,250,.96);
  --panel-solid: #fffcfa;
  --panel-edge: #efc9d4;
  --panel-shadow: 0 1px 2px rgba(122,52,74,.08), 0 4px 14px rgba(122,52,74,.06);
  --card: #fffafa;
  --text: #4a2630; --text-dim: #8a5a66;
  --accent: #d6457a; --accent2: #ffb3c6; --accent-soft: rgba(214,69,122,.14); --on-accent: #ffffff;
  --ok: #5f9c7a; --bad: #c93a4e; --warn: #8e4a6b;
  --bar: #f8dde6; --bar-text: #4a1a2c; --bar-edge: #e7b3c3;
  --btn: #ffffff; --btn-text: #4a2630; --btn-edge: #e2b1bf; --btn-shine: 0;
  --go: #d6457a; --go-edge: #b83665; --go-text: #ffffff;
  --warnb: #8e4a6b; --warnb-edge: #6e3650; --warnb-text: #ffffff;
  --danger: #c2344f; --danger-edge: #8f1d30; --danger-text: #ffffff;
  --note: #fbe8ee; --note-text: #4a1a2c; --note-edge: #e7b3c3;
  --field: #ffffff; --field-edge: #e2b1bf; --field-text: #4a2630;
  --track: #f1d9d4;
  --fill: #d6457a;
  --thumb: #d6457a; --thumb-edge: #b83665;
  --display: #3b1a24; --display-edge: #e7a3b6; --line: #ff8fb0; --line2: #b8698f;
  --radius: 12px; --radius-sm: 10px; --radius-xs: 6px;
  --font-head: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%234a2630'/></svg>");
  --scroll-thumb: #e7a3b6; --scroll-track: rgba(255,255,255,.5);
  --tag-on: #e3f1e8; --tag-off: #f2dbe6; --tag-edge-on: #5f9c7a; --tag-edge-off: #b07a98;
  --math-bg: rgba(255,255,255,.75); --math-edge: #e7a3b6;
  --c-root: #b83665; --c-ratio: #e0708f; --c-hz: #5f9c7a; --c-beat: #8e4a6b;
  --glow: rgba(255,143,176,.7);
  --shape-fill: rgba(214,69,122,.16);
}

/* ---------- Technozen ---------- */
[data-theme="technozen"] {
  --bg-image: radial-gradient(ellipse at 70% 10%, rgba(95,242,214,.12), transparent 50%), radial-gradient(ellipse at 15% 90%, rgba(40,120,140,.25), transparent 55%), linear-gradient(#0b1214 0%, #10202a 60%, #0a1418 100%);
  --panel: linear-gradient(rgba(20,34,38,.80), rgba(10,18,20,.72));
  --panel-solid: #132226;
  --panel-edge: rgba(95,242,214,.22);
  --panel-shadow: 0 18px 44px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.05);
  --card: linear-gradient(rgba(24,40,44,.9), rgba(12,22,24,.86));
  --text: #d7f5ee; --text-dim: #8fb8b0;
  --accent: #5ff2d6; --accent2: #8ab4ff; --accent-soft: rgba(95,242,214,.12); --on-accent: #031a16;
  --ok: #5ff2d6; --bad: #ff7a7a; --warn: #ffd27a;
  --bar: linear-gradient(rgba(44,70,76,.9), rgba(16,28,32,.94));
  --bar-text: #bff7ea; --bar-edge: rgba(95,242,214,.35);
  --btn: linear-gradient(rgba(62,92,98,.75), rgba(22,36,40,.92));
  --btn-text: #d7f5ee; --btn-edge: rgba(95,242,214,.42); --btn-shine: .12;
  --go: linear-gradient(rgba(95,242,214,.5), rgba(20,90,80,.92)); --go-edge: #5ff2d6; --go-text: #eafffb;
  --warnb: linear-gradient(rgba(255,210,122,.42), rgba(90,60,16,.92)); --warnb-edge: #ffd27a; --warnb-text: #fff3d6;
  --danger: linear-gradient(rgba(255,122,122,.42), rgba(90,20,20,.92)); --danger-edge: #ff7a7a; --danger-text: #ffe0e0;
  --note: linear-gradient(rgba(255,226,140,.95), rgba(214,170,60,.95)); --note-text: #2a2000; --note-edge: #e7bb4f;
  --field: rgba(6,14,16,.85); --field-edge: rgba(95,242,214,.35); --field-text: #d7f5ee;
  --track: #15262a;
  --fill: #5ff2d6;
  --thumb: radial-gradient(circle at 40% 35%, #eafff9 0, #5ff2d6 45%, #0f5a50 100%); --thumb-edge: #5ff2d6;
  --display: #050b0d; --display-edge: rgba(95,242,214,.3); --line: #5ff2d6; --line2: #8ab4ff;
  --radius: 6px; --radius-sm: 4px; --radius-xs: 3px;
  --font-head: "Segoe UI Semibold", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-body: "Segoe UI Light", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%235ff2d6'/></svg>");
  --scroll-thumb: #2a4a4f; --scroll-track: transparent;
  --tag-on: rgba(95,242,214,.2); --tag-off: rgba(255,210,122,.15); --tag-edge-on: #5ff2d6; --tag-edge-off: #ffd27a;
  --math-bg: rgba(0,0,0,.35); --math-edge: rgba(95,242,214,.35);
  --c-root: #8ab4ff; --c-ratio: #ffd27a; --c-hz: #5ff2d6; --c-beat: #d59bff;
  --glow: rgba(95,242,214,.7);
  --shape-fill: rgba(95,242,214,.14);
}

/* ---------- Windows XP (Bliss) ---------- */
[data-theme="xp"] {
  --bg-image: url("../img/bliss.png") center / cover no-repeat fixed;
  --panel: linear-gradient(#f6f5ee, #ece9d8);
  --panel-solid: #ece9d8;
  --panel-edge: #ffffff;
  --panel-shadow: 0 6px 16px rgba(0,30,90,.35), inset 0 0 0 1px #d6d0c0;
  --card: linear-gradient(#ffffff, #ece9d8);
  --text: #101010; --text-dim: #4a4a4a;
  --accent: #0054e3; --accent2: #3c8cff; --accent-soft: rgba(0,84,227,.12); --on-accent: #ffffff;
  --ok: #2a9a2a; --bad: #c81b1b; --warn: #d9820b;
  --bar: linear-gradient(#3d95ff 0%, #0058ee 40%, #0054e3 60%, #0a5fe8 100%);
  --bar-text: #ffffff; --bar-edge: #0831d9;
  --btn: linear-gradient(#ffffff 0%, #f4f3ee 60%, #e4e2d6 100%);
  --btn-text: #000000; --btn-edge: #003c74; --btn-shine: .3;
  --go: linear-gradient(#9de06b, #3c9a1e 60%, #2f7d16); --go-edge: #1f5a0c; --go-text: #ffffff;
  --warnb: linear-gradient(#ffc36a, #e77a14 60%, #c25a0a); --warnb-edge: #8a4a06; --warnb-text: #ffffff;
  --danger: linear-gradient(#ff8a8a, #d42a2a 60%, #a31d1d); --danger-edge: #6e1414; --danger-text: #ffffff;
  --note: linear-gradient(#fffbd2, #fff17a 60%, #f2d33c); --note-text: #202000; --note-edge: #b89a00;
  --field: #ffffff; --field-edge: #7f9db9; --field-text: #000000;
  --track: #d7d3c2;
  --fill: #0054e3;
  --thumb: linear-gradient(#ffffff, #d4d0c8 60%, #a9a48f); --thumb-edge: #6b6755;
  --display: #061a3e; --display-edge: #7f9db9; --line: #7fe0ff; --line2: #9fff7a;
  --radius: 6px; --radius-sm: 4px; --radius-xs: 3px;
  --font-head: Tahoma, "Trebuchet MS", sans-serif;
  --font-body: Tahoma, Verdana, sans-serif;
  --font-mono: "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%23000000'/></svg>");
  --scroll-thumb: linear-gradient(#c8dcff, #6f9ff0); --scroll-track: #ece9d8;
  --tag-on: #d4f7c0; --tag-off: #ffe6b8; --tag-edge-on: #3c7a1e; --tag-edge-off: #b76b10;
  --math-bg: #fffef2; --math-edge: #7f9db9;
  --c-root: #0054e3; --c-ratio: #c25600; --c-hz: #1e7a1e; --c-beat: #8a1fa8;
  --glow: rgba(60,140,255,.6);
  --shape-fill: rgba(0,84,227,.14);
}

/* ==========================================================================
   Per-theme extras: canvas backgrounds and the green/dark step cards
   ========================================================================== */
[data-theme="aero"]      { --canvas-bg: #f3fbff; --step-dark: #3d9b25; --step-dark-text: #ffffff; }
[data-theme="dark"]      { --canvas-bg: #03100a; --step-dark: #1f6b1a; --step-dark-text: #eaffea; }
[data-theme="modern"]    { --canvas-bg: #f9fafb; --step-dark: #1d4ed8; --step-dark-text: #ffffff; }
[data-theme="blossom"]   { --canvas-bg: #fff8f3; --step-dark: #b83665; --step-dark-text: #ffffff; }
[data-theme="technozen"] { --canvas-bg: #0a1418; --step-dark: #0f6b5a; --step-dark-text: #e6fffb; }
[data-theme="xp"]        { --canvas-bg: #ffffff; --step-dark: #3c8a1f; --step-dark-text: #ffffff; }

/* ==========================================================================
   Decorative backgrounds, per theme. Modern is deliberately bare.
   ========================================================================== */
.decor { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.decor .d { display: none; position: absolute; }
[data-theme="aero"] .decor .aero { display: block; }
[data-theme="dark"] .decor .dark { display: block; }
[data-theme="blossom"] .decor .blossom { display: block; }
[data-theme="technozen"] .decor .zen { display: block; }

.decor .aero.sun { width: 620px; height: 620px; right: -170px; top: -200px; border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, rgba(255,255,255,.85) 16%, rgba(255,255,255,0) 62%); }
.decor .aero.cloud { border-radius: 50%; background: radial-gradient(ellipse, rgba(255,255,255,.96), rgba(255,255,255,0) 70%); }
.decor .aero.c1 { left: -80px; top: 90px; width: 360px; height: 120px; }
.decor .aero.c2 { left: 38%; top: -40px; width: 440px; height: 150px; }
.decor .aero.c3 { right: -60px; top: 300px; width: 380px; height: 130px; }
.decor .aero.hill { left: -15%; right: -15%; bottom: -80px; height: 40vh; border-radius: 50% 50% 0 0 / 26% 26% 0 0;
  background: radial-gradient(ellipse at 50% 0%, #c3f79a 0%, #6fcd3c 35%, #3d9b25 65%, #23701a 100%);
  box-shadow: inset 0 6px 0 rgba(255,255,255,.5); }

.decor .dark.glow { inset: -20%;
  background: radial-gradient(ellipse at 85% 0%, rgba(125,255,58,.14), transparent 45%), radial-gradient(ellipse at 10% 100%, rgba(60,160,30,.22), transparent 50%); }
.decor .dark.horizon { left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #7dff3a, transparent); box-shadow: 0 0 18px 4px rgba(125,255,58,.55); }

/* Cherry blossom trees: one SVG reused on two corners, mirrored on the second */
.decor .blossom.tree { width: 560px; height: 600px; opacity: .9; }
.decor .blossom.tree svg { width: 100%; height: 100%; display: block; }
.decor .blossom.t1 { left: -150px; top: -120px; }
.decor .blossom.t2 { right: -170px; bottom: -150px; transform: scaleX(-1) rotate(-6deg); }

.decor .zen.ring { border-radius: 50%; border: 1px solid rgba(95,242,214,.18); }
.decor .zen.r1 { width: 720px; height: 720px; left: -260px; top: -260px; }
.decor .zen.r2 { width: 980px; height: 980px; right: -420px; bottom: -460px; }
.decor .zen.r3 { width: 420px; height: 420px; right: 12%; top: 18%; border-color: rgba(138,180,255,.16); }

/* bubbles (aero) and chrome orbs (dark) */
.decor .bub { position: absolute; bottom: -140px; border-radius: 50%; animation: rise linear infinite; display: none;
  background: radial-gradient(circle at 30% 30%, #fff 0 6%, rgba(255,255,255,.22) 13%, rgba(180,230,255,.12) 60%, rgba(255,255,255,.55) 78%, rgba(255,255,255,.08) 100%);
  border: 1px solid rgba(255,255,255,.7); }
.decor .chrome { position: absolute; bottom: -140px; border-radius: 50%; animation: rise linear infinite; display: none; opacity: .5;
  background: radial-gradient(circle at 30% 30%, #fff 0 4%, #9aa3ab 18%, #2a2f35 60%, #0b0d10 100%);
  border: 1px solid rgba(255,255,255,.3); }
[data-theme="aero"] .decor .bub { display: block; }
[data-theme="dark"] .decor .chrome { display: block; }
@keyframes rise { from { transform: translateY(0); } to { transform: translateY(-125vh); } }

/* Falling petals for the cherry blossom theme. Built by app.js. */
#petals { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; display: none; }
[data-theme="blossom"] #petals { display: block; }
.petal { position: absolute; top: -40px; border-radius: 80% 0 80% 0; background: linear-gradient(135deg, #ffe4ec, #ffa9c3); opacity: .85;
  animation: petal-fall linear infinite; }
@keyframes petal-fall {
  0%   { transform: translate(0, -5vh) rotate(0deg); }
  50%  { transform: translate(40px, 50vh) rotate(180deg); }
  100% { transform: translate(-30px, 110vh) rotate(360deg); }
}

/* XP: the Bliss wallpaper is the whole background, so the decor layer stays off */
[data-theme="xp"] .decor { display: none; }
[data-theme="modern"] .decor { display: none; }

/* ---------- Modern dark ---------- */
[data-theme="moderndark"] {
  --bg-image: linear-gradient(#0b0d12, #0b0d12);
  --panel: #14171f; --panel-solid: #171b24; --panel-edge: #2a303c;
  --panel-shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
  --card: #171b24;
  --text: #e5e7eb; --text-dim: #9aa3b2;
  --accent: #3b82f6; --accent2: #60a5fa; --accent-soft: rgba(59,130,246,.18); --on-accent: #ffffff;
  --ok: #22c55e; --bad: #ef4444; --warn: #f59e0b;
  --bar: #14171f; --bar-text: #e5e7eb; --bar-edge: #2a303c;
  --btn: #1d2230; --btn-text: #e5e7eb; --btn-edge: #353d4d; --btn-shine: 0;
  --go: #3b82f6; --go-edge: #2563eb; --go-text: #ffffff;
  --warnb: #ea580c; --warnb-edge: #c2410c; --warnb-text: #ffffff;
  --danger: #dc2626; --danger-edge: #991b1b; --danger-text: #ffffff;
  --note: #facc15; --note-text: #422006; --note-edge: #ca8a04;
  --field: #0f1218; --field-edge: #353d4d; --field-text: #e5e7eb;
  --track: #2a303c; --fill: #3b82f6;
  --thumb: radial-gradient(circle at 50% 50%, #ffffff 0, #cbd5e1 55%, #64748b 100%); --thumb-edge: #94a3b8;
  --display: #05070b; --display-edge: #2a303c; --line: #60a5fa; --line2: #fbbf24;
  --radius: 12px; --radius-sm: 10px; --radius-xs: 8px;
  --font-head: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%23e5e7eb'/></svg>");
  --scroll-thumb: #353d4d; --scroll-track: transparent;
  --tag-on: rgba(34,197,94,.18); --tag-off: rgba(245,158,11,.16); --tag-edge-on: #22c55e; --tag-edge-off: #f59e0b;
  --math-bg: #10131a; --math-edge: #2a303c;
  --c-root: #60a5fa; --c-ratio: #fb923c; --c-hz: #4ade80; --c-beat: #c084fc;
  --glow: rgba(59,130,246,.35);
  --shape-fill: rgba(59,130,246,.2);
}
[data-theme="moderndark"] { --canvas-bg: #0b0d12; --step-dark: #1d4ed8; --step-dark-text: #ffffff; }
[data-theme="moderndark"] .decor { display: none; }

/* ---------- Synthwave (night grid, neon pink and cyan) ---------- */
[data-theme="synth"] {
  --bg-image: linear-gradient(#14072a 0%, #2a0d4a 55%, #3b0f4f 100%);
  --panel: rgba(36,14,66,.92); --panel-solid: #240e42; --panel-edge: #6b2fa0;
  --panel-shadow: 0 0 0 1px rgba(255,62,165,.12), 0 8px 26px rgba(0,0,0,.45);
  --card: #2d1250;
  --text: #f6e9ff; --text-dim: #b99ad6;
  --accent: #ff3ea5; --accent2: #36f1ff; --accent-soft: rgba(255,62,165,.18); --on-accent: #ffffff;
  --ok: #3dffb0; --bad: #ff4d6d; --warn: #ffb703;
  --bar: #1d0a36; --bar-text: #f6e9ff; --bar-edge: #6b2fa0;
  --btn: #2d1250; --btn-text: #f6e9ff; --btn-edge: #7a3bb8; --btn-shine: 0;
  --go: #ff3ea5; --go-edge: #c2187a; --go-text: #ffffff;
  --warnb: #ffb703; --warnb-edge: #c98a00; --warnb-text: #2a1500;
  --danger: #ff4d6d; --danger-edge: #b0203b; --danger-text: #ffffff;
  --note: #ffe66d; --note-text: #3b2a00; --note-edge: #c9a500;
  --field: #1a0836; --field-edge: #7a3bb8; --field-text: #f6e9ff;
  --track: #3a1a5c; --fill: #36f1ff;
  --thumb: radial-gradient(circle at 50% 50%, #ffffff 0, #ff9fd3 55%, #ff3ea5 100%); --thumb-edge: #c2187a;
  --display: #0a0218; --display-edge: #6b2fa0; --line: #36f1ff; --line2: #ff3ea5;
  --radius: 10px; --radius-sm: 8px; --radius-xs: 6px;
  --font-head: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%23f6e9ff'/></svg>");
  --scroll-thumb: #7a3bb8; --scroll-track: transparent;
  --tag-on: rgba(61,255,176,.16); --tag-off: rgba(255,183,3,.14); --tag-edge-on: #3dffb0; --tag-edge-off: #ffb703;
  --math-bg: #1d0a36; --math-edge: #6b2fa0;
  --c-root: #ff3ea5; --c-ratio: #ffb703; --c-hz: #36f1ff; --c-beat: #b388ff;
  --glow: rgba(255,62,165,.5);
  --shape-fill: rgba(54,241,255,.16);
}
[data-theme="synth"] { --canvas-bg: #14072a; --step-dark: #c2187a; --step-dark-text: #ffffff; }
[data-theme="synth"] .decor .synth { display: block; }
.decor .synth.bgimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .85; }

/* ---------- Forest (moss, bark and lantern light) ---------- */
[data-theme="forest"] {
  --bg-image: linear-gradient(#0d1a12 0%, #14291c 60%, #1b3523 100%);
  --panel: rgba(23,41,28,.94); --panel-solid: #17291c; --panel-edge: #3c6b47;
  --panel-shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 22px rgba(0,0,0,.35);
  --card: #1c3322;
  --text: #e6f2e0; --text-dim: #9bb89a;
  --accent: #6fbf73; --accent2: #c8e6a0; --accent-soft: rgba(111,191,115,.18); --on-accent: #0d1a12;
  --ok: #8bd17c; --bad: #e0695a; --warn: #e0b050;
  --bar: #112218; --bar-text: #e6f2e0; --bar-edge: #3c6b47;
  --btn: #1c3322; --btn-text: #e6f2e0; --btn-edge: #3c6b47; --btn-shine: 0;
  --go: #4f9d4a; --go-edge: #36722f; --go-text: #ffffff;
  --warnb: #b5763a; --warnb-edge: #7e4f22; --warnb-text: #ffffff;
  --danger: #c44a3a; --danger-edge: #8a2f22; --danger-text: #ffffff;
  --note: #e0c47a; --note-text: #3a2a08; --note-edge: #b49340;
  --field: #0f1f15; --field-edge: #3c6b47; --field-text: #e6f2e0;
  --track: #24402b; --fill: #6fbf73;
  --thumb: radial-gradient(circle at 50% 50%, #f4ffe8 0, #c8e6a0 55%, #6fbf73 100%); --thumb-edge: #4f9d4a;
  --display: #08120c; --display-edge: #3c6b47; --line: #8bd17c; --line2: #e0b050;
  --radius: 12px; --radius-sm: 10px; --radius-xs: 8px;
  --font-head: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%23e6f2e0'/></svg>");
  --scroll-thumb: #3c6b47; --scroll-track: transparent;
  --tag-on: rgba(139,209,124,.16); --tag-off: rgba(224,176,80,.14); --tag-edge-on: #8bd17c; --tag-edge-off: #e0b050;
  --math-bg: #112218; --math-edge: #3c6b47;
  --c-root: #8bd17c; --c-ratio: #e0b050; --c-hz: #c8e6a0; --c-beat: #d9a06b;
  --glow: rgba(111,191,115,.4);
  --shape-fill: rgba(111,191,115,.18);
}
[data-theme="forest"] { --canvas-bg: #0d1a12; --step-dark: #36722f; --step-dark-text: #ffffff; }
[data-theme="forest"] .decor .forest { display: block; }
.decor .forest.tree { width: 380px; height: 470px; opacity: .9; }
.decor .forest.tree svg { width: 100%; height: 100%; display: block; }
.decor .forest.f1 { left: -110px; bottom: -70px; }
.decor .forest.f2 { right: -120px; bottom: -90px; transform: scaleX(-1); }

/* ---------- Sunflower (warm yellow, brown and cream) ---------- */
[data-theme="sunflower"] {
  --bg-image: linear-gradient(#fff9dc 0%, #ffeeab 60%, #ffe38a 100%);
  --panel: rgba(255,252,236,.95); --panel-solid: #fffcec; --panel-edge: #e9c24a;
  --panel-shadow: 0 1px 2px rgba(122,75,0,.12), 0 6px 18px rgba(122,75,0,.12);
  --card: #fffbe6;
  --text: #3d2a00; --text-dim: #7a5f2a;
  --accent: #e8a400; --accent2: #7a4b00; --accent-soft: rgba(232,164,0,.2); --on-accent: #3d2a00;
  --ok: #5c8a2a; --bad: #c9402b; --warn: #e8a400;
  --bar: #ffe27a; --bar-text: #3d2a00; --bar-edge: #e9c24a;
  --btn: #fff6cc; --btn-text: #3d2a00; --btn-edge: #d9a92b; --btn-shine: 0;
  --go: #f2b705; --go-edge: #b98600; --go-text: #3d2a00;
  --warnb: #7a4b00; --warnb-edge: #4f3000; --warnb-text: #ffffff;
  --danger: #c9402b; --danger-edge: #8f2a1a; --danger-text: #ffffff;
  --note: #fff0b3; --note-text: #3d2a00; --note-edge: #d9a92b;
  --field: #fffdf3; --field-edge: #d9a92b; --field-text: #3d2a00;
  --track: #f6e3a1; --fill: #e8a400;
  --thumb: radial-gradient(circle at 50% 50%, #ffffff 0, #ffe38a 55%, #e8a400 100%); --thumb-edge: #b98600;
  --display: #4a3300; --display-edge: #b98600; --line: #e8a400; --line2: #7a4b00;
  --radius: 14px; --radius-sm: 10px; --radius-xs: 8px;
  --font-head: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --font-body: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: Consolas, "Courier New", monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%233d2a00'/></svg>");
  --scroll-thumb: #d9a92b; --scroll-track: transparent;
  --tag-on: rgba(92,138,42,.16); --tag-off: rgba(232,164,0,.16); --tag-edge-on: #5c8a2a; --tag-edge-off: #e8a400;
  --math-bg: #fff3c2; --math-edge: #e9c24a;
  --c-root: #e8a400; --c-ratio: #7a4b00; --c-hz: #5c8a2a; --c-beat: #c9402b;
  --glow: rgba(232,164,0,.45);
  --shape-fill: rgba(232,164,0,.2);
}
[data-theme="sunflower"] { --canvas-bg: #fff9dc; --step-dark: #b98600; --step-dark-text: #ffffff; }
[data-theme="sunflower"] .decor { display: none; }

/* ---------- Monochrome (black, white and grey, sharp edges) ---------- */
[data-theme="mono"] {
  --bg-image: #f2f2f2;
  --panel: #ffffff; --panel-solid: #ffffff; --panel-edge: #111111;
  --panel-shadow: none;
  --card: #fafafa;
  --text: #111111; --text-dim: #555555;
  --accent: #111111; --accent2: #666666; --accent-soft: rgba(17,17,17,.1); --on-accent: #ffffff;
  --ok: #2f7d32; --bad: #b00000; --warn: #888888;
  --bar: #111111; --bar-text: #ffffff; --bar-edge: #111111;
  --btn: #ffffff; --btn-text: #111111; --btn-edge: #111111; --btn-shine: 0;
  --go: #111111; --go-edge: #000000; --go-text: #ffffff;
  --warnb: #6b6b6b; --warnb-edge: #3d3d3d; --warnb-text: #ffffff;
  --danger: #b00000; --danger-edge: #6b0000; --danger-text: #ffffff;
  --note: #e6e6e6; --note-text: #111111; --note-edge: #111111;
  --field: #ffffff; --field-edge: #111111; --field-text: #111111;
  --track: #dddddd; --fill: #111111;
  --thumb: #111111; --thumb-edge: #000000;
  --display: #111111; --display-edge: #111111; --line: #111111; --line2: #888888;
  --radius: 2px; --radius-sm: 2px; --radius-xs: 2px;
  --font-head: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Courier New", Courier, monospace;
  --chev: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M0 0h10L5 6z' fill='%23111111'/></svg>");
  --scroll-thumb: #111111; --scroll-track: transparent;
  --tag-on: #111111; --tag-off: #dddddd; --tag-edge-on: #111111; --tag-edge-off: #888888;
  --math-bg: #f5f5f5; --math-edge: #111111;
  --c-root: #111111; --c-ratio: #555555; --c-hz: #111111; --c-beat: #b00000;
  --glow: rgba(0,0,0,.2);
  --shape-fill: rgba(17,17,17,.1);
}
[data-theme="mono"] { --canvas-bg: #ffffff; --step-dark: #111111; --step-dark-text: #ffffff; }
[data-theme="mono"] .decor { display: none; }
