/* ================= 0. 基础设置 ================= */
:root {
  --primary: #0066ff;
  --secondary: #ffcc00;
  --text: #222;
  --radius: 12px;
  --maxWidth: 1100px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  min-height: 100vh; /* 确保网页至少有一屏那么高 */
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
  
  /* 修复底部白条：给背景一个深色底色，万一图片没加载出来也是深色的 */
  background-color: #1a1a1a; 
  
  /* 【重要修复】移除了 body 的动画，防止 fixed 按钮失效 */
  /* animation: pageIn 0.8s ease-out both;  <-- 这行删掉了 */
}

/* 让内容模块自己单独做进场动画，不影响 body */
.module, .top-nav {
  animation: pageIn 0.8s ease-out both;
}

html { scroll-behavior: smooth; }
a { text-decoration: none; color: inherit; }

/* 全局图片保险 */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ================= 1. 背景图 + 遮罩 (修复缩放问题) ================= */
.bg-overlay {
  position: fixed;
  inset: 0;
  
  /* 背景图设置 - 更新路径 */
  background-image: url("../images/beijin.jpg");
  background-repeat: no-repeat;
  
  /* --- 修复背景缩放过大 --- */
  /* cover: 铺满全屏（会裁切），但我们加上 center top 让它优先显示上方（脸部） */
  background-size: cover; 
  background-position: center top; 
  
  z-index: -2;
}

/* 如果在手机上觉得背景还是太糊太大，可以用下面的代码覆盖（可选） */
@media (max-width: 768px) {
  .bg-overlay {
    /* 在手机上改用 center center 或者调整位置 */
    background-position: center center;
  }
}

.bg-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2); /* 遮罩暗度 */
}

/* ================= 2. 顶部导航栏 ================= */
.top-nav {
  /* 修改1：从 sticky 改为 fixed，彻底固定在浏览器顶部 */
  position: fixed; 
  top: 0;
  left: 0;
  width: 100%; /* fixed 需要指定宽度 */
  
  z-index: 1000;
  background: rgba(255, 255, 255, 0.1);
  
  /* 修改2：减少模糊度，从 12px 降到 4px */
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--maxWidth);
  margin: auto;
  padding: 0 20px;
  height: 60px;
}
.logo { font-size: 20px; font-weight: bold; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.nav-list { display: flex; gap: 24px; list-style: none; }
.nav-list a { color: #fff; font-weight: 500; transition: .2s; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.nav-list a:hover { color: var(--secondary); }
.nav-toggle { display: none; font-size: 24px; background: none; border: none; color: #fff; cursor: pointer; }

/* ================= 3. 通用模块卡片 ================= */
.module { padding: 80px 20px; position: relative; }
.glass {
  max-width: var(--maxWidth);
  margin: 40px auto;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: #fff;
  padding: 40px;
}
.container { padding: 0; }

/* ================= 4. 首页与头像 ================= */
.home-module {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 85vh; /* 调整高度 */
}

.home-content {
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.avatar {
  width: 140px !important;
  height: 140px !important;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.6);
  margin: 0 auto 20px auto;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.home-title { font-size: 2.5rem; margin-bottom: 10px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.home-bio { font-size: 1.2rem; margin-bottom: 30px; opacity: 0.9; }

.visit-stats { margin-top: 20px; font-size: 0.9rem; opacity: 0.8; }

/* ================= 5. 按钮样式 ================= */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: .2s;
  cursor: pointer;
  text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; border: 2px solid var(--primary); }
.btn-primary:hover { background: #0053d9; border-color: #0053d9; }
.btn-outline { background: transparent; color: #fff; border: 2px solid #fff; }
.btn-outline:hover { background: #fff; color: var(--primary); }
.home-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ================= 6. 项目网格 ================= */
.project-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.project-card {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.2);
  overflow: hidden;
  transition: transform 0.2s;
}
.project-card:hover { transform: translateY(-5px); }
.card-img { width: 100%; height: 160px; object-fit: cover; }
.card-body { padding: 20px; }
.card-body h3 { margin-bottom: 10px; }
.card-body p { margin-bottom: 15px; opacity: 0.8; font-size: 0.95rem; }

/* ================= 7. 联系我网格 ================= */
.contact-grid { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.contact-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 24px;
  width: 200px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.contact-card h3 { margin-bottom: 10px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.contact-card p { font-size: 0.9rem; opacity: 0.8; margin-bottom: 15px; }

/* ================= 8. 功能按钮与面板 (重点修复) ================= */
.ctrl-btn {
  position: fixed; /* 修复后，这里终于可以生效了 */
  right: 20px;
  z-index: 999;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: .2s;
}
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.4); transform: scale(1.05); }

/* 按钮位置 */
#log-toggle { bottom: 130px; }
#music-toggle { bottom: 70px; }

/* 侧边日志面板 */
.side-panel {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 1001;
  width: 320px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  transform: translateX(-100%);
  transition: transform .3s ease;
  border-right: 1px solid rgba(255,255,255,0.1);
  color: #fff;
}
.side-panel:not(.collapsed) { transform: translateX(0); }
.panel-inner { padding: 24px; height: 100%; overflow-y: auto; }
.close-btn { position: absolute; right: 15px; top: 15px; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }
.log-list { list-style: none; margin-top: 20px; }
.log-list li { margin-bottom: 15px; font-size: 0.95rem; line-height: 1.5; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; }

/* 音乐面板 */
#music-panel {
  position: fixed;
  right: 75px;
  bottom: 70px;
  z-index: 998;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 12px;
  overflow: hidden;
  transition: all .3s ease;
  transform-origin: bottom right;
  opacity: 1;
  transform: scale(1);
}
#music-panel.collapsed { opacity: 0; transform: scale(0.8); pointer-events: none; }

/* ================= 9. 响应式与修复 ================= */
@media (max-width: 768px) {
  .nav-list {
    position: fixed;
    left: 0; top: 60px; width: 100%; height: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.95); /* 加深手机端导航背景 */
    backdrop-filter: blur(10px);
    flex-direction: column;
    align-items: center;
    gap: 20px;
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .nav-list.open { height: calc(100vh - 60px); padding-top: 60px; }
  .nav-toggle { display: block; }
  .home-title { font-size: 1.8rem; }
}

/* 进场动画 */
@keyframes pageIn {
  0% { filter: blur(10px); opacity: 0; }
  100% { filter: none; opacity: 1; } /* 重点：filter: none 释放定位限制 */
}
/* 遮罩层 */
#splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000;
  transition: opacity 0.8s ease-out, visibility 0.8s;
  opacity: 1;
}
#splash.hide { opacity: 0; visibility: hidden; }

/* 图标修复 */
.fa, .fas, .fab, .far { font-size: inherit; display: inline-block; line-height: 1; }
.ctrl-btn i { font-size: 20px !important; }

/* 手动播放按钮样式 */
  #manual-play {
    position: absolute;
    z-index: 100001;
    background: transparent;
    border: 2px solid rgba(255,255,255,0.6);
    color: #fff;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 30px;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: .3s;
  }
  #manual-play:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
  }
  #manual-play i {
    margin-right: 8px;
  }
