:root {
  --bg-deep: #07111f;
  --bg-mid: #0f2340;
  --bg-soft: #1b3a60;
  --accent: #ffd08a;
  --accent-2: #9ecbff;
  --text-main: #f5f7ff;
  --text-dim: #ccd6eb;
  --card-bg: rgba(12, 20, 40, 0.58);
  --card-border: rgba(255, 255, 255, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  color: var(--text-main);
  font-family: "Manrope", "Segoe UI", sans-serif;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(158, 203, 255, 0.18), transparent 38%),
    radial-gradient(circle at 80% 0%, rgba(255, 208, 138, 0.12), transparent 34%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 52%, var(--bg-soft) 100%);
}

.music-bar {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(10, 20, 40, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.music-label {
  font-size: 0.86rem;
  color: #f8ecd4;
}

#music-toggle {
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  color: #1a2438;
  background: linear-gradient(120deg, #ffe0b8, #ffc78f);
}

#music-volume {
  width: 82px;
}

.music-volume-label {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.music-status {
  font-size: 0.78rem;
  color: #c6ddff;
  min-width: 4em;
}

main {
  position: relative;
  z-index: 6;
  width: min(980px, 92vw);
  margin: 0 auto;
  padding: 10vh 0 16vh;
}

h1,
h2 {
  font-family: "ZCOOL XiaoWei", serif;
  letter-spacing: 0.03em;
}

.parallax-layer {
  position: fixed;
  inset: -15vh -10vw;
  pointer-events: none;
  z-index: 1;
  transition: transform 0.08s linear;
}

.stars {
  background-image:
    radial-gradient(2px 2px at 15% 22%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.6px 1.6px at 35% 72%, rgba(255, 255, 255, 0.75), transparent),
    radial-gradient(1.8px 1.8px at 70% 35%, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(1.2px 1.2px at 88% 78%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(1.4px 1.4px at 55% 52%, rgba(255, 255, 255, 0.8), transparent);
  background-size: 380px 300px;
  opacity: 0.8;
}

.nebula {
  background:
    radial-gradient(circle at 24% 30%, rgba(116, 169, 255, 0.35), transparent 35%),
    radial-gradient(circle at 74% 62%, rgba(255, 183, 158, 0.28), transparent 40%);
  filter: blur(22px);
}

.glow {
  background:
    radial-gradient(ellipse at 50% 22%, rgba(255, 244, 218, 0.2), transparent 56%),
    radial-gradient(ellipse at 50% 82%, rgba(165, 204, 255, 0.16), transparent 60%);
}

.cover-video-stage {
  position: fixed;
  inset: 0 0 auto 0;
  height: 100vh;
  z-index: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  pointer-events: none;
  overflow: hidden;
}

.cover-video-stage::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 30vh;
  background: linear-gradient(180deg, rgba(7, 17, 31, 0) 0%, rgba(7, 17, 31, 0.92) 100%);
}

.character-stage {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.cute-character {
  --hug-progress: 0;
  --body-color: #ffd2e1;
  --arm-color: #ffd2e1;
  --leg-color: #fff4ea;
  position: absolute;
  width: clamp(108px, 16vw, 186px);
  transform-origin: center bottom;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.25));
  will-change: transform;
}

.character-full {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: none;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.26));
}

.cute-character.using-full .character-full {
  display: block;
}

.cute-character.using-full .character-avatar-wrap,
.cute-character.using-full .character-body {
  display: none;
}

.character-avatar-wrap {
  position: relative;
  width: 56%;
  margin: 0 auto;
  aspect-ratio: 1;
  border-radius: 999px;
  border: 3px solid rgba(255, 249, 236, 0.86);
  overflow: hidden;
  box-shadow: 0 7px 14px rgba(0, 0, 0, 0.25);
  z-index: 2;
}

.character-head {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.character-body {
  position: relative;
  width: 74%;
  margin: -8% auto 0;
  height: 50%;
  border-radius: 38% 38% 26% 26%;
  background: var(--body-color);
  box-shadow: inset 0 -8px 16px rgba(0, 0, 0, 0.1);
  transform: translateY(calc(var(--hug-progress) * 4px));
}

.character-belly {
  position: absolute;
  inset: 20% 24% 20%;
  border-radius: 40%;
  background: rgba(255, 255, 255, 0.38);
}

.character-arm {
  position: absolute;
  top: 18%;
  width: 34%;
  height: 16%;
  border-radius: 999px;
  background: var(--arm-color);
  transform-origin: center center;
  transition: transform 0.1s linear;
}

.character-arm.outer {
  left: -14%;
}

.character-arm.inner {
  right: -14%;
}

.character-leg {
  position: absolute;
  bottom: -18%;
  width: 21%;
  height: 25%;
  border-radius: 999px;
  background: var(--leg-color);
}

.character-leg.left {
  left: 24%;
}

.character-leg.right {
  right: 24%;
}

.cute-character.left .character-arm.outer {
  transform: rotate(-16deg);
}

.cute-character.left .character-arm.inner {
  transform: rotate(calc(20deg + var(--hug-progress) * 56deg));
}

.cute-character.right .character-arm.outer {
  transform: rotate(16deg);
}

.cute-character.right .character-arm.inner {
  transform: rotate(calc(-20deg - var(--hug-progress) * 56deg));
}

.cute-character.left {
  --body-color: #ffd2e1;
  --arm-color: #ffd2e1;
  --leg-color: #fff4ea;
}

.cute-character.right {
  --body-color: #cce1ff;
  --arm-color: #cce1ff;
  --leg-color: #eff6ff;
}

.cute-character.is-hugging {
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.3));
}

.together-character {
  position: absolute;
  width: clamp(124px, 19vw, 210px);
  border-radius: 20px;
  border: 3px solid rgba(255, 244, 220, 0.82);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.32);
  object-fit: cover;
  opacity: 0;
  will-change: transform, opacity;
}

#particle-canvas {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.scene {
  position: relative;
  margin-bottom: 16vh;
}

.hero {
  min-height: 84vh;
  display: grid;
  align-content: center;
  gap: 1.2rem;
  text-align: center;
}

.hero-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.08) contrast(1.05) brightness(0.78);
}

.hero-video-mask {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 13, 27, 0.28), rgba(5, 12, 22, 0.66)),
    linear-gradient(90deg, rgba(8, 18, 36, 0.62) 0%, rgba(8, 18, 36, 0.2) 50%, rgba(8, 18, 36, 0.62) 100%);
  pointer-events: none;
}

.avatar-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.avatar-card {
  margin: 0;
  display: grid;
  gap: 0.5rem;
  justify-items: center;
}

.avatar-card img {
  width: clamp(74px, 11vw, 108px);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
}

#avatar-left {
  animation: spinClockwise 16s linear infinite;
}

#avatar-right {
  animation: spinCounterClockwise 16s linear infinite;
}

@keyframes spinClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes spinCounterClockwise {
  from { transform: rotate(0deg); }
  to { transform: rotate(-360deg); }
}

.avatar-card figcaption {
  font-size: 0.95rem;
  color: #ffe8bf;
}

.avatar-heart {
  color: #ffd3db;
  font-size: 1.3rem;
  transform: translateY(-10px);
  animation: heartBeat 1.9s ease-in-out infinite;
}

@keyframes heartBeat {
  0%,
  100% { transform: translateY(-10px) scale(1); }
  35% { transform: translateY(-10px) scale(1.13); }
  70% { transform: translateY(-10px) scale(0.94); }
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--accent-2);
  font-size: 0.86rem;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 4.5rem);
  line-height: 1.12;
}

.lead {
  margin: 0 auto;
  max-width: 680px;
  font-size: clamp(1rem, 2.5vw, 1.28rem);
  color: var(--text-dim);
}

.cta {
  justify-self: center;
  text-decoration: none;
  color: var(--bg-deep);
  background: linear-gradient(120deg, #ffe8bf, #ffd08a);
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 208, 138, 0.35);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: clamp(1.2rem, 4vw, 2.4rem);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 30px rgba(2, 8, 22, 0.35);
}

.card h2,
.countdown h2 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.card p,
.countdown p {
  margin: 0;
  color: var(--text-dim);
  line-height: 1.85;
  font-size: clamp(1rem, 2.2vw, 1.18rem);
}

.chapter-title {
  margin-bottom: 0.5rem;
}

.chapter-quote {
  margin: 0 0 0.9rem;
  padding: 0.62rem 0.85rem 0.62rem 1rem;
  border-left: 3px solid rgba(255, 216, 140, 0.9);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255, 214, 128, 0.14), rgba(255, 214, 128, 0.03));
  color: #ffe2a3;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.55;
  text-shadow: 0 0 14px rgba(255, 202, 120, 0.22);
}

.chapter-quote[hidden] {
  display: none !important;
}

.chapter-body {
  margin: 0;
}

.countdown {
  text-align: center;
  background: rgba(8, 16, 34, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  padding: clamp(1.2rem, 5vw, 3rem);
}

.memory-heart {
  text-align: center;
  background: rgba(8, 16, 34, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 30px;
  padding: clamp(1.2rem, 5vw, 3rem);
}

.heart-photo-frame {
  width: min(520px, 86vw);
  margin: 1rem auto 1.1rem;
  aspect-ratio: 1 / 1;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.35));
}

.heart-photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  clip-path: path("M 50% 91% C 46% 86%, 8% 62%, 8% 35% C 8% 17%, 22% 7%, 36% 7% C 44% 7%, 50% 11%, 50% 18% C 50% 11%, 56% 7%, 64% 7% C 78% 7%, 92% 17%, 92% 35% C 92% 62%, 54% 86%, 50% 91% Z");
  border: 4px solid rgba(255, 236, 214, 0.72);
}

.memory-heart p {
  margin: 0;
  color: var(--text-dim);
  font-size: clamp(1rem, 2.4vw, 1.16rem);
}

.memory-heart.surprise-pop {
  animation: surprisePop 0.85s cubic-bezier(0.2, 0.9, 0.2, 1.05);
}

@keyframes surprisePop {
  0% {
    opacity: 0;
    transform: translateY(56px) scale(0.78);
  }
  62% {
    opacity: 1;
    transform: translateY(-8px) scale(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.timer {
  margin: 1.2rem 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 0.8rem;
}

.timer div {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.8rem;
}

.timer span {
  display: block;
  font-size: clamp(1.5rem, 6vw, 2.6rem);
  font-weight: 800;
  color: #fff5d6;
}

.timer small {
  color: var(--text-dim);
}

.birthday-message {
  margin-top: 1rem;
  color: #fff0cf;
  font-size: clamp(1rem, 2.5vw, 1.2rem);
}

#celebrate-btn {
  margin-top: 1.3rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, #a8cfff, #ffd6ab);
  color: #111826;
  font-weight: 700;
  font-size: 1rem;
  padding: 0.9rem 1.4rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#celebrate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(168, 207, 255, 0.38);
}

#celebrate-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
  filter: grayscale(0.25);
}

body.celebration-burst::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 232, 176, 0.45), rgba(255, 215, 142, 0.18) 32%, rgba(255, 215, 142, 0) 70%),
    radial-gradient(circle at 18% 22%, rgba(255, 205, 128, 0.24), transparent 42%),
    radial-gradient(circle at 82% 26%, rgba(255, 180, 190, 0.24), transparent 46%);
  animation: celebrationFlash 1.5s ease-out;
}

body.celebration-burst #celebrate-btn {
  animation: celebratePulse 0.65s cubic-bezier(0.2, 0.9, 0.2, 1) 2;
}

@keyframes celebrationFlash {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes celebratePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 8px 18px rgba(255, 214, 138, 0.28);
  }
  45% {
    transform: scale(1.08);
    box-shadow: 0 0 0 8px rgba(255, 221, 153, 0.18), 0 18px 35px rgba(255, 206, 115, 0.42);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 8px 18px rgba(255, 214, 138, 0);
  }
}

.gift-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
}

.gift-modal[hidden] {
  display: none !important;
}

.gift-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 20, 0.68);
}

.gift-modal-card {
  position: relative;
  z-index: 1;
  width: min(520px, 92vw);
  background: rgba(11, 20, 40, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 22px;
  padding: 1.15rem 1.15rem 1.25rem;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  animation: giftModalIn 0.42s ease;
}

@keyframes giftModalIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gift-modal-card h3 {
  margin: 0 0 0.75rem;
  font-family: "ZCOOL XiaoWei", serif;
  font-size: clamp(1.45rem, 4vw, 2rem);
  color: #ffe7b7;
  text-align: center;
}

.gift-modal-card img {
  width: 100%;
  max-height: 58vh;
  object-fit: cover;
  border-radius: 14px;
  border: 2px solid rgba(255, 237, 199, 0.55);
}

.gift-modal-card p {
  margin: 0.85rem 0 0;
  color: #dce7ff;
  line-height: 1.75;
  text-align: center;
}

.gift-close-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  font-size: 1.35rem;
  cursor: pointer;
}

.reveal {
  opacity: 0;
  transform: translateY(26px) scale(0.985);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.meteor {
  position: absolute;
  width: 170px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), transparent);
  transform: rotate(-28deg);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.9));
  opacity: 0;
  animation: meteor 6s linear infinite;
}

.meteor-1 {
  top: 20%;
  left: 10%;
  animation-delay: 0.4s;
}

.meteor-2 {
  top: 38%;
  right: 8%;
  animation-delay: 2.8s;
}

@keyframes meteor {
  0% {
    opacity: 0;
    transform: translateX(0) translateY(0) rotate(-28deg);
  }
  10% {
    opacity: 1;
  }
  45% {
    opacity: 0;
    transform: translateX(260px) translateY(180px) rotate(-28deg);
  }
  100% {
    opacity: 0;
  }
}

body.celebration-active .countdown {
  box-shadow: 0 0 0 2px rgba(255, 224, 176, 0.45), 0 0 48px rgba(255, 202, 120, 0.4);
}

@media (max-width: 768px) {
  .music-bar {
    left: 10px;
    right: 10px;
    top: 10px;
    border-radius: 16px;
    justify-content: space-between;
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  .music-label {
    width: 100%;
    font-size: 0.8rem;
  }

  .music-status {
    min-width: 0;
  }

  main {
    width: min(96vw, 620px);
    padding-top: 9vh;
  }

  .timer {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .meteor {
    width: 120px;
  }

  .cute-character {
    width: clamp(84px, 24vw, 128px);
  }

  .together-character {
    width: clamp(108px, 28vw, 176px);
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
