:root {
  --bg: #26120f;
  --cream: #fff3de;
  --rose: #ff8ea5;
  --rose-deep: #c65765;
  --coral: #ff725f;
  --gold: #ffd28a;
  --glass: rgba(70, 31, 25, 0.44);
  --line: rgba(255, 229, 202, 0.42);
  --shadow: 0 24px 80px rgba(21, 7, 5, 0.46);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow-x: hidden;
  color: var(--cream);
  background: var(--bg);
}

button {
  font: inherit;
}

.birthday-app {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 50% 58%, rgba(255, 151, 132, 0.32), transparent 34rem),
    linear-gradient(180deg, rgba(44, 18, 14, 0.18), rgba(22, 8, 7, 0.92)),
    url("./assets/birthday-concept.png") center / cover no-repeat;
}

.birthday-app::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(28, 10, 8, 0.38);
  backdrop-filter: blur(4px) saturate(1.08);
}

.ambient {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 18%, rgba(255, 126, 132, 0.25), transparent 14rem),
    radial-gradient(circle at 90% 12%, rgba(255, 197, 116, 0.22), transparent 12rem),
    linear-gradient(90deg, rgba(24, 6, 5, 0.5), transparent 35%, transparent 65%, rgba(24, 6, 5, 0.38));
}

.petals,
.petals::before,
.petals::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 151, 161, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(255, 212, 132, 0.85) 0 1.5px, transparent 2.5px);
  background-size: 8rem 7rem, 11rem 9rem;
  animation: floatPetals 16s linear infinite;
}

.petals::before,
.petals::after {
  content: "";
  opacity: 0.7;
}

.petals::before {
  transform: translateY(-30%);
  animation-duration: 22s;
}

.petals::after {
  transform: translateY(-50%);
  animation-duration: 28s;
}

.topbar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(1rem, 2vw, 1.8rem);
}

.glass-button {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.7rem;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(45, 17, 14, 0.42);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(14px);
  cursor: pointer;
}

.heart-button .icon {
  color: #ff91a7;
}

.hero {
  position: relative;
  z-index: 2;
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto auto;
  align-items: center;
  padding: clamp(3.2rem, 5.2vh, 4.1rem) clamp(1rem, 4vw, 4rem) 0.85rem;
}

.title-wrap {
  margin: -0.5rem auto 0;
  text-align: center;
  text-shadow: 0 8px 30px rgba(49, 15, 10, 0.9);
}

.heart-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #ffe8c8;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

.heart-line span {
  width: min(13vw, 8rem);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 225, 191, 0.68), transparent);
}

h1 {
  margin: 0.2rem 0 0;
  font-family: "STSong", "SimSun", "Microsoft YaHei", serif;
  font-size: clamp(2.7rem, 6.5vw, 5.65rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: 0;
  color: #ffe7c5;
}

h1 span {
  display: inline;
}

.title-wrap p {
  margin: 0.55rem 0 0;
  font-size: clamp(0.98rem, 1.7vw, 1.38rem);
  font-weight: 500;
  color: rgba(255, 238, 214, 0.92);
}

.stage {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(15rem, 20rem);
  gap: clamp(0.8rem, 3vw, 2.5rem);
  width: min(62rem, 100%);
  margin: 0 auto;
  align-items: end;
}

.cake-scene {
  position: relative;
  min-height: clamp(13.5rem, 27vw, 21rem);
  display: grid;
  align-items: end;
  filter: drop-shadow(0 2rem 2rem rgba(22, 7, 5, 0.45));
}

.candle-row {
  position: absolute;
  left: 50%;
  bottom: clamp(8.2rem, 13.6vw, 12.2rem);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(0.28rem, 0.84vw, 0.6rem);
  width: min(90%, 37rem);
  transform: translateX(-50%);
  z-index: 3;
}

.candle {
  position: relative;
  width: clamp(0.42rem, 0.8vw, 0.62rem);
  height: clamp(3.8rem, 7.2vw, 5.8rem);
  border-radius: 999px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 120, 119, 0.62) 0 5px, rgba(255, 237, 218, 0.95) 5px 10px),
    #ffe9d6;
  box-shadow: inset -2px 0 0 rgba(142, 56, 52, 0.2);
}

.candle:nth-child(3n) {
  height: clamp(3.5rem, 6.8vw, 5.2rem);
}

.candle:nth-child(4n) {
  height: clamp(4rem, 7.6vw, 6rem);
}

.flame {
  position: absolute;
  left: 50%;
  top: -1.45rem;
  width: 1rem;
  height: 1.55rem;
  border-radius: 50% 50% 48% 48%;
  background: radial-gradient(circle at 52% 68%, #fff7c7 0 18%, #ffd66f 33%, #ff813d 66%, transparent 72%);
  box-shadow: 0 0 0.9rem #ffd37b, 0 0 1.8rem rgba(255, 129, 61, 0.9);
  transform: translateX(-50%) rotate(3deg);
  transform-origin: 50% 90%;
  animation: flicker 0.15s infinite alternate;
}

.candle.out .flame {
  opacity: 0;
  transform: translateX(-50%) translateY(0.3rem) scale(0.2);
  transition: 0.5s ease;
}

.smoke {
  position: absolute;
  left: 50%;
  top: -2.3rem;
  width: 0.35rem;
  height: 1.8rem;
  border-radius: 999px;
  opacity: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent);
  filter: blur(2px);
  transform: translateX(-50%);
}

.candle.out .smoke {
  animation: smoke 1.4s ease-out forwards;
}

.cake {
  position: relative;
  width: min(100%, 42rem);
  height: clamp(9.5rem, 17vw, 13.5rem);
  margin: 0 auto;
}

.cake-top {
  position: absolute;
  left: 50%;
  top: 0;
  width: 88%;
  height: 45%;
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 48% 48%, rgba(255, 247, 229, 0.98) 0 39%, rgba(255, 210, 201, 0.96) 40% 64%, rgba(229, 120, 126, 0.9) 65% 100%);
  box-shadow: inset 0 -0.45rem 0 rgba(197, 77, 86, 0.18), 0 0.8rem 2.3rem rgba(255, 149, 128, 0.35);
  z-index: 2;
}

.cake-side {
  position: absolute;
  left: 50%;
  top: 22%;
  width: 88%;
  height: 57%;
  border-radius: 0 0 3rem 3rem / 0 0 2rem 2rem;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 18% 62%, rgba(231, 92, 108, 0.28) 0 0.45rem, transparent 0.5rem),
    radial-gradient(circle at 76% 55%, rgba(244, 123, 136, 0.24) 0 0.5rem, transparent 0.55rem),
    linear-gradient(180deg, #fff0e3 0%, #ffd9cf 56%, #f5b3ad 100%);
  box-shadow: var(--shadow), inset 0 -0.7rem 1rem rgba(190, 74, 84, 0.15);
  overflow: hidden;
  z-index: 1;
}

.plate {
  position: absolute;
  left: 50%;
  bottom: 0.1rem;
  width: 98%;
  height: 27%;
  border-radius: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 230, 196, 0.96), rgba(156, 76, 58, 0.9));
  box-shadow: 0 1.1rem 2rem rgba(26, 7, 5, 0.52);
}

.age-number {
  position: absolute;
  left: 50%;
  top: 42%;
  color: #a65a22;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.2rem, 8vw, 6.5rem);
  line-height: 1;
  text-shadow: 0 2px 0 #ffe0a5, 0 0 1.1rem rgba(255, 197, 106, 0.45);
  transform: translate(-50%, -50%);
}

.rose {
  position: absolute;
  width: clamp(2.1rem, 4vw, 3.4rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 48% 54%, #f7b1a6 0 14%, #db6771 15% 29%, transparent 30%),
    conic-gradient(from 20deg, #fdd0c4, #d45262, #ffd7cd, #b84554, #fdd0c4);
  box-shadow: 0 0.2rem 0.8rem rgba(137, 31, 40, 0.26);
}

.rose-a { left: 10%; top: 35%; }
.rose-b { left: 24%; top: 18%; transform: scale(0.8); }
.rose-c { right: 18%; top: 26%; }
.rose-d { right: 7%; top: 42%; transform: scale(0.82); }
.rose-e { left: 67%; top: 55%; transform: scale(0.66); }

.icing {
  position: absolute;
  bottom: -0.1rem;
  width: 5rem;
  height: 2rem;
  border-radius: 3rem 3rem 0 0;
  background: linear-gradient(180deg, #f3899b, #d8586d);
}

.icing-a { left: 10%; }
.icing-b { left: 42%; }
.icing-c { right: 12%; }

.sprinkle {
  position: absolute;
  width: 0.35rem;
  height: 0.75rem;
  border-radius: 999px;
  background: #d9576b;
}

.s1 { left: 16%; top: 45%; transform: rotate(-24deg); }
.s2 { left: 36%; top: 64%; transform: rotate(18deg); background: #efb65e; }
.s3 { left: 55%; top: 46%; transform: rotate(35deg); }
.s4 { right: 28%; top: 65%; transform: rotate(-12deg); background: #efb65e; }
.s5 { right: 11%; top: 43%; transform: rotate(24deg); }

.wish-card {
  align-self: center;
  min-height: 13.2rem;
  padding: 1.2rem 1.45rem;
  border: 1px solid rgba(255, 220, 200, 0.46);
  border-radius: 1.2rem;
  color: #ffe8d3;
  background: rgba(52, 18, 15, 0.48);
  box-shadow: 0 1rem 3rem rgba(31, 8, 5, 0.25);
  backdrop-filter: blur(16px);
}

.wish-card h2 {
  margin: 0 0 0.7rem;
  font-size: 1.35rem;
  color: #ffb3c0;
}

.wish-card p {
  margin: 0;
  line-height: 1.8;
}

.divider {
  margin: 0.85rem 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 220, 190, 0.68), transparent);
}

.wish-text {
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  color: #ffb8c4;
}

.wish-card.complete {
  border-color: rgba(255, 216, 132, 0.82);
  box-shadow: 0 0 2.2rem rgba(255, 160, 122, 0.32);
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(0.9rem, 4vw, 4rem);
  margin: 0.15rem auto 0;
}

.secondary-control,
.mic-control {
  border: 1px solid rgba(255, 228, 213, 0.52);
  color: var(--cream);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.secondary-control {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.62rem;
  min-width: 10rem;
  min-height: 2.85rem;
  padding: 0 1.3rem;
  border-radius: 999px;
  background: rgba(90, 32, 27, 0.58);
  backdrop-filter: blur(12px);
}

.mic-control {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(4.8rem, 7.5vw, 6.1rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffd1d1, #ff6f91 64%, #d84d64);
  box-shadow: 0 0 0 0.7rem rgba(255, 128, 151, 0.17), 0 0.9rem 2rem rgba(111, 21, 35, 0.38);
}

.mic-control::before {
  content: "";
  position: absolute;
  inset: -1.7rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 198, 200, 0.28);
  animation: pulse 2.4s ease-out infinite;
}

.mic-icon {
  position: relative;
  width: 1.25rem;
  height: 2.15rem;
  border: 0.36rem solid #fff;
  border-top-width: 0.45rem;
  border-radius: 999px;
}

.mic-icon::before,
.mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
}

.mic-icon::before {
  bottom: -1rem;
  width: 0.34rem;
  height: 1rem;
}

.mic-icon::after {
  bottom: -1.08rem;
  width: 1.55rem;
  height: 0.32rem;
  border-radius: 999px;
}

.secondary-control:hover,
.mic-control:hover,
.secondary-control.active,
.mic-control.active {
  transform: translateY(-2px);
  box-shadow: 0 1rem 2rem rgba(61, 12, 9, 0.32), 0 0 1.6rem rgba(255, 127, 145, 0.26);
}

.hint {
  min-height: 1.5rem;
  margin: 0.5rem auto 0;
  text-align: center;
  color: rgba(255, 236, 216, 0.88);
}

.progress {
  width: min(23rem, 72vw);
  height: 0.34rem;
  margin: 0.45rem auto 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 235, 221, 0.24);
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffd58c, #ff7c96);
  transition: width 0.18s ease;
}

.sparkle {
  position: fixed;
  z-index: 4;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #ffd985;
  pointer-events: none;
  animation: pop 1.3s ease-out forwards;
}

@keyframes flicker {
  from { transform: translateX(-50%) rotate(-4deg) scaleY(0.94); }
  to { transform: translateX(-50%) rotate(5deg) scaleY(1.08); }
}

@keyframes smoke {
  0% { opacity: 0; transform: translateX(-50%) translateY(0) scale(0.8); }
  22% { opacity: 0.72; }
  100% { opacity: 0; transform: translateX(-34%) translateY(-2.5rem) scale(1.6); }
}

@keyframes pulse {
  from { transform: scale(0.72); opacity: 0.82; }
  to { transform: scale(1.15); opacity: 0; }
}

@keyframes pop {
  0% { transform: translateY(0) scale(0.9); opacity: 0; }
  18% { opacity: 1; }
  100% { transform: translateY(-7rem) scale(0.1); opacity: 0; }
}

@keyframes floatPetals {
  from { background-position: 0 -12rem, 4rem -8rem; }
  to { background-position: 7rem 48rem, -4rem 42rem; }
}

@media (max-width: 820px) {
  .birthday-app {
    min-height: 100svh;
    background-position: center;
  }

  .topbar {
    padding: 0.85rem;
  }

  .glass-button {
    min-height: 2.35rem;
    padding: 0 0.75rem;
    font-size: 0.86rem;
  }

  .heart-button {
    min-width: 2.35rem;
    justify-content: center;
  }

  .heart-button span:last-child {
    display: none;
  }

  .hero {
    min-height: 100svh;
    padding: 4.1rem 0.9rem 1rem;
  }

  .title-wrap {
    margin-top: 0;
  }

  h1 {
    font-size: clamp(2.55rem, 12vw, 3.6rem);
  }

  h1 span {
    display: block;
  }

  .title-wrap p {
    width: min(25rem, 92vw);
    margin-inline: auto;
  }

  .stage {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .cake-scene {
    min-height: 20rem;
  }

  .wish-card {
    width: min(100%, 25rem);
    min-height: 0;
    margin: 0 auto;
    padding: 1rem 1.1rem;
    text-align: center;
  }

  .wish-card h2 {
    margin-bottom: 0.4rem;
    font-size: 1.05rem;
  }

  .divider {
    margin: 0.6rem 0;
  }

  .wish-text {
    font-size: 1.05rem;
  }

  .controls {
    gap: 0.8rem;
    margin-top: 0.6rem;
  }

  .secondary-control {
    min-width: 5.7rem;
    min-height: 2.75rem;
    padding: 0 0.7rem;
    font-size: 0.9rem;
  }
}

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