/* ==========================================================
   特效层 —— 极光 / 流光 / 粒子 / 入场
   ========================================================== */
@property --spin-a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

/* 背景光团已迁移到 bg.css（分层极光 + 光束） */

/* 鼠标光斑 */
#cursorGlow {
  position: fixed; left: 0; top: 0; width: 320px; height: 320px;
  margin: -160px 0 0 -160px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 150, 190, .16), transparent 62%);
  z-index: 0; transition: opacity .4s; will-change: transform;
  opacity: 0;
}

/* 流光边框卡片 */
.ornate { position: relative; }
.ornate::before {
  content: ""; position: absolute; inset: -1.5px; border-radius: inherit;
  padding: 1.5px; pointer-events: none;
  background: conic-gradient(from var(--spin-a),
    rgba(255,143,177,0) 0deg,
    rgba(255,143,177,.85) 42deg,
    rgba(138,182,255,.9) 84deg,
    rgba(255,143,177,0) 130deg,
    rgba(255,143,177,0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: borderSpin 5.5s linear infinite;
  opacity: .9;
}
@keyframes borderSpin { to { --spin-a: 360deg; } }

/* 按钮流光 */
.btn { position: relative; overflow: hidden; }
.btn::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-18deg); transition: left .55s ease;
}
.btn:hover::after { left: 140%; }

/* 登录页入场 */
.auth-card { animation: cardIn .75s cubic-bezier(.16,.9,.24,1) both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(.97); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.auth-logo {
  animation: logoFloat 4.2s ease-in-out infinite;
  position: relative;
}
.auth-logo::after {
  content: ""; position: absolute; inset: -10px; border-radius: 30px;
  background: radial-gradient(circle, rgba(255,143,177,.5), transparent 65%);
  filter: blur(10px); z-index: -1; animation: logoPulse 3.4s ease-in-out infinite;
}
@keyframes logoFloat { 0%,100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-7px) rotate(2deg); } }
@keyframes logoPulse { 0%,100% { opacity: .45; transform: scale(.92); } 50% { opacity: .85; transform: scale(1.08); } }

.auth-card h1 {
  background: linear-gradient(100deg, #fff 0%, var(--accent) 32%, #fff 62%, var(--accent-2) 100%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmerText 6s linear infinite;
}
@keyframes shimmerText { to { background-position: 220% center; } }

#loginView form, #setupView form { animation: fadeUp .7s .12s cubic-bezier(.16,.9,.24,1) both; }
#loginView h1, #setupView h1 { animation: fadeUp .7s .05s cubic-bezier(.16,.9,.24,1) both; }
#loginView .sub, #setupView .sub { animation: fadeUp .7s .1s cubic-bezier(.16,.9,.24,1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

input[type="text"], input[type="password"], input[type="date"], textarea {
  transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, textarea:focus {
  background: rgba(0, 0, 0, .42);
  box-shadow: 0 0 0 3px rgba(255,143,177,.18), 0 0 26px rgba(255,143,177,.22);
}

/* 主页面入场 */
.hero { animation: heroIn .9s cubic-bezier(.16,.9,.24,1) both; }
@keyframes heroIn {
  from { opacity: 0; transform: translateY(20px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
.grid > .panel:nth-child(1) { transition-delay: .10s; }
.grid > .panel:nth-child(2) { transition-delay: .18s; }
.grid > .panel:nth-child(3) { transition-delay: .26s; }
.grid > .panel:nth-child(4) { transition-delay: .34s; }

/* 滚动浮现 */
body .reveal { opacity: 0; transform: translateY(42px); transition: opacity 1s cubic-bezier(.16,.9,.24,1), transform 1s cubic-bezier(.16,.9,.24,1); will-change: opacity, transform; }
body .reveal.in { opacity: 1; transform: none; }

/* 倒计时数字跳动 */
.unit { transition: transform .2s ease, box-shadow .3s ease, border-color .3s ease; }
.unit.tick { animation: unitPulse .42s cubic-bezier(.2,.8,.3,1); }
@keyframes unitPulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.07); box-shadow: 0 0 26px rgba(255,143,177,.35); border-color: rgba(255,143,177,.5); }
  100% { transform: scale(1); }
}

/* 卡片悬浮 */
.panel, .hero { transition: transform .35s cubic-bezier(.2,.8,.3,1), box-shadow .35s ease, border-color .35s ease; }
.panel:hover, .hero:hover {
  transform: translateY(-3px);
  border-color: rgba(255,143,177,.28);
  box-shadow: 0 26px 70px rgba(0,0,0,.45), 0 0 40px rgba(255,143,177,.10);
}

/* 照片悬停 */
.photo { transition: transform .35s cubic-bezier(.2,.8,.3,1), box-shadow .35s ease, border-color .35s ease; }
.photo:hover { transform: translateY(-4px) scale(1.02); border-color: rgba(255,143,177,.4); box-shadow: 0 18px 44px rgba(0,0,0,.45); }

/* 生日当天 */
body.birthday-mode .hero {
  border-color: rgba(255,143,177,.5);
  box-shadow: 0 0 70px rgba(255,143,177,.3), inset 0 0 60px rgba(255,143,177,.06);
}
body.birthday-mode .unit .num { animation: birthdayGlow 1.6s ease-in-out infinite; }
@keyframes birthdayGlow {
  0%,100% { filter: drop-shadow(0 0 6px rgba(255,143,177,.5)); }
  50%     { filter: drop-shadow(0 0 22px rgba(255,143,177,.95)); }
}

/* 庆祝过场 */
.celebrate {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(40, 22, 42, .92), rgba(6, 8, 16, .97));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: celIn .35s ease both;
}
.celebrate.out { animation: celOut .55s ease both; }
@keyframes celIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes celOut { to { opacity: 0; transform: scale(1.06); } }
.celebrate .inner { text-align: center; animation: celPop .7s cubic-bezier(.16,.9,.24,1) both; }
@keyframes celPop { from { opacity: 0; transform: translateY(26px) scale(.9); filter: blur(10px); } to { opacity: 1; transform: none; filter: none; } }
.celebrate .ring {
  width: 96px; height: 96px; margin: 0 auto 22px; border-radius: 50%;
  border: 2px solid rgba(255,143,177,.4);
  display: grid; place-items: center; font-size: 42px;
  box-shadow: 0 0 50px rgba(255,143,177,.45), inset 0 0 40px rgba(255,143,177,.18);
  animation: ringPulse 1.8s ease-in-out infinite;
}
@keyframes ringPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.celebrate h2 {
  font-size: clamp(26px, 5vw, 44px); font-weight: 800;
  background: linear-gradient(110deg, var(--accent), #fff 48%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.celebrate p { color: var(--muted); margin-top: 12px; font-size: 14.5px; letter-spacing: .08em; }

/* 通用粒子画布 */
#fxCanvas { position: fixed; inset: 0; z-index: 250; pointer-events: none; }

.toast { z-index: 400; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  /* 滚动淡入只动透明度，不算「动态效果」，保留 */
  body .reveal { transition-duration: .7s !important; }
}

/* ==========================================================
   登录过场：照片墙旋转飞入 → 转场主界面
   ========================================================== */
body.intro-active .wrap {
  transform: scale(1.035);
  opacity: 0;
}
.wrap { transition: transform .9s cubic-bezier(.16,.9,.24,1), opacity .9s ease; }

.intro {
  position: fixed; inset: 0; z-index: 350;
  overflow: hidden;
  perspective: 1700px;
  background:
    radial-gradient(circle at 50% 46%, rgba(58, 30, 58, .95) 0%, rgba(12, 10, 22, .98) 45%, #05060c 100%);
  transition: opacity .38s ease;
  opacity: 0;
}
.intro.in { opacity: 1; }
.intro.out { opacity: 0; }

.intro-glow {
  position: absolute; left: 50%; top: 50%;
  width: 40vmax; height: 40vmax;
  margin: -20vmax 0 0 -20vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,122,168,.28), rgba(138,182,255,.12) 40%, transparent 68%);
  filter: blur(30px);
  animation: introGlow 3s ease-in-out infinite;
}
@keyframes introGlow {
  0%, 100% { transform: scale(.85); opacity: .55; }
  50%      { transform: scale(1.1); opacity: .9; }
}

.intro-stage { position: absolute; inset: 0; transform-style: preserve-3d; }

/* 照片多时：整台旋转 + 卡片沿半径收拢 = 向内螺旋 */
.intro.play.spiral .intro-stage {
  animation: spiralTurn 3.2s cubic-bezier(.18, .8, .24, 1) both;
}
/* 螺旋模式卡片小一号，才看得出螺旋线 */
.intro.spiral .intro-card {
  width: clamp(72px, 11.5vmin, 122px);
  margin: calc(clamp(72px, 11.5vmin, 122px) / -2);
}
@keyframes spiralTurn {
  from { transform: rotate(-78deg) scale(1.06); }
  to   { transform: rotate(0deg) scale(1); }
}

.intro.spiral .intro-title {
  background: radial-gradient(circle at 50% 50%, rgba(6, 7, 14, .78) 0%, rgba(6, 7, 14, .45) 42%, transparent 70%);
}

.intro-card {
  position: absolute; left: 50%; top: 50%;
  width: clamp(96px, 16vmin, 180px);
  aspect-ratio: 1;
  margin: calc(clamp(96px, 16vmin, 180px) / -2);
  border-radius: 20px;
  overflow: hidden;
  opacity: 0;
  will-change: transform, opacity, filter;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14),
              0 0 44px rgba(255, 122, 168, .22);
  /* 起点：很远很远的纵深，几乎看不见 */
  transform: translate3d(var(--sx), var(--sy), -2600px)
             rotateZ(var(--sr)) rotateY(var(--sy2, 70deg)) scale(.12);
  filter: blur(14px) brightness(.45);
  transition: none;
}
.intro-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.intro-card.ph {
  display: grid; place-items: center;
  font-size: 34px;
  background: linear-gradient(135deg, rgba(255,122,168,.55), rgba(138,182,255,.55));
}

.intro.play .intro-card {
  opacity: 1;
  filter: none;
  transform: translate3d(var(--tx), var(--ty), 0) rotateZ(var(--tr)) rotateY(0deg) scale(var(--fs, 1.06));
  transition: transform 1.7s cubic-bezier(.13, .85, .2, 1.03) var(--d),
              opacity 1.1s ease var(--d),
              filter 1.4s ease var(--d);
}

.intro.exit .intro-card {
  opacity: 0;
  filter: blur(8px);
  transform: translate3d(calc(var(--tx) * .18), calc(var(--ty) * .18), 980px)
             rotateZ(calc(var(--tr) * .3)) scale(1.5);
  transition: transform 1s cubic-bezier(.5, 0, .85, .4) var(--ex, 0ms),
              opacity .9s ease var(--ex, 0ms),
              filter 1s ease var(--ex, 0ms);
}

.intro-title {
  position: absolute; inset: 0;
  display: grid; place-content: center;
  text-align: center;
  opacity: 0; transform: translateY(14px) scale(.98);
  transition: opacity .45s ease .08s, transform .55s cubic-bezier(.16,.9,.24,1) .08s;
  pointer-events: none;
}
.intro.play .intro-title,
.intro.in .intro-title { opacity: 1; transform: none; }
.intro.exit .intro-title { opacity: 0; transition: opacity .35s ease; }
.intro-title .kicker {
  font-size: 11px; letter-spacing: .42em; text-transform: uppercase;
  color: rgba(255, 255, 255, .42); margin-bottom: 14px;
}
.intro-title h2 {
  font-size: clamp(24px, 4vw, 40px); font-weight: 700; letter-spacing: .02em;
  background: linear-gradient(110deg, #fff, var(--accent) 55%, var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.intro-title p {
  margin-top: 12px; font-size: 13px; color: rgba(255, 255, 255, .4);
  letter-spacing: .18em;
}

.intro-flash {
  position: absolute; left: 50%; top: 50%;
  width: 10px; height: 10px; margin: -5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.95), rgba(255,143,177,.6) 40%, transparent 70%);
  opacity: 0;
}
.intro.exit .intro-flash { animation: introFlash .75s ease-out forwards; }
@keyframes introFlash {
  0%   { opacity: 0; transform: scale(.2); }
  35%  { opacity: .9; transform: scale(38); }
  100% { opacity: 0; transform: scale(90); }
}

@media (max-width: 620px) {
  .intro-card {
    width: clamp(72px, 19vmin, 118px);
    margin: calc(clamp(72px, 19vmin, 118px) / -2);
    filter: blur(10px) brightness(.45);
  }
}
@media (prefers-reduced-motion: reduce) {
  .intro { display: none !important; }
}

/* ==========================================================
   倒计时卡片：流动光束边框（Border Beam）
   ========================================================== */
@property --beam-angle { syntax: "<angle>"; initial-value: 0deg; inherits: false; }

.border-beam {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 2px;
  pointer-events: none;
  background: conic-gradient(
    from var(--beam-angle),
    transparent 0deg,
    transparent 286deg,
    rgba(255, 122, 168, 0) 306deg,
    rgba(255, 122, 168, .85) 342deg,
    #ffffff 355deg,
    rgba(255, 255, 255, 0) 360deg
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  filter: drop-shadow(0 0 9px rgba(255, 122, 168, 1));
  animation: beamSpin 4.6s linear infinite;
  opacity: .95;
}

.border-beam.alt {
  background: conic-gradient(
    from var(--beam-angle),
    transparent 0deg,
    transparent 286deg,
    rgba(138, 182, 255, 0) 306deg,
    rgba(138, 182, 255, .8) 342deg,
    #ffffff 355deg,
    rgba(255, 255, 255, 0) 360deg
  );
  filter: drop-shadow(0 0 9px rgba(138, 182, 255, 1));
  animation-delay: -2.3s;
}

@keyframes beamSpin {
  to { --beam-angle: 360deg; }
}

@media (prefers-reduced-motion: reduce) {
  .border-beam { animation: none; opacity: .5; }
}

/* 倒计时卡片 3D 倾斜 */
.hero {
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform .35s cubic-bezier(.2,.8,.3,1), box-shadow .35s ease, border-color .35s ease;
}

/* 生日当天：鼠标仙女棒 */
body.sparkler-mode,
body.sparkler-mode * { cursor: none !important; }
body.sparkler-mode input,
body.sparkler-mode textarea { cursor: text !important; }

#sparkTip {
  position: fixed;
  left: 0; top: 0;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  background: radial-gradient(circle, #ffffff 0%, #fff1bd 34%, rgba(255, 196, 110, .6) 62%, rgba(255, 150, 190, .25) 80%, transparent 100%);
  box-shadow: 0 0 16px rgba(255, 214, 130, .95), 0 0 40px rgba(255, 150, 190, .55);
  will-change: transform;
}

/* 仙女棒照到哪，哪一块就亮起来 */
#sparkLight {
  position: fixed;
  left: 0; top: 0;
  width: 290px; height: 290px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 60;
  background: radial-gradient(circle,
    rgba(255, 244, 216, .30) 0%,
    rgba(255, 224, 190, .16) 32%,
    rgba(255, 190, 220, .08) 55%,
    transparent 72%);
  mix-blend-mode: screen;
  will-change: transform;
  filter: blur(2px);
}

/* 输入框随字数长高，不出现内部滚动条 */
.composer { align-items: flex-start; }
.composer textarea {
  resize: none;
  overflow-y: hidden;
  transition: height .16s ease;
  line-height: 1.5;
}
