/* =========================================================
   爸爸的生日音乐会 —— 大气简约 · 深色高级感
   ========================================================= */
:root{
  --gold:#c9a96a;
  --gold-soft:#e8d9b8;
  --ink:#0b0b0f;
  --paper:#f4efe6;
  --serif:"Songti SC","STSong","SimSun",Georgia,"Times New Roman",serif;
  --sans:"PingFang SC","Microsoft YaHei","Hiragino Sans GB",system-ui,sans-serif;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{
  background:var(--ink);color:var(--paper);
  font-family:var(--sans);overflow:hidden;
  -webkit-tap-highlight-color:transparent;
  -webkit-font-smoothing:antialiased;
}
button{font-family:inherit}

/* ================= 天空 ================= */
#sky{position:fixed;inset:0;opacity:0;transition:opacity 1.4s ease;z-index:1}
#sky::before,#sky::after{content:"";position:absolute;inset:0;transition:opacity 3s ease;z-index:0}
#sky::before{
  background:linear-gradient(180deg,#7fc4f2 0%,#bfe4fb 46%,#eaf6ff 78%,#f6fbf2 100%);
}
#sky::after{
  background:linear-gradient(180deg,#04050d 0%,#0a1030 46%,#15214b 78%,#1d2a55 100%);
  opacity:0;
}
body[data-act="day"] #sky,body[data-act="night"] #sky,body[data-act="finale"] #sky{opacity:1}
body[data-act="night"] #sky::after,body[data-act="finale"] #sky::after{opacity:1}

.sun{
  position:absolute;left:12%;top:9%;width:clamp(64px,10vw,110px);aspect-ratio:1;border-radius:50%;z-index:1;
  background:radial-gradient(circle,#fff8dc 0%,#ffe9a3 45%,#ffce5c 100%);
  box-shadow:0 0 60px 24px rgba(255,224,140,.55);
  transition:opacity 2.4s ease,transform 2.4s ease;
}
.moon{
  position:absolute;right:14%;top:8%;width:clamp(46px,7vw,80px);aspect-ratio:1;border-radius:50%;z-index:1;
  background:radial-gradient(circle at 36% 34%,#fdfdf4 0%,#e7e6d6 58%,#c9c8b6 100%);
  box-shadow:0 0 44px 12px rgba(240,240,220,.35);
  opacity:0;transform:translateY(26px);transition:opacity 2.4s ease .5s,transform 2.4s ease .5s;
}
body[data-act="night"] .sun,body[data-act="finale"] .sun{opacity:0;transform:translateY(70px)}
body[data-act="night"] .moon,body[data-act="finale"] .moon{opacity:1;transform:translateY(0)}

#stars{position:absolute;inset:0;opacity:0;transition:opacity 2.6s ease .6s;z-index:1}
#stars-dense{position:absolute;inset:0;opacity:0;transition:opacity 3.5s ease;z-index:1}
body.starry #stars-dense{opacity:1}
body[data-act="night"] #stars,body[data-act="finale"] #stars{opacity:1}
#stars i,#stars-dense i{
  position:absolute;width:3px;height:3px;border-radius:50%;background:#fff;
  box-shadow:0 0 6px 1px rgba(255,255,255,.75);
  animation:twinkle 3.2s ease-in-out infinite;
}
@keyframes twinkle{0%,100%{opacity:.25}50%{opacity:1}}

.cloud{
  position:absolute;background:#fff;border-radius:100px;opacity:.9;
  filter:blur(1px);transition:opacity 2s ease;z-index:1;
}
.cloud::before,.cloud::after{content:"";position:absolute;background:#fff;border-radius:50%}
.c1{width:150px;height:40px;top:16%;left:-180px;animation:drift 64s linear infinite}
.c1::before{width:64px;height:64px;top:-30px;left:26px}
.c1::after{width:46px;height:46px;top:-20px;left:80px}
.c2{width:110px;height:32px;top:30%;left:-140px;animation:drift 86s linear infinite 18s;opacity:.75}
.c2::before{width:50px;height:50px;top:-24px;left:20px}
.c2::after{width:36px;height:36px;top:-16px;left:60px}
.c3{width:180px;height:46px;top:9%;left:-220px;animation:drift 110s linear infinite 42s;opacity:.6}
.c3::before{width:74px;height:74px;top:-36px;left:32px}
.c3::after{width:54px;height:54px;top:-24px;left:100px}
@keyframes drift{to{transform:translateX(calc(100vw + 440px))}}
body[data-act="night"] .cloud,body[data-act="finale"] .cloud{opacity:0}

.hill{position:absolute;left:-6%;right:-6%;border-radius:50% 50% 0 0;transition:background 3s ease;z-index:2}
.hill.back{bottom:0;height:26%;background:#9ad08a;opacity:.85}
.hill.front{bottom:0;height:17%;background:#6cb866}
body[data-act="night"] .hill.back,body[data-act="finale"] .hill.back{background:#1c2b4a}
body[data-act="night"] .hill.front,body[data-act="finale"] .hill.front{background:#14213d}

/* ================= 舞台（乐器幕） ================= */
#scene-instruments{
  position:fixed;inset:0;z-index:10;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:clamp(16px,3.6vh,40px);
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%,rgba(201,169,106,.16),transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 120%,#241016 0%,transparent 60%),
    #101016;
  opacity:0;visibility:hidden;transition:opacity .9s ease,visibility .9s;
}
#scene-instruments::after{
  content:"";position:absolute;left:0;right:0;bottom:0;height:26%;
  background:linear-gradient(180deg,#2a1a14,#160d0b);
  border-top:1px solid rgba(201,169,106,.45);
}
body[data-act="curtain"] #scene-instruments,
body[data-act="instruments"] #scene-instruments{opacity:1;visibility:visible}

.stage-line{
  margin:0;font-family:var(--serif);font-size:clamp(17px,3.4vw,26px);
  letter-spacing:.42em;text-indent:.42em;color:var(--gold-soft);
}
.rack{
  position:relative;z-index:1;
  display:flex;flex-wrap:wrap;justify-content:center;align-items:flex-end;
  gap:clamp(8px,2.6vw,34px);padding:0 16px;
}
.inst{
  position:relative;
  background:none;border:0;cursor:pointer;color:var(--paper);
  display:flex;flex-direction:column;align-items:center;gap:10px;
  padding:10px 8px 12px;border-radius:14px;
  transition:transform .45s cubic-bezier(.34,1.4,.64,1),background .4s;
}
.inst svg{
  height:clamp(56px,11.5vh,112px);width:auto;display:block;
  filter:drop-shadow(0 8px 18px rgba(0,0,0,.55));
  transition:filter .4s,transform .45s cubic-bezier(.34,1.4,.64,1);
}
.inst span{
  font-family:var(--serif);font-size:clamp(13px,2.4vw,17px);
  letter-spacing:.3em;text-indent:.3em;color:var(--gold-soft);
}
.inst:hover,.inst:focus-visible{transform:translateY(-10px);background:rgba(201,169,106,.08);outline:none}
.inst:hover svg,.inst:focus-visible svg{filter:drop-shadow(0 0 22px rgba(201,169,106,.65))}
.inst.chosen{transform:translateY(-14px);background:rgba(201,169,106,.14)}
.inst.chosen svg{filter:drop-shadow(0 0 30px rgba(255,214,130,.95))}
.inst.chosen::after{
  content:"♪";position:absolute;top:-6px;right:2px;color:var(--gold);
  animation:floatNote 1.6s ease-in-out infinite;
}
@keyframes floatNote{0%{opacity:0;transform:translateY(6px)}40%{opacity:1}100%{opacity:0;transform:translateY(-22px)}}
.stage-hint{
  position:relative;z-index:1;margin:0;color:rgba(244,239,230,.55);
  font-size:clamp(12px,2.2vw,14px);letter-spacing:.24em;text-indent:.24em;
}

/* ================= 生日树场景 ================= */
#scene-tree{
  position:fixed;inset:0;z-index:10;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  opacity:0;visibility:hidden;transition:opacity 1.2s ease,visibility 1.2s,filter 3s ease;
}
body[data-act="day"] #scene-tree,
body[data-act="night"] #scene-tree,
body[data-act="finale"] #scene-tree{opacity:1;visibility:visible}
body[data-act="night"] #scene-tree,
body[data-act="finale"] #scene-tree{filter:brightness(.72) saturate(.85)}

#growth-bar{
  position:absolute;top:max(18px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);
  width:min(56vw,300px);height:3px;border-radius:3px;
  background:rgba(11,11,15,.25);opacity:0;transition:opacity .8s;
}
#growth-bar i{
  display:block;height:100%;width:0%;border-radius:3px;
  background:linear-gradient(90deg,var(--gold),#ffe3a8);
  transition:width .35s ease;
}
body[data-act="day"] #growth-bar{opacity:1}
body[data-act="night"] #growth-bar,body[data-act="finale"] #growth-bar{opacity:0}

/* 孔明灯飞走后：树渐隐，夜空化作漫天繁星（规则需位于幕次规则之后才能覆盖） */
body.tree-gone #scene-tree{
  opacity:0;visibility:hidden;
  transition:opacity 3.2s ease,visibility 3.2s,filter 3.2s ease;
}

#tree{
  width:min(94vw,660px);max-height:72vh;height:auto;display:block;
  filter:drop-shadow(0 22px 30px rgba(0,0,0,.28));
}
#tree .ground{fill:rgba(74,124,64,.32)}
#tree .branch,#tree #trunk{
  fill:none;stroke:#6b4a2f;stroke-linecap:round;
  stroke-dasharray:1;stroke-dashoffset:1;
}
#tree .leaf{
  opacity:0;transform:scale(0);transform-box:fill-box;transform-origin:center;
  transition:opacity .55s ease,transform .75s cubic-bezier(.34,1.56,.64,1);
}
#tree .leaf.grown{opacity:1;transform:scale(1)}
#tree .flower{
  opacity:0;transform:scale(0);transform-box:fill-box;transform-origin:center;
  transition:opacity .5s ease,.9s cubic-bezier(.34,1.56,.64,1);
}
#tree .flower.grown{opacity:1;transform:scale(1)}

#big-bloom{
  opacity:0;transform:scale(0);transform-box:view-box;transform-origin:320px 260px;
  transition:transform 1.5s cubic-bezier(.34,1.56,.64,1),opacity .45s ease;
}
#big-bloom.appear{opacity:1;transform:scale(1)}
#big-bloom .twig{fill:none;stroke:#6b4a2f;stroke-linecap:round}
#big-bloom .bloom-halo{opacity:0;transition:opacity .8s ease .3s}
#big-bloom.appear .bloom-halo{opacity:.9}
#big-bloom .petal{
  fill:#ff9fb0;stroke:#e8788e;stroke-width:1.5;
  transform-box:fill-box;transform-origin:center;
  transform:scale(.18);
  transition:transform 1.5s cubic-bezier(.34,1.56,.64,1);
}
#big-bloom.appear .petal{transform:scale(.5)}
#big-bloom.open .petal{transform:scale(1)}
#big-bloom .bloom-core{fill:#ffe08a;transform-box:fill-box;transform-origin:center;transform:scale(.4);transition:transform 1s ease .4s}
#big-bloom.open .bloom-core{transform:scale(1)}

#tree-hint{
  margin:clamp(4px,1.4vh,14px) 0 0;font-size:clamp(13px,2.4vw,16px);
  letter-spacing:.26em;text-indent:.26em;color:#233a22;
  text-shadow:0 1px 0 rgba(255,255,255,.5);
  transition:opacity .6s;
}
body[data-act="night"] #tree-hint,body[data-act="finale"] #tree-hint{color:#c9d3ef;text-shadow:none}

/* ================= 水壶 ================= */
#can-wrap{
  position:fixed;left:0;top:0;z-index:30;width:clamp(88px,15vw,128px);
  touch-action:none;cursor:grab;opacity:0;visibility:hidden;
  transition:opacity .8s ease,visibility .8s;
  will-change:transform;
}
body[data-act="day"] #can-wrap{opacity:1;visibility:visible}
#can-wrap:active{cursor:grabbing}
#can-wrap.dragging{filter:drop-shadow(0 16px 22px rgba(0,0,0,.35))}
#can-wrap.pouring .can-body{transform:rotate(-34deg);transform-origin:74px 96px}
#can-wrap.pouring{cursor:default}
.can-body{transition:transform .5s cubic-bezier(.34,1.4,.64,1);transform-origin:74px 96px}
#can-wrap.hint-bounce{animation:canBounce 1.6s ease-in-out 3}
@keyframes canBounce{0%,100%{filter:none}50%{filter:drop-shadow(0 0 18px rgba(201,169,106,.95))}}

#droplets{position:fixed;inset:0;z-index:29;pointer-events:none;overflow:hidden}
.droplet{
  position:absolute;width:7px;height:11px;border-radius:50% 50% 60% 60%;
  background:linear-gradient(180deg,#bfe6ff,#5aa9e6);
  animation:fall .75s ease-in forwards;
}
@keyframes fall{
  0%{opacity:.95;transform:translateY(0) scaleY(1)}
  100%{opacity:0;transform:translateY(120px) scaleY(1.5)}
}

/* ================= 孔明灯 ================= */
#lantern{
  position:fixed;z-index:55;width:clamp(70px,11vw,110px);height:auto;
  transform:translate(-50%,-50%) scale(.25);
  opacity:0;pointer-events:none;
}
#lantern.show{opacity:1;transform:translate(-50%,-50%) scale(1);transition:opacity .9s ease,transform 1s cubic-bezier(.34,1.4,.64,1)}
#lantern.released{animation:lanternRise 11s cubic-bezier(.4,.1,.6,.9) forwards}
#lantern .sway{transform-box:fill-box;transform-origin:center;animation:lanternSway 3.4s ease-in-out infinite}
@keyframes lanternSway{0%,100%{transform:rotate(-5deg)}50%{transform:rotate(5deg)}}
@keyframes lanternRise{
  0%{transform:translate(-50%,-50%) scale(1);opacity:1}
  35%{transform:translate(calc(-50% + 6vw),calc(-50% - 8vh)) scale(.78);opacity:1}
  70%{transform:translate(calc(-50% - 5vw),calc(-50% - 15vh)) scale(.52);opacity:.95}
  100%{transform:translate(calc(-50% + 11vw),calc(-50% - 23vh)) scale(.3);opacity:.9}
}

/* ================= 字幕 ================= */
#caption{
  position:fixed;left:50%;bottom:clamp(26px,7vh,64px);transform:translateX(-50%);
  z-index:45;pointer-events:none;text-align:center;width:90vw;
  font-family:var(--serif);font-size:clamp(15px,3vw,22px);
  letter-spacing:.3em;text-indent:.3em;color:var(--gold-soft);
  text-shadow:0 2px 14px rgba(0,0,0,.75);
  opacity:0;transition:opacity .8s ease;
}
#caption.on{opacity:1}
body[data-act="day"] #caption{color:#1f3a1d;text-shadow:0 1px 0 rgba(255,255,255,.6)}

/* ================= 幕布 ================= */
#curtain{position:fixed;inset:0;z-index:60;pointer-events:none}
#curtain .panel{
  position:absolute;top:0;bottom:0;width:51%;
  background:
    repeating-linear-gradient(90deg,
      #5e0d1a 0px,#7d1526 26px,#660f1d 52px,#8a1a2b 78px,#5e0d1a 104px);
  box-shadow:inset 0 0 90px rgba(0,0,0,.75);
  transition:transform 2s cubic-bezier(.72,.02,.28,1);
}
#curtain .panel::after{
  content:"";position:absolute;top:0;bottom:0;width:10px;
  background:linear-gradient(90deg,rgba(0,0,0,.55),rgba(255,255,255,.14));
}
#curtain .panel.left{left:0}
#curtain .panel.left::after{right:0}
#curtain .panel.right{right:0}
#curtain .panel.right::after{left:0}
#curtain .valance{
  position:absolute;top:0;left:0;right:0;height:clamp(52px,11vh,110px);
  background:
    repeating-linear-gradient(90deg,#5e0d1a 0,#7d1526 30px,#5e0d1a 60px);
  border-bottom:4px solid var(--gold);
  box-shadow:0 12px 30px rgba(0,0,0,.6);
}
#curtain .valance::after{
  content:"";position:absolute;left:0;right:0;bottom:-16px;height:16px;
  background:
    radial-gradient(circle at 10px -4px,transparent 12px,#7d1526 12.5px) 0 0/24px 16px repeat-x;
}
body:not([data-act="boot"]) #curtain .panel.left{transform:translateX(-102%)}
body:not([data-act="boot"]) #curtain .panel.right{transform:translateX(102%)}
/* 进入白天/夜晚后，顶部帷幔也收起，避免遮挡天空与进度条 */
body[data-act="day"] #curtain,body[data-act="night"] #curtain,body[data-act="finale"] #curtain{opacity:0;transition:opacity 1.2s ease}
#curtain{transition:opacity .6s ease}

/* ================= 开场 ================= */
#boot{
  position:fixed;inset:0;z-index:80;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:22px;
  background:#000;cursor:pointer;
  transition:opacity 1.1s ease,visibility 1.1s;
}
body:not([data-act="boot"]) #boot{opacity:0;visibility:hidden;pointer-events:none}
.boot-glow{
  position:absolute;width:240px;height:240px;border-radius:50%;
  background:radial-gradient(circle,rgba(201,169,106,.30),transparent 68%);
  animation:breathe 4s ease-in-out infinite;
}
@keyframes breathe{0%,100%{transform:scale(.86);opacity:.65}50%{transform:scale(1.1);opacity:1}}
.boot-title{
  position:relative;margin:0;font-family:var(--serif);
  font-size:clamp(26px,6.4vw,46px);letter-spacing:.5em;text-indent:.5em;
  color:var(--gold-soft);
}
.boot-sub{
  position:relative;margin:0;font-size:clamp(12px,2.6vw,15px);
  letter-spacing:.34em;text-indent:.34em;color:rgba(244,239,230,.5);
  animation:pulse 2.6s ease-in-out infinite;
}
@keyframes pulse{0%,100%{opacity:.4}50%{opacity:.95}}

/* ================= 终幕 ================= */
#finale{
  position:fixed;inset:0;z-index:50;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;
  text-align:center;padding:0 24px;
  background:radial-gradient(ellipse at 50% 55%,rgba(4,5,13,.55),rgba(4,5,13,.85));
  opacity:0;transition:opacity 1.6s ease;
}
#finale[hidden]{display:none}
#finale.show{opacity:1}
.fin-wish{
  margin:0;font-family:var(--serif);
  font-size:clamp(30px,8vw,64px);letter-spacing:.3em;text-indent:.3em;
  color:#fff;text-shadow:0 0 34px rgba(255,214,130,.6);
}
.fin-sub{
  margin:0;font-family:var(--serif);font-size:clamp(15px,3.4vw,22px);
  letter-spacing:.26em;text-indent:.26em;color:var(--gold-soft);
}
.fin-sign{
  margin:14px 0 0;font-size:clamp(13px,2.8vw,17px);
  letter-spacing:.22em;text-indent:.22em;color:rgba(244,239,230,.75);
}
#replay{
  margin-top:26px;padding:12px 34px;border-radius:999px;
  background:transparent;border:1px solid var(--gold);
  color:var(--gold-soft);font-size:14px;letter-spacing:.24em;text-indent:.24em;
  cursor:pointer;transition:background .35s,color .35s,box-shadow .35s;
}
#replay:hover,#replay:focus-visible{
  background:var(--gold);color:#16120a;box-shadow:0 0 26px rgba(201,169,106,.55);outline:none;
}
.nojs{position:fixed;left:0;right:0;bottom:20px;text-align:center;color:var(--paper)}

/* ================= 无障碍 / 降级 ================= */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.2s !important}
}
@media (max-width:560px){
  .rack{gap:6px}
  .inst{padding:8px 4px 10px}
  #tree-hint{letter-spacing:.14em;text-indent:.14em}
}



