:root {
  --bg-deep: #05060f;
  --text-main: #f4f7ff;
  --text-soft: rgba(244, 247, 255, 0.72);
  --accent-cyan: #5fd3ff;
  --accent-violet: #9b8cff;
  --accent-warm: #ffd9a0;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-yuanti: "ZCOOLKuaiLe", "YouYuan", "幼圆", "Yuanti SC", "Noto Sans SC", "PingFang SC", sans-serif;
}

/* 自托管圆体（站酷快乐体，OFL 授权），跨设备一致显示圆体；原“幼圆”为 Windows 独占字体，苹果设备缺失 */
@font-face {
  font-family: "ZCOOLKuaiLe";
  src: url("../fonts/zcool.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

/* ---------- 宇宙背景 ---------- */
#space {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* ---------- 开场视频 ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  opacity: 1;
  transition: opacity 1.4s ease;
}
.intro.is-hidden {
  opacity: 0;
  pointer-events: none;
}
.intro__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.intro__controls {
  position: absolute;
  right: 28px;
  bottom: 28px;
  display: flex;
  gap: 12px;
  z-index: 12;
}
.ctrl-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 14, 30, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}
.ctrl-btn:hover {
  background: rgba(95, 211, 255, 0.18);
  border-color: rgba(95, 211, 255, 0.55);
  transform: translateY(-1px);
}
.intro__hint {
  position: absolute;
  left: 0; right: 0; bottom: 26px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: rgba(255, 255, 255, 0.45);
  z-index: 11;
  animation: breathe 2.6s ease-in-out infinite;
}

/* ---------- 主页内容 ---------- */
.content {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease;
}
.content.is-shown {
  opacity: 1;
  pointer-events: auto;
}
.content__inner {
  padding: 0 24px;
  max-width: 860px;
}
.line {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1), transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.content.is-shown .line--1 { transition-delay: 0.25s; opacity: 1; transform: none; }
.content.is-shown .line--2 { transition-delay: 1.0s;  opacity: 1; transform: none; }
.content.is-shown .line--3 { transition-delay: 1.8s;  opacity: 1; transform: none; }

.line--1 {
  font-family: var(--font-yuanti);
  font-weight: 700;
  font-size: clamp(26px, 4.4vw, 46px);
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-shadow: 0 0 28px rgba(95, 211, 255, 0.35), 0 2px 18px rgba(0, 0, 0, 0.6);
}
.line--2 {
  margin-top: 22px;
  font-family: var(--font-yuanti);
  font-weight: 300;
  font-size: clamp(14px, 2.2vw, 20px);
  letter-spacing: 0.14em;
  color: var(--text-soft);
}
.line--3 {
  margin-top: 30px;
  font-family: var(--font-yuanti);
  font-weight: 400;
  font-size: clamp(13px, 1.8vw, 17px);
  letter-spacing: 0.1em;
  color: rgba(244, 247, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.coming {
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 500;
  letter-spacing: 0.12em;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-warm);
  box-shadow: 0 0 10px var(--accent-warm);
  animation: pulse 1.6s ease-in-out infinite;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 1s ease 2.4s;
}
.content.is-shown .scroll-cue { opacity: 0.5; }
.scroll-cue span {
  display: block;
  width: 18px;
  height: 18px;
  border-right: 2px solid rgba(255, 255, 255, 0.7);
  border-bottom: 2px solid rgba(255, 255, 255, 0.7);
  transform: rotate(45deg);
  animation: bob 1.8s ease-in-out infinite;
}

@keyframes breathe { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.7; } }
@keyframes pulse  { 0%, 100% { transform: scale(1);   opacity: 1; } 50% { transform: scale(1.5); opacity: 0.5; } }
@keyframes bob    { 0%, 100% { transform: rotate(45deg) translate(0, 0); } 50% { transform: rotate(45deg) translate(4px, 4px); } }

@media (prefers-reduced-motion: reduce) {
  .intro, .content, .line, .scroll-cue { transition: none !important; }
  .dot, .scroll-cue span, .intro__hint { animation: none !important; }
}

/* ---------- 备案信息条 ---------- */
.beian-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px 18px;
  padding: 8px 16px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(244, 247, 255, 0.72);
  background: rgba(5, 6, 15, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  text-align: center;
  pointer-events: auto;
}
.beian-bar .beian-item a {
  color: rgba(244, 247, 255, 0.85);
  text-decoration: none;
  transition: color 0.2s ease;
}
.beian-bar .beian-item a:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}
.beian-bar .beian-item img {
  height: 14px;
  vertical-align: middle;
  margin-right: 4px;
}

/* ---------- 主页照片墙层（会切换的照片墙） ---------- */
.gallery {
  position: fixed;
  inset: 0;
  z-index: 2;                 /* 星空(0) 之上、主页文字(5) 之下 */
  pointer-events: none;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(var(--cols, 6), 1fr);
  grid-template-rows: repeat(var(--rows, 4), 1fr);
  gap: var(--gap, 3px);
  background: #05060f;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.gallery.is-shown { opacity: 1; }
.gallery__cell {
  position: relative;
  overflow: hidden;
}
.gallery__layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 5s ease-in-out;
  filter: saturate(1.06) brightness(0.92);
  will-change: opacity;
}
.gallery__layer.is-active { opacity: 0.8; }

/* 初始铺满阶段（#gallery 带 is-filling）：单格走短渐变，使「随机位置、短间隔逐格出现」清晰可辨；
   铺满后由 JS 移除该类，后续切换恢复上面 5s 的慢渐变。 */
.gallery.is-filling .gallery__layer { transition: opacity 0.5s ease-out; }

/* 文字区暗化，保证「欢迎来到我的空间」可读，同时墙在四周可见 */
.gallery-scrim {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse at center,
              rgba(5, 6, 15, 0.62) 0%,
              rgba(5, 6, 15, 0.28) 42%,
              rgba(5, 6, 15, 0.55) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .gallery { transition: opacity 0.6s ease !important; }
  .gallery__layer { transition: opacity 0.6s ease !important; }
}

/* ---------- 背景音乐播放器（与照片墙同步淡入） ---------- */
.music-player {
  position: fixed;
  left: 22px;
  bottom: 46px;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(80vw, 440px);
  padding: 7px 14px 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 14, 30, 0.40);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s ease, transform 0.9s ease, border-color 0.25s ease;
  pointer-events: none;
}
.music-player.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.music-player.is-muted .mp-name { color: rgba(244, 247, 255, 0.45); }
.mp-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.22s ease, color 0.22s ease, transform 0.15s ease;
}
.mp-btn:hover { background: rgba(95, 211, 255, 0.18); color: var(--accent-cyan); }
.mp-btn:active { transform: scale(0.9); }
.mp-btn svg { width: 18px; height: 18px; display: block; }
.mp-note {
  color: var(--accent-warm);
  font-size: 14px;
  line-height: 1;
  flex: 0 0 auto;
  filter: drop-shadow(0 0 6px rgba(255, 217, 160, 0.55));
}
.music-player.is-paused .mp-note { animation: pulse 1.2s ease-in-out infinite; }
.mp-name {
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  max-width: 240px;
}
.mp-hint {
  display: none;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--accent-cyan);
  white-space: nowrap;
}
.music-player.is-paused .mp-hint { display: inline; }

@media (max-width: 480px) {
  .music-player { left: 14px; bottom: 44px; padding: 6px 12px 6px 10px; }
  .mp-name { max-width: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  .music-player { transition: opacity 0.5s ease !important; }
}
