:root {
  color-scheme: dark;
  --pink: #ff79aa;
  --pink-soft: #ffc4da;
  --teal: #32c8b8;
  --black: #09070c;
  --surface: #fff9fc;
  --muted: #7d5a63;
  --shadow: rgba(15, 5, 15, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top left, rgba(255, 122, 162, 0.18), transparent 25%),
    linear-gradient(180deg, #09050a 0%, #120919 45%, #2b1323 100%);
  color: var(--surface);
  overflow-x: hidden;
  font-family: 'Comic Sans MS', 'Trebuchet MS', 'Segoe UI', sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.screen.hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.98);
}

.login-screen {
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 122, 162, 0.14), transparent 28%),
    linear-gradient(180deg, rgba(5, 2, 9, 1) 0%, rgba(15, 6, 17, 0.96) 100%);
}

.login-card {
  width: min(420px, 92vw);
  padding: clamp(1.5rem, 3vw, 2rem);
  border-radius: 32px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  text-align: center;
}

.login-hero {
  margin-bottom: 1.2rem;
}

.login-hero h1 {
  margin: 0.5rem 0 0.5rem;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.login-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
}

.sparkle-icon {
  display: inline-flex;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-form label {
  display: grid;
  gap: 0.45rem;
  text-align: left;
  color: rgba(255, 255, 255, 0.8);
}

.login-form input {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.login-form button {
  width: 100%;
  padding: 1rem 1.1rem;
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--pink), var(--teal));
  color: #100f14;
  font-weight: 700;
}

/* Lock icon and state styles for the login button */
.login-form button .lock-icon {
  margin-right: 0.6rem;
  font-size: 1.05rem;
  display: inline-block;
}

.login-form button.unlocked {
  background: linear-gradient(135deg, #8ef3c7, #5bd0a8);
  color: #05221a;
  box-shadow: 0 14px 40px rgba(45, 190, 150, 0.18);
}

.login-form button.locked {
  background: linear-gradient(135deg, #ffd6da, #ff9fb3);
  color: #3a0b12;
}

.login-form button .btn-text { vertical-align: middle; }

.login-status {
  min-height: 1.2rem;
  margin: 0;
  font-size: 0.95rem;
}

.login-status.success {
  color: #b8ffd8;
}

.login-status.error {
  color: #ffb1c0;
}

.transition-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.18), transparent 38%),
    rgba(9, 7, 12, 0.92);
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  transition: opacity 0.3s ease;
}

.transition-overlay.active {
  opacity: 1;
}

.cake-game-screen {
  overflow: hidden;
  display: block;
  padding: 0;
  background:
    radial-gradient(circle at 85% 20%, rgba(255, 197, 220, 0.18), transparent 28%),
    radial-gradient(circle at 18% 24%, rgba(132, 210, 255, 0.14), transparent 28%),
    linear-gradient(180deg, #2a2433 0%, #211a2a 56%, #2b1a24 56%, #261521 100%);
}

.game-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: clamp(0.8rem, 2vh, 1.2rem) 1rem 0.8rem;
}

.fireflies,
.fairy-lights,
.balloon-group,
.confetti-stream {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fireflies::before,
.fireflies::after {
  content: '';
  position: absolute;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 60%);
  filter: none;
  opacity: 0.85;
}

.fireflies::before {
  top: 8%;
  left: 12%;
}

.fireflies::after {
  bottom: 10%;
  right: 14%;
}

.fairy-lights::before,
.fairy-lights::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 3px;
  background: repeating-linear-gradient(90deg, #ffd56a 0 14px, #ff8fb4 14px 28px, #8fd4ff 28px 42px, #b4ff9f 42px 56px);
  top: 10%;
  left: 0;
  opacity: 0.85;
}

.fairy-lights::after {
  top: 16%;
}

.balloon-group::before,
.balloon-group::after {
  content: '';
  position: absolute;
  width: 86px;
  height: 116px;
  border-radius: 50% 50% 45% 45%;
  box-shadow: inset -8px -10px 0 rgba(0, 0, 0, 0.08);
}

.balloon-group::before {
  left: 4%;
  top: 14%;
  background: radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.6) 0 14%, transparent 16%), #ff7fae;
}

.balloon-group::after {
  right: 6%;
  top: 18%;
  background: radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.6) 0 14%, transparent 16%), #73c8ff;
}

.cake-stage {
  position: relative;
  width: min(680px, 90vw);
  max-width: 100%;
  padding: clamp(1.1rem, 3vw, 1.8rem);
  padding-top: clamp(2.9rem, 9vw, 3.7rem);
  border-radius: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cake-banner {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #3c1b26;
  font-weight: 700;
  font-size: clamp(0.85rem, 2.4vw, 1rem);
  white-space: nowrap;
  box-shadow: 0 12px 32px rgba(255, 122, 162, 0.18);
}

.celebration-stars {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.4) 2px, transparent 2px),
    radial-gradient(circle at 70% 18%, rgba(255, 255, 255, 0.25) 2px, transparent 2px),
    radial-gradient(circle at 40% 85%, rgba(255, 255, 255, 0.18) 2px, transparent 2px);
  opacity: 0.8;
}

.cake-plate {
  position: relative;
  width: min(350px, 74vw);
  aspect-ratio: 1 / 1.05;
  margin: 0 auto;
  display: grid;
  place-items: center;
  animation: cake-bounce 3.2s ease-in-out infinite;
  touch-action: none;
  user-select: none;
}

.cake-plate::after {
  content: '';
  position: absolute;
  inset: 12% 10% 10%;
  border-radius: 18px;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.75) 50%, transparent 60%);
}

.cake-plate.slash-hit::after {
  opacity: 1;
  animation: slash-flash 260ms ease-out;
}

/* Conventional two-tier frosted birthday cake */
.cake-tier {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 20px 40px rgba(0, 0, 0, 0.2);
}

.tier-bottom {
  bottom: 4%;
  width: 84%;
  height: 34%;
  background: linear-gradient(180deg, #e8b078 0%, #c8874f 100%);
}

.tier-top {
  bottom: 36%;
  width: 54%;
  height: 26%;
  background: linear-gradient(180deg, #f2c896 0%, #d99f66 100%);
}

/* Dollop of frosting capping each tier, with a dripping edge */
.frosting {
  position: absolute;
  top: -22%;
  left: -3%;
  right: -3%;
  height: 46%;
  background: linear-gradient(180deg, #ffffff 0%, #ffeaf3 100%);
  border-radius: 50% / 65%;
}

.frosting::after {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -12px;
  height: 16px;
  background-image: radial-gradient(circle at 12px 2px, #ffeaf3 8px, transparent 9px);
  background-size: 24px 16px;
  background-repeat: repeat-x;
}

/* Sprinkles scattered on the bottom tier */
.sprinkles {
  position: absolute;
  inset: 10% 6% 12%;
  background-image: radial-gradient(circle, #ff6fa5 3px, transparent 4px),
    radial-gradient(circle, #32c8b8 3px, transparent 4px), radial-gradient(circle, #ffd166 3px, transparent 4px),
    radial-gradient(circle, #7b6cf6 3px, transparent 4px), radial-gradient(circle, #ff6fa5 3px, transparent 4px),
    radial-gradient(circle, #ffd166 3px, transparent 4px);
  background-repeat: no-repeat;
  background-position: 12% 65%, 30% 25%, 48% 70%, 64% 20%, 80% 60%, 92% 30%;
}

.candles {
  position: absolute;
  top: -78%;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-evenly;
}

.candle {
  position: relative;
  width: 10px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffe7f4 0%, #ffd5e4 100%);
}

.flame {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 22px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle, #ffeaa2 0%, #ff9d6d 70%, #ff6f5c 100%);
  box-shadow: 0 0 18px rgba(255, 180, 110, 0.9);
}

.candle-flicker .flame {
  animation: flame-flicker 0.22s linear infinite;
}

/* Candles visually extinguish once blown out */
.candles-out .flame {
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* Cake slice element revealed after cutting */
.cake-slice {
  position: absolute;
  bottom: 4%;
  left: 62%;
  width: 20%;
  height: 30%;
  border-radius: 6px 22px 22px 6px;
  background: linear-gradient(180deg, #f2c896 0%, #d99f66 100%);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translate(0, 0) rotate(0deg);
  transition: opacity 0.3s ease, transform 0.5s ease;
  pointer-events: none;
}

.cake-slice.slice-up {
  opacity: 1;
  transform: translate(40%, -14%) rotate(12deg);
}

.party-table {
  position: relative;
  width: min(500px, 82vw);
  height: 74px;
  margin: -0.15rem auto 0;
}

.party-table::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 24px;
  border-radius: 16px;
  background: linear-gradient(180deg, #7f5943 0%, #6b4636 100%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.party-table::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  top: 24px;
  bottom: 0;
  border-radius: 0 0 14px 14px;
  background: repeating-linear-gradient(90deg, #6f4a37 0 26px, #734d39 26px 52px);
  opacity: 0.95;
}

.cake-stage::after {
  content: '';
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: -1px;
  height: 44%;
  border-radius: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0 2px,
    rgba(255, 255, 255, 0) 2px 22px
  );
  pointer-events: none;
}

.cake-stage.cake-sliced .cake-plate {
  animation: none;
}

.cake-stage.celebrate .cake-plate {
  animation: cake-bounce 0.6s ease-in-out infinite;
}

.game-panel {
  position: relative;
  left: auto;
  transform: none;
  bottom: auto;
  width: min(520px, 92vw);
  max-width: calc(100vw - 2rem);
  padding: 1.2rem 1.4rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  color: #3e2935;
  border: 1px solid rgba(255, 122, 162, 0.22);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.2);
  text-align: center;
  display: none;
  box-sizing: border-box;
  margin: 0 auto;
}

.game-panel.visible {
  display: block;
}

.game-panel p {
  margin: 0 0 1rem;
  font-size: 1rem;
}

.cut-meter {
  width: min(320px, 86vw);
  height: 12px;
  margin: 0.2rem auto 0.75rem;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 122, 162, 0.25);
}

.cut-meter-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ff7da6, #32c8b8);
  transition: width 220ms ease;
}

.cut-count {
  font-weight: 700;
  color: #714451;
  margin-bottom: 0.65rem;
}

.swipe-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 122, 162, 0.15);
  color: #5f3440;
  font-size: 0.9rem;
}

.slice-fallback-btn {
  margin-top: 0.8rem;
  border: 1px solid rgba(255, 122, 162, 0.35);
  background: rgba(255, 255, 255, 0.9);
  color: #5f3440;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font-weight: 700;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 1rem 1.3rem;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pink), var(--teal));
  color: #100f14;
  font-weight: 700;
  box-shadow: 0 12px 32px rgba(255, 122, 162, 0.22);
}

/* Keep legacy knife styles for compatibility if markup is restored later */
.knife-zone,
.knife,
.knife::before,
.knife.cutting {
  display: none;
}

.gift-box {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto 1rem;
}

.gift-base,
.gift-lid,
.gift-ribbon {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.gift-base {
  bottom: 0;
  width: 100%;
  height: 95px;
  border-radius: 24px 24px 18px 18px;
  background: linear-gradient(180deg, #ffbbd6 0%, #ffa1c6 100%);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.gift-lid {
  bottom: 82px;
  width: 120%;
  height: 40px;
  border-radius: 24px 24px 6px 6px;
  background: linear-gradient(180deg, #ffd2e6 0%, #f6a7cb 100%);
  transform-origin: center bottom;
}

.gift-ribbon {
  top: 22px;
  width: 30px;
  height: 110px;
  background: linear-gradient(180deg, #ff9dbe 0%, #ff5c97 100%);
  border-radius: 18px;
}

.gift-ribbon::before,
.gift-ribbon::after {
  content: '';
  position: absolute;
  top: 0;
  width: 60px;
  height: 20px;
  background: linear-gradient(135deg, #ff8ab3 0%, #ff4b8e 100%);
  border-radius: 16px;
}

.gift-ribbon::before {
  left: -16px;
  transform: rotate(20deg);
}

.gift-ribbon::after {
  right: -16px;
  transform: rotate(-20deg);
}

.scrapbook-screen {
  background: radial-gradient(circle at top left, rgba(255, 122, 162, 0.18), transparent 25%),
    radial-gradient(circle at bottom right, rgba(46, 196, 182, 0.14), transparent 22%),
    linear-gradient(180deg, #09050a 0%, #14081c 100%);
  overflow-y: auto;
}

.scrapbook-shell {
  width: min(1100px, 94vw);
  margin: 0 auto;
  padding: clamp(2rem, 3vw, 3rem) 1rem;
}

.intro {
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--pink-soft);
  letter-spacing: 0.3rem;
  text-transform: uppercase;
  font-size: 0.85rem;
}

h1 {
  margin: 0.6rem 0 0;
  font-size: clamp(2rem, 4vw, 3rem);
  color: var(--pink-soft);
}

.subtitle {
  margin: 0.8rem auto 0;
  max-width: 640px;
  color: rgba(255, 255, 255, 0.82);
}

.card-shell {
  position: relative;
  width: min(720px, 96vw);
  margin: 2rem auto 0;
  padding: 0.8rem;
}

.card {
  position: relative;
  width: 100%;
  min-height: 520px;
  transform-style: preserve-3d;
  transition: transform 0.9s ease;
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 32px;
  padding: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(255, 122, 162, 0.3);
  background: linear-gradient(135deg, #ffffff, #fdf3f9 70%, #ffeef5);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.24);
  backface-visibility: hidden;
}

.face-front {
  transform: rotateY(0deg);
}

.face-middle {
  transform: rotateY(120deg);
}

.face-back {
  transform: rotateY(240deg);
}

.message-panel {
  width: min(100%, 520px);
  text-align: center;
}

.heart-icon {
  font-size: 2.2rem;
  margin-bottom: 0.6rem;
}

.message-panel h2,
.message-grid h2 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  color: #ff5d8f;
}

.message-panel p {
  color: #603b48;
  line-height: 1.7;
}

.gift-bow {
  width: clamp(110px, 20vw, 140px);
  height: clamp(90px, 16vw, 120px);
  margin: 1.25rem auto 0;
  border: clamp(4px, 0.5vw, 6px) solid var(--pink-soft);
  border-radius: 50%;
  position: relative;
  transform: rotate(-6deg);
}

.carousel {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.carousel-window {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 2px solid rgba(255, 93, 143, 0.35);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45), 0 22px 60px rgba(0, 0, 0, 0.18);
}

.memory-track {
  display: flex;
  transition: transform 0.65s ease;
}

.memory-card {
  width: 100%;
  min-width: 100%;
  padding: clamp(1rem, 1.6vw, 1.2rem);
  box-sizing: border-box;
}

.photo-frame {
  width: 100%;
  height: auto;
  border-radius: 26px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.memory-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.2rem 0.2rem;
}

.carousel-btn {
  width: clamp(38px, 7vw, 44px);
  height: clamp(38px, 7vw, 44px);
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 93, 143, 0.7);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  color: #ff5d8f;
  font-size: 1.35rem;
}

.dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex: 1;
}

.dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 0 0 1px rgba(46, 196, 182, 0.16);
}

.dot.active {
  background: #ff5d8f;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
  transform: scale(1.25);
}

.message-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.portrait-window {
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px dashed rgba(255, 214, 231, 0.4);
}

.portrait {
  width: clamp(76px, 16vw, 96px);
  height: clamp(76px, 16vw, 96px);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255, 122, 162, 0.85), rgba(46, 196, 182, 0.7));
  font-size: clamp(1.8rem, 4vw, 2.2rem);
}

.controls {
  display: grid;
  gap: 0.9rem;
  justify-items: center;
  margin-top: 1rem;
}

.page-buttons {
  display: flex;
  gap: 0.85rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: 0.2rem 0.1rem;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Exit door (small, bottom-left) */
.exit-door {
  position: fixed;
  left: 12px;
  bottom: 12px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  z-index: 60;
  transition: transform 0.18s ease, background 0.18s ease;
}

.exit-door:hover {
  transform: translateY(-4px) scale(1.02);
  background: linear-gradient(135deg, rgba(255,122,162,0.14), rgba(46,196,182,0.12));
}

.exit-door::after {
  content: attr(title);
  position: absolute;
  left: 56px;
  bottom: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.78rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.exit-door:hover::after { opacity: 1; transform: translateY(0); }

.page-buttons button,
.heart-link {
  min-width: 120px;
  padding: 0.9rem 1rem;
  border-radius: 999px;
  font-weight: 700;
}

.heart-link {
  text-decoration: none;
  background: linear-gradient(135deg, var(--pink), var(--teal));
  color: #100f14;
  border: 2px dashed rgba(255, 255, 255, 0.45);
}

@media (max-width: 860px) {
  .cake-stage {
    width: 100%;
    padding: 1rem;
    padding-top: 2.8rem;
  }

  .game-panel {
    width: min(560px, 94vw);
    margin-top: 0.1rem;
  }
}

@media (max-width: 640px) {
  .cake-stage {
    padding: 0.85rem;
    padding-top: 2.5rem;
  }

  .cake-plate {
    width: min(300px, 76vw);
  }

  .knife {
    width: 150px;
  }

  .gift-box {
    width: 118px;
    height: 118px;
  }

  .game-panel {
    padding: 1rem;
    margin-top: 0.15rem;
  }
}

@keyframes cake-bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes flame-flicker {
  0% {
    transform: translateX(-50%) scaleY(1);
    opacity: 1;
  }
  50% {
    transform: translateX(-50%) scaleY(0.9);
    opacity: 0.88;
  }
  100% {
    transform: translateX(-50%) scaleY(1);
    opacity: 1;
  }
}

@keyframes slash-flash {
  from {
    transform: translateX(-12px);
    opacity: 0;
  }
  40% {
    opacity: 1;
  }
  to {
    transform: translateX(12px);
    opacity: 0;
  }
}

/* Dream page layout */
.dream-page {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at 20% 10%, rgba(255, 125, 170, 0.12), transparent 34%),
    linear-gradient(180deg, #1a0f1f 0%, #24122b 58%, #2f1730 100%);
  color: #fff9fd;
  overflow-x: hidden;
  overflow-y: auto;
}

.dream-container {
  width: min(1080px, 96vw);
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2rem) clamp(0.8rem, 2.2vw, 1.2rem) clamp(2.2rem, 8vh, 4rem);
}

.dream-card {
  width: min(980px, 100%);
  margin: 0 auto;
}

.typing-message {
  margin: 0.4rem 0 1.1rem;
  max-width: 900px;
  color: rgba(255, 238, 247, 0.92);
  font-size: clamp(1rem, 2.25vw, 1.25rem);
  line-height: 1.5;
}

.dream-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dream-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(1rem, 2.4vw, 1.4rem);
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 240, 247, 0.96));
  border: 1px solid rgba(255, 126, 173, 0.22);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.22);
  color: #5b3a4a;
  min-height: 170px;
}

.dream-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(255, 123, 164, 0.14), transparent 35%);
  pointer-events: none;
}

.dream-panel h2 {
  position: relative;
  margin: 0 0 0.5rem;
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: #ff5d8f;
}

.dream-panel p {
  position: relative;
  margin: 0;
  color: #5f4452;
  font-size: clamp(1rem, 2.35vw, 1.25rem);
  line-height: 1.55;
}

.dream-card-item {
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.dream-card-item.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.dream-card-item.visible::after {
  content: '';
  position: absolute;
  inset: auto 1rem 0.75rem auto;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: #ff6fa5;
  box-shadow: 0 0 0 6px rgba(255, 111, 165, 0.12);
}

.dream-footer {
  margin-top: 1.1rem;
  padding-bottom: 0.65rem;
}

.dream-footer p {
  margin: 0 0 0.65rem;
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  line-height: 1.5;
  color: rgba(255, 243, 250, 0.98);
}

.dream-page .heart-link {
  display: inline-flex;
}

.dream-card .fade-in {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.dream-card .fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.dream-confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 110;
}

.dream-confetti-piece {
  position: fixed;
  width: 7px;
  height: 12px;
  border-radius: 3px;
  pointer-events: none;
  animation: dream-confetti-fall 760ms ease-out forwards;
}

@keyframes dream-confetti-fall {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}

@media (max-width: 760px) {
  .dream-grid {
    grid-template-columns: 1fr;
  }
}
