/* 统一顶部项目高度，保证完美对齐 */
:root {
  --nav-item-h: 32px;
}

/* ===== 页面整体 ===== */
.wallpaper-page {
  background: #f5f7fa;
  min-height: 100vh;
  /* padding-top: 70px; */
  font-family: 'Segoe UI', 'PingFang SC', sans-serif;
}

/* 顶部导航栏 */
.wallpaper-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #3498db;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
  z-index: 1000;
}

/* 左侧：壁纸库 + 头像笔记 + 首页（全部同高对齐） */
.wallpaper-navbar .nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.wallpaper-navbar .nav-left > * {
  height: var(--nav-item-h);
  display: flex;
  align-items: center;
  /* 垂直居中容器内容 */
}

.wallpaper-navbar .logo {
  font-size: 20px;
  font-weight: bold;
  color: #fff;
  line-height: var(--nav-item-h);
  /* 文本基线对齐 */
}

.wallpaper-navbar .site-info {
  gap: 8px;
}

.wallpaper-navbar .site-info img {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: block;
  /* 去除内联基线 */
}

.wallpaper-navbar .site-info span {
  font-size: 16px;
  color: #fff;
  font-weight: bold;
  line-height: var(--nav-item-h);
}

/* 首页链接（默认白色；hover 渐变） */
.wallpaper-navbar .home-link {
  gap: 6px;
  text-decoration: none;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  line-height: var(--nav-item-h);
  transition: all 0.3s ease;
  margin-left: 15px;
  /* 👈 这里就是控制它整体往右偏移 */
}

.wallpaper-navbar .home-link .icon {
  width: 20px;
  height: 20px;
  display: block;
  fill: #fff;
  transform: translateY(-1px);
  /* 微调 1px，彻底对齐视觉中心 */
  transition: fill 0.3s ease;
}

.wallpaper-navbar .home-link span {
  color: #fff;
  transition: all 0.3s ease;
}

.wallpaper-navbar .home-link:hover .icon {
  fill: url(#nav-gradient);
}

.wallpaper-navbar .home-link:hover span {
  background: linear-gradient(90deg, #30a9de, #0066ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* 控件区 */
.wallpaper-navbar .controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wallpaper-navbar select {
  min-width: 140px;
  max-width: 180px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.wallpaper-navbar select,
.wallpaper-navbar input,
.wallpaper-navbar button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.wallpaper-navbar button {
  background: #2980b9;
  color: #fff;
  cursor: pointer;
}

.wallpaper-navbar button:hover {
  background: #1f6699;
}

/* 图片网格：固定 5 列，居中留白 */
.wallpaper-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  padding: 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.wallpaper-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.wallpaper-card:hover {
  transform: translateY(-6px);
}

.wallpaper-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

/* hover 信息 */
.wallpaper-info {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  font-size: 13px;
  transition: opacity 0.3s;
  text-align: center;
}

.wallpaper-card:hover .wallpaper-info {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 2000;
}

.lightbox.hidden {
  display: none;
}

.lightbox img {
  max-width: 90%;
  max-height: 80%;
  border-radius: 10px;
}

.lightbox .close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 30px;
  cursor: pointer;
}

.lightbox-actions {
  margin-top: 15px;
}

.lightbox-actions a {
  margin: 0 10px;
  padding: 8px 16px;
  background: #3498db;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
}

#resolutionInput {
  min-width: 140px;
}

/* 统一隐藏逻辑：彻底不占位 */
.hidden {
  display: none !important;
}

/* Lightbox 视频样式（和图片对齐） */
.lightbox video {
  max-width: 90%;
  max-height: 80%;
  border-radius: 10px;
}

.wallpaper-card img,
.wallpaper-card video {
  width: 100%;
  height: 160px;
  object-fit: cover;
  display: block;
}

/* ------------------------------------------------ */

.lightbox {
  display: flex;
  flex-direction: column; /* 强制上下排列 */
  justify-content: center;
  align-items: center;
}

.lightbox img,
.lightbox video {
  max-width: 90%;
  max-height: 80%;
  border-radius: 10px;
  margin-bottom: 15px; /* 👈 保证和按钮之间留间距 */
}

.lightbox-actions {
  order: 2; /* 始终在最后 */
  display: flex;
  justify-content: center;
  width: 100%;
}

/* ---------------------------------------------- */

/* ===== 手机端：一排 左=壁纸库+头像+笔记  右=图标+首页；第二排=所有搜索控件 ===== */
@media (max-width: 600px) {
  /* 顶栏容器允许换行：第一行=左右两块，第二行=控件区 */
  .wallpaper-navbar {
    display: flex;
    flex-wrap: wrap; /* 允许换行 -> 两排 */
    align-items: center;
    padding: 10px;
    height: auto;
  }

  /* 左侧：壁纸库 + 头像 + 辉少笔记（靠左） */
  .wallpaper-navbar .nav-left {
    order: 0; /* 第一排 */
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto; /* 占据左边空间 */
    min-width: 0;
  }
  .wallpaper-navbar .logo,
  .wallpaper-navbar .site-info {
    white-space: nowrap; /* 防止竖向折行 */
  }

  /* 右侧：首页图标（靠右） */
  .wallpaper-navbar .home-link {
    order: 0; /* 第一排 */
    margin-left: auto; /* 顶到最右 */
    display: flex;
    align-items: center;
    gap: 6px;
  }

  /* 第二排：控件区独占整行，纵向排布且同宽 */
  .wallpaper-navbar .controls {
    order: 1; /* 第二排 */
    flex: 1 1 100%; /* 独占整行 */
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
  }

  .wallpaper-navbar select,
  .wallpaper-navbar input,
  .wallpaper-navbar button {
    /* width: 100%;
    flex: none; */
    display: block;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box;
    margin: 0; /* 防止 UA 默认 margin 造成错位 */
  }

  /* 手机端网格两列，更耐看 */
  .wallpaper-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 超小屏：可选，隐藏“辉少笔记”文案（只留头像），保留首页在右侧 */
@media (max-width: 400px) {
  .wallpaper-navbar .site-info span {
    display: none;
  }
  .wallpaper-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------- */
/* 仅手机端显示箭头，桌面端隐藏 */
.mobile-toggle {
  display: none;
  margin-left: 6px;
  font-size: 14px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  line-height: 1;
}

@media (max-width: 900px) {
  .mobile-toggle {
    display: inline-block;
  }

  /* 手机端默认收起：注意提高选择器优先级并使用 !important 覆盖之前的 flex */
  .wallpaper-navbar .controls {
    display: none !important;
    flex-direction: column;
    gap: 8px;
    padding: 10px 0;
  }
  .wallpaper-navbar .controls.show {
    display: flex !important;
  }
}
