/*!
 * 黃天野個人主頁樣式表 | Tianye Huang's Personal Homepage Stylesheet
 * 增強流星動畫系統 | Enhanced Meteor Animation System
 *
 * 作者: 黃天野 (Tin Yeh Huang)
 * 版本: 4.0 - 增強流星動畫版
 * 更新: 2025年7月26日
 *
 * 設計理念:
 * - 物理真實的流星動畫 (Physics-based Meteor Animations)
 * - 多軌跡變化系統 (Multiple Trajectory Variations)
 * - 中國風水墨美學 (Chinese Ink-wash Aesthetics)
 * - 淡紫金配色方案 (Light Purple & Gold Color Scheme)
 * - 增強毛玻璃效果 (Enhanced Glassmorphism)
 * - 響應式設計優化 (Responsive Design Optimization)
 * - 高性能動畫系統 (High-Performance Animation System)
 *
 * 新功能:
 * - 4種不同的流星軌跡類型 (4 Different Meteor Trajectory Types)
 * - 重力模擬與拋物線運動 (Gravity Simulation & Parabolic Motion)
 * - 動態頻率控制 (Dynamic Frequency Control)
 * - 自適應尺寸變化 (Adaptive Size Variations)
 * - 優化的視覺層次 (Optimized Visual Hierarchy)
 */

/*
===============================================================================
                                    目錄 | TABLE OF CONTENTS
===============================================================================

1. CSS變量系統 ........................... CSS Variables System
2. 基礎樣式重置 ......................... Base Styles Reset
3. 佈局與網格系統 ....................... Layout & Grid System
4. 導航與菜單系統 ....................... Navigation & Menu System
5. 排版與內容樣式 ....................... Typography & Content Styles
6. 增強流星動畫系統 ..................... Enhanced Meteor Animation System
   6.1 流星軌跡動畫 ..................... Meteor Trajectory Animations
   6.2 流星樣式與變化 ................... Meteor Styles & Variations
   6.3 容器與控制 ....................... Container & Controls
7. 組件與卡片樣式 ....................... Component & Card Styles
8. 交互元素 ............................. Interactive Elements
9. 主題切換系統 ......................... Theme Toggle System
10. 響應式設計 .......................... Responsive Design
11. 工具類與輔助樣式 .................... Utility Classes & Helper Styles

===============================================================================
*/

/* ========================================================================
   1. CSS 變量系統 | CSS Variables System
   ======================================================================== */

/* ===== 中國風主題系統 | CHINESE STYLE THEME SYSTEM ===== */
:root {
  /* ===== 動畫過渡控制 | ANIMATION TRANSITION CONTROL ===== */
  --theme-transition-duration: 0.4s;
  --theme-transition-timing: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --theme-transition: all var(--theme-transition-duration) var(--theme-transition-timing);
  --theme-transition-fast: all 0.2s var(--theme-transition-timing);
  --theme-transition-slow: all 0.8s var(--theme-transition-timing);
  --bounce-transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ===== 淺色主題 - 水墨白 | LIGHT THEME - INK WHITE ===== */
  /* 核心色彩 */
  --bg-color: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 50%, #f1f3f4 100%);
  --bg-solid: #f8f9fa;
  --text-color: #2c3e50;
  --text-secondary-color: #6c757d;
  --text-tertiary-color: #495057;
  --content-bg: rgba(255, 255, 255, 0.75);
  --border-color: rgba(108, 117, 125, 0.2);

  /* ===== 统一字体系统 | UNIFIED TYPOGRAPHY SYSTEM ===== */
  --font-family-primary: 'Inter', 'PingFang SC', 'Noto Serif SC', 'Microsoft YaHei', sans-serif;
  --font-family-secondary: 'Noto Serif SC', 'PingFang SC', 'Microsoft YaHei', serif;

  /* 字体大小层次 | Font Size Hierarchy */
  --font-size-h1: 2.5rem;        /* 主标题 */
  --font-size-h2: 2rem;          /* 二级标题 */
  --font-size-h3: 1.5rem;        /* 三级标题 */
  --font-size-h4: 1.25rem;       /* 四级标题 */
  --font-size-body: 1rem;        /* 正文 */
  --font-size-small: 0.875rem;   /* 小字 */
  --font-size-xs: 0.75rem;       /* 极小字 */

  /* 行高系统 | Line Height System */
  --line-height-tight: 1.2;      /* 标题行高 */
  --line-height-normal: 1.5;     /* 正文行高 */
  --line-height-relaxed: 1.7;    /* 宽松行高 */

  /* 字重系统 | Font Weight System */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* 主色調 - 淡金色 (國風金) | Primary Accent - Light Gold */
  --primary-accent-h: 45;
  --primary-accent-s: 65%;
  --primary-accent-l: 68%;
  --primary-accent: hsl(var(--primary-accent-h), var(--primary-accent-s), var(--primary-accent-l));
  --primary-accent-hover: hsl(var(--primary-accent-h), calc(var(--primary-accent-s) + 10%), calc(var(--primary-accent-l) - 8%));
  --primary-accent-light: hsl(var(--primary-accent-h), var(--primary-accent-s), calc(var(--primary-accent-l) + 12%));
  --primary-accent-transparent: hsla(var(--primary-accent-h), var(--primary-accent-s), var(--primary-accent-l), 0.25);
  --primary-accent-transparent-light: hsla(var(--primary-accent-h), var(--primary-accent-s), var(--primary-accent-l), 0.12);

  /* 輔助色調 - 淡紫色 (國風紫) | Secondary Accent - Light Purple */
  --secondary-accent-h: 280;
  --secondary-accent-s: 35%;
  --secondary-accent-l: 65%;
  --secondary-accent: hsl(var(--secondary-accent-h), var(--secondary-accent-s), var(--secondary-accent-l));
  --secondary-accent-hover: hsl(var(--secondary-accent-h), calc(var(--secondary-accent-s) + 10%), calc(var(--secondary-accent-l) - 8%));
  --secondary-accent-light: hsl(var(--secondary-accent-h), var(--secondary-accent-s), calc(var(--secondary-accent-l) + 12%));
  --secondary-accent-transparent: hsla(var(--secondary-accent-h), var(--secondary-accent-s), var(--secondary-accent-l), 0.2);
  --secondary-accent-transparent-light: hsla(var(--secondary-accent-h), var(--secondary-accent-s), var(--secondary-accent-l), 0.1);
  
  /* Semantic Colors */
  --link-color: var(--primary-accent);
  --link-hover: var(--primary-accent-hover);
  --heading-color: var(--secondary-accent);
  --subheading-color: var(--primary-accent);
  
  /* UI 元素 - 增強毛玻璃效果 */
  --menu-bg: rgba(248, 248, 248, 0.65);
  --menu-bg-glassy: rgba(255, 255, 255, 0.45);
  --menu-text: #2c3e50;
  --menu-hover-bg: var(--primary-accent);
  --menu-hover-text: #1a1a1a;
  --card-bg-glassy: rgba(255, 255, 255, 0.02); /* 極度透明以顯示星星背景 */
  --glass-border: rgba(255, 255, 255, 0.4);
  --glass-shadow: rgba(0, 0, 0, 0.15);
  
  /* Shadows & Effects */
  --shadow-color: rgba(0, 0, 0, 0.04);
  --shadow-color-medium: rgba(0, 0, 0, 0.08);
  --shadow-color-strong: rgba(0, 0, 0, 0.12);
  --shadow-color-light: rgba(0, 0, 0, 0.03);
  --card-border-highlight: rgba(0, 0, 0, 0.05);
  
  /* Interactive Elements */
  --button-bg: var(--primary-accent);
  --button-text: #FFFFFF;
  --button-hover-bg: var(--primary-accent-hover);
  --button-shadow: 0 2px 8px var(--primary-accent-transparent);
  
  /* Code & Syntax */
  --code-bg: #ffffdd;
  --code-text: var(--text-color);
  --pre-bg: #f6f6f6;
  
  /* Status Colors */
  --success-color: #28a745;
  --warning-color: #fd7e14;
  --error-color: #dc3545;
  --info-color: #17a2b8;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-accent), var(--primary-accent-light));
  --gradient-secondary: linear-gradient(135deg, var(--secondary-accent), var(--secondary-accent-light));
  --gradient-mixed: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
}

[data-theme="dark"] {
  /* ===== 深色主題 - 岩石黑水墨 | DARK THEME - ROCK BLACK INK ===== */
  /* 核心色彩 - 岩石黑漸變背景 */
  --bg-color: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 25%, #1e1e1e 50%, #252525 75%, #1a1a1a 100%);
  --bg-solid: #1a1a1a;
  --text-color: #e8e6e3;
  --text-secondary-color: #b8b5b2;
  --text-tertiary-color: #d0ccc9;
  --content-bg: rgba(42, 42, 42, 0.65);
  --border-color: rgba(184, 181, 178, 0.15);

  /* 字体系统继承浅色主题设置 */
  
  /* Primary Accent (Light-tinted bright purple in dark mode) */
  --primary-accent-h: 265;
  --primary-accent-s: 55%;
  --primary-accent-l: 82%;
  --primary-accent: hsl(var(--primary-accent-h), var(--primary-accent-s), var(--primary-accent-l));
  --primary-accent-hover: hsl(var(--primary-accent-h), var(--primary-accent-s), calc(var(--primary-accent-l) + 8%));
  --primary-accent-light: hsl(var(--primary-accent-h), var(--primary-accent-s), calc(var(--primary-accent-l) + 12%));
  --primary-accent-transparent: hsla(var(--primary-accent-h), var(--primary-accent-s), var(--primary-accent-l), 0.3);
  --primary-accent-transparent-light: hsla(var(--primary-accent-h), var(--primary-accent-s), var(--primary-accent-l), 0.18);

  /* Secondary Accent (Light-tinted bright gold in dark mode) */
  --secondary-accent-h: 43;
  --secondary-accent-s: 75%;
  --secondary-accent-l: 78%;
  --secondary-accent: hsl(var(--secondary-accent-h), var(--secondary-accent-s), var(--secondary-accent-l));
  --secondary-accent-hover: hsl(var(--secondary-accent-h), var(--secondary-accent-s), calc(var(--secondary-accent-l) + 8%));
  --secondary-accent-light: hsl(var(--secondary-accent-h), var(--secondary-accent-s), calc(var(--secondary-accent-l) + 12%));
  --secondary-accent-transparent: hsla(var(--secondary-accent-h), var(--secondary-accent-s), var(--secondary-accent-l), 0.25);
  --secondary-accent-transparent-light: hsla(var(--secondary-accent-h), var(--secondary-accent-s), var(--secondary-accent-l), 0.12);
  
  /* Semantic Colors */
  --link-color: var(--primary-accent);
  --link-hover: var(--primary-accent-hover);
  --heading-color: var(--secondary-accent);
  --subheading-color: var(--primary-accent);
  
  /* UI 元素 - 岩石黑毛玻璃 */
  --menu-bg: rgba(26, 26, 26, 0.75);
  --menu-bg-glassy: rgba(42, 42, 42, 0.55);
  --menu-text: #f2f0ed;
  --menu-hover-bg: var(--primary-accent);
  --menu-hover-text: #1a1a1a;
  --card-bg-glassy: rgba(42, 42, 42, 0.02); /* 極度透明以顯示星星背景 */
  --glass-border: rgba(242, 240, 237, 0.18);
  --glass-shadow: rgba(0, 0, 0, 0.5);
  
  /* Shadows & Effects */
  --shadow-color: rgba(0, 0, 0, 0.25);
  --shadow-color-medium: rgba(0, 0, 0, 0.35);
  --shadow-color-strong: rgba(0, 0, 0, 0.45);
  --shadow-color-light: rgba(0, 0, 0, 0.15);
  --card-border-highlight: rgba(255, 255, 255, 0.12);
  
  /* Interactive Elements */
  --button-bg: var(--primary-accent);
  --button-text: #120E1A;
  --button-hover-bg: var(--primary-accent-hover);
  --button-shadow: 0 2px 8px var(--primary-accent-transparent);
  
  /* Code & Syntax */
  --code-bg: rgba(255, 255, 255, 0.1);
  --code-text: var(--text-color);
  --pre-bg: rgba(255, 255, 255, 0.05);
  
  /* Status Colors (adjusted for dark theme) */
  --success-color: #4caf50;
  --warning-color: #ff9800;
  --error-color: #f44336;
  --info-color: #2196f3;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, var(--primary-accent), var(--primary-accent-light));
  --gradient-secondary: linear-gradient(135deg, var(--secondary-accent), var(--secondary-accent-light));
  --gradient-mixed: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
}

/* ========================================================================
   全局樣式 | Global Styles
   ======================================================================== */

/* ===== 性能优化 | PERFORMANCE OPTIMIZATION ===== */
* {
  box-sizing: border-box;
}

/* 减少重绘和回流 */
*,
*::before,
*::after {
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* 优化动画性能 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* 全局动画性能优化 */
@keyframes rippleExpand {
  from {
    transform: scale(0);
    opacity: 0.6;
  }
  to {
    transform: scale(2);
    opacity: 0;
  }
}

/* 为动画元素添加GPU加速 */
.content-card,
.menu-item a,
.keyword-pill,
.social-icon,
.theme-toggle,
.cv-download-btn,
.link-btn {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ===== 基礎設置 | BASE SETTINGS ===== */
html {
  scroll-behavior: smooth;
  /* 实现92%整体缩放效果 */
  font-size: 14.72px; /* 16px * 0.92 = 14.72px */
}

body {
  font-family: var(--font-family-primary) !important;
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-normal);
  color: var(--text-color) !important;
  line-height: var(--line-height-normal);
  transition: var(--theme-transition);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  /* 性能优化 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

/* 移除水墨背景效果，為流星動畫讓路 */

/* 統一主題過渡效果 */
body.theme-transitioning {
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: background-color, color;
}

body.theme-transitioning *,
body.theme-transitioning *::before,
body.theme-transitioning *::after {
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background-image 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              text-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              filter 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              backdrop-filter 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  will-change: background-color, color, border-color, box-shadow;
}

/* 特殊元素的過渡控制 */
body.theme-transitioning .gradient-text {
  transition: background-image var(--theme-transition),
              -webkit-background-clip var(--theme-transition),
              background-clip var(--theme-transition),
              -webkit-text-fill-color var(--theme-transition) !important;
}

body.theme-transitioning .menu-toggle span,
body.theme-transitioning .menu-toggle span::before,
body.theme-transitioning .menu-toggle span::after {
  transition: background-color var(--theme-transition),
              transform var(--theme-transition-fast) !important;
}

/* 禁用某些元素的過渡以避免閃爍 */
body.theme-transitioning svg,
body.theme-transitioning img {
  transition: opacity var(--theme-transition),
              filter var(--theme-transition) !important;
}

/* 滾動進度條樣式優化 */
#scroll-progress {
  position: fixed;
  top: 57px; /* 与JavaScript中的设置一致 */
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
  z-index: 10000; /* 与JavaScript中的设置一致 */
  transition: width 0.1s ease-out;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 10px var(--primary-accent-transparent);
  pointer-events: none; /* 确保不会阻挡点击事件 */
}



p, li, td, dd {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-relaxed);
  color: var(--text-color);
  transition: var(--theme-transition);
}

/* ========================================================================
   流星動畫系統 | Meteor Animation System
   ======================================================================== */

/* ========================================================================
   6. 增強流星動畫系統 | ENHANCED METEOR ANIMATION SYSTEM
   ========================================================================

   這個系統實現了物理真實的流星動畫效果，包含：
   - 4種不同的軌跡類型（陡峭、淺弧、曲線、經典）
   - 重力模擬和拋物線運動
   - 動態頻率控制（1-3秒間隔）
   - 自適應尺寸變化
   - 高性能渲染優化

   This system implements physics-realistic meteor animations featuring:
   - 4 different trajectory types (steep, shallow, curved, classic)
   - Gravity simulation and parabolic motion
   - Dynamic frequency control (1-3 second intervals)
   - Adaptive size variations
   - High-performance rendering optimization
   ======================================================================== */



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

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ===== 增強動畫系統 | ENHANCED ANIMATION SYSTEM ===== */

/* 點擊漣漪動畫 */
@keyframes rippleExpand {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

/* 卡片進入動畫 */
.animate-in {
  animation: slideInUp 0.8s ease-out forwards;
}

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

/* 移除鼠標軌跡樣式，為流星動畫讓路 */

/* 移除不需要的波紋效果 */

/* 移除水墨畫布，為流星動畫讓路 */

/* 配合水墨效果的背景漸變 - 淺色主題 */
body {
  background: linear-gradient(135deg,
    rgba(213, 203, 225, 0.03) 0%,  /* #d5cbe1 淺紫灰 - 更透明 */
    rgba(52, 75, 94, 0.02) 30%,    /* #344b5e 深藍灰 - 更透明 */
    rgba(213, 203, 225, 0.015) 60%, /* 進一步透明 */
    rgba(52, 75, 94, 0.02) 100%     /* 保持一致的透明度 */
  );
  background-attachment: fixed;
  position: relative;
  overflow-x: hidden;
}

/* 暗色主題的背景漸變 - 岩石黑水墨風格 */
[data-theme="dark"] body {
  background: linear-gradient(135deg,
    rgba(26, 26, 26, 0.95) 0%,     /* #1a1a1a 岩石黑 */
    rgba(45, 45, 45, 0.92) 25%,    /* #2d2d2d 深灰 */
    rgba(30, 30, 30, 0.94) 50%,    /* #1e1e1e 暗灰 */
    rgba(37, 37, 37, 0.93) 75%,    /* #252525 中灰 */
    rgba(26, 26, 26, 0.95) 100%    /* #1a1a1a 岩石黑 */
  );
  background-attachment: fixed;
}

/* ===== 6.3 容器與控制 | CONTAINER & CONTROLS ===== */

/* ===== 6.2 優化星星閃爍背景樣式 | OPTIMIZED TWINKLING STARS BACKGROUND STYLES ===== */

/* 優化星星容器 */
.optimized-stars-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
  will-change: transform;
}

/* 高性能星星基礎樣式 - 使用GPU加速 */
.optimized-star {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: opacity, transform;
  backface-visibility: hidden;
  transform-origin: center;
}

/* 明亮星星動畫 - 高對比度 */
.star-bright {
  background: rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 8px rgba(255, 255, 255, 0.8),
    0 0 16px rgba(157, 117, 212, 0.6);
}

/* 暗淡星星動畫 - 基礎亮度 */
.star-dim {
  background: rgba(157, 117, 212, 0.7);
  box-shadow: 0 0 4px rgba(157, 117, 212, 0.4);
}

/* 脈衝星星動畫 - 中等亮度 */
.star-pulse {
  background: rgba(157, 117, 212, 0.8);
  box-shadow:
    0 0 6px rgba(157, 117, 212, 0.6),
    0 0 12px rgba(157, 117, 212, 0.3);
}

/* 靜態星星 - 純CSS動畫，性能友好 */
.star-static {
  background: rgba(157, 117, 212, 0.6);
  box-shadow: 0 0 3px rgba(157, 117, 212, 0.4);
  animation: twinkle-static 4s ease-in-out infinite;
  animation-delay: var(--star-delay, 0s);
}

/* 高性能CSS動畫關鍵幀 */
@keyframes twinkle-bright {
  0%, 100% {
    opacity: 0.2;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}

@keyframes twinkle-dim {
  0%, 100% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(0.8);
  }
}

@keyframes twinkle-pulse {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.9;
  }
}

/* 靜態星星動畫 - 輕量級CSS動畫 */
@keyframes twinkle-static {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  25% {
    opacity: 0.7;
    transform: scale(1.1);
  }
  75% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

/* 減少動畫偏好設置支持 */
@media (prefers-reduced-motion: reduce) {
  .optimized-star {
    animation: none !important;
    opacity: 0.5;
  }
}

/* 點擊漣漪效果 */
.click-ripple {
  position: fixed;
  border: 2px solid var(--primary-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  animation: rippleExpand 0.6s ease-out forwards;
}

/* ========================================================================
   排版系統 | Typography System
   ======================================================================== */

/* ===== 標題和文字樣式 | HEADINGS AND TEXT STYLES ===== */
#toptitle h1 {
  font-family: var(--font-family-primary);
  font-size: 3rem; /* 特殊主标题保持较大 */
  font-weight: var(--font-weight-extrabold);
  color: var(--heading-color);
  line-height: var(--line-height-tight);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 3px solid var(--secondary-accent);
  text-shadow: 1px 1px 3px var(--shadow-color-light),
               0 0 10px var(--primary-accent-transparent);
}

/* 统一标题系统 */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-primary);
  color: var(--heading-color);
  line-height: var(--line-height-tight);
  margin-top: 0.8rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.1em;
  font-weight: var(--font-weight-bold);
}

h1 {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  border-bottom: 2px solid var(--secondary-accent);
}

h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  border-bottom: 2px solid var(--secondary-accent);
  padding-bottom: 0.3em;
  text-shadow: 1px 1px 2px var(--shadow-color-light),
               0 0 8px var(--secondary-accent-transparent);
}

h3 {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  border-bottom: none;
}

h4 {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-semibold);
  color: var(--subheading-color);
}

/* Reduce space if we begin the page with a title */
div#toptitle + h2, div#toptitle + h3 {
  margin-top: -0.7em;
}

div#toptitle {
  padding-bottom: 0.1em;
  margin-bottom: 1em;
}

div#toptitle h1, #layout-content div#toptitle h1 {
  margin-bottom: 0.0em;
  padding-bottom: 0.05em;
  padding-top: 0;
  margin-top: 0.3em;
  border-bottom: none;
}

/* ===== 增強主標題區域 | ENHANCED HERO TITLE SECTION ===== */
.hero-title {
  margin-bottom: 0.6rem;
  text-align: center;
  position: relative;
  padding: 0.8rem 0;
}

.title-container {
  position: relative;
  display: inline-block;
}

.main-title {
  font-family: var(--font-family-primary);
  font-size: 2.8rem;
  font-weight: var(--font-weight-bold);
  margin: 0;
  line-height: var(--line-height-tight);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}

.title-english {
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.02em;
  text-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.title-chinese {
  background: linear-gradient(135deg, var(--secondary-accent), var(--primary-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-family: var(--font-family-secondary);
  font-weight: var(--font-weight-semibold);
  font-size: 0.9em;
  letter-spacing: 0.1em;
}

.title-subtitle {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-body);
  color: var(--text-secondary-color);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-normal);
}

.subtitle-text {
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.subtitle-divider {
  color: var(--primary-accent);
  font-weight: 600;
}

.hero-title:hover .subtitle-text {
  opacity: 1;
}

/* ===== 社交媒體圖標 | SOCIAL MEDIA ICONS ===== */
.social-icons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.8rem;
  padding: 0.5rem;
}

.social-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--card-bg-glassy);
  backdrop-filter: blur(15px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-color);
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease; /* 简化过渡 */
  box-shadow: 0 2px 8px var(--glass-shadow);
  will-change: transform; /* GPU加速 */
}

.social-icon svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
}

.social-icon:hover {
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  color: #1a1a1a;
  transform: translateY(-2px) scale(1.05); /* 减少移动和缩放 */
  border-color: transparent;
}

div#subtitle {
  margin-top: 0.0em;
  margin-bottom: 0.0em;
  padding-top: 0em;
  padding-bottom: 0.1em;
}

em {
  font-style: italic;
}

strong {
  font-weight: bold;
}

p {
  margin-top: 0.0em;
  margin-bottom: 0.5em;
  padding: 0;
}

pre {
  padding: 0;
  margin: 0;
  font-size: 90%;
  font-family: monaco, monospace;
}

tt {
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 90%;
  font-family: monaco, monospace;
  transition: var(--theme-transition);
}

/* ===== LINKS ===== */
a, a > tt {
  color: var(--link-color);
  text-decoration: none;
  transition: var(--theme-transition);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ========================================================================
   佈局系統 | Layout System
   ======================================================================== */

/* ===== 主要佈局結構 | MAIN LAYOUT STRUCTURE ===== */
#page-container {
  position: relative;
  min-height: 100vh;
  width: 100%;
  background: transparent;
}

/* ===== 頂部導航欄重構 | TOP NAVIGATION REFACTORED ===== */
.top-nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 65px;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(30px) saturate(200%) brightness(1.2);
  -webkit-backdrop-filter: blur(30px) saturate(200%) brightness(1.2);
  border: none;
  z-index: 10000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  box-shadow:
    0 4px 20px rgba(52, 75, 94, 0.1),
    0 2px 8px rgba(213, 203, 225, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: var(--theme-transition);
}

.top-nav-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(213, 203, 225, 0.03) 0%,
    transparent 50%,
    rgba(52, 75, 94, 0.02) 100%);
  pointer-events: none;
}

/* Navigation controls container */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* 移除顶部导航栏装饰线 */
/* .top-nav-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
  opacity: 0.9;
} */

.nav-title {
  font-family: var(--font-family-primary);
  font-size: 1.1rem;
  font-weight: var(--font-weight-semibold);
  color: var(--text-color);
  text-decoration: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  transition: var(--theme-transition);
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  min-width: 120px;
}

.nav-left {
  justify-content: flex-start;
}

.nav-right {
  justify-content: flex-end;
  gap: 12px;
}

/* ===== MENU TOGGLE BUTTON ===== */
#menu-toggle-btn {
  display: none;
  background: var(--card-bg-glassy);
  backdrop-filter: blur(15px) saturate(1.2);
  -webkit-backdrop-filter: blur(15px) saturate(1.2);
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--shadow-color), inset 0 1px 0 var(--card-border-highlight);
  border: 1px solid var(--border-color);
  cursor: pointer;
  width: 36px;
  height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10001; /* Above top nav */
  gap: 4px;
}

#menu-toggle-btn:hover {
  transform: translateY(-2px);
  background: var(--content-bg);
  border-color: var(--border-color);
  box-shadow: 0 6px 20px var(--shadow-color-medium), inset 0 1px 0 var(--card-border-highlight);
}



#menu-toggle-btn span {
  display: block;
  height: 2px;
  width: 18px;
  background: var(--text-secondary-color);
  border-radius: 1px;
  transition: var(--theme-transition);
}

#menu-close-btn {
  display: none;
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 1.8rem;
  font-weight: 300;
  line-height: 1;
  color: var(--text-color);
  cursor: pointer;
  z-index: 1100;
  transition: color 0.2s;
}

#menu-close-btn:hover {
  color: var(--text-color);
}

/* ===== LANGUAGE SWITCH ===== */
.language-switch {
  background: var(--card-bg-glassy);
  backdrop-filter: blur(15px) saturate(1.2);
  -webkit-backdrop-filter: blur(15px) saturate(1.2);
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: 0 4px 12px var(--shadow-color), inset 0 1px 0 var(--card-border-highlight);
  border: 1px solid var(--border-color);
  transition: var(--theme-transition);
  height: 36px;
  display: flex;
  align-items: center;
  cursor: pointer;
  min-width: auto;
  text-align: center;
  white-space: nowrap;
}

.language-switch:hover {
  transform: translateY(-2px);
  background: var(--content-bg);
  border-color: var(--border-color);
  box-shadow: 0 6px 20px var(--shadow-color-medium), inset 0 1px 0 var(--card-border-highlight);
}

.language-switch a {
  font-family: var(--font-family-primary);
  color: var(--text-color);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-small);
  text-decoration: none;
  transition: all 0.2s ease;
}

.language-switch a:hover {
  color: var(--primary-accent);
  text-decoration: none;
  text-shadow: 0 0 5px var(--primary-accent-transparent);
}

/* ===== 主題切換按鈕 - 中國風設計 | THEME TOGGLE - CHINESE STYLE ===== */
.theme-toggle {
  background: var(--card-bg-glassy);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  padding: 8px;
  border-radius: 50%;
  box-shadow:
    0 4px 16px var(--glass-shadow),
    0 0 0 1px var(--glass-border),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease; /* 简化过渡 */
  will-change: transform; /* GPU加速 */
}

.theme-toggle:hover {
  transform: translateY(-1px) scale(1.02); /* 减少移动和缩放 */
  box-shadow:
    0 4px 16px var(--primary-accent-transparent),
    0 0 0 1px var(--primary-accent),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.theme-toggle:active {
  transform: translateY(0) scale(0.98);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--text-color);
  transition: all 0.3s ease;
  display: none;
}

.theme-toggle:hover svg {
  fill: var(--text-color);
  opacity: 0.8;
}

/* Theme toggle icon visibility - 亮色主題顯示太陽，暗色主題顯示月亮 */
html[data-theme='light'] .theme-toggle .sun-icon,
html:not([data-theme='dark']) .theme-toggle .sun-icon {
  display: block;
}

html[data-theme='dark'] .theme-toggle .moon-icon {
  display: block;
}

html[data-theme='dark'] .theme-toggle .sun-icon,
html:not([data-theme='dark']) .theme-toggle .moon-icon {
  display: none;
}

/* ===== 側邊欄菜單重構 | SIDEBAR MENU REFACTORED ===== */
#layout-menu {
  position: fixed;
  top: 65px; /* Match new top nav height */
  left: 0;
  width: 280px;
  height: calc(100vh - 65px);
  padding: 0;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(30px) saturate(200%) brightness(1.15);
  -webkit-backdrop-filter: blur(30px) saturate(200%) brightness(1.15);
  box-shadow:
    4px 0 24px rgba(52, 75, 94, 0.12),
    2px 0 12px rgba(213, 203, 225, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border: none;
  z-index: 9000; /* High z-index but below top nav */
  overflow-y: auto;
  overflow-x: hidden;
  transition: var(--theme-transition);
  display: flex;
  flex-direction: column;
}

/* 移除侧边栏装饰线 */
/* #layout-menu::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
  opacity: 0.8;
  z-index: 1;
} */

#layout-menu td {
  background: transparent;
  vertical-align: top;
}

#layout-menu a {
  line-height: 1.5em;
  margin-left: 0.5em;
  color: var(--menu-text);
  text-decoration: none;
}

#layout-menu a.current:link, #layout-menu a.current:visited {
  color: var(--primary-accent);
  border-bottom: 1px solid var(--primary-accent);
}

#layout-menu a:link, #layout-menu a:visited, #layout-menu a:hover {
  color: var(--menu-text);
  text-decoration: none;
}

#layout-menu a:hover {
  color: var(--link-hover);
  text-decoration: none;
}

/* ===== MENU STYLES ===== */
.menu-category {
  user-select: none;
  font-family: var(--font-family-primary);
  font-weight: var(--font-weight-bold);
  font-size: 1.2em;
  color: var(--text-color);
  margin-bottom: 0.6em;
  padding: 12px 15px 0.3em 15px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.menu-category-title {
  font-family: var(--font-family-primary);
  padding: 0.4em 10px 0.15em;
  display: block;
  color: var(--text-secondary-color);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  font-size: var(--font-size-xs);
  letter-spacing: 0.5px;
}

div.menu-item {
  padding-left: 0;
  text-indent: 0;
  padding-right: 5px;
}

/* ===== SCROLLABLE MENU ITEMS ===== */
#menu-items {
  flex: 1;
  overflow-y: auto;
  padding: 0 15px 80px 15px; /* 底部留出空间给 copyright */
  margin-bottom: 0;
  transition: all 0.3s ease;
}

/* Auto-scroll based on height */
@media (max-height: 800px) {
  #menu-items {
    overflow-y: auto;
  }
}

@media (min-height: 801px) {
  #menu-items {
    overflow-y: visible;
  }
  
  #layout-menu {
    overflow-y: visible;
  }
}

#menu-items .menu-item a {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 6px 16px;
  border-radius: 12px;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-small);
  color: var(--menu-text);
  font-weight: var(--font-weight-medium);
  margin-bottom: 4px;
  white-space: normal;
  line-height: var(--line-height-normal);
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-align: left;
  transition: background-color 0.15s ease, transform 0.15s ease; /* 简化过渡 */
  position: relative;
  will-change: transform; /* GPU加速 */
}

#menu-items .menu-item a:hover {
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  color: #1a1a1a;
  text-decoration: none;
  transform: translateX(4px); /* 减少移动距离 */
}

#menu-items .menu-item a.current {
  background: linear-gradient(135deg, var(--secondary-accent), var(--primary-accent));
  color: #1a1a1a;
}

#menu-items .menu-item a.current:hover {
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  transform: translateX(4px); /* 减少移动距离 */
}

.menu-icon {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  flex-shrink: 0;
}

/* ===== 優化側邊欄控制項排版 | OPTIMIZED SIDEBAR CONTROLS ===== */

.menu-control-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-small);
  color: var(--text-secondary-color);
  transition: all 0.3s ease;
  margin: 0;
  border: none;
  background: transparent;
}

.menu-control-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-color);
}

.control-label {
  font-family: var(--font-family-primary);
  color: var(--text-color);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-small);
  opacity: 0.8;
}

.language-link {
  font-family: var(--font-family-primary);
  color: var(--primary-accent);
  text-decoration: none;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-xs);
  padding: 0.3rem 0.8rem;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-accent-transparent), var(--secondary-accent-transparent));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-link:hover {
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  color: #1a1a1a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--primary-accent-transparent);
}

.theme-toggle-sidebar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--card-bg-glassy);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  box-shadow:
    0 4px 16px var(--glass-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.theme-toggle-sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.theme-toggle-sidebar:hover::before {
  left: 100%;
}

.theme-toggle-sidebar svg {
  width: 18px;
  height: 18px;
  fill: var(--text-color);
  transition: all 0.3s ease;
  z-index: 1;
}

.theme-toggle-sidebar:hover {
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  border-color: var(--primary-accent);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 12px var(--primary-accent-transparent);
}

.theme-toggle-sidebar:hover svg {
  fill: #1a1a1a;
  transform: rotate(180deg);
}

/* Theme toggle icon visibility for sidebar - 亮色主題顯示太陽，暗色主題顯示月亮 */
html[data-theme='light'] .theme-toggle-sidebar .sun-icon,
html:not([data-theme='dark']) .theme-toggle-sidebar .sun-icon {
  display: block;
}

html[data-theme='dark'] .theme-toggle-sidebar .moon-icon {
  display: block;
}

html[data-theme='dark'] .theme-toggle-sidebar .sun-icon,
html:not([data-theme='dark']) .theme-toggle-sidebar .moon-icon {
  display: none;
}

/* ===== 重新設計的版權區域 | REDESIGNED COPYRIGHT SECTION ===== */
.menu-copyright {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.6rem;
  background: linear-gradient(135deg, var(--menu-bg-glassy), var(--primary-accent-transparent-light));
  backdrop-filter: blur(25px) saturate(200%);
  border-top: 1px solid var(--primary-accent-transparent);
  font-family: var(--font-family-primary);
  font-size: var(--font-size-xs);
  color: var(--text-secondary-color);
  text-align: center;
  overflow: hidden;
}

.menu-copyright::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary-accent), transparent);
  /* 移除shimmer動畫 */
}

/* ===== 頁面底部版權信息 | PAGE FOOTER COPYRIGHT ===== */
.page-footer {
  margin-top: 2rem;
  padding: 1.2rem 0;
  background: var(--card-bg-glassy);
  backdrop-filter: blur(15px) saturate(150%);
  border-top: 1px solid var(--glass-border);
  text-align: center;
}

.footer-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1rem;
}

.footer-content p {
  font-family: var(--font-family-primary);
  margin: 0.3rem 0;
  font-size: var(--font-size-small);
  color: var(--text-color);
  opacity: 0.7;
  line-height: var(--line-height-normal);
}

.footer-content p:first-child {
  font-weight: var(--font-weight-semibold);
  opacity: 0.9;
  margin-bottom: 0.6rem;
}

.menu-copyright p {
  margin: 0;
  line-height: 1.4;
}

.menu-copyright p + p {
  margin-top: 4px;
}

/* ===== LAYOUT CONTENT ===== */
#layout-content {
  margin-left: 290px; /* Optimized spacing from sidebar */
  margin-top: 70px; /* Match new top nav height */
  margin-right: 1rem;
  margin-bottom: 1rem;
  padding: 0.5rem 2rem; /* 减少上下padding，保持左右padding */
  min-height: calc(100vh - 70px);
  transition: all 0.3s ease-in-out;
  background-color: transparent;
  border: none;
  text-align: left;
  vertical-align: top;
  position: relative;
  z-index: 1;
}

/* 隱藏主內容區域的滾動條 */
body {
  overflow-x: hidden;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

body::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

html {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

html::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Reduce spacing between all headings and content for denser layout */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 0.5rem; /* Further reduced from default */
  margin-top: 0.8rem; /* Further reduced from default */
}

h1 + *, h2 + *, h3 + *, h4 + *, h5 + *, h6 + * {
  margin-top: 0.5rem; /* Tighter spacing after headings */
}

/* ===== 內容卡片 - 增強毛玻璃效果 | CONTENT CARDS - ENHANCED GLASSMORPHISM ===== */
.content-card {
  background: var(--card-bg-glassy);
  backdrop-filter: blur(8px) saturate(110%) brightness(1.02);
  -webkit-backdrop-filter: blur(8px) saturate(110%) brightness(1.02);
  border-radius: 16px;
  padding: 14px 12px;
  margin-bottom: 0.4rem;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.1),
    0 6px 20px rgba(52, 75, 94, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
  overflow: hidden;
  /* 超高性能GPU加速優化 */
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  perspective: 1000px;
  contain: layout style paint;
}

/* 简化的背景效果 - 移除复杂动画以提升性能 */
.content-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(213, 203, 225, 0.08) 0%,
    transparent 50%,
    rgba(52, 75, 94, 0.05) 100%);
  pointer-events: none;
  z-index: -1;
}

.content-card:hover {
  transform: translate3d(0, -4px, 0); /* GPU加速的3D變換 */
  box-shadow:
    0 12px 35px rgba(0, 0, 0, 0.18),
    0 6px 15px rgba(52, 75, 94, 0.12),
    0 0 0 1px var(--primary-accent-transparent);
}

/* 動畫進入狀態 */
.content-card.animate-in {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) !important;
}

/* 移除复杂的伪元素动画以提升性能 */

/* 嵌套卡片透明度增強 */
.content-card .content-card {
  background: rgba(255, 255, 255, 0.08); /* 嵌套卡片更透明 */
  backdrop-filter: blur(15px) saturate(150%);
  -webkit-backdrop-filter: blur(15px) saturate(150%);
}

[data-theme="dark"] .content-card .content-card {
  background: rgba(42, 42, 42, 0.1); /* 深色主題嵌套卡片 */
}

/* 增強毛玻璃效果的輔助元素 */
.glassmorphism-enhanced {
  background: rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(40px) saturate(300%) brightness(1.2) !important;
  -webkit-backdrop-filter: blur(40px) saturate(300%) brightness(1.2) !important;
}

/* ===== CONTENT ITEM STYLES ===== */
.education-item,
.publication-item,
.project-item,
.experience-item,
.other-experience-item,
.award-category,
.skill-category {
  padding-left: 1.2rem;
  border-left: 4px solid var(--primary-accent);
  margin-bottom: 0.8rem; /* 减少底部间距 */
  position: relative;
  transition: border-left-color 0.3s ease;
}

.education-item:hover,
.publication-item:hover,
.project-item:hover,
.experience-item:hover,
.other-experience-item:hover,
.award-category:hover,
.skill-category:hover {
  border-left-color: var(--secondary-accent);
}

/* Specific border colors for differentiation */
.education-item {
  border-left-color: var(--secondary-accent);
}

.publication-item {
  border-left-color: var(--primary-accent);
}

.project-item {
  border-left-color: var(--secondary-accent);
}

.experience-item {
  border-left-color: var(--primary-accent);
}

.other-experience-item {
  border-left-color: var(--secondary-accent);
}

.award-category {
  border-left-color: var(--primary-accent);
}

.skill-category {
  border-left-color: var(--secondary-accent);
}

/* ===== LISTS ===== */
ul, ol, dl {
  margin-top: 0.1em;
  padding-top: 0;
  margin-bottom: 0.5em;
  padding-left: 20px;
}

dt {
  margin-top: 0.3em;
  margin-bottom: 0;
}

dl {
  margin-left: 20px;
}

dd {
  color: var(--text-color);
}

dd > *:first-child {
  margin-top: 0;
}

ul {
  list-style-position: outside;
  list-style-type: square;
}

p + ul, p + ol {
  margin-top: -0.3em;
}

li ul, li ol {
  margin-top: -0.2em;
}

ol {
  list-style-position: outside;
  list-style-type: decimal;
}

li p, dd p {
  margin-bottom: 0.2em;
}

ol ol {
  list-style-type: lower-alpha;
}

ol ol ol {
  list-style-type: lower-roman;
}

/* ===== TABLES ===== */
table {
  border: 2px solid black;
  border-collapse: collapse;
}

td {
  padding: 2px;
  padding-left: 0.5em;
  padding-right: 0.5em;
  text-align: center;
  border: 1px solid gray;
}

table + table {
  margin-top: 1em;
}

tr.heading {
  font-weight: bold;
  border-bottom: 2px solid black;
}

table.imgtable, table.imgtable td {
  border: none;
  text-align: left;
  padding-right: 2em;
}

/* ===== IMAGES ===== */
img {
  border: none;
}

img.eq {
  padding: 0;
  padding-left: 0.1em;
  padding-right: 0.1em;
  margin: 0;
}

img.eqwl {
  padding-left: 2em;
  padding-top: 0.6em;
  padding-bottom: 0.2em;
  margin: 0;
}

/* ===== CODE BLOCKS ===== */
p + div.codeblock {
  margin-top: -0.6em;
}

div.codeblock, div.infoblock {
  margin-right: 0%;
  margin-top: 1.2em;
  margin-bottom: 1.3em;
}

div.blocktitle {
  font-weight: bold;
  color: #cd7b62;
  margin-top: 1.2em;
  margin-bottom: 0.1em;
}

div.blockcontent {
  border: 1px solid silver;
  padding: 0.3em 0.5em;
}

div.infoblock > div.blockcontent {
  background: #ffffee;
}

div.blockcontent p + ul, div.blockcontent p + ol {
  margin-top: 0.4em;
}

div.infoblock p {
  margin-bottom: 0em;
}

div.infoblock li p, div.infoblock dd p {
  margin-bottom: 0.5em;
}

div.infoblock p + p {
  margin-top: 0.8em;
}

div.codeblock > div.blockcontent {
  background: #f6f6f6;
}

/* ===== CODE SYNTAX HIGHLIGHTING ===== */
span.pycommand {
  color: #000070;
}

span.statement {
  color: #008800;
}

span.builtin {
  color: #000088;
}

span.special {
  color: #990000;
}

span.operator {
  color: #880000;
}

span.error {
  color: #aa0000;
}

span.comment, span.comment > *, span.string, span.string > * {
  color: #606060;
}

/* ===== BUTTONS AND LINKS ===== */
.link-btn {
  display: inline-block;
  padding: 8px 16px;
  background-color: var(--primary-accent);
  font-family: var(--font-family-primary);
  color: white !important;
  text-decoration: none;
  border-radius: 8px;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.link-btn:hover {
  background-color: var(--secondary-accent);
  color: #121212 !important;
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.cv-download {
  margin-top: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.cv-download-btn {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
  font-family: var(--font-family-primary);
  color: white;
  text-decoration: none;
  border-radius: 12px;
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-small);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.cv-download-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.cv-download-btn:hover::before {
  left: 100%;
}

.cv-download-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  color: white;
  text-decoration: none;
}

.cv-download-btn i {
  margin-right: 10px;
  font-size: 1.1rem;
}

/* ===== PROFILE CARD ===== */
.profile-card {
  margin-bottom: 0.4rem; /* 与其他content-card保持一致的间距 */
}

.profile-header {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.profile-image {
  flex-shrink: 0;
}

.profile-image img {
  width: 160px;
  height: 240px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-image img:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

.profile-basic-info {
  flex: 1;
  background: var(--content-bg);
  padding: 0.8rem; /* 统一padding，与其他profile卡片保持一致 */
  border-radius: 10px;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* Remove scrollbar - let content display at natural height */
  overflow: visible;
  height: auto;
  min-height: auto;
  max-height: none;
}

.profile-basic-info h2 {
  font-family: var(--font-family-primary);
  margin-top: 0;
  margin-bottom: 0.5rem;
  margin-left: -0.8rem;
  margin-right: -0.8rem;
  padding-left: 0.8rem;
  padding-right: 0.8rem;
  color: var(--heading-color);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  border-bottom: 2px solid var(--primary-accent);
  padding-bottom: 0.3rem;
}

.basic-info {
  font-family: var(--font-family-primary);
  line-height: var(--line-height-normal);
  margin-bottom: 0.5rem;
  color: var(--text-color);
  font-weight: var(--font-weight-medium);
}

.contact-info {
  margin-bottom: 0;
  padding: 0.6rem 0.8rem; /* 与其他profile卡片保持一致的左右padding */
  background: var(--card-bg-glassy);
  backdrop-filter: blur(15px) saturate(150%);
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 16px var(--glass-shadow);
}

.contact-item {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  padding: 0.3rem 0;
  transition: var(--theme-transition);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.contact-item:last-child {
  margin-bottom: 0;
}

.contact-label {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-small);
  color: var(--text-secondary-color);
  min-width: 80px;
  font-weight: var(--font-weight-medium);
  flex-shrink: 0; /* 防止標籤被壓縮 */
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}

.email-link, .phone-link {
  font-family: var(--font-family-primary);
  color: var(--primary-accent);
  text-decoration: none;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  transition: var(--bounce-transition);
  position: relative;
  overflow: hidden;
  word-break: break-all; /* 允許長郵件地址斷行 */
  hyphens: auto;
}

.email-link::before, .phone-link::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary-accent), var(--secondary-accent));
  transition: width 0.3s ease;
}

.email-link:hover, .phone-link:hover {
  color: var(--secondary-accent);
  transform: translateX(4px);
}

.email-link:hover::before, .phone-link:hover::before {
  width: 100%;
}

.contact-info a {
  font-family: var(--font-family-primary);
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.3s ease;
  font-weight: var(--font-weight-medium);
}

.contact-info a:hover {
  color: var(--link-hover);
}

.profile-description {
  line-height: 1.5; /* Reduced for denser layout */
  background: var(--content-bg);
  padding: 0.6rem 0.8rem; /* 进一步减少上下padding，保持左右padding */
  border-radius: 10px;
  border: 1px solid var(--border-color);
  margin-bottom: 0.6rem; /* 进一步减少底部间距 */
}

.profile-description p {
  margin-bottom: 0.6rem;
  text-align: justify;
}

.research-interests {
  background: var(--content-bg);
  padding: 0.6rem 0.8rem; /* 进一步减少上下padding，保持左右padding */
  border-radius: 10px;
  border: 1px solid var(--border-color);
}

.research-interests h3 {
  font-family: var(--font-family-primary);
  margin-top: 0;
  margin-bottom: 0.6rem;
  color: var(--heading-color);
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  border-bottom: 2px solid var(--secondary-accent);
  padding-bottom: 0.3rem;
}

.keywords-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ===== 關鍵詞標籤 - 水墨風格 | KEYWORDS - INK STYLE ===== */
.keyword-pill {
  display: inline-block;
  background: var(--card-bg-glassy);
  backdrop-filter: blur(10px) saturate(150%);
  font-family: var(--font-family-primary);
  color: var(--text-color);
  border: 1px solid var(--glass-border);
  padding: 0.5rem 1.2rem;
  border-radius: 25px;
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  transition: background-color 0.2s ease, transform 0.2s ease; /* 简化过渡 */
  box-shadow: 0 2px 8px var(--glass-shadow);
  margin: 3px;
  cursor: pointer;
  will-change: transform; /* GPU加速 */
}

.keyword-pill:hover {
  background: var(--primary-accent);
  color: #1a1a1a;
  transform: translateY(-2px) scale(1.05); /* 减少移动和缩放 */
  border-color: var(--primary-accent);
}

.keyword-pill:nth-child(even):hover {
  background: var(--secondary-accent);
  transform: translateY(-2px) scale(1.05); /* 减少移动和缩放 */
}

.keyword-list {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.personal-info-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.personal-info-wrapper > p {
  margin: 0;
}

.keywords-container {
  flex-shrink: 0;
  width: 400px;
}

/* ===== RESPONSIVE DESIGN FOR PROFILE ===== */
@media (max-width: 1024px) {
  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.2rem;
  }
  
  .profile-image {
    align-self: center;
  }
  
  .profile-basic-info {
    width: 100%;
    height: auto;
  }
  
  .keywords-grid {
    justify-content: center;
  }
  
  .profile-basic-info,
  .profile-description,
  .research-interests {
    text-align: left;
  }
}

@media (max-width: 768px) {
  /* 响应式字体缩放 */
  html {
    font-size: 13.76px; /* 14.72px * 0.935 进一步缩放 */
  }

  .profile-image img {
    width: 140px;
    height: 200px;
  }

  .profile-basic-info {
    padding: 20px; /* 與content-card在平板上的padding一致 */
  }

  .profile-basic-info h2 {
    font-size: var(--font-size-h2);
    margin-left: -20px; /* 調整為與新padding一致 */
    margin-right: -20px;
    padding-left: 20px;
    padding-right: 20px;
  }

  .research-interests h3 {
    font-size: var(--font-size-h3);
  }

  .contact-info {
    font-size: 0.9rem;
  }

  /* 移動設備上的聯絡信息響應式布局 - 完全優化版 */
  .contact-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.3rem;
  }

  .contact-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
  }

  .contact-label {
    min-width: auto;
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color-secondary);
    display: block;
    width: 100%;
  }

  .contact-links {
    flex-direction: column;
    gap: 0.4rem;
    align-items: flex-start;
    width: 100%;
  }

  .email-link, .phone-link {
    font-size: 0.85rem;
    display: block;
    margin: 0;
    padding: 0.3rem 0.5rem;
    word-break: break-word;
    line-height: 1.4;
    max-width: 100%;
    overflow-wrap: break-word;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    width: calc(100% - 1rem);
    box-sizing: border-box;
  }

  .email-link:hover, .phone-link:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-accent);
    transform: translateX(0);
  }

  .email-link:active, .phone-link:active {
    transform: scale(0.98);
  }

  .profile-basic-info {
    padding: 12px; /* 與content-card在移動設備上的padding一致 */
  }

  .profile-description,
  .research-interests {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  /* 小屏幕进一步缩放 */
  html {
    font-size: 12.8px; /* 14.72px * 0.87 更小的缩放 */
  }

  .profile-header {
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .profile-image img {
    width: 120px;
    height: 180px;
  }

  .keyword-pill {
    font-size: var(--font-size-xs);
    padding: 0.3rem 0.7rem;
  }

  .profile-basic-info,
  .profile-description,
  .research-interests {
    padding: 0.8rem;
  }

  .profile-basic-info h2 {
    font-size: var(--font-size-h2);
    margin-left: -12px; /* 調整為與新padding一致 */
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .research-interests h3 {
    font-size: var(--font-size-h3);
  }
}

/* ===== SKILL TAGS ===== */
.skills-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.skill-tag {
  display: inline-block;
  background: var(--secondary-accent-transparent-light);
  color: var(--text-color);
  padding: 0.6em 1.2em;
  margin: 0.3em;
  border-radius: 25px;
  font-size: 0.9em;
  font-weight: 500;
  border: 1px solid var(--secondary-accent-transparent);
  transition: all 0.3s ease;
  box-shadow: 0 2px 5px var(--shadow-color-light);
}

.skill-tag:hover {
  background: var(--gradient-mixed);
  color: var(--button-text);
  border-color: transparent;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 4px 10px var(--primary-accent-transparent), 0 2px 5px var(--secondary-accent-transparent);
}

/* ===== NOTES AND SPECIAL TEXT ===== */
.co-author-note {
  background-color: var(--primary-accent-transparent);
  color: var(--text-color);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 500;
}

.note {
  font-size: 0.9rem;
  color: var(--text-secondary-color);
  margin-top: 1rem;
  font-style: italic;
}

.note-text {
  color: #dc3545;
  font-size: 0.85rem;
  font-style: italic;
  margin-top: 0.5rem;
}

.position {
  font-family: var(--font-family-primary);
  color: var(--text-tertiary-color);
  font-weight: var(--font-weight-medium);
  margin-bottom: 0.3rem;
  font-size: var(--font-size-body);
}

.duration {
  font-family: var(--font-family-primary);
  color: var(--text-secondary-color);
  font-size: var(--font-size-small);
  margin-bottom: 0.5rem;
  font-style: italic;
}

.award-date {
  color: var(--text-secondary-color);
  font-size: 0.9rem;
  font-style: italic;
  margin-left: 1rem;
}

/* ===== SPECIFIC SECTIONS ===== */
.course-categories {
  margin-top: 1rem;
}

.course-categories ul {
  margin-left: 1rem;
}

.course-categories li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.reference-links {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary-color);
}

.research-section {
  margin-bottom: 1.2rem;
}

.research-section h3 {
  color: var(--heading-color);
  font-size: 1.4rem;
  margin-bottom: 0.6rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0.3rem;
}

.publication-list {
  margin-top: 0.6rem;
}

.publication-item {
  margin-bottom: 0.8rem;
  padding: 0.8rem 1.2rem; /* 减少上下padding，保持左右padding */
  background-color: var(--content-bg);
  border-radius: 8px;
  border-left: 4px solid var(--secondary-accent);
  border: 1px solid var(--border-color);
}

.publication-item p {
  margin-bottom: 0.6rem;
  line-height: 1.6;
}

.publication-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.academic-participation {
  margin-top: 0.6rem;
}

.academic-participation h4 {
  color: var(--heading-color);
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.academic-participation ul {
  margin-left: 1rem;
}

.academic-participation li {
  margin-bottom: 0.3rem;
}

.project-list {
  margin-top: 0.6rem;
}

.project-item {
  margin-bottom: 0.8rem;
  padding: 0.8rem 1.2rem; /* 减少上下padding，保持左右padding */
  background-color: var(--content-bg);
  border-radius: 8px;
  border-left: 4px solid var(--primary-accent);
  border: 1px solid var(--border-color);
}

.project-item h4 {
  font-family: var(--font-family-primary);
  color: var(--heading-color);
  font-size: var(--font-size-h4);
  margin-bottom: 0.6rem;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.project-info {
  font-family: var(--font-family-primary);
  color: var(--text-secondary-color);
  font-size: var(--font-size-small);
  margin-bottom: 0.6rem;
  padding: 0.3rem 0.5rem; /* 减少上下padding，保持左右padding */
  background-color: var(--border-color);
  border-radius: 4px;
}

.project-item p {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

.experience-list {
  list-style-type: none;
  padding-left: 0;
  color: var(--text-color);
}

.experience-list li,
.experience-list p {
  color: var(--text-color);
}

.experience-item {
  margin-bottom: 0.6rem; /* 进一步缩小间距 */
  padding: 0.6rem 1rem; /* 减少上下padding，保持左右padding */
  background-color: var(--content-bg);
  border-radius: 8px;
  border-left: 4px solid var(--secondary-accent);
  border: 1px solid var(--border-color);
}

.experience-item h4 {
  font-family: var(--font-family-primary);
  color: var(--heading-color);
  font-size: var(--font-size-h4);
  margin-bottom: 0.3rem;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.other-experience-list {
  margin-top: 0.6rem;
}

.other-experience-item {
  margin-bottom: 0.6rem; /* 进一步缩小间距 */
  padding: 0.6rem 1rem; /* 减少上下padding，保持左右padding */
  background-color: var(--content-bg);
  border-radius: 8px;
  border-left: 4px solid var(--primary-accent);
  border: 1px solid var(--border-color);
}

.other-experience-item h4 {
  font-family: var(--font-family-primary);
  color: var(--heading-color);
  font-size: var(--font-size-h4);
  margin-bottom: 0.3rem;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.honors-awards-list {
  list-style-type: none;
  padding-left: 0;
  color: var(--text-color);
}

.honors-awards-list li {
  color: var(--text-color);
}

.award-category {
  margin-bottom: 0.4rem;
  padding: 0.8rem 1.5rem; /* 减少上下padding，保持左右padding */
  background-color: var(--content-bg);
  border-radius: 4 px;
  border-left: 4px solid var(--secondary-accent);
  border: 1px solid var(--border-color);
}

.award-category h4 {
  font-family: var(--font-family-primary);
  color: var(--heading-color);
  font-size: var(--font-size-h4);
  margin-bottom: 0.6rem;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

.award-category ul {
  margin-left: 1rem;
}

.award-category li {
  margin-bottom: 0.5rem;
  line-height: 1.5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.skills-section {
  margin-top: 1.2rem;
  color: var(--text-color);
}

.skills-section p {
  color: var(--text-color);
}

.skill-category {
  margin-bottom: 1.2rem;
  padding: 0.8rem 1.5rem; /* 减少上下padding，保持左右padding */
  background-color: var(--content-bg);
  border-radius: 8px;
  border-left: 4px solid var(--primary-accent);
  border: 1px solid var(--border-color);
}

.skill-category h4 {
  font-family: var(--font-family-primary);
  color: var(--heading-color);
  font-size: var(--font-size-h4);
  margin-bottom: 0.6rem;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
}

/* ===== FOOTER ===== */
div#footer {
  font-size: small;
  border-top: 1px solid #c0c0c0;
  padding-top: 0.1em;
  margin-top: 4.0em;
  color: #c0c0c0;
  clear: both;
  position: relative;
  z-index: 10;
}

div#footer a {
  color: #80a0b0;
}

div#footer-text {
  float: left;
  padding-bottom: 8px;
}

/* Footer responsive design */
@media (max-width: 1340px) {
  div#footer {
    margin-top: 3em;
    padding: 1rem 0;
    text-align: center;
  }
  
  div#footer-text {
    float: none;
    text-align: center;
  }
}

@media (max-width: 768px) {
  div#footer {
    margin-top: 2em;
    font-size: 0.8rem;
  }
}

#fwtitle {
  margin: 2px;
}

#fwtitle #toptitle {
  padding-left: 0.5em;
  margin-bottom: 0.5em;
}

/* ===== OVERLAY ===== */
#page-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 9400; /* Below sidebar but above content */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0s 0.3s;
}

body.menu-open #layout-menu {
  transform: translateX(0);
}

body.menu-open #page-overlay {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s;
}

/* ===== RESPONSIVE DESIGN ===== */

/* Desktop Layout (Default) */
@media (min-width: 1200px) {
  #layout-menu {
    transform: translateX(0) !important;
    position: fixed !important;
    left: 0 !important;
    z-index: 9000 !important; /* Ensure proper layering */
  }

  #menu-toggle-btn {
    display: none !important;
  }

  #layout-content {
    margin-left: 300px !important; /* Ensure proper spacing from sidebar */
    margin-top: 80px !important; /* Match updated top spacing */
  }
}

/* Tablet and Mobile Layout */
@media (max-width: 1199px) {
  #layout-menu {
    position: fixed;
    left: -300px;
    top: 65px; /* Match new top nav height */
    width: 280px;
    height: calc(100vh - 65px);
    z-index: 9500; /* Higher than desktop but below top nav */
    transition: left 0.3s ease-in-out, transform 0.3s ease-in-out;
    border: none; /* 移除移动端边框 */
    box-shadow: 5px 0 25px var(--glass-shadow);
    padding: 0;
    transform: translateX(-100%);
    overflow-y: auto;
    overflow-x: hidden;
  }

  #layout-menu.active,
  .menu-open #layout-menu {
    left: 0;
    transform: translateX(0);
  }

  #layout-content {
    margin-left: 1rem;
    margin-right: 1rem;
    margin-top: 70px; /* Match new top nav height */
    padding: 0.8rem; /* Further reduced for denser layout */
    width: auto;
  }

  .top-nav-bar {
    justify-content: space-between;
    left: 0;
    height: 65px;
    padding: 0 1rem 0 1rem; /* Reset padding for mobile */
  }

  #menu-toggle-btn {
    display: flex;
  }

  #menu-close-btn {
    display: block;
  }

  #toptitle h1, .main-title {
    font-size: 2.5rem;
  }

  .title-subtitle {
    font-size: 0.9rem;
    flex-wrap: wrap;
  }

  h2 {
    font-size: 1.8rem;
  }

  h4 {
    font-size: 1.15rem;
  }
}

@media (max-width: 768px) {
  #layout-content {
    margin-left: 0.5rem;
    margin-right: 0.5rem;
    margin-top: 75px; /* Reduced for denser layout */
    padding: 0.75rem; /* Reduced for denser layout */
  }

  .content-card {
    padding: 12px; /* Further reduced for mobile */
    margin-bottom: 8px; /* Tighter spacing on mobile */
  }

  /* 移除創意佈局樣式 */

  .top-nav-bar {
    height: 60px;
    padding: 0 0.5rem;
  }

  #layout-menu {
    top: 60px;
    height: calc(100vh - 60px);
  }

  .language-switch {
    padding: 6px 12px;
    font-size: 13px;
  }

  .theme-toggle {
    width: 32px;
    height: 32px;
    padding: 5px;
  }

  .theme-toggle svg {
    width: 18px;
    height: 18px;
  }

  .content-card {
    padding: 20px;
  }

  .link-btn {
    padding: 6px 12px;
    font-size: 0.85rem;
  }

  .keyword-pill {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
  }

  .skill-tag {
    padding: 0.5em 1em;
    font-size: 0.85em;
  }

  /* Mobile menu adjustments */
  #layout-menu {
    padding: 0;
    display: flex;
    flex-direction: column;
  }
  
  .menu-category {
    padding: 10px 15px 0.5em 15px;
  }
  
  #menu-items {
    padding: 0 15px;
    overflow-y: auto;
  }
  
  .menu-copyright {
    padding: 10px 15px;
  }

  #menu-items .menu-item a {
    padding: 6px 8px;
    margin-bottom: 2px;
    font-size: 0.9rem;
  }

  .menu-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
  }
}

@media (max-width: 480px) {
  #toptitle h1, .main-title {
    font-size: 2rem;
  }

  .title-subtitle {
    font-size: 0.85rem;
    gap: 0.5rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .top-nav-bar {
    height: 60px;
    padding: 0 0.5rem;
  }

  #layout-content {
    margin-top: 70px; /* Reduced for denser layout */
    margin-left: 0.25rem;
    margin-right: 0.25rem;
    padding: 0.5rem; /* Reduced for denser layout */
  }

  .content-card {
    padding: 12px; /* 稍微增加padding提升可讀性 */
    margin-bottom: 8px; /* 適中的間距 */
  }

  /* 極小屏幕的聯絡信息優化 (320px) */
  .contact-item {
    padding: 0.5rem 0;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
  }

  .contact-label {
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
  }

  .contact-links {
    gap: 0.3rem;
  }

  .email-link, .phone-link {
    font-size: 0.8rem;
    line-height: 1.3;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    /* 確保在極小屏幕上可讀性 */
    min-height: 32px;
    display: flex;
    align-items: center;
  }

  /* 長郵件地址的處理 - 點擊展開 */
  .email-link {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
  }

  .email-link:hover,
  .email-link:focus,
  .email-link:active {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    height: auto;
    min-height: auto;
  }

  /* 電話號碼保持單行 */
  .phone-link {
    white-space: nowrap;
  }

  #layout-menu {
    top: 60px;
    height: calc(100vh - 60px);
    width: 260px;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  #layout-menu {
    display: none;
  }
  
  .top-nav-bar {
    display: none;
  }
  
  #layout-content {
    margin-left: 0;
    margin-top: 0;
  }
}