* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Microsoft YaHei", Arial, sans-serif;
  min-height: 100vh;
  padding: 20px;
  color: #cac3c3;
  /* 默认日间模式背景 */
  background: url(https://blog.iceegg.cn/randomphoto/randomphoto-day.php)
    no-repeat center center fixed;
  background-size: cover;
  /* 移除背景动画以防止晃动 */
  /* background-size: 400% 400%;
  animation: gradientShift 15s ease infinite; */
  transition: background 0.5s ease;
  /* 使用flex布局使内容垂直和水平居中 */
  display: flex;
  flex-direction: column;
}

/* 夜间模式 */
body.night-mode {
  background: url(https://blog.iceegg.cn/randomphoto/randomphoto-night.php)
    no-repeat center center fixed;
  background-size: cover;
  color: #e0e0e0;
  /* 移除背景动画 */
}

/* 移除背景动画相关代码 */
/* @keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
} */

.container {
  max-width: 1200px;
  margin: 0 auto;
  /* 当只有一张卡片时，确保容器不影响居中 */
  display: flex;
  flex-direction: column;
  flex: 1;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  padding: 50px 0 30px;
  width: 100%;
}

h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: #f0f6fc;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 夜间模式下的标题 */
body.night-mode h1 {
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
  font-size: 1.1rem;
  color: #e4e5e6;
  max-width: 600px;
  margin: 0 auto;
}

/* 夜间模式下的副标题 */
body.night-mode .subtitle {
  color: #dbdbdb;
}

/* 昼夜切换按钮 */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 30px;
  padding: 10px 15px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #333;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

body.night-mode .theme-toggle {
  background: rgba(30, 30, 40, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.theme-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.15);
}

body.night-mode .theme-toggle:hover {
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.friends-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 25px;
  padding: 30px 0 50px;
  /* 添加弹性过渡效果 */
  transition: all 0.5s ease;
  width: 100%;
  flex: 1;
}

.friend-card {
  border-radius: 15px;
  overflow: hidden;
  transition: all 0.3s ease;
  position: relative;
  height: 100%;
  /* 添加3D变换样式 */
  transform-style: preserve-3d;
  will-change: transform;
  /* 设置固定宽度以确保居中效果 */
  width: 260px;
  margin: 0;
  /* 毛玻璃效果 */
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
}

/* 夜间模式下的卡片 */
body.night-mode .friend-card {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.friend-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

/* 夜间模式下的悬停效果 */
body.night-mode .friend-card:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.card-bg {
  height: 120px;
  background-size: cover;
  background-position: center;
  transition: transform 0.3s ease;
  /* 添加滤镜效果 */
  filter: saturate(1.2);
}

.card-content {
  padding: 70px 20px 25px;
  text-align: center;
  position: relative;
}

.friend-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.5);
  object-fit: cover;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2rem;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  transition: transform 0.3s ease;
  /* 添加发光效果 */
  filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.1));
  /* 毛玻璃效果 */
  background: rgba(106, 137, 204, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

/* 夜间模式下的头像边框 */
body.night-mode .friend-avatar {
  border: 4px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.friend-name {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 15px 0 10px;
  color: #2c3e50;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 夜间模式下的名称 */
body.night-mode .friend-name {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.friend-desc {
  color: #1d1e1f;
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}

/* 夜间模式下的描述 */
body.night-mode .friend-desc {
  color: #d4d2d2;
  text-shadow: none;
}

/* 美化访问按钮 */
.friend-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 25px;
  background: linear-gradient(135deg, #6a89cc 0%, #82a0ff 100%);
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  gap: 8px;
  /* 毛玻璃效果 */
  background: rgba(106, 137, 204, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 15px rgba(106, 137, 204, 0.25);
}

.friend-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: 0.5s;
}

.friend-link:hover::before {
  left: 100%;
}

.friend-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 7px 20px rgba(106, 137, 204, 0.35);
}

.friend-link:active {
  transform: translateY(-1px);
}

/* 夜间模式下的链接按钮 */
body.night-mode .friend-link {
  background: rgba(80, 100, 180, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

body.night-mode .friend-link:hover {
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.3);
}

/* 箭头图标样式 */
.arrow-icon {
  transition: transform 0.3s ease;
}
/* 添加悬浮简介信息样式 */
.friend-hover-info {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.8);
  color: rgb(27, 26, 26);
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 0.9rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  margin-bottom: 10px;
  backdrop-filter: blur(5px);
  z-index: 10;
}

.friend-hover-info::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.8) transparent transparent transparent;
}

.friend-card:hover .friend-hover-info {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-5px);
}

/* 夜间模式下的悬浮信息样式 */
body.night-mode .friend-hover-info {
  background: rgba(255, 255, 255, 0.9);
}

body.night-mode .friend-hover-info::after {
  border-color: rgba(50, 50, 60, 0.9) transparent transparent transparent;
}
footer {
  text-align: center;
  color: #7f8c8d;
  padding: 40px 0;
  margin-top: 20px;
  font-size: 0.95rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  width: 100%;
}

/* 夜间模式下的页脚 */
body.night-mode footer {
  color: #b0b0b0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes pulse {
  0% {
    box-shadow: 0 4px 15px rgba(106, 137, 204, 0.25);
  }
  50% {
    box-shadow: 0 4px 20px rgba(106, 137, 204, 0.4);
  }
  100% {
    box-shadow: 0 4px 15px rgba(106, 137, 204, 0.25);
  }
}

@media (max-width: 768px) {
  .friends-grid {
    padding: 20px 0 30px;
    gap: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .theme-toggle {
    top: 15px;
    right: 15px;
    padding: 8px 12px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 15px;
  }

  .friend-card {
    width: 100%;
    max-width: 260px;
  }

  .theme-toggle {
    top: 10px;
    right: 10px;
  }
}
