:root {
  --gold: #e8d5a3;
  --gold-soft: rgba(232, 213, 163, 0.55);
  --ink: #f6f1e8;
  --muted: rgba(246, 241, 232, 0.62);
  --stroke: rgba(255, 255, 255, 0.12);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #050712;
  color: var(--ink);
  font-family: "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.sky {
  position: fixed; inset: 0; z-index: 0;
  background:
    radial-gradient(1200px 700px at 50% 110%, rgba(42,28,78,0.45), transparent 60%),
    radial-gradient(900px 500px at 18% 12%, rgba(58,42,120,0.28), transparent 55%),
    linear-gradient(180deg, #050712 0%, #0b1024 42%, #120c22 100%);
}
#stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.nebula { position: absolute; filter: blur(60px); opacity: 0.55; pointer-events: none; }
.nebula-a { width: 42vw; height: 42vw; left: -8%; top: 8%; background: radial-gradient(circle, rgba(88,72,180,0.45), transparent 68%); }
.nebula-b { width: 50vw; height: 36vw; right: -12%; top: 22%; background: radial-gradient(circle, rgba(36,78,140,0.4), transparent 70%); }
.nebula-c { width: 38vw; height: 28vw; left: 30%; bottom: -8%; background: radial-gradient(circle, rgba(150,70,120,0.22), transparent 70%); }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 42%, rgba(2,3,10,0.78) 100%); pointer-events: none; }

.shooting-star {
  position: absolute; width: 90px; height: 1.5px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  opacity: 0; animation: shoot 7.5s linear infinite;
}
.s1 { top: 14%; left: 62%; animation-delay: 1.2s; }
.s2 { top: 28%; left: 18%; animation-delay: 4.4s; }
.s3 { top: 48%; left: 72%; animation-delay: 6.1s; width: 70px; }
@keyframes shoot {
  0% { opacity: 0; transform: translate(0,0) rotate(-28deg); }
  6% { opacity: 0.9; }
  18% { opacity: 0; transform: translate(-220px,130px) rotate(-28deg); }
  100% { opacity: 0; transform: translate(-220px,130px) rotate(-28deg); }
}

.gate {
  position: fixed; inset: 0; z-index: 30; display: grid; place-content: center;
  justify-items: center; gap: 12px; text-align: center; overflow: hidden;
  padding: calc(24px + var(--safe-t)) max(16px, var(--safe-r)) calc(24px + var(--safe-b)) max(16px, var(--safe-l));
}
.cosmos { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.gate-spark, .gate-float { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: hidden; }
.gate-float .barrage { font-family: "Cormorant Garamond", "Microsoft YaHei", serif; font-size: clamp(13px,3.2vw,18px); max-width: calc(100vw - 36px); overflow: hidden; text-overflow: ellipsis; }

.sun { position: absolute; left: -12%; bottom: 4%; width: min(46vw,340px); height: min(46vw,340px); border-radius: 50%; background: radial-gradient(circle, rgba(255,186,92,0.32) 0%, rgba(255,150,70,0.08) 42%, transparent 70%); filter: blur(6px); }
.moon { position: absolute; top: calc(8% + var(--safe-t)); right: 9%; width: 22px; height: 22px; border-radius: 50%; box-shadow: 7px -5px 0 0 rgba(232,213,163,0.78); filter: drop-shadow(0 0 10px rgba(232,213,163,0.35)); }
.constellation { position: absolute; left: 4%; top: 18%; width: min(28vw,180px); height: auto; opacity: 0.42; }
.constellation path { stroke: rgba(232,213,163,0.55); stroke-width: 1; stroke-linecap: round; stroke-linejoin: round; }
.constellation circle { fill: rgba(232,213,163,0.9); }

.meteor { position: absolute; width: 110px; height: 1.4px; background: linear-gradient(90deg, transparent, #fff, rgba(232,213,163,0.8), transparent); opacity: 0; animation: meteor 8s linear infinite; }
.m1 { top: 12%; left: 70%; animation-delay: 0.6s; }
.m2 { top: 22%; left: 40%; animation-delay: 2.4s; width: 80px; }
.m3 { top: 38%; left: 82%; animation-delay: 4.1s; width: 130px; }
.m4 { top: 58%; left: 18%; animation-delay: 5.8s; width: 90px; }
.m5 { top: 72%; left: 62%; animation-delay: 7.2s; width: 70px; }
@keyframes meteor {
  0% { opacity: 0; transform: translate(0,0) rotate(-32deg); }
  4% { opacity: 0.95; }
  16% { opacity: 0; transform: translate(-260px,160px) rotate(-32deg); }
  100% { opacity: 0; transform: translate(-260px,160px) rotate(-32deg); }
}

.system-wrap { position: relative; z-index: 1; width: min(100%,52vh,420px); height: min(100%,52vh,420px); aspect-ratio: 1; display: grid; place-items: center; margin-top: 4px; }
.orbit { position: absolute; border: 1px solid rgba(232,213,163,0.16); border-radius: 50%; pointer-events: none; animation: spin linear infinite; }
.o1 { width: 54%; height: 54%; animation-duration: 12s; }
.o2 { width: 70%; height: 70%; animation-duration: 20s; animation-direction: reverse; }
.o3 { width: 86%; height: 86%; animation-duration: 32s; }
.o4 { width: 100%; height: 100%; animation-duration: 48s; animation-direction: reverse; border-style: dashed; opacity: 0.75; }
.planet { position: absolute; top: 0; left: 50%; border-radius: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 10px currentColor; }
.mercury { width: 7px; height: 7px; background: #c9c2b2; color: #c9c2b2; }
.venus { width: 9px; height: 9px; background: #e8c48a; color: #e8c48a; }
.earth { width: 8px; height: 8px; background: #8eb4d4; color: #8eb4d4; }
.mars { width: 7px; height: 7px; background: #c47a62; color: #c47a62; }

.gate-kicker { letter-spacing: 0.32em; text-transform: uppercase; font-size: 14px; color: var(--gold); }
.gate-title { font-family: "Cormorant Garamond", serif; font-weight: 400; font-size: clamp(36px,8vw,64px); letter-spacing: 0.08em; }
.gate-sign { color: var(--muted); letter-spacing: 0.2em; font-size: 15px; margin-bottom: 6px; }

.start-btn { position: relative; z-index: 10; border: 0; background: transparent; width: 168px; height: 168px; border-radius: 50%; cursor: pointer; color: var(--ink); }
.start-btn::before { content: ""; position: absolute; inset: -38%; border-radius: 50%; background: radial-gradient(circle, rgba(255,196,110,0.28), transparent 68%); pointer-events: none; z-index: -1; }
.start-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid var(--gold-soft); animation: spin 9s linear infinite; box-shadow: 0 0 0 10px rgba(232,213,163,0.04), 0 12px 40px rgba(0,0,0,0.28); }
.start-ring::before, .start-ring::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); top: 6px; left: 50%; transform: translateX(-50%); box-shadow: 0 0 12px var(--gold); }
.start-ring::after { top: auto; bottom: 6px; }
.start-core { position: absolute; inset: 22px; border-radius: 50%; display: grid; place-items: center; letter-spacing: 0.22em; font-size: 16px; background: rgba(12,16,32,0.45); border: 1px solid var(--stroke); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: inset 0 0 24px rgba(232,213,163,0.08); transition: transform .28s ease, background .28s ease, box-shadow .28s ease; }
.start-btn:hover .start-core, .start-btn:active .start-core { transform: scale(0.96); background: rgba(232,213,163,0.14); box-shadow: inset 0 0 28px rgba(232,213,163,0.16), 0 0 28px rgba(232,213,163,0.18); }
@keyframes spin { to { transform: rotate(360deg); } }

/* 门禁预加载进度 */
.gate-load { position: absolute; left: 0; right: 0; bottom: calc(30px + var(--safe-b)); z-index: 5; text-align: center; font-size: 13px; letter-spacing: 0.3em; color: var(--muted); pointer-events: none; transition: color .4s ease, text-shadow .4s ease; }
.gate-load.is-ready { color: var(--gold); text-shadow: 0 0 14px rgba(232,213,163,0.45); }
.start-btn.is-ready .start-ring { animation-duration: 5s; box-shadow: 0 0 0 10px rgba(232,213,163,0.06), 0 12px 40px rgba(0,0,0,0.28), 0 0 34px rgba(232,213,163,0.35); }

/* 大门祝福开场：加载期间循环演绎 */
.gate-intro { position: absolute; left: 50%; bottom: calc(64px + var(--safe-b)); transform: translateX(-50%); z-index: 6; width: max-content; max-width: calc(100vw - 48px); pointer-events: none; text-align: center; }
.intro-line { font-family: "Cormorant Garamond", "Microsoft YaHei", serif; font-size: clamp(16px, 4.4vw, 24px); letter-spacing: 0.18em; color: var(--gold); text-shadow: 0 0 20px rgba(232,213,163,0.4); opacity: 0; filter: blur(6px); transform: translateY(14px) scale(0.96); transition: opacity .65s ease, filter .65s ease, transform .65s cubic-bezier(0.175,0.885,0.32,1.275); }
.intro-line.is-in { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
.intro-line.is-out { opacity: 0; filter: blur(8px); transform: translateY(-14px) scale(1.04); transition: opacity .6s ease, filter .6s ease, transform .6s ease; }

.show { position: relative; z-index: 1; height: 100%; height: 100dvh; }
.scene { position: absolute; inset: 0; opacity: 0; visibility: hidden; pointer-events: none; transform: scale(1.03); transition: opacity 1.15s ease, visibility 1.15s ease, transform 1.25s ease; }
.scene.is-on { opacity: 1; visibility: visible; pointer-events: auto; transform: scale(1); }
.scene-tag { position: absolute; top: calc(18px + var(--safe-t)); left: calc(22px + var(--safe-l)); z-index: 4; font-size: 11px; letter-spacing: 0.36em; color: var(--gold-soft); }

.flash-area { position: absolute; inset: 0; display: grid; place-items: center; z-index: 2; padding: calc(7vh + var(--safe-t) + 8px) calc(7vw + var(--safe-r)) calc(14vh + var(--safe-b) + 8px) calc(7vw + var(--safe-l)); }
.flash-frame { position: relative; width: min(420px,72vw,calc(60vh * 3 / 4)); aspect-ratio: 3 / 4; max-height: min(100%,62vh); border-radius: 18px; overflow: hidden; border: 1px solid var(--stroke); box-shadow: 0 18px 50px rgba(0,0,0,0.45); background: rgba(0,0,0,0.28); }
.float-layer { position: absolute; inset: 0; z-index: 6; overflow: hidden; pointer-events: none; }
.float-layer .barrage { font-family: "Cormorant Garamond", "Microsoft YaHei", serif; }
.slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 18%; opacity: 0; transition: opacity 0.4s ease; }
.slide.is-active { opacity: 1; z-index: 1; }

.scene-stream { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: calc(56px + var(--safe-t)) 0 calc(24px + var(--safe-b)); }
.stream-label { text-align: center; font-size: 11px; letter-spacing: 0.38em; color: var(--gold-soft); margin-bottom: 6px; }
.tracks { display: grid; gap: 10px; }
.track-wrap { width: 100%; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.track { display: flex; gap: 10px; width: max-content; animation: marquee 28s linear infinite; }
.track-wrap.reverse .track { animation-direction: reverse; animation-duration: 32s; }
.track-wrap:nth-child(3) .track { animation-duration: 24s; }
.track-wrap:nth-child(4) .track { animation-duration: 36s; }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.thumb { width: 22vw; max-width: 132px; height: 18vh; min-height: 96px; max-height: 150px; border-radius: 14px; object-fit: cover; object-position: center 18%; flex: 0 0 auto; border: 1px solid rgba(255,255,255,0.08); }

.intro-praise { position: absolute; top: 50%; left: 50%; width: 100%; text-align: center; transform: translate(-50%,-50%) scale(0.72); font-family: "Cormorant Garamond", serif; font-size: clamp(28px,8vw,56px); letter-spacing: 0.12em; color: var(--gold); text-shadow: 0 0 28px rgba(232,213,163,0.45); opacity: 0; pointer-events: none; z-index: 8; transition: all 0.8s cubic-bezier(0.175,0.885,0.32,1.275); }
.intro-praise span { display: block; margin-top: 8px; font-size: 0.72em; }
.intro-praise.is-show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.intro-praise.is-hide { opacity: 0; transform: translate(-50%,-50%) scale(1.6); filter: blur(16px); transition: all 0.5s ease-in; }
.praise-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.barrage { position: absolute; color: var(--ink); white-space: nowrap; opacity: 0; user-select: none; pointer-events: none; text-shadow: 0 2px 8px rgba(0,0,0,0.55); animation: popIn 0.5s cubic-bezier(0.175,0.885,0.32,1.275) forwards; }
.barrage.is-gold { color: #ffd700; text-shadow: 0 0 10px rgba(255,215,0,0.55); z-index: 6; }
.barrage.is-rose { color: #f3b6c8; text-shadow: 0 0 10px rgba(243,182,200,0.4); }
@keyframes popIn { 0% { transform: scale(0) translateY(16px); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

.scene-end { display: grid; place-content: center; text-align: center; padding: calc(24px + var(--safe-t)) 28px calc(24px + var(--safe-b)); }
.fireworks { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.end-copy { position: relative; z-index: 2; display: grid; gap: 16px; justify-items: center; }
.eyebrow { letter-spacing: 0.42em; text-transform: uppercase; font-size: 11px; color: var(--gold); }
.scene-end h1 { font-family: "Cormorant Garamond", serif; font-weight: 400; font-size: clamp(36px,8vw,68px); letter-spacing: 0.08em; }
.blessing { max-width: 28em; margin: 0 auto; color: var(--muted); font-weight: 300; font-size: 15px; line-height: 1.9; }
.sign-line { letter-spacing: 0.22em; font-size: 12px; color: var(--gold-soft); }
.end-line { margin-top: 18px; font-size: 12px; letter-spacing: 0.14em; color: var(--gold-soft); }

.music-btn { position: fixed; right: calc(16px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); z-index: 12; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--stroke); background: rgba(8,10,22,0.55); color: var(--gold); backdrop-filter: blur(12px); font-size: 16px; cursor: pointer; }
.music-btn.is-off { color: var(--muted); opacity: 0.7; }

/* 日夜切换按钮（与音乐按钮同组，始终可点，大门页也可切） */
.theme-btn { position: fixed; right: calc(74px + var(--safe-r)); bottom: calc(16px + var(--safe-b)); z-index: 40; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--stroke); background: rgba(8,10,22,0.55); color: var(--gold); backdrop-filter: blur(12px); display: grid; place-items: center; cursor: pointer; transition: color .3s ease, background .3s ease, box-shadow .3s ease; }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .ico-sun { display: none; }

/* ============ 白天 · 柔和晴空星空主题 ============ */
body.day {
  --gold: #a2762e;
  --gold-soft: rgba(150,110,40,0.62);
  --ink: #2d3757;
  --muted: rgba(45,55,87,0.66);
  --stroke: rgba(45,55,87,0.16);
}
body.day, body.day html { background: #e4ecf7; }
body.day .sky {
  background:
    radial-gradient(1100px 640px at 50% 114%, rgba(255,224,176,0.85), transparent 62%),
    radial-gradient(900px 520px at 14% 8%, rgba(178,206,246,0.6), transparent 58%),
    linear-gradient(180deg, #cfe1f5 0%, #e9eef8 46%, #faf2e2 100%);
  transition: background .8s ease;
}
body.day .nebula { filter: blur(66px); }
body.day .nebula-a { background: radial-gradient(circle, rgba(255,255,255,0.75), transparent 68%); opacity: 0.9; }
body.day .nebula-b { background: radial-gradient(circle, rgba(196,218,250,0.85), transparent 70%); opacity: 0.75; }
body.day .nebula-c { background: radial-gradient(circle, rgba(255,228,196,0.8), transparent 70%); opacity: 0.85; }
body.day .vignette { background: radial-gradient(ellipse at center, transparent 46%, rgba(148,128,88,0.16) 100%); }
body.day .shooting-star { display: none; }

/* 晴日暖阳（右上角柔光） */
.sun-glow { display: none; }
body.day .sun-glow {
  display: block; position: absolute; top: -12%; right: -8%;
  width: 52vmin; height: 52vmin; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,238,196,0.95) 0%, rgba(255,214,146,0.45) 36%, rgba(255,214,146,0) 70%);
  filter: blur(2px);
}

/* 大门页：月夜元素退场，晨光元素增强 */
body.day .moon { display: none; }
body.day .meteor { display: none; }
body.day .sun {
  width: min(54vw, 390px); height: min(54vw, 390px); filter: blur(4px);
  background: radial-gradient(circle, rgba(255,202,120,0.5) 0%, rgba(255,178,96,0.16) 44%, transparent 70%);
}
body.day .constellation path { stroke: rgba(122,90,38,0.5); }
body.day .constellation circle { fill: rgba(160,116,42,0.95); }
body.day .orbit { border-color: rgba(70,82,120,0.22); }
body.day .o4 { border-color: rgba(70,82,120,0.14); }

/* 开启按钮：浅色磨砂玻璃 */
body.day .start-btn::before { background: radial-gradient(circle, rgba(255,196,110,0.42), transparent 68%); }
body.day .start-ring { box-shadow: 0 12px 40px rgba(120,100,60,0.18); }
body.day .start-core {
  background: rgba(255,255,255,0.6);
  border-color: rgba(70,82,120,0.2);
  box-shadow: inset 0 0 24px rgba(255,255,255,0.7), 0 8px 28px rgba(120,100,60,0.14);
}
body.day .start-btn:hover .start-core, body.day .start-btn:active .start-core { background: rgba(255,255,255,0.82); }

/* 浮动文字 / 弹幕在浅底下的投影与配色 */
body.day .barrage { text-shadow: 0 2px 10px rgba(255,255,255,0.95); }
body.day .barrage.is-gold { color: #a2762e; text-shadow: 0 0 10px rgba(162,118,46,0.35); }
body.day .barrage.is-rose { color: #bd5f80; text-shadow: 0 0 10px rgba(189,95,128,0.3); }
body.day .intro-praise { text-shadow: 0 0 28px rgba(162,118,46,0.28); }

/* 右下悬浮按钮组：浅色磨砂 */
body.day .music-btn, body.day .theme-btn {
  background: rgba(255,255,255,0.62); border-color: rgba(70,82,120,0.2);
  color: #a2762e; box-shadow: 0 6px 20px rgba(120,100,60,0.14);
}
body.day .music-btn.is-off { color: rgba(45,55,87,0.5); }

/* 照片框在浅底下的柔和投影 */
body.day .flash-frame { border-color: rgba(45,55,87,0.14); box-shadow: 0 18px 50px rgba(110,96,64,0.22); }
body.day .thumb { border-color: rgba(45,55,87,0.12); }

@media (max-width: 720px) {
  .flash-area { padding: calc(10vh + var(--safe-t)) max(20px,var(--safe-l)) calc(16vh + var(--safe-b)) max(20px,var(--safe-r)); }
  .flash-frame { width: min(280px,72vw,calc(48vh * 3 / 4)); max-height: 48vh; }
  .track-wrap:nth-child(4) { display: none; }
  .thumb { width: 26vw; height: 15vh; }
  .blessing { font-size: 14px; padding: 0 12px; }
  .start-btn { width: 132px; height: 132px; }
  .start-core { font-size: 14px; letter-spacing: 0.16em; }
  .system-wrap { width: min(100%,38vh,260px); height: min(100%,38vh,260px); }
  .gate-title { font-size: 34px; letter-spacing: 0.06em; }
  .gate-kicker { font-size: 12px; letter-spacing: 0.28em; }
  .gate-sign { font-size: 13px; }
  .constellation { display: none; }
  .moon { width: 16px; height: 16px; right: 14px; }
  .intro-praise { font-size: 32px; padding: 0 16px; }
  .scene-end h1 { font-size: 32px; padding: 0 12px; }
}
@media (min-width: 721px) and (max-width: 1024px) {
  .flash-frame { width: min(420px,52vw,calc(54vh * 3 / 4)); max-height: 54vh; }
  .thumb { width: min(150px,15vw); height: min(198px,17vh); max-width: none; max-height: none; min-height: 120px; }
  .start-btn { width: 176px; height: 176px; }
  .gate-title { font-size: clamp(48px,7vw,72px); }
  .scene-end h1 { font-size: clamp(42px,6vw,64px); }
  .blessing { font-size: 16px; max-width: 32em; }
  .intro-praise { font-size: clamp(36px,6vw,60px); }
  .system-wrap { width: min(70vw,58vh,560px); height: min(70vw,58vh,560px); }
}
@media (min-width: 1025px) {
  .gate { gap: 16px; }
  .gate-kicker { font-size: 15px; letter-spacing: 0.46em; }
  .gate-title { font-size: 58px; letter-spacing: 0.14em; }
  .gate-sign { font-size: 17px; letter-spacing: 0.3em; margin-bottom: 8px; }
  .start-btn { width: 200px; height: 200px; }
  .start-core { font-size: 17px; letter-spacing: 0.22em; }
  .system-wrap { width: min(52vw,56vh,480px); height: min(52vw,56vh,480px); }
  .flash-frame { width: min(440px,32vw,calc(64vh * 3 / 4)); max-height: 64vh; }
  .thumb { width: 152px; height: 200px; max-width: none; max-height: none; min-height: 0; border-radius: 16px; }
  .scene-end h1 { font-size: 56px; }
  .blessing { font-size: 17px; line-height: 2; }
}
@media (orientation: landscape) and (max-height: 900px) and (max-width: 1024px) {
  .flash-frame { width: min(300px,38vw,calc(64vh * 3 / 4)); max-height: 64vh; }
  .start-btn { width: 132px; height: 132px; }
  .constellation { display: none; }
  .system-wrap { width: min(42vh,46vw,340px); height: min(42vh,46vw,340px); }
}
