/* =========================================
Design Tokens (6 Themes)
========================================= */
/* [1] Light (Default) */
:root {
--bg: #ffffff; --bg2: #f6f8fa; --bg3: #eef1f5;
--text: #1f2328; --text2: #59636e; --text3: #8b949e;
--border: #d0d7de; --brand: #0969da; --brand-hover: #0550ae; --brand-bg: #ddf4ff;
--code-bg: #f6f8fa; --code-text: #1f2328;
--shadow: 0 1px 3px rgba(0,0,0,0.05); --radius: 6px;
--font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
--font-mono: "JetBrains Mono", "Fira Code", monospace;
}

/* [2] Dark (System & Manual) */
@media (prefers-color-scheme: dark) {
:root {
--bg: #0d1117; --bg2: #161b22; --bg3: #21262d;
--text: #e6edf3; --text2: #8b949e; --text3: #6e7681;
--border: #30363d; --brand: #2f81f7; --brand-hover: #58a6ff; --brand-bg: #1c2b3f;
--code-bg: #161b22; --code-text: #e6edf3;
--shadow: 0 1px 3px rgba(0,0,0,0.3);
}
}
[data-theme="dark"] {
--bg: #0d1117; --bg2: #161b22; --bg3: #21262d;
--text: #e6edf3; --text2: #8b949e; --text3: #6e7681;
--border: #30363d; --brand: #2f81f7; --brand-hover: #58a6ff; --brand-bg: #1c2b3f;
--code-bg: #161b22; --code-text: #e6edf3; --shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-theme="light"] {
--bg: #ffffff; --bg2: #f6f8fa; --bg3: #eef1f5;
--text: #1f2328; --text2: #59636e; --text3: #8b949e;
--border: #d0d7de; --brand: #0969da; --brand-hover: #0550ae; --brand-bg: #ddf4ff;
--code-bg: #f6f8fa; --code-text: #1f2328; --shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* [3] Orbital (深空終端) */
[data-theme="orbital"] {
--bg: #030508; --bg2: #0a0f1a; --bg3: #111827;
--text: #e2e8f0; --text2: #94a3b8; --text3: #64748b;
--border: #1e293b; --brand: #38bdf8; --brand-hover: #7dd3fc; --brand-bg: rgba(56, 189, 248, 0.1);
--code-bg: #0f172a; --code-text: #38bdf8;
--shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5); --radius: 4px;
--font-main: 'Inter', sans-serif;
}
[data-theme="orbital"] body::before {
content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
background-image: linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
background-size: 40px 40px;
}

/* [4] Quantum (量子全息) */
[data-theme="quantum"] {
--bg: #090514; --bg2: rgba(255, 255, 255, 0.03); --bg3: rgba(255, 255, 255, 0.08);
--text: #f8fafc; --text2: #cbd5e1; --text3: #94a3b8;
--border: rgba(255, 255, 255, 0.08); --brand: #a855f7; --brand-hover: #c084fc; --brand-bg: rgba(168, 85, 247, 0.15);
--code-bg: rgba(0, 0, 0, 0.3); --code-text: #e879f9;
--shadow: 0 8px 32px rgba(168, 85, 247, 0.15); --radius: 16px;
}
[data-theme="quantum"] body::before {
content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
background: radial-gradient(circle at 10% 20%, rgba(168, 85, 247, 0.15), transparent 40%), radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.1), transparent 40%);
}
[data-theme="quantum"] .site-header, [data-theme="quantum"] .toc-nav, [data-theme="quantum"] .code-block, [data-theme="quantum"] .data-table, [data-theme="quantum"] .guide-card {
backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,0.1);
}

/* [5] Monolith (巨物檔案) */
[data-theme="monolith"] {
--bg: #121212; --bg2: #1a1a1a; --bg3: #242424;
--text: #ffffff; --text2: #a3a3a3; --text3: #737373;
--border: #333333; --brand: #ef4444; --brand-hover: #f87171; --brand-bg: rgba(239, 68, 68, 0.1);
--code-bg: #0a0a0a; --code-text: #facc15;
--shadow: none; --radius: 0px;
}
[data-theme="monolith"] h1, [data-theme="monolith"] h2 { text-transform: uppercase; letter-spacing: 0.05em; }

/* [6] Cyber (賽博科技) */
[data-theme="cyber"] {
--bg: #050811; --bg2: #0b1122; --bg3: #121b34;
--text: #c5d6e6; --text2: #708aa4; --text3: #42556a;
--border: #1a2f4c; --brand: #00f0ff; --brand-hover: #66f5ff; --brand-bg: rgba(0, 240, 255, 0.12);
--code-bg: #02050c; --code-text: #00f0ff;
--shadow: 0 0 15px rgba(0, 240, 255, 0.3); --radius: 2px;
--font-main: "JetBrains Mono", monospace;
}
[data-theme="cyber"] body::before {
content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
background-image: linear-gradient(rgba(0, 240, 255, 0.015) 1px, transparent 1px), linear-gradient(90deg, rgba(0, 240, 255, 0.015) 1px, transparent 1px);
background-size: 20px 20px;
}
[data-theme="cyber"] h1, [data-theme="cyber"] h2, [data-theme="cyber"] h3 { text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 2px dashed var(--border); }
[data-theme="cyber"] .code-block::before {
content: "SYSTEM LOG // TERMINAL"; display: block; background: var(--bg3); padding: 4px 16px; font-size: 10px; font-weight: 700; color: var(--text3); letter-spacing: 0.1em; border-bottom: 1px solid var(--border);
}

/* =========================================
2. Base & Typography
========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
font-family: var(--font-main); background: var(--bg); color: var(--text);
line-height: 1.6; font-size: 16px; -webkit-font-smoothing: antialiased;
transition: background 0.3s, color 0.3s; min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }
h1, h2, h3 { line-height: 1.3; margin-top: 2em; margin-bottom: 0.8em; font-weight: 600; }
h1 { font-size: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
h2 { font-size: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
h3 { font-size: 1.2rem; }
p { margin-bottom: 1em; }
ul, ol { margin-bottom: 1em; padding-left: 1.5em; }
code {
font-family: var(--font-mono); background: var(--code-bg); color: var(--code-text);
padding: 0.2em 0.4em; border-radius: var(--radius); font-size: 0.9em; border: 1px solid var(--border);
}

/* =========================================
3. Header & Theme Switcher
========================================= */
.site-header {
position: sticky; top: 0; z-index: 100; height: 60px; background: var(--bg2);
border-bottom: 1px solid var(--border); display: flex; align-items: center;
}
.header-inner {
width: 100%; max-width: 1400px; margin: 0 auto; padding: 0 24px;
display: flex; align-items: center; gap: 16px;
}
.toc-toggle { display: none; background: none; border: none; font-size: 24px; color: var(--text); cursor: pointer; }
.breadcrumb { font-size: 14px; color: var(--text2); flex: 1; }
.breadcrumb a { color: var(--text2); }
.bc-sep { margin: 0 8px; }
.theme-switcher { display: flex; gap: 6px; flex-wrap: wrap; }
.theme-btn {
background: transparent; border: 1px solid var(--border); color: var(--text3);
padding: 4px 8px; font-family: var(--font-mono); font-size: 11px;
cursor: pointer; border-radius: var(--radius); transition: all 0.2s; white-space: nowrap;
}
.theme-btn:hover { color: var(--text); border-color: var(--brand); }
.theme-btn.active { background: var(--brand); color: var(--bg); border-color: var(--brand); font-weight: bold; }

/* =========================================
4. Layout & TOC
========================================= */
.page-layout { display: grid; grid-template-columns: 260px 1fr; max-width: 1400px; margin: 0 auto; }
.toc-nav {
position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto; padding: 24px 16px;
border-right: 1px solid var(--border); background: var(--bg);
scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.toc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.toc-title { font-weight: 600; font-size: 14px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }
.toc-close { display: none; background: none; border: none; font-size: 20px; color: var(--text2); cursor: pointer; }
.toc-search-hint { font-size: 12px; color: var(--text3); margin-bottom: 16px; }
.toc-list { list-style: none; padding: 0; }
.toc-item {
display: block; padding: 8px 12px; margin: 2px 0; font-size: 14px; color: var(--text2);
border-radius: var(--radius); border-left: 2px solid transparent; transition: all 0.15s; text-decoration: none;
}
.toc-item:hover { color: var(--text); background: var(--bg2); text-decoration: none; }
.toc-item.active { color: var(--brand); background: var(--brand-bg); border-left-color: var(--brand); font-weight: 500; }
.toc-overlay { display: none; }
.main-content { padding: 32px 48px 64px; min-width: 0; max-width: 900px; }

/* =========================================
5. Components
========================================= */
.data-table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: 14px; border-radius: var(--radius); overflow: hidden; display: table; }
.data-table th, .data-table td { border: 1px solid var(--border); padding: 12px 14px; text-align: left; }
.data-table th { background: var(--bg2); font-weight: 600; }
.data-table tr:nth-child(even) { background: var(--bg2); }
.code-block {
position: relative; background: var(--code-bg); border: 1px solid var(--border);
border-radius: var(--radius); margin: 1.5em 0; overflow: hidden;
}
.code-block pre { padding: 16px; overflow-x: auto; margin: 0; font-size: 14px; line-height: 1.5; color: var(--code-text); }
.code-block code { background: none; padding: 0; border: none; color: inherit; }
.copy-btn {
position: absolute; top: 8px; right: 8px; background: var(--bg3); border: 1px solid var(--border);
border-radius: var(--radius); padding: 4px 10px; font-size: 12px; color: var(--text2); cursor: pointer; opacity: 0; transition: opacity 0.2s;
}
.code-block:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--brand-bg); color: var(--brand); }
.alert { padding: 12px 16px; border-radius: var(--radius); margin: 1.5em 0; border-left: 4px solid; font-size: 14px; background: var(--bg2); }
.alert-info { border-color: var(--brand); }
.alert-warning { border-color: #f59e0b; }
.alert-danger { border-color: #ef4444; }
.cross-link::after { content: " ↗"; font-size: 0.8em; vertical-align: super; }

/* =========================================
6. Footer
========================================= */
.page-footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 24px 48px; font-size: 14px; color: var(--text3); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.footer-nav { display: flex; gap: 24px; }
.btn-top, .btn-home { color: var(--text2); text-decoration: none; }
.btn-top:hover, .btn-home:hover { color: var(--brand); }

/* =========================================
7. Index Page (Cards) - 已將 hero-title 改為 800 粗體
========================================= */
.hero-section { padding: 4rem 3rem 3rem; max-width: 1200px; margin: 0 auto; text-align: center; }
.hero-tag { display: inline-block; margin-bottom: 1.5rem; font-family: var(--font-mono); font-size: 0.8rem; color: var(--brand); letter-spacing: 0.1em; }
.hero-title { 
  font-size: clamp(2.5rem, 6vw, 4.5rem); 
  line-height: 1.1; 
  margin-bottom: 1.5rem; 
  margin-top: 0; 
  font-weight: 800; /* 改為極粗體 */
  letter-spacing: -0.03em; /* 粗體大標題收緊字距，視覺更緊湊有力 */
  border: none; 
}
.hero-desc { font-size: 1.1rem; color: var(--text2); max-width: 700px; margin: 0 auto; }
.guide-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; padding: 2rem 3rem 6rem; max-width: 1200px; margin: 0 auto; }
.guide-card {
background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
padding: 2rem; display: flex; flex-direction: column; gap: 1rem; text-decoration: none; color: var(--text); transition: all 0.3s;
}
.guide-card:hover { border-color: var(--brand); transform: translateY(-4px); box-shadow: var(--shadow); text-decoration: none; }
.card-icon { font-size: 2rem; color: var(--brand); }
.card-title { font-size: 1.5rem; font-weight: 600; margin: 0; border: none; }
.card-desc { color: var(--text2); font-size: 0.95rem; flex: 1; margin: 0; }

/* =========================================
8. RWD & Mobile Drawer
========================================= */
/* =========================================
   7. RWD & Mobile Drawer (響應式與手機版抽屜)
========================================= */
@media (max-width: 960px) {
  /* --- 基礎佈局切換 --- */
  .page-layout { grid-template-columns: 1fr; }
  .toc-toggle { display: block; }
  
  /* --- TOC 抽選單動畫 --- */
  .toc-nav {
    position: fixed; top: 0; left: -280px; width: 280px; height: 100vh;
    z-index: 200; transition: left 0.3s ease; box-shadow: var(--shadow);
  }
  .toc-nav.open { left: 0; }
  .toc-close { display: block; }
  
  /* --- 遮罩層 --- */
  .toc-overlay { 
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); z-index: 150; 
  }
  .toc-overlay.open { display: block; }
  
  /* --- 內容區間距調整 --- */
  .main-content { padding: 24px 20px 64px; }
  .page-footer { padding: 24px 20px; }
  .hero-section, .guide-cards { padding-left: 1.5rem; padding-right: 1.5rem; }

  /* --- 👇 手機版 Header 專屬修復 (防止擠壓與點擊失效) --- */
  .header-inner {
    flex-wrap: wrap;       /* 允許換行 */
    gap: 8px;              /* 縮小間距 */
    padding: 8px 16px;     /* 縮小左右內距 */
  }
  
  /* TOC 按鈕定位在最左側 */
  .toc-toggle {
    order: -1;             /* 確保 ☰ 按鈕在第一順位 */
    margin-right: auto;    /* 把後面的元素推到右邊 */
  }

  /* 麵包屑佔滿第二行，並確保足夠大的點擊熱區 */
  .breadcrumb {
    flex: 1 1 100%;        /* 強制換行並佔滿寬度 */
    font-size: 13px;
    min-height: 32px;      
    display: flex;
    align-items: center;
    order: 1;              /* 放在 TOC 按鈕之後 */
  }
  
  .breadcrumb a {
    padding: 4px 8px 4px 0;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
  
  /* 主題切換器佔滿第三行，允許橫向滑動以容納多按鈕 */
  .theme-switcher {
    width: 100%;           
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;      /* 按鈕太多時可橫向滑動 */
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    order: 2;              /* 放在最後 */
  }
  
  /* 手機版主題按鈕縮小，防止變形 */
  .theme-btn {
    padding: 3px 6px;
    font-size: 9px;
    flex-shrink: 0;        /* 防止按鈕被壓縮變形 */
    white-space: nowrap;   /* 防止文字斷行 */
  }
  
  /* 確保選中的按鈕在手機版依然明顯 */
  .theme-btn.active {
    font-weight: bold;
    border-color: var(--brand);
  }
  /* 👆 手機版 Header 修復結束 */
}

/* --- 小螢幕手機版：表格卡片化 --- */
@media (max-width: 640px) {
  .data-table thead { display: none; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table tr { 
    border: 1px solid var(--border); 
    border-radius: var(--radius); 
    padding: 12px; 
    margin-bottom: 16px; 
    background: var(--bg2); 
  }
  .data-table td { 
    border: none; 
    padding: 6px 0; 
    text-align: left; 
    display: flex; 
    justify-content: space-between; 
    gap: 12px; 
  }
  .data-table td::before { 
    content: attr(data-label); 
    font-weight: 600; 
    color: var(--text2); 
    flex-shrink: 0; 
  }
}

/* =========================================
   Logo 與 Hero 專屬科技感樣式
   ========================================= */

/* 頂部 Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono); /* 使用等寬字體 */
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.logo-icon { 
  color: var(--brand); 
  font-size: 1.5rem; 
  text-shadow: 0 0 10px var(--brand-bg); /* 圖示發光 */
}
.logo-text {
  color: var(--text);
}

/* Hero 標籤 */
.hero-tag {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--brand);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Hero 大標題 (您之前喜歡的版本：調整過間距、粗體/大寫、發光) */
.hero-section { 
  padding: 2rem 3rem 3rem; /* 上方間距已收緊 */
  max-width: 1200px; 
  margin: 0 auto; 
  text-align: center; 
}

.hero-title {
  font-family: var(--font-main);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  line-height: 1.1;
  margin-bottom: 1.5rem;
  margin-top: 0; 
  font-weight: 800; /* 極粗體 (若想改回優雅細體，請改為 300) */
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: none;
  color: var(--brand);
  text-shadow: 0 0 20px var(--brand-bg); /* 文字霓虹發光 */
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text2);
  max-width: 700px;
  margin: 0 auto;
}