/* ===== 流星轨迹 · 你的星图 —— 交互网站样式 ===== */

@font-face {
  font-family: "MeteorSerif";
  src: local("Source Han Serif SC"), local("Noto Serif SC"), local("SimSun"), local("宋体");
}
@font-face {
  font-family: "MeteorHand";
  src: local("STKaiti"), local("KaiTi"), local("楷体");
}

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

html, body {
  width: 100%; height: 100%;
  background: #020409;
  overflow: hidden;
  font-family: "ZCOOL XiaoWei", "MeteorSerif", "STZhongsong", "SimSun", "宋体", serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  cursor: pointer;
}

#viewport { position: fixed; inset: 0; }

/* 1920×1080 设计舞台，居中缩放 */
#stage {
  position: absolute;
  left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform: translate(-50%, -50%);
  transform-origin: center center;
}

#world { position: absolute; inset: 0; width: 1920px; height: 1080px; display: block; }

/* ---------- 场景容器 ---------- */
.scene {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  pointer-events: none;
}
.scene.on { opacity: 1; visibility: visible; }

/* ---------- 幕 1（居中式开场） ---------- */
.s-center { display: flex; align-items: center; justify-content: center; }
.s1-box { text-align: center; margin-top: -40px; }
.s1-eyebrow {
  font-size: 20px; letter-spacing: 12px; text-indent: 12px;
  color: rgba(214, 226, 255, 0.55);
  margin-bottom: 34px;
}
.s1-title {
  font-size: 56px; font-weight: normal; letter-spacing: 8px;
  color: #e9f0ff;
  text-shadow: 0 0 34px rgba(140, 180, 255, 0.45), 0 0 90px rgba(90, 140, 255, 0.22);
  margin-bottom: 30px;
}
.s1-desc {
  font-size: 21px; line-height: 2.1; letter-spacing: 3px;
  color: rgba(178, 196, 230, 0.82);
}

/* ---------- 标题块（幕 2–9 左上角） ---------- */
.t-head {
  position: absolute; left: 84px; top: 62px;
  max-width: 780px;
}
.t-title {
  font-size: 38px; font-weight: normal; letter-spacing: 5px;
  color: #e6edff;
  text-shadow: 0 0 26px rgba(130, 170, 255, 0.35);
  margin-bottom: 18px;
}
.t-desc {
  font-size: 20px; line-height: 2; letter-spacing: 2.5px;
  color: rgba(160, 180, 216, 0.85);
}
.t-date {
  margin-top: 16px;
  font-size: 22px; letter-spacing: 4px;
  color: rgba(224, 214, 192, 0.9);
  display: inline-block;
  border-bottom: 1px solid rgba(224, 214, 192, 0.4);
  padding-bottom: 6px;
}

/* ---------- 记忆碎片（幕 4–7）：3D 玻璃质感 + 虹彩流光边框 ---------- */
@property --ir {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}
@property --rx { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --ry { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --mx { syntax: "<percentage>"; inherits: false; initial-value: 30%; }
@property --my { syntax: "<percentage>"; inherits: false; initial-value: 35%; }
@keyframes irSpin { to { --ir: 360deg; } }
@keyframes glassSheen {
  0%, 58% { background-position: 135% 0; }
  100% { background-position: -135% 0; }
}

.memory { position: absolute; inset: 0; }

/* 3D 姿态载体：透视倾斜，随鼠标轻微转动（--rx/--ry 已注册，transition 平滑） */
.card3d {
  position: absolute;
  transform-style: preserve-3d;
  transform: var(--anchor, none) perspective(950px) rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--ms, 1));
  transition: --rx 0.35s ease-out, --ry 0.35s ease-out;
}

.photo-card {
  position: relative;
  transform-style: preserve-3d;
}
/* 玻璃厚度中层：半透明的虹彩边，垫在正面下方 —— 倾斜时露出"侧壁" */
.photo-card::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: 20px;
  border: 2px solid transparent;
  background:
    linear-gradient(rgba(24, 34, 66, 0.55), rgba(24, 34, 66, 0.55)) padding-box,
    conic-gradient(from var(--ir),
      rgba(140, 185, 255, 0.9), rgba(255, 185, 130, 0.9),
      rgba(255, 228, 165, 0.9), rgba(165, 255, 222, 0.75),
      rgba(206, 172, 255, 0.9), rgba(140, 185, 255, 0.9)) border-box;
  animation: irSpin 9s linear infinite;
  transform: translateZ(-9px);
}
.photo-frame {
  position: relative;
  width: 560px; height: 320px;
  border: 2.5px solid transparent;
  border-radius: 20px;
  padding: 8px;
  transform-style: preserve-3d;
  overflow: visible;
  /* 玻璃主体（padding-box）+ 虹彩旋转描边（border-box）；
     backdrop-filter 让玻璃边圈后的星空产生磨砂折射 */
  background:
    linear-gradient(160deg,
      rgba(185, 208, 255, 0.16),
      rgba(18, 26, 52, 0.40) 46%,
      rgba(216, 178, 255, 0.12)) padding-box,
    conic-gradient(from var(--ir),
      rgba(127, 178, 255, 0.85), rgba(255, 178, 122, 0.85),
      rgba(255, 226, 160, 0.85), rgba(159, 255, 217, 0.70),
      rgba(201, 167, 255, 0.85), rgba(127, 178, 255, 0.85)) border-box;
  animation: irSpin 9s linear infinite;
  backdrop-filter: blur(3px) saturate(1.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 3px rgba(130, 150, 220, 0.28),
    inset 1px 0 0 rgba(200, 220, 255, 0.22),
    inset -1px 0 0 rgba(160, 140, 255, 0.16),
    0 0 26px rgba(150, 185, 255, 0.20),
    0 0 60px rgba(255, 190, 120, 0.14),
    0 26px 60px rgba(0, 0, 0, 0.55);
}
/* 玻璃底板：沿 Z 轴垫在 -20px，自带虹彩描边 —— 倾斜时露出彩虹玻璃厚度 */
.photo-frame::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 17px;
  border: 2.5px solid transparent;
  background:
    linear-gradient(160deg, rgba(30, 42, 80, 0.88), rgba(8, 12, 26, 0.94)) padding-box,
    conic-gradient(from calc(var(--ir) - 60deg),
      rgba(150, 190, 255, 0.95), rgba(255, 190, 135, 0.95),
      rgba(255, 230, 170, 0.95), rgba(170, 255, 226, 0.8),
      rgba(210, 175, 255, 0.95), rgba(150, 190, 255, 0.95)) border-box;
  animation: irSpin 9s linear infinite;
  transform: translateZ(-20px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}
/* 液态玻璃表面：跟随鼠标的镜面高光 + 两团缓慢游走的液态光斑 + 斜向流光 */
.photo-frame::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: 17px;
  background:
    radial-gradient(340px circle at var(--mx) var(--my),
      rgba(255, 255, 255, 0.22), rgba(190, 215, 255, 0.07) 45%, transparent 62%),
    radial-gradient(190px circle at 18% 120%,
      rgba(160, 210, 255, 0.14), transparent 65%),
    radial-gradient(230px circle at 85% -20%,
      rgba(255, 205, 160, 0.10), transparent 60%),
    linear-gradient(115deg,
      transparent 32%,
      rgba(255, 255, 255, 0.13) 45%,
      rgba(210, 230, 255, 0.04) 53%,
      transparent 66%);
  background-size: 100% 100%, 240% 240%, 240% 240%, 260% 100%;
  background-position: 0 0, 0% 100%, 100% 0%, 0 0;
  animation:
    liquidFlow 12s ease-in-out infinite alternate,
    glassSheen 5.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes liquidFlow {
  from { background-position: 0 0, -18% 92%, 88% -14%, 0 0; }
  to   { background-position: 0 0, 26% 34%, 42% 58%, 0 0; }
}
.photo-canvas { position: relative; width: 540px; height: 300px; display: block; border-radius: 9px; }

/* 手写批注 */
.hand-note {
  position: absolute;
  font-family: "Ma Shan Zheng", "MeteorHand", "STKaiti", "KaiTi", "楷体", cursive;
  font-size: 36px; line-height: 1.95; letter-spacing: 3px;
  color: #f2e7d2;
  text-shadow: 0 0 18px rgba(255, 214, 150, 0.35);
}
.hn-heart { color: #ffb4b4; }
.hn-sig {
  margin-top: 14px; font-size: 22px;
  color: rgba(230, 214, 186, 0.72);
}

/* 幕 7 便签卡：纸面便签 + 虹彩玻璃边框（3D 姿态由 .card3d 提供） */
.sticky-note {
  position: relative;
  width: 400px; height: 300px;
  border: 2px solid transparent;
  border-radius: 14px;
  background:
    linear-gradient(160deg, #f8f0dd 0%, #efe2c4 78%, #e6d5b0 100%) padding-box,
    conic-gradient(from var(--ir),
      rgba(127, 178, 255, 0.85), rgba(255, 178, 122, 0.85),
      rgba(255, 226, 160, 0.85), rgba(159, 255, 217, 0.70),
      rgba(201, 167, 255, 0.85), rgba(127, 178, 255, 0.85)) border-box;
  animation: irSpin 9s linear infinite;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 6px rgba(150, 120, 70, 0.25),
    /* 层叠玻璃厚度：三层渐暗的"侧壁" */
    0 3px 0 rgba(214, 198, 160, 0.95),
    0 6px 0 rgba(186, 168, 128, 0.9),
    0 9px 0 rgba(158, 140, 102, 0.85),
    0 20px 48px rgba(0, 0, 0, 0.55),
    0 0 30px rgba(150, 185, 255, 0.18),
    0 0 60px rgba(255, 190, 120, 0.14);
  transform: rotate(-2.5deg);
  padding: 46px 50px;
}
/* 便签玻璃反光层 */
.sticky-note::after {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(300px circle at var(--mx) var(--my),
      rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(115deg,
      transparent 38%, rgba(255, 255, 255, 0.10) 50%, transparent 62%);
  background-size: 100% 100%, 260% 100%;
  animation: glassSheen 5.8s ease-in-out infinite;
  pointer-events: none;
}
.sticky-note::before {
  content: "";
  position: absolute; left: 50%; top: -13px;
  width: 74px; height: 26px;
  transform: translateX(-50%) rotate(1.6deg);
  background: rgba(200, 178, 130, 0.5);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.sn-leaf {
  position: absolute; right: 26px; top: 18px;
  font-size: 40px; color: #7f9a5e;
  transform: rotate(14deg);
  opacity: 0.9;
}
.sn-line {
  font-family: "Ma Shan Zheng", "MeteorHand", "STKaiti", "KaiTi", "楷体", cursive;
  font-size: 52px; letter-spacing: 8px;
  color: #4a3f30;
  line-height: 1.7;
}
.sn-sig {
  margin-top: 26px;
  font-family: "Ma Shan Zheng", "MeteorHand", "STKaiti", "KaiTi", "楷体", cursive;
  font-size: 24px; letter-spacing: 3px;
  color: rgba(90, 76, 56, 0.75);
}

/* ---------- 终章（幕 9） ---------- */
.ending {
  position: absolute; left: 0; right: 0;
  top: 762px;
  text-align: center;
}
.end-line {
  font-size: 26px; letter-spacing: 5px; line-height: 2.15;
  color: #e9eefc;
  text-shadow: 0 0 22px rgba(150, 185, 255, 0.4);
}
.end-sep {
  margin: 26px auto 22px;
  display: flex; align-items: center; justify-content: center; gap: 18px;
  width: 420px;
}
.end-sep span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(220, 205, 170, 0.55)); }
.end-sep span:last-child { background: linear-gradient(90deg, rgba(220, 205, 170, 0.55), transparent); }
.end-sep i {
  font-style: normal; font-size: 15px;
  color: rgba(240, 220, 175, 0.9);
}

/* ---------- 导航 UI ---------- */
#ui {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 110px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s;
}
#ui.show { opacity: 1; }

#dots {
  position: absolute; left: 50%; bottom: 36px;
  transform: translateX(-50%);
  display: flex; gap: 20px;
  padding: 8px 10px;
  pointer-events: auto;
}
/* 星图式导航点：小星点 + 呼吸光晕，当前幕是一颗脉冲的暖金星 */
.dot {
  position: relative;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(205, 218, 248, 0.65) 0%,
    rgba(190, 205, 240, 0.22) 55%,
    transparent 72%);
  box-shadow: 0 0 7px rgba(170, 195, 255, 0.28);
  cursor: pointer;
  transition: background 0.4s, box-shadow 0.4s, transform 0.4s;
}
.dot::before {
  /* 扩大点击热区 */
  content: "";
  position: absolute; inset: -9px;
}
.dot::after {
  /* 十字星芒，仅当前幕显示 */
  content: "";
  position: absolute; left: 50%; top: 50%;
  width: 21px; height: 21px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(90deg, transparent 42%, rgba(255, 224, 165, 0.85) 50%, transparent 58%) 0 0 / 100% 1.5px no-repeat,
    linear-gradient(90deg, transparent 42%, rgba(255, 224, 165, 0.85) 50%, transparent 58%) 0 100% / 100% 1.5px no-repeat,
    linear-gradient(0deg, transparent 42%, rgba(255, 224, 165, 0.85) 50%, transparent 58%) 0 0 / 1.5px 100% no-repeat,
    linear-gradient(0deg, transparent 42%, rgba(255, 224, 165, 0.85) 50%, transparent 58%) 100% 0 / 1.5px 100% no-repeat;
  opacity: 0.85;
  pointer-events: none;
}
.dot:hover {
  background: radial-gradient(circle,
    rgba(235, 242, 255, 0.95) 0%,
    rgba(200, 215, 250, 0.35) 55%,
    transparent 72%);
  box-shadow: 0 0 10px rgba(190, 210, 255, 0.5);
}
.dot.on {
  background: radial-gradient(circle,
    #fff8ea 0%,
    #ffdba4 38%,
    rgba(255, 190, 110, 0.45) 68%,
    transparent 74%);
  box-shadow:
    0 0 10px rgba(255, 208, 130, 0.8),
    0 0 26px rgba(255, 180, 100, 0.35);
  animation: dotPulse 2.6s ease-in-out infinite;
}
@keyframes dotPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.45); }
}

#hint {
  position: absolute; right: 64px; bottom: 36px;
  font-size: 17px; letter-spacing: 4px;
  color: rgba(196, 210, 240, 0.6);
  animation: hintBreath 2.6s ease-in-out infinite;
}
.hint-arrow { display: inline-block; margin-left: 2px; }
@keyframes hintBreath {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 0.95; }
}

/* ---------- 手机竖屏适配 ----------
   Canvas 星幕 cover 裁切居中，文字/卡片按屏幕重新排布（由 app.js 同步定位） */
@media (orientation: portrait) {
  #world { width: 100vw; height: 100vh; object-fit: cover; }
  .t-head { left: 20px; top: 20px; max-width: 88vw; }
  .t-title { font-size: 24px; letter-spacing: 3px; margin-bottom: 12px; }
  .t-desc { font-size: 13px; line-height: 1.8; letter-spacing: 1.5px; }
  .t-date { font-size: 14px; margin-top: 10px; padding-bottom: 4px; }
  .s1-eyebrow { font-size: 12px; letter-spacing: 6px; margin-bottom: 18px; }
  .s1-title { font-size: 27px; letter-spacing: 4px; margin-bottom: 18px; }
  .s1-desc { font-size: 14px; line-height: 1.95; letter-spacing: 2px; }
  .card3d { --anchor: translate(-50%, -50%); }
  .memory .card3d { left: 50% !important; top: 40% !important; }
  #mem7 .card3d { top: 44% !important; }
  .hand-note { left: 6vw !important; top: 62vh !important; font-size: 20px; line-height: 1.85; }
  .hn-sig { font-size: 15px; }
  .sticky-note { width: 330px; height: 252px; padding: 30px 34px; }
  .sn-line { font-size: 30px; letter-spacing: 5px; }
  .sn-sig { font-size: 16px; margin-top: 16px; }
  .ending { top: 59vh; }
  .end-line { font-size: 15px; letter-spacing: 3px; line-height: 2; }
  .end-sep { width: 58vw; margin: 14px auto 12px; }
  #dots { bottom: 12px; gap: 13px; padding: 6px 8px; }
  .dot { width: 6px; height: 6px; }
  .dot::before { inset: -7px; }
  .dot::after { width: 17px; height: 17px; }
  #hint { right: 14px; bottom: 11px; font-size: 12px; letter-spacing: 2px; }
}
