﻿/* ====================================
   🎨 YoFat's Blog - 簡潔主題
   黑紅色系 + 藍色輔色，保留原本排版
   ==================================== */

/* ====================================
   🎨 配色變數
   ==================================== */

:root {
  /* 🎭 字型系統 */
  --font-ui: 'Inter', 'Roboto', 'Noto Sans TC', sans-serif;
  --font-display: 'Inter', 'Roboto', 'Noto Sans TC', sans-serif;
  --font-mono: 'Fira Code', 'Roboto Mono', 'JetBrains Mono', monospace;
  
  /* 🎨 主要色彩 - 紅藍黑系 (黑暗模式) */
  --primary-red: #ff2b47;
  --primary-blue: #00d4ff;
  --primary-black: #0d0d0f;
  
  /* 🌈 延伸色彩 */
  --blood-red: var(--primary-red);
  --corrupt-blue: var(--primary-blue);
  --deep-black: var(--primary-black);
  --dark-red: #cc1f38;
  --dark-blue: #0099cc;
  --black-red: #1a0308;
  --charcoal: #1a1a1f;
  
  /* 🌫️ 背景色彩 - 黑暗基調 */
  --bg-primary: var(--primary-black);
  --bg-secondary: var(--charcoal);
  --bg-tertiary: #1a1a2e;
  
  /* 📝 文字色彩 - 對比清晰 */
  --text-primary: #ffffff;
  --text-secondary: #b8b8d1;
  --text-muted: #6b7280;
  
  /* 🎯 強調色彩 - 紅藍配色 */
  --accent-color: var(--primary-red);
  --secondary-accent: var(--primary-blue);
  --border-color: #2a2a3e;
  --border: var(--border-color);
  --border-hover: var(--primary-blue);
  
  /* ⏱️ 動畫時間 */
  --duration-fast: 0.2s;
  --duration-normal: 0.3s;
  --duration-slow: 0.5s;
  
  /* 📐 間距與圓角 */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-xxl: 3rem;
  --spacing-3xl: 4rem;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  
  /* 🖼️ 陰影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.5);
  
  /* ⚡ 動畫時長 */
  --duration-fast: 0.15s;
  --duration-normal: 0.3s;
  --duration-slow: 0.6s;
  
  /* 📏 Header 高度 */
  --header-height: 80px;
  
  /* 🌟 光暈與特效 */
  --glow-red: 0 0 20px rgba(255, 43, 71, 0.5);
  --glow-blue: 0 0 20px rgba(0, 212, 255, 0.5);
  --glow-gold: 0 0 20px rgba(255, 165, 0, 0.5);
  --tainted-gold: #ffa500;
  
  /* 🔗 原本風格的變數別名 */
  --bg: var(--bg-primary);
  --fg: var(--text-primary);
  --fg-secondary: var(--text-secondary);
  --muted: var(--text-muted);
  --pri: var(--blood-red);
  --pri-hover: #e0243e;
  --accent: var(--corrupt-blue);
  --accent-hover: #00bfe6;
  --card: var(--bg-tertiary);
  --card-hover: #1a1a1f;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
}

/* ====================================
   📱 全局樣式設定
   ==================================== */

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  font-size: 1rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) var(--bg-primary);
}

/* 頁面主滾動條樣式 */
body::-webkit-scrollbar {
  width: 12px;
}

body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

body::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, 
    var(--accent-color) 0%, 
    var(--tainted-gold) 50%, 
    var(--accent-color) 100%);
  border-radius: 6px;
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
}

body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, 
    var(--tainted-gold) 0%, 
    rgba(255, 215, 0, 1) 50%, 
    var(--tainted-gold) 100%);
  box-shadow: 
    0 0 15px rgba(255, 165, 0, 0.7),
    inset 0 0 5px rgba(255, 215, 0, 0.5);
  transform: scaleX(1.1);
}

/* ====================================
   📏 滾動進度條動畫
   ==================================== */

.scroll-progress-top,
.scroll-progress-bottom {
  position: fixed;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-red), var(--primary-blue));
  box-shadow: 0 0 10px rgba(255, 43, 71, 0.6);
  z-index: 1000;
  transition: all 0.3s ease;
}

.scroll-progress-top {
  top: 0;
  left: 0;
  width: 0%;
}

.scroll-progress-bottom {
  bottom: 0;
  left: 0;
  width: 0%;
  opacity: 0;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 10px rgba(255, 43, 71, 0.6);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 43, 71, 0.9), 0 0 30px rgba(0, 212, 255, 0.5);
  }
}

/* ====================================
   🏗️ 三欄式布局
   ==================================== */

/* 三欄式頁面的 body 樣式 */
body.three-column {
  margin: 0;
  padding: 0;
}

body.three-column .three-column-layout {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

.three-column-layout {
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  min-height: 100vh;
}

/* 新的有效三欄容器 */
.three-column-container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
}

.three-column-layout.with-border {
  border-top: 2px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

/* 左側邊欄 */
.three-column-layout .left-sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 0;
  z-index: 100;
  margin: 0;
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 120px;
  height: calc(100vh - 120px);
  overflow-y: hidden;
}

/* 新的簡化左側邊欄 - 直接選擇器 */
.three-column-container .left-sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  padding: 0;
  position: sticky;
  top: 100px;
  height: calc(100vh - 100px);
  overflow-y: hidden;
  z-index: 100;
}

/* 右側邊欄 */
.three-column-layout .right-sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  padding: 0;
  z-index: 100;
  margin: 0;
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 120px;
  height: calc(100vh - 120px);
  overflow-y: auto;
  display: block !important;
  visibility: visible !important;
}

/* 新的簡化右側邊欄 - 直接選擇器 */
.three-column-container .right-sidebar {
  width: 250px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  padding: 0;
  position: sticky;
  top: 100px;
  height: calc(100vh - 100px);
  overflow-y: hidden;
  z-index: 100;
  display: block !important;
  visibility: visible !important;
}

/* 新的主要內容區 */
.three-column-container .main-content {
  flex: 1;
  background: var(--bg-primary);
  padding: var(--spacing-xl);
  min-width: 0;
}

/* 主要內容區 */
.main-content {
  padding: var(--spacing-xl);
  min-width: 0;
  flex: 1;
  background: var(--bg-primary);
  overflow-x: hidden;
  margin: 0;
  position: relative;
}

/* 頁面標題區塊 */
.page-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-xl) 0;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

/* Make sure page header does not overlay navigation menus.
   Force a low stacking order for page header and ensure header/nav are above it. */
.page-header {
  z-index: 0 !important;
}

/* Ensure global header and nav menu are stacked above page header */
header .header-container,
.mobile-toggle {
  z-index: 11001 !important;
  position: relative !important;
}

.nav-menu,
.nav-menu.active,
body.nav-open .nav-menu {
  z-index: 11002 !important;
}

.page-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--corrupt-blue), var(--accent-color), var(--blood-red));
  animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.page-title {
  font-size: 2.5rem;
  font-weight: 900;
  margin: 0 0 var(--spacing-sm) 0;
  background: linear-gradient(45deg, var(--corrupt-blue), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.page-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
  opacity: 0.9;
}

/* ====================================
   🃏 卡片樣式
   ==================================== */

.nav-card,
.info-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-md);
  transition: all var(--duration-normal) ease;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--spacing-md);
}

.welcome-card {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 2px solid var(--accent-color);
  text-align: center;
}

.welcome-content {
  margin-top: var(--spacing-md);
}

.welcome-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-md);
  line-height: 1.4;
}

.welcome-description {
  margin-top: var(--spacing-sm);
}

.description-text {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  font-style: italic;
}

.welcome-stats {
  display: flex;
  justify-content: space-around;
  gap: var(--spacing-md);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(var(--accent-rgb), 0.05) 100%);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.stat-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.1), transparent);
  transition: left 0.5s ease;
}

.stat-item:hover::before {
  left: 100%;
}

.stat-item:hover {
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(var(--accent-rgb), 0.15);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(var(--accent-rgb), 0.08) 100%);
}

.stat-item:nth-child(1) {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(220, 38, 38, 0.08) 100%);
  border: 2px solid rgba(220, 38, 38, 0.2);
}

.stat-item:nth-child(1):hover {
  border-color: #dc2626;
  box-shadow: 0 8px 25px rgba(220, 38, 38, 0.2);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(220, 38, 38, 0.12) 100%);
}

.stat-item:nth-child(2) {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(37, 99, 235, 0.08) 100%);
  border: 2px solid rgba(37, 99, 235, 0.2);
}

.stat-item:nth-child(2):hover {
  border-color: #2563eb;
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.2);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(37, 99, 235, 0.12) 100%);
}

.stat-item:nth-child(3) {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(34, 197, 94, 0.08) 100%);
  border: 2px solid rgba(34, 197, 94, 0.2);
}

.stat-item:nth-child(3):hover {
  border-color: #22c55e;
  box-shadow: 0 8px 25px rgba(34, 197, 94, 0.2);
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(34, 197, 94, 0.12) 100%);
}

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-color);
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.stat-item:hover .stat-number {
  transform: scale(1.1);
  color: var(--accent-color);
}

.stat-item:nth-child(1) .stat-number {
  color: #dc2626;
}

.stat-item:nth-child(2) .stat-number {
  color: #2563eb;
}

.stat-item:nth-child(3) .stat-number {
  color: #22c55e;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.stat-item:hover .stat-label {
  color: var(--text-secondary);
  transform: translateY(-1px);
}

.nav-card:hover,
.info-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Security Researcher 特殊卡片樣式 - 金光邊框 */
.security-researcher-card {
  background: linear-gradient(135deg, 
    rgba(255, 43, 71, 0.1) 0%, 
    rgba(0, 212, 255, 0.08) 50%, 
    rgba(13, 13, 15, 0.1) 100%);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  background-clip: padding-box;
}

.security-researcher-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, 
    rgba(255, 165, 0, 0.8) 0%, 
    rgba(255, 215, 0, 0.9) 25%, 
    rgba(255, 140, 0, 0.7) 50%, 
    rgba(255, 215, 0, 0.9) 75%, 
    rgba(255, 165, 0, 0.8) 100%);
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 1;
  border-radius: var(--radius-lg);
  padding: 2px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: exclude;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: goldGlow 3s ease-in-out infinite;
}

.security-researcher-card:hover::before {
  opacity: 1;
  animation: goldPulse 1.5s ease-in-out infinite;
}

.security-researcher-card:hover {
  border-color: rgba(255, 165, 0, 0.6);
  box-shadow: 
    0 0 20px rgba(255, 165, 0, 0.5),
    0 0 40px rgba(255, 215, 0, 0.3),
    0 0 60px rgba(255, 140, 0, 0.2),
    inset 0 0 20px rgba(255, 215, 0, 0.1);
  transform: translateY(-4px);
}

.security-researcher-card .profile-section {
  position: relative;
  z-index: 2;
}

/* 主題切換卡片樣式 */
.theme-card {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
}

.sidebar-title,
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-md) 0;
  color: var(--text-primary);
}

/* ====================================
   🧭 導航樣式
   ==================================== */

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 0; /* 移除項目間距，讓大階層之間完全緊貼 */
  /* 移除高度限制和滾動 */
  padding-top: 20px; /* 在頂部添加留白 */
}

/* 舊的 .toc-link 定義已移除，避免與 HackMD 風格衝突 */

.toc-link:hover {
  background: rgba(255, 43, 71, 0.1);
  color: var(--blood-red);
  border-left-color: var(--blood-red);
}

/* 分類和標籤頁面的導航樣式優化 */
.categories-page .toc-link,
.tags-page .toc-link {
  padding: 4px 8px;
  font-size: 0.75rem;
  line-height: 1.2;
  margin-bottom: 1px;
}

.categories-page .sidebar-title,
.tags-page .sidebar-title {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.categories-page .category-icon,
.tags-page .tag-name {
  font-size: 0.7rem;
}

.categories-page .category-count,
.tags-page .tag-count {
  font-size: 0.65rem;
  padding: 1px 4px;
  min-width: auto;
}

.categories-page .nav-card,
.tags-page .nav-card {
  padding: 12px;
  margin-bottom: 8px;
}

.categories-page .toc-nav,
.tags-page .toc-nav {
  gap: 1px;
}

.tags-page .tags-filter {
  margin-bottom: 8px;
}

.tags-page .search-input {
  font-size: 0.75rem;
  padding: 4px 8px;
  height: auto;
}

/* Search page specific styles */
.search-page .search-tip,
.search-page .quick-search {
  font-size: 0.8rem;
}

.search-page .search-tip h3,
.search-page .quick-search h3 {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.search-page .sidebar-title {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.search-page .nav-card {
  padding: 6px 10px;
  margin-bottom: 6px;
}

.search-page .quick-search-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-page .quick-search-links .btn {
  font-size: 0.7rem;
  padding: 3px 8px;
}

/* Search input styling */
.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  left: 12px;
  z-index: 2;
  color: #666;
  pointer-events: none;
}

#search-input {
  width: 100%;
  padding: 12px 45px 12px 45px;
  border: 2px solid #e1e5e9;
  border-radius: 25px;
  font-size: 16px;
  background: white;
  transition: all 0.3s ease;
  outline: none;
}

#search-input:focus {
  border-color: var(--blood-red);
  box-shadow: 0 0 0 3px rgba(255, 43, 71, 0.1);
}

.search-clear {
  position: absolute;
  right: 12px;
  cursor: pointer;
  color: #999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 4px;
  border-radius: 50%;
}

.search-clear:hover {
  color: var(--blood-red);
  background: rgba(255, 43, 71, 0.1);
}

.search-clear.show {
  opacity: 1;
}

/* Quick search suggestion tags */
.suggestion-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.suggestion-tag {
  display: inline-block;
  padding: 4px 10px;
  background: linear-gradient(135deg, #2c3e50, #34495e);
  border: 1px solid #34495e;
  border-radius: 15px;
  font-size: 0.75rem;
  color: #ecf0f1;
  cursor: pointer;
  transition: all 0.3s ease;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.suggestion-tag:hover {
  background: linear-gradient(135deg, var(--blood-red), #d63384);
  color: white;
  border-color: var(--blood-red);
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(255, 43, 71, 0.3);
}

.search-page .tips-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
}

.search-page .tips-list li {
  padding: 2px 0;
  font-size: 0.75rem;
  color: #666;
  position: relative;
  padding-left: 12px;
}

.search-page .tips-list li:before {
  content: "💡";
  position: absolute;
  left: 0;
  font-size: 0.7rem;
}

.toc-link.active {
  background: rgba(255, 43, 71, 0.15);
  color: var(--blood-red);
  border-left-color: var(--blood-red);
  box-shadow: 0 0 10px rgba(255, 43, 71, 0.3);
}

/* 文章檢視切換樣式 */
.posts-view {
  display: none;
}

.posts-view.active {
  display: block;
}

/* 分類檢視樣式 */
.categories-section {
  display: grid;
  gap: var(--spacing-xl);
}

.category-group {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  transition: all 0.3s ease;
}

.category-group:hover {
  border-color: var(--accent-color);
  box-shadow: 0 4px 20px rgba(var(--accent-rgb), 0.1);
}

.category-title {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--border);
}

.category-icon {
  font-size: 1.5rem;
}

.category-count {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: normal;
}

.category-posts {
  display: grid;
  gap: var(--spacing-sm);
}

.category-post-item {
  padding: var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.category-post-item:hover {
  background: var(--bg-secondary);
}

.category-post-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.category-post-link:hover {
  color: var(--accent-color);
}

.category-post-title {
  flex: 1;
  font-weight: 500;
}

.category-post-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: var(--spacing-md);
}

/* 時間軸檢視樣式 */
.timeline {
  position: relative;
  padding-left: var(--spacing-xl);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-color), var(--secondary-accent));
}

.timeline-year {
  margin-bottom: var(--spacing-xl);
  position: relative;
}

.timeline-year::before {
  content: '';
  position: absolute;
  left: -30px;
  top: 10px;
  width: 20px;
  height: 20px;
  background: var(--accent-color);
  border-radius: 50%;
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.3);
}

.year-title {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: var(--spacing-lg);
  font-weight: 600;
}

.timeline-posts {
  display: grid;
  gap: var(--spacing-md);
}

.timeline-item {
  position: relative;
  padding: var(--spacing-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

.timeline-item:hover {
  border-color: var(--accent-color);
  transform: translateX(5px);
  box-shadow: 0 4px 15px rgba(var(--accent-rgb), 0.1);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -25px;
  top: 20px;
  width: 15px;
  height: 2px;
  background: var(--accent-color);
}

.timeline-date {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: var(--spacing-xs);
}

.timeline-title {
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.2s ease;
}

.timeline-title:hover {
  color: var(--accent-color);
}

.timeline-category {
  display: inline-block;
  background: var(--accent-color);
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  margin-left: var(--spacing-sm);
}

.site-nav {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

/* ====================================
   👤 個人資訊區域
   ==================================== */

.profile-section {
  text-align: center;
  padding: var(--spacing-md) 0;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin-bottom: var(--spacing-md);
  border: 3px solid var(--border);
  transition: all var(--duration-normal) ease;
  object-fit: cover;
}

/* 光明模式下的邊線 */
html.light .profile-avatar {
  border: 3px solid var(--border);
  box-shadow: 
    0 2px 8px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.1);
}

html.light .profile-avatar:hover {
  border-color: var(--corrupt-blue);
  box-shadow: 
    0 0 20px rgba(0, 212, 255, 0.4),
    0 0 0 2px var(--corrupt-blue),
    0 4px 12px rgba(0, 0, 0, 0.2);
  transform: scale(1.05);
}

.profile-avatar:hover {
  transform: scale(1.05);
}

/* 黑暗模式下的懸停效果 */
html:not(.light) .profile-avatar:hover {
  border-color: var(--accent-color);
  box-shadow: 0 0 15px rgba(255, 43, 71, 0.3);
}

.profile-name {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-xs) 0;
  color: var(--text-primary);
}

.profile-title {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ====================================
   🧭 右邊欄組件樣式
   ==================================== */

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-md) 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.quick-nav {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--duration-fast) ease;
  font-size: 0.9rem;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  transform: translateX(2px);
}

.recent-posts {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.recent-post {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: var(--spacing-sm);
}

.recent-post:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.recent-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--spacing-xs);
}

.recent-title {
  font-size: 0.85rem;
  font-weight: 500;
  margin: 0;
  color: var(--text-primary);
  line-height: 1.3;
  flex: 1;
}

.recent-title:hover {
  color: var(--accent-color);
}

.recent-date {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.tag-cloud-mini {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.tag-mini {
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-hover);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--duration-fast) ease;
  border: 1px solid transparent;
}

.tag-mini:hover {
  background: var(--accent-color);
  color: var(--text-on-accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 43, 71, 0.3);
}

/* ====================================
   📊 精簡統計樣式
   ==================================== */

.stats-compact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.stat-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) ease;
}

.stat-row:hover {
  background: rgba(255, 43, 71, 0.05);
}

.stat-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.stat-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ====================================
   🔗 精簡鏈接樣式
   ==================================== */

.quick-links-compact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.quick-link-compact {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) ease;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}

.quick-link-compact:hover {
  background: rgba(0, 212, 255, 0.1);
  color: var(--corrupt-blue);
  border-left-color: var(--corrupt-blue);
}

.btn-compact {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 0.9rem;
}

/* ====================================
   🌞 主題切換按鈕
   ==================================== */

.theme-toggle-section {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  padding: var(--spacing-md) 0;
}

.theme-toggle-btn {
  background: var(--bg-secondary);
  border: 2px solid var(--border);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all var(--duration-normal) ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background: var(--accent-color);
  border-color: var(--accent-color);
  transform: scale(1.1) rotate(10deg);
  box-shadow: 0 4px 15px rgba(255, 43, 71, 0.3);
}

.theme-toggle-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

/* ====================================
   🌞 Light Theme 亮色主題
   ==================================== */

html.light {
  /* 🎨 光明模式 - 紅藍白配色 */
  --primary-red: #dc2626;
  --primary-blue: #2563eb;
  --primary-white: #ffffff;
  
  /* 🌫️ 背景色彩 - 白色基調 */
  --bg-primary: var(--primary-white);
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  
  /* 📝 文字色彩 - 深色文字 */
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;
  
  /* 🎯 強調色彩 - 紅藍配色 */
  --accent-color: var(--primary-red);
  --secondary-accent: var(--primary-blue);
  --border: #e2e8f0;
  --border-hover: var(--primary-blue);
  --border-color: #e2e8f0;
  
  /* 🖼️ 陰影 - 較輕的陰影 */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  
  /* 🔄 覆蓋黑色變數為合適的光明模式顏色 */
  --deep-black: var(--text-primary);
  --primary-black: var(--text-primary);
  --black-red: var(--primary-red);
  --charcoal: var(--bg-secondary);
}

/* 白色主題的 Hero 區域 - 純淨紅藍白配色 */
html.light .hero-section {
  background: linear-gradient(135deg, 
    #ffffff 0%, 
    #ffffff 30%, 
    rgba(220, 38, 38, 0.05) 60%, 
    rgba(37, 99, 235, 0.08) 85%, 
    #ffffff 100%);
}

/* 光明模式下的 Hero 文字顏色 */
html.light .hero-title {
  color: var(--text-primary);
  text-shadow: none;
}

html.light .hero-subtitle {
  color: var(--text-secondary);
  text-shadow: none;
}

html.light .hero-description {
  color: var(--text-secondary);
  text-shadow: none;
  font-weight: 500;
}

/* 光明模式下的 Hero 背景圖案 */
html.light .hero-bg-pattern {
  background: 
    radial-gradient(circle at 20% 30%, rgba(220, 38, 38, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(255, 255, 255, 0.8) 0%, transparent 40%);
}

/* 光明模式下的右邊欄金光效果 */
html.light .security-researcher-card {
  background: linear-gradient(135deg, 
    rgba(220, 38, 38, 0.05) 0%, 
    rgba(37, 99, 235, 0.04) 50%, 
    rgba(255, 255, 255, 0.1) 100%);
  border: 2px solid transparent;
}

html.light .security-researcher-card::before {
  background: linear-gradient(45deg, 
    rgba(255, 165, 0, 0.9) 0%, 
    rgba(255, 215, 0, 1) 25%, 
    rgba(255, 140, 0, 0.8) 50%, 
    rgba(255, 215, 0, 1) 75%, 
    rgba(255, 165, 0, 0.9) 100%);
}

html.light .security-researcher-card:hover {
  border-color: rgba(255, 165, 0, 0.8);
  box-shadow: 
    0 0 20px rgba(255, 165, 0, 0.6),
    0 0 40px rgba(255, 215, 0, 0.4),
    0 0 60px rgba(255, 140, 0, 0.3),
    inset 0 0 20px rgba(255, 215, 0, 0.15);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) ease;
}

.nav-link:hover {
  background: rgba(0, 212, 255, 0.1);
  color: var(--corrupt-blue);
}

.nav-icon {
  font-size: 1.1rem;
}

.nav-text {
  font-size: 0.9rem;
}

/* ====================================
   🦸 Hero 區域
   ==================================== */

.hero-section {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
  background: linear-gradient(135deg, 
    #0d0d0f 0%, 
    #1a0308 20%, 
    #0f1419 40%, 
    #1e293b 60%, 
    #334155 80%, 
    #475569 100%);
  overflow: hidden;
  width: 100%;
}

.hero-section.full-width {
  margin: 0;
  border-radius: 0;
}

.hero-bg-pattern {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 30%, rgba(255, 43, 71, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(13, 13, 15, 0.8) 0%, transparent 40%);
  z-index: 1;
}

.hero-container {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1400px;
  padding: var(--spacing-xxl);
  margin: 0 auto;
}

.hero-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--spacing-3xl);
  align-items: center;
}

.hero-text {
  text-align: left;
}

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 300px;
  height: 300px;
}

.hero-avatar {
  position: relative;
  z-index: 2;
}

.hero-profile-img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid var(--accent-color);
  box-shadow: 0 10px 30px rgba(255, 43, 71, 0.3);
  transition: all 0.3s ease;
}

.hero-profile-img:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 40px rgba(255, 43, 71, 0.4);
}

.floating-item {
  position: absolute;
  font-size: 2rem;
  animation: float 3s ease-in-out infinite;
  opacity: 0.7;
}

.floating-item:nth-child(1) {
  top: 20%;
  left: -20%;
  animation-delay: 0s;
}

.floating-item:nth-child(2) {
  bottom: 30%;
  right: -30%;
  animation-delay: 1s;
}

.floating-item:nth-child(3) {
  top: 60%;
  left: -10%;
  animation-delay: 2s;
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.hero-bottom-border {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-color), var(--corrupt-blue), var(--accent-color));
  box-shadow: 0 2px 10px rgba(255, 43, 71, 0.3);
}

.hero-title {
  font-size: 4.5rem;
  font-weight: 700;
  margin: 0 0 var(--spacing-lg) 0;
  line-height: 1.1;
  color: var(--text-primary);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(30px);
}

.hero-title .name-whole {
  white-space: nowrap;
  word-break: keep-all;
  font-weight: 700;
}

.hero-subtitle {
  font-size: 1.4rem;
  color: var(--text-secondary);
  margin: 0;
  font-weight: 500;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 600px;
}

.hero-greeting {
  display: block;
  font-size: 1.3rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: var(--spacing-sm);
}

.hero-name {
  display: block;
  background: linear-gradient(45deg, var(--blood-red), var(--corrupt-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: hero-glow 3s ease-in-out infinite alternate;
}

@keyframes hero-glow {
  from {
    filter: drop-shadow(0 0 10px rgba(255, 43, 71, 0.3));
  }
  to {
    filter: drop-shadow(0 0 20px rgba(255, 43, 71, 0.5));
  }
}

.hero-subtitle {
  font-size: 1.3rem;
  color: var(--corrupt-blue);
  margin: 0 0 var(--spacing-lg) 0;
  font-weight: 500;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0 0 var(--spacing-xl) 0;
  line-height: 1.6;
}

.hero-buttons {
  display: flex;
  gap: var(--spacing-lg);
}

.hero-avatar {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--blood-red);
  box-shadow: 0 0 30px rgba(255, 43, 71, 0.4);
  transition: all var(--duration-normal) ease;
  position: relative;
  z-index: 2;
}

.hero-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 0 40px rgba(255, 43, 71, 0.6);
}

.hero-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.floating-elements {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  top: 0;
  left: 0;
}

.floating-item {
  position: absolute;
  font-size: 2rem;
  opacity: 0.6;
  animation: float 6s ease-in-out infinite;
}

.floating-item:nth-child(1) {
  top: 10%;
  left: -20%;
  animation-delay: 0s;
}

.floating-item:nth-child(2) {
  top: 70%;
  right: -20%;
  animation-delay: 2s;
}

.floating-item:nth-child(3) {
  bottom: 10%;
  left: 20%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) translateX(0px) rotate(0deg);
    opacity: 0.6;
  }
  25% {
    transform: translateY(-15px) translateX(5px) rotate(5deg);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-20px) translateX(0px) rotate(0deg);
    opacity: 0.9;
  }
  75% {
    transform: translateY(-15px) translateX(-5px) rotate(-5deg);
    opacity: 0.8;
  }
}

/* ====================================
   🔘 按鈕樣式
   ==================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-lg);
  border: none;
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--duration-fast) ease;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn-primary {
  background: var(--blood-red);
  color: white;
}

.btn-primary:hover {
  background: var(--dark-red);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(255, 43, 71, 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.btn-accent {
  background: var(--secondary-accent);
  color: var(--bg-primary);
}

.btn-accent:hover {
  background: var(--dark-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 212, 255, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: rgba(255, 43, 71, 0.1);
  border-color: var(--blood-red);
  color: var(--blood-red);
}

/* ====================================
   📄 內容區域樣式
   ==================================== */

.content-section {
  margin-bottom: var(--spacing-3xl);
  padding: var(--spacing-xl) 0;
}

.content-section:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: var(--spacing-3xl);
}

.content-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: var(--spacing-xxl) 0;
}

/* 最新文章區域特殊樣式 */
#latest-posts {
  position: relative;
  overflow: hidden;
}

#latest-posts::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: 
    radial-gradient(circle at 20% 20%, rgba(255, 43, 71, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0, 212, 255, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 40% 60%, rgba(255, 43, 71, 0.02) 0%, transparent 30%);
  animation: backgroundFloat 20s ease-in-out infinite;
  z-index: -1;
}

/* 背景浮動動畫 */
@keyframes backgroundFloat {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(-2%, -1%) rotate(1deg);
  }
  50% {
    transform: translate(1%, -2%) rotate(-0.5deg);
  }
  75% {
    transform: translate(-1%, 1%) rotate(0.5deg);
  }
}

.section-header {
  text-align: center;
  margin-bottom: var(--spacing-xl);
  position: relative;
  padding: var(--spacing-lg) 0;
}

.section-title {
  font-size: 2.2rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-md) 0;
  color: var(--text-primary);
  text-shadow: 0 0 5px rgba(255, 43, 71, 0.3);
  position: relative;
  display: inline-block;
  animation: titlePulse 3s ease-in-out infinite;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 3px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    var(--primary-red) 20%, 
    var(--primary-blue) 80%, 
    transparent 100%);
  border-radius: 2px;
  animation: underlineGlow 2s ease-in-out infinite alternate;
}

.section-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1s ease-out 0.5s forwards;
  position: relative;
}

.section-description::before {
  content: '✨';
  margin-right: 0.5rem;
  animation: sparkle 2s ease-in-out infinite;
}

/* 標題脈動動畫 */
@keyframes titlePulse {
  0%, 100% { 
    transform: scale(1);
    filter: brightness(1);
  }
  50% { 
    transform: scale(1.02);
    filter: brightness(1.1);
  }
}

/* 火焰閃爍動畫 */
@keyframes flameFlicker {
  0% { 
    transform: rotate(-2deg) scale(1);
    filter: hue-rotate(0deg) brightness(1);
  }
  25% {
    transform: rotate(1deg) scale(1.05);
    filter: hue-rotate(10deg) brightness(1.1);
  }
  50% {
    transform: rotate(-1deg) scale(1.02);
    filter: hue-rotate(-5deg) brightness(1.05);
  }
  75% {
    transform: rotate(2deg) scale(1.03);
    filter: hue-rotate(8deg) brightness(1.08);
  }
  100% { 
    transform: rotate(-2deg) scale(1);
    filter: hue-rotate(0deg) brightness(1);
  }
}

/* 底線發光動畫 */
@keyframes underlineGlow {
  0% {
    box-shadow: 0 0 5px rgba(255, 43, 71, 0.5);
    opacity: 0.7;
  }
  100% {
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.8);
    opacity: 1;
  }
}

/* 文字淡入向上動畫 */
@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 星星閃爍動畫 */
@keyframes sparkle {
  0%, 100% {
    transform: scale(1) rotate(0deg);
    opacity: 0.7;
  }
  25% {
    transform: scale(1.2) rotate(90deg);
    opacity: 1;
  }
  50% {
    transform: scale(0.8) rotate(180deg);
    opacity: 0.8;
  }
  75% {
    transform: scale(1.1) rotate(270deg);
    opacity: 1;
  }
}

.section-footer {
  text-align: center;
  margin-top: var(--spacing-xl);
}

/* ====================================
   📰 文章卡片
   ==================================== */

.articles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg); /* 減少文章間距 */
  margin-bottom: var(--spacing-xl);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.article-card {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  padding: 0;
  transition: all 0.4s ease;
  overflow: hidden;
  position: relative;
  
  /* 統一高度和布局 */
  display: flex;
  flex-direction: column;
  min-height: 180px;
  
  /* 進入動畫 */
  opacity: 0;
  transform: translateY(30px) scale(0.95);
  animation: cardSlideIn 0.8s ease-out forwards;
}

.article-card:nth-child(1) { animation-delay: 0.1s; }
.article-card:nth-child(2) { animation-delay: 0.2s; }
.article-card:nth-child(3) { animation-delay: 0.3s; }
.article-card:nth-child(4) { animation-delay: 0.4s; }
.article-card:nth-child(5) { animation-delay: 0.5s; }
.article-card:nth-child(6) { animation-delay: 0.6s; }

/* 文章卡片進入動畫 */
@keyframes cardSlideIn {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 金光邊框動畫 */
@keyframes goldGlow {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(1.02);
  }
}

@keyframes goldPulse {
  0%, 100% {
    opacity: 0.8;
    filter: brightness(1);
  }
  50% {
    opacity: 1;
    filter: brightness(1.2);
  }
}

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent-color), var(--corrupt-blue));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.article-card:hover::before {
  opacity: 0.1;
}

.article-card:hover {
  border-color: var(--accent-color);
  box-shadow: 
    0 10px 30px rgba(255, 43, 71, 0.2),
    0 0 0 1px rgba(255, 43, 71, 0.1);
  transform: translateY(-6px);
}

.article-content {
  position: relative;
  z-index: 2;
  padding: var(--spacing-xl);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.article-header {
  margin-bottom: var(--spacing-sm);
}

.article-title {
  margin: 0 0 var(--spacing-sm) 0;
  font-size: 1.7rem;
  line-height: 1.3;
}

.article-title a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 700;
  transition: all 0.3s ease;
  background: linear-gradient(45deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.article-title a:hover {
  background: linear-gradient(45deg, var(--accent-color), var(--corrupt-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.article-title a:hover {
  color: var(--blood-red);
}

.article-meta {
  display: flex;
  gap: var(--spacing-md);
  font-size: 1rem;
  color: var(--text-muted);
}

.article-category {
  background: rgba(0, 212, 255, 0.2);
  color: var(--corrupt-blue);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.article-excerpt {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.article-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.article-tags {
  display: flex;
  gap: var(--spacing-xs);
  flex-wrap: wrap;
}

.article-tag {
  background: rgba(255, 165, 0, 0.2);
  color: var(--tainted-gold);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
}

.article-action {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
}

.article-excerpt {
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* ====================================
   📂 分類與標籤頁面樣式
   ==================================== */

/* 頁面標題 */
.page-header {
  margin-bottom: var(--spacing-xxl);
  text-align: center;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 var(--spacing-md) 0;
  background: linear-gradient(135deg, var(--accent-color), var(--secondary-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
}

/* 分類區域 */
.category-section {
  margin-bottom: var(--spacing-3xl);
  scroll-margin-top: 120px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--spacing-xl);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.category-section:hover {
  border-color: var(--corrupt-blue);
  box-shadow: 0 6px 30px rgba(0, 212, 255, 0.2);
  transform: translateY(-2px);
}

.category-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--corrupt-blue), var(--accent-color));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-section:hover::before {
  opacity: 1;
}

.category-header {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--border);
  position: relative;
}

.category-title {
  font-size: 2.2rem;
  font-weight: 700;
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  background: linear-gradient(45deg, var(--text-primary), var(--corrupt-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.category-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin: 0 0 var(--spacing-md) 0;
  line-height: 1.6;
  opacity: 0.9;
}

.category-stats {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
}

.posts-count {
  font-size: 0.9rem;
  background: linear-gradient(45deg, var(--corrupt-blue), var(--accent-color));
  color: white;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-full);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* 標籤區域 */
.tag-section {
  margin-bottom: var(--spacing-3xl);
  scroll-margin-top: 100px;
}

.tag-header {
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 2px solid var(--border-color);
}

.tag-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--secondary-accent);
  font-family: var(--font-mono);
}

.tag-description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0;
}

/* 標籤雲 */
.tags-cloud-section {
  margin-bottom: var(--spacing-xxl);
  padding: var(--spacing-xl);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--text-primary);
}

.section-description {
  font-size: 1rem;
  color: var(--text-secondary);
  margin: 0 0 var(--spacing-xl) 0;
}

.tags-cloud-container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  justify-content: center;
}

.tag-cloud-item {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-secondary);
  transition: all var(--duration-normal) ease;
  position: relative;
  overflow: hidden;
}

.tag-cloud-item:hover {
  color: var(--text-primary);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tag-text {
  font-weight: 500;
}

.tag-badge {
  background: var(--accent-color);
  color: white;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
}

/* 標籤雲尺寸 */
.tag-xs { font-size: 0.8rem; }
.tag-sm { font-size: 0.9rem; }
.tag-md { font-size: 1rem; }
.tag-lg { font-size: 1.1rem; font-weight: 600; }
.tag-xl { font-size: 1.2rem; font-weight: 700; }

/* 搜尋輸入框 */
.search-input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.9rem;
  margin-bottom: var(--spacing-md);
  transition: all var(--duration-normal) ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(255, 43, 71, 0.1);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* 顯示更多按鈕 */
.show-more-section {
  text-align: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--border-color);
}

.show-more-btn {
  padding: var(--spacing-md) var(--spacing-xl);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) ease;
  cursor: pointer;
}

.show-more-btn:hover {
  background: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
  transform: translateY(-2px);
}

/* 統計網格 */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm);
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.stat-value {
  font-weight: 600;
  color: var(--accent-color);
  font-size: 0.9rem;
}

/* 熱門標籤 */
.popular-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.popular-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  transition: all var(--duration-normal) ease;
}

.popular-tag:hover {
  color: var(--text-primary);
  border-color: var(--secondary-accent);
  background: rgba(37, 99, 235, 0.1);
}

.popular-tag .tag-count {
  background: var(--secondary-accent);
  color: white;
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 0.7rem;
}

/* 快速導航 */
.quick-nav {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.quick-nav .nav-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--duration-normal) ease;
}

.quick-nav .nav-link:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  transform: translateX(4px);
}

/* ====================================
   📂 分類卡片
   ==================================== */

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.category-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  transition: all var(--duration-normal) ease;
}

.category-card:hover {
  border-color: var(--corrupt-blue);
  box-shadow: 0 8px 25px rgba(0, 212, 255, 0.2);
  transform: translateY(-4px);
}

.category-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
}

.category-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-sm) 0;
  color: var(--text-primary);
}

.category-count {
  color: var(--text-muted);
  margin: 0 0 var(--spacing-md) 0;
}

.category-topics {
  display: flex;
  gap: var(--spacing-xs);
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
}

.category-topic {
  background: rgba(255, 43, 71, 0.2);
  color: var(--blood-red);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

/* ====================================
   ℹ️ 右側邊欄內容
   ==================================== */

/* 舊的 .sidebar-content 定義已移除，避免與 HackMD 風格衝突 */

.stats-compact {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.stat-item {
  text-align: center;
  padding: var(--spacing-md);
  background: rgba(255, 43, 71, 0.1);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 43, 71, 0.2);
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--blood-red);
  margin-bottom: var(--spacing-xs);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.quick-link {
  display: block;
  padding: var(--spacing-sm) var(--spacing-md);
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--duration-fast) ease;
  border: 1px solid transparent;
}

.quick-link:hover {
  background: rgba(0, 212, 255, 0.1);
  color: var(--corrupt-blue);
  border-color: var(--corrupt-blue);
  transform: translateX(5px);
}

.github-section {
  text-align: center;
}

/* ====================================
   💫 光暈效果
   ==================================== */

.glow-effect {
  text-shadow: 0 0 5px rgba(255, 43, 71, 0.4);
  animation: subtle-glow 4s ease-in-out infinite alternate;
}

@keyframes subtle-glow {
  from {
    text-shadow: 0 0 5px rgba(255, 43, 71, 0.4);
  }
  to {
    text-shadow: 0 0 8px rgba(255, 43, 71, 0.6);
  }
}

.highlight-text {
  color: var(--blood-red);
  text-shadow: 0 0 10px rgba(255, 43, 71, 0.5);
}

/* ====================================
   🎯 關於我區域
   ==================================== */

.about-content {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
}

.about-text {
  margin-bottom: var(--spacing-xl);
}

.about-text p {
  margin: 0 0 var(--spacing-md) 0;
  font-size: 1.1rem;
  line-height: 1.7;
}

.skills-showcase {
  text-align: center;
}

.skills-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 var(--spacing-lg) 0;
  color: var(--corrupt-blue);
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

.skills-grid {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  flex-wrap: wrap;
}

.skill-tag {
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: var(--radius-lg);
  font-weight: 500;
  transition: all var(--duration-normal) ease;
}

.skill-tag.python {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.skill-tag.js {
  background: rgba(241, 196, 15, 0.2);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.3);
}

.skill-tag.security {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.skill-tag.ai {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
  border: 1px solid rgba(155, 89, 182, 0.3);
}

.skill-tag.web {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.skill-tag.crypto {
  background: rgba(230, 126, 34, 0.2);
  color: #e67e22;
  border: 1px solid rgba(230, 126, 34, 0.3);
}

.skill-tag:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ====================================
   📱 響應式設計
   ==================================== */

/* 桌面大螢幕 */
@media (min-width: 1201px) {
  .three-column-layout {
    display: grid !important;
    grid-template-columns: 260px 1fr 260px !important;
    gap: 0;
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
  }
}

/* 一般桌面螢幕 */
@media (min-width: 769px) and (max-width: 1200px) {
  .three-column-layout {
    display: grid !important;
    grid-template-columns: 200px 1fr 200px !important;
    gap: 0;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 767px) {
  .three-column-layout {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    width: 100%;
    max-width: 100%;
    padding: var(--spacing-md);
  }
  
  .three-column-layout .left-sidebar {
    order: 2;
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    background: var(--bg-tertiary);
    position: static;
    height: auto;
    overflow-y: visible;
  }
  
  .three-column-layout .right-sidebar {
    order: 3;
    padding: var(--spacing-md);
    border: none;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    background: var(--bg-tertiary);
    position: static;
    height: auto;
    overflow-y: visible;
    display: block !important;
    visibility: visible !important;
  }
  
  .main-content {
    order: 1;
    padding: var(--spacing-lg);
  }
  
  .posts-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .category-section {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
  }
  
  .category-title {
    font-size: 1.8rem;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  /* 保持 Hero 區域的左右排列 */
  .hero-content {
    grid-template-columns: 1fr auto;
    gap: var(--spacing-lg);
    align-items: center;
  }
  
  .hero-profile-img {
    width: 120px;
    height: 120px;
  }
}

@media (max-width: 768px) {
  .hero-content {
    grid-template-columns: 1fr auto;
    gap: var(--spacing-lg);
    align-items: center;
  }
  
  .hero-title {
    font-size: 3.5rem;
    line-height: 1.1;
    word-break: keep-all;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .hero-profile-img {
    width: 120px;
    height: 120px;
  }
  
  .hero-visual {
    width: 200px;
    height: 200px;
  }
  
  .floating-elements {
    display: none;
  }
  
  .three-column-layout {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
  
  .three-column-layout .left-sidebar {
    position: static;
    height: auto;
    border: none;
    order: 2;
  }
  
  .three-column-layout .right-sidebar {
    position: static;
    height: auto;
    border: none;
    order: 3;
    padding: var(--spacing-md);
    overflow-y: visible;
  }
  
  .main-content {
    order: -1;
    padding: var(--spacing-lg);
  }
  
  .articles-grid {
    gap: var(--spacing-md);
  }
  
  .article-card {
    flex-direction: column;
    text-align: left;
    min-height: auto;
    padding: var(--spacing-md);
  }
  
  .article-content {
    order: 1;
  }
  
  .article-action {
    order: 2;
    padding: var(--spacing-sm);
    justify-content: flex-start;
    margin-top: var(--spacing-sm);
  }
  
  .categories-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.5rem;
    line-height: 1.2;
    word-break: keep-all;
    white-space: nowrap;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--spacing-md);
  }
  
  .hero-profile-img {
    width: 100px;
    height: 100px;
  }
  
  .hero-visual {
    width: 150px;
    height: 150px;
  }
  
  .main-content {
    padding: var(--spacing-md);
  }
  
  .section-title {
    font-size: 1.8rem;
  }
}

/* 🌌 背景層 - 藍圖網格特效 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    linear-gradient(90deg, rgba(0, 212, 255, 0.1) 1px, transparent 1px),
    linear-gradient(rgba(0, 212, 255, 0.1) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: -2;
  animation: gridPulse 4s ease-in-out infinite;
}

/* 🔥 光滲背景層特效 */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 43, 71, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(255, 165, 0, 0.1) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
  animation: lightLeak 8s ease-in-out infinite;
}

/* 🌟 動畫關鍵幀 */
@keyframes gridPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

@keyframes lightLeak {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 標題樣式 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--fg);
  margin: 1.5rem 0 1rem 0;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

/* 段落樣式 */
p {
  margin: 0 0 1.5rem;
  color: var(--fg);
}

/* 連結樣式 */
a {
  color: var(--pri);
  text-decoration: none;
  transition: all var(--duration-fast) ease;
}

a:hover {
  color: var(--pri-hover);
  text-decoration: underline;
}

/* 列表樣式 */
ul, ol {
  margin: 0 0 1.5rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--fg);
}

/* 程式碼樣式 */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--card);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--accent);
  border: 1px solid var(--border);
}

pre {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  overflow-x: auto; /* 允許水平滾動 */
  margin: 1.5rem 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

pre code {
  background: none;
  padding: 0;
  border: none;
  color: var(--fg);
}

/* Rouge 語法高亮器樣式 */
.highlight {
  margin: 1rem 0; /* 減少上下邊距 */
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  transition: all 0.3s ease;
}

.highlight:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.highlight pre {
  margin: 0;
  padding: 0; /* 移除所有外部 padding */
  background: var(--card);
  border: none;
  overflow-x: auto; /* 允許水平滾動 */
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.highlight code {
  font-family: var(--font-mono);
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: inherit;
}

/* 增強的 Rouge 區塊樣式 - 高優先級 */
.highlighter-rouge .highlight.enhanced-block {
  margin: 0 !important;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
  overflow: hidden !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid var(--border-color) !important;
  border-top: none !important;
  background: var(--bg-primary) !important;
  transition: all 0.3s ease !important;
}

.highlighter-rouge .highlight.enhanced-block:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.highlighter-rouge .highlight.enhanced-block pre.highlight {
  margin: 0;
  padding: 0;
  background: var(--card);
  border: none;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}

/* 程式碼區塊增強樣式 */
.code-header {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 0.75rem 1.25rem !important;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border-color) !important;
  border-bottom: none !important;
  margin: 1rem 0 0 0 !important;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.code-lang {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-copy {
  background: linear-gradient(135deg, var(--pri), var(--pri-hover));
  color: white;
  border: 1px solid var(--pri);
  border-radius: var(--radius-md);
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.code-copy:hover {
  background: linear-gradient(135deg, var(--pri-hover), var(--pri));
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(255, 43, 71, 0.3);
}

.code-copy:active {
  transform: translateY(0);
}

.code-copy span {
  font-size: 1rem;
  line-height: 1;
}

/* 隱藏 Rouge 行號 */
.rouge-gutter {
  display: none !important;
}

.rouge-code {
  width: 100% !important;
}

/* Rouge 語法高亮主題 */
.highlight .c { color: var(--text-muted); } /* 註釋 */
.highlight .k { color: var(--pri); } /* 關鍵字 */
.highlight .kd { color: var(--pri); } /* 關鍵字宣告 */
.highlight .kn { color: var(--pri); } /* 關鍵字命名空間 */
.highlight .s { color: var(--success); } /* 字串 */
.highlight .sa { color: var(--success); } /* 字串逸出 */
.highlight .dl { color: var(--success); } /* 字串分隔符 */
.highlight .n { color: var(--accent); } /* 數字 */
.highlight .m { color: var(--accent); } /* 數字 */
.highlight .mi { color: var(--accent); } /* 整數 */
.highlight .mf { color: var(--accent); } /* 浮點數 */
.highlight .o { color: var(--text-secondary); } /* 運算子 */
.highlight .p { color: var(--text-secondary); } /* 括號 */
.highlight .nb { color: var(--pri); } /* 內建函數 */
.highlight .nf { color: var(--accent); } /* 函數名稱 */
.highlight .nc { color: var(--accent); } /* 類別名稱 */
.highlight .nn { color: var(--text-secondary); } /* 模組名稱 */

.code-content pre code {
  font-family: var(--font-mono);
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--text-primary);
}

/* 沒有行號時的樣式調整 */
.code-content.no-line-numbers pre {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* 語法高亮主題優化 */
.code-content pre .highlight {
  background: transparent;
}

.code-content pre .highlight .c { color: var(--text-muted); } /* 註釋 */
.code-content pre .highlight .k { color: var(--pri); } /* 關鍵字 */
.code-content pre .highlight .s { color: var(--success); } /* 字串 */
.code-content pre .highlight .n { color: var(--accent); } /* 數字 */

/* Rouge 手機版本優化 */
@media (max-width: 768px) {
  .highlight {
    margin: 1rem 0;
    border-radius: var(--radius-md);
  }

  .highlight pre {
    padding: 0; /* 移除外部 padding */
    font-size: 0.85rem;
  }

  .rouge-gutter {
    display: none !important;
  }

  .rouge-code {
    width: 100% !important;
  }

  .rouge-code pre {
    padding: 0.75rem 0.75rem 0.75rem 0.5rem;
    font-size: 0.85rem;
    line-height: 1.4; /* 與行號保持一致 */
  }

  .code-header {
    padding: 0.5rem 1rem;
  }

  .code-lang {
    font-size: 0.8rem;
  }

  .code-copy {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
  }
}

/* Rouge 平板版本優化 */
@media (max-width: 1024px) and (min-width: 769px) {
  .highlight {
    margin: 1.25rem 0;
  }

  .highlight pre {
    padding: 0; /* 移除外部 padding */
  }

  .rouge-gutter {
    display: none !important;
  }

  .rouge-code {
    width: 100% !important;
  }

  .rouge-code {
    width: calc(100% - 2.75rem);
  }

  .rouge-code pre {
    padding: 0.875rem 0.875rem 0.875rem 0.625rem;
    line-height: 1.45; /* 與行號保持一致 */
  }

  .code-header {
    padding: 0.625rem 1.125rem;
  }

  .code-lang {
    font-size: 0.85rem;
  }

  .code-copy {
    padding: 0.3125rem 0.625rem;
    font-size: 0.85rem;
  }
}

/* 刪減符號樣式 */
del {
  text-decoration: line-through;
  text-decoration-color: var(--error);
  text-decoration-thickness: 2px;
  opacity: 0.7;
}

/* 引用樣式 */
blockquote {
  border-left: 4px solid var(--pri);
  margin: 1.5rem 0;
  padding: 0.5rem 1rem;
  background: var(--card);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--fg-secondary);
  font-style: italic;
}

/* 分隔線 */
hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

/* 圖片樣式 */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

/* 表格樣式 */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background: var(--card);
  border-radius: var(--radius-md);
  overflow: hidden;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--fg);
}

/* 按鈕基本樣式 */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--pri);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--duration-fast) ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--pri-hover);
  transform: translateY(-2px);
  box-shadow: var(--glow-red), var(--shadow-lg);
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-hover);
  box-shadow: var(--glow-blue), var(--shadow-lg);
}

/* 卡片基本樣式 */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1rem 0;
  transition: all var(--duration-normal) ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* 容器樣式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
  
  /* 確保桌面版使用Flexbox + sticky */
  .three-column-layout {
    display: flex !important;
  }
  
  .three-column-layout .left-sidebar {
    position: sticky !important;
    top: 120px !important;
    height: calc(100vh - 120px) !important;
    width: 240px !important;
    flex-shrink: 0 !important;
  }
  
  .three-column-layout .right-sidebar {
    position: sticky !important;
    top: 120px !important;
    height: calc(100vh - 120px) !important;
    width: 240px !important;
    flex-shrink: 0 !important;
  }
}

/* 主要內容區域 */
.main-content {
  min-height: calc(100vh - 160px);
  padding: 2rem 0;
}

/* ====================================
   🧩 Header 導航
   ==================================== */

header {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border-bottom: 2px solid var(--corrupt-blue);
  box-shadow: var(--shadow-lg);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--fg);
}

.logo-image {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
}

.logo-text {
  font-family: 'Orbitron', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(45deg, var(--corrupt-blue), var(--tainted-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: var(--glow-blue);
  letter-spacing: 2px;
}

.nav-container {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 2rem;
}

.nav-item {
  position: relative;
}

.nav-link {
  color: var(--fg-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) ease;
  font-weight: 500;
  border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  color: var(--corrupt-blue);
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--corrupt-blue);
  box-shadow: var(--glow-blue);
  text-decoration: none;
  transform: translateY(-2px);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-actions .btn {
  padding: 0.5rem;
  min-width: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-toggle {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  gap: 0.25rem;
}

.mobile-toggle span {
  width: 1.5rem;
  height: 2px;
  background: var(--fg);
  transition: all var(--duration-fast) ease;
}

/* ====================================
   🏠 首頁 Hero 區域 - 保留特殊設計
   ==================================== */

.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-bg-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.3;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 50%, rgba(255, 43, 71, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0, 212, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 40% 80%, rgba(255, 165, 0, 0.1) 0%, transparent 50%);
  z-index: 2;
}

.hero-container {
  position: relative;
  z-index: 3;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.hero-content {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.hero-greeting {
  font-size: 1.2rem;
  color: var(--accent);
  margin-bottom: 1rem;
  font-weight: 500;
}

.hero-name {
  font-size: 3.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, var(--pri), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.5rem;
  color: var(--fg-secondary);
  margin-bottom: 1.5rem;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ====================================
   📚 Posts 頁面樣式
   ==================================== */

/* 三欄佈局 */
.grid-3col {
  display: grid;
  grid-template-columns: 300px 1fr 250px;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  align-items: start;
}

.content-root {
  min-height: calc(100vh - 160px);
}

/* 側邊欄樣式 */
/* 舊的 .toc 定義已移除，避免與 HackMD 風格衝突 */

.toc h3, .toc h4 {
  margin: 0 0 1rem 0;
  font-size: 1.1rem;
  color: var(--pri);
  text-shadow: var(--glow-red);
}

.toc nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

/* 舊的 .toc-link 定義已移除，避免與 HackMD 風格衝突 */

.toc-link:hover,
.toc-link.active {
  color: var(--accent);
  background: rgba(0, 212, 255, 0.1);
  border-color: var(--accent);
  box-shadow: var(--glow-blue);
  text-decoration: none;
}

/* 篩選控制 */
.filter-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-secondary);
}

.filter-select, .search-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  color: var(--fg);
  font-size: 0.8rem;
  transition: all var(--duration-fast) ease;
  width: 100%;
  box-sizing: border-box;
}

.filter-select:focus, .search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow-blue);
}

/* 主內容區域 */
.main-content {
  min-width: 0;
  padding: 0;
}

/* 右側邊欄（僅在文章頁面使用） */
.post-layout .sidebar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.page-header {
  margin-bottom: 2rem;
  text-align: center;
}

.page-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-color), var(--secondary-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-description {
  font-size: 1.125rem;
  color: var(--fg-secondary);
  max-width: 600px;
  margin: 0 auto;
}

.filter-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.filter-group label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-secondary);
}

.filter-select, .control-select {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  color: var(--fg);
  font-size: 0.9rem;
  min-width: 120px;
}

.filter-select:focus, .control-select:focus {
  outline: none;
  border-color: var(--pri);
}

.posts-stats {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-lg);
  color: var(--fg-secondary);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  padding: var(--spacing-lg) 0;
}

/* Post 簡潔列表樣式 */
.post-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  height: fit-content;
}

.post-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--corrupt-blue), var(--accent-color));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.post-card:hover::before {
  transform: scaleX(1);
}

.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0, 212, 255, 0.2);
  border-color: var(--corrupt-blue);
  background: var(--bg-secondary);
}

.post-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 212, 255, 0.1),
    transparent
  );
  transition: left 0.6s ease;
}

.post-card:hover::after {
  left: 100%;
}

.post-card-title {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  line-height: 1.3;
}

.post-card-title a {
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.3s ease;
  position: relative;
  display: inline-block;
}

.post-card-title a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color), var(--secondary-accent));
  transition: width 0.3s ease;
}

.post-card-title a:hover::after {
  width: 100%;
}

.post-card-title a:hover {
  color: var(--accent-color);
  transform: translateX(3px);
  text-shadow: 0 0 8px rgba(var(--accent-rgb), 0.3);
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.post-card-excerpt {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  position: relative;
  padding: 1rem 0;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.02) 0%, transparent 100%);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.post-card:hover .post-card-excerpt {
  color: var(--text-primary);
  border-left-color: var(--accent-color);
  padding-left: 1.5rem;
  transform: translateX(4px);
  background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.05) 0%, transparent 100%);
}

.post-card-excerpt::before {
  content: '"';
  position: absolute;
  top: -8px;
  left: -20px;
  font-size: 2.5rem;
  color: var(--accent-color);
  opacity: 0.2;
  font-family: 'Georgia', serif;
  transition: all 0.3s ease;
  font-weight: bold;
}

.post-card:hover .post-card-excerpt::before {
  opacity: 0.4;
  transform: scale(1.1) rotate(-5deg);
}

.post-card-excerpt::after {
  content: '"';
  position: absolute;
  bottom: -20px;
  right: -15px;
  font-size: 2.5rem;
  color: var(--accent-color);
  opacity: 0.2;
  font-family: 'Georgia', serif;
  transition: all 0.3s ease;
  font-weight: bold;
}

.post-card:hover .post-card-excerpt::after {
  opacity: 0.4;
  transform: scale(1.1) rotate(5deg);
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag-link {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 43, 71, 0.1);
  color: var(--pri);
  border: 1px solid rgba(255, 43, 71, 0.3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all var(--duration-fast) ease;
}

.tag-link:hover {
  background: rgba(255, 43, 71, 0.2);
  border-color: var(--pri);
  text-decoration: none;
}

.read-more-btn {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
}

.read-more-btn:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ====================================
   📄 文章頁面樣式
   ==================================== */

.post-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

.post-container {
  display: flex;
  gap: 2rem;
  width: 100%;
  align-items: flex-start;
}

/* 左側目錄 */
.post-toc {
  flex: 0 0 250px;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.toc-wrapper {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

/* 中間內容區 */
.post-main {
  flex: 1;
  min-width: 0;
}

.post-article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* 文章標題區 */
.post-header {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
}

.post-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.breadcrumb-link {
  color: var(--accent);
  text-decoration: none;
  transition: all var(--duration-fast) ease;
}

.breadcrumb-link:hover {
  color: var(--accent-hover);
  text-shadow: var(--glow-blue);
}

.breadcrumb-separator {
  color: var(--muted);
}

.breadcrumb-current {
  color: var(--fg-secondary);
}

.post-title {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--fg);
  line-height: 1.2;
  text-shadow: var(--glow-red);
}

.post-description {
  font-size: 1.125rem;
  color: var(--fg-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.post-meta {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.meta-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.meta-icon {
  font-size: 1rem;
}

.meta-secondary {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.meta-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.meta-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg-secondary);
  white-space: nowrap;
}

.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.meta-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all var(--duration-fast) ease;
}

.category-tag {
  background: rgba(255, 43, 71, 0.1);
  color: var(--pri);
  border: 1px solid rgba(255, 43, 71, 0.3);
}

.category-tag:hover {
  background: rgba(255, 43, 71, 0.2);
  border-color: var(--pri);
  box-shadow: var(--glow-red);
}

.tag-tag {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.3);
}

.tag-tag:hover {
  background: rgba(0, 212, 255, 0.2);
  border-color: var(--accent);
  box-shadow: var(--glow-blue);
}

/* 文章內容 */
.post-content {
  padding: 2rem;
  max-width: none;
  margin: 0;
  line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  position: relative;
}

.post-content h2 {
  border-bottom: 2px solid var(--pri);
  padding-bottom: 0.5rem;
}

.post-content h3 {
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
}

/* 文章導航 */
.post-navigation {
  display: flex;
  justify-content: space-between;
  margin: 2rem 0;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.nav-prev, .nav-next {
  flex: 1;
  max-width: calc(50% - 0.5rem);
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration-normal) ease;
}

.nav-prev:hover, .nav-next:hover {
  border-color: var(--corrupt-blue);
  box-shadow: var(--glow-blue);
  transform: translateY(-2px);
}

.nav-next {
  text-align: right;
}

.nav-prev a, .nav-next a {
  color: var(--fg);
  text-decoration: none;
  display: block;
}

.nav-prev a:hover, .nav-next a:hover {
  color: var(--accent);
  text-shadow: var(--glow-blue);
}

/* ====================================
   🏷️ 分類和標籤頁面
   ==================================== */

.category-grid, .tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.category-card, .tag-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  transition: all var(--duration-normal) ease;
  box-shadow: var(--shadow-sm);
}

.category-card:hover, .tag-card:hover {
  border-color: var(--corrupt-blue);
  transform: translateY(-4px);
  box-shadow: var(--glow-blue), var(--shadow-lg);
}

.category-name, .tag-name {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--pri);
}

.category-count, .tag-count {
  color: var(--muted);
  font-size: 0.9rem;
}

/* ====================================
   🔍 搜尋頁面
   ==================================== */

.search-form {
  max-width: 600px;
  margin: 0 auto 2rem;
}

.search-input {
  width: 100%;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--fg);
  font-size: 1rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--pri);
}

.search-results {
  max-width: 800px;
  margin: 0 auto;
}

.search-result {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: all var(--duration-normal) ease;
}

.search-result:hover {
  border-color: var(--border-hover);
}

/* ====================================
   📱 響應式設計
   ==================================== */

@media (max-width: 768px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.75rem; }
  h3 { font-size: 1.375rem; }
  
  .container {
    padding: 0 1rem;
  }
  
  .main-content {
    padding: 1rem 0;
  }
  
  .header-container {
    padding: 0 1rem;
  }
  
  .nav-menu {
    gap: 1rem;
  }
  
  .nav-link {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  .hero-name {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.25rem;
  }
  
  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .posts-grid {
    gap: var(--spacing-md);
  }
  
  .post-card {
    padding: 1rem;
  }
  
  /* 三欄佈局響應式 */
  .grid-3col {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  
  .toc, .sidebar {
    position: static;
    max-height: none;
  }
  
  /* 文章頁面響應式 */
  .post-layout {
    padding: 1rem;
  }
  
  .post-container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .post-toc {
    flex: none;
    position: static;
    max-height: none;
    order: -1;
  }
  
  .post-header {
    padding: 1.5rem;
  }
  
  .post-title {
    font-size: 2rem;
  }
  
  .post-content {
    padding: 1.5rem;
  }
  
  .meta-primary {
    gap: 1rem;
  }
  
  .meta-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .mobile-toggle {
    display: flex;
  }
  
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .nav-menu.active {
    display: flex;
    /* Make expanded menu fill available viewport space under header and be scrollable */
    position: fixed !important;
    top: var(--header-height, 56px) !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    /* Use explicit height as stronger fallback when other rules override max-height */
    height: calc(100vh - var(--header-height, 56px)) !important;
    max-height: calc(100vh - var(--header-height, 56px)) !important;
    min-height: 150px !important; /* prevent extremely small render */
    overflow-y: auto !important;
    z-index: 20000 !important;
    border-radius: 0 !important; /* make full-width feel natural */
    padding: 1rem !important;
  }
  
  .category-grid, .tag-grid {
    grid-template-columns: 1fr;
  }
  
  .post-navigation {
    flex-direction: column;
  }
  
  .nav-prev, .nav-next {
    max-width: 100%;
    text-align: left;
  }
  
  .filter-controls {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 480px) {
  .hero-name {
    font-size: 2rem;
  }
  
  .page-title {
    font-size: 2rem;
  }
  
  .post-title {
    font-size: 2rem;
  }
}

/* ====================================
   📄 Footer 樣式
   ==================================== */

.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: var(--spacing-xl) 0;
  margin-top: auto;
  text-align: center;
  position: relative;
  z-index: 10;
  clear: both;
}

.site-footer .container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.site-footer p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ====================================
   📊 右欄統計與標籤雲樣式
   ==================================== */

/* 分類統計 */
.category-stats {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.3s ease;
}

.stat-item:hover {
  background: var(--bg-secondary);
  border-color: var(--corrupt-blue);
  transform: translateX(3px);
}

.stat-name {
  font-weight: 600;
  color: var(--text-primary);
}

.stat-count {
  background: linear-gradient(45deg, var(--corrupt-blue), var(--accent-color));
  color: white;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

/* 熱門標籤雲 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.tag-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--spacing-xs) var(--spacing-sm);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8rem;
  transition: all 0.3s ease;
}

.tag-link:hover {
  background: var(--corrupt-blue);
  color: white;
  border-color: var(--corrupt-blue);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

.tag-count {
  background: var(--accent-color);
  color: white;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

.tag-link:hover .tag-count {
  background: rgba(255, 255, 255, 0.2);
}

/* ====================================
   📄 文章頁面專用樣式
   ==================================== */

.article-layout {
  display: grid;
  grid-template-columns: 260px 1fr; /* 稍微減少左欄寬度以適應 container */
  gap: var(--spacing-lg); /* 稍微減少間距 */
  width: 100%;
  max-width: none; /* 移除全寬限制，讓外層 container 控制寬度 */
  margin: 0 auto;
  padding: 0; /* 移除內部 padding，讓外層 container 控制 */
  min-height: calc(100vh - 200px);
  box-sizing: border-box;
}

/* 左欄：文章側邊欄 - 移除垂直滾動 */
.article-sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
  max-height: none; /* 移除高度限制 */
  overflow: visible; /* 移除滾動 */
}

.sidebar-content {
  background: transparent; /* 移除背景 */
  border: none; /* 移除邊框 */
  border-radius: 0; /* 移除圓角 */
  padding: 0; /* 移除內邊距 */
  box-shadow: none; /* 移除陰影 */
  margin: 0;
}

/* 文章導航 - 移除外層框框 */
.article-nav {
  margin-bottom: 0;
  border: none;
  background: transparent;
  padding: 0;
}

.nav-title {
  display: none; /* 隱藏標題 */
}

/* ====================================
   📖 階層式目錄樣式 - 簡潔版
   ==================================== */

/* ====================================
   📖 HackMD 風格階層式目錄 - 簡潔版
   ==================================== */

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
  max-height: none; /* 移除垂直滾動 */
  overflow: visible; /* 移除滾動 */
}

.toc-item {
  position: relative;
  margin-bottom: 0; /* 減少項目間距，讓整體更緊湊 */
}

.toc-link {
  display: block;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 1px 8px 1px 20px; /* 進一步減少內邊距 */
  border-radius: 3px; /* 稍微圓角 */
  transition: all 0.15s ease; /* 稍微快一點的動畫 */
  font-size: 1.15rem; /* 放大字體，提升可讀性 */
  font-weight: 500; /* 統一字重 */
  line-height: 1.2; /* 更緊湊的行高 */
  position: relative;
  border-left: 1px solid transparent; /* 更細的左邊框 */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* HackMD 風格的階層指示器 - 移除白色句點 */

.toc-link:hover {
  color: var(--accent-color);
  background: rgba(255, 43, 71, 0.03); /* 更淡的背景 */
  border-left-color: var(--accent-color);
}

/* .toc-link:hover::before 已移除 */

.toc-link.active {
  color: var(--accent-color);
  background: rgba(255, 43, 71, 0.08);
  border-left-color: var(--accent-color);
  font-weight: 500;
}

/* .toc-link.active::before 已移除 */

/* HackMD 風格：所有項目使用相同字體大小，用縮排表示階層 */
.toc-level-1 .toc-link {
  font-weight: 500; /* 統一字重 */
  font-size: 0.75rem; /* 統一為更小的字體 */
  padding-left: 16px; /* 減少縮進 */
  border-left: 2px solid var(--accent-color);
}

/* .toc-level-1 .toc-link::before 已移除 */

.toc-level-2 .toc-link {
  font-weight: 500; /* 統一字重 */
  font-size: 0.75rem; /* 統一為更小的字體 */
  padding-left: 32px; /* 增加縮進表示階層 */
  border-left: 1px solid var(--border);
}

/* .toc-level-2 .toc-link::before 已移除 */

.toc-level-3 .toc-link {
  font-weight: 500; /* 統一字重 */
  font-size: 0.75rem; /* 統一為更小的字體 */
  padding-left: 48px; /* 進一步增加縮進 */
  border-left: 1px solid var(--border);
  color: var(--text-secondary); /* 統一顏色 */
}

/* .toc-level-3 .toc-link::before 已移除 */

/* 活躍狀態的階層樣式 */
.toc-level-1 .toc-link.active {
  background: linear-gradient(90deg, rgba(255, 43, 71, 0.1) 0%, rgba(255, 43, 71, 0.05) 100%);
}

.toc-level-2 .toc-link.active {
  background: rgba(255, 43, 71, 0.06);
}

.toc-level-3 .toc-link.active {
  background: rgba(255, 43, 71, 0.04);
}

/* HackMD 風格的連接線 */
.toc-list::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  opacity: 0.3;
}

.toc-level-1::before {
  content: '';
  position: absolute;
  left: 10px;
  top: 50%;
  width: 8px;
  height: 1px;
  background: var(--accent-color);
  opacity: 0.6;
}

/* TOC 控制按鈕 - 改為文字形式並往下移 */
.toc-controls {
  display: flex;
  justify-content: center;
  gap: 20px; /* 增加按鈕間距 */
  margin-top: 28px; /* 進一步增加上邊距 */
  padding: 20px 0; /* 增加內邊距 */
  /* 移除框框 */
}

.toc-control-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem; /* 與目錄項目保持一致 */
  font-weight: 500; /* 統一字重 */
  padding: 4px 8px;
  transition: all 0.15s ease;
  opacity: 0.7;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.toc-control-btn:hover {
  color: var(--accent-color);
  opacity: 1;
  text-decoration: underline;
}

.toc-control-btn:active {
  transform: scale(0.95);
}

/* 子項目容器（展開/收起功能）- 使用更穩定的 collapsed/expanded 狀態
   note: 使用 `max-height` 與有限值可以讓過渡動畫正常工作；
   不要使用全域性的 `.toc-children { max-height:0 }`，以免被其他規則覆蓋導致展開後仍為 0 */
.toc-children {
  /* default to visible in case JS didn't run; collapsed state is explicit */
  max-height: 100vh;
  overflow: visible;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  margin-left: 0;
  padding-left: 0;
}

.toc-children.collapsed {
  /* collapsed (explicit) state used by JS when folding) */
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.toc-children.expanded {
  /* expanded uses a large but finite max-height so CSS transitions work */
  max-height: 80vh; /* allow plenty of room on mobile */
  overflow: auto;
  opacity: 1;
}

/* 子項目連接線 */
.toc-children::before {
  content: '';
  position: absolute;
  left: 32px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
  opacity: 0.4;
}

/* 響應式設計 - 更緊湊 */
@media (max-width: 768px) {
  .toc-link {
    padding: 3px 6px 3px 12px; /* 更小的內邊距 */
    font-size: 0.75rem; /* 手機上統一大小 */
    font-weight: 500; /* 統一字重 */
  }

  /* .toc-link::before 已移除 */

  .toc-level-1 .toc-link {
    padding-left: 12px;
    font-size: 0.7rem; /* 進一步縮小字體 */
    font-weight: 500;
  }

  /* .toc-level-1 .toc-link::before 已移除 */

  .toc-level-2 .toc-link {
    padding-left: 24px; /* 手機上調整縮排 */
    font-size: 0.7rem; /* 進一步縮小字體 */
    font-weight: 500;
  }

  /* .toc-level-2 .toc-link::before 已移除 */

  .toc-level-3 .toc-link {
    padding-left: 36px; /* 手機上調整縮排 */
    font-size: 0.7rem; /* 進一步縮小字體 */
    font-weight: 500;
  }

  /* .toc-level-3 .toc-link::before 已移除 */

  .toc-list::before {
    left: 8px;
  }

  .toc-level-1::before {
    left: 5px;
  }

  .toc-nav {
    padding-top: 16px; /* 在手機上添加適當的頂部留白 */
  }

  .toc-controls {
    gap: 16px; /* 在手機上稍微減少間距 */
    margin-top: 24px; /* 在手機上調整上邊距 */
  }

  .toc-control-btn {
    font-size: 0.7rem; /* 手機上稍微調小 */
    font-weight: 500; /* 統一字重 */
    padding: 3px 6px;
  }

  .toc-children.expanded {
    max-height: none; /* 移除高度限制，完全展開 */
    overflow: visible; /* 允許內容完全顯示 */
  }
}

.toc-empty {
  color: var(--text-tertiary);
  font-style: italic;
  text-align: center;
}
 
/* ==========================
   Mobile TOC / Article fixes
   - Ensure TOC does not overlay the main content on small screens
   - Stack article layout into one column and put TOC above content
   - Disable sticky positioning and high z-index for TOC/sidebar on mobile
   - Make sure post-article is rendered above any lingering sidebar backgrounds
   ========================== */

@media (max-width: 768px) {
  /* Force article layout to a single column and keep normal flow */
  .article-layout {
    display: block !important;
    grid-template-columns: none !important;
    padding: 0 1rem !important;
  }

  /* Hide left/right sidebars completely on mobile to simplify layout */
  .three-column-layout .left-sidebar,
  .three-column-layout .right-sidebar,
  .left-sidebar,
  .right-sidebar,
  .sidebar {
    display: none !important;
    visibility: hidden !important;
    width: auto !important; /* keep layout flow safe */
  }

  /* Sidebar / TOC becomes static in document flow and placed before content (order handled in HTML) */
  .article-sidebar,
  .post-toc,
  .toc-wrapper,
  .toc-nav {
    position: static !important;
    top: auto !important;
    max-height: none !important;
    overflow: visible !important;
    width: auto !important;
    flex: none !important;
    order: -1 !important; /* place TOC above article content when stacked */
    z-index: 1 !important; /* ensure it's not above the article content */
    background: transparent !important; /* avoid covering visual backgrounds */
    box-shadow: none !important;
  }

  /* Ensure the main article is visually on top (so clickable links and content aren't blocked) */
  .post-article,
  .article-main,
  .post-main {
    position: relative !important;
    z-index: 2 !important;
  }

  /* Reduce potential full-screen nav/menu interference */
  .nav-menu,
  .toc-overlay,
  .toc-fullscreen {
    display: none !important;
  }

  /* When the mobile nav is opened, prevent body scroll and ensure nav is on top */
  body.nav-open {
    overflow: hidden !important;
  }

  body.nav-open .nav-menu {
    display: flex !important;
    position: fixed !important;
    /* use header height variable to avoid mismatches */
    top: var(--header-height, 56px) !important; /* below header */
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99999 !important;
    background: var(--bg-secondary) !important;
    padding: 1rem !important;
    overflow-y: auto !important;
    /* explicit max-height prevents other rules from collapsing the menu to 0 */
    max-height: calc(100vh - var(--header-height, 56px)) !important;
    box-sizing: border-box !important;
  }

  /* Ensure header mobile toggle and container are above any lingering sidebars */
  .mobile-toggle {
    z-index: 10005 !important;
    position: relative !important;
  }

  header .header-container {
    z-index: 10004 !important;
    position: relative !important;
  }

  /* Strongly force hide any sidebar variants on mobile and free up the main column */
  .three-column-container,
  .three-column-layout {
    display: block !important;
    width: 100% !important;
  }

  .three-column-container .left-sidebar,
  .three-column-container .right-sidebar,
  .three-column-layout .left-sidebar,
  .three-column-layout .right-sidebar,
  .left-sidebar,
  .right-sidebar,
  .sidebar {
    display: none !important;
    visibility: hidden !important;
    position: static !important;
    width: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .three-column-container .main-content,
  .main-content,
  .article-main {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: var(--spacing-sm) !important;
    padding-right: var(--spacing-sm) !important;
    margin: 0 auto !important;
    display: block !important;
    flex: none !important;
  }

  /* Extra-safety rules: target home/three-column pages specifically to remove any overlaying sidebars */
  body.home.three-column .right-sidebar,
  body.home.three-column .left-sidebar,
  body.three-column.home .right-sidebar,
  body.three-column.home .left-sidebar,
  body.three-column .right-sidebar,
  body.home .right-sidebar {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  /* Ensure the mobile toggle button accepts clicks */
  #mobileToggle,
  .mobile-toggle {
    pointer-events: auto !important;
    z-index: 20000 !important;
  }

  /* Debug visual feedback when mobile toggle is clicked (temporary) */
  .mobile-toggle.mobile-toggle-flash span {
    background: var(--accent-color) !important;
    transition: background 0.15s ease;
  }
}

/* 移除重複的 .toc-level-2 和 .toc-level-3 定義，避免覆蓋 HackMD 風格 */

/* 移除重複的 .toc-level-4/5/6 定義，避免覆蓋 HackMD 風格 */

.no-toc {
  color: var(--text-muted);
  font-style: italic;
  text-align: center;
  padding: var(--spacing-md);
}

/* 右欄：主要文章內容 */
.article-main {
  min-height: calc(100vh - 200px);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0 var(--spacing-sm); /* 添加適當的內邊距 */
}

/* 響應式設計 - 小螢幕優化 */
@media (max-width: 768px) {
  .article-layout {
    grid-template-columns: 1fr; /* 小螢幕改為單欄 */
    gap: var(--spacing-md);
    padding: 0; /* 小螢幕也移除 padding */
  }
  
  .article-sidebar {
    order: 2; /* 目錄移到下方 */
  }
  
  .article-main {
    order: 1; /* 內容移到上方 */
  }
  
  /* 小螢幕下調整左欄寬度 */
  .article-sidebar {
    width: 100%; /* 小螢幕下占滿寬度 */
  }
}.post-article {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  min-height: 100%;
  max-width: 100%; /* 充分利用寬度 */
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box; /* 確保 padding 不會超出寬度 */
}

/* 文章標題 */
.post-title {
  color: var(--text-primary);
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--spacing-lg);
  background: linear-gradient(45deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 文章元資訊 */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-color);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.meta-icon {
  font-size: 1.1rem;
}

.meta-categories,
.meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.category-badge,
.tag-badge {
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

.category-badge {
  background: rgba(0, 212, 255, 0.2);
  color: var(--corrupt-blue);
}

.tag-badge {
  background: rgba(255, 165, 0, 0.2);
  color: var(--tainted-gold);
}

/* 文章內容 */
.post-content {
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 1.1rem;
  max-width: 100%; /* 允許充分利用寬度 */
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word; /* 確保長單詞也能換行 */
  hyphens: auto; /* 自動斷字 */
  width: 100%;
  box-sizing: border-box; /* 確保不會超出容器 */
}

/* 確保文章內的所有元素都不會超出寬度 */
.post-content * {
  max-width: 100%;
  box-sizing: border-box;
}

/* 圖片和媒體元素的安全設置 */
.post-content img,
.post-content picture,
.post-content figure,
.post-content video,
.post-content iframe {
  max-width: 100%; /* 不會超出容器 */
  height: auto;    /* 保持長寬比 */
  display: block;
  margin: 1rem auto;
  /* 不使用 object-fit 依賴寬高，僅保護性設置 */
}

/* 覆蓋可能的內嵌寬高屬性或 style，避免打破排版 */
.post-content img[width],
.post-content img[height],
.post-content img[style] {
  max-width: 100% !important;
  width: 100% !important;
  height: auto !important;
}

/* 限制過高的圖片，避免佔用整個視窗高度 */
.post-content img {
  /* 保護性圖片規則：不會強制擴張父容器 */
  width: auto;           /* 保持圖片本身比例與縮放彈性 */
  max-width: 100%;       /* 永遠不超過可用寬度 */
  max-width: 720px;      /* 在大螢幕上限制最大寬度（可調） */
  height: auto;
  max-height: 80vh;      /* 限制過高圖片，避免推垮頁面 */
  border-radius: var(--radius-md);
  margin: var(--spacing-lg) auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  display: block;
}

/* 確保 flex / grid 的子元素可縮小，不會因內容擴張父容器 */
.post-main,
.post-article,
.post-container,
.article-main {
  min-width: 0; /* 允許在 flex/grid 內被壓縮，避免溢出 */
}

/* 最後一道保護：避免子元素推寬父容器導致整個頁面溢出 */
.post-article {
  overflow-x: hidden; /* 隱藏因極端內容造成的橫向溢出 */
}

/* Desktop-only: For article pages, remove left-sidebar internal vertical scroll
   so the page scrollbar handles vertical scrolling instead. This targets only
   article/post templates to avoid changing other pages. */
@media (min-width: 769px) {
  body.post-page .left-sidebar,
  body.layout-post .left-sidebar,
  article.post-article .left-sidebar {
    max-height: none !important;
    overflow-y: visible !important;
    /* remove any fixed viewport-height and sticky positioning so the sidebar
       grows with the page and does not create an internal scrollbar */
    height: auto !important;
    position: static !important;
    top: auto !important;
  }

  /* Also ensure TOC / article-sidebar containers inside posts don't force internal scrolling */
  body.post-page .post-toc,
  body.layout-post .post-toc,
  article.post-article .post-toc,
  body.post-page .toc-wrapper,
  body.layout-post .toc-wrapper,
  article.post-article .toc-wrapper,
  body.post-page .toc-nav,
  body.layout-post .toc-nav,
  article.post-article .toc-nav {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    position: static !important;
  }
}

/* Hide any internal scrollbar for TOC/left-sidebar on article pages (desktop)
   — keeps page scrollbar intact but removes the small scrollbar inside the sidebar */
@media (min-width: 769px) {
  body.post-page .toc-wrapper,
  body.layout-post .toc-wrapper,
  article.post-article .toc-wrapper,
  body.post-page .toc-nav,
  body.layout-post .toc-nav,
  article.post-article .toc-nav,
  body.post-page .left-sidebar,
  body.layout-post .left-sidebar,
  article.post-article .left-sidebar {
    /* ensure no internal scrolling */
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    /* hide scrollbars cross-browser */
    scrollbar-width: none !important; /* Firefox */
    -ms-overflow-style: none !important; /* IE 10+ */
  }

  /* WebKit browsers */
  body.post-page .toc-wrapper::-webkit-scrollbar,
  body.layout-post .toc-wrapper::-webkit-scrollbar,
  article.post-article .toc-wrapper::-webkit-scrollbar,
  body.post-page .toc-nav::-webkit-scrollbar,
  body.layout-post .toc-nav::-webkit-scrollbar,
  article.post-article .toc-nav::-webkit-scrollbar,
  body.post-page .left-sidebar::-webkit-scrollbar,
  body.layout-post .left-sidebar::-webkit-scrollbar,
  article.post-article .left-sidebar::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
  }

  /* Extra strong: force all descendants to be visible (no internal scroll) */
  body.post-page .toc-wrapper *,
  body.layout-post .toc-wrapper *,
  article.post-article .toc-wrapper *,
  body.post-page .left-sidebar *,
  body.layout-post .left-sidebar *,
  article.post-article .left-sidebar * {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
}

/* Extra, very-specific overrides to catch remaining scrollbar cases (direct children, lists, navs)
   Keep this near the other TOC overrides so specificity/order remains strong. */
@media (min-width: 769px) {
  body.post-page article.post-article .toc-wrapper,
  body.post-page article.post-article .toc-nav,
  body.post-page article.post-article .left-sidebar,
  body.layout-post article.post-article .toc-wrapper,
  body.layout-post article.post-article .toc-nav,
  body.layout-post article.post-article .left-sidebar {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
    position: static !important;
  }

  /* Direct children / common inner containers */
  body.post-page .toc-wrapper > *,
  body.post-page .toc-nav > *,
  body.post-page .left-sidebar > *,
  body.layout-post .toc-wrapper > *,
  body.layout-post .toc-nav > *,
  body.layout-post .left-sidebar > *,
  article.post-article .toc-wrapper > *,
  article.post-article .toc-nav > *,
  article.post-article .left-sidebar > * {
    overflow: visible !important;
    overflow-y: visible !important;
    max-height: none !important;
    height: auto !important;
  }

  /* Specific for the TOC list items that sometimes set max-height/overflow */
  body.post-page .toc-list,
  body.post-page .toc-item,
  body.layout-post .toc-list,
  body.layout-post .toc-item,
  article.post-article .toc-list,
  article.post-article .toc-item {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
  }
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
  color: var(--text-primary);
  margin-top: var(--spacing-xl);
  margin-bottom: var(--spacing-md);
  font-weight: 700;
  line-height: 1.3;
}

.post-content h1 {
  font-size: 2rem;
  border-bottom: 3px solid var(--accent-color);
  padding-bottom: var(--spacing-sm);
}

.post-content h2 {
  font-size: 1.6rem;
  border-bottom: 2px solid var(--corrupt-blue);
  padding-bottom: var(--spacing-xs);
}

.post-content h3 {
  font-size: 1.4rem;
  color: var(--corrupt-blue);
}

.post-content h4 {
  font-size: 1.2rem;
  color: var(--tainted-gold);
}

.post-content p {
  margin-bottom: var(--spacing-lg);
}

.post-content blockquote {
  border-left: 4px solid var(--accent-color);
  padding-left: var(--spacing-lg);
  margin: var(--spacing-lg) 0;
  background: rgba(255, 43, 71, 0.05);
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  font-style: italic;
}

.post-content code {
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9em;
}

.post-content pre {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  overflow-x: auto;
  margin: var(--spacing-lg) 0;
}

.post-content pre code {
  background: none;
  padding: 0;
}

.post-content ul,
.post-content ol {
  margin: var(--spacing-lg) 0;
  padding-left: var(--spacing-xl);
}

.post-content li {
  margin-bottom: var(--spacing-sm);
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--spacing-lg) 0;
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.post-content th,
.post-content td {
  padding: var(--spacing-sm) var(--spacing-md);
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.post-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

.post-content img {
  /* 保留最後一層保護（若前面規則未生效仍有保障） */
  width: 100%;
  max-width: 720px;
  height: auto;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  margin: var(--spacing-lg) auto;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  display: block;
}

.post-content a {
  color: var(--accent-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

.post-content a:hover {
  color: var(--corrupt-blue);
  text-decoration: underline;
}

/* 文章底部 */
.post-footer {
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-xl);
  border-top: 2px solid var(--border-color);
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xl);
}

/* ====================================
   📄 文章頁面響應式設計
   ==================================== */

@media (max-width: 1200px) {
  .article-layout {
    grid-template-columns: 250px 1fr;
    gap: var(--spacing-lg);
    padding: 0 var(--spacing-lg);
  }
}

@media (max-width: 1024px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    padding: 0 var(--spacing-lg);
  }

  /* 手機響應式 .sidebar-content padding 已移除，避免與 HackMD 風格衝突 */

  .post-article {
    margin-left: 0;
  }

  /* TOC 高度限制已移除，完全展開無限制 */

  .post-title {
    font-size: 2rem;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }
}

@media (max-width: 768px) {
  .article-layout {
    gap: var(--spacing-lg);
    padding: 0 var(--spacing-md);
  }

  .sidebar-content {
    margin: 0 0 var(--spacing-lg) 0;
  }

  .post-article {
    margin-left: 0;
  }

  .post-title {
    font-size: 1.8rem;
  }

  .post-meta {
    flex-direction: column;
    gap: var(--spacing-md);
  }

  .nav-btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  .share-buttons {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .article-layout {
    gap: var(--spacing-md);
    padding: 0 var(--spacing-sm);
  }

  .sidebar-content {
    margin: 0 0 var(--spacing-md) 0;
  }

  .post-article {
    margin-left: 0;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .post-article {
    margin-left: var(--spacing-md);
  }

  .sidebar-content {
    padding: var(--spacing-xs);
    margin: 0;
  }
}

/* ====================================
   🌙 文章頁面主題適配
   ==================================== */

/* 光明模式適配 - TOC 區域完全透明 */
html.light .sidebar-content {
  background: transparent; /* 移除背景 */
  border: none; /* 移除邊框 */
  box-shadow: none; /* 移除陰影 */
}

html.light .post-article {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.9) 100%);
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

html.light .toc-link:hover,
html.light .toc-link.active {
  background: rgba(255, 43, 71, 0.08);
}

html.light .nav-btn:hover {
  box-shadow: 0 4px 12px rgba(255, 43, 71, 0.15);
}

/* 黑暗模式適配 - TOC 區域完全透明 */
html:not(.light) .sidebar-content {
  background: transparent; /* 移除背景 */
  border: none; /* 移除邊框 */
  box-shadow: none; /* 移除陰影 */
}

html:not(.light) .post-article {
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* === Emergency mobile visibility overrides === */
@media (max-width: 768px) {
  /* 強制顯示文章相關容器，避免其他樣式（或第三方樣式）在手機上隱藏它們 */
  .article-layout,
  .article-main,
  .post-article,
  .post-content,
  .post-header,
  .post-title {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 2 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    transform: none !important;
    -webkit-transform: none !important;
    pointer-events: auto !important;
  }

  /* 確保 post-content 的子元素可見，避免被 collapse/hidden 覆蓋 */
  .post-content * {
    display: revert !important;
    visibility: visible !important;
    opacity: 1 !important;
  }

  /* 如果有 .posts-view 被切換為 hidden，保證單篇文章頁面仍可見 */
  .posts-view {
    display: block !important;
    visibility: visible !important;
  }
}

html:not(.light) .toc-link:hover,
html:not(.light) .toc-link.active {
  background: rgba(255, 43, 71, 0.15);
}

html:not(.light) .nav-btn:hover {
  box-shadow: 0 4px 12px rgba(255, 43, 71, 0.4);
}

/* 滾動條樣式 */
.article-sidebar::-webkit-scrollbar {
  width: 6px;
}

.article-sidebar::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}

.article-sidebar::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: var(--radius-sm);
}

.article-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--corrupt-blue);
}


