Spaces:
Sleeping

byte-vortex commited on
Commit
1deda54
ยท
verified ยท
1 Parent(s): 6e62fba

Deploy Myco from CI

Browse files
Files changed (1) hide show
  1. ui/renderers.py +202 -199
ui/renderers.py CHANGED
@@ -12,10 +12,8 @@ POISONOUS_MUSHROOM_NAMES = {
12
  "Ghost Gill", "Pepper Pixie", "Ruby Knuckle", "Clockwork Chanterelle",
13
  }
14
 
15
- # โ”€โ”€ Inline CSS + keyframes injected once into the scene โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
16
  SCENE_STYLES = """
17
  <style>
18
- /* โ”€โ”€ Base scene โ”€โ”€ */
19
  .forest-scene {
20
  position: relative; isolation: isolate;
21
  overflow: hidden; min-height: 20rem;
@@ -28,8 +26,6 @@ SCENE_STYLES = """
28
  box-shadow: 0 18px 48px rgba(8,30,20,.26);
29
  color: #f9ffe9;
30
  }
31
-
32
- /* โ”€โ”€ HUD bar โ”€โ”€ */
33
  .scene-hud {
34
  position: relative; z-index: 3;
35
  display: flex; flex-wrap: wrap; gap: .4rem;
@@ -37,8 +33,6 @@ SCENE_STYLES = """
37
  background: rgba(13,38,28,.72); backdrop-filter: blur(6px);
38
  font-size: .8rem; font-weight: 800;
39
  }
40
-
41
- /* โ”€โ”€ Stage โ”€โ”€ */
42
  .scene-stage {
43
  position: relative; height: 13rem;
44
  margin: .6rem 0;
@@ -48,22 +42,16 @@ SCENE_STYLES = """
48
  border-radius: 22px; overflow: hidden;
49
  }
50
  .scene-stage span { position: absolute; line-height:1; }
51
-
52
- /* โ”€โ”€ Trees / grass โ”€โ”€ */
53
  .tree-left { left:6%; bottom:18%; font-size:5rem; filter:drop-shadow(0 8px 12px rgba(0,0,0,.28)); }
54
  .tree-right { right:7%; bottom:20%; font-size:4.75rem; filter:drop-shadow(0 8px 12px rgba(0,0,0,.28)); }
55
  .grass-one { left:26%; bottom:14%; font-size:2.4rem; }
56
  .grass-two { right:28%;bottom:16%; font-size:2.2rem; }
57
-
58
- /* โ”€โ”€ Sparkles โ”€โ”€ */
59
  .sparkle-one { left:34%; top:18%; font-size:1.8rem; animation:twinkle 1.8s ease-in-out infinite; }
60
  .sparkle-two { right:33%; top:24%; font-size:1.6rem; animation:twinkle 2.2s ease-in-out infinite reverse; }
61
  @keyframes twinkle {
62
  0%,100%{opacity:.3;transform:scale(.85);}
63
  50%{opacity:1;transform:scale(1.18);}
64
  }
65
-
66
- /* โ”€โ”€ Myco player โ€” position grid โ”€โ”€ */
67
  .myco-player {
68
  font-size:4rem; z-index:2;
69
  transition: left .32s cubic-bezier(.34,1.56,.64,1), bottom .32s cubic-bezier(.34,1.56,.64,1);
@@ -83,17 +71,11 @@ SCENE_STYLES = """
83
  .pos-0-2 .myco-player{left:14%;bottom:13%;}
84
  .pos-1-2 .myco-player{left:41%;bottom:13%;}
85
  .pos-2-2 .myco-player{left:67%;bottom:13%;}
86
-
87
- /* โ”€โ”€ Mushroom sprite โ”€โ”€ */
88
  .mushroom-sprite {
89
  right:33%; bottom:22%; font-size:3.6rem; z-index:2;
90
  filter:drop-shadow(0 6px 14px rgba(0,0,0,.3));
91
  }
92
-
93
- /* โ”€โ”€ STATE: waiting (no mushroom) โ”€โ”€ */
94
  .state-waiting .mushroom-sprite { opacity:0; }
95
-
96
- /* โ”€โ”€ STATE: discovered โ€” mushroom pops up, Myco runs toward it โ”€โ”€ */
97
  .state-discovered .mushroom-sprite {
98
  animation: shroom-popup 0.7s cubic-bezier(.34,1.56,.64,1) both;
99
  }
@@ -110,14 +92,11 @@ SCENE_STYLES = """
110
  0% { transform:translateX(-3rem) scaleX(-1); }
111
  100% { transform:translateX(0) scaleX(1); }
112
  }
113
-
114
- /* โ”€โ”€ STATE: picked โ€” mushroom flies up and disappears โ”€โ”€ */
115
  .state-picked .mushroom-sprite {
116
  animation: shroom-catch 0.55s cubic-bezier(.34,1.56,.64,1) both;
117
  }
118
  .state-picked .myco-player {
119
- animation: myco-bob 2.4s ease-in-out infinite,
120
- myco-catch-jump 0.55s ease both;
121
  }
122
  @keyframes shroom-catch {
123
  0% { opacity:1; transform:translateY(0) scale(1); }
@@ -128,16 +107,13 @@ SCENE_STYLES = """
128
  0%,100%{ transform:translateY(0); }
129
  40% { transform:translateY(-1.4rem) scale(1.1); }
130
  }
131
-
132
- /* โ”€โ”€ STATE: danger (poison, not yet picked) โ”€โ”€ */
133
  .state-danger .mushroom-sprite {
134
  animation: shroom-popup 0.7s cubic-bezier(.34,1.56,.64,1) both,
135
  poison-pulse 1.2s ease-in-out infinite 0.7s;
136
  filter: drop-shadow(0 0 18px rgba(255,62,91,.9));
137
  }
138
  .state-danger .myco-player {
139
- animation: myco-bob 2.4s ease-in-out infinite,
140
- myco-recoil 0.5s ease both;
141
  }
142
  @keyframes poison-pulse {
143
  0%,100%{ filter:drop-shadow(0 0 10px rgba(255,62,91,.6)); }
@@ -149,8 +125,6 @@ SCENE_STYLES = """
149
  60% { transform:translateX(.4rem); }
150
  100%{ transform:translateX(0); }
151
  }
152
-
153
- /* โ”€โ”€ STATE: game over โ”€โ”€ */
154
  .state-game-over .forest-scene,
155
  .state-game-over {
156
  animation: screen-shake .45s ease both;
@@ -162,9 +136,7 @@ SCENE_STYLES = """
162
  animation: shroom-explode .6s ease both;
163
  filter: drop-shadow(0 0 24px rgba(255,62,91,1));
164
  }
165
- .state-game-over .myco-player {
166
- animation: myco-fall .6s ease both;
167
- }
168
  @keyframes screen-shake {
169
  0%,100%{ transform:translateX(0); }
170
  20% { transform:translateX(-8px); }
@@ -181,16 +153,12 @@ SCENE_STYLES = """
181
  0% { transform:rotate(0) translateY(0); opacity:1; }
182
  100%{ transform:rotate(-90deg) translateY(2rem); opacity:.4; }
183
  }
184
-
185
- /* โ”€โ”€ Rarity glows โ”€โ”€ */
186
- .rarity-rare .mushroom-sprite { filter:drop-shadow(0 0 18px rgba(138,220,255,.9)); }
187
- .rarity-legendary .mushroom-sprite{ filter:drop-shadow(0 0 28px rgba(255,215,0,1)); animation:legendary-pulse 1s ease-in-out infinite 0.7s; }
188
  @keyframes legendary-pulse {
189
  0%,100%{ filter:drop-shadow(0 0 18px rgba(255,215,0,.7)); transform:scale(1); }
190
  50% { filter:drop-shadow(0 0 36px rgba(255,215,0,1)); transform:scale(1.1); }
191
  }
192
-
193
- /* โ”€โ”€ Mini map grid โ”€โ”€ */
194
  .forest-map {
195
  display:grid; grid-template-columns:repeat(3,1fr);
196
  gap:.3rem; margin:.4rem auto .6rem;
@@ -203,8 +171,6 @@ SCENE_STYLES = """
203
  border-radius:8px; background:rgba(255,255,255,.1); font-weight:900;
204
  }
205
  .map-tile.active { background:rgba(255,224,138,.92); color:#3d2c00!important; }
206
-
207
- /* โ”€โ”€ Caption โ”€โ”€ */
208
  .scene-caption {
209
  display:flex; justify-content:space-between; gap:.6rem;
210
  padding:.55rem .8rem; border-radius:14px;
@@ -212,8 +178,6 @@ SCENE_STYLES = """
212
  align-items:center;
213
  }
214
  .scene-caption span { color:#d9f4d4; }
215
-
216
- /* โ”€โ”€ Score burst โ”€โ”€ */
217
  .score-burst {
218
  margin:.65rem auto 0; max-width:520px;
219
  padding:.5rem .85rem; border-radius:999px;
@@ -229,8 +193,6 @@ SCENE_STYLES = """
229
  .state-game-over .score-burst {
230
  background:rgba(130,0,30,.45); border-color:rgba(255,120,140,.55);
231
  }
232
-
233
- /* โ”€โ”€ Story moment โ”€โ”€ */
234
  .story-moment {
235
  margin:.75rem auto 0; max-width:760px;
236
  padding:.8rem 1rem; border:1px solid rgba(255,234,166,.3);
@@ -239,15 +201,29 @@ SCENE_STYLES = """
239
  }
240
  .story-moment strong,.story-moment span { display:block; }
241
  .story-moment span { margin-top:.2rem; color:#f6e7b2; }
242
-
243
- /* โ”€โ”€ Suppress Gradio white flash โ”€โ”€ */
244
  .generating .forest-scene, .pending .forest-scene { opacity:.88!important; }
245
  .progress-level,.progress-level-inner { display:none!important; }
246
  div.gradio-html { background:transparent!important; }
247
  .wrap.default.pending,.wrap.default.generating { background:transparent!important; }
 
 
 
 
 
 
 
 
 
 
 
248
  </style>
249
  """
250
 
 
 
 
 
 
251
  def hero_markdown() -> str:
252
  return """
253
  <div class="myco-hero">
@@ -264,45 +240,24 @@ def home_forest_markdown() -> str:
264
  return """
265
  <div class="home-forest-postcard" aria-label="Animated Myco forest postcard">
266
  <style>
267
- .home-myco-wrapper, .home-brown-wrapper {
268
- position: relative;
269
- display: inline-block;
270
- }
271
  .home-spore {
272
- position: absolute;
273
- left: 50%;
274
- top: 20%;
275
- width: 4px;
276
- height: 4px;
277
- background: #a8ffb2; /* Green glow for Myco */
278
- border-radius: 50%;
279
- filter: blur(0.5px);
280
- box-shadow: 0 0 6px #52ff6b, 0 0 10px #fff;
281
- opacity: 0;
282
- pointer-events: none;
283
- animation: floatHomeSpore var(--duration) ease-out infinite;
284
- animation-delay: var(--delay);
285
  }
286
  @keyframes floatHomeSpore {
287
- 0% {
288
- transform: translate(0, 0) scale(1);
289
- opacity: 0;
290
- }
291
- 15% {
292
- opacity: 1;
293
- }
294
- 80% {
295
- opacity: 0.7;
296
- }
297
- 100% {
298
- transform: translate(var(--x), var(--y)) scale(0.2);
299
- opacity: 0;
300
- }
301
  }
302
  </style>
303
-
304
  <div class="home-sky">
305
- <span class="home-milky-way" title="Milky Way">๐ŸŒŒ</span>
306
  <span class="home-star star-one">โœจ</span>
307
  <span class="home-star star-two">โœฆ</span>
308
  <span class="home-star star-three">โœง</span>
@@ -310,20 +265,17 @@ def home_forest_markdown() -> str:
310
  <div class="home-forest-floor">
311
  <span class="home-tree left">๐ŸŒฒ</span>
312
  <span class="home-grass grass-left">๐ŸŒฟ</span>
313
-
314
  <span class="home-myco-wrapper">
315
- <span class="home-myco" title="Myco">๐Ÿ„</span>
316
- <span class="home-spore" style="--x: -25px; --y: -45px; --duration: 3.5s; --delay: 0s;"></span>
317
- <span class="home-spore" style="--x: 20px; --y: -35px; --duration: 4.2s; --delay: 0.8s;"></span>
318
- <span class="home-spore" style="--x: -5px; --y: -60px; --duration: 3s; --delay: 1.5s;"></span>
319
  </span>
320
-
321
  <span class="home-brown-wrapper">
322
- <span class="home-brown-mushroom" title="Brown mushroom">๐Ÿ„โ€๐ŸŸซ</span>
323
- <span class="home-spore" style="--x: -15px; --y: -40px; --duration: 3.8s; --delay: 0.4s; background: #ffeaa7; box-shadow: 0 0 6px #fdcb6e, 0 0 10px #fff;"></span>
324
- <span class="home-spore" style="--x: 25px; --y: -50px; --duration: 4.5s; --delay: 1.2s; background: #ffeaa7; box-shadow: 0 0 6px #fdcb6e, 0 0 10px #fff;"></span>
325
  </span>
326
-
327
  <span class="home-grass grass-right">๐Ÿƒ</span>
328
  <span class="home-tree right">๐ŸŒณ</span>
329
  <span class="home-moon">๐ŸŒ–</span>
@@ -347,35 +299,55 @@ def play_hook_markdown() -> str:
347
  </div>
348
  """
349
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
350
  def forest_scene(
351
- current: MushroomState | None,
352
- collection: CollectionState | None,
353
- position: tuple[int, int] | None = None,
354
  ) -> str:
355
- count = len(_safe_collection(collection))
356
- area = current_area(count)
 
357
  pos_x, pos_y = _safe_position(position)
358
- pos_cls = f"pos-{pos_x}-{pos_y}"
359
-
360
- # Define defaults to avoid complex if/else variable assignment
361
- if current is None:
362
- mushroom_name = "Hidden mushroom"
363
- rarity = "common"
364
- sprite = "โœจ"
365
- status = "The moss is listening. Click Search Clearing to wake the forest."
366
- omen = "Myco is waiting to sense the first spore."
367
- event_label = "๐ŸŒŒ Dreaming Forest"
368
- encounter = "The next clearing may reveal a memory, creature, or poison omen."
369
- mystery_label = "The Wrong Memory"
370
- score_total = "0"
371
- health = "3"
372
- reward_text = "Search a clearing to score spores."
373
- state_cls = "state-waiting"
374
- else:
 
375
  mushroom_name = current.get("name", "Mystery mushroom")
376
- rarity = current.get("rarity", "Common").lower()
377
-
378
- # Sprite logic
 
379
  if current.get("poison") == "Yes":
380
  sprite = "โ˜ ๏ธ"
381
  elif rarity == "legendary":
@@ -385,25 +357,25 @@ def forest_scene(
385
  else:
386
  sprite = "๐Ÿ„โ€๐ŸŸซ"
387
 
388
- game_over = current.get("game_over") == "Yes"
389
- studied = current.get("studied") == "Yes"
390
- event_label = f"{current.get('event_emoji','โœจ')} {current.get('event_title','Strange Omen')}"
391
- encounter = current.get("encounter", "The forest waits for Myco's reaction.")
392
  mystery_label = current.get("mystery_title", "The Wrong Memory")
393
- score_total = current.get("score_total", "0")
394
- health = current.get("health", "3")
395
- reward_text = current.get("reward_text", "Decide whether to risk the pickup.")
396
- state_cls = _scene_state_class(current)
397
-
398
- status = f"A {rarity} {mushroom_name} breaks through the moss!"
399
  if game_over:
400
  status = f"๐Ÿ’€ GAME OVER: {mushroom_name} was poisonous!"
 
 
 
 
 
 
 
 
401
 
402
- omen = "โœ… Picked! Move to the next clearing." if current.get("picked") == "Yes" else \
403
- "Press Search Clearing to start a new run." if game_over else \
404
- ("๐Ÿ“– New field note unlocked." if studied else "๐Ÿ„ Myco tilts its cap and studies the strange mushroom.")
405
-
406
- import time
407
  anim_key = str(int(time.time() * 1000))[-6:]
408
 
409
  return f'''{SCENE_STYLES}
@@ -412,8 +384,8 @@ def forest_scene(
412
  <span>๐Ÿงญ {escape(area.name)}</span>
413
  <span>๐ŸŽฎ ({pos_x+1},{pos_y+1})</span>
414
  <span>๐Ÿ“– {count} found</span>
415
- <span>โญ {escape(score_total)}</span>
416
- <span>โค๏ธ {escape(health)}/3</span>
417
  <span>{escape(event_label)}</span>
418
  <span>๐Ÿงฉ {escape(mystery_label)}</span>
419
  </div>
@@ -424,10 +396,9 @@ def forest_scene(
424
  <span class="grass grass-one">๐ŸŒฟ</span>
425
  <span class="grass grass-two">๐Ÿƒ</span>
426
  <span class="myco-player" title="Myco">๐Ÿ„</span>
427
- <span class="mushroom-sprite" title="{escape(mushroom_name)}">{sprite if current else "โœจ"}</span>
428
  <span class="sparkle sparkle-one">โœจ</span>
429
  <span class="sparkle sparkle-two">โœฆ</span>
430
- <span class="wood-log">๐Ÿชต</span>
431
  </div>
432
 
433
  <div class="forest-map" aria-label="Forest grid">
@@ -435,22 +406,29 @@ def forest_scene(
435
  </div>
436
 
437
  <div class="scene-caption">
438
- <strong>{escape(status)}</strong>
439
- <span>{escape(omen)}</span>
440
  </div>
441
- <div class="score-burst" aria-live="polite">{escape(reward_text)}</div>
442
  <div class="story-moment">
443
- <strong>{escape(event_label)}</strong>
444
- <span>{escape(encounter)}</span>
445
  </div>
446
- </div>
447
- '''
 
 
 
 
448
 
449
  def _safe_position(position):
450
  if position is None:
451
  return (1, 1)
452
- x, y = position
453
- return (max(0, min(2, int(x))), max(0, min(2, int(y))))
 
 
 
454
 
455
  def _movement_tiles(active_x, active_y):
456
  tiles = []
@@ -462,6 +440,8 @@ def _movement_tiles(active_x, active_y):
462
  return "".join(tiles)
463
 
464
  def _scene_state_class(current):
 
 
465
  if current.get("game_over") == "Yes":
466
  return "state-game-over"
467
  if current.get("picked") == "Yes":
@@ -470,35 +450,47 @@ def _scene_state_class(current):
470
  return "state-danger"
471
  return "state-discovered"
472
 
 
 
 
 
 
 
 
 
473
  def game_status_markdown(
474
- current: MushroomState | None,
475
- collection: CollectionState | None,
476
- position: tuple[int, int] | None = None,
477
  ) -> str:
478
- count = len(_safe_collection(collection))
479
- pos_x, pos_y = _safe_position(position)
480
  active_mystery = next_mystery(count)
481
  mystery_line = _mystery_goal_line(active_mystery, count)
482
 
483
  if current is None:
484
- objective = "Goal: solve **one mystery** โ€” why does Myco remember a vanished forest?"
485
- discovery = "No active discovery yet. Move Myco, then Search Clearing."
486
- ai_job = "Myco's job: notice clues you would miss alone."
487
- event = "**Event:** waiting for the first omen"
488
- clue_line = mystery_line
489
- thread_line= "**Mystery thread:** The Wrong Memory โ€” search the first clearing."
490
- bloom_line = f"**Impossible bloom:** {_mystery_bloom_meter(count)}"
491
- score_line = "**Score:** 0 spores ยท **Health:** 3/3"
492
  else:
493
- name = current.get("name", "Mystery mushroom")
494
- studied = current.get("studied") == "Yes"
495
- next_step= "Collect it to preserve the clue" if studied else "Ask Myco, then Study or Follow Whisper"
496
- if current.get("game_over") == "Yes":
 
 
497
  objective = "**๐Ÿ’€ GAME OVER** โ€” press **Search Clearing** to start a new run."
498
- elif current.get("picked") == "Yes":
499
  objective = "Current objective: **move to the next clearing and search again**."
500
  else:
 
501
  objective = f"Current objective: **{next_step}**."
 
502
  bloom_line = f"**Impossible bloom:** {_mystery_bloom_meter(count)}"
503
  score_line = (
504
  f"**Score:** {current.get('score_total','0')} spores ยท "
@@ -512,7 +504,7 @@ def game_status_markdown(
512
  f"**Mystery thread:** {current.get('mystery_title','The Wrong Memory')} โ€” "
513
  f"Next: {current.get('mystery_next','follow the whisper.')}"
514
  )
515
- ai_job = "Myco's job: interpret clues, warn you away from danger, make discoveries feel alive."
516
 
517
  return "\n".join((
518
  "### ๐ŸŽฎ Quest Log",
@@ -521,29 +513,27 @@ def game_status_markdown(
521
  event, clue_line, thread_line, mystery_line, ai_job,
522
  ))
523
 
524
- def _mystery_bloom_meter(count):
525
- filled = max(0, min(5, count))
526
- petals = "".join("๐ŸŒ•" if i < filled else "๐ŸŒ‘" for i in range(5))
527
- if filled >= 5:
528
- return f"{petals} Impossible Bloom visible"
529
- return f"{petals} {5-filled} clue-whispers remain"
530
 
531
  def mushroom_card(
532
- mushroom: Mushroom | None,
533
- clue: str | None = None,
534
- secret: str | None = None,
535
- state: MushroomState | None = None,
536
  ) -> str:
537
  if mushroom is None:
538
  return "### ๐ŸŒฒ Forest Clearing\nClick **Search Clearing** โ€” watch Myco run toward the mushroom!"
539
- s = state or {}
540
- poison = mushroom.name in POISONOUS_MUSHROOM_NAMES
541
- poison_warning = "\n> โš ๏ธ **Myco senses danger โ€” do NOT pick this without studying first!**" if poison else ""
542
  return "\n".join((
543
  f"### ๐Ÿ„โ€๐ŸŸซ {mushroom.name}",
544
  f"**{mushroom.rarity} discovery** ยท found near **{mushroom.habitat}**",
545
  f"> {mushroom.lore}",
546
- poison_warning,
547
  "",
548
  f"* **Edible:** {mushroom.edible}",
549
  f"* **Magic:** {mushroom.magic}",
@@ -554,17 +544,21 @@ def mushroom_card(
554
  f"* **Mystery:** {s.get('mystery_title','The Wrong Memory')}",
555
  f"* **Clue:** {clue or 'Study with Myco to reveal the clue.'}",
556
  f"* **Secret:** {secret or 'Collect it to see how the MycoDex reacts.'}",
 
557
  ))
558
 
559
  def _mushroom_value_label(rarity):
560
- if rarity == "Legendary": return "100 spores"
561
- if rarity == "Rare": return "35 spores + special discovery"
562
- return "10 spores"
563
 
564
  def _poison_risk_label(name):
565
  return "โš ๏ธ POISONOUS โ€” Game Over if picked!" if name in POISONOUS_MUSHROOM_NAMES else "No obvious poison"
566
 
567
- def world_map_markdown(collection: CollectionState | None) -> str:
 
 
 
 
 
568
  count = len(_safe_collection(collection))
569
  cards = []
570
  for area in AREA_UNLOCKS:
@@ -597,26 +591,34 @@ def _secret_badge(label, unlocked):
597
  icon = "๐Ÿ”Ž" if unlocked else "โ—‡"
598
  return f'<span class="achievement {state}">{icon} {escape(label)}</span>'
599
 
600
- def dex_markdown(collection: CollectionState | None) -> str:
 
 
 
 
 
601
  current_collection = _safe_collection(collection)
602
  if not current_collection:
603
  return EMPTY_DEX
604
  rows = ["### ๐Ÿ“– MycoDex", ""]
605
  for entry in current_collection:
 
606
  rows.append(
607
- f"* ๐Ÿ„ **{entry['name']}** โ€” {entry['rarity']} โ€” {entry['habitat']} "
608
- f"โ€” clue: {entry.get('clue','not studied yet')}"
609
  )
610
  return "\n".join(rows)
611
 
612
- def _safe_collection(collection):
613
- return list(collection or [])
614
 
615
- def progress_markdown(collection: CollectionState | None) -> str:
616
- count = len(_safe_collection(collection))
617
- active_area = current_area(count)
618
- upcoming_area = next_area(count)
619
- unlocked_names= ", ".join(a.name for a in unlocked_areas(count))
 
 
 
 
620
  rows = [
621
  "### โœจ Forest Progress",
622
  f"**MycoDex discoveries:** {count}",
@@ -627,27 +629,28 @@ def progress_markdown(collection: CollectionState | None) -> str:
627
  if upcoming_area:
628
  rows.append(f"**Next area:** {upcoming_area.required_discoveries - count} more to unlock **{upcoming_area.name}**.")
629
  else:
630
- rows.append(f"**All areas visible:** You reached **{AREA_UNLOCKS[-1].name}**.")
631
  if upcoming_mystery:
632
  rows.append(f"**Next secret:** {upcoming_mystery.required_discoveries - count} more to reveal **{upcoming_mystery.name}**.")
633
  else:
634
  rows.append("**All current secrets found.** Myco thinks the Elder is watching kindly.")
635
  return "\n\n".join(rows)
636
 
 
 
 
 
 
637
  def _mystery_goal_line(active_mystery, count):
638
  if active_mystery is None:
639
  return "**Mystery:** Every known clue is awake. Keep exploring for rare surprises."
640
  remaining = active_mystery.required_discoveries - count
641
  return f"**Mystery:** {remaining} clue discoveries until **{active_mystery.name}** โ€” {active_mystery.clue}"
642
 
643
- def game_intro_markdown() -> str:
644
- return """
645
- <div style="text-align:center;margin-bottom:.75rem;">
646
- <h3>๐ŸŒฒ The Deep Forest</h3>
647
- <p style="color:#666;font-size:.9em;">
648
- You step into the glowing undergrowth. Myco hops off your shoulder, its cap faintly pulsing.<br>
649
- Click <strong>Search Clearing</strong> โ€” watch Myco run toward whatever pops up.
650
- </p>
651
- </div>
652
- """
653
 
 
12
  "Ghost Gill", "Pepper Pixie", "Ruby Knuckle", "Clockwork Chanterelle",
13
  }
14
 
 
15
  SCENE_STYLES = """
16
  <style>
 
17
  .forest-scene {
18
  position: relative; isolation: isolate;
19
  overflow: hidden; min-height: 20rem;
 
26
  box-shadow: 0 18px 48px rgba(8,30,20,.26);
27
  color: #f9ffe9;
28
  }
 
 
29
  .scene-hud {
30
  position: relative; z-index: 3;
31
  display: flex; flex-wrap: wrap; gap: .4rem;
 
33
  background: rgba(13,38,28,.72); backdrop-filter: blur(6px);
34
  font-size: .8rem; font-weight: 800;
35
  }
 
 
36
  .scene-stage {
37
  position: relative; height: 13rem;
38
  margin: .6rem 0;
 
42
  border-radius: 22px; overflow: hidden;
43
  }
44
  .scene-stage span { position: absolute; line-height:1; }
 
 
45
  .tree-left { left:6%; bottom:18%; font-size:5rem; filter:drop-shadow(0 8px 12px rgba(0,0,0,.28)); }
46
  .tree-right { right:7%; bottom:20%; font-size:4.75rem; filter:drop-shadow(0 8px 12px rgba(0,0,0,.28)); }
47
  .grass-one { left:26%; bottom:14%; font-size:2.4rem; }
48
  .grass-two { right:28%;bottom:16%; font-size:2.2rem; }
 
 
49
  .sparkle-one { left:34%; top:18%; font-size:1.8rem; animation:twinkle 1.8s ease-in-out infinite; }
50
  .sparkle-two { right:33%; top:24%; font-size:1.6rem; animation:twinkle 2.2s ease-in-out infinite reverse; }
51
  @keyframes twinkle {
52
  0%,100%{opacity:.3;transform:scale(.85);}
53
  50%{opacity:1;transform:scale(1.18);}
54
  }
 
 
55
  .myco-player {
56
  font-size:4rem; z-index:2;
57
  transition: left .32s cubic-bezier(.34,1.56,.64,1), bottom .32s cubic-bezier(.34,1.56,.64,1);
 
71
  .pos-0-2 .myco-player{left:14%;bottom:13%;}
72
  .pos-1-2 .myco-player{left:41%;bottom:13%;}
73
  .pos-2-2 .myco-player{left:67%;bottom:13%;}
 
 
74
  .mushroom-sprite {
75
  right:33%; bottom:22%; font-size:3.6rem; z-index:2;
76
  filter:drop-shadow(0 6px 14px rgba(0,0,0,.3));
77
  }
 
 
78
  .state-waiting .mushroom-sprite { opacity:0; }
 
 
79
  .state-discovered .mushroom-sprite {
80
  animation: shroom-popup 0.7s cubic-bezier(.34,1.56,.64,1) both;
81
  }
 
92
  0% { transform:translateX(-3rem) scaleX(-1); }
93
  100% { transform:translateX(0) scaleX(1); }
94
  }
 
 
95
  .state-picked .mushroom-sprite {
96
  animation: shroom-catch 0.55s cubic-bezier(.34,1.56,.64,1) both;
97
  }
98
  .state-picked .myco-player {
99
+ animation: myco-bob 2.4s ease-in-out infinite, myco-catch-jump 0.55s ease both;
 
100
  }
101
  @keyframes shroom-catch {
102
  0% { opacity:1; transform:translateY(0) scale(1); }
 
107
  0%,100%{ transform:translateY(0); }
108
  40% { transform:translateY(-1.4rem) scale(1.1); }
109
  }
 
 
110
  .state-danger .mushroom-sprite {
111
  animation: shroom-popup 0.7s cubic-bezier(.34,1.56,.64,1) both,
112
  poison-pulse 1.2s ease-in-out infinite 0.7s;
113
  filter: drop-shadow(0 0 18px rgba(255,62,91,.9));
114
  }
115
  .state-danger .myco-player {
116
+ animation: myco-bob 2.4s ease-in-out infinite, myco-recoil 0.5s ease both;
 
117
  }
118
  @keyframes poison-pulse {
119
  0%,100%{ filter:drop-shadow(0 0 10px rgba(255,62,91,.6)); }
 
125
  60% { transform:translateX(.4rem); }
126
  100%{ transform:translateX(0); }
127
  }
 
 
128
  .state-game-over .forest-scene,
129
  .state-game-over {
130
  animation: screen-shake .45s ease both;
 
136
  animation: shroom-explode .6s ease both;
137
  filter: drop-shadow(0 0 24px rgba(255,62,91,1));
138
  }
139
+ .state-game-over .myco-player { animation: myco-fall .6s ease both; }
 
 
140
  @keyframes screen-shake {
141
  0%,100%{ transform:translateX(0); }
142
  20% { transform:translateX(-8px); }
 
153
  0% { transform:rotate(0) translateY(0); opacity:1; }
154
  100%{ transform:rotate(-90deg) translateY(2rem); opacity:.4; }
155
  }
156
+ .rarity-rare .mushroom-sprite { filter:drop-shadow(0 0 18px rgba(138,220,255,.9)); }
157
+ .rarity-legendary .mushroom-sprite { filter:drop-shadow(0 0 28px rgba(255,215,0,1)); animation:legendary-pulse 1s ease-in-out infinite 0.7s; }
 
 
158
  @keyframes legendary-pulse {
159
  0%,100%{ filter:drop-shadow(0 0 18px rgba(255,215,0,.7)); transform:scale(1); }
160
  50% { filter:drop-shadow(0 0 36px rgba(255,215,0,1)); transform:scale(1.1); }
161
  }
 
 
162
  .forest-map {
163
  display:grid; grid-template-columns:repeat(3,1fr);
164
  gap:.3rem; margin:.4rem auto .6rem;
 
171
  border-radius:8px; background:rgba(255,255,255,.1); font-weight:900;
172
  }
173
  .map-tile.active { background:rgba(255,224,138,.92); color:#3d2c00!important; }
 
 
174
  .scene-caption {
175
  display:flex; justify-content:space-between; gap:.6rem;
176
  padding:.55rem .8rem; border-radius:14px;
 
178
  align-items:center;
179
  }
180
  .scene-caption span { color:#d9f4d4; }
 
 
181
  .score-burst {
182
  margin:.65rem auto 0; max-width:520px;
183
  padding:.5rem .85rem; border-radius:999px;
 
193
  .state-game-over .score-burst {
194
  background:rgba(130,0,30,.45); border-color:rgba(255,120,140,.55);
195
  }
 
 
196
  .story-moment {
197
  margin:.75rem auto 0; max-width:760px;
198
  padding:.8rem 1rem; border:1px solid rgba(255,234,166,.3);
 
201
  }
202
  .story-moment strong,.story-moment span { display:block; }
203
  .story-moment span { margin-top:.2rem; color:#f6e7b2; }
 
 
204
  .generating .forest-scene, .pending .forest-scene { opacity:.88!important; }
205
  .progress-level,.progress-level-inner { display:none!important; }
206
  div.gradio-html { background:transparent!important; }
207
  .wrap.default.pending,.wrap.default.generating { background:transparent!important; }
208
+
209
+ /* AI activity indicator */
210
+ .ai-tick-badge {
211
+ display:inline-block; padding:.15rem .55rem; border-radius:999px;
212
+ background:rgba(80,220,120,.22); border:1px solid rgba(80,220,120,.4);
213
+ color:#90ffb8; font-size:.72rem; font-weight:800;
214
+ animation: ai-pulse 2s ease-in-out infinite;
215
+ }
216
+ @keyframes ai-pulse {
217
+ 0%,100%{ opacity:.6; } 50%{ opacity:1; }
218
+ }
219
  </style>
220
  """
221
 
222
+
223
+ # ---------------------------------------------------------------------------
224
+ # Static UI fragments
225
+ # ---------------------------------------------------------------------------
226
+
227
  def hero_markdown() -> str:
228
  return """
229
  <div class="myco-hero">
 
240
  return """
241
  <div class="home-forest-postcard" aria-label="Animated Myco forest postcard">
242
  <style>
243
+ .home-myco-wrapper, .home-brown-wrapper { position:relative; display:inline-block; }
 
 
 
244
  .home-spore {
245
+ position:absolute; left:50%; top:20%; width:4px; height:4px;
246
+ background:#a8ffb2; border-radius:50%; filter:blur(0.5px);
247
+ box-shadow:0 0 6px #52ff6b,0 0 10px #fff;
248
+ opacity:0; pointer-events:none;
249
+ animation:floatHomeSpore var(--duration) ease-out infinite;
250
+ animation-delay:var(--delay);
 
 
 
 
 
 
 
251
  }
252
  @keyframes floatHomeSpore {
253
+ 0% { transform:translate(0,0) scale(1); opacity:0; }
254
+ 15% { opacity:1; }
255
+ 80% { opacity:0.7; }
256
+ 100% { transform:translate(var(--x),var(--y)) scale(0.2); opacity:0; }
 
 
 
 
 
 
 
 
 
 
257
  }
258
  </style>
 
259
  <div class="home-sky">
260
+ <span class="home-milky-way">๐ŸŒŒ</span>
261
  <span class="home-star star-one">โœจ</span>
262
  <span class="home-star star-two">โœฆ</span>
263
  <span class="home-star star-three">โœง</span>
 
265
  <div class="home-forest-floor">
266
  <span class="home-tree left">๐ŸŒฒ</span>
267
  <span class="home-grass grass-left">๐ŸŒฟ</span>
 
268
  <span class="home-myco-wrapper">
269
+ <span class="home-myco">๐Ÿ„</span>
270
+ <span class="home-spore" style="--x:-25px;--y:-45px;--duration:3.5s;--delay:0s;"></span>
271
+ <span class="home-spore" style="--x:20px;--y:-35px;--duration:4.2s;--delay:0.8s;"></span>
272
+ <span class="home-spore" style="--x:-5px;--y:-60px;--duration:3s;--delay:1.5s;"></span>
273
  </span>
 
274
  <span class="home-brown-wrapper">
275
+ <span class="home-brown-mushroom">๐Ÿ„โ€๐ŸŸซ</span>
276
+ <span class="home-spore" style="--x:-15px;--y:-40px;--duration:3.8s;--delay:0.4s;background:#ffeaa7;box-shadow:0 0 6px #fdcb6e,0 0 10px #fff;"></span>
277
+ <span class="home-spore" style="--x:25px;--y:-50px;--duration:4.5s;--delay:1.2s;background:#ffeaa7;box-shadow:0 0 6px #fdcb6e,0 0 10px #fff;"></span>
278
  </span>
 
279
  <span class="home-grass grass-right">๐Ÿƒ</span>
280
  <span class="home-tree right">๐ŸŒณ</span>
281
  <span class="home-moon">๐ŸŒ–</span>
 
299
  </div>
300
  """
301
 
302
+ def game_intro_markdown() -> str:
303
+ return """
304
+ <div style="text-align:center;margin-bottom:.75rem;">
305
+ <h3>๐ŸŒฒ The Deep Forest</h3>
306
+ <p style="color:#aacfaa;font-size:.9em;">
307
+ You step into the glowing undergrowth. Myco hops off your shoulder, its cap faintly pulsing.<br>
308
+ Click <strong>Search Clearing</strong> โ€” watch Myco run toward whatever pops up.
309
+ <span class="ai-tick-badge">๐Ÿค– Myco AI roaming</span>
310
+ </p>
311
+ </div>
312
+ """
313
+
314
+
315
+ # ---------------------------------------------------------------------------
316
+ # Forest scene โ€” main animated panel
317
+ # ---------------------------------------------------------------------------
318
+
319
  def forest_scene(
320
+ current: "MushroomState | None",
321
+ collection: "CollectionState | None",
322
+ position: "tuple[int,int] | None" = None,
323
  ) -> str:
324
+ import time
325
+ count = len(_safe_collection(collection))
326
+ area = current_area(count)
327
  pos_x, pos_y = _safe_position(position)
328
+ pos_cls = f"pos-{pos_x}-{pos_y}"
329
+
330
+ # โ”€โ”€ Safe defaults โ”€โ”€ assign ALL variables before the if/else so
331
+ # nothing is ever "referenced before assignment"
332
+ mushroom_name = "Hidden mushroom"
333
+ rarity = "common"
334
+ sprite = "โœจ"
335
+ status = "The moss is listening. Click Search Clearing to wake the forest."
336
+ omen = "Myco is waiting to sense the first spore."
337
+ event_label = "๐ŸŒŒ Dreaming Forest"
338
+ encounter = "The next clearing may reveal a memory, creature, or poison omen."
339
+ mystery_label = "The Wrong Memory"
340
+ score_total = "0"
341
+ health = "3"
342
+ reward_text = "Search a clearing to score spores."
343
+ state_cls = "state-waiting" # โ† always set here first
344
+
345
+ if current is not None:
346
  mushroom_name = current.get("name", "Mystery mushroom")
347
+ rarity = current.get("rarity", "Common").lower()
348
+ game_over = current.get("game_over") == "Yes"
349
+ studied = current.get("studied") == "Yes"
350
+
351
  if current.get("poison") == "Yes":
352
  sprite = "โ˜ ๏ธ"
353
  elif rarity == "legendary":
 
357
  else:
358
  sprite = "๐Ÿ„โ€๐ŸŸซ"
359
 
360
+ event_label = f"{current.get('event_emoji','โœจ')} {current.get('event_title','Strange Omen')}"
361
+ encounter = current.get("encounter", "The forest waits for Myco's reaction.")
 
 
362
  mystery_label = current.get("mystery_title", "The Wrong Memory")
363
+ score_total = current.get("score_total", "0")
364
+ health = current.get("health", "3")
365
+ reward_text = current.get("reward_text", "Decide whether to risk the pickup.")
366
+ state_cls = _scene_state_class(current) # โ† overwrite only when current exists
367
+
 
368
  if game_over:
369
  status = f"๐Ÿ’€ GAME OVER: {mushroom_name} was poisonous!"
370
+ omen = "Press Search Clearing to start a new run."
371
+ elif current.get("picked") == "Yes":
372
+ status = f"โœ… {mushroom_name} picked! Move to the next clearing."
373
+ omen = "Move Myco and search again."
374
+ else:
375
+ status = f"A {rarity} {mushroom_name} breaks through the moss!"
376
+ omen = ("๐Ÿ“– Field note unlocked." if studied
377
+ else "๐Ÿ„ Myco tilts its cap. Study it before picking!")
378
 
 
 
 
 
 
379
  anim_key = str(int(time.time() * 1000))[-6:]
380
 
381
  return f'''{SCENE_STYLES}
 
384
  <span>๐Ÿงญ {escape(area.name)}</span>
385
  <span>๐ŸŽฎ ({pos_x+1},{pos_y+1})</span>
386
  <span>๐Ÿ“– {count} found</span>
387
+ <span>โญ {escape(str(score_total))}</span>
388
+ <span>โค๏ธ {escape(str(health))}/3</span>
389
  <span>{escape(event_label)}</span>
390
  <span>๐Ÿงฉ {escape(mystery_label)}</span>
391
  </div>
 
396
  <span class="grass grass-one">๐ŸŒฟ</span>
397
  <span class="grass grass-two">๐Ÿƒ</span>
398
  <span class="myco-player" title="Myco">๐Ÿ„</span>
399
+ <span class="mushroom-sprite" title="{escape(mushroom_name)}">{escape(sprite)}</span>
400
  <span class="sparkle sparkle-one">โœจ</span>
401
  <span class="sparkle sparkle-two">โœฆ</span>
 
402
  </div>
403
 
404
  <div class="forest-map" aria-label="Forest grid">
 
406
  </div>
407
 
408
  <div class="scene-caption">
409
+ <strong>{escape(str(status))}</strong>
410
+ <span>{escape(str(omen))}</span>
411
  </div>
412
+ <div class="score-burst" aria-live="polite">{escape(str(reward_text))}</div>
413
  <div class="story-moment">
414
+ <strong>{escape(str(event_label))}</strong>
415
+ <span>{escape(str(encounter))}</span>
416
  </div>
417
+ </div>'''
418
+
419
+
420
+ # ---------------------------------------------------------------------------
421
+ # Helpers
422
+ # ---------------------------------------------------------------------------
423
 
424
  def _safe_position(position):
425
  if position is None:
426
  return (1, 1)
427
+ try:
428
+ x, y = position
429
+ return (max(0, min(2, int(x))), max(0, min(2, int(y))))
430
+ except Exception:
431
+ return (1, 1)
432
 
433
  def _movement_tiles(active_x, active_y):
434
  tiles = []
 
440
  return "".join(tiles)
441
 
442
  def _scene_state_class(current):
443
+ if not current:
444
+ return "state-waiting"
445
  if current.get("game_over") == "Yes":
446
  return "state-game-over"
447
  if current.get("picked") == "Yes":
 
450
  return "state-danger"
451
  return "state-discovered"
452
 
453
+ def _safe_collection(collection):
454
+ return list(collection or [])
455
+
456
+
457
+ # ---------------------------------------------------------------------------
458
+ # Game status panel
459
+ # ---------------------------------------------------------------------------
460
+
461
  def game_status_markdown(
462
+ current: "MushroomState | None",
463
+ collection: "CollectionState | None",
464
+ position: "tuple[int,int] | None" = None,
465
  ) -> str:
466
+ count = len(_safe_collection(collection))
467
+ pos_x, pos_y = _safe_position(position)
468
  active_mystery = next_mystery(count)
469
  mystery_line = _mystery_goal_line(active_mystery, count)
470
 
471
  if current is None:
472
+ objective = "Goal: solve **one mystery** โ€” why does Myco remember a vanished forest?"
473
+ discovery = "No active discovery yet. Move Myco, then Search Clearing."
474
+ ai_job = "Myco AI is roaming โ€” watch it search, study, and collect automatically."
475
+ event = "**Event:** waiting for the first omen"
476
+ clue_line = mystery_line
477
+ thread_line = "**Mystery thread:** The Wrong Memory โ€” search the first clearing."
478
+ bloom_line = f"**Impossible bloom:** {_mystery_bloom_meter(count)}"
479
+ score_line = "**Score:** 0 spores ยท **Health:** 3/3"
480
  else:
481
+ name = current.get("name", "Mystery mushroom")
482
+ studied = current.get("studied") == "Yes"
483
+ game_over = current.get("game_over") == "Yes"
484
+ picked = current.get("picked") == "Yes"
485
+
486
+ if game_over:
487
  objective = "**๐Ÿ’€ GAME OVER** โ€” press **Search Clearing** to start a new run."
488
+ elif picked:
489
  objective = "Current objective: **move to the next clearing and search again**."
490
  else:
491
+ next_step = "Collect it to preserve the clue" if studied else "Study it, then Collect or Pick"
492
  objective = f"Current objective: **{next_step}**."
493
+
494
  bloom_line = f"**Impossible bloom:** {_mystery_bloom_meter(count)}"
495
  score_line = (
496
  f"**Score:** {current.get('score_total','0')} spores ยท "
 
504
  f"**Mystery thread:** {current.get('mystery_title','The Wrong Memory')} โ€” "
505
  f"Next: {current.get('mystery_next','follow the whisper.')}"
506
  )
507
+ ai_job = "Myco AI is watching โ€” it will study and collect automatically while you explore."
508
 
509
  return "\n".join((
510
  "### ๐ŸŽฎ Quest Log",
 
513
  event, clue_line, thread_line, mystery_line, ai_job,
514
  ))
515
 
516
+
517
+ # ---------------------------------------------------------------------------
518
+ # Mushroom card
519
+ # ---------------------------------------------------------------------------
 
 
520
 
521
  def mushroom_card(
522
+ mushroom: "Mushroom | None",
523
+ clue: "str | None" = None,
524
+ secret: "str | None" = None,
525
+ state: "MushroomState | None" = None,
526
  ) -> str:
527
  if mushroom is None:
528
  return "### ๐ŸŒฒ Forest Clearing\nClick **Search Clearing** โ€” watch Myco run toward the mushroom!"
529
+ s = state or {}
530
+ poison = mushroom.name in POISONOUS_MUSHROOM_NAMES
531
+ warning = "\n> โš ๏ธ **Myco senses danger โ€” do NOT pick this without studying first!**" if poison else ""
532
  return "\n".join((
533
  f"### ๐Ÿ„โ€๐ŸŸซ {mushroom.name}",
534
  f"**{mushroom.rarity} discovery** ยท found near **{mushroom.habitat}**",
535
  f"> {mushroom.lore}",
536
+ warning,
537
  "",
538
  f"* **Edible:** {mushroom.edible}",
539
  f"* **Magic:** {mushroom.magic}",
 
544
  f"* **Mystery:** {s.get('mystery_title','The Wrong Memory')}",
545
  f"* **Clue:** {clue or 'Study with Myco to reveal the clue.'}",
546
  f"* **Secret:** {secret or 'Collect it to see how the MycoDex reacts.'}",
547
+ f"* **Status:** {'โš ๏ธ POISONOUS' if poison else 'โœ… Appears safe'}",
548
  ))
549
 
550
  def _mushroom_value_label(rarity):
551
+ return {"Legendary": "100 spores", "Rare": "35 spores"}.get(rarity, "10 spores")
 
 
552
 
553
  def _poison_risk_label(name):
554
  return "โš ๏ธ POISONOUS โ€” Game Over if picked!" if name in POISONOUS_MUSHROOM_NAMES else "No obvious poison"
555
 
556
+
557
+ # ---------------------------------------------------------------------------
558
+ # World map
559
+ # ---------------------------------------------------------------------------
560
+
561
+ def world_map_markdown(collection: "CollectionState | None") -> str:
562
  count = len(_safe_collection(collection))
563
  cards = []
564
  for area in AREA_UNLOCKS:
 
591
  icon = "๐Ÿ”Ž" if unlocked else "โ—‡"
592
  return f'<span class="achievement {state}">{icon} {escape(label)}</span>'
593
 
594
+
595
+ # ---------------------------------------------------------------------------
596
+ # MycoDex
597
+ # ---------------------------------------------------------------------------
598
+
599
+ def dex_markdown(collection: "CollectionState | None") -> str:
600
  current_collection = _safe_collection(collection)
601
  if not current_collection:
602
  return EMPTY_DEX
603
  rows = ["### ๐Ÿ“– MycoDex", ""]
604
  for entry in current_collection:
605
+ poison_flag = " โ˜ ๏ธ" if entry.get("poison") == "Yes" else ""
606
  rows.append(
607
+ f"* ๐Ÿ„ **{entry['name']}**{poison_flag} โ€” {entry['rarity']} โ€” "
608
+ f"{entry['habitat']} โ€” clue: {entry.get('clue','not studied yet')}"
609
  )
610
  return "\n".join(rows)
611
 
 
 
612
 
613
+ # ---------------------------------------------------------------------------
614
+ # Progress
615
+ # ---------------------------------------------------------------------------
616
+
617
+ def progress_markdown(collection: "CollectionState | None") -> str:
618
+ count = len(_safe_collection(collection))
619
+ active_area = current_area(count)
620
+ upcoming_area = next_area(count)
621
+ unlocked_names = ", ".join(a.name for a in unlocked_areas(count))
622
  rows = [
623
  "### โœจ Forest Progress",
624
  f"**MycoDex discoveries:** {count}",
 
629
  if upcoming_area:
630
  rows.append(f"**Next area:** {upcoming_area.required_discoveries - count} more to unlock **{upcoming_area.name}**.")
631
  else:
632
+ rows.append(f"**All areas visible.** You reached **{AREA_UNLOCKS[-1].name}**.")
633
  if upcoming_mystery:
634
  rows.append(f"**Next secret:** {upcoming_mystery.required_discoveries - count} more to reveal **{upcoming_mystery.name}**.")
635
  else:
636
  rows.append("**All current secrets found.** Myco thinks the Elder is watching kindly.")
637
  return "\n\n".join(rows)
638
 
639
+
640
+ # ---------------------------------------------------------------------------
641
+ # Helpers
642
+ # ---------------------------------------------------------------------------
643
+
644
  def _mystery_goal_line(active_mystery, count):
645
  if active_mystery is None:
646
  return "**Mystery:** Every known clue is awake. Keep exploring for rare surprises."
647
  remaining = active_mystery.required_discoveries - count
648
  return f"**Mystery:** {remaining} clue discoveries until **{active_mystery.name}** โ€” {active_mystery.clue}"
649
 
650
+ def _mystery_bloom_meter(count):
651
+ filled = max(0, min(5, count))
652
+ petals = "".join("๐ŸŒ•" if i < filled else "๐ŸŒ‘" for i in range(5))
653
+ if filled >= 5:
654
+ return f"{petals} Impossible Bloom visible"
655
+ return f"{petals} {5 - filled} clue-whispers remain"
 
 
 
 
656