:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(15, 23, 42, 0.88);
  --panel-border: rgba(255, 255, 255, 0.12);
  --primary: #f59e0b;
  --primary-glow: rgba(245, 158, 11, 0.4);
  --accent: #38bdf8;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-color);
  font-family: var(--font-family);
  color: var(--text);
}

#canvas-container {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* 載入畫面 */
#loading-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #1e293b 0%, #090d16 100%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.6s ease;
}

.loader-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(245, 158, 11, 0.2);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: spin 1s infinite linear;
  margin-bottom: 24px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #fbbf24;
  margin-bottom: 10px;
}

.loading-sub {
  font-size: 14px;
  color: var(--text-muted);
}

/* UI 覆蓋層 */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* GDD 頂部導航 HUD (GDD Section 4.1 - 緊湊單行不重疊設計) */
.top-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  row-gap: 6px;
  pointer-events: auto;
  z-index: 46;
}

.hud-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.hud-floor-badge {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3));
  border: 1px solid #f59e0b;
  box-shadow: 0 0 15px var(--primary-glow);
  padding: 6px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.hud-floor-badge:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.45));
}

.floor-level {
  font-size: 13.5px;
  font-weight: 800;
  color: #fbbf24;
  white-space: nowrap;
}

.floor-name {
  font-size: 11px;
  color: #f8fafc;
  white-space: nowrap;
}

/* 核心數值計量條 (資金、EXP、精神值 Qi、淨化值 Clarity、繁榮度) */
.hud-stats-group {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  padding: 5px 11px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  flex-shrink: 1;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  gap: 5px;
  white-space: nowrap;
}

.stat-bar-wrap {
  width: 68px;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.stat-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.bar-qi { background: linear-gradient(90deg, #10b981, #34d399); }
.bar-clarity { background: linear-gradient(90deg, #38bdf8, #818cf8); }

/* 頂部右側快捷按鈕（嚴格單行不換行） */
.hud-right-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.btn-hud {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.btn-hud:hover {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-hud.active {
  border-color: #f59e0b;
  box-shadow: 0 0 12px var(--primary-glow);
  color: #fbbf24;
}

/* 隱藏會與頂部數值列打架重疊的舊版常駐快訊條（已由 Toast 與目標膠囊取代） */
#agent-monitor-alert {
  display: none !important;
}

#agent-monitor-alert:hover {
  border-color: #38bdf8;
  background: rgba(15, 23, 42, 0.95);
}

.monitor-pulse {
  width: 8px;
  height: 8px;
  background: #34d399;
  border-radius: 50%;
  animation: pulseGreen 1.5s infinite;
}

@keyframes pulseGreen {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

/* 互動懸浮提示 [E] */
#prompt-interaction {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid #f59e0b;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.45);
  padding: 10px 24px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  color: #f8fafc;
  display: none;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  cursor: pointer;
  animation: pulsePrompt 1.8s infinite ease-in-out;
}

@keyframes pulsePrompt {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.04); }
}

/* GDD 4.1 底部五大核心導航塢 (Bottom Master Dock) */
.master-dock {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  padding: 8px 16px;
  border-radius: 24px;
  border: 1px solid var(--panel-border);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  z-index: 20;
}

.dock-item {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  min-width: 76px;
}

.dock-item:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  transform: translateY(-4px);
  color: #fbbf24;
}

.dock-icon {
  font-size: 22px;
}

.dock-label {
  font-size: 12px;
  font-weight: 700;
}

/* 浮動動作小按鈕欄 (跳躍、揮手等) */
.action-strip {
  position: absolute;
  bottom: 90px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.btn-strip {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f8fafc;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
  transition: all 0.2s;
}

.btn-strip:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
}

/* 彈窗遮罩與卡片通式 (徹底使用 display: none + visibility: hidden 杜絕關閉視窗內的按鈕攔截點擊！) */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none !important;
  transition: opacity 0.25s ease;
}

.modal-overlay:not(.open),
.modal-overlay:not(.open) * {
  pointer-events: none !important;
  visibility: hidden !important;
}

.modal-overlay.open {
  display: flex;
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
  z-index: 65;
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 22px;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.8);
  max-width: 780px;
  width: 92%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: scale(0.96);
  transition: transform 0.3s ease;
}

.modal-overlay.open .modal-card {
  transform: scale(1);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 750;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
}

.btn-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 75vh;
}

/* ========================================================= */
/* GDD Section 4.2: Agent 監控與工具派遣儀表板 (Command Panel) */
/* ========================================================= */
.agent-dash-layout {
  display: flex;
  gap: 20px;
}

.dash-agent-info {
  width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding-right: 20px;
}

.dash-avatar-card {
  width: 150px;
  height: 150px;
  border-radius: 16px;
  border: 2px solid #f59e0b;
  overflow: hidden;
  box-shadow: 0 0 20px var(--primary-glow);
  background: #1e293b;
}

.dash-avatar-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dash-name { font-size: 16px; font-weight: 700; color: #fbbf24; }
.dash-role { font-size: 11px; color: #38bdf8; text-align: center; }

.dash-status-pill {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #34d399;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.dash-tasks-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.utility-task-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}

.utility-task-card:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: #f59e0b;
  transform: translateX(4px);
}

.task-title { font-size: 13px; font-weight: 700; color: #f8fafc; }
.task-desc { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.btn-dispatch {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #fff;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* 任務運算進度與成果展示區 */
.deliverable-box {
  background: #090d16;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 14px;
  padding: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: #e2e8f0;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  display: none;
}

/* ========================================================= */
/* GDD Section 8: 五行卡牌 Roguelike 戰鬥畫面 (Mind Maze Combat) */
/* ========================================================= */
.combat-stage {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.combat-arena {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: radial-gradient(circle at center, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.95) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px 30px;
}

.combat-fighter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 180px;
}

.fighter-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid #f59e0b;
  overflow: hidden;
  background: #1e293b;
  box-shadow: 0 0 20px var(--primary-glow);
}

.fighter-avatar img { width: 100%; height: 100%; object-fit: cover; }
.fighter-name { font-size: 14px; font-weight: 700; }

.combat-hp-bar {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 5px;
  overflow: hidden;
}

.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ef4444, #f87171);
  transition: width 0.3s;
}

.hp-fill-player {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.ap-gems {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.ap-gem {
  width: 14px;
  height: 14px;
  background: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.8);
}

.ap-gem.spent {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: none;
}

/* 玩家手牌區 */
.cards-hand {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.combat-card {
  width: 140px;
  background: #1e293b;
  border: 2px solid #38bdf8;
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.combat-card:hover {
  transform: translateY(-8px) scale(1.04);
  box-shadow: 0 12px 25px rgba(56, 189, 248, 0.4);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-cost {
  width: 22px;
  height: 22px;
  background: #38bdf8;
  color: #0b0f19;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-name { font-size: 12px; font-weight: 700; color: #f8fafc; }
.card-effect { font-size: 10px; color: var(--text-muted); line-height: 1.4; }

/* 28 層樓晉升塔列表 */
.tower-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tower-item {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tower-item.active {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

.tower-item.cleared {
  border-color: #10b981;
  opacity: 0.7;
}

/* 晨卡 / 晚卡 特殊視圖 */
.daily-card-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.daily-card-emblem {
  font-size: 48px;
  margin-bottom: 4px;
}

.daily-textarea {
  width: 100%;
  height: 90px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: #f8fafc;
  padding: 12px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  resize: none;
}

/* VFX 打擊動畫與浮動傷害 */
@keyframes vfxPop {
  0% { transform: translate(50%, -50%) scale(0.4); opacity: 0; }
  50% { transform: translate(50%, -50%) scale(1.3); opacity: 1; }
  100% { transform: translate(50%, -60%) scale(1); opacity: 0; }
}

@keyframes enemyShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px) rotate(-3deg); }
  40%, 80% { transform: translateX(8px) rotate(3deg); }
}

@keyframes floatUpFade {
  0% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-35px); opacity: 0; }
}

/* ========================================================= */
/* GDD Section 3: Day 0 靈魂星雲門戶與開局流程 (Onboarding)   */
/* ========================================================= */
#onboarding-portal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 50% 20%, rgba(30, 58, 138, 0.48) 0%, rgba(9, 13, 26, 0.90) 68%),
    linear-gradient(180deg, rgba(8, 12, 24, 0.72), rgba(7, 10, 20, 0.92)),
    url('blender_preview.png') center / cover no-repeat;
  z-index: 120;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 18px 20px;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  letter-spacing: 0.3px;
}

.form-input,
.form-select {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1.5px solid rgba(56, 189, 248, 0.42);
  background: rgba(10, 16, 32, 0.92);
  color: #f8fafc;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.45);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.form-input::placeholder {
  color: #64748b;
  font-weight: 500;
}

.form-input:focus,
.form-select:focus {
  border-color: #fbbf24;
  background: rgba(15, 23, 42, 0.98);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.22), inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.form-select option {
  background: #0f172a;
  color: #f8fafc;
}

.btn-summon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 12px;
  border: 1.5px solid rgba(253, 230, 138, 0.85);
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 52%, #d97706 100%);
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-summon:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 10px 26px rgba(251, 191, 36, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.btn-summon:active {
  transform: translateY(0);
}

.ob-ctype-card {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1.5px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.78);
  transition: transform 0.16s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  text-align: left;
}

.ob-ctype-card:hover {
  transform: translateY(-1px);
  border-color: rgba(251, 191, 36, 0.68);
  background: rgba(30, 41, 59, 0.92);
}

.ob-ctype-card.selected {
  border-color: #fbbf24;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.24), rgba(30, 41, 59, 0.92));
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.32);
}

.ob-ctype-thumb {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  background: #0f172a;
}

.ob-sign-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(120, 82, 42, 0.42), rgba(30, 41, 59, 0.85));
  border: 1.5px dashed rgba(251, 191, 36, 0.65);
  box-shadow: inset 0 0 18px rgba(245, 158, 11, 0.12);
}

.portal-compass-orbit {
  width: 120px;
  height: 120px;
  border: 2px dashed rgba(245, 158, 11, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: spinSlow 20s infinite linear;
  margin-bottom: 24px;
}

@keyframes spinSlow {
  to { transform: rotate(360deg); }
}

.portal-compass-core {
  font-size: 54px;
  animation: pulseCore 2s infinite ease-in-out;
}

@keyframes pulseCore {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); filter: drop-shadow(0 0 20px #f59e0b); }
}

.portal-title {
  font-size: 28px;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.portal-desc {
  font-size: 14px;
  color: #cbd5e1;
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: 24px;
}

/* GDD Section 3: Onboarding 5-Step Views */
.onboarding-step-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 580px;
  width: 90%;
  animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* GDD Section 9.2: 大熊熊 1 分鐘正念呼吸圈 */
.mindful-circle-wrap {
  width: 200px;
  height: 200px;
  margin: 20px auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mindful-ring {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.25) 0%, rgba(14, 165, 233, 0.05) 70%);
  border: 3px solid #38bdf8;
  box-shadow: 0 0 35px rgba(56, 189, 248, 0.5);
  animation: breatheCycle 8s infinite ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
}

@keyframes breatheCycle {
  0%, 100% { transform: scale(0.85); box-shadow: 0 0 15px rgba(56, 189, 248, 0.3); }
  50% { transform: scale(1.35); box-shadow: 0 0 50px rgba(56, 189, 248, 0.8); }
}

/* GDD Section 7 (16F): 大師天賦樹節點 */
.talent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.talent-node {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  transition: all 0.2s;
}

.talent-node.unlocked {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
}

.talent-name { font-size: 14px; font-weight: 700; color: #f8fafc; }
.talent-desc { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* GDD Section 4.1 & 7 (5F): 靈感看板貼紙 */
.vision-board-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.vision-card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.vision-card:hover {
  transform: translateY(-3px);
  border-color: #38bdf8;
}

/* 一鍵全體派遣按鈕 (GDD Section 6.2) */
.btn-batch-deploy {
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.4);
  transition: all 0.2s;
}

.btn-batch-deploy:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* 27F 個人命運成長繪卷 (Scroll of Destiny) */
.destiny-scroll-paper {
  background: linear-gradient(180deg, #fef3c7 0%, #fae8b4 100%);
  color: #78350f;
  border: 4px solid #b45309;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  font-family: serif;
  line-height: 1.8;
}

/* ========================================================= */
/* 循序漸進解鎖與升級系統 (Progression & Upgrading CSS)       */
/* ========================================================= */

/* CEO 檔案頭像與徽章 */
.hud-ceo-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px 14px;
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

.hud-ceo-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.hud-ceo-name {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.hud-ceo-title {
  font-size: 10px;
  color: #94a3b8;
}

/* 樓層 EXP 經驗條 */
.bar-exp {
  background: linear-gradient(90deg, #f59e0b, #fbbf24, #fef08a);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
  transition: width 0.4s ease;
}

/* 鎖定功能提示微標籤 */
.dock-item.locked {
  opacity: 0.6;
  filter: grayscale(0.5);
  cursor: pointer;
}

.dock-item.locked:hover {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
  transform: none;
  color: var(--text-muted);
}

.dock-lock-badge {
  font-size: 10px;
  background: rgba(239, 68, 68, 0.25);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 8px;
  padding: 1px 6px;
  margin-top: 2px;
}

.btn-hud.locked {
  opacity: 0.6;
  position: relative;
}

.btn-hud .hud-lock-badge {
  font-size: 9px;
  background: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 4px;
  padding: 1px 4px;
  margin-left: 4px;
}

/* CEO 新手引導導航欄 (Tutorial Guide Banner) */
#tutorial-guide-banner {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(245, 158, 11, 0.5);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 15px rgba(245, 158, 11, 0.2);
  backdrop-filter: blur(16px);
  padding: 10px 18px;
  border-radius: 16px;
  z-index: 48;
  max-width: 680px;
  width: 90%;
  pointer-events: auto;
  animation: slideDownTutorial 0.4s ease-out;
}

@keyframes slideDownTutorial {
  from { opacity: 0; transform: translate(-50%, -20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.tutorial-pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 12px #f59e0b;
  animation: pulseDot 1.5s infinite;
  flex-shrink: 0;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.6; }
}

.tutorial-content {
  flex: 1;
}

.tutorial-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}

.tutorial-step-tag {
  font-size: 11px;
  font-weight: 800;
  color: #fbbf24;
  letter-spacing: 0.5px;
}

.tutorial-reward {
  font-size: 10px;
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border-radius: 6px;
  padding: 1px 6px;
  font-weight: 700;
}

.tutorial-title {
  font-size: 13px;
  font-weight: 700;
  color: #f8fafc;
}

.tutorial-desc {
  font-size: 12px;
  color: #cbd5e1;
  margin-top: 2px;
}

.btn-tut-action {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #0f172a;
  border: none;
  font-size: 12px;
  font-weight: 800;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-tut-action:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-tut-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
}

.btn-tut-close:hover {
  color: #fff;
}

#bounty-chest-pill {
  position: fixed;
  top: 74px;
  right: 24px;
  z-index: 42;
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 800;
  color: #fef08a;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.2s, border-color 0.2s;
}

#bounty-chest-pill:hover {
  transform: translateY(-1px) scale(1.03);
  border-color: #fbbf24;
}

#furniture-upgrade-card {
  position: fixed;
  right: 24px;
  bottom: 108px;
  z-index: 55;
  width: 280px;
  background: linear-gradient(155deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.95));
  border: 1.5px solid rgba(251, 191, 36, 0.65);
  border-radius: 16px;
  padding: 13px 15px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.5), 0 0 22px rgba(245, 158, 11, 0.2);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: fadeIn 0.22s ease-out;
}
.modal-levelup-card {
  text-align: center;
  background: radial-gradient(circle at center, #1e1b4b 0%, #0f172a 90%);
  border: 2px solid #f59e0b;
  box-shadow: 0 0 50px rgba(245, 158, 11, 0.4);
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 26px;
}

.lu-gift-showcase {
  margin-top: 14px;
  background: linear-gradient(155deg, rgba(245, 158, 11, 0.16), rgba(30, 41, 59, 0.92));
  border: 1.5px solid rgba(251, 191, 36, 0.65);
  border-radius: 16px;
  padding: 12px 14px;
  text-align: left;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), inset 0 0 18px rgba(251, 191, 36, 0.12);
}

.lu-gift-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #0f172a;
  background: linear-gradient(90deg, #fde68a, #f59e0b);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.lu-gift-media {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(254, 240, 138, 0.45);
  background: #0b1120;
  margin-bottom: 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

.lu-gift-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lu-gift-title {
  font-size: 15px;
  font-weight: 800;
  color: #fef08a;
  margin-bottom: 4px;
}

.lu-gift-desc {
  font-size: 12.5px;
  color: #e2e8f0;
  line-height: 1.55;
}

.tower-gift-thumb {
  width: 78px;
  height: 46px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  flex-shrink: 0;
  background: #0f172a;
}

.levelup-sparkles {
  font-size: 36px;
  margin-bottom: 8px;
  animation: pulseCore 1.5s infinite;
}

.levelup-title {
  font-size: 26px;
  font-weight: 900;
  color: #fbbf24;
  letter-spacing: 2px;
  margin: 0;
}

.levelup-floor {
  font-size: 18px;
  font-weight: 700;
  color: #38bdf8;
  margin-top: 4px;
}

.levelup-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.5), transparent);
  margin: 18px 0;
}

.levelup-perk-box {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: left;
}

.lu-perk-title {
  font-size: 13px;
  font-weight: 700;
  color: #34d399;
  margin-bottom: 4px;
}

.lu-perk-desc {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.5;
}

.levelup-rewards {
  display: flex;
  justify-content: space-around;
  gap: 10px;
  margin-bottom: 18px;
}

.lu-reward-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
}

/* 浮動 Toast 通知（精簡最多 2 條，絕不遮擋中央彈窗） */
.toast-container {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 460px;
  pointer-events: none;
  z-index: 120;
}

.toast-msg {
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(245, 158, 11, 0.85);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  color: #fef08a;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 700;
  text-align: center;
}
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  animation: fadeInOutToast 3s forwards ease-in-out;
}

@keyframes fadeInOutToast {
  0% { opacity: 0; transform: translateY(10px); }
  15% { opacity: 1; transform: translateY(0); }
  85% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* ========================================================= */
/* 沉浸式故事序章劇院 (Story Prologue Theater)                */
/* ========================================================= */
#story-prologue {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: radial-gradient(ellipse at center, #131b35 0%, #060913 80%);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 32px;
  cursor: pointer;
  user-select: none;
  transition: opacity 0.8s ease;
}

.prologue-skip-btn {
  position: absolute;
  top: 24px;
  right: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #94a3b8;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 5;
}

.prologue-skip-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}

.prologue-stage {
  max-width: 640px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.prologue-chapter {
  font-size: 11px;
  letter-spacing: 3px;
  color: #fbbf24;
  text-transform: uppercase;
  padding: 4px 14px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 20px;
  background: rgba(251, 191, 36, 0.08);
}

.prologue-icon {
  font-size: 56px;
  filter: drop-shadow(0 0 24px rgba(251, 191, 36, 0.45));
  animation: floatGentle 3.5s ease-in-out infinite;
}

@keyframes floatGentle {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
}

.prologue-title {
  font-size: 24px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 1px;
}

.prologue-text {
  font-size: 16px;
  line-height: 2;
  color: #cbd5e1;
  min-height: 96px;
  max-width: 560px;
  white-space: pre-line;
}

.prologue-progress {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.prologue-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s;
}

.prologue-dot.active {
  width: 24px;
  border-radius: 6px;
  background: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.6);
}

.prologue-continue {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 10px;
  letter-spacing: 1px;
  animation: blinkSoft 1.8s infinite;
}

@keyframes blinkSoft {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ========================================================= */
/* 遊戲內 Visual Novel 劇情對話框 (VN Dialogue Box)           */
/* ========================================================= */
#vn-dialogue-box {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 92vw);
  background: rgba(10, 16, 32, 0.94);
  backdrop-filter: blur(20px);
  border: 1.5px solid rgba(251, 191, 36, 0.55);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), 0 0 30px rgba(251, 191, 36, 0.15);
  padding: 18px 24px;
  display: none;
  align-items: center;
  gap: 20px;
  z-index: 95;
  cursor: pointer;
  pointer-events: auto;
  animation: vnSlideUp 0.35s ease-out;
}

@keyframes vnSlideUp {
  from { opacity: 0; transform: translate(-50%, 24px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.vn-portrait-wrap {
  width: 96px;
  height: 118px;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(251, 191, 36, 0.6);
  background: rgba(30, 41, 59, 0.8);
  flex-shrink: 0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.vn-portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vn-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vn-speaker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.vn-speaker-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.15));
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fbbf24;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
}

.vn-step-indicator {
  font-size: 11px;
  color: #64748b;
}

.vn-text {
  font-size: 15px;
  line-height: 1.75;
  color: #f1f5f9;
  min-height: 54px;
}

.vn-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
}

.vn-next-hint {
  font-size: 12px;
  color: #fbbf24;
  font-weight: 700;
  animation: blinkSoft 1.5s infinite;
}

/* 漸進浮現動畫 */
.ui-fade-reveal {
  animation: fadeReveal 0.6s ease-out;
}

@keyframes fadeReveal {
  from { opacity: 0; transform: translateY(10px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ========================================================= */
/* 3D 世界投影標籤、實時倒數計時條與漂浮數值特效               */
/* ========================================================= */
#world-markers-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  overflow: hidden;
}

.world-bubble {
  position: absolute;
  transform: translate(-50%, -100%);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(251, 191, 36, 0.7);
  border-radius: 14px;
  padding: 6px 12px;
  color: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  cursor: pointer;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: transform 0.15s ease;
}

.world-bubble:hover {
  border-color: #38bdf8;
  background: rgba(30, 41, 59, 0.96);
}

.world-bubble-bar-wrap {
  width: 110px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.world-bubble-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  width: 0%;
  transition: width 0.25s linear;
}

.world-bubble-bar.coffee-bar {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.world-float-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 15px;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  animation: floatUpFade 1.8s ease-out forwards;
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, 0) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, -18px) scale(1.08); }
  100% { opacity: 0; transform: translate(-50%, -64px) scale(0.95); }
}

/* 實時進行中任務倒數卡片 (清晰顯示剩餘幾秒) */
#active-timer-card {
  position: fixed;
  top: 156px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(16px);
  border: 1.5px solid #38bdf8;
  border-radius: 16px;
  padding: 10px 18px;
  display: none;
  align-items: center;
  gap: 14px;
  z-index: 45;
  pointer-events: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 18px rgba(56, 189, 248, 0.25);
  min-width: 320px;
}

.timer-card-icon {
  font-size: 24px;
  animation: pulseCore 1.4s infinite;
}

.timer-card-info {
  flex: 1;
}

.timer-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.timer-card-sec {
  font-size: 14px;
  font-weight: 900;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.timer-card-bar-wrap {
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}

.timer-card-bar {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8, #34d399);
  width: 0%;
  transition: width 0.25s linear;
}

/* ========================================================= */
/* 升級慶典動態演出 (Rotating Sunrays & Elastic Chibi Bounce) */
/* ========================================================= */
.lu-hero-stage {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lu-sunrays {
  position: absolute;
  inset: -26px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    from 0deg,
    rgba(251, 191, 36, 0.34) 0deg 14deg,
    transparent 14deg 30deg
  );
  filter: blur(1px);
  animation: spinSlow 10s linear infinite;
  pointer-events: none;
}

.lu-chibi-frame {
  position: relative;
  width: 126px;
  height: 150px;
  border-radius: 18px;
  overflow: hidden;
  border: 2.5px solid #fbbf24;
  box-shadow: 0 0 32px rgba(251, 191, 36, 0.65), 0 12px 28px rgba(0, 0, 0, 0.6);
  animation: chibiLevelBounce 1.4s ease-in-out infinite;
  z-index: 2;
}

.lu-chibi-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes chibiLevelBounce {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  25% { transform: translateY(-10px) scale(0.96, 1.05); }
  50% { transform: translateY(0) scale(1.04, 0.95); }
  75% { transform: translateY(-5px) scale(0.99, 1.02); }
}

.lu-floor-transition {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.7);
  z-index: 3;
  white-space: nowrap;
}

.lu-evolution-tag {
  display: inline-block;
  margin-top: 8px;
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 12px;
}

/* ========================================================= */
/* 遊戲手感大升級：目標卡、心流連擊、節奏微互動、突發事件      */
/* ========================================================= */
#current-goal-pill {
  position: fixed;
  top: 76px;
  left: 20px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(56, 189, 248, 0.45);
  border-radius: 12px;
  padding: 7px 14px;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 8px;
  z-index: 30;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: all 0.2s;
  max-width: 340px;
}

#current-goal-pill:hover {
  border-color: #fbbf24;
  transform: translateY(-1px);
}

#flow-combo-badge {
  position: fixed;
  top: 116px;
  right: 24px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.92), rgba(239, 68, 68, 0.92));
  border: 1.5px solid #fef08a;
  border-radius: 20px;
  padding: 6px 14px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  display: none;
  align-items: center;
  gap: 6px;
  z-index: 30;
  pointer-events: auto;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.55);
  animation: pulseCombo 1.2s ease-in-out infinite;
}

@keyframes pulseCombo {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* 心流共振節奏點按按鈕 (任務/沖咖啡時彈出) */
#flow-boost-btn {
  position: fixed;
  bottom: 112px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #f59e0b, #fbbf24, #38bdf8);
  background-size: 200% 200%;
  color: #0f172a;
  border: 2px solid #fef08a;
  border-radius: 30px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 8px;
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.75), 0 10px 28px rgba(0, 0, 0, 0.6);
  animation: boostPulse 0.65s ease-in-out infinite;
}

@keyframes boostPulse {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.08); }
}

#world-bubble-event,
#world-bubble-chest,
#world-bubble-highfive {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  font-weight: 900;
  z-index: 45;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

#world-bubble-event {
  border: 2.5px solid #ffffff;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #ffffff;
  font-size: 22px;
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.85), 0 6px 18px rgba(0, 0, 0, 0.55);
  animation: eventBob 1.1s ease-in-out infinite;
}

#world-bubble-event:hover {
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  transform: translate(-50%, -108%) scale(1.12);
}

#world-bubble-chest {
  border: 2.5px solid #fef08a;
  background: linear-gradient(135deg, #f59e0b, #b45309);
  color: #ffffff;
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.85), 0 6px 18px rgba(0, 0, 0, 0.55);
  animation: eventBob 1.3s ease-in-out infinite;
}

#world-bubble-highfive {
  border: 2px solid #a7f3d0;
  background: linear-gradient(135deg, #10b981, #047857);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.8), 0 6px 18px rgba(0, 0, 0, 0.55);
  animation: eventBob 1.25s ease-in-out infinite;
}

.btn-info-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(56, 189, 248, 0.65);
  background: rgba(14, 165, 233, 0.16);
  color: #7dd3fc;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  padding: 0;
  line-height: 1;
}

.btn-info-icon:hover {
  background: rgba(14, 165, 233, 0.35);
  color: #ffffff;
  transform: scale(1.08);
}

@keyframes eventBob {
  0%, 100% { transform: translate(-50%, -100%); }
  50% { transform: translate(-50%, -115%); }
}

/* ========================================================= */
/* 3D 小遊戲實時 HUD 與 遊樂場 / 命運卡圖鑑彈窗                */
/* ========================================================= */
#minigame-hud {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 16, 32, 0.94);
  backdrop-filter: blur(16px);
  border: 2px solid #fbbf24;
  border-radius: 20px;
  padding: 10px 22px;
  display: none;
  align-items: center;
  gap: 18px;
  z-index: 65;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 24px rgba(251, 191, 36, 0.35);
  pointer-events: auto;
}

.mg-title {
  font-size: 13px;
  font-weight: 800;
  color: #fbbf24;
}

.mg-stat {
  font-size: 14px;
  font-weight: 900;
  color: #38bdf8;
}

.mg-time {
  font-size: 14px;
  font-weight: 900;
  color: #fef08a;
  background: rgba(245, 158, 11, 0.2);
  padding: 3px 10px;
  border-radius: 10px;
}

.mg-hint {
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 700;
}

.arcade-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.arcade-tab {
  flex: 1;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.arcade-tab.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(56, 189, 248, 0.2));
  border-color: #fbbf24;
  color: #fef08a;
}

.destiny-album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.album-card {
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s, border-color 0.2s;
}

.album-card.unlocked {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.96));
}

.album-card.unlocked:hover {
  transform: translateY(-3px);
  border-color: #fbbf24;
}

.album-card.locked {
  opacity: 0.48;
  filter: grayscale(0.8);
}

.album-rarity {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 8px;
  align-self: flex-start;
}

.rarity-COMMON { background: rgba(148, 163, 184, 0.22); color: #cbd5e1; }
.rarity-RARE { background: rgba(56, 189, 248, 0.22); color: #7dd3fc; }
.rarity-LEGENDARY { background: rgba(251, 191, 36, 0.25); color: #fde68a; }

/* ========================================================= */
/* Phase 2: 3D 番茄鐘專注陪伴禪意列 & Chibi 羈絆好感度 UI     */
/* ========================================================= */
#pomodoro-zen-bar {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 16, 32, 0.92);
  backdrop-filter: blur(20px);
  border: 1.5px solid rgba(52, 211, 153, 0.65);
  border-radius: 28px;
  padding: 12px 26px;
  display: none;
  align-items: center;
  gap: 20px;
  z-index: 85;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7), 0 0 30px rgba(16, 185, 129, 0.22);
  pointer-events: auto;
}

.pomo-clock {
  font-size: 24px;
  font-weight: 900;
  color: #34d399;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.bond-box {
  background: rgba(244, 114, 182, 0.10);
  border: 1px solid rgba(244, 114, 182, 0.35);
  border-radius: 12px;
  padding: 10px;
  margin-top: 10px;
  width: 100%;
  text-align: left;
}

.bond-bar-wrap {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  margin: 5px 0 8px;
}

.bond-bar {
  height: 100%;
  background: linear-gradient(90deg, #f472b6, #fb7185);
  transition: width 0.35s ease;
}

.bond-story-card {
  background: rgba(15, 23, 42, 0.72);
  border-left: 3px solid #f472b6;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 11px;
  color: #fbcfe8;
  line-height: 1.55;
}

/* ========================================================= */
/* Phase 3: 3D 實景心魔 Boss 戰 HUD (不遮擋 3D 辦公室舞台!)    */
/* ========================================================= */
#boss3d-hud-top {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(640px, 92vw);
  background: rgba(15, 10, 28, 0.92);
  backdrop-filter: blur(18px);
  border: 1.5px solid rgba(244, 63, 94, 0.65);
  border-radius: 18px;
  padding: 12px 20px;
  display: none;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 28px rgba(244, 63, 94, 0.25);
  pointer-events: auto;
}

#boss3d-card-tray {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, 95vw);
  background: rgba(10, 16, 32, 0.90);
  backdrop-filter: blur(18px);
  border: 1.5px solid rgba(251, 191, 36, 0.5);
  border-radius: 22px;
  padding: 12px 18px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 80;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
  pointer-events: auto;
}

.boss3d-hand-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.boss3d-card {
  width: 158px;
  background: linear-gradient(160deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.98));
  border: 1.5px solid rgba(251, 191, 36, 0.45);
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  text-align: left;
}

.boss3d-card:hover {
  transform: translateY(-8px) scale(1.03);
  border-color: #fbbf24;
  box-shadow: 0 10px 26px rgba(251, 191, 36, 0.35);
}

.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.theme-card {
  background: rgba(15, 23, 42, 0.88);
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-card:hover {
  border-color: #fbbf24;
  transform: translateY(-2px);
}

.theme-card.active {
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.14);
}
