/* ============================================
   渗透测试 + AI 技术文档网站 - 多主题样式
   Pentest AI Docs - Multi-Theme System
   ============================================ */

/* ============ Galaxy Star Theme (Default) ============ */
:root,
html[data-theme="galaxy"] {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f28;
  --bg-tertiary: #151538;
  --bg-card: #121230;
  --bg-code: #080818;
  --border: #202060;
  --border-light: #303090;
  --text-primary: #e8e0ff;
  --text-secondary: #b0a0e8;
  --text-muted: #7870b8;
  --text-link: #9b59b6;
  --accent-green: #8e44ad;
  --accent-green-dim: #7d3c98;
  --accent-blue: #a569bd;
  --accent-orange: #f5b041;
  --accent-red: #e74c3c;
  --accent-purple: #bb8fce;
  --accent-cyan: #85c1e9;
  --severity-critical: #e74c3c;
  --severity-high: #f39c12;
  --severity-medium: #f5b041;
  --severity-low: #3cc98e;
  --logo-gradient: linear-gradient(135deg, #9b59b6, #5b2c6f);
  --hero-glow: radial-gradient(circle, rgba(155,89,182,0.08) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(155,89,182,0.12);
  --card-accent: #9b59b6;
  --scrollbar-thumb: #303090;
  --nav-hover-bg: rgba(155,89,182,0.04);
  --nav-active-bg: rgba(155,89,182,0.1);
  --tr-hover: rgba(155,89,182,0.03);
  --sidebar-width: 280px;
  --header-height: 56px;
  --max-content-width: 1100px;
  --font-mono: 'Cascadia Code', 'Fira Code', 'Source Code Pro', 'Consolas', 'Courier New', monospace;
  --font-sans: 'Inter', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
}

/* ============ Forest Green Theme ============ */
html[data-theme="forest"] {
  --bg-primary: #0a1a0f;
  --bg-secondary: #0f2216;
  --bg-tertiary: #142d1c;
  --bg-card: #102417;
  --bg-code: #081a0e;
  --border: #1a4022;
  --border-light: #2a5a30;
  --text-primary: #d4edda;
  --text-secondary: #8fbc8f;
  --text-muted: #5c8a5c;
  --text-link: #5cdb5c;
  --accent-green: #2ecc71;
  --accent-green-dim: #27ae60;
  --accent-blue: #52d681;
  --accent-orange: #f0b94d;
  --accent-red: #e74c3c;
  --accent-purple: #a29bfe;
  --accent-cyan: #1abc9c;
  --severity-critical: #e74c3c;
  --severity-high: #f39c12;
  --severity-medium: #f0b94d;
  --severity-low: #2ecc71;
  --logo-gradient: linear-gradient(135deg, #2ecc71, #1abc9c);
  --hero-glow: radial-gradient(circle, rgba(46,204,113,0.08) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(46,204,113,0.12);
  --card-accent: #2ecc71;
  --scrollbar-thumb: #2a5a30;
  --nav-hover-bg: rgba(46,204,113,0.04);
  --nav-active-bg: rgba(46,204,113,0.1);
  --tr-hover: rgba(46,204,113,0.03);
}

/* ============ Arctic Ice Theme ============ */
html[data-theme="arctic"] {
  --bg-primary: #0a1620;
  --bg-secondary: #0e1d2b;
  --bg-tertiary: #132738;
  --bg-card: #101f30;
  --bg-code: #09141c;
  --border: #1a3050;
  --border-light: #264878;
  --text-primary: #e0f0ff;
  --text-secondary: #8fc8ff;
  --text-muted: #5a90c0;
  --text-link: #4dc9f6;
  --accent-green: #00e5ff;
  --accent-green-dim: #00b8d4;
  --accent-blue: #40c4ff;
  --accent-orange: #ff9100;
  --accent-red: #ff5252;
  --accent-purple: #b388ff;
  --accent-cyan: #18ffff;
  --severity-critical: #ff5252;
  --severity-high: #ff6d00;
  --severity-medium: #ff9100;
  --severity-low: #00e676;
  --logo-gradient: linear-gradient(135deg, #00e5ff, #40c4ff);
  --hero-glow: radial-gradient(circle, rgba(0,229,255,0.07) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(0,229,255,0.1);
  --card-accent: #00e5ff;
  --scrollbar-thumb: #264878;
  --nav-hover-bg: rgba(0,229,255,0.04);
  --nav-active-bg: rgba(0,229,255,0.1);
  --tr-hover: rgba(0,229,255,0.02);
}

/* ============ Sunrise Warm Theme ============ */
html[data-theme="sunrise"] {
  --bg-primary: #1a1008;
  --bg-secondary: #24180e;
  --bg-tertiary: #301e12;
  --bg-card: #1e140c;
  --bg-code: #120c06;
  --border: #402a18;
  --border-light: #5a3a20;
  --text-primary: #ffe0c0;
  --text-secondary: #d4a870;
  --text-muted: #a08060;
  --text-link: #ffb300;
  --accent-green: #ffb300;
  --accent-green-dim: #e6a100;
  --accent-blue: #ff9100;
  --accent-orange: #ff6d00;
  --accent-red: #ff3d00;
  --accent-purple: #ff80ab;
  --accent-cyan: #80deea;
  --severity-critical: #ff3d00;
  --severity-high: #ff6d00;
  --severity-medium: #ff9100;
  --severity-low: #ffb300;
  --logo-gradient: linear-gradient(135deg, #ffb300, #ff6d00);
  --hero-glow: radial-gradient(circle, rgba(255,179,0,0.08) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(255,179,0,0.12);
  --card-accent: #ffb300;
  --scrollbar-thumb: #5a3a20;
  --nav-hover-bg: rgba(255,179,0,0.04);
  --nav-active-bg: rgba(255,179,0,0.1);
  --tr-hover: rgba(255,179,0,0.03);
}

/* ============ Neon Cyberpunk Theme ============ */
html[data-theme="neon"] {
  --bg-primary: #000000;
  --bg-secondary: #030303;
  --bg-tertiary: #0a0a0a;
  --bg-card: #050508;
  --bg-code: #000000;
  --border: #1f0030;
  --border-light: #3a1060;
  --text-primary: #f0e0ff;
  --text-secondary: #c0a0e0;
  --text-muted: #8060a0;
  --text-link: #ff00ff;
  --accent-green: #00ff41;
  --accent-green-dim: #00cc33;
  --accent-blue: #00ccff;
  --accent-orange: #ff6600;
  --accent-red: #ff0044;
  --accent-purple: #ff00ff;
  --accent-cyan: #00ffcc;
  --severity-critical: #ff0044;
  --severity-high: #ff6600;
  --severity-medium: #ffcc00;
  --severity-low: #00ff41;
  --logo-gradient: linear-gradient(135deg, #ff00ff, #00ccff);
  --hero-glow: radial-gradient(circle, rgba(255,0,255,0.06) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(255,0,255,0.05);
  --shadow-md: 0 4px 12px rgba(255,0,255,0.08);
  --shadow-lg: 0 8px 32px rgba(255,0,255,0.1);
  --card-accent: #ff00ff;
  --scrollbar-thumb: #3a1060;
  --nav-hover-bg: rgba(255,0,255,0.03);
  --nav-active-bg: rgba(255,0,255,0.1);
  --tr-hover: rgba(255,0,255,0.02);
}

/* ============ Hacker Terminal Theme ============ */
html[data-theme="hacker"] {
  --bg-primary: #0a0f0a;
  --bg-secondary: #0d140d;
  --bg-tertiary: #111a11;
  --bg-card: #0e150e;
  --bg-code: #050a05;
  --border: #1a3a1a;
  --border-light: #2a5a2a;
  --text-primary: #00ff41;
  --text-secondary: #00cc33;
  --text-muted: #008822;
  --text-link: #00ff41;
  --accent-green: #00ff41;
  --accent-green-dim: #00cc33;
  --accent-blue: #00dd88;
  --accent-orange: #aaff00;
  --accent-red: #ff3344;
  --accent-purple: #88ff00;
  --accent-cyan: #00ffaa;
  --severity-critical: #ff3344;
  --severity-high: #ff8800;
  --severity-medium: #ccff00;
  --severity-low: #00ff41;
  --logo-gradient: linear-gradient(135deg, #00ff41, #00aa22);
  --hero-glow: radial-gradient(circle, rgba(0,255,65,0.08) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,255,65,0.04);
  --shadow-md: 0 4px 12px rgba(0,255,65,0.08);
  --shadow-lg: 0 8px 32px rgba(0,255,65,0.12);
  --card-accent: #00ff41;
  --scrollbar-thumb: #1a3a1a;
  --nav-hover-bg: rgba(0,255,65,0.04);
  --nav-active-bg: rgba(0,255,65,0.1);
  --tr-hover: rgba(0,255,65,0.03);
}

/* ============ Sakura / Cherry Blossom Theme ============ */
html[data-theme="sakura"] {
  --bg-primary: #1a1018;
  --bg-secondary: #241820;
  --bg-tertiary: #301e28;
  --bg-card: #1e1420;
  --bg-code: #120a10;
  --border: #402838;
  --border-light: #5a3850;
  --text-primary: #f8e8f0;
  --text-secondary: #d0a8c0;
  --text-muted: #987090;
  --text-link: #ff80b0;
  --accent-green: #ff80a0;
  --accent-green-dim: #e87090;
  --accent-blue: #ff90c0;
  --accent-orange: #ffb080;
  --accent-red: #ff5070;
  --accent-purple: #e8a0d0;
  --accent-cyan: #ffb8d0;
  --severity-critical: #ff5070;
  --severity-high: #ff8060;
  --severity-medium: #ffa070;
  --severity-low: #ff80a0;
  --logo-gradient: linear-gradient(135deg, #ff80b0, #e86090);
  --hero-glow: radial-gradient(circle, rgba(255,128,176,0.08) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(255,128,176,0.12);
  --card-accent: #ff80b0;
  --scrollbar-thumb: #5a3850;
  --nav-hover-bg: rgba(255,128,176,0.04);
  --nav-active-bg: rgba(255,128,176,0.1);
  --tr-hover: rgba(255,128,176,0.03);
}

/* ============ Ocean Deep Theme ============ */
html[data-theme="ocean"] {
  --bg-primary: #030b14;
  --bg-secondary: #061220;
  --bg-tertiary: #0a1a2e;
  --bg-card: #081620;
  --bg-code: #020a12;
  --border: #0e2440;
  --border-light: #163a68;
  --text-primary: #e0f0ff;
  --text-secondary: #80b8e0;
  --text-muted: #4878a0;
  --text-link: #40c8ff;
  --accent-green: #00e8c8;
  --accent-green-dim: #00c8a8;
  --accent-blue: #40a8ff;
  --accent-orange: #ffb840;
  --accent-red: #ff4860;
  --accent-purple: #8098ff;
  --accent-cyan: #00e0ff;
  --severity-critical: #ff4860;
  --severity-high: #ff8040;
  --severity-medium: #ffb840;
  --severity-low: #00e8c8;
  --logo-gradient: linear-gradient(135deg, #00e0ff, #0068d0);
  --hero-glow: radial-gradient(circle, rgba(0,224,255,0.07) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(0,224,255,0.1);
  --card-accent: #00e0ff;
  --scrollbar-thumb: #163a68;
  --nav-hover-bg: rgba(0,224,255,0.03);
  --nav-active-bg: rgba(0,224,255,0.08);
  --tr-hover: rgba(0,224,255,0.02);
}

/* ============ Aura / Iridescent Theme ============ */
html[data-theme="aura"] {
  --bg-primary: #0f0a18;
  --bg-secondary: #160e24;
  --bg-tertiary: #1e1432;
  --bg-card: #141020;
  --bg-code: #0a0612;
  --border: #2a1a48;
  --border-light: #3a2870;
  --text-primary: #f4eeff;
  --text-secondary: #c8b8f0;
  --text-muted: #8070b0;
  --text-link: #c080ff;
  --accent-green: #80ffc8;
  --accent-green-dim: #60e8a8;
  --accent-blue: #8090ff;
  --accent-orange: #ffb870;
  --accent-red: #ff6088;
  --accent-purple: #c080ff;
  --accent-cyan: #80ffe8;
  --severity-critical: #ff6088;
  --severity-high: #ff9060;
  --severity-medium: #ffb870;
  --severity-low: #80ffc8;
  --logo-gradient: linear-gradient(135deg, #c080ff, #40e0d0, #ff80b0);
  --hero-glow: radial-gradient(circle, rgba(192,128,255,0.07) 0%, transparent 70%);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 32px rgba(192,128,255,0.12);
  --card-accent: #c080ff;
  --scrollbar-thumb: #3a2870;
  --nav-hover-bg: rgba(192,128,255,0.04);
  --nav-active-bg: rgba(192,128,255,0.1);
  --tr-hover: rgba(192,128,255,0.03);
}

/* ============ Theme Transition Smoothing ============ */
html {
  transition: background-color 0.5s ease, color 0.5s ease;
}

html *,
html *::before,
html *::after {
  transition: background-color 0.4s ease, border-color 0.4s ease, color 0.3s ease, box-shadow 0.4s ease, opacity 0.3s ease;
}

/* Exclude elements that need instant response */
html .reading-progress,
html .reading-progress *,
html #fxCanvas,
html #fxCanvas *,
html .back-to-top,
html .back-to-top * { transition: none !important; }

/* ============ Grain Texture Overlay ============ */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  background-repeat: repeat;
}

/* ============ Global Scrollbar ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; border: 2px solid var(--bg-primary); }
::-webkit-scrollbar-thumb:hover { background: var(--border-light); }
::-webkit-scrollbar-corner { background: var(--bg-primary); }

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--scrollbar-thumb) var(--bg-primary);
  scrollbar-width: thin;
}

/* Smooth theme transitions */
body, .sidebar, .main-content, header, nav, .profile-card, .login-card, .modal-box,
.stat-card, .table-wrap, input, select, textarea, .badge, table, th, td, .action-btn,
.topbar, .theme-switcher, .search-wrap input, .sidebar-nav, .nav-item, .nav-section-title {
  transition: background-color 0.5s ease, border-color 0.5s ease, color 0.35s ease, box-shadow 0.5s ease;
}

/* ============ Global Link Styles ============ */
a {
  color: var(--text-link);
  text-decoration: none;
  transition: all 0.2s ease;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.3s ease, color 0.2s ease;
}
a:hover {
  background-size: 100% 1px;
}

/* Skip underline animation for nav items, buttons, badges */
.nav-item a,
.sidebar a,
button,
.badge,
.hero-tag,
.tool-card,
.card a[href^="#"] {
  background: none !important;
}

/* ============ Selection ============ */
::selection {
  background: rgba(155,89,182,0.3);
  color: #fff;
}
html[data-theme="forest"] ::selection { background: rgba(46,204,113,0.3); }
html[data-theme="arctic"] ::selection { background: rgba(0,229,255,0.3); }
html[data-theme="sunrise"] ::selection { background: rgba(255,179,0,0.3); }
html[data-theme="neon"] ::selection { background: rgba(255,0,255,0.3); }
html[data-theme="hacker"] ::selection { background: rgba(0,255,65,0.3); }
html[data-theme="sakura"] ::selection { background: rgba(255,128,176,0.3); }
html[data-theme="ocean"] ::selection { background: rgba(0,224,255,0.3); }
html[data-theme="aura"] ::selection { background: rgba(192,128,255,0.3); }

/* ============ Focus Ring ============ */
*:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 2px;
  transition: outline-color 0.3s ease;
}

/* ============ Page Load Animation ============ */
@keyframes pageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ Skeleton Loading ============ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-text.short { width: 60%; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-card { height: 80px; border-radius: var(--radius-md); margin-bottom: 12px; }

/* ============ Smooth Section Entrance ============ */
@keyframes sectionReveal {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Progressive enhancement for browsers that support scroll-driven animations */
@supports (animation-timeline: view()) {
  section {
    animation: sectionReveal 0.5s ease both;
    animation-timeline: view();
    animation-range: entry 0% entry 100%;
  }
}

/* ============ Theme Dynamic Effects ============ */
/* Hero glow + card hover effects (particles via Canvas) */

/* ============ Theme Ambient Backgrounds ============ */
/* Full-viewport ambient glow — no hard edges */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.75;
  transition: background 1s ease, opacity 0.8s ease;
}

/* --- Forest: Bioluminescent green/teal mist --- */
html[data-theme="forest"] body::before {
  background:
    radial-gradient(ellipse 1200px 800px at 15% 90%, rgba(46,204,113,0.10) 0%, transparent 60%),
    radial-gradient(ellipse 900px 700px at 85% 10%, rgba(26,188,156,0.08) 0%, transparent 55%),
    radial-gradient(ellipse 800px 600px at 50% 40%, rgba(46,204,113,0.05) 0%, transparent 70%),
    radial-gradient(ellipse 600px 500px at 30% 65%, rgba(22,160,90,0.04) 0%, transparent 65%);
  animation: forestMist 10s ease-in-out infinite;
}
@keyframes forestMist {
  0%, 100% { opacity: 0.7; }
  40% { opacity: 0.9; }
  70% { opacity: 0.65; }
}
html[data-theme="forest"] .card { transition: all 0.3s ease, box-shadow 0.4s ease; }
html[data-theme="forest"] .card:hover {
  box-shadow: 0 4px 20px rgba(46,204,113,0.2), 0 0 0 2px rgba(46,204,113,0.15);
  border-color: rgba(46,204,113,0.4);
}
html[data-theme="forest"] .section-header::after { box-shadow: 0 0 8px rgba(46,204,113,0.4); }

/* --- Arctic: Northern lights with ice-blue drift --- */
html[data-theme="arctic"] body::before {
  background:
    radial-gradient(ellipse 1400px 500px at 20% 70%, rgba(0,229,255,0.10) 0%, transparent 50%),
    radial-gradient(ellipse 1200px 400px at 70% 25%, rgba(64,196,255,0.09) 0%, transparent 50%),
    radial-gradient(ellipse 1000px 600px at 50% 80%, rgba(0,188,212,0.06) 0%, transparent 55%),
    radial-gradient(ellipse 800px 450px at 40% 50%, rgba(24,255,255,0.05) 0%, transparent 60%);
  animation: auroraDrift 12s ease-in-out infinite;
}
@keyframes auroraDrift {
  0%, 100% { opacity: 0.65; }
  25% { opacity: 0.85; }
  50% { opacity: 0.7; }
  75% { opacity: 0.9; }
}
html[data-theme="arctic"] .card { transition: all 0.3s ease, box-shadow 0.4s ease; }
html[data-theme="arctic"] .card:hover {
  box-shadow: 0 4px 20px rgba(0,229,255,0.18), 0 0 0 2px rgba(0,229,255,0.12);
  border-color: rgba(0,229,255,0.35);
}
html[data-theme="arctic"] .section-header::after { box-shadow: 0 0 8px rgba(0,229,255,0.4); }

/* --- Sunrise: Warm golden-red embers rising from below --- */
html[data-theme="sunrise"] body::before {
  background:
    radial-gradient(ellipse 1300px 700px at 50% 120%, rgba(255,179,0,0.13) 0%, transparent 45%),
    radial-gradient(ellipse 1000px 550px at 50% 100%, rgba(255,109,0,0.09) 0%, transparent 50%),
    radial-gradient(ellipse 800px 400px at 30% 40%, rgba(255,140,0,0.05) 0%, transparent 60%),
    radial-gradient(ellipse 900px 500px at 70% 35%, rgba(255,200,60,0.04) 0%, transparent 55%);
  animation: emberGlow 8s ease-in-out infinite;
}
@keyframes emberGlow {
  0%, 100% { opacity: 0.7; }
  30% { opacity: 0.9; }
  60% { opacity: 0.75; }
  85% { opacity: 1; }
}
html[data-theme="sunrise"] .card { transition: all 0.3s ease, box-shadow 0.4s ease; }
html[data-theme="sunrise"] .card:hover {
  box-shadow: 0 4px 20px rgba(255,179,0,0.2), 0 0 0 2px rgba(255,179,0,0.15);
  border-color: rgba(255,179,0,0.4);
}
html[data-theme="sunrise"] .section-header::after { box-shadow: 0 0 8px rgba(255,179,0,0.4); }

/* --- Neon: Cyberpunk synthwave magenta/cyan --- */
html[data-theme="neon"] body::before {
  background:
    radial-gradient(ellipse 1100px 700px at 25% 60%, rgba(255,0,255,0.08) 0%, transparent 45%),
    radial-gradient(ellipse 1000px 600px at 75% 30%, rgba(0,204,255,0.07) 0%, transparent 45%),
    radial-gradient(ellipse 700px 500px at 60% 70%, rgba(255,0,255,0.04) 0%, transparent 55%),
    radial-gradient(ellipse 800px 400px at 40% 20%, rgba(0,255,204,0.05) 0%, transparent 50%);
  animation: synthPulse 6s ease-in-out infinite;
}
@keyframes synthPulse {
  0%, 100% { opacity: 0.65; }
  50% { opacity: 0.9; }
}
html[data-theme="neon"] .card {
  transition: all 0.3s ease, box-shadow 0.3s ease;
  border-color: rgba(255,0,255,0.15);
}
html[data-theme="neon"] .card:hover {
  box-shadow: 0 0 24px rgba(255,0,255,0.25), 0 0 60px rgba(0,204,255,0.08), 0 0 0 2px rgba(255,0,255,0.3);
  border-color: rgba(255,0,255,0.6);
}
html[data-theme="neon"] .section-header::after { box-shadow: 0 0 12px rgba(255,0,255,0.6), 0 0 24px rgba(255,0,255,0.3); }
html[data-theme="neon"] .section-header h2 { text-shadow: 0 0 20px rgba(255,0,255,0.3); }
html[data-theme="neon"] .card h3 { text-shadow: 0 0 10px rgba(255,0,255,0.1); }

/* --- Galaxy: Deep space purple/blue nebulae --- */
html[data-theme="galaxy"] body::before {
  background:
    radial-gradient(ellipse 1500px 900px at 25% 30%, rgba(155,89,182,0.12) 0%, transparent 50%),
    radial-gradient(ellipse 1200px 800px at 75% 65%, rgba(80,120,220,0.10) 0%, transparent 50%),
    radial-gradient(ellipse 1000px 600px at 50% 50%, rgba(155,89,182,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 800px 500px at 40% 75%, rgba(100,50,160,0.05) 0%, transparent 55%);
  animation: nebulaDrift 14s ease-in-out infinite;
}
@keyframes nebulaDrift {
  0%, 100% { opacity: 0.7; }
  25% { opacity: 0.85; }
  50% { opacity: 0.7; }
  75% { opacity: 0.9; }
}
html[data-theme="galaxy"] .card { transition: all 0.3s ease, box-shadow 0.4s ease; }
html[data-theme="galaxy"] .card:hover {
  box-shadow: 0 4px 24px rgba(155,89,182,0.25), 0 0 0 2px rgba(155,89,182,0.2);
  border-color: rgba(155,89,182,0.45);
}
html[data-theme="galaxy"] .section-header::after { box-shadow: 0 0 10px rgba(155,89,182,0.5); }

/* --- Hacker: Terminal green matrix glow --- */
html[data-theme="hacker"] body::before {
  background:
    radial-gradient(ellipse 1200px 600px at 50% 0%, rgba(0,255,65,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 1000px 500px at 50% 100%, rgba(0,204,51,0.05) 0%, transparent 50%),
    radial-gradient(ellipse 800px 400px at 30% 50%, rgba(0,255,65,0.04) 0%, transparent 55%),
    radial-gradient(ellipse 600px 350px at 70% 50%, rgba(0,170,34,0.03) 0%, transparent 50%);
  animation: terminalFlicker 5s ease-in-out infinite;
}
@keyframes terminalFlicker {
  0%, 100% { opacity: 0.7; }
  30% { opacity: 0.85; }
  50% { opacity: 0.72; }
  80% { opacity: 0.9; }
}
html[data-theme="hacker"] .card {
  transition: all 0.3s ease, box-shadow 0.3s ease;
  border-color: rgba(0,255,65,0.12);
}
html[data-theme="hacker"] .card:hover {
  box-shadow: 0 0 20px rgba(0,255,65,0.2), 0 0 0 2px rgba(0,255,65,0.2);
  border-color: rgba(0,255,65,0.5);
}
html[data-theme="hacker"] .section-header::after { box-shadow: 0 0 10px rgba(0,255,65,0.5); }

/* --- Sakura: Pink petal-float ambiance --- */
html[data-theme="sakura"] body::before {
  background:
    radial-gradient(ellipse 1200px 700px at 25% 40%, rgba(255,128,176,0.1) 0%, transparent 50%),
    radial-gradient(ellipse 1000px 600px at 75% 60%, rgba(255,160,200,0.08) 0%, transparent 50%),
    radial-gradient(ellipse 800px 500px at 50% 30%, rgba(255,200,220,0.05) 0%, transparent 55%),
    radial-gradient(ellipse 700px 450px at 40% 75%, rgba(255,120,160,0.06) 0%, transparent 50%);
  animation: sakuraBreeze 10s ease-in-out infinite;
}
@keyframes sakuraBreeze {
  0%, 100% { opacity: 0.7; }
  40% { opacity: 0.9; }
  70% { opacity: 0.65; }
}
html[data-theme="sakura"] .card {
  transition: all 0.3s ease, box-shadow 0.4s ease;
  border-color: rgba(255,128,176,0.1);
}
html[data-theme="sakura"] .card:hover {
  box-shadow: 0 4px 24px rgba(255,128,176,0.22), 0 0 0 2px rgba(255,128,176,0.15);
  border-color: rgba(255,128,176,0.4);
}
html[data-theme="sakura"] .section-header::after { box-shadow: 0 0 10px rgba(255,128,176,0.5); }

/* --- Ocean: Deep-sea bioluminescent waves --- */
html[data-theme="ocean"] body::before {
  background:
    radial-gradient(ellipse 1400px 500px at 50% 100%, rgba(0,224,255,0.08) 0%, transparent 45%),
    radial-gradient(ellipse 1200px 600px at 30% 20%, rgba(0,200,224,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 1000px 500px at 70% 40%, rgba(0,160,200,0.05) 0%, transparent 55%),
    radial-gradient(ellipse 800px 400px at 50% 80%, rgba(0,232,200,0.07) 0%, transparent 45%);
  animation: oceanSwell 12s ease-in-out infinite;
}
@keyframes oceanSwell {
  0%, 100% { opacity: 0.6; }
  25% { opacity: 0.8; }
  50% { opacity: 0.65; }
  75% { opacity: 0.9; }
}
html[data-theme="ocean"] .card {
  transition: all 0.3s ease, box-shadow 0.4s ease;
  border-color: rgba(0,224,255,0.08);
}
html[data-theme="ocean"] .card:hover {
  box-shadow: 0 4px 20px rgba(0,224,255,0.18), 0 0 0 2px rgba(0,224,255,0.12);
  border-color: rgba(0,224,255,0.35);
}
html[data-theme="ocean"] .section-header::after { box-shadow: 0 0 10px rgba(0,224,255,0.5); }

/* --- Aura: Prismatic shifting colors --- */
html[data-theme="aura"] body::before {
  background:
    radial-gradient(ellipse 1100px 700px at 20% 50%, rgba(192,128,255,0.09) 0%, transparent 45%),
    radial-gradient(ellipse 1000px 600px at 60% 30%, rgba(64,224,208,0.07) 0%, transparent 45%),
    radial-gradient(ellipse 900px 500px at 40% 70%, rgba(255,128,176,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 800px 500px at 70% 60%, rgba(128,144,255,0.05) 0%, transparent 45%);
  animation: auraShift 14s ease-in-out infinite;
}
@keyframes auraShift {
  0%, 100% { opacity: 0.65; }
  20% { opacity: 0.85; }
  40% { opacity: 0.7; }
  60% { opacity: 0.9; }
  80% { opacity: 0.7; }
}
html[data-theme="aura"] .card {
  transition: all 0.3s ease, box-shadow 0.3s ease;
  border-color: rgba(192,128,255,0.12);
}
html[data-theme="aura"] .card:hover {
  box-shadow: 0 0 24px rgba(192,128,255,0.2), 0 0 48px rgba(64,224,208,0.08), 0 0 0 2px rgba(192,128,255,0.2);
  border-color: rgba(192,128,255,0.5);
  background: linear-gradient(135deg, rgba(192,128,255,0.02) 0%, rgba(64,224,208,0.02) 50%, rgba(255,128,176,0.02) 100%);
}
html[data-theme="aura"] .section-header::after {
  box-shadow: 0 0 12px rgba(192,128,255,0.5), 0 0 24px rgba(64,224,208,0.3);
}
html[data-theme="aura"] .section-header h2 {
  background: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 50%, var(--accent-green) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Canvas layer for particle FX */
#fxCanvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ============ Base Reset ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  scroll-padding-top: 20px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.75;
  letter-spacing: 0.01em;
}

/* == Body scrollbar == */
body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: var(--bg-primary); }
body::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }
body::-webkit-scrollbar-thumb:hover { background: var(--border-light); }

a { color: var(--text-link); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-blue); }

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

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* ============ Theme Switcher ============ */
.theme-switcher {
  position: fixed;
  top: 48px;
  right: 16px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 5px 7px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.04) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Separator dot between buttons */
.theme-switcher::before {
  content: '';
  position: absolute;
  inset: 11px 7px;
  top: 11px; bottom: 11px;
  background: var(--border);
  border-radius: 28px;
  opacity: 0.3;
  pointer-events: none;
  z-index: -1;
}

.theme-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.45);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  flex-shrink: 0;
  outline: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), inset 0 1px 2px rgba(255,255,255,0.25);
}

.theme-btn:hover {
  transform: scale(1.25);
  border-color: #fff;
  box-shadow: 0 0 18px currentColor, inset 0 1px 2px rgba(255,255,255,0.3);
}

.theme-btn.active {
  border-color: #fff;
  box-shadow: 0 0 18px currentColor, 0 0 36px currentColor, inset 0 1px 2px rgba(255,255,255,0.3);
  transform: scale(1.15);
  z-index: 2;
}

/* ── 每个主题按钮独立底色 ── */
.theme-btn.forest { background-color: #2ecc71; color: #2ecc71; }
.theme-btn.arctic { background-color: #00c8ff; color: #00c8ff; }
.theme-btn.sunrise { background-color: #ff9800; color: #ff9800; }
.theme-btn.neon { background-color: #e040fb; color: #e040fb; }
.theme-btn.galaxy { background-color: #ab47bc; color: #ab47bc; }
.theme-btn.hacker { background-color: #00e676; color: #00e676; }
.theme-btn.sakura { background-color: #ff80b0; color: #ff80b0; }
.theme-btn.ocean { background-color: #00c8e0; color: #00c8e0; }
.theme-btn.aura { background-color: #c080ff; color: #c080ff; }

/* Tooltip label on hover */
.theme-btn::after {
  content: attr(data-label);
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 3px 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-sans);
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.theme-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Active theme name label */
.theme-switcher::after {
  content: attr(data-current-label);
  position: absolute;
  top: -32px;
  right: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  opacity: 0;
  transition: all 0.35s ease;
  pointer-events: none;
  font-family: var(--font-sans);
}

.theme-switcher:hover::after {
  opacity: 1;
}

/* ============ Layout ============ */
/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan), var(--accent-purple));
  z-index: 400;
  width: 0%;
  transition: width 0.12s linear;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(155,89,182,0.4);
}

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  top: 0; left: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-accent), transparent);
  z-index: 2;
  opacity: 0.6;
}

.sidebar-header {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 16px 16px; flex-shrink: 0;
}
.sidebar-logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-purple), #6c5ce7);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(171,71,188,0.35);
}
.sidebar-title {
  font-size: 14px; font-weight: 700; color: var(--text-primary);
  letter-spacing: 0.02em;
}

.sidebar-profile-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  font-size: 13px; font-weight: 500; color: var(--accent-purple);
  text-decoration: none; border-bottom: 1px solid var(--border);
  flex-shrink: 0; transition: background 0.2s;
}
.sidebar-profile-link:hover { background: var(--bg-tertiary); }

/* Collapsed sidebar state */
.sidebar.collapsed {
  transform: translateX(calc(var(--sidebar-width) * -1));
}

/* Spring toggle — sits on the right edge of sidebar, vertically centered */
.sidebar-spring {
  position: fixed;
  top: 50%;
  left: var(--sidebar-width);
  transform: translate(-50%, -50%);
  z-index: 310;
  width: 22px; height: 56px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 11px;
  color: rgba(255,255,255,0.3);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.sidebar-spring:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  width: 26px; height: 64px; border-radius: 13px;
}
.sidebar-spring .spring-icon-expand { display: none; }
.sidebar-spring .spring-icon-collapse { display: block; }

/* When collapsed, move spring to left edge and flip icon */
.sidebar.collapsed ~ .sidebar-spring {
  left: 8px;
}
.sidebar.collapsed ~ .sidebar-spring .spring-icon-collapse { display: none; }
.sidebar.collapsed ~ .sidebar-spring .spring-icon-expand { display: block; }

/* Main content expands when sidebar is collapsed */
.sidebar.collapsed ~ .main-content {
  margin-left: 60px;
}

.sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  text-decoration: none; flex-shrink: 0;
  transition: background 0.2s;
}
.sidebar-user:hover { background: var(--bg-tertiary); }

.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  flex-shrink: 0; user-select: none;
  background: var(--accent-purple);
  overflow: hidden;
}
.sidebar-user-avatar .avatar-emoji {
  font-size: 22px;
  background: transparent;
}
.sidebar-user-info { overflow: hidden; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
}

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--transition);
  font-family: var(--font-sans);
}

.sidebar-search input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
.sidebar-search input:focus ~ .keyboard-shortcut { opacity: 0; }
.sidebar-search input::placeholder { color: var(--text-muted); }

/* search icon hint via background */
.sidebar-search { position: relative; }
.sidebar-search::before {
  content: '🔍';
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

/* Search dropdown */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 8px; right: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  max-height: 320px;
  overflow-y: auto;
}
.search-dropdown::-webkit-scrollbar { width: 4px; }
.search-dropdown::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }

.search-result-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
  cursor: pointer;
  background: none !important;
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--bg-tertiary) !important; }

.search-result-title { display: block; font-size: 13px; color: var(--text-primary); font-weight: 500; margin-bottom: 2px; }
.search-result-desc { display: block; font-size: 11px; color: var(--text-muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-dropdown-empty { padding: 16px; text-align: center; font-size: 12px; color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 2px; }

.nav-section-title {
  padding: 12px 20px 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  gap: 6px;
}

.nav-section-title:hover { color: var(--text-secondary); }

/* Section icon */
.nav-section-title .nav-icon {
  display: inline-block;
  width: 28px;
  text-align: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* Section item count badge */
.nav-section-title .nav-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; font-size: 10px; font-weight: 700;
  background: var(--bg-tertiary); color: var(--text-muted);
  letter-spacing: 0; margin-left: auto; margin-right: 8px;
  transition: all 0.2s;
}
.nav-section-title:hover .nav-count {
  background: var(--border); color: var(--text-secondary);
}

/* accordion arrow */
.nav-section-title::after {
  content: '▾';
  font-size: 9px;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.5;
}

.nav-section.collapsed .nav-section-title::after {
  transform: rotate(-90deg);
}

/* Smooth collapse: wrap items in a container for height animation */
.nav-items-wrap {
  overflow: hidden;
  max-height: 800px;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-section.collapsed .nav-items-wrap {
  max-height: 0;
}

.nav-item a {
  display: block;
  padding: 7px 20px 7px 28px;
  font-size: 14px;
  color: var(--text-secondary);
  border-left: 3px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0 4px 4px 0;
}

.nav-item a:hover {
  color: var(--text-primary);
  background: var(--nav-hover-bg);
  border-left-color: var(--border-light);
  text-decoration: none;
}

.nav-item a.active {
  color: var(--accent-blue);
  background: var(--nav-active-bg);
  border-left-color: var(--accent-blue);
  font-weight: 500;
}

/* Search highlight indicator */
.nav-item a mark {
  background: rgba(255, 179, 0, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Keyboard shortcut badge */
.keyboard-shortcut {
  display: inline-block;
  padding: 1px 6px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  vertical-align: middle;
  margin-left: 4px;
}

.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 200;
  width: 38px; height: 38px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-toggle:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 0 12px rgba(88,166,255,0.15);
}
.sidebar-toggle:active {
  transform: scale(0.93);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ============ Main Content ============ */
.main-content {
  margin-left: var(--sidebar-width);
  margin-right: 60px;
  flex: 1;
  min-width: 0;
  background: var(--bg-primary);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-wrapper {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 56px 56px 80px;
}

/* ============ Hero ============ */
.hero {
  text-align: center;
  padding: 72px 0 56px;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 600px; height: 400px;
  background: radial-gradient(ellipse, var(--hero-glow));
  pointer-events: none;
  z-index: 0;
}

.hero-icon {
  width: 80px; height: 80px;
  background: var(--logo-gradient);
  border-radius: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(155,89,182,0.2);
  position: relative;
  z-index: 1;
  animation: heroIconFloat 3s ease-in-out infinite;
}
@keyframes heroIconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 900;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-cyan) 40%, var(--accent-purple) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
  animation: heroShimmer 6s ease-in-out infinite;
  background-size: 200% 200%;
}
@keyframes heroShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 640px;
  margin: 0 auto 32px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

.hero-tags {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.hero-tag {
  padding: 5px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.hero-tag:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
}
.hero-tag-time {
  background: rgba(88,166,255,0.08);
  border-color: rgba(88,166,255,0.25);
  color: var(--accent-blue);
}

/* ============ Sections ============ */
section {
  margin-bottom: 56px;
  scroll-margin-top: 24px;
}

.section-header {
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
  position: relative;
}

.section-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--card-accent), var(--accent-cyan), transparent);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.section-header:hover::after {
  width: 140px;
}

.section-header h2 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* anchor link indicator on hover */
.section-header h2 {
  position: relative;
}

.section-header h2:hover .anchor-link {
  opacity: 1;
}

.anchor-link {
  display: inline-block;
  opacity: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-left: 8px;
  transition: opacity 0.2s ease, color 0.2s ease;
  vertical-align: middle;
  text-decoration: none;
  font-weight: 400;
  cursor: pointer;
}

.anchor-link:hover {
  color: var(--accent-blue);
  opacity: 1;
}
.anchor-link.copied {
  color: var(--accent-green);
  opacity: 1;
}

.section-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============ Focus Visible ============ */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

.nav-item a:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}

.sidebar-search input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(88,166,255,0.25);
}

/* ============ Toast Notification ============ */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 24px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  animation: toastIn 0.35s cubic-bezier(0.4, 0, 0.2, 1), toastOut 0.3s ease 1.8s forwards;
  pointer-events: auto;
  max-width: 320px;
  display: flex;
  align-items: center;
  gap: 8px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ============ Cards ============ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 34px;
  margin-bottom: 20px;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.15s ease-out;
  position: relative;
  box-shadow: var(--shadow-sm);
  transform-style: preserve-3d;
  perspective: 1000px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--card-accent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 0;
  pointer-events: none;
}

.card:hover::before {
  opacity: 0.03;
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(255,255,255,0.03) inset;
  transform: translateY(-2px);
}

.card > * {
  position: relative;
  z-index: 1;
}

/* Glowing left accent on card hover */
.card::after {
  content: '';
  position: absolute;
  top: 16px; bottom: 16px; left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--card-accent);
  transform: scaleY(0);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 0;
}

.card:hover::after {
  transform: scaleY(1);
}

.card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.card h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--text-primary);
  padding-left: 14px;
  border-left: 3px solid var(--card-accent);
  position: relative;
}
.card h4::before {
  content: '';
  position: absolute;
  left: -3px; top: 0; bottom: 0;
  width: 3px;
  background: var(--card-accent);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: scaleY(0);
}
.card:hover h4::before {
  opacity: 1;
  transform: scaleY(1);
}

.card h4:first-child { margin-top: 0; }

.card p, .card li {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.card p { margin-bottom: 12px; }

/* Card variants */
.card.featured {
  border-color: var(--card-accent);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(155,89,182,0.03) 100%);
}
.card.featured::before {
  opacity: 0.04;
}
.card.compact {
  padding: 20px 24px;
  margin-bottom: 12px;
}
.card.compact h3 { font-size: 1.05rem; margin-bottom: 6px; }
.card.compact p { font-size: 13px; margin-bottom: 0; }

.card.danger {
  border-color: rgba(248,81,73,0.3);
  background: rgba(248,81,73,0.03);
}
.card.danger:hover {
  border-color: rgba(248,81,73,0.5);
  box-shadow: 0 4px 20px rgba(248,81,73,0.1);
}
.card.danger::after { background: var(--accent-red); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.card-grid .card { margin-bottom: 0; }

/* ============ Badges ============ */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  vertical-align: middle;
  transition: all 0.25s ease;
  cursor: default;
  position: relative;
}

.badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.badge-critical { background: rgba(248,81,73,0.12); color: var(--severity-critical); border: 1px solid rgba(248,81,73,0.2); }
.badge-high { background: rgba(240,136,62,0.12); color: var(--severity-high); border: 1px solid rgba(240,136,62,0.2); }
.badge-medium { background: rgba(210,153,29,0.12); color: var(--severity-medium); border: 1px solid rgba(210,153,29,0.2); }
.badge-low { background: rgba(63,185,80,0.12); color: var(--severity-low); border: 1px solid rgba(63,185,80,0.2); }
.badge-info { background: rgba(88,166,255,0.12); color: var(--accent-blue); border: 1px solid rgba(88,166,255,0.2); }
.badge-ai { background: rgba(163,113,247,0.12); color: var(--accent-purple); border: 1px solid rgba(163,113,247,0.2); }
.badge-crawler { background: rgba(57,197,207,0.12); color: var(--accent-cyan); border: 1px solid rgba(57,197,207,0.2); }

/* Dot indicator for badges */
.badge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 6px;
  background: currentColor;
  opacity: 0.7;
  vertical-align: middle;
}

/* ============ Code ============ */
pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 20px 20px 24px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.75;
  position: relative;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), var(--shadow-sm);
  tab-size: 4;
  -moz-tab-size: 4;
}

/* Line numbers via CSS counters */
pre.line-numbers {
  padding-left: 60px;
  counter-reset: line;
}
pre.line-numbers code {
  counter-increment: line;
  display: block;
  position: relative;
}
pre.line-numbers code::before {
  content: counter(line);
  position: absolute;
  left: -44px;
  width: 32px;
  text-align: right;
  color: var(--text-muted);
  opacity: 0.35;
  font-size: 11px;
  font-feature-settings: 'tnum';
  user-select: none;
  pointer-events: none;
}

pre::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px;
  height: 100%;
  background: var(--border-light);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* Language label on code blocks */
pre[data-lang] {
  padding-top: 42px;
}

pre[data-lang]::after {
  content: attr(data-lang);
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 26px;
  padding: 5px 16px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  display: flex;
  align-items: center;
}

pre code {
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: none;
  padding: 0;
  border-radius: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  background: var(--bg-tertiary);
  padding: 2px 6px;
  border-radius: 3px;
  color: var(--accent-orange);
  border: 1px solid var(--border);
}

pre code { border: none; color: var(--text-primary); }

.copy-btn {
  position: absolute;
  top: 8px; right: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: all 0.25s ease;
  font-family: var(--font-sans);
  font-weight: 500;
  z-index: 2;
}

pre:hover .copy-btn { opacity: 1; }
.copy-btn:hover { background: var(--border-light); color: var(--text-primary); transform: scale(1.05); }
.copy-btn.copied {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background: rgba(46,204,113,0.1);
  animation: copyPulse 0.4s ease;
}
@keyframes copyPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* Line highlight animation */
@keyframes codeFlash {
  0% { background: rgba(255,255,255,0.06); }
  100% { background: transparent; }
}

pre .highlight-line {
  display: block;
  margin: 0 -20px;
  padding: 0 20px;
  animation: codeFlash 1.5s ease-out;
}

/* Code block hover effect */
pre:hover {
  border-color: var(--border-light);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 0 20px rgba(0,0,0,0.2), 0 0 0 1px rgba(255,255,255,0.02);
}
pre:hover::before {
  background: linear-gradient(180deg, var(--card-accent) 0%, var(--accent-cyan) 60%, transparent 100%);
  opacity: 0.7;
}

/* Inline code refinement */
:not(pre) > code {
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 1px 7px;
  border-radius: 4px;
}

/* Code keyword colors (subtle syntax hint) */
pre .kw { color: var(--accent-purple); }
pre .str { color: var(--accent-green); }
pre .fn { color: var(--accent-blue); }
pre .cm { color: var(--text-muted); font-style: italic; }
pre .num { color: var(--accent-orange); }
pre .op { color: var(--accent-cyan); }

/* ============ Tables ============ */
.table-wrap,
.table-wrapper {
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.table-wrap:hover,
.table-wrapper:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}

.table-wrap table,
.table-wrapper table {
  margin: 0;
  border: none;
  border-radius: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin: 16px 0;
  border: 1px solid var(--border);
}

thead th {
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  border-bottom: 2px solid var(--card-accent);
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  line-height: 1.6;
  transition: background 0.2s ease;
}

tr:last-child td { border-bottom: none; }

tr:hover td {
  background: var(--tr-hover);
}

/* Alternating row subtle background */
tr:nth-child(even) td {
  background: rgba(255,255,255,0.008);
}

tr:nth-child(even):hover td {
  background: var(--tr-hover);
}

td code {
  font-size: 12px;
  white-space: nowrap;
}

/* First column emphasis */
td:first-child {
  font-weight: 500;
  color: var(--text-primary);
}

/* ============ Lists ============ */
ul, ol {
  padding-left: 24px;
  margin: 12px 0;
}

li {
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
}

li::marker { color: var(--card-accent); font-weight: 600; }

ol {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}
ol li {
  counter-increment: step;
  padding-left: 36px;
  position: relative;
  margin-bottom: 10px;
}
ol li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 24px; height: 24px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-blue);
  font-family: var(--font-mono);
}

/* ============ Definition Lists ============ */
dl {
  margin: 20px 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
dt {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-width: 140px;
  letter-spacing: 0.02em;
}
dd {
  padding: 12px 20px;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  margin: 0;
  display: flex;
  align-items: center;
}
dt:last-of-type,
dd:last-of-type {
  border-bottom: none;
}
dt code, dd code {
  font-size: 12px;
}

/* ============ Figures ============ */
figure {
  margin: 24px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
figure:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-md);
}
figure img {
  display: block;
  width: 100%;
  height: auto;
}
figure figcaption {
  padding: 10px 18px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-tertiary);
  font-style: italic;
}

/* ============ Keyboard Keys ============ */
kbd {
  display: inline-block;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-bottom-width: 3px;
  border-radius: 5px;
  box-shadow: 0 1px 0 var(--border), inset 0 1px 0 rgba(255,255,255,0.04);
  line-height: 1.5;
  vertical-align: middle;
  white-space: nowrap;
  transition: all 0.15s ease;
}
kbd:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
  box-shadow: 0 2px 0 var(--border);
}
kbd + kbd {
  margin-left: 3px;
}

/* ============ Mark / Highlight ============ */
mark {
  background: rgba(255, 179, 0, 0.18);
  color: inherit;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 500;
}
html[data-theme="forest"] mark { background: rgba(46,204,113,0.18); }
html[data-theme="arctic"] mark { background: rgba(0,229,255,0.18); }
html[data-theme="sunrise"] mark { background: rgba(255,179,0,0.22); }
html[data-theme="neon"] mark { background: rgba(255,0,255,0.15); }
html[data-theme="hacker"] mark { background: rgba(0,255,65,0.18); }

/* ============ Details / Summary (Disclosure Widget) ============ */
details {
  margin: 16px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.3s ease;
}
details:hover {
  border-color: var(--border-light);
}
details[open] {
  border-color: var(--border-light);
}
summary {
  padding: 14px 20px 14px 36px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  position: relative;
  user-select: none;
  transition: background 0.2s ease;
  background: var(--bg-secondary);
}
summary::-webkit-details-marker { display: none; }
summary::marker { display: none; content: ''; }

summary::before {
  content: '▸';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--accent-blue);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 700;
}
details[open] > summary::before {
  transform: translateY(-50%) rotate(90deg);
}
summary:hover {
  background: var(--bg-tertiary);
}
details .details-content {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}
details .details-content > :first-child { margin-top: 0; }
details .details-content > :last-child { margin-bottom: 0; }

/* ============ Blockquotes ============ */
blockquote {
  border-left: 4px solid var(--accent-orange);
  background: rgba(210,153,29,0.04);
  padding: 16px 20px;
  margin: 20px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  position: relative;
}

blockquote::before {
  content: '"';
  position: absolute;
  top: -8px;
  left: 10px;
  font-size: 32px;
  color: var(--accent-orange);
  opacity: 0.2;
  font-family: Georgia, serif;
  line-height: 1;
}

blockquote.warning {
  border-left-color: var(--accent-red);
  background: rgba(248,81,73,0.04);
}

blockquote.warning::before {
  color: var(--accent-red);
}

blockquote.info {
  border-left-color: var(--accent-blue);
  background: rgba(88,166,255,0.04);
}

blockquote.info::before {
  color: var(--accent-blue);
}

/* ============ Step Flow ============ */
.step-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0;
  position: relative;
}

/* connecting line between steps */
.step-flow::before {
  content: '';
  position: absolute;
  top: 32px;
  left: 60px;
  right: 60px;
  height: 1px;
  background: var(--border);
  z-index: 0;
}

.step-item {
  flex: 1;
  min-width: 100px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 16px;
  text-align: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 1;
}

.step-item:hover {
  border-color: var(--accent-green);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* arrow between steps */
.step-item:not(:last-child)::after {
  content: '→';
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-green);
  font-size: 16px;
  font-weight: 700;
  z-index: 2;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--accent-green-dim);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(63,185,80,0.3);
  position: relative;
  z-index: 1;
}

.step-label { font-size: 13px; font-weight: 600; margin-bottom: 4px; color: var(--text-primary); }
.step-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

/* ============ Alerts ============ */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.7;
  border-left: 4px solid;
  position: relative;
  transition: all 0.3s ease;
}

.alert:hover {
  transform: translateX(3px);
}

.alert-warning {
  background: rgba(210,153,29,0.06);
  border-color: var(--accent-orange);
  color: var(--accent-orange);
}

.alert-danger {
  background: rgba(248,81,73,0.06);
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.alert-info {
  background: rgba(88,166,255,0.06);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
}

.alert code {
  background: rgba(0,0,0,0.15);
  border-color: rgba(255,255,255,0.1);
}

/* Alert icon */
.alert::before {
  position: absolute;
  left: 14px;
  top: 14px;
  font-size: 18px;
  opacity: 0.4;
}

.alert strong {
  display: block;
  margin-bottom: 4px;
}

/* ============ Tool Grid ============ */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.tool-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--card-accent), transparent 80%);
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 0;
}

.tool-card:hover::before {
  opacity: 0.03;
}

.tool-card:hover {
  border-color: var(--card-accent);
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg), 0 8px 40px rgba(0,0,0,0.3), 0 0 30px rgba(155,89,182,0.08);
}

.tool-card .icon {
  font-size: 36px;
  margin-bottom: 14px;
  display: block;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

.tool-card:hover .icon {
  transform: scale(1.15) rotate(-5deg);
}

.tool-card h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.tool-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* ============ Tooltips (data-tooltip) ============ */
[data-tooltip] {
  position: relative;
  cursor: help;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
  transition: opacity 0.2s ease, transform 0.2s ease;
  letter-spacing: 0.01em;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
[data-tooltip].tooltip-left::after {
  left: auto; right: 0;
  transform: translateX(0) translateY(4px);
}
[data-tooltip].tooltip-left:hover::after {
  transform: translateX(0) translateY(0);
}
[data-tooltip].tooltip-right::after {
  left: 0; right: auto;
  transform: translateX(0) translateY(4px);
}
[data-tooltip].tooltip-right:hover::after {
  transform: translateX(0) translateY(0);
}

/* ============ Breadcrumbs ============ */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0;
  margin: 0 0 24px 0;
  list-style: none;
  font-size: 13px;
}
.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  margin: 0;
}
.breadcrumb li:not(:last-child)::after {
  content: '/';
  color: var(--border-light);
  font-size: 11px;
  margin-left: 2px;
}
.breadcrumb a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.breadcrumb a:hover {
  color: var(--accent-blue);
  background: var(--bg-tertiary);
}
.breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* ============ Tabs ============ */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  position: relative;
}
.tabs::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  height: 2px;
  background: var(--card-accent);
  border-radius: 2px;
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}
.tab-btn {
  padding: 12px 22px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  position: relative;
  transition: color 0.2s ease;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.tab-btn:hover {
  color: var(--text-secondary);
}
.tab-btn.active {
  color: var(--accent-blue);
}
.tab-panel {
  display: none;
  animation: fadeInUp 0.3s ease;
}
.tab-panel.active {
  display: block;
}

/* ============ Progress Bar ============ */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  margin: 8px 0;
}
.progress-bar .progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}
.progress-bar .progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: progressShimmer 2s ease-in-out infinite;
}
@keyframes progressShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.progress-bar.warning .progress-fill {
  background: linear-gradient(90deg, var(--accent-orange), var(--accent-gold, #e8b830));
}
.progress-bar.danger .progress-fill {
  background: linear-gradient(90deg, var(--accent-red), var(--accent-orange));
}

/* ============ Image Effects ============ */
.card img:not(.no-zoom),
.content-wrapper img:not(.no-zoom) {
  border-radius: var(--radius-sm);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: zoom-in;
}
.card img:not(.no-zoom):hover,
.content-wrapper img:not(.no-zoom):hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

/* ============ Abbreviation ============ */
abbr[title] {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
abbr[title]:hover {
  color: var(--accent-blue);
}

/* ============ Superscript / Subscript ============ */
sup, sub {
  font-size: 0.75em;
  position: relative;
  vertical-align: baseline;
}
sup { top: -0.5em; }
sub { bottom: -0.25em; }
sup a, sub a {
  font-size: inherit;
}
sup a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 1px;
  transition: color 0.2s ease;
}
sup a:hover {
  color: var(--accent-blue);
}

/* ============ Back to Top ============ */
.back-to-top {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 44px; height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 50;
  box-shadow: var(--shadow-md);
  font-weight: 700;
}

.back-to-top::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(var(--card-accent) var(--scroll-percent, 0%), transparent var(--scroll-percent, 0%));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top.visible::before {
  opacity: 0.8;
}

.back-to-top:hover {
  background: var(--border-light);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

/* ============ Scroll Animations (legacy - now defined above) ============ */

/* ===== Theme-specific keyframes ===== */
@keyframes auroraShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes starTwinkle {
  0%, 100% { opacity: 0.35; }
  20% { opacity: 0.9; }
  40% { opacity: 0.4; }
  60% { opacity: 0.85; }
  80% { opacity: 0.45; }
}

@keyframes neonFlicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.3; }
}

@keyframes scanlineScroll {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100vh); }
}

@keyframes warmPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

@keyframes leafFloat {
  0% { transform: translateY(0) rotate(0deg); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { transform: translateY(-100vh) rotate(360deg); opacity: 0; }
}

.animate-in { animation: fadeInUp 0.4s ease forwards; }

/* ============ Footer ============ */
.page-footer {
  border-top: 2px solid var(--border);
  margin-top: 48px;
  padding: 0;
  position: relative;
}
.page-footer::before {
  content: '';
  position: absolute;
  top: -2px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-accent), var(--accent-cyan), transparent);
  opacity: 0.5;
}

.footer-inner {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 32px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.footer-logo {
  width: 40px; height: 40px;
  background: var(--logo-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(63,185,80,0.25);
}

.footer-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.footer-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0;
}

.footer-meta {
  text-align: right;
}

.footer-meta p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.7;
}

.footer-version {
  opacity: 0.6;
  font-size: 11px !important;
}

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
    padding: 28px 16px;
  }
  .footer-brand {
    flex-direction: column;
  }
  .footer-meta {
    text-align: center;
  }
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
    --max-content-width: 100%;
  }
  .main-content { margin-right: 24px; }
  .hero h1 { font-size: 2.6rem; }
  .content-wrapper { padding: 40px 32px 64px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar-toggle { display: flex; }
  .sidebar-spring { display: none; }
  .main-content { margin-left: 0; margin-right: 0; }
  .content-wrapper { padding: 24px 20px 56px; }
  .hero { padding: 48px 0 36px; }
  .hero h1 { font-size: 2rem; }
  .hero-icon { width: 60px; height: 60px; font-size: 28px; }
  .step-flow { flex-direction: column; }
  .tool-grid { grid-template-columns: 1fr; }
  pre { font-size: 13px; padding: 16px; }
  .card { padding: 24px 20px; }
  .section-header h2 { font-size: 1.5rem; }
  .theme-switcher {
    top: 8px; right: 8px;
    gap: 1px;
    padding: 4px 5px;
    border-radius: 22px;
  }
  .theme-btn { width: 24px; height: 24px; }
  .theme-btn::after { display: none; }
  .theme-switcher::after { display: none; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.6rem; }
  .section-header h2 { font-size: 1.35rem; }
  .section-header::after { width: 40px; }
  .card h3 { font-size: 1.15rem; }
  .card { padding: 20px 16px; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
  .hero-icon { width: 52px; height: 52px; font-size: 24px; }
  .back-to-top { bottom: 16px; right: 16px; width: 38px; height: 38px; }
}

/* ============ Reduced Motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .hero-icon { animation: none; }
}

/* ============ Print Styles ============ */
@media print {
  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay,
  .sidebar-spring,
  .theme-switcher,
  .back-to-top,
  .copy-btn,
  .reading-progress,
  body::before {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .content-wrapper {
    max-width: 100%;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 12px;
    line-height: 1.5;
  }

  .card {
    background: #fff;
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
    padding: 16px;
    margin-bottom: 12px;
  }

  pre {
    background: #f5f5f5;
    border: 1px solid #ddd;
    white-space: pre-wrap;
    word-break: break-word;
    page-break-inside: avoid;
    font-size: 11px;
    padding: 12px;
  }

  pre::before { display: none; }

  .section-header {
    border-bottom-color: #000;
  }

  .section-header::after {
    background: #000;
  }

  table {
    border: 1px solid #000;
  }

  th {
    background: #eee;
    color: #000;
    border-bottom: 2px solid #000;
  }

  td {
    border-bottom: 1px solid #ccc;
    color: #333;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  .alert {
    border: 1px solid #999;
    background: #f9f9f9;
    color: #333;
  }

  .hero h1 {
    font-size: 1.8rem;
    -webkit-text-fill-color: #000;
  }

  .hero {
    padding: 20px 0;
  }
}

