/* ═══════════════════════════════════════════════
   Reset & root
═══════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --t: 0.42s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Zen Kaku Gothic New', 'Noto Serif SC', sans-serif;
}

/* ═══════════════════════════════════════════════
   背景 — 纯黑底 + 图片淡入层
═══════════════════════════════════════════════ */
#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-color: #080810;       /* 纯黑底，避免撕裂感 */
  transition: filter var(--t), transform var(--t);
  transform: scale(1.04);
}

#bg-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  /* 慢速缓入，1.8s 才到完全可见 */
  transition: opacity 1.8s cubic-bezier(0.25, 0, 0.1, 1);
}

#bg-img.loaded {
  opacity: 1;
}

/* 搜索框聚焦时背景模糊 */
#bg.blurred {
  filter: blur(20px) brightness(0.5);
  transform: scale(1.09);
}

/* 暗角 */
#bg::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(ellipse at center, transparent 25%, rgba(0, 0, 0, 0.65) 100%);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════
   遮罩层
═══════════════════════════════════════════════ */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.12);
  transition: background var(--t);
  pointer-events: none;
}

#overlay.active {
  background: rgba(0, 0, 0, 0.45);
}

/* ═══════════════════════════════════════════════
   主舞台 — 黄金分割布局
   padding-top: 28vh → 内容中心约在 38.2% 处
═══════════════════════════════════════════════ */
#stage {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 28vh;
  justify-content: flex-start;
}

/* ═══════════════════════════════════════════════
   时钟
═══════════════════════════════════════════════ */
#clock {
  font-family: 'Noto Serif SC', serif;
  font-size: clamp(2.8rem, 7.5vw, 5.5rem);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.08em;
  text-shadow: 0 2px 32px rgba(0, 0, 0, 0.6);
  margin-bottom: 0.18em;
  transition: opacity var(--t), transform var(--t);
  user-select: none;
}

#clock.hidden {
  opacity: 0;
  transform: translateY(-12px);
}

#date-label {
  font-size: clamp(0.7rem, 1.4vw, 0.9rem);
  color: rgba(255, 255, 255, 0.42);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 2.4rem;
  transition: opacity var(--t);
  user-select: none;
}

#date-label.hidden {
  opacity: 0;
}

/* ═══════════════════════════════════════════════
   搜索框容器（含候选下拉、引擎下拉的定位锚）
═══════════════════════════════════════════════ */
#search-wrap {
  width: min(600px, 88vw);
  position: relative;
}

/* ═══════════════════════════════════════════════
   搜索框本体
═══════════════════════════════════════════════ */
#search-box {
  width: 100%;
  position: relative;
  height: 52px;
}

/* ── 输入框 ── */
#search-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 1.3rem 0 7rem;          /* 左侧留出引擎按钮空间 */
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 13px;
  /* 暗玻璃质感 */
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(28px) saturate(150%);
  -webkit-backdrop-filter: blur(28px) saturate(150%);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 300;
  letter-spacing: 0.02em;
  outline: none;
  transition:
    background var(--t),
    border-color var(--t),
    box-shadow var(--t),
    padding-left var(--t);
  caret-color: rgba(255, 255, 255, 0.8);
  z-index: 1;
}

#search-input::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

/* 聚焦态 */
#search-box.focused #search-input {
  background: rgba(0, 0, 0, 0.62);
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.05),
    0 10px 44px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding-left: 2.8rem;              /* 引擎按钮消失，左内边距收窄 */
}

/* ═══════════════════════════════════════════════
   左侧引擎切换按钮
═══════════════════════════════════════════════ */
#engine-toggle {
  position: absolute;
  left: 1.5px;
  top: 1.5px;
  bottom: 1.5px;
  z-index: 3;                        /* 必须高于 input 的 z-index:1 */
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  gap: 0.35rem;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px 0 0 11px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.07em;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;                  /* 裁剪波纹 */
  transition:
    background 0.2s,
    color 0.2s,
    opacity var(--t),
    transform var(--t);
}

#engine-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

#engine-toggle .chevron {
  width: 10px;
  height: 10px;
  opacity: 0.45;
  transition: transform 0.28s ease;
  flex-shrink: 0;
}

#engine-toggle.open .chevron {
  transform: rotate(180deg);
}

/* 输入框聚焦时引擎按钮淡出 */
#search-box.focused #engine-toggle {
  opacity: 0;
  transform: translateX(-8px);
  pointer-events: none;
}

/* ═══════════════════════════════════════════════
   波纹动画
═══════════════════════════════════════════════ */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  transform: scale(0);
  animation: ripple-anim 0.55s ease-out forwards;
  pointer-events: none;
}

@keyframes ripple-anim {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* ═══════════════════════════════════════════════
   引擎下拉菜单
═══════════════════════════════════════════════ */
#engine-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  z-index: 10;
  background: rgba(12, 12, 18, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  overflow: hidden;
  /* 默认隐藏 */
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#engine-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.dd-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  position: relative;
  overflow: hidden;                  /* 裁剪波纹 */
  transition: background 0.16s, color 0.16s;
}

.dd-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.dd-item.active {
  color: #fff;
}

.dd-item + .dd-item {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.dd-item .check {
  margin-left: auto;
  width: 13px;
  height: 13px;
  opacity: 0;
  transition: opacity 0.18s;
  color: rgba(255, 255, 255, 0.65);
  flex-shrink: 0;
}

.dd-item.active .check {
  opacity: 1;
}

/* ═══════════════════════════════════════════════
   搜索图标（聚焦时显示）
═══════════════════════════════════════════════ */
#search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%) scale(0.4) rotate(-40deg);
  color: rgba(255, 255, 255, 0.38);
  display: flex;
  align-items: center;
  pointer-events: none;
  opacity: 0;
  z-index: 2;
  transition: opacity var(--t), transform var(--t);
}

#search-icon svg {
  width: 16px;
  height: 16px;
}

#search-box.focused #search-icon {
  opacity: 1;
  transform: translateY(-50%) scale(1) rotate(0deg);
}

/* ═══════════════════════════════════════════════
   候选列表（最多 6 条，无滚动条）
═══════════════════════════════════════════════ */
#suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 9;
  background: rgba(12, 12, 18, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  overflow: hidden;                  /* 超出直接裁剪 */
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#suggestions.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

.sug-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 1rem;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.9rem;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.14s, color 0.14s;
}

.sug-item:hover,
.sug-item.selected {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.sug-item + .sug-item {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sug-icon {
  width: 13px;
  height: 13px;
  opacity: 0.28;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════
   底部装饰
═══════════════════════════════════════════════ */
#img-credit {
  position: fixed;
  bottom: 1.2rem;
  right: 1.4rem;
  z-index: 3;
  font-size: 0.67rem;
  color: rgba(255, 255, 255, 0.22);
  letter-spacing: 0.06em;
  text-decoration: none;
  user-select: none;
  transition: color 0.2s;
}

#img-credit:hover {
  color: rgba(255, 255, 255, 0.5);
}

#refresh-bg {
  position: fixed;
  bottom: 1.1rem;
  left: 1.4rem;
  z-index: 3;
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.11);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.32);
  transition: color 0.2s, background 0.2s, transform 0.6s ease;
}

#refresh-bg:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(0, 0, 0, 0.55);
}

#refresh-bg.spinning {
  transform: rotate(360deg);
}

#refresh-bg svg {
  width: 14px;
  height: 14px;
}
