/* ============================================================
   styles.css — 總經指標儀表板 深色主題設計系統
   ============================================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── CSS 變數 ── */
:root {
  /* 背景色 */
  --bg-primary: #060a13;
  --bg-secondary: #0d1321;
  --bg-tertiary: #111827;
  --bg-card: rgba(15, 23, 42, 0.65);
  --bg-card-hover: rgba(20, 30, 55, 0.8);

  /* 文字色 */
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  /* 訊號色 */
  --signal-green: #00d4aa;
  --signal-green-bg: rgba(0, 212, 170, 0.12);
  --signal-green-glow: rgba(0, 212, 170, 0.4);
  --signal-yellow: #fbbf24;
  --signal-yellow-bg: rgba(251, 191, 36, 0.12);
  --signal-yellow-glow: rgba(251, 191, 36, 0.4);
  --signal-red: #ff4757;
  --signal-red-bg: rgba(255, 71, 87, 0.12);
  --signal-red-glow: rgba(255, 71, 87, 0.4);

  /* 強調色 */
  --accent-primary: #667eea;
  --accent-secondary: #764ba2;
  --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);

  /* 類別色 */
  --cat-rates: #667eea;
  --cat-inflation: #f093fb;
  --cat-employment: #4facfe;
  --cat-activity: #43e97b;
  --cat-sentiment: #fa709a;
  --cat-commodities: #fccb90;

  /* 卡片效果 */
  --card-border: rgba(255, 255, 255, 0.06);
  --card-border-hover: rgba(255, 255, 255, 0.12);
  --card-blur: 20px;
  --card-radius: 16px;
  --card-radius-lg: 24px;

  /* 間距 */
  --gap: 16px;
  --gap-lg: 24px;

  /* 字型 */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* 動畫 */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 150ms var(--ease-out);
  --transition-normal: 300ms var(--ease-out);
  --transition-slow: 500ms var(--ease-out);
}

/* ── 基本重置 ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── 背景動態效果 ── */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(102, 126, 234, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 90% 80%, rgba(118, 75, 162, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 0%, rgba(79, 172, 254, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ── 主容器 ── */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px 40px;
}

/* ── 頂部導航列 ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.header-title h1 {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-title .subtitle {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 400;
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.last-updated {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 6px;
}

.last-updated .pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--signal-green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--signal-green-glow); }
  50% { opacity: 0.7; box-shadow: 0 0 0 6px transparent; }
}

/* ── 總經健康評分區 ── */
.score-section {
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius-lg);
  padding: 32px;
  margin-bottom: var(--gap-lg);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 40px;
  align-items: center;
  animation: slideUp 0.6s var(--ease-out) both;
  position: relative;
  overflow: hidden;
}

.score-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), rgba(118, 75, 162, 0.5), transparent);
}

.score-gauge-container {
  position: relative;
  width: 160px;
  height: 160px;
}

.score-gauge-container canvas {
  width: 100% !important;
  height: 100% !important;
}

.score-value-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-number {
  font-size: 2.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-max {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.score-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.score-info .score-label {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 12px;
}

.score-info .score-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 420px;
}

.score-summary-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
}

.summary-bar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
}

.summary-bar-item .bar-label {
  width: 50px;
  color: var(--text-secondary);
  font-weight: 500;
  flex-shrink: 0;
}

.summary-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.summary-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s var(--ease-out);
}

.summary-bar-item .bar-count {
  width: 20px;
  text-align: right;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

/* ── 類別區塊 ── */
.category-section {
  margin-bottom: var(--gap-lg);
  animation: slideUp 0.6s var(--ease-out) both;
}

.category-section:nth-child(2) { animation-delay: 0.08s; }
.category-section:nth-child(3) { animation-delay: 0.16s; }
.category-section:nth-child(4) { animation-delay: 0.24s; }
.category-section:nth-child(5) { animation-delay: 0.32s; }
.category-section:nth-child(6) { animation-delay: 0.40s; }

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding-left: 4px;
}

.category-icon {
  font-size: 1.2rem;
}

.category-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.category-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--card-border), transparent);
  margin-left: 12px;
}

/* ── Bento Grid ── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap);
}

/* ── 指標卡片 ── */
.indicator-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 20px;
  position: relative;
  transition:
    background var(--transition-normal),
    border-color var(--transition-normal),
    transform var(--transition-normal),
    box-shadow var(--transition-normal);
  cursor: default;
  overflow: hidden;
}

.indicator-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  border-radius: var(--card-radius) var(--card-radius) 0 0;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.indicator-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--card-border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.indicator-card:hover::before {
  opacity: 1;
}

/* 各類別卡片頂部線條色 */
.indicator-card[data-category="rates"]::before { background: var(--cat-rates); }
.indicator-card[data-category="inflation"]::before { background: var(--cat-inflation); }
.indicator-card[data-category="employment"]::before { background: var(--cat-employment); }
.indicator-card[data-category="activity"]::before { background: var(--cat-activity); }
.indicator-card[data-category="sentiment"]::before { background: var(--cat-sentiment); }
.indicator-card[data-category="commodities"]::before { background: var(--cat-commodities); }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-title-zh {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
  letter-spacing: 0;
  text-transform: none;
}

/* ── 訊號燈 ── */
.signal-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all var(--transition-normal);
}

.signal-light.green {
  background: var(--signal-green);
  box-shadow: 0 0 8px var(--signal-green-glow), 0 0 20px rgba(0, 212, 170, 0.15);
}

.signal-light.yellow {
  background: var(--signal-yellow);
  box-shadow: 0 0 8px var(--signal-yellow-glow), 0 0 20px rgba(251, 191, 36, 0.15);
}

.signal-light.red {
  background: var(--signal-red);
  box-shadow: 0 0 8px var(--signal-red-glow), 0 0 20px rgba(255, 71, 87, 0.15);
  animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
  0%, 100% { box-shadow: 0 0 8px var(--signal-red-glow), 0 0 20px rgba(255, 71, 87, 0.15); }
  50% { box-shadow: 0 0 12px var(--signal-red-glow), 0 0 30px rgba(255, 71, 87, 0.25); }
}

/* ── 數值顯示 ── */
.card-value-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.card-value {
  font-size: 1.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.card-change {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.card-change.positive {
  color: var(--signal-green);
  background: var(--signal-green-bg);
}

.card-change.negative {
  color: var(--signal-red);
  background: var(--signal-red-bg);
}

.card-change.neutral {
  color: var(--signal-yellow);
  background: var(--signal-yellow-bg);
}

.card-description {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── 迷你圖表 ── */
.card-sparkline {
  margin-top: 14px;
  height: 50px;
  position: relative;
}

.card-sparkline canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── 入場動畫 ── */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.indicator-card {
  animation: slideUp 0.5s var(--ease-out) both;
}

/* 交錯動畫延遲 */
.bento-grid .indicator-card:nth-child(1) { animation-delay: 0.05s; }
.bento-grid .indicator-card:nth-child(2) { animation-delay: 0.10s; }
.bento-grid .indicator-card:nth-child(3) { animation-delay: 0.15s; }

/* ── 數值跳動動畫 ── */
.value-updated {
  animation: valueBounce 0.4s var(--ease-spring);
}

@keyframes valueBounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* ── 底部狀態列 ── */
.footer {
  margin-top: 32px;
  padding: 16px 0;
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.footer-item {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.footer-item .legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.footer-right {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* ── Tooltip ── */
.tooltip {
  position: absolute;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border-hover);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.78rem;
  color: var(--text-primary);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition-fast);
  z-index: 1000;
  max-width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tooltip.visible {
  opacity: 1;
}

/* ── 響應式設計 ── */

/* 平板 */
@media (max-width: 1200px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .score-section {
    grid-template-columns: auto 1fr;
    gap: 24px;
  }

  .score-summary-bars {
    grid-column: 1 / -1;
  }
}

/* 大手機 / 小平板 */
@media (max-width: 768px) {
  .app-container {
    padding: 16px 16px 32px;
  }

  .header {
    padding: 12px 0 20px;
  }

  .header-title h1 {
    font-size: 1.15rem;
  }

  .score-section {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 24px;
    gap: 20px;
  }

  .score-gauge-container {
    margin: 0 auto;
    width: 140px;
    height: 140px;
  }

  .score-info .score-description {
    max-width: 100%;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .card-value {
    font-size: 1.4rem;
  }
}

/* 手機 */
@media (max-width: 480px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .score-number {
    font-size: 2.2rem;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── 滾動條美化 ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── 選取色 ── */
::selection {
  background: rgba(102, 126, 234, 0.3);
}

/* ── Loading Overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-logo {
  font-size: 3rem;
  animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  transition: all 0.3s ease;
}

.loading-subtext {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

/* ── Data Source Badge ── */
.data-source-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  background: var(--bg-card);
  transition: all var(--transition-normal);
}

.data-source-badge .badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-normal);
}

.data-source-badge.real {
  border-color: rgba(0, 212, 170, 0.3);
  background: rgba(0, 212, 170, 0.08);
  color: var(--signal-green);
}

.data-source-badge.real .badge-dot {
  background: var(--signal-green);
  box-shadow: 0 0 6px var(--signal-green-glow);
}

.data-source-badge.mock {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
  color: var(--signal-yellow);
}

.data-source-badge.mock .badge-dot {
  background: var(--signal-yellow);
  box-shadow: 0 0 6px var(--signal-yellow-glow);
}

/* ── 預測傳導鏈面板 ── */
.prediction-section {
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius-lg);
  padding: 32px;
  margin-bottom: var(--gap-lg);
  animation: slideUp 0.6s var(--ease-out) 0.1s both;
  position: relative;
  overflow: hidden;
}

.prediction-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.5), rgba(244, 114, 182, 0.5), transparent);
}

.prediction-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.prediction-section-title h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.prediction-section-title .subtitle-tag {
  font-size: 0.65rem;
  padding: 3px 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.15), rgba(244, 114, 182, 0.15));
  color: #c4b5fd;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* 傳導鏈節點 */
.prediction-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 32px;
  flex-wrap: nowrap;
}

.chain-branches {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chain-branch {
  display: flex;
  align-items: center;
}

.chain-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 24px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  min-width: 150px;
  text-align: center;
  transition: all var(--transition-normal);
}

.chain-node:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--card-border-hover);
  transform: translateY(-2px);
}

.chain-node-icon {
  font-size: 1.6rem;
}

.chain-node-label {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.chain-node-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.chain-node-signal {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 8px;
  margin-top: 2px;
}

.chain-node-signal.strong-bull { background: var(--signal-green-bg); color: var(--signal-green); }
.chain-node-signal.bull        { background: var(--signal-green-bg); color: var(--signal-green); }
.chain-node-signal.neutral     { background: var(--signal-yellow-bg); color: var(--signal-yellow); }
.chain-node-signal.bear        { background: var(--signal-red-bg); color: var(--signal-red); }
.chain-node-signal.strong-bear { background: var(--signal-red-bg); color: var(--signal-red); }

/* 箭頭 */
.chain-arrow {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
}

.arrow-line {
  width: 50px;
  height: 2px;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.4), rgba(244, 114, 182, 0.4));
  position: relative;
  overflow: visible;
}

.arrow-line::after {
  content: '▶';
  position: absolute;
  right: -10px;
  top: -7px;
  color: rgba(244, 114, 182, 0.6);
  font-size: 11px;
}

.arrow-line::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 20px;
  height: 4px;
  background: rgba(167, 139, 250, 0.6);
  border-radius: 2px;
  animation: flowArrow 2s ease-in-out infinite;
}

@keyframes flowArrow {
  0% { left: -10px; opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { left: 50px; opacity: 0; }
}

.arrow-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* 預測細節區 */
.prediction-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

/* 預測儀表 */
.prediction-gauge-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--card-border);
}

.prediction-gauge-wrapper h3 {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.gauge-bar-container {
  position: relative;
  margin-bottom: 8px;
}

.gauge-bar-track {
  width: 100%;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg,
    #ff4757 0%, #ff6b81 20%,
    #fbbf24 40%, #94a3b8 50%,
    #fbbf24 60%, #43e97b 80%,
    #00d4aa 100%
  );
  position: relative;
  overflow: visible;
}

.gauge-bar-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 20px;
  background: white;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  transition: left 1s var(--ease-out);
  z-index: 2;
}

.gauge-bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.62rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.prediction-score-display {
  text-align: center;
  margin-top: 16px;
}

.prediction-score-number {
  font-size: 2.4rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
}

.prediction-score-number.bullish { color: var(--signal-green); }
.prediction-score-number.bearish { color: var(--signal-red); }
.prediction-score-number.neutral-score { color: var(--signal-yellow); }

.prediction-score-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 6px;
}

.prediction-confidence {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 4px;
  font-family: var(--font-mono);
}

/* 驅動因子 */
.drivers-wrapper {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--card-border);
}

.drivers-wrapper h3 {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.driver-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--card-border);
}

.driver-item:last-child {
  border-bottom: none;
}

.driver-icon {
  font-size: 1.2rem;
  width: 32px;
  text-align: center;
}

.driver-info {
  flex: 1;
}

.driver-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}

.driver-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.driver-signal {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
}

.driver-signal.green { background: var(--signal-green-bg); color: var(--signal-green); }
.driver-signal.yellow { background: var(--signal-yellow-bg); color: var(--signal-yellow); }
.driver-signal.red { background: var(--signal-red-bg); color: var(--signal-red); }

.driver-bar-container {
  width: 60px;
  flex-shrink: 0;
}

.driver-bar {
  height: 4px;
  border-radius: 2px;
  transition: width 0.8s var(--ease-out);
}

.all-drivers-toggle {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  color: var(--text-tertiary);
  font-size: 0.72rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-sans);
}

.all-drivers-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}
/* ── 短線籌碼神經網 ── */
.prediction-short-term {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.short-term-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.short-term-header h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.st-badge {
  font-size: 0.6rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(251, 146, 60, 0.2);
  color: #fb923c;
  border: 1px solid rgba(251, 146, 60, 0.3);
  font-weight: 500;
}

.short-term-signal-box {
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--card-border);
}

.short-term-signal-box strong {
  font-weight: 700;
}

.short-term-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.st-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all var(--transition-normal);
}

.st-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--card-border-hover);
}

.st-card-title {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-weight: 500;
}

.st-card-val {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 6px;
}

.st-card-signal {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
}


/* ── 市場指數卡片 ── */
.market-section {
  margin-bottom: var(--gap-lg);
  animation: slideUp 0.6s var(--ease-out) 0.15s both;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.market-card {
  background: var(--bg-card);
  backdrop-filter: blur(var(--card-blur));
  -webkit-backdrop-filter: blur(var(--card-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--card-radius);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.market-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--card-border-hover);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.market-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  opacity: 0.8;
}

.market-card.sox::before { background: #a78bfa; }
.market-card.taiex::before { background: #f472b6; }

.market-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.market-card-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.market-card-title-zh {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 2px;
}

.market-card-prediction {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
}

.market-card-value {
  font-size: 2rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
  margin-bottom: 2px;
}

.market-card-change {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.market-card-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.market-card-chart {
  margin-top: 16px;
  height: 80px;
}

.market-card-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── 相關性分析區 ── */
.correlation-section {
  margin-bottom: var(--gap-lg);
  animation: slideUp 0.6s var(--ease-out) 0.2s both;
}

.correlation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.corr-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  transition: all var(--transition-normal);
  cursor: default;
}

.corr-cell:hover {
  transform: translateY(-2px);
  border-color: var(--card-border-hover);
}

.corr-cell-name {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-align: center;
  font-weight: 500;
  line-height: 1.3;
}

.corr-cell-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.corr-cell-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
}

.corr-cell-bar-fill {
  position: absolute;
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s var(--ease-out);
}

/* 相關性顏色 */
.corr-positive-strong { color: #00d4aa; }
.corr-positive-strong .corr-cell-bar-fill { background: #00d4aa; }
.corr-positive { color: #43e97b; }
.corr-positive .corr-cell-bar-fill { background: #43e97b; }
.corr-weak { color: #94a3b8; }
.corr-weak .corr-cell-bar-fill { background: #94a3b8; }
.corr-negative { color: #fbbf24; }
.corr-negative .corr-cell-bar-fill { background: #fbbf24; }
.corr-negative-strong { color: #ff4757; }
.corr-negative-strong .corr-cell-bar-fill { background: #ff4757; }

.corr-highlight {
  grid-column: 1 / -1;
  background: rgba(167, 139, 250, 0.06);
  border-color: rgba(167, 139, 250, 0.2);
  flex-direction: row;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
}

.corr-highlight .corr-cell-name {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.corr-highlight .corr-cell-value {
  font-size: 1.4rem;
  color: #a78bfa;
}

/* ── 響應式補充 ── */
@media (max-width: 768px) {
  .prediction-chain {
    flex-direction: column;
    gap: 8px;
  }
  .chain-arrow {
    transform: rotate(90deg);
    padding: 4px 0;
  }
  .prediction-details {
    grid-template-columns: 1fr;
  }
  .market-grid {
    grid-template-columns: 1fr;
  }
  .correlation-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }
}


