Lashtw commited on
Commit
f802aeb
·
1 Parent(s): 91643a8

feat: 自動同步更新至 Hugging Face

Browse files
Files changed (3) hide show
  1. css/game.css +244 -0
  2. js/config.js +279 -3
  3. js/game.js +142 -5
css/game.css CHANGED
@@ -4422,5 +4422,249 @@ html[data-theme="dark"] .r-card { background: var(--bg-2); }
4422
  50% { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(217, 119, 6, 0); }
4423
  }
4424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4425
 
4426
 
 
4422
  50% { transform: scale(1.04); box-shadow: 0 0 0 4px rgba(217, 119, 6, 0); }
4423
  }
4424
 
4425
+ /* ===================== 專屬獨特稱號體系 (Title Visuals & Gallery) ===================== */
4426
+ .title-badge {
4427
+ display: inline-flex;
4428
+ align-items: center;
4429
+ gap: 5px;
4430
+ font-weight: 700;
4431
+ letter-spacing: 0.5px;
4432
+ border-radius: 9999px;
4433
+ white-space: nowrap;
4434
+ vertical-align: middle;
4435
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
4436
+ transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, filter 0.2s ease;
4437
+ user-select: none;
4438
+ box-sizing: border-box;
4439
+ }
4440
+ .title-badge:hover {
4441
+ transform: translateY(-1.5px) scale(1.04);
4442
+ filter: brightness(1.08);
4443
+ }
4444
+ .title-badge-sm {
4445
+ font-size: 11px;
4446
+ padding: 1.5px 7px;
4447
+ margin-left: 6px;
4448
+ line-height: 1.35;
4449
+ }
4450
+ .title-badge-md {
4451
+ font-size: 12px;
4452
+ padding: 2.5px 10px;
4453
+ margin-left: 8px;
4454
+ line-height: 1.4;
4455
+ cursor: pointer;
4456
+ }
4457
+ .title-badge-lg {
4458
+ font-size: 14px;
4459
+ padding: 5px 14px;
4460
+ line-height: 1.5;
4461
+ }
4462
+ .title-badge .title-icon {
4463
+ display: inline-block;
4464
+ font-style: normal;
4465
+ line-height: 1;
4466
+ filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
4467
+ }
4468
+ .title-badge .title-text {
4469
+ display: inline-block;
4470
+ letter-spacing: 0.3px;
4471
+ }
4472
+
4473
+ /* 頂級神話流光極光動畫 */
4474
+ .title-glow-celestial {
4475
+ background-size: 200% 200% !important;
4476
+ animation: titleCelestialShimmer 4s ease infinite;
4477
+ }
4478
+ @keyframes titleCelestialShimmer {
4479
+ 0% { background-position: 0% 50%; }
4480
+ 50% { background-position: 100% 50%; }
4481
+ 100% { background-position: 0% 50%; }
4482
+ }
4483
+
4484
+ /* 斬魔神將・赤煞熾芒脈衝 */
4485
+ .title-glow-red {
4486
+ animation: titlePulseRed 2.8s ease-in-out infinite alternate;
4487
+ }
4488
+ @keyframes titlePulseRed {
4489
+ 0% { box-shadow: 0 0 6px rgba(239, 68, 68, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
4490
+ 100% { box-shadow: 0 0 14px rgba(239, 68, 68, 0.85), 0 0 4px rgba(254, 202, 202, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
4491
+ }
4492
+
4493
+ /* 破魔先鋒・紫雷電芒脈衝 */
4494
+ .title-glow-purple {
4495
+ animation: titlePulsePurple 2.8s ease-in-out infinite alternate;
4496
+ }
4497
+ @keyframes titlePulsePurple {
4498
+ 0% { box-shadow: 0 0 6px rgba(168, 85, 247, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
4499
+ 100% { box-shadow: 0 0 14px rgba(168, 85, 247, 0.85), 0 0 4px rgba(233, 213, 255, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
4500
+ }
4501
+
4502
+ /* 誅邪武聖・烈焰焚天脈衝 */
4503
+ .title-glow-orange {
4504
+ animation: titlePulseOrange 2.8s ease-in-out infinite alternate;
4505
+ }
4506
+ @keyframes titlePulseOrange {
4507
+ 0% { box-shadow: 0 0 6px rgba(249, 115, 22, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
4508
+ 100% { box-shadow: 0 0 14px rgba(249, 115, 22, 0.85), 0 0 4px rgba(254, 215, 170, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
4509
+ }
4510
+
4511
+ /* 破雷先鋒・蒼雷天青脈衝 */
4512
+ .title-glow-blue {
4513
+ animation: titlePulseBlue 2.8s ease-in-out infinite alternate;
4514
+ }
4515
+ @keyframes titlePulseBlue {
4516
+ 0% { box-shadow: 0 0 6px rgba(2, 132, 199, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
4517
+ 100% { box-shadow: 0 0 12px rgba(2, 132, 199, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
4518
+ }
4519
+
4520
+ /* 榮譽稱號閣 Modal 樣式 */
4521
+ .title-gallery-modal {
4522
+ padding: 4px 2px;
4523
+ }
4524
+ .title-gallery-header {
4525
+ text-align: center;
4526
+ padding-bottom: 14px;
4527
+ border-bottom: 1px dashed rgba(226, 232, 240, 0.8);
4528
+ margin-bottom: 16px;
4529
+ }
4530
+ .title-gallery-title {
4531
+ margin: 0;
4532
+ font-size: 20px;
4533
+ font-weight: 800;
4534
+ color: #1e293b;
4535
+ display: flex;
4536
+ align-items: center;
4537
+ justify-content: center;
4538
+ gap: 8px;
4539
+ }
4540
+ .title-gallery-sub {
4541
+ font-size: 13px;
4542
+ color: #64748b;
4543
+ margin-top: 4px;
4544
+ }
4545
+ .title-gallery-current-banner {
4546
+ background: linear-gradient(135deg, rgba(241, 245, 249, 0.9), rgba(248, 250, 252, 0.95));
4547
+ border: 1px solid #e2e8f0;
4548
+ border-radius: 14px;
4549
+ padding: 14px 18px;
4550
+ margin-bottom: 20px;
4551
+ display: flex;
4552
+ align-items: center;
4553
+ justify-content: space-between;
4554
+ gap: 12px;
4555
+ box-shadow: inset 0 1px 2px rgba(255,255,255,0.8), 0 2px 4px rgba(0,0,0,0.03);
4556
+ }
4557
+ .title-gallery-current-label {
4558
+ font-size: 12px;
4559
+ font-weight: 700;
4560
+ color: #64748b;
4561
+ margin-bottom: 4px;
4562
+ }
4563
+ .title-gallery-section-title {
4564
+ font-size: 14px;
4565
+ font-weight: 800;
4566
+ color: #334155;
4567
+ margin: 16px 0 10px;
4568
+ display: flex;
4569
+ align-items: center;
4570
+ gap: 6px;
4571
+ }
4572
+ .title-gallery-grid {
4573
+ display: grid;
4574
+ grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
4575
+ gap: 12px;
4576
+ }
4577
+ .title-card {
4578
+ border-radius: 12px;
4579
+ border: 1px solid #e2e8f0;
4580
+ padding: 12px 14px;
4581
+ background: #ffffff;
4582
+ display: flex;
4583
+ flex-direction: column;
4584
+ justify-content: space-between;
4585
+ gap: 8px;
4586
+ transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
4587
+ position: relative;
4588
+ overflow: hidden;
4589
+ }
4590
+ .title-card.owned {
4591
+ border-color: #cbd5e1;
4592
+ background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
4593
+ box-shadow: 0 2px 5px rgba(0,0,0,0.04);
4594
+ }
4595
+ .title-card.equipped {
4596
+ border-color: #f59e0b;
4597
+ background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
4598
+ box-shadow: 0 0 0 1.5px #f59e0b, 0 4px 12px rgba(245, 158, 11, 0.15);
4599
+ }
4600
+ .title-card.locked {
4601
+ opacity: 0.65;
4602
+ background: #f8fafc;
4603
+ border-color: #e2e8f0;
4604
+ }
4605
+ .title-card-top {
4606
+ display: flex;
4607
+ align-items: center;
4608
+ justify-content: space-between;
4609
+ gap: 8px;
4610
+ }
4611
+ .title-card-source {
4612
+ font-size: 11px;
4613
+ color: #94a3b8;
4614
+ font-weight: 600;
4615
+ }
4616
+ .title-card-desc {
4617
+ font-size: 12px;
4618
+ color: #475569;
4619
+ line-height: 1.5;
4620
+ }
4621
+ .title-card-btn {
4622
+ width: 100%;
4623
+ padding: 6px 12px;
4624
+ font-size: 12px;
4625
+ font-weight: 700;
4626
+ border-radius: 8px;
4627
+ border: none;
4628
+ cursor: pointer;
4629
+ transition: all 0.15s ease;
4630
+ margin-top: 4px;
4631
+ }
4632
+ .title-card-btn-equip {
4633
+ background: linear-gradient(135deg, #3b82f6, #2563eb);
4634
+ color: #ffffff;
4635
+ box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
4636
+ }
4637
+ .title-card-btn-equip:hover {
4638
+ background: linear-gradient(135deg, #2563eb, #1d4ed8);
4639
+ transform: translateY(-1px);
4640
+ }
4641
+ .title-card-badge-equipped {
4642
+ background: #fef3c7;
4643
+ color: #b45309;
4644
+ font-size: 11.5px;
4645
+ font-weight: 800;
4646
+ text-align: center;
4647
+ padding: 5px 8px;
4648
+ border-radius: 8px;
4649
+ border: 1px solid #fde68a;
4650
+ }
4651
+ .title-card-lock-tip {
4652
+ font-size: 11px;
4653
+ color: #94a3b8;
4654
+ text-align: center;
4655
+ padding: 4px;
4656
+ }
4657
+
4658
+ @media (max-width: 640px) {
4659
+ .title-gallery-grid {
4660
+ grid-template-columns: 1fr;
4661
+ }
4662
+ .title-badge-md {
4663
+ font-size: 11px;
4664
+ padding: 2px 7px;
4665
+ margin-left: 4px;
4666
+ }
4667
+ }
4668
+
4669
 
4670
 
js/config.js CHANGED
@@ -516,16 +516,292 @@ export const MERCHANT = {
516
  { id: 'bow', name: '突騎破陣弓', icon: '🏹', lv: 3, cost: 55, limit: 1, limitType: 'once', effect: 'boss_crit_dmg', val: 0.5, desc: '世界 Boss 暴擊傷害倍率 +50%' },
517
  { id: 'horn', name: '大漠聚魂號角', icon: '📯', lv: 3, cost: 30, limit: 2, limitType: 'week', effect: 'boss_order', count: 1, desc: '今日世界 Boss 討伐次數額外 +1 次' },
518
  { id: 'goldTally', name: '敕賜大將雙兵符', icon: '🪖', lv: 4, cost: 35, limit: 1, limitType: 'week', effect: 'full_tally', count: 2, val: 2, desc: '獲得完整金兵符 ×2(御商特惠每週 1 份,Lv.6 瀚海節度使放寬為 2 份)' },
519
- { id: 'title1', name: '稱號【博通西域・卷壹】', icon: '👑', lv: 4, cost: 120, limit: 1, limitType: 'once', effect: 'title', title: '博通西域・卷壹', desc: '第一紀元 Part A 畢業尊榮炫耀稱號' },
520
  { id: 'grain12h', name: '西域天山雪蓮', icon: '❄️', lv: 5, cost: 50, limit: 1, limitType: 'week', effect: 'grain_sec', sec: 43200, desc: '發放 12 小時 (43,200秒) 當前 CPS 巨額糧草' },
521
  { id: 'horse', name: '汗血寶馬令', icon: '🐎', lv: 5, cost: 90, limit: 1, limitType: 'once', effect: 'cost_discount', discount: 0.15, desc: '九州全境名都出征輜重與駐防升級成本永久 -15%' },
522
  { id: 'winterSachet', name: '寒假修煉香囊', icon: '🏮', lv: 5, cost: 35, limit: 1, limitType: 'week', effect: 'offline_mult', mult: 2.0, hours: 168, desc: '寒假期間離線結算產能 2.0 倍神速成長' },
523
  { id: 'crossbow', name: '大漠破甲重弩', icon: '🎯', lv: 6, cost: 80, limit: 1, limitType: 'once', effect: 'boss_crit_flat', addDmg: 1, desc: '世界 Boss 暴擊傷害額外 +1(暴擊扣 3 HP)' },
524
- { id: 'title2', name: '稱號【名震天山・卷貳】', icon: '👑', lv: 6, cost: 120, limit: 1, limitType: 'once', effect: 'title', title: '名震天山・卷貳', desc: '第二紀元 Part B 畢業尊榮炫耀稱號' },
525
  { id: 'grain24h', name: '常平帝國輜重', icon: '🏛️', lv: 7, cost: 75, limit: 1, limitType: 'week', effect: 'grain_sec', sec: 86400, desc: '發放 24 小時整天 (86,400秒) 當前 CPS 終極糧草' },
526
  { id: 'pill', name: '全軍破境神丹', icon: '💊', lv: 7, cost: 50, limit: 3, limitType: 'tier', effect: 'global_prod_add', val: 0.10, desc: '九州全境名都秒產永久 +10%(上限疊加 3 次)' },
527
  { id: 'tallyChest', name: '神武金兵符寶匣', icon: '📦', lv: 7, cost: 100, limit: 1, limitType: 'once', effect: 'full_tally', count: 5, val: 5, desc: '萬里胡商盟主尊享大禮:直接獲得整箱完整大將金兵符 ×5(終身限購 1 次)!' },
528
  { id: 'seal', name: '至尊【天可汗金印】', icon: '✨', lv: 8, cost: 150, limit: 1, limitType: 'once', effect: 'frame_effect', desc: '名冊與排行榜專屬金色流光動態巨龍外框' },
529
- { id: 'title3', name: '稱號【九百六十・一統天下】', icon: '👑', lv: 8, cost: 160, limit: 1, limitType: 'once', effect: 'title', title: '九百六十・一統天下', desc: '960 單字全制霸終極傳奇稱號' },
530
  ]
531
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
516
  { id: 'bow', name: '突騎破陣弓', icon: '🏹', lv: 3, cost: 55, limit: 1, limitType: 'once', effect: 'boss_crit_dmg', val: 0.5, desc: '世界 Boss 暴擊傷害倍率 +50%' },
517
  { id: 'horn', name: '大漠聚魂號角', icon: '📯', lv: 3, cost: 30, limit: 2, limitType: 'week', effect: 'boss_order', count: 1, desc: '今日世界 Boss 討伐次數額外 +1 次' },
518
  { id: 'goldTally', name: '敕賜大將雙兵符', icon: '🪖', lv: 4, cost: 35, limit: 1, limitType: 'week', effect: 'full_tally', count: 2, val: 2, desc: '獲得完整金兵符 ×2(御商特惠每週 1 份,Lv.6 瀚海節度使放寬為 2 份)' },
519
+ { id: 'title1', name: '稱號【博通西域・卷壹】', icon: '📜', lv: 4, cost: 120, limit: 1, limitType: 'once', effect: 'title', title: '博通西域・卷壹', desc: '第一紀元 Part A 畢業尊榮炫耀稱號' },
520
  { id: 'grain12h', name: '西域天山雪蓮', icon: '❄️', lv: 5, cost: 50, limit: 1, limitType: 'week', effect: 'grain_sec', sec: 43200, desc: '發放 12 小時 (43,200秒) 當前 CPS 巨額糧草' },
521
  { id: 'horse', name: '汗血寶馬令', icon: '🐎', lv: 5, cost: 90, limit: 1, limitType: 'once', effect: 'cost_discount', discount: 0.15, desc: '九州全境名都出征輜重與駐防升級成本永久 -15%' },
522
  { id: 'winterSachet', name: '寒假修煉香囊', icon: '🏮', lv: 5, cost: 35, limit: 1, limitType: 'week', effect: 'offline_mult', mult: 2.0, hours: 168, desc: '寒假期間離線結算產能 2.0 倍神速成長' },
523
  { id: 'crossbow', name: '大漠破甲重弩', icon: '🎯', lv: 6, cost: 80, limit: 1, limitType: 'once', effect: 'boss_crit_flat', addDmg: 1, desc: '世界 Boss 暴擊傷害額外 +1(暴擊扣 3 HP)' },
524
+ { id: 'title2', name: '稱號【名震天山・卷貳】', icon: '❄️', lv: 6, cost: 120, limit: 1, limitType: 'once', effect: 'title', title: '名震天山・卷貳', desc: '第二紀元 Part B 畢業尊榮炫耀稱號' },
525
  { id: 'grain24h', name: '常平帝國輜重', icon: '🏛️', lv: 7, cost: 75, limit: 1, limitType: 'week', effect: 'grain_sec', sec: 86400, desc: '發放 24 小時整天 (86,400秒) 當前 CPS 終極糧草' },
526
  { id: 'pill', name: '全軍破境神丹', icon: '💊', lv: 7, cost: 50, limit: 3, limitType: 'tier', effect: 'global_prod_add', val: 0.10, desc: '九州全境名都秒產永久 +10%(上限疊加 3 次)' },
527
  { id: 'tallyChest', name: '神武金兵符寶匣', icon: '📦', lv: 7, cost: 100, limit: 1, limitType: 'once', effect: 'full_tally', count: 5, val: 5, desc: '萬里胡商盟主尊享大禮:直接獲得整箱完整大將金兵符 ×5(終身限購 1 次)!' },
528
  { id: 'seal', name: '至尊【天可汗金印】', icon: '✨', lv: 8, cost: 150, limit: 1, limitType: 'once', effect: 'frame_effect', desc: '名冊與排行榜專屬金色流光動態巨龍外框' },
529
+ { id: 'title3', name: '稱號【九百六十・一統天下】', icon: '🐉', lv: 8, cost: 160, limit: 1, limitType: 'once', effect: 'title', title: '九百六十・一統天下', desc: '960 單字全制霸終極傳奇稱號' },
530
  ]
531
  };
532
+
533
+ // ===================== 專屬獨特稱號體系 (Title Style Registry) =====================
534
+ export const TITLE_DEFS = {
535
+ // === 世界 Boss 第一期【上古・饕餮】===
536
+ '斬魔將軍': {
537
+ name: '斬魔將軍',
538
+ icon: '🗡️',
539
+ source: '世界 Boss【饕餮】討伐戰',
540
+ desc: '破陣斬將!給予上古饕餮致命最後一擊之尾刀神將!',
541
+ bg: 'linear-gradient(135deg, #ef4444 0%, #b91c1c 55%, #7f1d1d 100%)',
542
+ border: '1px solid rgba(254, 202, 202, 0.85)',
543
+ color: '#ffffff',
544
+ shadow: '0 0 10px rgba(239, 68, 68, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35)',
545
+ glowClass: 'title-glow-red',
546
+ rarity: '神話・赤煞'
547
+ },
548
+ '破魔先鋒': {
549
+ name: '破魔先鋒',
550
+ icon: '⚡',
551
+ source: '世界 Boss【饕餮】討伐戰',
552
+ desc: '雷厲風行!榮登饕餮討伐戰全班總傷害第一 MVP!',
553
+ bg: 'linear-gradient(135deg, #a855f7 0%, #7c3aed 55%, #4c1d95 100%)',
554
+ border: '1px solid rgba(233, 213, 255, 0.85)',
555
+ color: '#ffffff',
556
+ shadow: '0 0 10px rgba(168, 85, 247, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35)',
557
+ glowClass: 'title-glow-purple',
558
+ rarity: '傳奇・紫雷'
559
+ },
560
+ '平妖勇士': {
561
+ name: '平妖勇士',
562
+ icon: '🛡️',
563
+ source: '世界 Boss【饕餮】討伐戰',
564
+ desc: '萬眾一心!同袍齊心協力封印上古饕餮之英勇將士!',
565
+ bg: 'linear-gradient(135deg, #10b981 0%, #059669 55%, #064e3b 100%)',
566
+ border: '1px solid rgba(167, 243, 208, 0.75)',
567
+ color: '#ffffff',
568
+ shadow: '0 0 8px rgba(16, 185, 129, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25)',
569
+ glowClass: 'title-glow-green',
570
+ rarity: '史詩・翡翠'
571
+ },
572
+
573
+ // === 世界 Boss 第二期【上古・窮奇】===
574
+ '誅邪武聖': {
575
+ name: '誅邪武聖',
576
+ icon: '🪓',
577
+ source: '世界 Boss【窮奇】討伐戰',
578
+ desc: '神斧撼岳!力斬雷翼凶神窮奇於陣前之至尊武聖!',
579
+ bg: 'linear-gradient(135deg, #f97316 0%, #c2410c 55%, #7c2d12 100%)',
580
+ border: '1px solid rgba(254, 215, 170, 0.85)',
581
+ color: '#ffffff',
582
+ shadow: '0 0 10px rgba(249, 115, 22, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35)',
583
+ glowClass: 'title-glow-orange',
584
+ rarity: '神話・烈焰'
585
+ },
586
+ '破雷先鋒': {
587
+ name: '破雷先鋒',
588
+ icon: '⚡',
589
+ source: '世界 Boss【窮奇】討伐戰',
590
+ desc: '怒破雷海!勇奪窮奇討伐戰全班總傷害第一 MVP!',
591
+ bg: 'linear-gradient(135deg, #0284c7 0%, #0369a1 55%, #082f49 100%)',
592
+ border: '1px solid rgba(186, 230, 253, 0.85)',
593
+ color: '#ffffff',
594
+ shadow: '0 0 10px rgba(2, 132, 199, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.35)',
595
+ glowClass: 'title-glow-blue',
596
+ rarity: '傳奇・蒼雷'
597
+ },
598
+ '鎮雷天將': {
599
+ name: '鎮雷天將',
600
+ icon: '🌩️',
601
+ source: '世界 Boss【窮奇】討伐戰',
602
+ desc: '定海神針!鎮守陣地克制天雷怒潮之功勳天將!',
603
+ bg: 'linear-gradient(135deg, #4f46e5 0%, #3730a3 55%, #1e1b4b 100%)',
604
+ border: '1px solid rgba(199, 210, 254, 0.75)',
605
+ color: '#ffffff',
606
+ shadow: '0 0 8px rgba(79, 70, 229, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25)',
607
+ glowClass: 'title-glow-indigo',
608
+ rarity: '史詩・定雷'
609
+ },
610
+
611
+ // === 西域商隊系列 ===
612
+ '博通西域・卷壹': {
613
+ name: '博通西域・卷壹',
614
+ icon: '📜',
615
+ source: '西域商隊 Part A 畢業',
616
+ desc: '絲路漫漫!貫通第一紀元 Part A 320 單字之博學大儒!',
617
+ bg: 'linear-gradient(135deg, #d97706 0%, #b45309 55%, #78350f 100%)',
618
+ border: '1px solid rgba(253, 230, 138, 0.85)',
619
+ color: '#ffffff',
620
+ shadow: '0 0 8px rgba(217, 119, 6, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3)',
621
+ glowClass: 'title-glow-amber',
622
+ rarity: '傳奇・琥珀'
623
+ },
624
+ '名震天山・卷貳': {
625
+ name: '名震天山・卷貳',
626
+ icon: '❄️',
627
+ source: '西域商隊 Part B 畢業',
628
+ desc: '傲立霜雪!攻克第二紀元 Part B 單字之天山豪傑!',
629
+ bg: 'linear-gradient(135deg, #06b6d4 0%, #0e7490 55%, #164e63 100%)',
630
+ border: '1px solid rgba(165, 243, 252, 0.85)',
631
+ color: '#ffffff',
632
+ shadow: '0 0 8px rgba(6, 182, 212, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.3)',
633
+ glowClass: 'title-glow-cyan',
634
+ rarity: '傳奇・玄冰'
635
+ },
636
+ '九百六十・一統天下': {
637
+ name: '九百六十・一統天下',
638
+ icon: '🐉',
639
+ source: '西域商隊全冊圓滿制霸',
640
+ desc: '九百六十天威全制霸!君臨天下之絲綢之路天可汗!',
641
+ bg: 'linear-gradient(135deg, #f59e0b 0%, #ec4899 50%, #8b5cf6 100%)',
642
+ border: '1.5px solid #fef08a',
643
+ color: '#ffffff',
644
+ shadow: '0 0 14px rgba(236, 72, 153, 0.7), 0 0 8px rgba(245, 158, 11, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.45)',
645
+ glowClass: 'title-glow-celestial',
646
+ rarity: '天尊・神龍'
647
+ },
648
+
649
+ // === 封測先鋒系列 ===
650
+ '智勇大將軍': {
651
+ name: '智勇大將軍',
652
+ icon: '🚩',
653
+ source: '封測先鋒功勳冊封',
654
+ desc: '統軍破陣,封測功勳卓著之大將軍!',
655
+ bg: 'linear-gradient(135deg, #dc2626 0%, #991b1b 100%)',
656
+ border: '1px solid #fca5a5',
657
+ color: '#ffffff',
658
+ shadow: '0 0 8px rgba(220, 38, 38, 0.5)',
659
+ glowClass: 'title-glow-red',
660
+ rarity: '先鋒・元帥'
661
+ },
662
+ '破陣前鋒': {
663
+ name: '破陣前鋒',
664
+ icon: '🏹',
665
+ source: '封測先鋒功勳冊封',
666
+ desc: '一馬當先,攻城掠地無可阻擋之先鋒銳將!',
667
+ bg: 'linear-gradient(135deg, #ea580c 0%, #9a3412 100%)',
668
+ border: '1px solid #fdba74',
669
+ color: '#ffffff',
670
+ shadow: '0 0 8px rgba(234, 88, 12, 0.5)',
671
+ glowClass: 'title-glow-orange',
672
+ rarity: '先鋒・突騎'
673
+ },
674
+ '驍勇校尉': {
675
+ name: '驍勇校尉',
676
+ icon: '⚔️',
677
+ source: '封測先鋒功勳冊封',
678
+ desc: '百戰淬礪,恪盡職守之軍中健將!',
679
+ bg: 'linear-gradient(135deg, #2563eb 0%, #1e40af 100%)',
680
+ border: '1px solid #93c5fd',
681
+ color: '#ffffff',
682
+ shadow: '0 0 8px rgba(37, 99, 235, 0.5)',
683
+ glowClass: 'title-glow-blue',
684
+ rarity: '先鋒・校尉'
685
+ },
686
+ '���軍將士': {
687
+ name: '隨軍將士',
688
+ icon: '🔰',
689
+ source: '封測起步起手禮',
690
+ desc: '同仇敵愾,同甘共苦之隨軍勇士!',
691
+ bg: 'linear-gradient(135deg, #475569 0%, #1e293b 100%)',
692
+ border: '1px solid #cbd5e1',
693
+ color: '#ffffff',
694
+ shadow: '0 0 6px rgba(71, 85, 105, 0.4)',
695
+ glowClass: '',
696
+ rarity: '先鋒・隨軍'
697
+ }
698
+ };
699
+
700
+ /**
701
+ * 取得稱號樣式定義(支援語意模糊匹配與防禦性兜底)
702
+ */
703
+ export function getTitleDef(titleName) {
704
+ if (!titleName) return null;
705
+ const trimmed = String(titleName).trim();
706
+ if (TITLE_DEFS[trimmed]) return TITLE_DEFS[trimmed];
707
+
708
+ // 語意模糊匹配(自動為任何包含關鍵字的稱號分配相應圖標與專屬主題)
709
+ if (/神龍|天可汗|一統天下|九百六十/.test(trimmed)) {
710
+ return {
711
+ name: trimmed, icon: '🐉', rarity: '天尊・神龍', desc: '極致至尊傳奇稱號',
712
+ bg: 'linear-gradient(135deg, #f59e0b 0%, #ec4899 50%, #8b5cf6 100%)',
713
+ border: '1.5px solid #fef08a', color: '#ffffff',
714
+ shadow: '0 0 12px rgba(236,72,153,0.6), 0 0 6px rgba(245,158,11,0.8)',
715
+ glowClass: 'title-glow-celestial'
716
+ };
717
+ }
718
+ if (/斬魔|尾刀|殺|刀|誅/.test(trimmed)) {
719
+ return {
720
+ name: trimmed, icon: '🗡️', rarity: '神話・赤煞', desc: '終結一擊神將稱號',
721
+ bg: 'linear-gradient(135deg, #ef4444 0%, #b91c1c 55%, #7f1d1d 100%)',
722
+ border: '1px solid rgba(254, 202, 202, 0.85)', color: '#ffffff',
723
+ shadow: '0 0 10px rgba(239, 68, 68, 0.65)',
724
+ glowClass: 'title-glow-red'
725
+ };
726
+ }
727
+ if (/破魔|破雷|雷|電|疾/.test(trimmed)) {
728
+ return {
729
+ name: trimmed, icon: '⚡', rarity: '傳奇・雷芒', desc: '先鋒突擊銳將稱號',
730
+ bg: 'linear-gradient(135deg, #a855f7 0%, #7c3aed 55%, #4c1d95 100%)',
731
+ border: '1px solid rgba(233, 213, 255, 0.85)', color: '#ffffff',
732
+ shadow: '0 0 10px rgba(168, 85, 247, 0.65)',
733
+ glowClass: 'title-glow-purple'
734
+ };
735
+ }
736
+ if (/武聖|戰神|破天|斧/.test(trimmed)) {
737
+ return {
738
+ name: trimmed, icon: '🪓', rarity: '神話・曜金', desc: '威震八方武聖稱號',
739
+ bg: 'linear-gradient(135deg, #f97316 0%, #c2410c 55%, #7c2d12 100%)',
740
+ border: '1px solid rgba(254, 215, 170, 0.85)', color: '#ffffff',
741
+ shadow: '0 0 10px rgba(249, 115, 22, 0.65)',
742
+ glowClass: 'title-glow-orange'
743
+ };
744
+ }
745
+ if (/將軍|元帥|大將|主帥|帥/.test(trimmed)) {
746
+ return {
747
+ name: trimmed, icon: '🚩', rarity: '統帥・朱雀', desc: '三軍統帥功勳稱號',
748
+ bg: 'linear-gradient(135deg, #dc2626 0%, #991b1b 100%)',
749
+ border: '1px solid #fca5a5', color: '#ffffff',
750
+ shadow: '0 0 8px rgba(220, 38, 38, 0.5)',
751
+ glowClass: 'title-glow-red'
752
+ };
753
+ }
754
+ if (/卷|通|書|史|文|博/.test(trimmed)) {
755
+ return {
756
+ name: trimmed, icon: '📜', rarity: '傳奇・金卷', desc: '博學深思文豪稱號',
757
+ bg: 'linear-gradient(135deg, #d97706 0%, #b45309 55%, #78350f 100%)',
758
+ border: '1px solid rgba(253, 230, 138, 0.85)', color: '#ffffff',
759
+ shadow: '0 0 8px rgba(217, 119, 6, 0.55)',
760
+ glowClass: 'title-glow-amber'
761
+ };
762
+ }
763
+ if (/天山|冰|雪|寒|霜/.test(trimmed)) {
764
+ return {
765
+ name: trimmed, icon: '❄️', rarity: '傳奇・玄冰', desc: '冷傲凌霄英豪稱號',
766
+ bg: 'linear-gradient(135deg, #06b6d4 0%, #0e7490 55%, #164e63 100%)',
767
+ border: '1px solid rgba(165, 243, 252, 0.85)', color: '#ffffff',
768
+ shadow: '0 0 8px rgba(6, 182, 212, 0.55)',
769
+ glowClass: 'title-glow-cyan'
770
+ };
771
+ }
772
+ if (/勇士|平妖|衛|護|盾|甲/.test(trimmed)) {
773
+ return {
774
+ name: trimmed, icon: '🛡️', rarity: '史詩・翡翠', desc: '堅毅不拔勇將稱號',
775
+ bg: 'linear-gradient(135deg, #10b981 0%, #059669 55%, #064e3b 100%)',
776
+ border: '1px solid rgba(167, 243, 208, 0.75)', color: '#ffffff',
777
+ shadow: '0 0 8px rgba(16, 185, 129, 0.45)',
778
+ glowClass: 'title-glow-green'
779
+ };
780
+ }
781
+
782
+ // 預設兜底 (Fallback)
783
+ return {
784
+ name: trimmed, icon: '🎖️', rarity: '榮譽・勳章', desc: '專屬榮譽功勳稱號',
785
+ bg: 'linear-gradient(135deg, #6366f1 0%, #4338ca 100%)',
786
+ border: '1px solid rgba(165, 180, 252, 0.6)', color: '#ffffff',
787
+ shadow: '0 0 8px rgba(99, 102, 241, 0.45)',
788
+ glowClass: ''
789
+ };
790
+ }
791
+
792
+ /**
793
+ * 格式化輸出獨特稱號徽章 HTML
794
+ */
795
+ export function formatTitleBadge(titleName, { size = 'sm', clickable = false, titleAttr = '' } = {}) {
796
+ const def = getTitleDef(titleName);
797
+ if (!def) return '';
798
+
799
+ const safeName = String(def.name).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' })[c]);
800
+ const tip = titleAttr || `${def.icon} 【${def.name}】(${def.rarity || '榮譽稱號'})\n${def.desc || ''}`;
801
+ const safeTip = String(tip).replace(/"/g, '&quot;');
802
+ const sizeClass = size === 'md' ? 'title-badge-md' : (size === 'lg' ? 'title-badge-lg' : 'title-badge-sm');
803
+ const glow = def.glowClass ? ` ${def.glowClass}` : '';
804
+ const clickAttr = clickable ? ' data-title-clickable="1" tabindex="0" role="button"' : '';
805
+
806
+ return `<span class="title-badge ${sizeClass}${glow}" style="background:${def.bg}; border:${def.border}; color:${def.color}; box-shadow:${def.shadow};" title="${safeTip}"${clickAttr}><span class="title-icon">${def.icon}</span><span class="title-text">${safeName}</span></span>`;
807
+ }
js/game.js CHANGED
@@ -2,7 +2,8 @@ import { getDB, DBError } from './db.js?v=20261102_v1';
2
  import {
3
  BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, REVIEW_MAX_QUESTIONS, THEME, QUIZ_COIN_MIN, QUIZ_COIN_SECONDS,
4
  CLASS_STAGES, LUCKY, STAR_BASE_MAX, QUIZ_COIN_DAILY_FULL, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT,
5
- WORLD_BOSS_UNLOCK_DATE, WORLD_BOSS_END_DATE, MERCHANT, APP_BUILD_VERSION
 
6
  } from './config.js?v=20261102_v1';
7
  import {
8
  loadEnglishWords, getMerchantStatus, getMerchantDayInfo, generateMerchantQuiz, speakWord, submitMerchantAnswer,
@@ -37,6 +38,7 @@ import {
37
  export { openTodayWordsModal, openCaravanLevelsModal, openMerchantQuizModal, openMerchantEventModal, openTianjiModal };
38
  window.showAnnouncementModal = showAnnouncementModal;
39
  window.getRandomBeggingSpeech = getRandomBeggingSpeech;
 
40
 
41
  let db, user, student, classInfo = null;
42
  let game = null, progress = {}, stats = {};
@@ -127,6 +129,18 @@ async function init() {
127
  const btnBannerGuideDetail = $('#btnBannerGuideDetail');
128
  if (btnBannerGuideDetail) bind(btnBannerGuideDetail, 'click', () => openBeginnerGuideModal());
129
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  // 切到背景時補存;切回前景/喚醒設備時檢查是否有其他裝置在新時段登入(防多載具舊進度覆蓋)
131
  bind(document, 'visibilitychange', () => {
132
  if (document.hidden) {
@@ -710,9 +724,16 @@ function updateHeader() {
710
  if (!game?.curTitle && Array.isArray(game?.titles) && game.titles.length > 0) {
711
  game.curTitle = game.titles[game.titles.length - 1];
712
  }
713
- const titleBadge = game?.curTitle ? ` 【${game.curTitle}】` : '';
714
- const dragonIcon = game?.hasDragonFrame ? '🐉 ' : '';
715
- $('#userName').textContent = `${dragonIcon}${classInfo.name || classInfo.code} #${student.seat} ${student.name}${titleBadge}`;
 
 
 
 
 
 
 
716
  $('#userMeta').textContent = bankName;
717
  renderRes();
718
  updateQuizRedDot();
@@ -2353,7 +2374,7 @@ function renderRankTable() {
2353
 
2354
  const meTag = item.isMe ? '<span class="badge badge-accent" style="margin-left:6px; font-size:11px;">我</span>' : '';
2355
  const dragonTag = item.hasDragonFrame ? '<span title="天可汗金印・金龍環繞" style="margin-right:4px;">🐉</span>' : '';
2356
- const titleTag = item.curTitle ? `<span class="badge badge-accent" style="margin-left:6px; font-size:11px; background:linear-gradient(135deg,#f59e0b,#d97706); color:#fff;">👑 ${esc(item.curTitle)}</span>` : '';
2357
  const laborBadge = item.laborPassed ? '<span class="badge badge-mint" style="margin-left:4px;" title="勞權達標">🛡️</span>' : '';
2358
  const weekBadge = item.isSloth
2359
  ? '<span class="badge badge-rose" title="上週未達標,處於怠惰狀況">⚠️怠惰</span>'
@@ -2846,4 +2867,120 @@ window.setMerchantExp = (exp) => {
2846
  };
2847
  window.getMerchantStatusTest = () => (game ? getMerchantStatus(game) : null);
2848
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2849
 
 
2
  import {
3
  BUILDINGS, TIERS, SCHEDULE, PASS_SCORE, REVIEW_MAX_QUESTIONS, THEME, QUIZ_COIN_MIN, QUIZ_COIN_SECONDS,
4
  CLASS_STAGES, LUCKY, STAR_BASE_MAX, QUIZ_COIN_DAILY_FULL, WEEKLY_SCHEDULE, SLOTH_PENALTY_MULT,
5
+ WORLD_BOSS_UNLOCK_DATE, WORLD_BOSS_END_DATE, MERCHANT, APP_BUILD_VERSION,
6
+ TITLE_DEFS, getTitleDef, formatTitleBadge
7
  } from './config.js?v=20261102_v1';
8
  import {
9
  loadEnglishWords, getMerchantStatus, getMerchantDayInfo, generateMerchantQuiz, speakWord, submitMerchantAnswer,
 
38
  export { openTodayWordsModal, openCaravanLevelsModal, openMerchantQuizModal, openMerchantEventModal, openTianjiModal };
39
  window.showAnnouncementModal = showAnnouncementModal;
40
  window.getRandomBeggingSpeech = getRandomBeggingSpeech;
41
+ window.openTitleGalleryModal = openTitleGalleryModal;
42
 
43
  let db, user, student, classInfo = null;
44
  let game = null, progress = {}, stats = {};
 
129
  const btnBannerGuideDetail = $('#btnBannerGuideDetail');
130
  if (btnBannerGuideDetail) bind(btnBannerGuideDetail, 'click', () => openBeginnerGuideModal());
131
 
132
+ // 頂欄稱號徽章點擊綁定(開啟榮譽稱號閣切換稱號)
133
+ const userNameEl = $('#userName');
134
+ if (userNameEl) {
135
+ bind(userNameEl, 'click', (e) => {
136
+ if (e.target.closest('[data-title-clickable]') || e.target.closest('.title-badge') || e.target.closest('.user-name')) {
137
+ if (game?.curTitle || (Array.isArray(game?.titles) && game.titles.length > 0)) {
138
+ openTitleGalleryModal();
139
+ }
140
+ }
141
+ });
142
+ }
143
+
144
  // 切到背景時補存;切回前景/喚醒設備時檢查是否有其他裝置在新時段登入(防多載具舊進度覆蓋)
145
  bind(document, 'visibilitychange', () => {
146
  if (document.hidden) {
 
724
  if (!game?.curTitle && Array.isArray(game?.titles) && game.titles.length > 0) {
725
  game.curTitle = game.titles[game.titles.length - 1];
726
  }
727
+ const titleBadgeHtml = game?.curTitle
728
+ ? formatTitleBadge(game.curTitle, { size: 'md', clickable: true, titleAttr: `👑 佩戴稱號【${game.curTitle}】\n點擊開啟【榮譽稱號閣】更換佩戴稱號` })
729
+ : '';
730
+ const dragonTag = game?.hasDragonFrame ? '<span title="天可汗金印・金龍環繞" style="margin-right:4px;">🐉</span>' : '';
731
+ const studentInfoHtml = `<span>${esc(classInfo?.name || classInfo?.code || '')} #${esc(student?.seat || '')} ${esc(student?.name || '')}</span>`;
732
+
733
+ const userNameEl = $('#userName');
734
+ if (userNameEl) {
735
+ userNameEl.innerHTML = `${dragonTag}${studentInfoHtml}${titleBadgeHtml}`;
736
+ }
737
  $('#userMeta').textContent = bankName;
738
  renderRes();
739
  updateQuizRedDot();
 
2374
 
2375
  const meTag = item.isMe ? '<span class="badge badge-accent" style="margin-left:6px; font-size:11px;">我</span>' : '';
2376
  const dragonTag = item.hasDragonFrame ? '<span title="天可汗金印・金龍環繞" style="margin-right:4px;">🐉</span>' : '';
2377
+ const titleTag = item.curTitle ? formatTitleBadge(item.curTitle, { size: 'sm' }) : '';
2378
  const laborBadge = item.laborPassed ? '<span class="badge badge-mint" style="margin-left:4px;" title="勞權達標">🛡️</span>' : '';
2379
  const weekBadge = item.isSloth
2380
  ? '<span class="badge badge-rose" title="上週未達標,處於怠惰狀況">⚠️怠惰</span>'
 
2867
  };
2868
  window.getMerchantStatusTest = () => (game ? getMerchantStatus(game) : null);
2869
 
2870
+ // ===================== 榮譽稱號閣 (Title Gallery & Switcher) =====================
2871
+ export async function openTitleGalleryModal() {
2872
+ if (!game) return;
2873
+ game.titles = Array.isArray(game.titles) ? game.titles : [];
2874
+ if (game.curTitle && !game.titles.includes(game.curTitle)) {
2875
+ game.titles.push(game.curTitle);
2876
+ }
2877
+ if (!game.curTitle && game.titles.length > 0) {
2878
+ game.curTitle = game.titles[game.titles.length - 1];
2879
+ }
2880
+
2881
+ const curDef = getTitleDef(game.curTitle);
2882
+
2883
+ // 整理稱號庫中的所有稱號列表
2884
+ const allTitleKeys = Object.keys(TITLE_DEFS);
2885
+ // 把學生有但是不在 TITLE_DEFS 中的自訂稱號也加進來
2886
+ game.titles.forEach(t => {
2887
+ if (t && !allTitleKeys.includes(t)) allTitleKeys.push(t);
2888
+ });
2889
+
2890
+ const ownedTitles = allTitleKeys.filter(t => game.titles.includes(t));
2891
+ const lockedTitles = allTitleKeys.filter(t => !game.titles.includes(t));
2892
+
2893
+ const modalHtml = `
2894
+ <div class="title-gallery-modal">
2895
+ <div class="title-gallery-header">
2896
+ <h2 class="title-gallery-title">🎖️ 榮譽稱號閣</h2>
2897
+ <div class="title-gallery-sub">威震四海,各展風華!點擊已解鎖的稱號即可隨時更換佩戴。</div>
2898
+ </div>
2899
+
2900
+ <div class="title-gallery-current-banner">
2901
+ <div>
2902
+ <div class="title-gallery-current-label">當前佩戴稱號</div>
2903
+ <div>${curDef ? formatTitleBadge(curDef.name, { size: 'lg' }) : '<span class="mute">尚未佩戴稱號</span>'}</div>
2904
+ </div>
2905
+ <div style="font-size:12px; color:#64748b; text-align:right;">
2906
+ 已解鎖:<b style="color:#d97706; font-size:15px;">${ownedTitles.length}</b> / ${allTitleKeys.length} 個
2907
+ </div>
2908
+ </div>
2909
+
2910
+ <div class="title-gallery-section-title">
2911
+ <span>✨ 已獲殊榮(點擊切換佩戴)</span>
2912
+ </div>
2913
+ <div class="title-gallery-grid" id="tgOwnedGrid">
2914
+ ${ownedTitles.map(t => {
2915
+ const def = getTitleDef(t);
2916
+ const isEquipped = game.curTitle === t;
2917
+ return `
2918
+ <div class="title-card owned ${isEquipped ? 'equipped' : ''}" data-title="${esc(t)}">
2919
+ <div class="title-card-top">
2920
+ ${formatTitleBadge(t, { size: 'md' })}
2921
+ <span class="title-card-source">${esc(def.rarity || '榮譽稱號')}</span>
2922
+ </div>
2923
+ <div class="title-card-desc">${esc(def.desc || '')}</div>
2924
+ <div style="margin-top:auto;">
2925
+ ${isEquipped
2926
+ ? '<div class="title-card-badge-equipped">👑 佩戴中</div>'
2927
+ : `<button type="button" class="title-card-btn title-card-btn-equip" data-equip-title="${esc(t)}">佩戴此稱號</button>`
2928
+ }
2929
+ </div>
2930
+ </div>
2931
+ `;
2932
+ }).join('')}
2933
+ </div>
2934
+
2935
+ ${lockedTitles.length > 0 ? `
2936
+ <div class="title-gallery-section-title" style="margin-top:22px;">
2937
+ <span>🔒 九州全稱號殿堂(尚未解鎖)</span>
2938
+ </div>
2939
+ <div class="title-gallery-grid">
2940
+ ${lockedTitles.map(t => {
2941
+ const def = getTitleDef(t);
2942
+ return `
2943
+ <div class="title-card locked">
2944
+ <div class="title-card-top">
2945
+ <div style="display:flex; align-items:center; gap:6px;">
2946
+ <span style="font-size:14px; opacity:0.8;">🔒</span>
2947
+ <span style="font-weight:700; color:#475569; font-size:12px;">【${esc(t)}】</span>
2948
+ </div>
2949
+ <span class="title-card-source">${esc(def.source || '特殊活動')}</span>
2950
+ </div>
2951
+ <div class="title-card-desc" style="color:#64748b;">${esc(def.desc || '尚未獲得此稱號')}</div>
2952
+ <div class="title-card-lock-tip">解鎖途徑:${esc(def.source || '敬請期待')}</div>
2953
+ </div>
2954
+ `;
2955
+ }).join('')}
2956
+ </div>
2957
+ ` : ''}
2958
+ </div>
2959
+ `;
2960
+
2961
+ const m = openModal(modalHtml, { wide: true });
2962
+
2963
+ // 綁定切換佩戴按鈕
2964
+ m.modalEl.querySelectorAll('[data-equip-title]').forEach(btn => {
2965
+ btn.addEventListener('click', async (e) => {
2966
+ const targetTitle = e.currentTarget.getAttribute('data-equip-title');
2967
+ if (!targetTitle) return;
2968
+ game.curTitle = targetTitle;
2969
+ updateHeader();
2970
+ renderRankTable();
2971
+ try {
2972
+ if (typeof save === 'function') {
2973
+ await save();
2974
+ } else if (user && db) {
2975
+ await db.saveGame(user.uid, game);
2976
+ }
2977
+ toast(`👑 已成功佩戴專屬稱號【${targetTitle}】!`, 'success');
2978
+ } catch (err) {
2979
+ console.error('[Title] Save title error:', err);
2980
+ }
2981
+ m.close();
2982
+ });
2983
+ });
2984
+ }
2985
+
2986