/* ===== GaGa! 个人主页 ===== */
:root {
  --ink: #2b2b2b;
  --ink-soft: #555;
  --orange: #f0704a;
  --outline: #1a1a1a;
  --green: #6cc06c;
  --grass: #8aab5e;
  --track: #dcdcdc;
  --btn-bg: #fff8ec;
  --btn-border: #9a9a9a;
  --font: 'Inter', 'PingFang SC', 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-fun: 'Chalkboard SE', 'Comic Sans MS', 'Marker Felt', 'Yuanti SC', 'YouYuan', ui-rounded, 'PingFang SC', cursive;
}

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

/* text-size-adjust 锁 100%：iOS Safari 会自动放大长文本行（时钟日期行被吹大，
   看起来比时分秒数字大一号），锁死后日期行与 hms 行字号严格一致 */
html, body { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
  background: #a8d8ef;
  transition: background 4s ease, color 2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* ---- 天空相位（北京时间驱动） ---- */
/* background-color 必须单独给实色：iOS Safari 26 不再读 theme-color，
   而是采样 body 的 background-color 给状态栏/工具栏着色（渐变属于 image，采不到） */
body.phase-day   { background: radial-gradient(circle at 12% 8%, rgba(255,236,170,.7), rgba(255,236,170,0) 44%), #b0dcf2; background-color: #b0dcf2; }
body.phase-dawn  { background: linear-gradient(#8fb8d8 40%, #f6d7b8); background-color: #8fb8d8; }
body.phase-dusk  { background: linear-gradient(#7a9cc4 30%, #f0a868); background-color: #7a9cc4; }
body.phase-night { background: linear-gradient(#0b1030, #1a2450); background-color: #0b1030; --ink: #f2efe6; --ink-soft: #c9c6bc; --btn-bg: #2c3560; --btn-border: #55639e; --track: #3a4470; --grass: #4f6a44; }
body.phase-dusk { --grass: #7d9455; }

/* 橡皮筋回弹露出的 html 底色，跟相位走 */
html { background-color: #a8d8ef; transition: background-color 4s ease; }
html:has(body.phase-day)   { background-color: #b0dcf2; }
html:has(body.phase-dawn)  { background-color: #8fb8d8; }
html:has(body.phase-dusk)  { background-color: #7a9cc4; }
html:has(body.phase-night) { background-color: #0b1030; }
html:has(body.raining.phase-day)   { background-color: #9db4c6; }
html:has(body.raining.phase-dawn)  { background-color: #7d94ac; }
html:has(body.raining.phase-dusk)  { background-color: #66788e; }
html:has(body.raining.phase-night) { background-color: #05081c; }

/* 底边取样条（仅移动端）：大部分藏在屏幕外，只留 4px 贴着工具栏，
   颜色 = 草地绿（var(--grass) 随昼夜/黄昏自动变），让底部工具栏和地面同色。
   PC 端页面底边是天空渐变而非草地，不需要这条，藏掉以免露绿边 */
#tintBottom {
  display: none;
  position: fixed; left: 0; width: 100%; height: 12px; bottom: -8px;
  z-index: 0; pointer-events: none;
  background-color: var(--grass); transition: background-color 3s ease;
}
@media (max-width: 640px) {
  #tintBottom { display: block; }
}

#sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

/* 星星 */
#stars { position: absolute; inset: 0; opacity: 0; transition: opacity 4s ease; }
body.phase-night #stars { opacity: 1; }
.star {
  position: absolute; background: #fff; border-radius: 50%;
  animation: twinkle var(--tw, 3s) ease-in-out infinite alternate;
}
.star.big { box-shadow: 0 0 6px 1px rgba(255,255,240,.8); }
@keyframes twinkle { from { opacity: .15; transform: scale(.7); } to { opacity: 1; transform: scale(1.15); } }

/* 月亮（SVG 按月相绘制亮面，JS 每日更新） */
#moon {
  position: absolute; top: 9%; right: 12%;
  width: 74px; height: 74px; border-radius: 50%;
  opacity: 0; transform: translateY(90px);
  transition: opacity 4s ease, transform 5s ease;
}
body.phase-night #moon { opacity: 1; transform: translateY(0); }
#moonWrap { position: absolute; inset: 0; }
#moonSvg { display: block; width: 100%; height: 100%; overflow: visible; }

/* 太阳：白天大阳光，光芒慢慢转 */
#sun {
  position: absolute; top: 7%; left: 8%;
  width: clamp(96px, 13vw, 160px); height: auto;
  opacity: 0; transform: translateY(0);
  transition: opacity 4s ease, transform 5s ease;
  filter: drop-shadow(0 0 26px rgba(255,214,110,.75));
}
body.phase-day #sun { opacity: 1; }
body.phase-dawn #sun, body.phase-dusk #sun { opacity: .55; }
#sunRays { transform-box: fill-box; transform-origin: 50% 50%; animation: spin 48s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 云（白天可见，慢慢漂） */
.cloud {
  position: absolute; width: 130px; height: 34px; border-radius: 40px;
  background: rgba(255,255,255,.85);
  opacity: .9; transition: opacity 4s ease;
  animation: drift 70s linear infinite;
}
.cloud::before, .cloud::after {
  content: ''; position: absolute; background: inherit; border-radius: 50%;
}
.cloud::before { width: 52px; height: 52px; top: -24px; left: 22px; }
.cloud::after  { width: 38px; height: 38px; top: -16px; left: 66px; }
.cloud-a { top: 10%; left: -160px; }
.cloud-b { top: 20%; left: -160px; transform: scale(.7); animation-duration: 95s; animation-delay: -40s; }
body.phase-night .cloud { opacity: 0; }
@keyframes drift { from { translate: 0 0; } to { translate: calc(100vw + 320px) 0; } }

/* 启动瞬态：刷新时天空直接落在当前相位（不做昼夜切换动画），
   随后只让"该升起的那一个"从地平线下升起：夜晚升月亮、白天升太阳 */
body.sky-boot, body.sky-boot *, body.sky-boot *::before, body.sky-boot *::after { transition: none !important; }
html:has(body.sky-boot) { transition: none !important; }
body.sky-boot.phase-night #moon { opacity: 0; transform: translateY(90px); }
body.sky-boot.phase-day #sun, body.sky-boot.phase-dawn #sun, body.sky-boot.phase-dusk #sun {
  opacity: 0; transform: translateY(70px);
}

/* ---- 主区 ---- */
#main {
  position: relative; z-index: 1;
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px 16px 0;
  gap: 8px;
}

/* Logo */
#logo { width: clamp(220px, 30vw, 400px); height: auto; cursor: pointer; user-select: none; }
#logo text {
  font-family: var(--font-fun);
  font-weight: 700;
  fill: var(--orange);
  stroke: var(--outline);
  stroke-width: 7px;
  stroke-linejoin: round;
  paint-order: stroke fill;
}
#logo.boing { animation: boing .7s cubic-bezier(.28,.84,.42,1); }
@keyframes boing {
  0% { transform: scale(1,1); } 30% { transform: scale(1.12,.86); }
  55% { transform: scale(.92,1.1); } 75% { transform: scale(1.05,.96); } 100% { transform: scale(1,1); }
}

/* ---- 计时器 ---- */
#timer { text-align: center; width: min(680px, 94vw); }

.since { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 6px; }
.since .rule { flex: 1; max-width: 190px; height: 1px; background: var(--ink-soft); opacity: .5; }
/* 小字号 + 宽字距：克制一点更高级 */
.since-text { font-size: clamp(10px, 1.2vw, 12.5px); color: var(--ink-soft); letter-spacing: .22em; font-weight: 600; }

.num {
  font-family: var(--font-fun);
  font-weight: 700; letter-spacing: .01em;
  display: inline-block; line-height: 1.05;
}
/* 每个数字歪歪扭扭，手绘感 */
.digit { display: inline-block; }
.digit:nth-child(odd)  { transform: rotate(-4deg) translateY(-1px); }
.digit:nth-child(even) { transform: rotate(3.5deg) translateY(1.5px); }
.digit:nth-child(3n)   { transform: rotate(-2deg) translateY(2px); }
.digit:nth-child(5n)   { transform: rotate(5deg) translateY(-2px); }
.days-row .num { font-size: clamp(56px, 9vw, 104px); }
.unit {
  font-family: var(--font-fun); font-weight: 700;
  font-size: clamp(18px, 2.6vw, 30px); margin: 0 10px 0 4px;
  display: inline-block; transform: rotate(-2deg);
}
.unit-days { font-size: clamp(26px, 4vw, 46px); transform: rotate(2deg); }
.hms-row { margin-top: 2px; }
.hms-row .num { font-size: clamp(38px, 6vw, 68px); }

/* 数字区可点击：计时器 ⇄ 时钟；时钟日期行=原第二行字号、时间行=原第一行字号 */
#numSwitch { cursor: pointer; user-select: none; -webkit-user-select: none; }
#numSwitch:focus-visible { outline: 2px dashed var(--ink-soft); outline-offset: 8px; border-radius: 14px; }
.clock-date .num { font-size: clamp(38px, 6vw, 68px); }
.clock-time .num { font-size: clamp(56px, 9vw, 104px); }
.clock-time { margin-top: 2px; }

/* 秒数跳动 */
.num.tick { animation: tick .34s cubic-bezier(.3,1.6,.5,1); }
@keyframes tick { 0% { transform: translateY(-.15em) scale(1.08) rotate(-2deg); } 100% { transform: translateY(0) scale(1) rotate(0); } }

/* 进度条 */
.progress-wrap { margin: 22px auto 6px; width: min(560px, 88vw); }
.progress-track {
  position: relative; height: clamp(38px, 5vw, 52px);
  background: var(--track); border-radius: 16px;
  transition: background 2s ease;
}
.progress-fill {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: var(--green); border-radius: 16px;
  transition: width 1s ease;
}
.age-label {
  position: absolute; top: 50%; transform: translateY(-50%) rotate(-1.5deg);
  left: 0; margin-left: 10px;
  font-family: var(--font-fun); font-weight: 700;
  font-size: clamp(15px, 2vw, 21px); color: var(--ink);
  white-space: nowrap; transition: left 1s ease;
}
.age-label i, .age-label .frac { font-size: .72em; font-style: normal; }

/* 按钮：手绘贴纸风，歪歪的圆角 + 硬阴影 */
.actions { display: flex; gap: 30px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.btn {
  font-family: var(--font-fun); font-weight: 700;
  font-size: clamp(15px, 1.9vw, 20px);
  color: var(--ink); text-decoration: none;
  background: var(--btn-bg);
  border: 3px solid var(--outline);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  padding: 10px 24px;
  box-shadow: 3px 4px 0 rgba(26,26,26,.3);
  transform: rotate(-1.4deg);
  transition: transform .18s cubic-bezier(.3,1.5,.5,1), box-shadow .18s ease, background 2s ease, color 2s ease, border-color 2s ease;
}
#btnCollab {
  transform: rotate(1.3deg);
  border-radius: 18px 225px 18px 255px / 255px 18px 225px 18px;
}
.btn:hover { transform: rotate(0deg) translateY(-3px) scale(1.045); box-shadow: 4px 7px 0 rgba(26,26,26,.3); }
.btn:active { transform: rotate(0deg) scale(.94); box-shadow: 1px 2px 0 rgba(26,26,26,.3); }
body.phase-night .btn { border-color: #93a3dc; box-shadow: 3px 4px 0 rgba(0,0,0,.45); }

/* ---- 底部场景 ---- */
/* 场景保持 1200:500 固定比例，宽屏时居中，草地向两侧无缝延伸 */
/* 场景宽除了不超过视口宽/高，还要给主区+版权留够高度（606px），
   否则宽屏矮窗口下整页超出一屏、版权被挤到首屏外 */
#stage { position: relative; z-index: 1; width: 100%; --scene-w: min(100vw, 100vh, max(320px, calc((100vh - 606px) * 2.4))); padding-bottom: 46px; }
#stage::before {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--scene-w) * 0.09 + 46px);
  background: var(--grass);
  border-top: 3px solid var(--outline);
  transition: background 3s ease;
}
#scene { display: block; width: var(--scene-w); aspect-ratio: 1200 / 500; height: auto; margin: 0 auto; position: relative; z-index: 1; }

#grass { fill: var(--grass); transition: fill 3s ease; }
#horizon { stroke: var(--outline); stroke-width: 3; opacity: .8; }

.ol { stroke: var(--outline); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.ol.thin { stroke-width: 3; }
#man, #corgi, #cat { transition: filter 3s ease; }
body.phase-night #man, body.phase-night #corgi, body.phase-night #cat { filter: brightness(.85); }

/* SVG 内部可动部件 */
#corgiBody, #catBody, #manBody,
#corgiLegL, #corgiLegR, #catTail,
#corgiEarL, #corgiEarR, #catEarL, #catEarR,
#corgiHead, #catHead, #manHead, #armL, #armR,
#corgiEyes, #catEyes, #manEyes {
  transform-box: fill-box;
}
#corgiBody, #catBody { transform-origin: 50% 100%; transition: transform .35s cubic-bezier(.3,1.4,.5,1), opacity .8s ease; }
#corgiHead, #catHead, #manHead { transform-origin: 50% 90%; }
#corgiLegL, #corgiLegR { transform-origin: 50% 0%; }
#catTail { transform-origin: 100% 50%; }
#corgiEarL, #corgiEarR, #catEarL, #catEarR { transform-origin: 50% 100%; }
#corgiEyes, #catEyes, #manEyes { transform-origin: 50% 50%; }
#armL { transform-origin: 80% 10%; }
#armR { transform-origin: 20% 10%; }

/* 常态小动作：猫尾摆、呼吸 */
#catTail { animation: sway 3.2s ease-in-out infinite alternate; }
@keyframes sway { from { transform: rotate(-4deg); } to { transform: rotate(7deg); } }
#manBody { animation: breathe 4s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes breathe { from { transform: scaleY(1); } to { transform: scaleY(1.008); } }

/* 眨眼（JS 加类） */
.blink { animation: blink .18s ease-in-out; }
@keyframes blink { 50% { transform: scaleY(.08); } }

/* 耳朵抖动（JS 随机加类） */
.twitch { animation: twitch .5s ease-in-out; }
@keyframes twitch { 25% { transform: rotate(-14deg); } 60% { transform: rotate(9deg); } }

/* 奔跑：腿部摆动 + 身体颠簸 */
.running #corgiLegL, .running #catPawL { animation: legA .28s ease-in-out infinite alternate; }
.running #corgiLegR, .running #catPawR { animation: legB .28s ease-in-out infinite alternate; }
#catPawL, #catPawR { transform-box: fill-box; transform-origin: 50% 0%; }
@keyframes legA { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
@keyframes legB { from { transform: rotate(22deg); } to { transform: rotate(-22deg); } }
.running #corgiBody, .running #catBody { animation: trot .28s ease-in-out infinite alternate; }
@keyframes trot { from { transform: translateY(0); } to { transform: translateY(-6px); } }
#man.running #manBody { animation: trot .3s ease-in-out infinite alternate; }

/* 趴下 / 蹲下 */
.crouch #corgiBody, .crouch #catBody { transform: scaleY(.78) scaleX(1.1); }
.crouch #corgiHead, .crouch #catHead { transform: translateY(10px); }

/* 开心挥手（点击人物） */
.wave #armR { animation: wave .6s ease-in-out 2; }
@keyframes wave { 50% { transform: rotate(-46deg); } }

/* ---- 版权 ---- */
#footer {
  position: absolute; left: 0; right: 0; bottom: 6px; z-index: 2;
  text-align: center; font-size: 10px; line-height: 1.6;
  color: #2f3a26; opacity: .75; padding: 0 12px;
  transition: color 2s ease;
}
body.phase-night #footer { color: #d8dcc8; }
/* 备案信息（仅 cn 分支）：跟版权同色同字号，悬停才显下划线 */
.beian { margin-top: 2px; }
.beian a { color: inherit; text-decoration: none; }
.beian a:hover { text-decoration: underline; }

/* ---- 移动端 ---- */
@media (max-width: 640px) {
  #main { padding-top: 14px; justify-content: flex-start; gap: 4px; }
  #logo { width: min(300px, 72vw); }
  .actions { gap: 12px; margin-top: 18px; }
  .btn { padding: 9px 14px; }
  /* 与 JS 的移动端 viewBox(200 100 800 400) 对应 */
  #scene { aspect-ratio: 2 / 1; }
  #stage::before { height: calc(var(--scene-w) * 0.135 + 46px); }
  .cloud { display: none; }
  #moon { width: 54px; height: 54px; right: 8%; }
  .progress-wrap { margin-top: 16px; }
}
/* ---- PC 矮屏：整页收进一屏（计时器压缩 + 场景按剩余高度缩 + 允许与人物重合） ---- */
@media (min-width: 641px) and (max-height: 900px) {
  #main { padding-top: 10px; gap: 4px; justify-content: flex-start; z-index: 2; }
  #logo { width: clamp(180px, 26vw, 320px); }
  .since { margin-bottom: 2px; }
  .days-row .num { font-size: clamp(44px, 6.5vw, 76px); }
  .hms-row .num { font-size: clamp(30px, 4.4vw, 50px); }
  .clock-time .num { font-size: clamp(44px, 6.5vw, 76px); }
  .clock-date .num { font-size: clamp(30px, 4.4vw, 50px); }
  .unit { font-size: clamp(15px, 2vw, 22px); }
  .unit-days { font-size: clamp(20px, 3vw, 32px); }
  .progress-wrap { margin: 12px auto 4px; }
  .progress-track { height: clamp(32px, 4vw, 44px); }
  .actions { margin-top: 12px; gap: 18px; }
  .btn { padding: 8px 18px; font-size: clamp(14px, 1.6vw, 17px); }
  #stage { --scene-w: min(100vw, 100vh, max(300px, calc((100vh - 395px) * 2.4))); margin-top: -56px; }
}
@media (min-width: 641px) and (max-height: 640px) {
  #logo { width: clamp(150px, 20vw, 240px); }
  .days-row .num { font-size: clamp(36px, 5vw, 56px); }
  .hms-row .num { font-size: clamp(24px, 3.4vw, 38px); }
  .clock-time .num { font-size: clamp(36px, 5vw, 56px); }
  .clock-date .num { font-size: clamp(24px, 3.4vw, 38px); }
  .unit { font-size: clamp(13px, 1.6vw, 18px); }
  .unit-days { font-size: clamp(17px, 2.4vw, 26px); }
  .progress-wrap { margin: 8px auto 2px; }
  .progress-track { height: 30px; }
  .actions { margin-top: 8px; gap: 12px; }
  .btn { padding: 6px 14px; }
  #stage { --scene-w: min(100vw, 100vh, max(300px, calc((100vh - 395px) * 2.4))); margin-top: -52px; }
}

@media (prefers-reduced-motion: reduce) {
  .cloud, #catTail, #manBody, #sunRays { animation: none; }
}

/* ---- 统一返回按钮（所有非首页页面，左上角） ---- */
.back-btn {
  position: fixed; top: 14px; left: 14px; z-index: 6;
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-fun); font-weight: 700; font-size: 15px;
  color: var(--ink); background: var(--btn-bg);
  border: 3px solid var(--outline);
  border-radius: 225px 14px 255px 14px / 14px 255px 14px 225px;
  padding: 7px 14px 7px 10px; cursor: pointer;
  box-shadow: 3px 4px 0 rgba(26,26,26,.3);
  transform: rotate(-2deg);
  transition: transform .18s cubic-bezier(.3,1.5,.5,1), box-shadow .18s ease, background 2s ease, color 2s ease, border-color 2s ease;
}
.back-btn svg { width: 26px; height: 16px; }
.back-btn:hover { transform: rotate(0deg) translateY(-2px) scale(1.05); box-shadow: 4px 6px 0 rgba(26,26,26,.3); }
.back-btn:active { transform: scale(.94); box-shadow: 1px 2px 0 rgba(26,26,26,.3); }
body.phase-night .back-btn { border-color: #93a3dc; box-shadow: 3px 4px 0 rgba(0,0,0,.45); }

/* ---- 路牌：GaGa说（立在人物身后的路上） ---- */
#sign { cursor: pointer; }
#signBoard { fill: var(--btn-bg); transition: fill 2s ease, stroke 2s ease; }
#signLabel { font-family: var(--font-fun); font-weight: 700; fill: var(--orange); }
#signTime { font-family: var(--font-fun); font-weight: 700; fill: var(--ink-soft); opacity: .8; }
#signText { font-family: var(--font-fun); font-weight: 700; fill: var(--ink); }
#sign:hover #signBoard { fill: var(--orange); }
#sign:hover #signLabel, #sign:hover #signText, #sign:hover #signTime { fill: var(--btn-bg); }
body.phase-night #signBoard { stroke: #93a3dc; }
#trees { transition: filter 3s ease; }
body.phase-night #trees { filter: brightness(.62) saturate(.8); }
body.phase-dusk #trees { filter: brightness(.85); }

/* ---- 流星（夜）/ 飞鸟（白天） ---- */
.meteor {
  position: absolute; width: 130px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, rgba(255,255,240,0), rgba(255,255,240,.95));
  filter: drop-shadow(0 0 6px rgba(255,255,240,.8));
  transform: rotate(24deg); opacity: 0; pointer-events: none;
  animation: meteorFly 1.5s ease-out forwards;
}
@keyframes meteorFly {
  0% { opacity: 0; translate: 0 0; }
  12% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; translate: -46vw 21vw; }
}
.bird { position: absolute; width: 26px; height: 12px; pointer-events: none; animation: birdFly linear forwards; }
.bird svg { display: block; width: 100%; height: 100%; overflow: visible; }
.bird .wl, .bird .wr { transform-box: fill-box; animation: flap .5s ease-in-out infinite alternate; }
.bird .wl { transform-origin: 100% 100%; }
.bird .wr { transform-origin: 0% 100%; }
@keyframes flap { from { transform: rotate(26deg); } to { transform: rotate(-18deg); } }
@keyframes birdFly {
  0% { translate: -60px 0; } 25% { translate: 25vw -14px; }
  50% { translate: 50vw 6px; } 75% { translate: 75vw -10px; }
  100% { translate: calc(100vw + 60px) 0; }
}
body.phase-night .bird, body.raining .bird { display: none; }

/* ---- 雨天：乌云 / 天色 / 隐藏星月 ---- */
#overcast {
  position: absolute; left: -10%; right: -10%; top: -40px; height: 34vh;
  background:
    radial-gradient(60% 90% at 18% 100%, rgba(88,98,120,.95), rgba(88,98,120,0) 70%),
    radial-gradient(50% 80% at 48% 100%, rgba(74,84,106,.95), rgba(74,84,106,0) 72%),
    radial-gradient(60% 90% at 80% 100%, rgba(88,98,120,.95), rgba(88,98,120,0) 70%),
    linear-gradient(rgba(70,80,102,.9), rgba(70,80,102,0));
  opacity: 0; transition: opacity 3s ease; pointer-events: none;
}
body.raining #overcast { opacity: 1; }
body.raining.phase-night #overcast { opacity: .5; }
body.raining .cloud { background: rgba(120,130,152,.9); }
body.raining.phase-day { background: radial-gradient(circle at 12% 8%, rgba(210,220,232,.5), rgba(210,220,232,0) 44%), #9db4c6; background-color: #9db4c6; }
body.raining.phase-dawn { background: linear-gradient(#7d94ac 40%, #c9b39c); background-color: #7d94ac; }
body.raining.phase-dusk { background: linear-gradient(#66788e 30%, #b08058); background-color: #66788e; }
body.raining.phase-night { background: linear-gradient(#05081c, #101736); background-color: #05081c; }
body.raining #stars, body.raining #moon { opacity: 0 !important; }
#rainCv { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* ---- 雨伞 ---- */
#umbrella { transition: opacity .8s ease; }
#man.rainhold #umbrella { opacity: 1; }

/* ---- 睡觉（23:00–06:00）：男生去睡了，猫狗趴窝 ---- */
#man { transition: opacity 1.6s ease, filter 3s ease; }
body.sleeping #man { opacity: 0; pointer-events: none; }
/* 睡觉 = 淡入独立绘制的趴窝埋头睡姿、淡出站姿（不再压扁站姿） */
#corgiSleep, #catSleep {
  opacity: 0; pointer-events: none;
  transform-box: fill-box; transform-origin: 50% 100%;
  transition: opacity .8s ease;
}
.sleeping-pet #corgiBody, .sleeping-pet #catBody { opacity: 0; pointer-events: none; }
.sleeping-pet #corgiSleep, .sleeping-pet #catSleep { opacity: 1; animation: breathe 4s ease-in-out infinite alternate; }
/* Zzz 从站姿头高移到趴姿头旁 */
.sleeping-pet .zzz { translate: 0 88px; }
.zzz { pointer-events: none; }
.zzz text { font-family: var(--font-fun); font-weight: 700; fill: var(--ink-soft); }
.sleeping-pet .zzz { opacity: 1; animation: zFloat 2.6s ease-in-out infinite; }
@keyframes zFloat { 0%,100% { transform: translateY(0); opacity: .55; } 50% { transform: translateY(-8px); opacity: 1; } }

/* ---- 生日限定（每年 1/10）：横幅 + 烟花彩带 ---- */
#bdayBanner {
  position: fixed; top: 10px; left: 14px; z-index: 4;
  display: flex; align-items: center; gap: 10px;
  background: var(--btn-bg); border: 3px solid var(--outline);
  border-radius: 255px 18px 225px 18px / 18px 225px 18px 255px;
  box-shadow: 3px 4px 0 rgba(26,26,26,.3);
  padding: 8px 18px;
  font-family: var(--font-fun); font-weight: 700;
  font-size: clamp(15px, 2.2vw, 22px); color: var(--ink);
  transform: rotate(-1.5deg);
  animation: bannerIn .8s cubic-bezier(.3,1.6,.5,1);
}
#bdayBanner[hidden] { display: none; }
#bdayBanner svg { width: 40px; height: 30px; flex: none; }
@keyframes bannerIn { from { transform: rotate(-1.5deg) scale(.4); opacity: 0; } }
#fx { position: fixed; inset: 0; z-index: 3; pointer-events: none; }

/* ---- 男生对话气泡 ---- */
#bubble {
  transform-box: fill-box; transform-origin: 50% 100%;
  transform: scale(.6); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .3s cubic-bezier(.3,1.6,.5,1);
}
#man.talking #bubble { opacity: 1; transform: scale(1); }
#bubbleBox, #bubbleTail { fill: var(--btn-bg); }
#bubbleText { font-family: var(--font-fun); font-weight: 700; fill: var(--ink); }
body.phase-night #bubbleBox, body.phase-night #bubbleTail { stroke: #93a3dc; }

/* ---- 晕倒星星 ---- */
#dizzy { transition: opacity .3s ease; }
#dizzySpin { transform-box: fill-box; transform-origin: 50% 50%; }
#man.faint #dizzy { opacity: 1; }
#man.faint #dizzySpin { animation: spin 1.1s linear infinite; }

/* ---- 男生情绪动作 ---- */
#manBody { transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
#man.emoting #manBody { animation: none; }
#armL, #armR { transition: transform .3s cubic-bezier(.3,1.5,.5,1); }
/* 摔倒 / 晕倒 / 爬起 */
#man.fall #manBody { transform: rotate(84deg) translate(4px,2px); transition: transform .45s cubic-bezier(.55,0,.85,.35); }
#man.faint #manBody { transform: rotate(-88deg) translate(-4px,2px); transition: transform .6s cubic-bezier(.55,0,.85,.35); }
#man.getup #manBody { transform: rotate(0deg); transition: transform .8s cubic-bezier(.3,1.5,.5,1); }
/* 欢呼：举双手 + 小跳 */
#man.cheer #armL { transform: rotate(160deg); }
#man.cheer #armR { transform: rotate(-160deg); }
#man.cheer #manBody { animation: cheerHop .5s ease-in-out 3; }
@keyframes cheerHop { 50% { transform: translateY(-24px); } }
/* 鼓掌 */
#man.clap #armL { animation: clapL .38s ease-in-out 5; }
#man.clap #armR { animation: clapR .38s ease-in-out 5; }
@keyframes clapL { 0%,100% { transform: rotate(-26deg); } 50% { transform: rotate(-40deg); } }
@keyframes clapR { 0%,100% { transform: rotate(26deg); } 50% { transform: rotate(40deg); } }
/* 弯腿跳 */
#man.duckjump #manBody { animation: duckJump .95s cubic-bezier(.3,.7,.4,1); }
@keyframes duckJump {
  0% { transform: scaleY(1); }
  22% { transform: scaleY(.78) scaleX(1.1); }
  55% { transform: translateY(-64px) scaleY(1.06) scaleX(.96); }
  78% { transform: translateY(0) scaleY(.88) scaleX(1.06); }
  100% { transform: scaleY(1); }
}
/* 皱眉 */
#browL, #browR { transform-box: fill-box; transform-origin: 50% 50%; transition: transform .25s ease; }
#man.frown #browL { transform: rotate(16deg) translate(2px,3px); }
#man.frown #browR { transform: rotate(-16deg) translate(-2px,3px); }
#manMouthSmile, #manMouthSad { transition: opacity .25s ease; }
#man.frown #manMouthSmile { opacity: 0; }
#man.frown #manMouthSad { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #dizzySpin, #man.cheer #manBody, #man.clap #armL, #man.clap #armR,
  #man.duckjump #manBody, #bdayBanner { animation: none; }
  .meteor, .bird, .zzz { animation: none; }
}