:root {
  --bg-top: #22173d;
  --bg-mid: #432a65;
  --bg-bottom: #f39f88;
  --card-bg: rgba(255, 246, 240, 0.14);
  --card-border: rgba(255, 255, 255, 0.32);
  --text-main: #fff7f2;
  --text-soft: rgba(255, 247, 242, 0.78);
  --accent: #ffd671;
  --accent-strong: #ff8f70;
  --shadow: rgba(39, 14, 57, 0.36);
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  font-family: "STSong", "Noto Serif SC", "Microsoft YaHei", serif;
  color: var(--text-main);
  touch-action: manipulation;
  background:
    radial-gradient(circle at top left, rgba(255, 191, 131, 0.24), transparent 28%),
    radial-gradient(circle at 85% 20%, rgba(255, 130, 144, 0.22), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 48%, var(--bg-bottom) 100%);
}

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

.ambient {
  position: absolute;
  inset: auto;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.5;
  pointer-events: none;
  animation: drift 10s ease-in-out infinite alternate;
}

.ambient-left {
  width: 24rem;
  height: 24rem;
  left: -6rem;
  top: 4rem;
  background: rgba(255, 191, 131, 0.26);
}

.ambient-right {
  width: 20rem;
  height: 20rem;
  right: -4rem;
  bottom: 6rem;
  background: rgba(255, 147, 188, 0.24);
  animation-duration: 12s;
}

.panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s ease, visibility 0.8s ease;
  overflow: hidden;
}

.panel.active {
  opacity: 1;
  visibility: visible;
}

.glass-card {
  width: min(88vw, 23rem);
  padding: 1.7rem 1.15rem 1.45rem;
  border-radius: 1.6rem;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(16px);
  box-shadow: 0 1.5rem 4rem var(--shadow);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top center, rgba(255, 227, 185, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 58%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 0.75rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 241, 220, 0.76);
  font-size: 0.75rem;
}

h1,
h2 {
  margin: 0;
  font-family: "YouYuan", "STXingkai", "KaiTi", cursive;
  font-weight: 400;
}

h1 {
  font-size: clamp(2rem, 8.2vw, 2.9rem);
  line-height: 1.08;
}

h2 {
  font-size: clamp(2.3rem, 6vw, 4.2rem);
}

.hint,
.subcopy,
.cake-tip {
  color: var(--text-soft);
}

.hint {
  margin: 0.85rem 0 1rem;
}

.password-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  padding: 1rem 1.1rem;
  font-size: 1rem;
  outline: none;
  background: rgba(255, 255, 255, 0.18);
  color: var(--text-main);
}

.password-input::placeholder {
  color: rgba(255, 247, 242, 0.52);
}

.primary-btn,
.next-btn {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  color: #4b1b34;
  font-family: "YouYuan", "STXingkai", "KaiTi", cursive;
  box-shadow: 0 0.9rem 2rem rgba(75, 27, 52, 0.26);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.5s ease;
}

.primary-btn:hover,
.next-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 1.1rem 2.2rem rgba(75, 27, 52, 0.34);
}

.primary-btn {
  width: 100%;
  margin-top: 0.95rem;
  padding: 1rem 1.2rem;
  font-size: 1.16rem;
  background: linear-gradient(135deg, #ffe39f 0%, #ffb189 100%);
}

.gate-message {
  min-height: 1.5rem;
  margin-top: 0.8rem;
  color: #ffe7bd;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.blessing-panel {
  align-items: start;
  background:
    linear-gradient(180deg, rgba(34, 23, 61, 0.16) 0%, rgba(34, 23, 61, 0.2) 100%);
}

.hero-copy {
  position: absolute;
  top: clamp(1.35rem, 5vw, 2.2rem);
  left: 50%;
  width: min(88vw, 22rem);
  transform: translateX(-50%);
  text-align: center;
}

.subcopy {
  margin-top: 0.6rem;
  font-size: 0.96rem;
}

.blessing-stream {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.blessing-line {
  position: absolute;
  left: -110%;
  width: min(84vw, 22rem);
  padding: 0;
  border-radius: 0;
  font-size: clamp(0.98rem, 3.8vw, 1.1rem);
  line-height: 1.62;
  color: #fff8f5;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
  will-change: transform, opacity;
  animation: glideAcross linear forwards, bobbing 1.6s ease-in-out infinite;
}

.blessing-fill {
  display: inline-block;
  background-size: 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbowPulse 2.2s linear infinite;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.3));
}

.blessing-line.exit {
  animation: driftAway 1.2s ease forwards;
}

.next-btn {
  position: absolute;
  right: 1rem;
  bottom: 1.2rem;
  padding: 0.88rem 1.2rem;
  font-size: 1rem;
  background: linear-gradient(135deg, #fff2b6 0%, #ffb0a5 100%);
}

.next-btn.hide {
  opacity: 0;
  pointer-events: none;
}

.cake-panel {
  background:
    radial-gradient(circle at 50% 82%, rgba(255, 223, 175, 0.1), transparent 28%),
    radial-gradient(circle at 50% 18%, rgba(255, 108, 154, 0.1), transparent 20%),
    linear-gradient(180deg, rgba(20, 17, 45, 0.55) 0%, rgba(31, 18, 52, 0.76) 100%);
}

.three-container {
  position: absolute;
  inset: 0;
  touch-action: manipulation;
}

.cake-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wish-text {
  position: absolute;
  top: 1.25rem;
  left: 50%;
  transform: translate(-50%, 1rem);
  width: min(84vw, 18rem);
  padding: 0.78rem 0.95rem;
  border-radius: 1.1rem;
  background: rgba(255, 240, 214, 0.12);
  border: 1px solid rgba(255, 227, 173, 0.18);
  font-family: "YouYuan", "STXingkai", "KaiTi", cursive;
  text-align: center;
  font-size: clamp(1.35rem, 5vw, 1.8rem);
  color: #fff6cf;
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease;
}

.wish-text.show {
  opacity: 1;
  transform: translate(-50%, 0);
  box-shadow: 0 0 2rem rgba(255, 211, 125, 0.22);
}

.cake-tip {
  position: absolute;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  margin: 0;
  text-align: center;
  width: min(86vw, 20rem);
  font-size: 0.93rem;
  line-height: 1.55;
}

@keyframes glideAcross {
  0% {
    transform: translateX(0) translateY(0) scale(0.96);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  50% {
    transform: translateX(60vw) translateY(-0.3rem) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateX(135vw) translateY(-0.6rem) scale(1.04);
    opacity: 0;
  }
}

@keyframes driftAway {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(45vw) translateY(-6rem) rotate(-8deg) scale(0.9);
  }
}

@keyframes bobbing {
  0% {
    margin-top: 0;
  }
  50% {
    margin-top: -0.35rem;
  }
  100% {
    margin-top: 0.15rem;
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(2rem, -1rem, 0) scale(1.08);
  }
}

@keyframes rainbowPulse {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

@media (min-width: 768px) {
  .glass-card {
    width: min(90vw, 30rem);
    padding: 2rem 1.5rem;
    border-radius: 1.8rem;
  }

  .hero-copy {
    top: 2.4rem;
    width: min(90vw, 40rem);
  }

  .blessing-line {
    width: min(72vw, 36rem);
    font-size: 1.15rem;
    line-height: 1.5;
  }

  .next-btn {
    right: clamp(1.25rem, 3vw, 2.4rem);
    bottom: clamp(1.25rem, 3vw, 2rem);
    padding: 0.9rem 1.5rem;
    font-size: 1.1rem;
  }

  .wish-text {
    top: 2rem;
    width: auto;
    padding: 0.9rem 1.5rem;
    border-radius: 999px;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .cake-tip {
    bottom: 1.4rem;
    width: min(92vw, 28rem);
    font-size: 1rem;
    line-height: 1.5;
  }
}

@media (max-width: 640px) {
  body {
    overflow: hidden;
  }

  .ambient-left {
    width: 18rem;
    height: 18rem;
    left: -5rem;
    top: 2rem;
  }

  .ambient-right {
    width: 14rem;
    height: 14rem;
    right: -3rem;
    bottom: 5rem;
  }

  .panel {
    padding: 1rem;
  }

  .glass-card {
    width: min(88vw, 22rem);
    min-height: 22rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .blessing-line {
    width: min(82vw, 21rem);
  }

  .hero-copy {
    top: 1.3rem;
    width: min(86vw, 20rem);
  }

  .hero-copy h2 {
    line-height: 1.08;
  }

  .subcopy {
    font-size: 0.95rem;
  }

  .next-btn {
    right: 0.9rem;
    bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px));
  }

  .wish-text {
    width: min(84vw, 17rem);
  }

  .cake-tip {
    bottom: calc(0.9rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 420px) {
  .glass-card {
    width: min(90vw, 20rem);
    min-height: 21rem;
    padding: 1.45rem 0.95rem;
  }

  h1 {
    font-size: 1.72rem;
  }

  h2 {
    font-size: 2rem;
  }

  .eyebrow {
    font-size: 0.68rem;
    letter-spacing: 0.18em;
  }

  .hint,
  .subcopy,
  .cake-tip,
  .gate-message {
    font-size: 0.9rem;
  }

  .password-input,
  .primary-btn {
    font-size: 0.98rem;
  }

  .password-input {
    padding: 0.88rem 1rem;
  }

  .primary-btn {
    padding: 0.88rem 1.1rem;
  }

  .blessing-line {
    width: min(84vw, 18.6rem);
    font-size: 0.94rem;
  }

  .wish-text {
    top: 1rem;
    font-size: 1.35rem;
  }

  .next-btn {
    min-width: 6.2rem;
  }
}
