<!-- 优化后的 CSS：变量化主题，易于修改 -->
<style>
  /* =========================================
     1. 主题变量配置 (在此处修改默认值)
     ========================================= */
  :root {
    /* 核心配色 */
    --bg-color: #0b1021;                    /* 深空背景色 */
    --bg-gradient: radial-gradient(circle at 50% 50%, #1a233a 0%, #0b1021 100%);
    --text-color: #e2e8f0;                  /* 全局文字颜色 */
    --link-color: #38bdf8;                  /* 链接/强调色 */
    
    /* 面板配色 */
    --panel-bg: rgba(15, 23, 42, 0.95);     /* 控制面板背景 */
    --panel-border: rgba(56, 189, 248, 0.3);/* 面板边框 */
    --panel-text: #94a3b8;                  /* 面板次要文字 */
    --input-bg: #1e293b;                    /* 输入框背景 */
    
    /* 文章区域玻璃感 */
    --article-bg: rgba(15, 23, 42, 0.6);     /* 文章背景透明度 */
  }

  /* =========================================
     2. 全局样式 (应用深空主题)
     ========================================= */
  body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed; /* 背景固定，不随滚动条动 */
    background-size: cover;
    color: var(--text-color);
    /* 如果博客园有强制背景，这里用 !important 覆盖 */
    background-color: var(--bg-color) !important; 
  }

  /* 强制改变文章区域的链接颜色，适配深色背景 */
  a { color: var(--link-color) !important; text-decoration: none; }
  a:hover { text-decoration: underline; opacity: 0.8; }

  /* =========================================
     3. 文章区域样式 (玻璃拟态)
     ========================================= */
  #main, .day, .post, .postBody, .postTitle {
    background-color: var(--article-bg) !important; 
    backdrop-filter: blur(8px); /* 毛玻璃效果，如果不想要可以去掉 */
    -webkit-backdrop-filter: blur(8px);
    border-radius: 10px;
    padding: 20px !important;
    margin-bottom: 20px !important;
    color: var(--text-color) !important;
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  }

  /* =========================================
     4. 粒子画布 (层级最高)
     ========================================= */
  #particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none; /* 穿透点击 */
  }

  /* =========================================
     5. 侧边栏控制台 (UI 样式优化)
     ========================================= */
  .particle-sidebar-widget {
    position: fixed;
    right: 20px;
    top: 100px;
    width: 300px;
    background: var(--panel-bg);
    border-radius: 16px;
    box-shadow: -8px 8px 32px rgba(0,0,0,0.5);
    z-index: 100000;
    border: 1px solid var(--panel-border);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #fff;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(15px); /* 面板本身也加一点模糊 */
  }

  /* 收起状态 */
  .particle-sidebar-widget.collapsed {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    opacity: 0.8;
  }

  /* 头部 */
  .sidebar-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    transition: background 0.2s;
  }
  .sidebar-header:hover { background: rgba(255, 255, 255, 0.1); }
  
  .sidebar-title { 
    font-size: 14px; 
    font-weight: 700; 
    color: var(--link-color); 
    white-space: nowrap; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    letter-spacing: 0.5px;
  }
  
  .collapsed .sidebar-title span { display: none; }
  
  .toggle-btn { 
    color: var(--panel-text); 
    font-size: 14px; 
    transition: transform 0.4s ease; 
  }
  .collapsed .toggle-btn { transform: rotate(180deg); }

  /* 控制区 */
  .sidebar-controls {
    padding: 16px;
    max-height: 500px;
    overflow-y: auto;
    /* 隐藏滚动条但保留功能 */
    scrollbar-width: none; 
  }
  .sidebar-controls::-webkit-scrollbar { display: none; }
  
  .collapsed .sidebar-controls { display: none; }

  /* 统计栏 */
  .stats-top {
    font-size: 11px;
    color: var(--panel-text);
    margin-bottom: 12px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px dashed rgba(255,255,255,0.1);
  }

  /* 控件组 */
  .ctrl-group { margin-bottom: 16px; }
  .ctrl-label { 
    display: block; 
    color: var(--panel-text); 
    font-size: 10px; 
    margin-bottom: 8px; 
    text-transform: uppercase; 
    font-weight: 700; 
    letter-spacing: 1px;
  }
  .ctrl-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12px; }

  /* 滑块样式重置 */
  input[type="range"] { 
    -webkit-appearance: none; 
    width: 100%; 
    height: 4px; 
    background: #334155; 
    border-radius: 2px; 
    outline: none; 
  }
  input[type="range"]::-webkit-slider-thumb { 
    -webkit-appearance: none; 
    width: 14px; 
    height: 14px; 
    border-radius: 50%; 
    background: var(--link-color); 
    cursor: pointer; 
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.5); 
  }

  /* 下拉菜单 */
  select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    padding: 8px;
    border-radius: 8px;
    font-size: 12px;
    outline: none;
    cursor: pointer;
    transition: border 0.2s;
  }
  select:hover { border-color: var(--link-color); }

  /* 标签 */
  .badge { 
    background: rgba(56, 189, 248, 0.15); 
    color: var(--link-color); 
    padding: 2px 6px; 
    border-radius: 4px; 
    font-size: 10px; 
    font-weight: bold;
    min-width: 24px; 
    text-align: center; 
  }

  /* 开关 */
  .toggle-switch { position: relative; width: 36px; height: 20px; }
  .toggle-switch input { opacity: 0; width: 0; height: 0; }
  .toggle-slider { 
    position: absolute; 
    cursor: pointer; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background-color: #334155; 
    transition: .3s; 
    border-radius: 20px; 
  }
  .toggle-slider:before { 
    position: absolute; 
    content: ""; 
    height: 14px; width: 14px; 
    left: 3px; bottom: 3px; 
    background-color: white; 
    transition: .3s; 
    border-radius: 50%; 
  }
  input:checked + .toggle-slider { background-color: var(--link-color); }
  input:checked + .toggle-slider:before { transform: translateX(16px); }

  /* 移动端适配 */
  @media (max-width: 768px) {
    .particle-sidebar-widget { 
      top: auto; 
      bottom: 15px; 
      right: 15px; 
      width: calc(100% - 30px); 
      max-height: 45vh; 
    }
    .particle-sidebar-widget.collapsed { 
      width: 45px; 
      height: 45px; 
    }
  }
</style>
