/* =============================================================
   靈犀源點 AEO Radar — 主樣式表（全面重寫版）
   設計風格：Light Professional — 仿 Google Lighthouse 品質
   Mobile-first，斷點：640px / 768px / 1024px / 1280px
   字體：Inter + Noto Sans TC + JetBrains Mono
   ============================================================= */

/* ─────────────────────────────────────────────
   0. CSS 設計代幣（Design Tokens）
───────────────────────────────────────────── */
:root {
  /* 背景色系 */
  --bg:          #ffffff;
  --bg-alt:      #f8fafc;
  --bg-result:   #fafbfc;

  /* 文字色系 */
  --text:           #1e293b;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  /* 強調色 */
  --accent:       #2563eb;
  --accent-light: #dbeafe;
  --teal:         #0d9488;

  /* 狀態色 */
  --green:     #16a34a;
  --green-bg:  #f0fdf4;
  --green-border: #bbf7d0;
  --orange:    #ea580c;
  --orange-bg: #fff7ed;
  --orange-border: #fed7aa;
  --red:       #dc2626;
  --red-bg:    #fef2f2;
  --red-border:    #fecaca;

  /* 線條 */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* 陰影 */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);

  /* 漸層 */
  --gradient:       linear-gradient(135deg, #2563eb, #0d9488);
  --gradient-blue:  linear-gradient(135deg, #2563eb, #3b82f6);
  --gradient-score: linear-gradient(135deg, #2563eb 0%, #0d9488 100%);

  /* 字體 */
  --font-sans: 'Inter', 'Noto Sans TC', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

  /* 圓角 */
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   16px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* 間距 */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* 動畫 */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:  150ms;
  --dur-base:  250ms;
  --dur-slow:  400ms;
  --dur-score: 1200ms;

  /* Z-index */
  --z-navbar:  100;
  --z-overlay: 200;
}

/* ─────────────────────────────────────────────
   1. Reset & 基礎排版
───────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 無障礙：跳過連結 */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 9999;
  text-decoration: none;
  transition: top var(--dur-fast) ease;
}
.skip-link:focus {
  top: 0;
}

/* 螢幕閱讀器專用 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 焦點樣式 */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* 連結 */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur-fast) ease;
}
a:hover { color: var(--teal); }

/* 按鈕基礎 */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol { list-style: none; }

/* ─────────────────────────────────────────────
   2. 容器
───────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--sp-5);
}

@media (min-width: 640px) {
  .container { padding-inline: var(--sp-6); }
}
@media (min-width: 1024px) {
  .container { padding-inline: var(--sp-8); }
}

/* ─────────────────────────────────────────────
   3. 導覽列
───────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-navbar);
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--dur-base) ease;
}

.navbar.scrolled {
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

/* 品牌 */
.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  color: var(--text);
}

.brand-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-lingxi {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.brand-aeo {
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 語言切換 */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
}

.lang-btn {
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
  letter-spacing: 0.02em;
}

.lang-btn.active {
  background-color: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.lang-btn:hover:not(.active) {
  color: var(--text);
}

/* ─────────────────────────────────────────────
   4. Hero 區塊
───────────────────────────────────────────── */
.hero {
  background-color: var(--bg);
  padding-block: var(--sp-20) var(--sp-16);
  text-align: center;
  overflow: hidden;
  /* 細微放射狀背景光暈 */
  background-image: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(37,99,235,0.06), transparent);
}

.hero-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
}

/* 徽章 */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 16px;
  background: linear-gradient(135deg, #eff6ff, #f0fdfa);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.01em;
}

/* 主標題 */
.hero-title {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text);
  letter-spacing: -0.03em;
}

@media (min-width: 640px) {
  .hero-title { font-size: 3rem; }
}
@media (min-width: 768px) {
  .hero-title { font-size: 3.4rem; }
}

/* 漸層文字（AI 二字） */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 副標題 */
.hero-subtitle {
  max-width: 480px;
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

@media (min-width: 768px) {
  .hero-subtitle { font-size: 1.1rem; }
}

/* ─────────────────────────────────────────────
   4a. 掃描輸入框
───────────────────────────────────────────── */
.scan-box {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.scan-input-wrap {
  display: flex;
  align-items: center;
  background-color: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  padding: 6px 6px 6px var(--sp-5);
  gap: var(--sp-3);
  transition:
    border-color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
  box-shadow: var(--shadow-sm);
}

.scan-input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1), var(--shadow-sm);
}

.scan-input-icon {
  font-size: 1rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.scan-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
}

.scan-input::placeholder {
  color: var(--text-muted);
}

.scan-btn {
  flex-shrink: 0;
  padding: 10px 24px;
  background: var(--gradient);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition:
    opacity var(--dur-fast) ease,
    transform var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
  box-shadow: 0 2px 8px rgba(37,99,235,0.35);
}

.scan-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

.scan-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}

.scan-btn.loading {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

/* 網址錯誤提示 */
.url-error {
  font-size: 0.82rem;
  color: var(--red);
  text-align: left;
  padding-left: var(--sp-5);
  font-weight: 500;
}

/* ─────────────────────────────────────────────
   4b. 流程標籤
───────────────────────────────────────────── */
.flow-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2);
  justify-content: center;
}

.flow-tag {
  padding: 4px 14px;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.flow-tag-accent {
  background: var(--gradient);
  border-color: transparent;
  color: #fff;
}

.flow-arrow {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────
   4c. 統計數字格
───────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
  width: 100%;
  max-width: 560px;
  margin-top: var(--sp-2);
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-4) var(--sp-3);
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: transform var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* ─────────────────────────────────────────────
   5. 載入中覆蓋層
───────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  background-color: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) ease;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-4);
  text-align: center;
  max-width: 420px;
  padding: var(--sp-5);
  width: 100%;
}

/* 雙層脈動 Spinner */
.loading-spinner-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.loading-spinner-pulse {
  position: absolute;
  width: 60px;
  height: 60px;
  border: 2px solid rgba(37,99,235,0.2);
  border-radius: 50%;
  animation: pulse-ring 1.5s ease-out infinite;
}

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

@keyframes pulse-ring {
  0%   { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.2); opacity: 0; }
}

.loading-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.loading-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.loading-step {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  min-height: 1.2em;
}

/* 步驟列表包裝器（JS 動態插入） */
.loading-steps-wrap {
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.loading-step-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px var(--sp-2);
  border-radius: 6px;
  font-size: 0.8rem;
  transition: background-color var(--dur-fast) ease;
}

.loading-step-item.loading-step-pending {
  color: var(--text-muted);
}

.loading-step-item.loading-step-active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

.loading-step-item.loading-step-done {
  color: var(--green);
}

.step-status-icon {
  font-size: 0.9rem;
  width: 1.2em;
  text-align: center;
  flex-shrink: 0;
}

.step-name {
  flex: 1;
  min-width: 0;
}

.step-state {
  font-size: 0.72rem;
  opacity: 0.75;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────
   6. 掃描結果區塊
───────────────────────────────────────────── */
.scan-result {
  background-color: var(--bg-result);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-12) var(--sp-16);
}

.scan-result[hidden] {
  display: none;
}

/* 滑入動畫（JS 移除 hidden 後觸發） */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scan-result.slide-in {
  animation: slideInUp var(--dur-slow) var(--ease-out) both;
}

/* 結果容器單欄堆疊 */
.result-container {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}

/* 報告標題列 */
.result-title-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.result-heading {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.result-url-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 2px 12px;
  font-family: var(--font-mono);
  letter-spacing: 0;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─────────────────────────────────────────────
   6a. 總分摘要卡片（Section A）
───────────────────────────────────────────── */
.score-summary-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-8) var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-6);
}

@media (min-width: 768px) {
  .score-summary-card {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--sp-8);
  }
}

/* 左側：分數圓圈 */
.score-circle-side {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

/* 圓形進度條容器 */
.score-circle-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.score-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* SVG 軌道（灰色底層） */
.score-track {
  stroke: var(--border);
}

/* SVG 進度弧（JS 動態填色） */
.score-progress {
  stroke: var(--accent);
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 數字疊加層 */
.score-overlay {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.score-number {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}

.score-denom {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 右側：資訊 */
.score-info-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  /* 桌面版置頂對齊 */
  align-self: flex-start;
}

/* 等級 Badge 列 */
.score-grade-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.score-grade-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text);
}

/* 等級 A（綠色）*/
.score-grade-badge[data-grade="A"],
.score-grade-badge[data-grade="A+"],
.score-grade-badge[data-grade="S"] {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

/* 等級 B-C（橘色）*/
.score-grade-badge[data-grade="B"],
.score-grade-badge[data-grade="C"] {
  background: var(--orange-bg);
  border-color: var(--orange-border);
  color: var(--orange);
}

/* 等級 D（紅色）*/
.score-grade-badge[data-grade="D"],
.score-grade-badge[data-grade="F"] {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}

.score-biz {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* 診斷文字 */
.score-diagnosis {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-left: 3px solid var(--accent-light);
  padding-left: var(--sp-3);
}

/* ─────────────────────────────────────────────
   Top 3 最需改善
───────────────────────────────────────────── */
.top3-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.top3-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.top3-cards {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* 單個 Top3 卡片 */
.top3-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  transition: transform var(--dur-fast) ease;
}

.top3-card:hover {
  transform: translateX(2px);
}

.top3-card[data-status="fail"] {
  border-left-color: var(--red);
  background: var(--red-bg);
  border-color: var(--red-border);
  border-left-color: var(--red);
}

.top3-card[data-status="warn"] {
  border-left-color: var(--orange);
  background: var(--orange-bg);
  border-color: var(--orange-border);
  border-left-color: var(--orange);
}

.top3-card-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.top3-card-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

.top3-card-score {
  font-size: 0.75rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  white-space: nowrap;
}

.top3-card-gain {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  white-space: nowrap;
}

.top3-card[data-status="fail"] .top3-card-gain {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.top3-card[data-status="warn"] .top3-card-gain {
  background: var(--orange-bg);
  color: var(--orange);
  border: 1px solid var(--orange-border);
}

/* ─────────────────────────────────────────────
   6b. 16 個維度手風琴（Section B）
───────────────────────────────────────────── */
.dimensions-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* 維度群組 */
.dim-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.dim-group-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-1);
}

.dim-group-icon {
  font-size: 0.9rem;
}

.dim-group-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* ─── 維度卡片 ─── */
.dim-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition:
    box-shadow var(--dur-base) ease,
    border-color var(--dur-base) ease;
}

.dim-card:hover {
  box-shadow: var(--shadow-sm);
}

/* pass 狀態：淡綠底色 */
.dim-card[data-status="pass"] {
  background: linear-gradient(to right, var(--green-bg) 0%, var(--bg) 100%);
  border-color: var(--green-border);
}

/* fail 狀態預設展開，淡紅邊框 */
.dim-card[data-status="fail"] {
  border-color: var(--red-border);
}

/* warn 狀態 */
.dim-card[data-status="warn"] {
  border-color: var(--orange-border);
}

/* 展開後加上明顯邊框 */
.dim-card.expanded {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

/* 卡片標頭（可點擊） */
.dim-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-fast) ease;
  /* 防止標頭自身的 focus outline 影響 */
  outline: none;
}

.dim-header:hover {
  background-color: var(--bg-alt);
}

.dim-header:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.dim-icon {
  font-size: 1rem;
  flex-shrink: 0;
  width: 1.5rem;
  text-align: center;
}

.dim-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

/* 進度條包裝 */
.dim-bar-wrap {
  flex-shrink: 0;
  width: 100px;
  height: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

@media (max-width: 480px) {
  .dim-bar-wrap { width: 60px; }
}

.dim-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s var(--ease-out);
}

/* 分數文字 */
.dim-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 狀態圖示 */
.dim-status-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  width: 1.2rem;
  text-align: center;
}

/* 展開箭頭 */
.dim-toggle {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--dur-fast) ease;
}

.dim-card.expanded .dim-toggle {
  transform: rotate(90deg);
}

/* 卡片詳細內容（展開時顯示） */
.dim-body {
  display: none;
  padding: var(--sp-5) var(--sp-5) var(--sp-5) calc(var(--sp-5) + 1.5rem + var(--sp-3));
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  animation: expandDown var(--dur-base) var(--ease-out) both;
}

.dim-card.expanded .dim-body {
  display: block;
}

@keyframes expandDown {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 維度詳細說明 */
.dim-detail {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: var(--sp-3);
}

/* 指標列表 */
.dim-indicators {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dim-indicators li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 根據指標開頭符號設定顏色 */
.dim-indicators li[data-pass="true"] {
  color: var(--green);
}

.dim-indicators li[data-pass="false"] {
  color: var(--red);
}

/* ─────────────────────────────────────────────
   6c. 修復方案（Section C）
───────────────────────────────────────────── */
.fix-codes-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* 修復方案標題列 */
.fix-codes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6) var(--sp-6);
  border-bottom: 1px solid var(--border);
  gap: var(--sp-4);
  flex-wrap: wrap;
  background: linear-gradient(to bottom, var(--bg), var(--bg-alt));
}

.fix-codes-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.fix-codes-icon {
  font-size: 1.2rem;
}

.fix-codes-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.fix-codes-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* 一鍵複製全部按鈕 */
.copy-all-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  background: var(--gradient);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition:
    opacity var(--dur-fast) ease,
    transform var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.copy-all-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.35);
}

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

.copy-all-btn:disabled {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.copy-all-btn.copied {
  background: var(--green);
}

/* 修復碼列表 */
.fix-codes-list {
  padding: var(--sp-4) var(--sp-6) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* 無資料提示 */
.no-data {
  text-align: center;
  padding: var(--sp-8);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ─── 修復碼卡片 ─── */
.fix-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow var(--dur-base) ease;
}

.fix-card:hover {
  box-shadow: var(--shadow-sm);
}

.fix-card.expanded {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

/* 修復碼卡片標頭 */
.fix-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  cursor: pointer;
  background: var(--bg-alt);
  transition: background-color var(--dur-fast) ease;
  user-select: none;
  outline: none;
}

.fix-header:hover {
  background: #f1f5f9;
}

.fix-header:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.fix-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.fix-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  min-width: 0;
}

/* +X 分 Badge */
.fix-gain {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  flex-shrink: 0;
  white-space: nowrap;
}

/* 展開箭頭 */
.fix-toggle {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--dur-fast) ease;
}

.fix-card.expanded .fix-toggle {
  transform: rotate(90deg);
}

/* 修復碼展開內容 */
.fix-body {
  display: none;
  padding: var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--bg);
  animation: expandDown var(--dur-base) var(--ease-out) both;
}

.fix-card.expanded .fix-body {
  display: block;
}

/* 修復碼說明文字 */
.fix-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--sp-4);
}

/* 程式碼區塊（暗色背景） */
.fix-code {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  margin-bottom: var(--sp-3);
  /* 水平捲動樣式 */
  scrollbar-width: thin;
  scrollbar-color: #475569 #1e293b;
  white-space: pre;
  border: 1px solid #334155;
}

.fix-code::-webkit-scrollbar {
  height: 6px;
}

.fix-code::-webkit-scrollbar-track {
  background: #1e293b;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.fix-code::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: var(--radius-full);
}

/* 程式碼語法高亮模擬（CSS 類別由 JS 標記） */
.fix-code .token-tag    { color: #93c5fd; }
.fix-code .token-attr   { color: #6ee7b7; }
.fix-code .token-string { color: #fde68a; }
.fix-code .token-key    { color: #93c5fd; }
.fix-code .token-value  { color: #fde68a; }
.fix-code .token-punct  { color: #94a3b8; }

/* 複製按鈕 */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    background-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    border-color var(--dur-fast) ease,
    transform var(--dur-fast) ease;
}

.copy-btn:hover {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

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

/* 已複製狀態 */
.copy-btn.copied {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

/* ─────────────────────────────────────────────
   6d. 行動中心（Action Center — Tab UI）
───────────────────────────────────────────── */

/* 外層容器 */
.action-center {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-top: 32px;
}

/* 行動中心標題 */
.action-center-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 20px 24px 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

/* Tab 列 */
.ac-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin-top: 16px;
}

.ac-tabs::-webkit-scrollbar {
  display: none;
}

/* 單個 Tab 按鈕 */
.ac-tab {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text-muted);
  transition: all 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
}

.ac-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.ac-tab:hover:not(.active) {
  color: var(--text);
  background: var(--bg-alt);
}

.ac-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.ac-tab-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.ac-tab-label {
  flex-shrink: 0;
}

/* 計數徽章（顯示待修復數量） */
.ac-tab-badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 700;
  line-height: 1.4;
  flex-shrink: 0;
}

/* 面板容器 */
.ac-panels {
  /* 讓子面板撐開 */
}

/* 單個面板 */
.ac-panel {
  display: none;
  padding: 24px;
}

.ac-panel.active {
  display: block;
  animation: fadeIn 0.2s ease both;
}

/* fadeIn 動畫（若未定義則此處補充） */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── 全部通過提示 ── */
.ac-all-pass {
  text-align: center;
  padding: 48px 24px;
}

.ac-all-pass-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
}

.ac-all-pass-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.ac-all-pass-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ── 步驟卡片（Tab 1：修復指南）── */
.ac-step-content {
  /* 步驟主體容器 */
}

.ac-step-header {
  margin-bottom: 16px;
}

.ac-step-meta {
  margin-bottom: 8px;
}

.ac-step-counter {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ac-step-title-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.ac-step-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.ac-step-status {
  font-size: 1rem;
  flex-shrink: 0;
}

.ac-step-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.ac-step-gain {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
  white-space: nowrap;
  flex-shrink: 0;
}

.ac-quickwin-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  white-space: nowrap;
  flex-shrink: 0;
}

/* 進度條 */
.ac-progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: var(--radius-full);
  margin-bottom: 20px;
  overflow: hidden;
}

.ac-progress-fill {
  height: 100%;
  background: var(--gradient-blue);
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-out);
}

/* 步驟說明文字 */
.ac-step-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 修復方案區塊 */
.ac-fix-section {
  margin-bottom: 20px;
}

.ac-fix-section-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ac-fix-section--ai .ac-fix-section-label {
  color: var(--teal);
}

/* 程式碼區塊包裝 */
.ac-code-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.ac-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.ac-code-filename {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.ac-code-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* 程式碼操作按鈕 */
.ac-code-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.ac-code-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-light);
}

.ac-code-btn.copied {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

/* 程式碼預覽（暗色背景）*/
.ac-code-pre {
  background: #1e293b;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  padding: 16px 20px;
  overflow-x: auto;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #475569 #1e293b;
}

.ac-code-pre--prompt {
  background: #0f172a;
  max-height: 200px;
}

/* 步驟導航列 */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  gap: var(--sp-3);
}

.step-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  color: var(--text);
  transition: all 0.15s ease;
}

.step-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.step-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.step-btn--next {
  background: var(--gradient-blue);
  color: #fff;
  border-color: transparent;
}

.step-btn--next:hover:not(:disabled) {
  opacity: 0.9;
  color: #fff;
  background: var(--gradient-blue);
}

.step-progress {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  flex: 1;
}

/* ── 生成檔案格線（Tab 2）── */
.ac-generate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-4);
}

/* ── 報告匯出格線（Tab 4）── */
.ac-export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-5);
}

.ac-export-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  transition: box-shadow 0.2s ease;
}

.ac-export-card:hover {
  box-shadow: var(--shadow-sm);
}

.ac-export-card--primary {
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border-color: var(--accent-light);
}

.ac-export-card-icon {
  font-size: 2.2rem;
}

.ac-export-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.ac-export-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.ac-export-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  color: var(--text);
  transition: all 0.15s ease;
  white-space: nowrap;
  align-self: stretch;
  justify-content: center;
}

.ac-export-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.ac-export-btn--primary {
  background: var(--gradient-blue);
  color: #fff;
  border-color: transparent;
}

.ac-export-btn--primary:hover {
  opacity: 0.9;
  color: #fff;
  background: var(--gradient-blue);
}

.ac-export-btn.copied {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

/* 空狀態提示 */
.ac-empty-msg {
  text-align: center;
  padding: var(--sp-10);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── RWD：手機版 ── */
@media (max-width: 640px) {
  .action-center-title {
    padding: 16px 16px 0;
    font-size: 1.05rem;
  }

  .ac-tab {
    padding: 12px 12px;
    font-size: 0.78rem;
    gap: 4px;
  }

  .ac-tab-icon {
    font-size: 0.9rem;
  }

  .ac-panel {
    padding: 16px;
  }

  .ac-step-title {
    font-size: 0.95rem;
  }

  .ac-generate-grid,
  .ac-export-grid {
    grid-template-columns: 1fr;
  }

  .ac-code-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-2);
  }

  .step-nav {
    flex-wrap: wrap;
  }

  .step-progress {
    order: -1;
    flex-basis: 100%;
    text-align: center;
  }
}

/* ─────────────────────────────────────────────
   6e. 重新掃描（Section D）
───────────────────────────────────────────── */
.rescan-wrap {
  display: flex;
  justify-content: center;
  padding-top: var(--sp-4);
}

.rescan-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 12px 28px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    border-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    transform var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease;
  letter-spacing: 0.01em;
}

.rescan-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

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

/* ─────────────────────────────────────────────
   7. Features 區塊
───────────────────────────────────────────── */
.features {
  background-color: var(--bg);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-16);
}

.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  text-align: center;
  margin-bottom: var(--sp-3);
}

.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-3);
}

@media (min-width: 768px) {
  .section-title { font-size: 2.2rem; }
}

.section-sub {
  font-size: 0.95rem;
  color: var(--text-secondary);
  text-align: center;
  max-width: 480px;
  margin: 0 auto var(--sp-10);
  line-height: 1.7;
}

.features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--sp-5);
}

@media (min-width: 640px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .features-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Feature 卡片 */
.feature-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  transition:
    transform var(--dur-base) ease,
    box-shadow var(--dur-base) ease,
    border-color var(--dur-base) ease;
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

/* 強調卡片（漸層邊框） */
.feature-card--accent {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdfa 100%);
  border-color: #bfdbfe;
}

.feature-card--accent:hover {
  border-color: var(--accent);
}

.feature-icon-wrap {
  width: 48px;
  height: 48px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--dur-fast) ease;
}

.feature-card--accent .feature-icon-wrap {
  background: var(--accent-light);
  border-color: transparent;
}

.feature-card:hover .feature-icon-wrap {
  background: var(--accent-light);
  border-color: transparent;
}

.feature-icon {
  font-size: 1.4rem;
}

.feature-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* 列表圓點 */
.feature-list li::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  opacity: 0.6;
}

/* ─────────────────────────────────────────────
   8. 頁尾
───────────────────────────────────────────── */
.footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding-block: var(--sp-6);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

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

.footer-link {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--dur-fast) ease;
}

.footer-link:hover {
  color: var(--text);
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.footer-sep {
  color: var(--border-strong);
  font-size: 0.8rem;
}

/* ─────────────────────────────────────────────
   9. 進度條顏色工具（JS 動態應用）
───────────────────────────────────────────── */
.bar-green  { background-color: var(--green);  }
.bar-orange { background-color: var(--orange); }
.bar-red    { background-color: var(--red);    }

/* ─────────────────────────────────────────────
   9b. 新功能：百分位徽章 / 分數預測條 / 掃描元資訊列 / 指標子項目 / Quick Win 徽章
───────────────────────────────────────────── */

/* ── 百分位徽章 ── */
.percentile-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* 高百分位（>= 80）：綠色 */
.percentile-badge--top {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}

/* 中百分位（50–79）：藍色 */
.percentile-badge--mid {
  background: var(--accent-light);
  border-color: #bfdbfe;
  color: var(--accent);
}

/* 低百分位（< 50）：橘色 */
.percentile-badge--low {
  background: var(--orange-bg);
  border-color: var(--orange-border);
  color: var(--orange);
}

/* ── 分數預測條 ── */
.score-prediction {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: linear-gradient(135deg, rgba(37,99,235,0.04), rgba(13,148,136,0.04));
  border: 1px solid rgba(37,99,235,0.12);
  border-radius: var(--radius);
}

.prediction-labels {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.prediction-label-current {
  color: var(--text-muted);
}

.prediction-label-gap {
  color: var(--border-strong);
  font-size: 0.7rem;
}

.prediction-label-predicted {
  color: var(--teal);
  font-weight: 600;
}

.prediction-gain {
  font-style: normal;
  font-size: 0.75rem;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  margin-left: 2px;
}

/* 進度條軌道 */
.prediction-bar-track {
  position: relative;
  width: 100%;
  height: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  overflow: visible;
  display: flex;
}

/* 目前分數（實色） */
.prediction-bar-current {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  border-radius: var(--radius-full) 0 0 var(--radius-full);
  transition: width 1s var(--ease-out);
  flex-shrink: 0;
}

/* 潛力區間（斜紋 + 動畫，從 0 展開到目標寬度） */
.prediction-bar-potential {
  height: 100%;
  /* 斜向細紋覆蓋在漸層上 */
  background:
    repeating-linear-gradient(
      60deg,
      transparent,
      transparent 4px,
      rgba(255,255,255,0.45) 4px,
      rgba(255,255,255,0.45) 7px
    ),
    linear-gradient(90deg, rgba(13,148,136,0.7), rgba(13,148,136,0.4));
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
  /* 動畫：由 JS 設定 --target-width，transition 展開 */
  transition: width 1.2s var(--ease-out) 0.3s;
  flex-shrink: 0;
}

/* 刻度數字 */
.prediction-bar-ticks {
  position: relative;
  height: 16px;
  margin-top: 2px;
}

.prediction-tick {
  position: absolute;
  transform: translateX(-50%);
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.prediction-tick--current {
  color: var(--accent);
  top: 0;
}

.prediction-tick--predicted {
  color: var(--teal);
  top: 0;
}

/* ── 掃描元資訊列 ── */
.scan-meta-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: var(--sp-3);
}

.scan-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  /* 分隔線（用 :not(:last-child) 後加）*/
}

.scan-meta-item:not(:last-child)::after {
  content: '·';
  margin-left: var(--sp-4);
  color: var(--border-strong);
}

/* ── 指標子項目（dim-indicators 的新結構）── */
.dim-indicators li {
  /* 覆寫舊的 display: flex，確保新版 icon + text 排列 */
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
}

.indicator-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
  line-height: 1.5;
  /* 確保 emoji 寬度固定 */
  width: 1.1em;
  text-align: center;
}

.indicator-text {
  flex: 1;
  min-width: 0;
}

/* 顏色依 data-pass 屬性設定（覆蓋舊規則） */
.dim-indicators li[data-pass="true"]  { color: var(--green); }
.dim-indicators li[data-pass="false"] { color: var(--red);   }
.dim-indicators li[data-pass="neutral"] { color: var(--text-secondary); }

/* ── Quick Win 徽章 ── */
.top3-card[data-quickwin="true"] {
  position: relative;
  overflow: visible;
}

.quickwin-badge {
  position: absolute;
  top: -8px;
  right: var(--sp-3);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 10px;
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(234,88,12,0.35);
  /* 脈動動畫 */
  animation: quickwin-pulse 2s ease-in-out infinite;
}

@keyframes quickwin-pulse {
  0%, 100% { box-shadow: 0 2px 8px rgba(234,88,12,0.35); }
  50%       { box-shadow: 0 2px 16px rgba(234,88,12,0.55); }
}

/* 手機版 Quick Win 徽章微調 */
@media (max-width: 480px) {
  .quickwin-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
  }
  .prediction-bar-ticks { display: none; }
}

/* ─────────────────────────────────────────────
   10. 列印樣式
───────────────────────────────────────────── */
@media print {
  .navbar,
  .loading-overlay,
  .scan-box,
  .hero,
  .features,
  .footer,
  .rescan-wrap,
  .copy-all-btn,
  .copy-btn {
    display: none !important;
  }

  .scan-result {
    display: block !important;
    padding: 0;
    background: #fff;
  }

  .score-summary-card,
  .fix-codes-section,
  .dim-card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  .dim-body,
  .fix-body {
    display: block !important;
  }

  .fix-code {
    background: #f8f8f8;
    color: #333;
    border: 1px solid #ccc;
  }

  body {
    font-size: 12px;
    color: #000;
  }
}

/* ─────────────────────────────────────────────
   11. 動畫工具類別
───────────────────────────────────────────── */

/* 進度條動畫（JS 插入後觸發） */
.dim-bar {
  animation: barGrow 0.8s var(--ease-out) both;
}

@keyframes barGrow {
  from { width: 0 !important; }
}

/* 卡片滑入（延遲排隊） */
.dim-card {
  animation: cardFadeIn 0.3s var(--ease-out) both;
}

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

/* 為每張卡設定不同延遲（由 JS 設定 style="animation-delay: Xms"） */

/* ─────────────────────────────────────────────
   12. 響應式微調
───────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Hero 縮小間距 */
  .hero {
    padding-block: var(--sp-12) var(--sp-10);
  }

  /* 掃描按鈕縮小 */
  .scan-btn {
    padding: 9px 18px;
    font-size: 0.85rem;
  }

  /* 分數卡片在手機版垂直排列（已是 column，確保 gap 合適） */
  .score-summary-card {
    padding: var(--sp-6) var(--sp-5);
    gap: var(--sp-5);
  }

  .score-circle-wrap {
    width: 120px;
    height: 120px;
  }

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

  /* 維度列表移除左側 padding（手機版更緊湊） */
  .dim-body {
    padding-left: var(--sp-5);
  }

  /* 修復方案標題列垂直排列 */
  .fix-codes-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .copy-all-btn {
    width: 100%;
    justify-content: center;
  }

  /* 結果 URL 徽章隱藏 */
  .result-url-badge {
    display: none;
  }

  /* Section 標題縮小 */
  .result-heading {
    font-size: 1.3rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  /* 修復碼列表邊距縮減 */
  .fix-codes-list {
    padding: var(--sp-3) var(--sp-4) var(--sp-5);
  }

  /* dim-bar 隱藏在超小螢幕 */
  @media (max-width: 380px) {
    .dim-bar-wrap { display: none; }
  }
}

/* 平板優化 */
@media (min-width: 641px) and (max-width: 1023px) {
  .score-summary-card {
    flex-direction: row;
    align-items: flex-start;
  }
}

/* ═══════ 修復方案：方案一 / 方案二 區塊 ═══════ */

.fix-section {
  margin-top: var(--sp-4);
  padding-top: var(--sp-4);
  border-top: 1px dashed var(--border);
}

.fix-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.fix-section-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* AI 提示詞區塊特殊樣式 */
.fix-section--ai {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.03), rgba(20, 184, 166, 0.03));
  margin-left: calc(-1 * var(--sp-5));
  margin-right: calc(-1 * var(--sp-5));
  margin-bottom: calc(-1 * var(--sp-5));
  padding: var(--sp-5);
  border-top: 1px solid rgba(37, 99, 235, 0.1);
  border-radius: 0 0 var(--radius) var(--radius);
}

.fix-section--ai .fix-section-label {
  color: var(--accent);
}

.fix-prompt-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  line-height: 1.6;
}

/* AI 提示詞程式碼區塊 — 用藍色調而非深色 */
.fix-code--prompt {
  background: #1e293b;
  border-left: 3px solid var(--accent);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  line-height: 1.7;
  max-height: 200px;
  overflow-y: auto;
}

/* AI 複製按鈕 — 藍色調 */
.copy-btn--ai {
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: #fff;
  border: none;
}

.copy-btn--ai:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.copy-btn--ai.copied {
  background: var(--green);
}

/* ═══════ 一鍵複製掃描報告按鈕 ═══════ */

.report-actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-5);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

.report-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.report-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.report-btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--teal));
  color: #fff;
  border: none;
}

.report-btn--primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.report-btn.copied {
  background: var(--green) !important;
  color: #fff !important;
  border-color: var(--green) !important;
}

/* ═══════════════════════════════════════════════════════
   工具箱區塊（Toolbox Section）
   包含：生成檔案工具卡、一鍵代管卡
═══════════════════════════════════════════════════════ */

/* ── 工具箱容器 ── */
.toolbox-section {
  margin-top: var(--sp-8);
  padding-top: var(--sp-8);
  border-top: 2px solid var(--border);
  animation: fadeInUp 0.4s var(--ease-out) both;
}

.toolbox-heading {
  margin-bottom: var(--sp-6);
}

.toolbox-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--sp-2) 0;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.toolbox-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

/* ── 工具卡格線 ── */
.toolbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--sp-4);
}

@media (min-width: 1024px) {
  .toolbox-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── 工具卡基礎樣式 ── */
.tool-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* 代管卡：視覺強調（藍色邊框漸層）*/
.tool-card--hosting {
  border-color: var(--accent);
  background: linear-gradient(160deg, #f0f7ff 0%, var(--bg) 60%);
  position: relative;
  overflow: hidden;
}

.tool-card--hosting::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
}

/* ── 卡片標頭 ── */
.tool-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.tool-card-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tool-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

/* ── 狀態/分類 Badge ── */
.tool-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--accent {
  background: var(--accent-light);
  color: var(--accent);
}

.badge--teal {
  background: #ccfbf1;
  color: #0f766e;
}

.badge--green {
  background: var(--green-bg);
  color: var(--green);
}

.badge--success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.badge--gray {
  background: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── 卡片說明文字 ── */
.tool-card-desc {
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ── 程式碼預覽區 ── */
.tool-preview {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  max-height: 150px;
  overflow-y: auto;
  flex-shrink: 0;
}

.tool-preview pre {
  margin: 0;
  padding: var(--sp-3);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
}

/* 捲動條美化 */
.tool-preview::-webkit-scrollbar {
  width: 4px;
}
.tool-preview::-webkit-scrollbar-track {
  background: var(--bg-alt);
}
.tool-preview::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 2px;
}

/* ── 操作按鈕列 ── */
.tool-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: auto;
}

/* ── 工具按鈕基礎樣式 ── */
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  white-space: nowrap;
  line-height: 1.4;
}

.tool-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.tool-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 主要按鈕（藍色漸層）*/
.tool-btn--primary {
  background: var(--gradient-blue);
  color: #fff;
  border: none;
}

.tool-btn--primary:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: #fff;
  border: none;
}

/* 輪廓樣式（更新按鈕）*/
.tool-btn--outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.tool-btn--outline:hover:not(:disabled) {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* 大號按鈕（一鍵代管主 CTA）*/
.tool-btn--large {
  padding: var(--sp-3) var(--sp-6);
  font-size: 0.9rem;
  width: 100%;
  justify-content: center;
}

/* ── 益處清單 ── */
.hosting-benefits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.hosting-benefits li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: 0.825rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.benefit-check {
  color: var(--green);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── 已代管：URL 顯示區 ── */
.hosting-dynamic-area {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.hosting-url-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.hosting-url-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0;
}

.hosting-url-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  flex-wrap: wrap;
}

.hosting-url-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  word-break: break-all;
  flex: 1;
  min-width: 0;
}

/* 讓 URL 區的複製按鈕小一點 */
.hosting-url-row .tool-btn {
  padding: var(--sp-1) var(--sp-3);
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* ── 已代管：行動按鈕 ── */
.hosting-action-btn {
  align-self: flex-start;
}

/* ── 已代管：下一步提示卡 ── */
.hosting-next-step {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
}

.hosting-next-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #92400e;
  margin: 0 0 var(--sp-1) 0;
}

.hosting-next-desc {
  font-size: 0.78rem;
  color: #78350f;
  margin: 0;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════════════════════
   深色模式 — 完整 Design Token 覆寫
   透過 [data-theme="dark"] 手動切換 + 系統偏好自動偵測
   ═══════════════════════════════════════════════════════════ */

[data-theme="dark"] {
  --bg:            #0f172a;
  --bg-alt:        #1e293b;
  --bg-result:     #1a2332;
  --text:          #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;
  --accent:        #60a5fa;
  --accent-light:  rgba(96,165,250,0.15);
  --teal:          #2dd4bf;
  --green:         #4ade80;
  --green-bg:      rgba(74,222,128,0.1);
  --green-border:  rgba(74,222,128,0.3);
  --orange:        #fb923c;
  --orange-bg:     rgba(251,146,60,0.1);
  --orange-border: rgba(251,146,60,0.3);
  --red:           #f87171;
  --red-bg:        rgba(248,113,113,0.1);
  --red-border:    rgba(248,113,113,0.3);
  --border:        #334155;
  --border-strong: #475569;
  --shadow-sm:     0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:     0 4px 6px rgba(0,0,0,0.4);
  --shadow-lg:     0 10px 25px rgba(0,0,0,0.5);
  color-scheme: dark;
}

[data-theme="dark"] body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="dark"] .navbar {
  background: rgba(15,23,42,0.9);
  border-bottom-color: var(--border);
}

[data-theme="dark"] .navbar.scrolled {
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="dark"] .hero {
  background: radial-gradient(ellipse at 50% 0%, rgba(96,165,250,0.08) 0%, transparent 60%);
}

[data-theme="dark"] .scan-input {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text);
}

[data-theme="dark"] .stat-card {
  background: var(--bg-alt);
  border-color: var(--border);
}

[data-theme="dark"] .score-summary-card,
[data-theme="dark"] .dimensions-section,
[data-theme="dark"] .fix-codes-section,
[data-theme="dark"] .action-center {
  background: var(--bg-alt);
  border-color: var(--border);
}

[data-theme="dark"] .dim-card {
  background: var(--bg);
  border-color: var(--border);
}

[data-theme="dark"] .dim-card[data-status="pass"] {
  background: rgba(74,222,128,0.05);
}

[data-theme="dark"] .fix-code,
[data-theme="dark"] .fix-code--prompt {
  background: #0f172a;
  border-color: var(--border);
}

[data-theme="dark"] .feature-card {
  background: var(--bg-alt);
  border-color: var(--border);
}

[data-theme="dark"] .footer {
  background: #0a0f1a;
  border-top-color: var(--border);
}

[data-theme="dark"] .copy-btn,
[data-theme="dark"] .report-btn {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-secondary);
}

[data-theme="dark"] .tool-card {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .tool-preview {
  background: #0f172a;
  border-color: #334155;
}

[data-theme="dark"] .hosting-url-row {
  background: #0f172a;
  border-color: #334155;
}

/* 系統偏好自動偵測（用戶未手動選擇時） */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0f172a;
    --bg-alt:        #1e293b;
    --bg-result:     #1a2332;
    --text:          #f1f5f9;
    --text-secondary:#94a3b8;
    --text-muted:    #64748b;
    --accent:        #60a5fa;
    --accent-light:  rgba(96,165,250,0.15);
    --teal:          #2dd4bf;
    --green:         #4ade80;
    --green-bg:      rgba(74,222,128,0.1);
    --green-border:  rgba(74,222,128,0.3);
    --orange:        #fb923c;
    --orange-bg:     rgba(251,146,60,0.1);
    --orange-border: rgba(251,146,60,0.3);
    --red:           #f87171;
    --red-bg:        rgba(248,113,113,0.1);
    --red-border:    rgba(248,113,113,0.3);
    --border:        #334155;
    --border-strong: #475569;
    --shadow-sm:     0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:     0 4px 6px rgba(0,0,0,0.4);
    --shadow-lg:     0 10px 25px rgba(0,0,0,0.5);
    color-scheme: dark;
  }
}

/* ═══════ 暗色模式切換按鈕 ═══════ */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}
.theme-toggle:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
