create-pmos 0.441.0 → 0.442.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/package.json +13 -13
  2. package/payload/KIT-VERSION +1 -1
  3. package/payload/planning/evals/eval-calibration.md +1 -1
  4. package/payload/planning/okrs/health-budgets.md +1 -1
  5. package/payload/state/discoveries.md +1 -1
  6. package/workspace/adler-seasons-art-test.js +106 -0
  7. package/workspace/adler-seasons-test.js +111 -0
  8. package/workspace/briefing-premium-board-test.js +19 -17
  9. package/workspace/briefing-premium-initiative-test.js +7 -4
  10. package/workspace/changelog.json +12 -0
  11. package/workspace/guide/adler.md +10 -0
  12. package/workspace/guide/home.md +2 -0
  13. package/workspace/ini-workflow-test.js +6 -2
  14. package/workspace/lib/settings-store.js +38 -0
  15. package/workspace/metric-drafts-ui-test.js +2 -2
  16. package/workspace/package-lock.json +2 -2
  17. package/workspace/package.json +1 -1
  18. package/workspace/premium-board-actions-test.js +2 -1
  19. package/workspace/premium-chat-attach-test.js +2 -0
  20. package/workspace/program-panel-test.js +1 -1
  21. package/workspace/public/pm/bd-ini-panel.js +2 -2
  22. package/workspace/public/pm/c3-ini-ui.js +1 -1
  23. package/workspace/public/pm/cozy-adler.css +21 -0
  24. package/workspace/public/pm/cozy-adler.js +415 -8
  25. package/workspace/public/pm/cozy-ev.css +16 -1
  26. package/workspace/public/pm/cozy-home.css +8 -0
  27. package/workspace/public/pm/cozy-news.js +1 -1
  28. package/workspace/public/pm/cozy-seasons.js +318 -0
  29. package/workspace/public/pm/cozy-settings.js +88 -5
  30. package/workspace/public/pm/cozy-viewer.js +8 -4
  31. package/workspace/public/pm/cozy.css +65 -0
  32. package/workspace/public/pm/dash-view.js +4 -2
  33. package/workspace/public/pm/home-app.js +8 -2
  34. package/workspace/public/pm/home-chat.js +1 -1
  35. package/workspace/public/pm/home-day.js +7 -4
  36. package/workspace/public/pm/home-ini.js +2 -2
  37. package/workspace/public/pm/home-mentions.js +1 -1
  38. package/workspace/public/pm/impact.js +1 -1
  39. package/workspace/public/pm/ini-groups.js +15 -10
  40. package/workspace/public/pm/ini-links.js +1 -1
  41. package/workspace/public/pm/ini-tasks.js +208 -44
  42. package/workspace/public/pm/ini-view-model.js +8 -2
  43. package/workspace/public/pm/ini-view.css +305 -1
  44. package/workspace/public/pm/ini-view.js +190 -80
  45. package/workspace/public/pm/mission.js +234 -0
  46. package/workspace/public/pm/premium-board.js +1 -1
  47. package/workspace/public/pm/premium-welcome.js +2 -2
  48. package/workspace/public/pm/split-merge.js +1 -1
  49. package/workspace/public/pm/stage-line.js +2 -2
  50. package/workspace/split-merge-ui-test.js +1 -1
  51. package/workspace/stage-card-test.js +48 -11
  52. package/workspace/task-links-test.js +2 -0
  53. package/workspace/task-milestones-test.js +5 -1
  54. package/workspace/task-plans-test.js +3 -3
  55. package/workspace/task-views-test.js +90 -37
  56. package/workspace/test-lists/adler-seasons-art.json +13 -0
  57. package/workspace/test-lists/batch18-adler-seasons.json +13 -0
  58. package/workspace/test-lists/mission.json +5 -0
  59. package/workspace/test-lists/viewer-tasks.json +5 -0
  60. package/workspace/tk-tasks-test.js +25 -30
@@ -113,19 +113,298 @@ function body(p) {
113
113
  const strings = (p) => `<path d="M90 160 L88 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="88" cy="184" r="3" fill="url(#${p}c)"/><path d="M110 160 L112 182" class="${S('creamhi')}" stroke-width="3" stroke-linecap="round"/><circle cx="112" cy="184" r="3" fill="url(#${p}c)"/>`;
114
114
  const mug = () => `<rect x="86" y="190" width="30" height="30" rx="7" class="${F('mug')}" stroke="${L_HOOD}" stroke-width="2.5"/><path d="M116 197 C 125 197, 125 212, 116 212" fill="none" stroke="${L_HOOD}" stroke-width="3"/><path d="M101 198 C 95 204, 97 212, 101 214 C 105 212, 107 204, 101 198Z" class="${F('mugleaf')}"/>`;
115
115
  const sparkles = () => [[26, 60, 7], [176, 52, 6], [20, 150, 5], [182, 150, 5]].map(([x, y, r]) => `<path d="M${x} ${y - r} L${x + r * 0.3} ${y - r * 0.3} L${x + r} ${y} L${x + r * 0.3} ${y + r * 0.3} L${x} ${y + r} L${x - r * 0.3} ${y + r * 0.3} L${x - r} ${y} L${x - r * 0.3} ${y - r * 0.3}Z" class="${F('gold')}"/>`).join('');
116
- function full(m, p, prop) {
116
+ // c: the charm he wears ({ ch, colors }, dressed() below), or nothing
117
+ function full(m, p, prop, c) {
117
118
  let g = body(p);
118
119
  if (m === 'calm' || m === 'rest') {
119
- g += head(m, p, prop) + strings(p) + capsule(64, 176, 80, 206, 22, p) + capsule(136, 176, 122, 206, 22, p) + paw(82, 210, p, 9) + paw(120, 210, p, 9) + mug();
120
- return g;
120
+ const held = c && c.ch.held ? c.ch.held(c.colors) : '';
121
+ g += head(m, p, prop) + strings(p) + capsule(64, 176, 80, 206, 22, p) + capsule(136, 176, 122, 206, 22, p) + paw(82, 210, p, 9) + paw(120, 210, p, 9) + (held || mug());
122
+ return g + wear(m, prop, c);
121
123
  }
122
124
  if (m === 'joy') g += sparkles();
123
125
  g += head(m, p, prop) + strings(p) + POSES[m].map(([a, b]) => capsule(a[0], a[1], b[0], b[1], 22, p) + paw(b[0], b[1], p)).join('');
124
126
  // AdU4: a magnifier in the raised paw when nothing is found; otherwise "needs you" holds up one card with a tick
125
127
  if (m === 'ask' && prop === 'magnifier') g += `<path d="M150 118 L140 132" class="${S('glass')}" stroke-width="6" stroke-linecap="round"/><circle cx="162" cy="104" r="17" class="${F('lens')} ${S('glass')}" stroke-width="5"/>` + paw(146, 128, p);
126
128
  else if (m === 'ask') g += `<g transform="rotate(10 168 110)"><rect x="152" y="88" width="34" height="40" rx="6" class="${F('white')} ${S('cardline')}" stroke-width="2"/><path d="M160 106 l5 5 l10 -11" fill="none" class="${S('tick')}" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"/></g>` + paw(162, 128, p);
129
+ return g + wear(m, prop, c);
130
+ }
131
+
132
+ /* ── Adler dressed for the season (feedback batch 18 item 8-B; canvas frames AsMoods, AsPlaces, AsSet2Tap, AsC_*; ported from
133
+ * adler-character/seasons-b/charms.py). A charm is what he wears or holds on a festival, a season or a day of his own: a head charm, a neck
134
+ * charm, a held charm (in place of the mug when he is handled or resting), one at his feet, and the scene around him. A festival changes what
135
+ * he wears, never his mood. The rules by mood: honest takes the charm off and the scene goes plain; needs you keeps the charm on a plain
136
+ * scene, so the ask leads; resting wears it in the night scene. By size: the S face never wears one, the M face wears head charms only, the
137
+ * L figure and the XL scene wear all of it. A charm never covers his eyes, mouth or sprout. Colours are the --ad-k-* tokens in cozy.css
138
+ * (adk- a fill, adks- a stroke); a scene's sky and ground are --ad-<key>0, --ad-<key>1 and --ad-<key>g. No flags, no religious dress, no
139
+ * team, league, film or brand marks. ── */
140
+ const K = (k) => `adk-${k}`, KS = (k) => `adks-${k}`;
141
+ const r1 = (v) => Math.round(v * 10) / 10;
142
+ const tw = (i) => (i % 3 ? ' d' + (i % 3 + 1) : '');
143
+
144
+ // head charms (head coordinates: the same on the M face and the L figure)
145
+ const partyHat = (c1 = 'gold15', c2 = 'orange1') => `<g transform="rotate(24 128 40)"><path d="M114 46 L128 4 L142 46 Z" class="${K(c1)}"/><path d="M118 34 L138 34 M121 24 L135 24 M124 14 L132 14" class="${KS(c2)}" stroke-width="3.2" stroke-linecap="round"/>`
146
+ + `<path d="M114 46 L128 4 L124 46Z" class="${K('white')}" opacity=".18"/><ellipse cx="128" cy="46" rx="15" ry="4" class="${K('gold18')}"/><circle cx="128" cy="4" r="5.5" class="${K(c2)}"/></g>`;
147
+ const beanie = (c = 'red7', band = 'paper2', pom = 'paper2') => `<path d="M40 66 C 42 30, 158 30, 160 66 Z" class="${K(c)}"/><path d="M58 44 C 70 36, 86 33, 96 33" class="${KS('white')}" stroke-width="5" opacity=".22" fill="none" stroke-linecap="round"/>`
148
+ + `<path d="M70 42 L70 60 M86 37 L86 60 M114 37 L114 60 M130 42 L130 60" stroke="rgba(0,0,0,.08)" stroke-width="3"/><rect x="36" y="56" width="128" height="14" rx="7" class="${K(band)}"/><circle cx="146" cy="34" r="10" class="${K(pom)}"/>`;
149
+ const helmet = () => `<circle cx="100" cy="92" r="88" class="${K('paper3')}" opacity=".16"/><circle cx="100" cy="92" r="88" fill="none" class="${KS('blue1')}" stroke-width="5"/>`
150
+ + `<path d="M38 52 C 52 26, 80 12, 108 12" class="${KS('white')}" stroke-width="7" fill="none" stroke-linecap="round" opacity=".7"/><path d="M150 150 C 160 140, 168 126, 172 112" class="${KS('white')}" stroke-width="4" fill="none" stroke-linecap="round" opacity=".45"/>`
151
+ + `<path d="M36 156 C 70 176, 130 176, 164 156 L 160 170 C 128 188, 72 188, 40 170Z" class="${K('paper7')} ${KS('blue4')}" stroke-width="2"/>`;
152
+ const sunHat = () => `<ellipse cx="100" cy="50" rx="86" ry="15" class="${K('gold12')}"/><path d="M58 50 C 60 22, 140 22, 142 50 Z" class="${K('gold9')}"/><path d="M58 46 C 80 52, 120 52, 142 46 L142 50 C 120 56, 80 56, 58 50Z" class="${K('green3')}"/>`
153
+ + `<path d="M24 52 C 60 62, 140 62, 176 52" class="${KS('gold16')}" stroke-width="2" fill="none" opacity=".6"/>`;
154
+ const hardHat = () => `<path d="M46 62 C 48 30, 152 30, 154 62 Z" class="${K('gold14')}"/><path d="M96 32 L104 32 L104 62 L96 62Z" class="${K('gold17')}"/><rect x="36" y="58" width="128" height="10" rx="5" class="${K('gold17')}"/>`
155
+ + `<path d="M62 44 C 70 38, 82 35, 90 35" class="${KS('white')}" stroke-width="4" opacity=".35" fill="none" stroke-linecap="round"/>`;
156
+ const headband = (c = 'blue10') => `<path d="M34 64 C 60 50, 140 50, 166 64 L 166 76 C 140 62, 60 62, 34 76Z" class="${K(c)}"/><path d="M40 66 C 64 56, 136 56, 160 66" class="${KS('white')}" stroke-width="2" opacity=".5" fill="none"/>`;
157
+ const pencil = () => `<g transform="rotate(-38 150 62)"><rect x="128" y="57" width="44" height="9" rx="2" class="${K('gold14')}"/><path d="M172 57 L182 61.5 L172 66Z" class="${K('gold9')}"/><path d="M178 59.6 L182 61.5 L178 63.4Z" class="${K('brown4')}"/>`
158
+ + `<rect x="122" y="57" width="7" height="9" rx="2" class="${K('orange1')}"/></g>`;
159
+ const mimosa = () => `<path d="M52 58 C 42 46, 36 36, 34 26" class="${KS('green3')}" stroke-width="2.5" fill="none"/>` + [[34, 26], [40, 32], [31, 34], [44, 40], [37, 44], [47, 48]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="4.5" class="${K('gold14')}"/>`).join('');
160
+
161
+ // neck charms
162
+ function scarf(c1, c2, chequer) {
163
+ let s = `<path d="M46 148 C 70 170, 130 170, 154 148 L 156 162 C 130 186, 70 186, 44 162Z" class="${K(c1)}"/><path d="M62 166 L 58 206 C 64 208, 72 208, 78 206 L 80 170Z" class="${K(c1)}"/>`;
164
+ if (c2 && !chequer) s += `<path d="M48 154 C 72 174, 128 174, 152 154" class="${KS(c2)}" stroke-width="4" fill="none"/><path d="M60 190 L 79 190 M59 198 L 78 198" class="${KS(c2)}" stroke-width="3.5"/>`;
165
+ if (chequer) {
166
+ for (let i = 0; i < 5; i++) for (let j = 0; j < 3; j++) if ((i + j) % 2 === 0) s += `<rect x="${r1(59 + j * 6.5)}" y="${172 + i * 7}" width="6.5" height="7" class="${K(c2)}"/>`;
167
+ for (let i = 0; i < 12; i += 2) s += `<rect x="${52 + i * 8}" y="${r1(160 + Math.abs(6 - i) * 0.6)}" width="8" height="7" class="${K(c2)}" opacity=".9"/>`;
168
+ }
169
+ return s + `<path d="M58 206 L 57 212 M64 207 L 64 213 M71 207 L 71 213 M77 206 L 78 212" class="${KS(c1)}" stroke-width="2.5" stroke-linecap="round"/>`;
170
+ }
171
+
172
+ // held charms (figure coordinates: in the paws, where the mug is)
173
+ const diya = () => `<ellipse class="env-glow ${K('amber1')}" cx="101" cy="192" rx="16" ry="18" opacity=".55"/><path d="M82 206 C 85 222, 117 222, 120 206 Z" class="${K('orange4')}"/><ellipse cx="101" cy="206" rx="19" ry="5" class="${K('brown1')}"/>`
174
+ + `<path d="M118 205 L127 201 L121 208Z" class="${K('orange4')}"/><path d="M88 214 C 96 217, 106 217, 114 214" class="${KS('gold14')}" stroke-width="2" fill="none"/>`
175
+ + `<path d="M101 184 C 95 193, 96 201, 101 204 C 106 201, 107 193, 101 184Z" class="${K('amber3')}"/><path d="M101 191 C 99 196, 99 200, 101 202 C 103 200, 103 196, 101 191Z" class="${K('gold1')}"/>`;
176
+ const mooncake = () => Array.from({ length: 10 }, (_, a) => `<circle cx="${r1(101 + 16 * Math.cos(a * Math.PI / 5))}" cy="${r1(205 + 16 * Math.sin(a * Math.PI / 5))}" r="4" class="${K('amber9')}"/>`).join('')
177
+ + `<circle cx="101" cy="205" r="16" class="${K('amber6')}"/><circle cx="101" cy="205" r="11" fill="none" class="${KS('amber10')}" stroke-width="2"/>`
178
+ + `<path d="M95 205 C 98 199, 104 199, 107 205 C 104 211, 98 211, 95 205Z" class="${K('amber10')}" opacity=".7"/><ellipse cx="95" cy="198" rx="6" ry="3" class="${K('white')}" opacity=".25"/>`;
179
+ const mandarins = () => [[90, 208], [112, 210]].map(([cx, cy]) => `<circle cx="${cx}" cy="${cy}" r="11.5" class="${K('amber4')}"/><ellipse cx="${cx - 4}" cy="${cy - 5}" rx="4" ry="2.5" class="${K('white')}" opacity=".35"/>`
180
+ + `<path d="M${cx} ${cy - 11} c 4 -6 10 -6 12 -3 c -4 3 -8 4 -12 3z" class="${K('green7')}"/>`).join('');
181
+ const stickLantern = (c = 'red6') => `<path d="M118 212 L150 148" class="${KS('brown2')}" stroke-width="3" stroke-linecap="round"/><path d="M150 148 L156 140" class="${KS('brown2')}" stroke-width="2"/>`
182
+ + `<ellipse class="env-glow ${K('amber1')}" cx="158" cy="152" rx="22" ry="20" opacity=".45"/><ellipse cx="158" cy="152" rx="16" ry="14" class="${K(c)}"/><path d="M146 146 C 154 142, 162 142, 170 146" class="${KS('gold14')}" stroke-width="1.6" fill="none" opacity=".8"/>`
183
+ + `<path d="M158 138 L158 166 M150 140 C 146 150, 146 156, 150 164 M166 140 C 170 150, 170 156, 166 164" class="${KS('red10')}" stroke-width="1.4" fill="none"/>`
184
+ + `<rect x="152" y="136" width="12" height="4" rx="1" class="${K('gold15')}"/><rect x="152" y="164" width="12" height="4" rx="1" class="${K('gold15')}"/><path d="M158 168 L158 178" class="${KS('gold15')}" stroke-width="2"/>`;
185
+ const ketupat = (x = 101, y = 204, s = 1) => `<g transform="translate(${x} ${y}) scale(${s}) rotate(45)"><rect x="-13" y="-13" width="26" height="26" rx="3" class="${K('green1')}"/>`
186
+ + `<path d="M-13 -4 L13 -4 M-13 5 L13 5 M-4 -13 L-4 13 M5 -13 L5 13" class="${KS('green6')}" stroke-width="2.4"/><path d="M-13 -13 L-6 -13 L-13 -6Z" class="${K('white')}" opacity=".25"/></g>`
187
+ + `<path d="M${r1(x + 14 * s)} ${r1(y + 12 * s)} q 6 10 2 18 M${r1(x + 10 * s)} ${r1(y + 16 * s)} q 2 10 -4 16" class="${KS('green1')}" stroke-width="${r1(3 * s)}" fill="none" stroke-linecap="round"/>`;
188
+ function lotus(x = 101, y = 206, s = 1, glow = true) {
189
+ let g = glow ? `<ellipse class="env-glow ${K('gold6')}" cx="${x}" cy="${r1(y - 6 * s)}" rx="${r1(20 * s)}" ry="${r1(16 * s)}" opacity=".5"/>` : '';
190
+ g += `<ellipse cx="${x}" cy="${r1(y + 8 * s)}" rx="${r1(19 * s)}" ry="${r1(5 * s)}" class="${K('green3')}"/>`;
191
+ const b = r1(y + 6 * s);
192
+ for (const a of [-60, -30, 0, 30, 60]) g += `<path transform="rotate(${a} ${x} ${b})" d="M${x} ${b} C ${r1(x - 8 * s)} ${r1(y - 4 * s)}, ${r1(x - 5 * s)} ${r1(y - 14 * s)}, ${x} ${r1(y - 18 * s)} C ${r1(x + 5 * s)} ${r1(y - 14 * s)}, ${r1(x + 8 * s)} ${r1(y - 4 * s)}, ${x} ${b}Z" class="${K(a ? 'red1' : 'red2')} ${KS('red3')}" stroke-width="1"/>`;
127
193
  return g;
128
194
  }
195
+ const popcorn = () => [[90, 192], [100, 187], [110, 191], [95, 182], [106, 181], [86, 186], [115, 185]].map(([x, y]) => `<circle cx="${x}" cy="${y}" r="7" class="${K('paper8')}"/>`).join('')
196
+ + `<path d="M85 196 L117 196 L112 224 L90 224 Z" class="${K('white')}"/>` + [88, 98.5, 109].map((x) => `<path d="M${x} 196 L${r1(x + 1.2)} 224 L${r1(x + 6.5)} 224 L${r1(x + 5.6)} 196Z" class="${K('red6')}"/>`).join('');
197
+ const egg = () => `<ellipse cx="101" cy="204" rx="13" ry="16" class="${K('blue3')}"/><path d="M88 204 l5 -5 l5 5 l5 -5 l5 5 l5 -5 l1 2" class="${KS('red2')}" stroke-width="3" fill="none" stroke-linejoin="round"/>`
198
+ + `<path d="M89 211 C 96 214, 106 214, 113 211" class="${KS('gold14')}" stroke-width="2.4" fill="none"/><ellipse cx="96" cy="196" rx="4" ry="6" class="${K('white')}" opacity=".35"/>`;
199
+ const zongzi = () => `<path d="M86 218 L101 188 L116 218 Z" class="${K('green4')} ${KS('green8')}" stroke-width="2" stroke-linejoin="round"/>`
200
+ + `<path d="M94 202 L108 202 M90 210 L112 210" class="${KS('amber7')}" stroke-width="2.4"/><path d="M101 188 L96 218" class="${KS('green8')}" stroke-width="1.4" opacity=".6"/>`;
201
+ const pie = (x = 101, y = 206) => `<path d="M${x - 18} ${y + 8} L${x + 16} ${y + 8} L${x + 12} ${y - 6} Z" class="${K('amber2')}"/><path d="M${x - 18} ${y + 8} L${x + 12} ${y - 6} L${x + 16} ${y + 8}" fill="none" class="${KS('amber8')}" stroke-width="3" stroke-linejoin="round"/>`
202
+ + `<path d="M${x - 14} ${y + 6} L${x + 12} ${y - 3}" class="${KS('orange6')}" stroke-width="2" opacity=".6"/>`;
203
+ const wateringCan = () => `<path d="M84 196 L112 196 L114 222 L82 222Z" class="${K('blue8')}"/><path d="M112 200 L132 186 L134 190 L114 208Z" class="${K('blue8')}"/>`
204
+ + `<ellipse cx="134" cy="187" rx="4" ry="5" class="${K('blue11')}"/><path d="M86 196 C 86 182, 110 182, 110 196" class="${KS('blue11')}" stroke-width="4" fill="none"/><ellipse cx="92" cy="203" rx="4" ry="6" class="${K('white')}" opacity=".3"/>`;
205
+ const pinwheel = () => `<path d="M101 222 L101 182" class="${KS('brown2')}" stroke-width="3" stroke-linecap="round"/>`
206
+ + [[0, 'orange1'], [90, 'green2'], [180, 'blue10'], [270, 'gold14']].map(([a, c]) => `<path transform="rotate(${a} 101 178)" d="M101 178 L101 160 L115 172 Z" class="${K(c)}"/>`).join('') + `<circle cx="101" cy="178" r="3" class="${K('white')}"/>`;
207
+ const apple = () => `<path d="M101 194 C 90 186, 82 196, 85 208 C 88 220, 96 222, 101 218 C 106 222, 114 220, 117 208 C 120 196, 112 186, 101 194Z" class="${K('red6')}"/>`
208
+ + `<path d="M101 194 L103 184" class="${KS('brown3')}" stroke-width="2.4" stroke-linecap="round"/><path d="M103 188 c 6 -6 12 -4 13 -1 c -5 3 -9 3 -13 1z" class="${K('green3')}"/><ellipse cx="92" cy="200" rx="3.5" ry="5" class="${K('white')}" opacity=".3"/>`;
209
+ const cupcake = () => `<path d="M88 206 L114 206 L110 222 L92 222Z" class="${K('red2')}"/><path d="M92 206 L93 222 M98 206 L98.5 222 M104 206 L103.5 222 M110 206 L109 222" class="${KS('red3')}" stroke-width="1.6"/>`
210
+ + `<path d="M86 207 C 84 196, 94 192, 101 194 C 108 192, 118 196, 116 207 Z" class="${K('paper2')}"/><rect x="99.5" y="182" width="3" height="12" rx="1" class="${K('blue10')}"/>`
211
+ + `<ellipse class="env-glow ${K('amber1')}" cx="101" cy="178" rx="6" ry="7" opacity=".6"/><path d="M101 172 C 98 176, 99 180, 101 181 C 103 180, 104 176, 101 172Z" class="${K('amber3')}"/>`;
212
+ const heartMug = () => `<rect x="86" y="190" width="30" height="30" rx="7" class="${K('red3')}"/><path d="M116 197 C 125 197, 125 212, 116 212" fill="none" class="${KS('red4')}" stroke-width="3"/>`
213
+ + `<path d="M101 213 C 92 206, 93 199, 97 199 C 99 199, 100.5 200.5, 101 202 C 101.5 200.5, 103 199, 105 199 C 109 199, 110 206, 101 213Z" class="${K('white')}"/>`;
214
+ const ricePot = () => `<path d="M84 202 C 82 222, 120 222, 118 202 Z" class="${K('orange4')}"/><ellipse cx="101" cy="202" rx="17" ry="5" class="${K('brown1')}"/>`
215
+ + `<path d="M86 200 C 88 188, 96 192, 98 196 C 100 186, 110 188, 110 196 C 114 190, 120 196, 116 202Z" class="${K('paper1')}"/><path d="M86 210 C 96 214, 106 214, 116 210" class="${KS('gold14')}" stroke-width="2.4" fill="none"/>`;
216
+ const tangyuan = () => `<path d="M84 204 C 86 222, 116 222, 118 204 Z" class="${K('white')} ${KS('gold10')}" stroke-width="2"/><ellipse cx="101" cy="204" rx="17" ry="4.5" class="${K('gold2')}"/>`
217
+ + `<circle cx="94" cy="203" r="5" class="${K('white')}"/><circle cx="104" cy="202" r="5" class="${K('red1')}"/><circle cx="110" cy="205" r="4" class="${K('white')}"/><path d="M90 212 L112 212" class="${KS('blue10')}" stroke-width="1.6" opacity=".6"/>`;
218
+
219
+ // charms at his feet (any mood that keeps the charm)
220
+ const football = (x = 162, y = 232, r = 13) => `<circle cx="${x}" cy="${y}" r="${r}" class="${K('white')} ${KS('paper11')}" stroke-width="1.5"/><path d="M${x} ${y - 5} l5 3.6 l-1.9 5.9 h-6.2 l-1.9 -5.9z" class="${K('ink1')}"/>`
221
+ + `<path d="M${x} ${y - 5} L${x} ${y - r} M${x + 5} ${r1(y - 1.4)} L${x + r - 1} ${y - 4} M${r1(x + 3.1)} ${r1(y + 4.5)} L${x + 7} ${y + r - 3} M${r1(x - 3.1)} ${r1(y + 4.5)} L${x - 7} ${y + r - 3} M${x - 5} ${r1(y - 1.4)} L${x - r + 1} ${y - 4}" class="${KS('ink1')}" stroke-width="1.3"/>`
222
+ + `<ellipse cx="${x - 4}" cy="${y - 6}" rx="4" ry="2.5" class="${K('white')}" opacity=".7"/>`;
223
+ const gift = (x = 36, y = 222) => `<rect x="${x - 14}" y="${y}" width="28" height="22" rx="4" class="${K('red7')}"/><rect x="${x - 16}" y="${y - 6}" width="32" height="8" rx="3" class="${K('red5')}"/>`
224
+ + `<rect x="${x - 3}" y="${y - 6}" width="6" height="28" class="${K('gold14')}"/><path d="M${x} ${y - 6} c -10 -10 -16 -2 -10 1 M${x} ${y - 6} c 10 -10 16 -2 10 1" class="${KS('gold14')}" stroke-width="3" fill="none" stroke-linecap="round"/>`;
225
+ const pumpkin = (x = 36, y = 228) => `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${y}" rx="22" ry="18" opacity=".35"/><ellipse cx="${x}" cy="${y}" rx="18" ry="14" class="${K('orange2')}"/>`
226
+ + `<path d="M${x - 7} ${y - 13} C ${x - 12} ${y - 4}, ${x - 12} ${y + 6}, ${x - 7} ${y + 13} M${x + 7} ${y - 13} C ${x + 12} ${y - 4}, ${x + 12} ${y + 6}, ${x + 7} ${y + 13}" class="${KS('orange5')}" stroke-width="2" fill="none"/>`
227
+ + `<path d="M${x} ${y - 14} L${x + 2} ${y - 20}" class="${KS('green7')}" stroke-width="3" stroke-linecap="round"/><circle cx="${x - 6}" cy="${y - 3}" r="2.6" class="${K('gold7')}"/><circle cx="${x + 6}" cy="${y - 3}" r="2.6" class="${K('gold7')}"/>`
228
+ + `<path d="M${x - 7} ${y + 4} Q${x} ${y + 10} ${x + 7} ${y + 4}" class="${KS('gold7')}" stroke-width="2.4" fill="none" stroke-linecap="round"/>`;
229
+ const umbrella = (x = 30, y = 244) => `<g transform="rotate(-12 ${x} ${y})"><path d="M${x} ${y} L${x} ${y - 74}" class="${KS('grey3')}" stroke-width="3"/>`
230
+ + `<path d="M${x - 7} ${y - 20} C ${x - 6} ${y - 50}, ${x - 3} ${y - 66}, ${x} ${y - 74} C ${x + 3} ${y - 66}, ${x + 6} ${y - 50}, ${x + 7} ${y - 20} Z" class="${K('blue10')}"/><path d="M${x} ${y - 74} L${x + 1} ${y - 20}" class="${KS('blue13')}" stroke-width="1.4" opacity=".6"/>`
231
+ + `<path d="M${x} ${y} q 0 8 -7 8 q -6 0 -6 -6" class="${KS('grey3')}" stroke-width="3" fill="none" stroke-linecap="round"/></g>`;
232
+ const clapper = (x = 34, y = 224) => `<rect x="${x - 16}" y="${y}" width="32" height="22" rx="3" class="${K('ink1')}"/><g transform="rotate(-16 ${x - 16} ${y})"><rect x="${x - 16}" y="${y - 8}" width="32" height="8" rx="2" class="${K('ink1')}"/>`
233
+ + Array.from({ length: 4 }, (_, i) => `<path d="M${x - 12 + i * 8} ${y - 8} l5 0 l-3 8 l-5 0z" class="${K('white')}"/>`).join('') + '</g>'
234
+ + `<path d="M${x - 12} ${y + 8} L${x + 12} ${y + 8} M${x - 12} ${y + 14} L${x + 6} ${y + 14}" class="${KS('white')}" stroke-width="1.6" opacity=".7"/>`;
235
+
236
+ // the scenes' parts (scene coordinates: W wide, H high, the ground line at gy)
237
+ const grassS = (x, y, s = 1, d = '') => `<g class="env-sway${d}"><path d="M${r1(x)} ${y} q -3 -${r1(14 * s)} -9 -${r1(20 * s)} M${r1(x)} ${y} q 1 -${r1(18 * s)} 4 -${r1(24 * s)} M${r1(x)} ${y} q 4 -${r1(10 * s)} 11 -${r1(15 * s)}" class="${S('grass')}" stroke-width="2.4" fill="none" stroke-linecap="round"/></g>`;
238
+ const hang = (x, top, len, inner) => `<g class="env-hang"><path d="M${r1(x)} ${top} L${r1(x)} ${top + len}" class="${KS('brown2')}" stroke-width="1.6"/>${inner}</g>`;
239
+ const lanternRound = (x, y, r = 14, c = 'red6') => `<ellipse class="env-glow ${K('amber1')}" cx="${r1(x)}" cy="${y}" rx="${r1(r * 1.5)}" ry="${r1(r * 1.4)}" opacity=".35"/><ellipse cx="${r1(x)}" cy="${y}" rx="${r}" ry="${r1(r * 0.88)}" class="${K(c)}"/>`
240
+ + `<rect x="${r1(x - r * 0.45)}" y="${r1(y - r * 0.98)}" width="${r1(r * 0.9)}" height="${r1(r * 0.24)}" rx="1" class="${K('gold15')}"/><rect x="${r1(x - r * 0.45)}" y="${r1(y + r * 0.75)}" width="${r1(r * 0.9)}" height="${r1(r * 0.24)}" rx="1" class="${K('gold15')}"/>`
241
+ + `<path d="M${r1(x)} ${y + r} L${r1(x)} ${r1(y + r * 1.6)}" class="${KS('gold15')}" stroke-width="2"/>`
242
+ + `<path d="M${r1(x - r * 0.55)} ${r1(y - r * 0.7)} C ${r1(x - r * 0.85)} ${r1(y - r * 0.2)}, ${r1(x - r * 0.85)} ${r1(y + r * 0.2)}, ${r1(x - r * 0.55)} ${r1(y + r * 0.7)} M${r1(x + r * 0.55)} ${r1(y - r * 0.7)} C ${r1(x + r * 0.85)} ${r1(y - r * 0.2)}, ${r1(x + r * 0.85)} ${r1(y + r * 0.2)}, ${r1(x + r * 0.55)} ${r1(y + r * 0.7)}" stroke="rgba(0,0,0,.15)" stroke-width="1.2" fill="none"/>`;
243
+ const lanternCny = (x, y, s = 1) => { x = r1(x); return `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${y}" rx="${r1(30 * s)}" ry="${r1(24 * s)}" opacity=".3"/><rect x="${r1(x - 8 * s)}" y="${r1(y - 22 * s)}" width="${r1(16 * s)}" height="${r1(5 * s)}" rx="1" class="${K('gold18')}"/><ellipse cx="${x}" cy="${y}" rx="${r1(22 * s)}" ry="${r1(18 * s)}" class="${K('red6')}"/>`
244
+ + `<path d="M${r1(x - 10 * s)} ${r1(y - 16 * s)} C ${r1(x - 18 * s)} ${r1(y - 6 * s)}, ${r1(x - 18 * s)} ${r1(y + 6 * s)}, ${r1(x - 10 * s)} ${r1(y + 16 * s)} M${r1(x + 10 * s)} ${r1(y - 16 * s)} C ${r1(x + 18 * s)} ${r1(y - 6 * s)}, ${r1(x + 18 * s)} ${r1(y + 6 * s)}, ${r1(x + 10 * s)} ${r1(y + 16 * s)} M${x} ${r1(y - 18 * s)} L${x} ${r1(y + 18 * s)}" class="${KS('red8')}" stroke-width="${r1(1.6 * s)}" fill="none"/>`
245
+ + `<rect x="${r1(x - 8 * s)}" y="${r1(y + 16 * s)}" width="${r1(16 * s)}" height="${r1(5 * s)}" rx="1" class="${K('gold18')}"/>`
246
+ + `<path d="M${r1(x - 4 * s)} ${r1(y + 21 * s)} L${r1(x - 5 * s)} ${r1(y + 34 * s)} M${x} ${r1(y + 21 * s)} L${x} ${r1(y + 36 * s)} M${r1(x + 4 * s)} ${r1(y + 21 * s)} L${r1(x + 5 * s)} ${r1(y + 34 * s)}" class="${KS('gold15')}" stroke-width="${r1(1.6 * s)}"/>`; };
247
+ const blossom = (x, y, r = 5, c = 'red1') => Array.from({ length: 5 }, (_, a) => `<circle cx="${r1(x + r * Math.cos(a * 2 * Math.PI / 5))}" cy="${r1(y + r * Math.sin(a * 2 * Math.PI / 5))}" r="${r1(r * 0.75)}" class="${K(c)}"/>`).join('') + `<circle cx="${r1(x)}" cy="${r1(y)}" r="${r1(r * 0.45)}" class="${K('gold15')}"/>`;
248
+ const pelita = (x, y, s = 1) => { x = r1(x); y = r1(y); return `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${r1(y - 8 * s)}" rx="${r1(9 * s)}" ry="${r1(11 * s)}" opacity=".55"/><path d="M${r1(x - 6 * s)} ${y} L${r1(x + 6 * s)} ${y} L${r1(x + 4 * s)} ${r1(y - 6 * s)} L${r1(x - 4 * s)} ${r1(y - 6 * s)}Z" class="${K('amber7')}"/>`
249
+ + `<path d="M${x} ${r1(y - 15 * s)} C ${r1(x - 3 * s)} ${r1(y - 10 * s)}, ${r1(x - 3 * s)} ${r1(y - 7 * s)}, ${x} ${r1(y - 6 * s)} C ${r1(x + 3 * s)} ${r1(y - 7 * s)}, ${r1(x + 3 * s)} ${r1(y - 10 * s)}, ${x} ${r1(y - 15 * s)}Z" class="${K('amber3')}"/>`; };
250
+ const smallDiya = (x, y, s = 1) => { x = r1(x); y = r1(y); return `<ellipse class="env-glow ${K('amber1')}" cx="${x}" cy="${r1(y - 9 * s)}" rx="${r1(10 * s)}" ry="${r1(12 * s)}" opacity=".55"/><path d="M${r1(x - 9 * s)} ${r1(y - 3 * s)} C ${r1(x - 7 * s)} ${r1(y + 4 * s)}, ${r1(x + 7 * s)} ${r1(y + 4 * s)}, ${r1(x + 9 * s)} ${r1(y - 3 * s)}Z" class="${K('orange4')}"/>`
251
+ + `<path d="M${x} ${r1(y - 14 * s)} C ${r1(x - 3 * s)} ${r1(y - 9 * s)}, ${r1(x - 3 * s)} ${r1(y - 5 * s)}, ${x} ${r1(y - 4 * s)} C ${r1(x + 3 * s)} ${r1(y - 5 * s)}, ${r1(x + 3 * s)} ${r1(y - 9 * s)}, ${x} ${r1(y - 14 * s)}Z" class="${K('amber3')}"/>`; };
252
+ // the crescent is a moon with the sky's own colour laid over it (bg: the sky's top colour)
253
+ const crescent = (x, y, r, bg) => `<circle cx="${r1(x)}" cy="${y}" r="${r}" class="${K('gold4')}"/><circle cx="${r1(x + r * 0.45)}" cy="${r1(y - r * 0.25)}" r="${r1(r * 0.9)}" class="${K(bg)}"/>`;
254
+ const stars = (pts, c = 'gold4') => pts.map(([x, y, r], i) => `<circle class="env-tw${tw(i)} ${K(c)}" cx="${r1(x)}" cy="${r1(y)}" r="${r}"/>`).join('');
255
+ function stringLights(W, y, cols, sag = 16) {
256
+ let s = `<path d="M0 ${y} Q ${r1(W / 4)} ${y + sag} ${r1(W / 2)} ${y} Q ${r1(3 * W / 4)} ${y + sag} ${r1(W)} ${y}" class="${KS('grey3')}" stroke-width="1.4" fill="none" opacity=".6"/>`;
257
+ for (let i = 1; i < 14; i++) { const t = i / 14, l = (t * 2) % 1; s += `<circle class="env-tw${tw(i)} ${K(cols[i % cols.length])}" cx="${r1(W * t)}" cy="${r1(y + sag * 4 * l * (1 - l) * 0.5 + 4)}" r="4"/>`; }
258
+ return s;
259
+ }
260
+ function bunting(W, y, cols, sag = 14) {
261
+ let s = `<path d="M0 ${y} Q ${r1(W / 2)} ${y + sag * 2} ${r1(W)} ${y}" class="${KS('brown2')}" stroke-width="1.2" fill="none" opacity=".5"/>`;
262
+ for (let i = 0; i < 16; i++) { const t = (i + 0.5) / 16, x = W * t, yy = y + sag * 4 * t * (1 - t); s += `<path d="M${r1(x - 9)} ${r1(yy)} L${r1(x + 9)} ${r1(yy)} L${r1(x)} ${r1(yy + 16)}Z" class="${K(cols[i % cols.length])}"/>`; }
263
+ return s;
264
+ }
265
+ const burst = (x, y, r, c, d = '') => `<g class="env-tw${d}">` + Array.from({ length: 12 }, (_, a) => { const an = a * Math.PI / 6; return `<path d="M${r1(x + r * 0.35 * Math.cos(an))} ${r1(y + r * 0.35 * Math.sin(an))} L${r1(x + r * Math.cos(an))} ${r1(y + r * Math.sin(an))}" class="${KS(c)}" stroke-width="2.4" stroke-linecap="round"/>`; }).join('') + '</g>';
266
+ function marigoldGarland(W, y) {
267
+ let s = '';
268
+ for (let k = 0; k < 4; k++) for (let i = 0; i < 9; i++) { const t = i / 8, x = W * k / 4 + (W / 4) * t; s += `<circle cx="${r1(x)}" cy="${r1(y + 72 * t * (1 - t))}" r="5" class="${K(i % 2 ? 'amber4' : 'gold14')}"/>`; }
269
+ return s;
270
+ }
271
+ function rangoli(x, y, r = 40) {
272
+ x = r1(x);
273
+ let s = `<ellipse cx="${x}" cy="${y}" rx="${r}" ry="${r1(r * 0.32)}" class="${K('red2')}" opacity=".85"/><ellipse cx="${x}" cy="${y}" rx="${r1(r * 0.75)}" ry="${r1(r * 0.24)}" class="${K('gold14')}"/>`
274
+ + `<ellipse cx="${x}" cy="${y}" rx="${r1(r * 0.5)}" ry="${r1(r * 0.16)}" class="${K('blue10')}" opacity=".8"/><ellipse cx="${x}" cy="${y}" rx="${r1(r * 0.22)}" ry="${r1(r * 0.07)}" class="${K('white')}"/>`;
275
+ for (let a = 0; a < 8; a++) { const an = a * Math.PI / 4; s += `<ellipse cx="${r1(x + r * 0.88 * Math.cos(an))}" cy="${r1(y + r * 0.28 * Math.sin(an))}" rx="${r1(r * 0.09)}" ry="${r1(r * 0.05)}" class="${K('green2')}"/>`; }
276
+ return s;
277
+ }
278
+ const tree = (x, gy, c = 'amber5', c2 = 'orange5') => `<path d="M${r1(x)} ${gy} L${r1(x)} ${gy - 70}" class="${KS('brown2')}" stroke-width="8" stroke-linecap="round"/><circle cx="${r1(x)}" cy="${gy - 86}" r="34" class="${K(c)}"/><circle cx="${r1(x - 24)}" cy="${gy - 70}" r="22" class="${K(c2)}"/><circle cx="${r1(x + 24)}" cy="${gy - 72}" r="22" class="${K(c)}"/>`;
279
+ const maple = (x, y, c, rot = 0, s = 1) => `<g transform="translate(${r1(x)} ${r1(y)}) rotate(${r1(rot)}) scale(${s})"><path d="M0 -10 L3 -4 L9 -6 L6 0 L10 3 L3 3 L2 9 L0 6 L-2 9 L-3 3 L-10 3 L-6 0 L-9 -6 L-3 -4Z" class="${K(c)}"/></g>`;
280
+ const evergreen = (x, gy, s = 1) => { x = r1(x); return `<rect x="${r1(x - 4 * s)}" y="${r1(gy - 14 * s)}" width="${r1(8 * s)}" height="${r1(14 * s)}" class="${K('brown2')}"/>`
281
+ + `<path d="M${x} ${r1(gy - 94 * s)} L${r1(x + 26 * s)} ${r1(gy - 50 * s)} L${r1(x + 14 * s)} ${r1(gy - 50 * s)} L${r1(x + 34 * s)} ${r1(gy - 14 * s)} L${r1(x - 34 * s)} ${r1(gy - 14 * s)} L${r1(x - 14 * s)} ${r1(gy - 50 * s)} L${r1(x - 26 * s)} ${r1(gy - 50 * s)}Z" class="${K('grey4')}"/>`
282
+ + `<path d="M${x} ${r1(gy - 104 * s)} l3 7 l7 0 l-6 4 l2 7 l-6 -4 l-6 4 l2 -7 l-6 -4 l7 0z" class="${K('gold14')}"/>`
283
+ + stars([[x - 10 * s, gy - 40 * s, 2.6], [x + 12 * s, gy - 30 * s, 2.6], [x + 2 * s, gy - 62 * s, 2.6], [x - 18 * s, gy - 22 * s, 2.6]], 'orange1'); };
284
+ const note = (x, y, d = '', c = 'violet1') => { x = r1(x); return `<g class="env-tw${d}"><path d="M${x} ${y} L${x} ${y - 18} L${r1(x + 12)} ${y - 22} L${r1(x + 12)} ${y - 4}" class="${KS(c)}" stroke-width="2.4" fill="none"/><ellipse cx="${r1(x - 3)}" cy="${y}" rx="4.5" ry="3.5" class="${K(c)}"/><ellipse cx="${r1(x + 9)}" cy="${y - 4}" rx="4.5" ry="3.5" class="${K(c)}"/></g>`; };
285
+ function goal(x, gy, w = 90, h = 56) {
286
+ x = r1(x);
287
+ let s = `<path d="M${x} ${gy} L${x} ${gy - h} L${r1(x + w)} ${gy - h} L${r1(x + w)} ${gy}" class="${KS('white')}" stroke-width="5" fill="none" stroke-linejoin="round"/>`;
288
+ for (let i = 1; i < 6; i++) s += `<path d="M${r1(x + w * i / 6)} ${gy - h} L${r1(x + w * i / 6)} ${gy}" class="${KS('white')}" stroke-width="1" opacity=".55"/>`;
289
+ for (let i = 1; i < 4; i++) s += `<path d="M${x} ${r1(gy - h * i / 4)} L${r1(x + w)} ${r1(gy - h * i / 4)}" class="${KS('white')}" stroke-width="1" opacity=".55"/>`;
290
+ return s;
291
+ }
292
+ const curtains = (W, H) => `<path d="M0 0 L${r1(W * 0.16)} 0 C ${r1(W * 0.12)} ${r1(H * 0.3)}, ${r1(W * 0.14)} ${r1(H * 0.6)}, ${r1(W * 0.1)} ${H} L0 ${H}Z" class="${K('red9')}"/>`
293
+ + `<path d="M${W} 0 L${r1(W * 0.84)} 0 C ${r1(W * 0.88)} ${r1(H * 0.3)}, ${r1(W * 0.86)} ${r1(H * 0.6)}, ${r1(W * 0.9)} ${H} L${W} ${H}Z" class="${K('red9')}"/>`
294
+ + [0.05, 0.1, 0.9, 0.95].map((f) => `<path d="M${r1(W * f)} 0 C ${r1(W * f - 6)} ${r1(H * 0.4)}, ${r1(W * f + 4)} ${r1(H * 0.7)}, ${r1(W * f - 4)} ${H}" class="${KS('red11')}" stroke-width="2" fill="none"/>`).join('');
295
+ const CONF = ['gold15', 'orange1', 'blue10', 'green2'];
296
+ const confetti = (W, gy, n = 26) => Array.from({ length: n }, (_, i) => { const x = Math.round((i * 97) % Math.floor(W * 0.9) + W * 0.05), y = Math.round(gy + 4 + (i * 37) % 22); return `<rect x="${x}" y="${y}" width="6" height="3" rx="1" class="${K(CONF[i % 4])}" transform="rotate(${(i * 53) % 180} ${x} ${y})"/>`; }).join('');
297
+ const streamers = (W) => ['gold15', 'orange1', 'blue10'].map((c, k) => { const y = 18 + k * 10; return `<path d="M0 ${y} Q ${r1(W * 0.25)} ${y + 24} ${r1(W * 0.5)} ${y + 4} T ${W} ${y + 8}" class="${KS(c)}" stroke-width="3" fill="none" opacity=".8"/>`; }).join('');
298
+ const waves = (W, y, c = 'teal1') => [0, 1, 2].map((i) => `<path d="M0 ${y + i * 12} q ${r1(W / 16)} -8 ${r1(W / 8)} 0` + ` t ${r1(W / 8)} 0`.repeat(7) + `" class="${KS(c)}" stroke-width="2.4" fill="none" opacity="${r1(0.9 - i * 0.25)}"/>`).join('');
299
+ const boat = (x, y, s = 1) => { x = r1(x); return `<path d="M${r1(x - 46 * s)} ${y} L${r1(x + 46 * s)} ${y} L${r1(x + 36 * s)} ${r1(y + 8 * s)} L${r1(x - 36 * s)} ${r1(y + 8 * s)}Z" class="${K('red7')}" opacity=".8"/>`
300
+ + `<path d="M${r1(x + 46 * s)} ${y} q 8 -6 6 -14" class="${KS('red7')}" stroke-width="${r1(3 * s)}" fill="none" opacity=".8"/>`
301
+ + Array.from({ length: 7 }, (_, i) => `<circle cx="${r1(x - 34 * s + i * 11 * s)}" cy="${r1(y - 4 * s)}" r="${r1(3 * s)}" class="${K('grey3')}" opacity=".7"/>`).join(''); };
302
+ const earth = (x, y, r) => { x = r1(x); return `<circle class="env-glow ${K('blue7')}" cx="${x}" cy="${y}" r="${r1(r * 1.4)}" opacity=".25"/><circle cx="${x}" cy="${y}" r="${r}" class="${K('blue10')}"/>`
303
+ + `<path d="M${r1(x - r * 0.6)} ${r1(y - r * 0.3)} c ${r1(r * 0.3)} -${r1(r * 0.3)} ${r1(r * 0.6)} 0 ${r1(r * 0.5)} ${r1(r * 0.3)} c -${r1(r * 0.2)} ${r1(r * 0.3)} -${r1(r * 0.6)} ${r1(r * 0.2)} -${r1(r * 0.5)} -${r1(r * 0.3)}z M${r1(x + r * 0.1)} ${r1(y + r * 0.2)} c ${r1(r * 0.4)} -${r1(r * 0.1)} ${r1(r * 0.6)} ${r1(r * 0.2)} ${r1(r * 0.4)} ${r1(r * 0.5)} c -${r1(r * 0.3)} ${r1(r * 0.1)} -${r1(r * 0.5)} 0 -${r1(r * 0.4)} -${r1(r * 0.5)}z" class="${K('green2')}"/>`; };
304
+ const craters = (W, gy) => [[W * 0.12, gy + 16, 16], [W * 0.78, gy + 20, 22], [W * 0.62, gy + 8, 9]].map(([x, y, rx]) => `<ellipse cx="${r1(x)}" cy="${y}" rx="${rx}" ry="${r1(rx * 0.3)}" class="${K('grey1')}"/>`).join('');
305
+ const footprints = (x, y) => Array.from({ length: 5 }, (_, i) => `<ellipse cx="${r1(x + i * 16)}" cy="${y + (i % 2 ? 4 : 0)}" rx="5" ry="2.6" class="${K('grey2')}"/>`).join('');
306
+ const clouds = (W, c = 'blue2') => `<g class="env-cloud"><ellipse cx="${r1(W * 0.22)}" cy="44" rx="48" ry="16" class="${K(c)}"/><ellipse cx="${r1(W * 0.26)}" cy="34" rx="28" ry="16" class="${K(c)}"/></g><g class="env-cloud"><ellipse cx="${r1(W * 0.74)}" cy="56" rx="40" ry="13" class="${K(c)}" opacity=".8"/></g>`;
307
+ const puddle = (x, y) => { x = r1(x); return `<ellipse cx="${x}" cy="${y}" rx="70" ry="9" class="${K('blue5')}" opacity=".7"/><path d="M${r1(x - 40)} ${y} L${r1(x - 20)} ${y} M${r1(x + 6)} ${y + 2} L${r1(x + 30)} ${y + 2}" class="${KS('white')}" stroke-width="2" opacity=".6"/>`; };
308
+ const kites = (W) => `<path d="M${r1(W * 0.18)} 40 l14 16 l-14 16 l-14 -16z" class="${K('orange1')}"/><path d="M${r1(W * 0.18)} 72 q 6 16 -2 30" class="${KS('brown2')}" stroke-width="1.4" fill="none"/>`
309
+ + `<path d="M${r1(W * 0.82)} 30 l12 14 l-12 14 l-12 -14z" class="${K('blue10')}"/><path d="M${r1(W * 0.82)} 58 q -6 16 2 28" class="${KS('brown2')}" stroke-width="1.4" fill="none"/>`;
310
+ const chalkboard = (x, y) => { x = r1(x); return `<rect x="${x}" y="${y}" width="80" height="54" rx="6" class="${K('grey5')} ${KS('amber7')}" stroke-width="5"/><path d="M${r1(x + 14)} ${y + 20} q 14 -8 26 0 M${r1(x + 14)} ${y + 34} L${r1(x + 56)} ${y + 34}" class="${KS('white')}" stroke-width="2" opacity=".6" fill="none"/>`; };
311
+ const deskLamp = (x, gy) => { x = r1(x); return `<ellipse class="env-glow ${K('gold6')}" cx="${r1(x + 20)}" cy="${gy - 30}" rx="40" ry="30" opacity=".45"/><path d="M${x} ${gy} L${r1(x + 30)} ${gy}" class="${KS('grey3')}" stroke-width="4" stroke-linecap="round"/>`
312
+ + `<path d="M${r1(x + 15)} ${gy} L${r1(x + 5)} ${gy - 34} L${r1(x + 30)} ${gy - 56}" class="${KS('grey3')}" stroke-width="3" fill="none"/><path d="M${r1(x + 22)} ${gy - 62} L${r1(x + 44)} ${gy - 54} L${r1(x + 36)} ${gy - 40}Z" class="${K('blue10')}"/>`; };
313
+ function city(W, gy) {
314
+ let s = '';
315
+ [[30, 60], [22, 90], [36, 50], [26, 110], [40, 70], [24, 84], [34, 56], [28, 100], [38, 64]].forEach(([w, h], i) => {
316
+ const x = Math.round(i * W / 9);
317
+ s += `<rect x="${x}" y="${gy - h}" width="${w}" height="${h}" class="${K('ink2')}"/>`;
318
+ for (let j = 0; j < 3; j++) s += `<rect x="${x + 6}" y="${gy - h + 10 + j * 16}" width="5" height="5" class="${K('gold4')}" opacity=".6"/>`;
319
+ });
320
+ return s + `<path d="M0 ${gy + 8} Q ${r1(W / 2)} ${gy - 6} ${W} ${gy + 8}" class="${KS('gold14')}" stroke-width="2.5" fill="none" opacity=".6"/><path d="M0 ${gy + 14} Q ${r1(W / 2)} ${gy} ${W} ${gy + 14}" class="${KS('orange1')}" stroke-width="2" fill="none" opacity=".5"/>`;
321
+ }
322
+ const track = (W, gy) => [0, 1, 2].map((i) => `<path d="M0 ${gy + 6 + i * 9} L${W} ${gy + 6 + i * 9}" class="${KS('white')}" stroke-width="2" opacity=".7"/>`).join('');
323
+ function menorahWindow(x, y, lit = 4) {
324
+ x = r1(x);
325
+ let s = `<rect x="${x}" y="${y}" width="96" height="72" rx="8" class="${K('paper10')} ${KS('blue6')}" stroke-width="3"/><path d="M${r1(x + 16)} ${y + 56} L${r1(x + 80)} ${y + 56} M${r1(x + 48)} ${y + 56} L${r1(x + 48)} ${y + 64} M${r1(x + 38)} ${y + 64} L${r1(x + 58)} ${y + 64}" class="${KS('blue9')}" stroke-width="2.4"/>`;
326
+ for (let i = 0; i < 9; i++) {
327
+ const cx = r1(x + 16 + i * 8), top = i !== 4 ? y + 36 : y + 30;
328
+ s += `<path d="M${cx} ${y + 56} L${cx} ${top}" class="${KS('blue9')}" stroke-width="2.4"/>`;
329
+ if (i === 4 || (i < 4 && i >= 4 - Math.floor(lit / 2)) || (i > 4 && i <= 4 + (lit - Math.floor(lit / 2)))) s += `<ellipse cx="${cx}" cy="${top - 4}" rx="2" ry="3.4" class="${K('amber3')}"/>`;
330
+ }
331
+ return s;
332
+ }
333
+ const sugarcane = (x, gy) => [0, 1].map((i) => { const b = r1(x + i * 8); return `<path d="M${b} ${gy} L${r1(b + 4)} ${gy - 90}" class="${KS('green3')}" stroke-width="5"/><path d="M${r1(b + 4)} ${gy - 90} q -10 -10 -18 -8 M${r1(b + 4)} ${gy - 90} q 10 -12 18 -8" class="${KS('green2')}" stroke-width="3" fill="none"/>`; }).join('');
334
+ const petals = (W, gy) => Array.from({ length: 13 }, (_, i) => { const x = Math.round(W * (i + 1) / 14), y = gy + 8 + (i * 7) % 16; return `<ellipse cx="${x}" cy="${y}" rx="4" ry="2.4" class="${K('red1')}" transform="rotate(${(i * 41) % 180} ${x} ${y})"/>`; }).join('');
335
+ // snow falls gently in winter only: rain never falls (rain means a source failed), and leaves never fall (falling leaves mean a real win)
336
+ const flakes = (pts) => pts.map(([x, y], i) => `<g class="env-snow${i ? ' d' + (i + 1) : ''}"><circle cx="${r1(x)}" cy="${y}" r="3" class="${K('white')}"/></g>`).join('');
337
+ const sun = (W, cy, r, glow) => `<circle class="env-glow ${K('amber1')}" cx="${r1(W * 0.84)}" cy="${cy}" r="${glow}" opacity=".7"/><circle cx="${r1(W * 0.84)}" cy="${cy}" r="${r}" class="${K('gold13')}"/>`;
338
+
339
+ /* the sports colours (Settings › Big sports, two picks): token names, never a hex */
340
+ const TEAM = { blue: 'blue10', red: 'red6', white: 'white', gold: 'gold14', green: 'green2', ink: 'ink1' };
341
+ const team = (c, i, d) => TEAM[(c || [])[i]] || d;
342
+
343
+ /* The charm table. key → { name, head, neck, held, feet (each a function of the sports colours), back, groundFx, front (functions of W, H, gy),
344
+ * grass (false: no tufts), dark (a night sky by day: the greeting's words go light) }. Every key has --ad-<key>0, --ad-<key>1 and --ad-<key>g. */
345
+ const CH = {
346
+ newyear: { name: 'New Year', head: () => partyHat(), back: (W) => streamers(W) + sun(W, 70, 18, 30), groundFx: (W, H, gy) => confetti(W, gy) },
347
+ cny: { name: 'Chinese New Year', held: mandarins, back: (W, H, gy) => hang(W * 0.14, 0, 38, lanternCny(W * 0.14, 62)) + hang(W * 0.86, 0, 26, lanternCny(W * 0.86, 50, 0.8))
348
+ + `<path d="M0 ${gy - 150} C 40 ${gy - 140}, 70 ${gy - 120}, 96 ${gy - 126} M50 ${gy - 140} C 60 ${gy - 160}, 76 ${gy - 166}, 86 ${gy - 168}" class="${KS('brown3')}" stroke-width="4" fill="none" stroke-linecap="round"/>`
349
+ + blossom(96, gy - 126) + blossom(86, gy - 168, 4) + blossom(40, gy - 144, 4.5) + blossom(66, gy - 134, 3.6) },
350
+ lantern: { name: 'Chap Goh Mei', held: () => stickLantern(), dark: true, back: (W) => `<circle class="env-glow ${K('gold5')}" cx="${r1(W * 0.82)}" cy="56" r="34" opacity=".4"/><circle cx="${r1(W * 0.82)}" cy="56" r="22" class="${K('gold5')}"/>` + stars([[W * 0.1, 30, 2], [W * 0.35, 50, 1.6], [W * 0.6, 26, 2]]) },
351
+ valentine: { name: 'Valentine’s Day', held: heartMug, back: (W) => [[W * 0.44, 60, ''], [W * 0.58, 44, ' d2'], [W * 0.52, 26, ' d3']].map(([x, y, d]) => `<g class="env-tw${d}"><path transform="translate(${r1(x)} ${y}) scale(.8)" d="M0 10 C -12 0, -10 -10, -4 -10 C -1 -10, 0 -7, 0 -6 C 0 -7, 1 -10, 4 -10 C 10 -10, 12 0, 0 10Z" class="${K('red2')}"/></g>`).join('') },
352
+ ramadan: { name: 'Ramadan evenings', dark: true, back: (W) => crescent(W * 0.8, 56, 20, 'ink3') + stars([[W * 0.15, 40, 2], [W * 0.4, 30, 1.6], [W * 0.62, 62, 1.6]]), front: (W, H, gy) => pelita(W * 0.16, gy + 14) + pelita(W * 0.84, gy + 12) },
353
+ raya: { name: 'Hari Raya Puasa', held: () => ketupat(), back: (W) => crescent(W * 0.84, 56, 20, 'paper6') + hang(W * 0.12, 0, 40, ketupat(r1(W * 0.12), 58, 0.9)) + hang(W * 0.22, 0, 22, ketupat(r1(W * 0.22), 40, 0.7)),
354
+ front: (W, H, gy) => [0.08, 0.2, 0.8, 0.92].map((f) => pelita(W * f, gy + 18 - Math.abs(0.5 - f) * 10)).join('') },
355
+ haji: { name: 'Hari Raya Haji', back: (W) => crescent(W * 0.84, 56, 20, 'paper4'), front: (W, H, gy) => pelita(W * 0.14, gy + 14) + pelita(W * 0.86, gy + 12) },
356
+ iwd: { name: 'International Women’s Day', head: mimosa, back: (W) => [[W * 0.1, 60], [W * 0.14, 70], [W * 0.08, 76], [W * 0.88, 50], [W * 0.92, 62]].map(([x, y]) => `<circle cx="${Math.round(x)}" cy="${y}" r="5" class="${K('gold14')}" opacity=".7"/>`).join('') },
357
+ pi: { name: 'Pi Day', held: () => pie() },
358
+ easter: { name: 'Easter', held: egg, front: (W, H, gy) => [[0.12, 'red1'], [0.18, 'white'], [0.84, 'gold14'], [0.9, 'red1']].map(([f, c]) => blossom(W * f, gy + 14, 5, c)).join('') },
359
+ earth: { name: 'Earth Day', held: wateringCan, back: (W) => earth(W * 0.84, 60, 22), front: (W, H, gy) => grassS(W * 0.24, gy + 22, 0.6) + grassS(W * 0.32, gy + 24, 0.5, ' d2') + grassS(W * 0.7, gy + 24, 0.6) + grassS(W * 0.78, gy + 22, 0.5, ' d2') },
360
+ labour: { name: 'Labour Day', head: hardHat },
361
+ vesak: { name: 'Vesak Day', held: () => lotus(), grass: false, groundFx: (W, H, gy) => `<ellipse cx="${r1(W * 0.16)}" cy="${gy + 18}" rx="30" ry="7" class="${K('green3')}" opacity=".8"/><ellipse cx="${r1(W * 0.84)}" cy="${gy + 22}" rx="26" ry="6" class="${K('green3')}" opacity=".8"/>` + lotus(r1(W * 0.16), gy + 12, 0.7) + lotus(r1(W * 0.84), gy + 16, 0.6) },
362
+ dragonboat: { name: 'Dragon Boat Festival', held: zongzi, grass: false, back: (W, H, gy) => boat(W * 0.78, gy - 70, 0.9) + waves(W, gy - 58) },
363
+ natday: { name: 'National Day', neck: () => scarf('blue10', 'white'), back: (W) => bunting(W, 8, ['blue10', 'white', 'gold14']) },
364
+ moon: { name: 'Moon landing day', head: helmet, dark: true, grass: false, back: (W) => earth(W * 0.16, 64, 24) + stars([[W * 0.4, 30, 2], [W * 0.6, 58, 1.6], [W * 0.74, 24, 2], [W * 0.9, 80, 1.6], [W * 0.3, 96, 1.4]]), groundFx: (W, H, gy) => craters(W, gy) + footprints(W * 0.66, gy + 12) },
365
+ ndp: { name: 'National Day', neck: () => scarf('red6', 'white'), dark: true, grass: false, back: (W) => bunting(W, 6, ['red6', 'white']) + burst(W * 0.18, 88, 30, 'orange1') + burst(W * 0.82, 74, 36, 'white', ' d2') + burst(W * 0.66, 120, 20, 'gold14', ' d3') },
366
+ teachers: { name: 'Teachers’ Day', held: apple, back: (W, H, gy) => chalkboard(W * 0.74, gy - 120) },
367
+ midautumn: { name: 'Mid-Autumn Festival', held: mooncake, dark: true, back: (W) => `<circle class="env-glow ${K('gold5')}" cx="${r1(W * 0.8)}" cy="70" r="52" opacity=".3"/><circle cx="${r1(W * 0.8)}" cy="70" r="38" class="${K('gold5')}"/><circle cx="${r1(W * 0.8 - 10)}" cy="62" r="6" class="${K('gold11')}"/><circle cx="${r1(W * 0.8 + 12)}" cy="80" r="4" class="${K('gold11')}"/>`
368
+ + hang(W * 0.12, 0, 46, lanternRound(W * 0.12, 64, 14, 'orange3')) + hang(W * 0.24, 0, 28, lanternRound(W * 0.24, 44, 11, 'red6')) + hang(W * 0.36, 0, 54, lanternRound(W * 0.36, 70, 10, 'gold14')) + stars([[W * 0.5, 30, 1.6], [W * 0.6, 90, 1.4], [W * 0.94, 140, 1.6]]) },
369
+ exam: { name: 'Exam season', head: pencil, back: (W, H, gy) => deskLamp(W * 0.76, gy - 18) },
370
+ children: { name: 'Children’s Day', held: pinwheel, back: kites },
371
+ nightrace: { name: 'The night race', neck: () => scarf('ink1', 'white', true), dark: true, grass: false, back: (W, H, gy) => city(W, gy - 40) + stars([[W * 0.2, 26, 1.6], [W * 0.7, 30, 1.6]]) },
372
+ halloween: { name: 'Halloween', feet: () => pumpkin(), dark: true, back: (W) => `<circle cx="${r1(W * 0.82)}" cy="58" r="22" class="${K('gold4')}"/>` + stars([[W * 0.15, 40, 2], [W * 0.4, 30, 1.6], [W * 0.6, 62, 1.6]]) },
373
+ deepavali: { name: 'Deepavali', held: diya, dark: true, grass: false, back: (W) => marigoldGarland(W, 0) + stars([[W * 0.2, 70, 1.6], [W * 0.5, 52, 1.6], [W * 0.8, 76, 1.6]]),
374
+ groundFx: (W, H, gy) => rangoli(W * 0.2, gy + 18, 46), front: (W, H, gy) => [0.62, 0.74, 0.86, 0.96].map((f) => smallDiya(W * f, gy + 20 - Math.abs(0.5 - f) * 8)).join('') },
375
+ thanks: { name: 'Thanksgiving', held: () => pie(), back: (W) => `<circle cx="${r1(W * 0.84)}" cy="80" r="34" fill="none" class="${KS('amber8')}" stroke-width="10"/>` + [[0, 'orange3'], [1.2, 'red6'], [2.4, 'gold14'], [3.6, 'orange3'], [4.8, 'red6']].map(([a, c]) => maple(W * 0.84 + 34 * Math.cos(a), 80 + 34 * Math.sin(a), c, a * 40, 0.9)).join('') },
376
+ hanukkah: { name: 'Hanukkah', back: (W) => menorahWindow(W * 0.72, 40, 4) + stringLights(W * 0.6, 12, ['blue10', 'white']) },
377
+ christmas: { name: 'Christmas', head: () => beanie(), feet: () => gift(), back: (W, H, gy) => stringLights(W, 10, ['gold14', 'red6', 'green2', 'blue10']) + evergreen(W * 0.86, gy + 10) },
378
+ dongzhi: { name: 'Dongzhi', held: tangyuan },
379
+ pongal: { name: 'Pongal', held: ricePot, back: (W, H, gy) => sugarcane(W * 0.82, gy + 10), groundFx: (W, H, gy) => `<ellipse cx="${r1(W * 0.2)}" cy="${gy + 18}" rx="40" ry="12" fill="none" class="${KS('white')}" stroke-width="2.4"/><ellipse cx="${r1(W * 0.2)}" cy="${gy + 18}" rx="24" ry="7" fill="none" class="${KS('white')}" stroke-width="2"/>` },
380
+ football: { name: 'The football finals', neck: (c) => scarf(team(c, 0, 'blue10'), team(c, 1, 'white')), feet: () => football(), grass: false, back: (W, H, gy) => goal(W * 0.74, gy + 6) + `<path d="M0 ${gy + 16} L${W} ${gy + 16}" class="${KS('white')}" stroke-width="3" opacity=".6"/>` },
381
+ games: { name: 'The Games', head: (c) => headband(team(c, 0, 'blue10')), grass: false, groundFx: (W, H, gy) => track(W, gy) },
382
+ movie: { name: 'Movie night', held: popcorn, feet: () => clapper(), dark: true, grass: false, back: (W, H) => `<rect x="${r1(W * 0.22)}" y="18" width="${r1(W * 0.56)}" height="${r1(H * 0.36)}" rx="6" class="${K('paper9')}" opacity=".18"/>` + curtains(W, H) },
383
+ // Music: notes, never headphones (headphones mean a meeting is recording)
384
+ music: { name: 'Music', back: (W) => note(W * 0.62, 90) + note(W * 0.7, 60, ' d2', 'blue10') + note(W * 0.34, 70, ' d3') },
385
+ spring: { name: 'Spring', back: () => `<path d="M0 30 C 40 36, 70 50, 100 50" class="${KS('brown3')}" stroke-width="4" fill="none"/>` + blossom(100, 50) + blossom(60, 40, 4) + blossom(30, 32, 4.5), groundFx: (W, H, gy) => petals(W, gy) },
386
+ summer: { name: 'Summer', head: sunHat, back: (W) => sun(W, 62, 26, 40) },
387
+ // autumn leaves lie on the ground; they never fall
388
+ autumn: { name: 'Autumn', neck: () => scarf('amber6', 'paper2'), back: (W, H, gy) => tree(W * 0.14, gy + 6) + tree(W * 0.9, gy + 10, 'red6', 'orange3'),
389
+ groundFx: (W, H, gy) => [[0.26, 'orange3'], [0.32, 'red6'], [0.66, 'gold14'], [0.72, 'orange3'], [0.78, 'red6'], [0.38, 'gold14']].map(([f, c], i) => maple(W * f, gy + 14 + (i * 5) % 12, c, (i * 47) % 180, 0.9)).join('') },
390
+ winter: { name: 'Winter', head: () => beanie('blue12', 'paper12', 'white'), neck: () => scarf('blue12', 'paper12'), grass: false, back: (W) => flakes([[W * 0.2, 30], [W * 0.5, 20], [W * 0.8, 40]]) },
391
+ // the monsoon: clouds and a puddle, no falling rain (rain means a source failed)
392
+ monsoon: { name: 'Monsoon', feet: () => umbrella(), back: (W) => clouds(W), groundFx: (W, H, gy) => puddle(W * 0.72, gy + 18) },
393
+ pmosday: { name: 'Your PMOS day', held: cupcake, back: streamers },
394
+ birthday: { name: 'Your birthday', head: () => partyHat('blue10', 'gold14'), held: cupcake, back: streamers, groundFx: (W, H, gy) => confetti(W, gy, 18) },
395
+ };
396
+ export const CHARM_KEYS = Object.freeze(Object.keys(CH));
397
+ /** The words for a charm ("Deepavali"), or '' for a key PMOS does not draw. */
398
+ export const charmName = (key) => (CH[key] ? CH[key].name : '');
399
+
400
+ /* What he wears on the figure: a held charm goes in his paws only when they are free (handled, resting); in a raised-paw mood it rests at his
401
+ * feet instead, unless the charm already has one there. The headphones win over a head charm: they mean a meeting is recording. */
402
+ function wear(m, prop, c) {
403
+ if (!c) return '';
404
+ const ch = c.ch, cs = c.colors;
405
+ const aside = ch.held && !ch.feet && m !== 'calm' && m !== 'rest' ? `<g transform="translate(-62 22)">${ch.held(cs)}</g>` : '';
406
+ return aside + (ch.neck ? ch.neck(cs) : '') + (ch.feet ? ch.feet(cs) : '') + (ch.head && prop !== 'headphones' ? ch.head(cs) : '');
407
+ }
129
408
 
130
409
  /* ── Settings > Adler (AdM5): this computer's settings, kept in localStorage for the first paint and read from /api/settings ── */
131
410
  const PREF_DEF = Object.freeze({ 'adler.amount': 'full', 'adler.motion': 'system', 'adler.celebrate': 'real', 'adler.quiet': '22' });
@@ -146,10 +425,53 @@ export function setPrefs(o) { P = clean({ ...P, ...o }); store.set(PREF_KEY, JSO
146
425
  export async function loadPrefs(get) {
147
426
  try {
148
427
  const r = get ? await get('/api/settings') : await fetch('/api/settings', { credentials: 'same-origin' }).then((x) => x.json());
149
- if (r && r.ok && Array.isArray(r.settings)) { const o = {}; for (const s of r.settings) if (s && s.key in PREF_DEF) o[s.key] = s.value; setPrefs(o); }
428
+ if (r && r.ok && Array.isArray(r.settings)) {
429
+ const o = {}, d = {};
430
+ for (const s of r.settings) if (s && s.key in PREF_DEF) o[s.key] = s.value; else if (s && (/^adler\.dress\./.test(s.key) || s.key === 'time.zone')) d[s.key] = s.value;
431
+ DP = d; setPrefs(o);
432
+ }
150
433
  } catch { /* the kept copy stands */ }
434
+ await loadDress(); // what he wears today follows the settings just read
151
435
  return prefs();
152
436
  }
437
+ /* Settings › Adler › Dress for the day (adler.dress.*, and time.zone): 8-A's keys, kept as they come so the calendar reads them */
438
+ let DP = {};
439
+ const rowsOf = () => [...Object.entries(P), ...Object.entries(DP)].map(([key, value]) => ({ key, value }));
440
+ /* the calendar's own map of these settings (dressPrefs adds its defaults and this computer's first day), or the plain map */
441
+ const dressMap = (m) => (m && typeof m.dressPrefs === 'function' ? m.dressPrefs(rowsOf()) : { ...P, ...DP });
442
+
443
+ /* ── the charm of the day (8-A's calendar picks it: charmToday in pm/cozy-seasons.js; this page keeps it while it lives) ── */
444
+ let D = null;
445
+ /** Today's charm for this page: { key, name, until, today, colors } or null. */
446
+ export const dress = () => D;
447
+ /** Sets today's charm (null: plain) and tells the page (the event adler:dressed). A key PMOS does not draw is plain. → the charm */
448
+ export function setDress(c) {
449
+ D = c && CH[c.key] ? { ...c, name: c.name || CH[c.key].name } : null;
450
+ if (typeof document !== 'undefined') document.dispatchEvent(new CustomEvent('adler:dressed', { detail: D }));
451
+ return D;
452
+ }
453
+ /** Asks the calendar (8-A, pm/cozy-seasons.js) what he wears today, with this computer's settings. No module, or no day: plain. → the charm */
454
+ export async function loadDress(now = Date.now(), load = () => import('./cozy-seasons.js')) {
455
+ try {
456
+ const m = await load();
457
+ return setDress(m && typeof m.charmToday === 'function' ? m.charmToday(new Date(now), dressMap(m)) : null);
458
+ } catch { return setDress(null); }
459
+ }
460
+ /** True on the festival's own day (not the days around it): the only day the greeting says "Happy <name>". */
461
+ export const dressDay = (c = D, now = Date.now()) => {
462
+ if (!c) return false;
463
+ if (typeof c.today === 'boolean') return c.today;
464
+ const d = new Date(now), iso = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
465
+ return !!c.day && String(c.day).slice(0, 10) === iso;
466
+ };
467
+ /* The charm a drawing wears, or null. o.charm names one (a preview in Settings, a test); o.dress: true wears today's, and only with
468
+ * Settings › Adler › How much: Full (Face only and Off undress him too). Honest never wears one: bad news is never in costume. */
469
+ function dressed(mood, o) {
470
+ if (mood === 'honest') return null;
471
+ const today = o.dress && P['adler.amount'] === 'full' ? D : null, key = o.charm || (today && today.key);
472
+ return CH[key] ? { ch: CH[key], colors: o.colors || (today && today.colors) || null } : null;
473
+ }
474
+
153
475
  /** One press in Settings > Adler: POST /api/settings, then the page follows at once. → the server's answer */
154
476
  export async function savePref(post, key, value) {
155
477
  if (!(key in PREF_DEF) || !PREF_OPTIONS[key].includes(value)) return { ok: false, error: 'That is not an Adler setting.' };
@@ -207,10 +529,13 @@ export function adler(mood, size = 'm', o = {}) {
207
529
  // o.id: a fixed prefix for a drawing that is redrawn in place (the chat avatar), so the same state draws the same markup and a
208
530
  // redraw that diffs the markup does not replace the node and replay its entrance (premium-viewer-flicker F1)
209
531
  const p = o.id ? 'ad' + o.id : nextId(), cls = `ad-svg am m-${m}${o.cls ? ' ' + o.cls : ''}`;
210
- const extra = o.prop === 'headphones' ? 'listening' : o.prop === 'magnifier' ? 'searching' : '';
211
- if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 4 156 156" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}${head(m, p, o.prop, o.grow, o.growNew)}</svg>`;
532
+ // a charm: the S face (under 36 px) never wears one, the M face wears a head charm only, the figure wears all of it
533
+ const c = dressed(mood, o), hat = c && !figure && px >= 36 && c.ch.head && o.prop !== 'headphones' ? c.ch.head(c.colors) : '';
534
+ const worn = figure ? c : hat ? c : null;
535
+ const extra = [o.prop === 'headphones' ? 'listening' : o.prop === 'magnifier' ? 'searching' : '', worn ? 'dressed for ' + worn.ch.name : ''].filter(Boolean).join(', ');
536
+ if (!figure) return `<svg class="${cls} ad-face" width="${px}" height="${px}" viewBox="22 4 156 156" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}${head(m, p, o.prop, o.grow, o.growNew)}${hat}</svg>`;
212
537
  const w = Math.round(px * 200 / 252);
213
- return `<svg class="${cls} ad-fig" width="${w}" height="${px}" viewBox="0 0 200 252" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${p}b)"/><g class="ad-br">${full(m, p, o.prop)}</g></svg>`;
538
+ return `<svg class="${cls} ad-fig" width="${w}" height="${px}" viewBox="0 0 200 252" overflow="visible" ${labelAttr(o, mood, extra)}>${defs(p)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${p}b)"/><g class="ad-br">${full(m, p, o.prop, c)}</g></svg>`;
214
539
  }
215
540
  /** His face where a plain icon stood (the Jira chip, the charter's check line, the Deliveries lane): with Settings > Adler > Off the icon
216
541
  * stays, so the press still says what it does. */
@@ -236,6 +561,8 @@ export function adlerScene(kind, mood, o = {}) {
236
561
  if (P['adler.amount'] === 'off') return '';
237
562
  if (P['adler.amount'] === 'face') return `<div class="ad-scene-face">${adler(mood, 'm', o)}</div>`;
238
563
  if (!SCENES.includes(kind)) kind = 'plain';
564
+ const c = kind === 'rain' ? null : dressed(mood, o);
565
+ if (c) return charmScene(kind, mood, o, c);
239
566
  const W = o.w || 400, H = o.h || 260, adh = Math.min(170, H - 60), m = INNER[mood], p = nextId(), gy = H - 34;
240
567
  let g = `<svg class="ad-scene env k-${kind}" viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMax slice" ${labelAttr(o, mood, kind === 'night' ? 'asleep' : '')}>`;
241
568
  g += `<defs><linearGradient id="${p}bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="adg-${kind}0"/><stop offset="1" class="adg-${kind}1"/></linearGradient></defs>`;
@@ -261,6 +588,78 @@ export function adlerScene(kind, mood, o = {}) {
261
588
  return g + '</svg>';
262
589
  }
263
590
 
591
+ /* The scene on a dressed day (AsMoods, AsPlaces): the charm's own sky, ground and things around him. Needs you keeps the charm on a plain
592
+ * scene, so the ask leads; resting (the night kind) is the charm's scene by night; a real win lets its leaves fall once, as on any day. */
593
+ function charmScene(kind, mood, o, c) {
594
+ const W = o.w || 400, H = o.h || 260, adh = Math.min(170, H - 60), m = INNER[mood], p = nextId(), gy = H - 34, ch = c.ch;
595
+ const plain = mood === 'needs-you', night = kind === 'night' && !plain, key = CHARM_KEYS.find((k) => CH[k] === ch);
596
+ const sky = plain ? 'plain' : night ? 'night' : key;
597
+ let g = `<svg class="ad-scene env k-${kind} ch-${key}${ch.dark || night ? ' dark' : ''}" viewBox="0 0 ${W} ${H}" preserveAspectRatio="xMidYMax slice" ${labelAttr(o, mood, (kind === 'night' ? 'asleep, ' : '') + 'dressed for ' + ch.name)}>`;
598
+ g += `<defs><linearGradient id="${p}bg" x1="0" y1="0" x2="0" y2="1"><stop offset="0" class="adg-${sky}0"/><stop offset="1" class="adg-${sky}1"/></linearGradient></defs>`;
599
+ g += `<g class="ad-env"><rect width="${W}" height="${H}" fill="url(#${p}bg)"/>`;
600
+ if (!plain && ch.back) g += ch.back(W, H, gy);
601
+ if (night) g += stars([[W * 0.1, 30, 2], [W * 0.3, 60, 1.6], [W * 0.55, 24, 2], [W * 0.7, 70, 1.6], [W * 0.9, 40, 2]]);
602
+ g += `<ellipse cx="${W / 2}" cy="${H + 30}" rx="${W * 0.75}" ry="70" class="${plain ? K('gold3') : night ? F('groundn') : `adf-${key}g`}" opacity=".85"/>`;
603
+ if (!plain && ch.groundFx) g += ch.groundFx(W, H, gy);
604
+ if (!plain && ch.grass !== false) g += grassS(W * 0.1, gy + 18, 1) + grassS(W * 0.9, gy + 14, 0.8, ' d2');
605
+ if (kind === 'think') { const cx = W / 2 + adh * 0.42, cy = H - adh - 6; for (let i = 0; i < 3; i++) g += `<circle class="env-dot${i ? ' d' + (i + 1) : ''} ${F('thinkdot')}" cx="${cx + i * 14}" cy="${cy + 18 - i * 6}" r="${4 + i}"/>`; }
606
+ g += '</g>';
607
+ if (kind === 'night' && m === 'rest') { const zx = W / 2 + adh * 0.25, zy = H - adh + 10; for (let i = 0; i < 3; i++) g += `<text class="env-z${i ? ' d' + (i + 1) : ''} ${F('moon')} ad-z z${i}" x="${zx}" y="${zy}">z</text>`; }
608
+ const aw = Math.round(adh * 200 / 252), x = (W - aw) / 2, y = H - adh - 8, q = nextId();
609
+ g += `<svg x="${x}" y="${y}" width="${aw}" height="${adh}" viewBox="0 0 200 252" overflow="visible" class="am m-${m}" aria-hidden="true">${defs(q)}<ellipse cx="100" cy="246" rx="62" ry="7" class="${F('shadow')}" opacity=".16" filter="url(#${q}b)"/><g class="ad-br">${full(m, q, o.prop, c)}</g></svg>`;
610
+ if (!plain && ch.front) g += `<g class="ad-env">${ch.front(W, H, gy)}</g>`;
611
+ if (m === 'joy') [[W * 0.2, 'leaf2'], [W * 0.35, 'gold'], [W * 0.62, 'leaf2'], [W * 0.78, 'pink'], [W * 0.5, 'gold']].forEach(([lx, k], i) => { g += fallLeaf(lx, 14, i ? ' d' + (i + 1) : '', k); });
612
+ if (kind === 'tea' && !(ch.held && (m === 'calm' || m === 'rest'))) { const sc = adh / 252, mx = x + 101 * sc, my = y + 186 * sc; [-6, 0, 6].forEach((dx, i) => { g += `<path class="env-steam${i ? ' d' + (i + 1) : ''} ${S('white')}" d="M${mx + dx} ${my} q -4 -6 0 -12 q 4 -6 0 -12" stroke-width="2.6" fill="none" stroke-linecap="round"/>`; }); }
613
+ return g + '</svg>';
614
+ }
615
+
616
+ /* Tap Adler (AsSet2Tap): one small dark popover says why he is dressed, with "Not this one" (that day off for this year) and › (Settings ›
617
+ * Adler › Dress for the day). PMOS never shows a toast when he dresses up. Any element with data-ad-dress opens it. */
618
+ export function dressTipHtml(c = D) {
619
+ if (!c) return '';
620
+ const EYEOFF = '<path d="M9.9 4.2A10 10 0 0 1 12 4c6.5 0 10 8 10 8a17 17 0 0 1-2.2 3.2M6.6 6.6A17 17 0 0 0 2 12s3.5 8 10 8a9.7 9.7 0 0 0 5.4-1.6M9.9 9.9a3 3 0 0 0 4.2 4.2M2 2l20 20"/>';
621
+ const CHEV = '<path d="M9 6l6 6-6 6"/>';
622
+ const ic = (d) => `<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${d}</svg>`;
623
+ return `<div class="ad-tip" role="dialog" aria-label="Why Adler is dressed"><span class="ad-tip-t">Dressed for ${esc(c.name)}.</span>`
624
+ + `<button type="button" class="ad-tip-b" data-ad-tip="skip" aria-label="Not this one: no ${esc(c.name)} charm" title="Not this one">${ic(EYEOFF)}</button>`
625
+ + `<button type="button" class="ad-tip-b" data-ad-tip="all" aria-label="All charms: open Dress for the day" title="Dress for the day">${ic(CHEV)}</button></div>`;
626
+ }
627
+ /** "Not this one": the calendar names the one setting that turns this day off for this year; PMOS saves it and he is plain at once. */
628
+ export async function skipDress(post, now = Date.now(), load = () => import('./cozy-seasons.js')) {
629
+ if (!D) return { ok: true };
630
+ const m = await load().catch(() => null), row = m && typeof m.skipThisYear === 'function' ? m.skipThisYear(D.key, new Date(now), dressMap(m)) : null;
631
+ if (!row || !row.key) return { ok: false, error: 'That day cannot be turned off here yet. Settings › Adler › Dress for the day can.' };
632
+ const r = await post('/api/settings', row);
633
+ if (r && r.ok) { DP = { ...DP, [row.key]: row.value }; setDress(null); }
634
+ return r || { ok: false, error: 'Not saved.' };
635
+ }
636
+ /** Opens the popover under a dressed Adler on press (root: the page part that holds him). o: { post, openSettings, say } */
637
+ export function mountDressTip(root, o = {}) {
638
+ if (!root || root.dataset.adTipOn) return;
639
+ root.dataset.adTipOn = '1';
640
+ const close = () => { const t = root.querySelector('.ad-tip'); if (t) t.remove(); };
641
+ root.addEventListener('click', async (e) => {
642
+ const b = e.target.closest('[data-ad-tip]');
643
+ if (b) {
644
+ e.stopPropagation(); close();
645
+ if (b.dataset.adTip === 'all') { if (o.openSettings) o.openSettings('dress'); return; }
646
+ const r = o.post ? await skipDress(o.post) : { ok: false, error: 'Not saved.' };
647
+ if (!r.ok && o.say) o.say(r.error || 'Not saved.');
648
+ return;
649
+ }
650
+ const a = e.target.closest('[data-ad-dress]');
651
+ if (!a || !D) { close(); return; }
652
+ e.stopPropagation();
653
+ if (root.querySelector('.ad-tip')) { close(); return; }
654
+ a.insertAdjacentHTML('afterend', dressTipHtml());
655
+ const first = root.querySelector('.ad-tip .ad-tip-b'); if (first) first.focus();
656
+ });
657
+ root.addEventListener('keydown', (e) => {
658
+ if (e.key === 'Escape') close();
659
+ else if ((e.key === 'Enter' || e.key === ' ') && e.target.matches && e.target.matches('[data-ad-dress]')) { e.preventDefault(); e.target.click(); }
660
+ });
661
+ }
662
+
264
663
  /* ── the moods of sentences Claude already says (AdM1-4) ── */
265
664
  const HONEST = /\b(not|no longer|couldn[’']?t|could not|can[’']?t|cannot|didn[’']?t|did not|isn[’']?t|wasn[’']?t|won[’']?t|failed|fails|error|broke|stopped|missed|lost|refused|unavailable)\b/i;
266
665
  const WORKING = /(…|\.\.\.)\s*$/;
@@ -292,4 +691,12 @@ export function mountToastFaces(doc = typeof document !== 'undefined' ? document
292
691
  new MutationObserver(scan).observe(doc.body, { childList: true });
293
692
  }
294
693
 
295
- if (typeof document !== 'undefined') addCss();
694
+ if (typeof document !== 'undefined') {
695
+ addCss();
696
+ // Settings › Adler › Dress for the day sends its new settings after each save (8-A): he follows at once
697
+ document.addEventListener('adler:dress', (e) => {
698
+ const d = e.detail && typeof e.detail === 'object' ? e.detail : {};
699
+ for (const [k, v] of Object.entries(d)) if (/^adler\.dress\./.test(k) || k === 'time.zone') DP[k] = v;
700
+ loadDress();
701
+ });
702
+ }
@@ -244,6 +244,20 @@
244
244
  .cz .ev-ad-hd { display: flex; align-items: center; gap: 12px; padding: 4px 4px 10px; }
245
245
  .cz .ev-sp-ad { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
246
246
  .cz .ev-sp-ad p { margin: 0; }
247
+ /* Settings › Adler › Dress for the day (feedback batch 18 item 8, AsSet1): the header with its master switch, what he wears now or next,
248
+ * the place pickers, the More festivals list under its row, and Wear now */
249
+ .ev-st .ev-dr-hd { display: flex; align-items: center; gap: 8px; margin: 0 0 4px -6px; }
250
+ .ev-st .ev-dr-hd h4 { margin: 0; font-size: var(--fs-4); font-weight: 800; }
251
+ .ev-st .ev-dr-now { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: var(--cz-well); }
252
+ .ev-st .ev-dr-now p { margin: 0; display: flex; flex-direction: column; gap: 2px; }
253
+ .ev-st .ev-dr-pl { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
254
+ .ev-st .ev-dr-pl select.ev-inp { max-width: 190px; }
255
+ .ev-st .ev-dr-more { padding-left: 16px; border-left: 2px solid var(--cz-hair); }
256
+ .ev-st .ev-dr-more .ev-trow { padding: 8px 0; }
257
+ .ev-st .ev-dr-wbtns { display: flex; gap: 10px; }
258
+ .ev-st .ev-wear { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 12px; border-radius: 16px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); font: inherit; cursor: pointer; min-width: 88px; }
259
+ .ev-st .ev-wear[aria-pressed="true"] { background: var(--cz-bluebg); color: var(--cz-blueink); border-color: transparent; }
260
+ @media (max-width: 760px) { .ev-st .ev-dr-pl { width: 100%; justify-content: flex-start; } .ev-st .ev-dr-pl select.ev-inp { max-width: none; flex: 1; } .ev-st .ev-dr-hd .ev-ib { width: 44px; height: 44px; } }
247
261
  /* Settings › Connectors: each source's last read (feedback batch 16 item 5, FmA3Settings; was the Sources card), and the amber box on top */
248
262
  .ev-st-main > .ev-st-warn { margin-bottom: 12px; color: var(--cz-ink); }
249
263
  .ev-st-warn .ev-ib-card { background: var(--cz-card); }
@@ -268,7 +282,8 @@
268
282
  .nv-opt.on { border-color: var(--cz-blue); background: var(--cz-bluebg); }
269
283
  .nv-rd { width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--cz-ink3); flex: none; box-sizing: border-box; }
270
284
  .nv-opt.on .nv-rd { border: 5px solid var(--cz-blue); }
271
- .nv-rec { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--cz-card); color: var(--cz-blueink); font-size: var(--fs-1); font-weight: 800; vertical-align: 1px; }
285
+ /* "I’d do this" on the overlap choice the agent recommends (batch 18 item 2-B); not .nv-rec, which is the ask Viewer's Record press (2-A) */
286
+ .nv-idd { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--cz-card); color: var(--cz-blueink); font-size: var(--fs-1); font-weight: 800; vertical-align: 1px; }
272
287
  .nv-go { padding-top: 2px; }
273
288
  .nv-pri svg { flex: none; }
274
289
  .nv-parts { margin: 0; padding: 0 0 0 18px; display: flex; flex-direction: column; gap: 6px; color: var(--cz-ink2); }