/* ========== 基础重置 ========== */
:root {
  --bg-image: url("../images/wallpapers/default.jpg");
  --transition-speed: 0.6s;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #1a1a1a;
  color: #fff;
  overflow: hidden;
}

/* ========== 页面容器 ========== */
.page-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  transition: transform var(--transition-speed) cubic-bezier(0.25, 0.8, 0.25, 1);
  will-change: transform;
}

/* ========== 全屏页面通用 ========== */
.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.nav-screen {
  top: 100%;
}

.screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
}

.home-screen::before {
  background: rgba(0, 0, 0, 0.4);
}

.nav-screen::before {
  background: rgba(0, 0, 0, 0.6);
}

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

/* ========== 起始页 ========== */
.home-screen {
  justify-content: flex-start;
  padding-top: 28vh;
  gap: 20px;
}

.brand {
  position: absolute;
  top: 24px;
  left: 32px;
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 2px;
  opacity: 0.85;
  z-index: 2;
}

/* 右上角菜单按钮 */
.menu-btn {
  position: absolute;
  top: 20px;
  right: 28px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #fff;
  opacity: 0.6;
  transition: opacity 0.2s;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn:hover {
  opacity: 1;
}

/* 下拉菜单 */
.menu-dropdown {
  position: absolute;
  top: 64px;
  right: 24px;
  min-width: 150px;
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 6px 0;
  display: none;
  z-index: 20;
}

.menu-dropdown.show {
  display: block;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #fff;
  transition: background 0.2s;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* 时间 */
.time-box {
  text-align: center;
}

.time {
  font-size: clamp(2.8rem, 9vw, 5.5rem);
  font-weight: 200;
  line-height: 1.1;
  letter-spacing: 2px;
}

/* 搜索框 */
.search-form {
  display: flex;
  align-items: center;
  width: min(90%, 560px);
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  border-radius: 50px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  position: relative;
}

.engine-wrapper {
  position: relative;
  flex-shrink: 0;
}

.engine-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
  overflow: hidden;
}

.engine-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

.engine-btn img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: contain;
}

.engine-dropdown {
  position: absolute;
  top: 48px;
  left: 0;
  min-width: 130px;
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  padding: 6px 0;
  display: none;
  z-index: 10;
}

.engine-dropdown.show {
  display: block;
}

.engine-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #fff;
  transition: background 0.2s;
}

.engine-option:hover {
  background: rgba(255, 255, 255, 0.2);
}

.engine-option.active {
  background: rgba(255, 255, 255, 0.15);
}

.engine-option img {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: contain;
}

.search-input {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 1rem;
  min-width: 0;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.search-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
}

.search-btn:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* 下滑提示 */
.scroll-hint {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.8;
  transition: opacity 0.5s;
  z-index: 2;
}

.scroll-hint.hidden {
  opacity: 0;
  pointer-events: none;
}

.scroll-hint span {
  font-size: 0.85rem;
  font-weight: 300;
}

.arrow {
  font-size: 1.4rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(8px);
  }
}

/* ========== 导航页 ========== */
.nav-screen {
  justify-content: flex-start;
  padding: 40px 20px 30px;
  gap: 24px;
}

.nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(100%, 1000px);
  margin-top: 10px;
}

.nav-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 4px;
}

.back-hint {
  font-size: 0.9rem;
  opacity: 0.7;
  font-weight: 300;
}

.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  width: min(100%, 1000px);
  flex: 1;
  align-content: center;
}

.nav-card {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 18px 20px;
  transition: transform 0.2s, background 0.2s;
}

.nav-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.2);
}

.nav-card h2 {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 14px;
  letter-spacing: 1px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.nav-footer {
  font-size: 0.8rem;
  opacity: 0.6;
  font-weight: 300;
}

/* ========== 壁纸弹窗 ========== */
.wallpaper-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.wallpaper-modal.show {
  display: flex;
}

.wallpaper-modal-content {
  width: 90%;
  max-width: 1000px;
  background: rgba(30, 30, 30, 0.9);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 24px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-weight: 300;
  letter-spacing: 2px;
}

.close-modal {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.close-modal:hover {
  opacity: 1;
}

.wallpaper-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: center;
}

.wallpaper-item {
  width: 180px;
  height: 100px;
  border-radius: 12px;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.2s, border-color 0.2s;
  position: relative;
  overflow: hidden;
}

.wallpaper-item:hover {
  transform: scale(1.05);
  border-color: rgba(255, 255, 255, 0.6);
}

.wallpaper-item span {
  position: absolute;
  bottom: 5px;
  left: 8px;
  font-size: 0.75rem;
  opacity: 0.8;
  text-shadow: 0 0 4px rgba(0,0,0,0.6);
}

.upload-item {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.4);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.upload-item:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.8);
}

.upload-item .plus {
  font-size: 2rem;
  font-weight: 200;
}

.upload-item .label {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* ========== 响应式 ========== */
@media (max-width: 600px) {
  .brand {
    top: 16px;
    left: 20px;
  }

  .menu-btn {
    top: 16px;
    right: 20px;
  }

  .home-screen {
    padding-top: 22vh;
  }

  .nav-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .nav-screen {
    padding: 24px 16px 20px;
    gap: 16px;
  }

  .nav-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .wallpaper-modal-content {
    padding: 16px;
  }

  .wallpaper-item {
    width: 140px;
    height: 80px;
  }
}