:root {
  --ink: #fffaf0;
  --muted: #d8d5c6;
  --panel: rgba(15, 28, 39, 0.72);
  --panel-strong: rgba(12, 23, 34, 0.9);
  --gold: #ffd36a;
  --rose: #ff8a9d;
  --pig: #ffb2c2;
  --pig-dark: #e76f8a;
  --mint: #8ce6cf;
  --blue: #86b7ff;
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #09111a;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, "Noto Serif TC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 138, 157, 0.18), transparent 28rem),
    radial-gradient(circle at 80% 10%, rgba(134, 183, 255, 0.2), transparent 30rem),
    linear-gradient(145deg, #09111a 0%, #16242a 45%, #241928 100%);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.hero {
  min-height: calc(100vh - 68px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 430px);
  align-items: center;
  gap: clamp(28px, 6vw, 78px);
}

.eyebrow,
.section-label {
  margin: 0 0 12px;
  color: var(--mint);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  font-size: clamp(3rem, 9vw, 7.6rem);
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.75rem, 3vw, 3rem);
}

.intro,
.orbit-copy p,
.sealed-card {
  color: var(--muted);
  line-height: 1.8;
}

.intro {
  max-width: 620px;
  margin: 24px 0 0;
  font-size: clamp(1rem, 2vw, 1.22rem);
}

.cake-stage {
  display: grid;
  place-items: center;
  gap: 14px;
}

.cake {
  position: relative;
  width: min(78vw, 340px);
  height: 370px;
  display: grid;
  justify-items: center;
  align-content: end;
  filter: drop-shadow(0 34px 38px var(--shadow));
}

.cake-pig {
  position: absolute;
  top: 120px;
  right: 22px;
  z-index: 2;
  width: 86px;
  height: 78px;
  transform: rotate(7deg);
  animation: pigPeek 2.4s ease-in-out infinite;
}

.pig-face {
  position: absolute;
  inset: 16px 4px 0;
  border-radius: 50% 50% 46% 46%;
  background: linear-gradient(145deg, #ffd0dc, var(--pig));
  box-shadow: inset 0 -9px 0 rgba(231, 111, 138, 0.16), 0 12px 22px rgba(0, 0, 0, 0.16);
}

.pig-ear {
  position: absolute;
  top: 5px;
  width: 28px;
  height: 32px;
  border-radius: 68% 32% 60% 40%;
  background: var(--pig-dark);
}

.pig-ear-left {
  left: 8px;
  transform: rotate(-26deg);
}

.pig-ear-right {
  right: 8px;
  transform: rotate(26deg) scaleX(-1);
}

.pig-eye {
  position: absolute;
  top: 22px;
  width: 7px;
  height: 9px;
  border-radius: 50%;
  background: #2d1d24;
}

.pig-eye-left { left: 22px; }
.pig-eye-right { right: 22px; }

.pig-snout {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 34px;
  height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 999px;
  background: #ff8fa6;
  transform: translateX(-50%);
}

.pig-snout span {
  width: 5px;
  height: 9px;
  border-radius: 999px;
  background: #8e3a50;
}

.candle {
  position: absolute;
  top: 26px;
  width: 42px;
  height: 130px;
  border: 0;
  border-radius: 14px 14px 7px 7px;
  background: repeating-linear-gradient(135deg, #fff8d9 0 13px, #ff8a9d 13px 25px);
  cursor: pointer;
}

.candle:focus-visible,
.star:focus-visible,
.primary-action:focus-visible,
.pig-action:focus-visible,
.secondary-action:focus-visible,
input:focus,
textarea:focus {
  outline: 3px solid var(--mint);
  outline-offset: 4px;
}

.wick {
  position: absolute;
  top: -11px;
  left: 18px;
  width: 6px;
  height: 18px;
  border-radius: 999px;
  background: #30251c;
}

.flame {
  position: absolute;
  top: -58px;
  left: 4px;
  width: 34px;
  height: 54px;
  border-radius: 50% 50% 45% 45%;
  background: radial-gradient(circle at 48% 62%, #fff6af 0 25%, #ffd36a 26% 54%, #ff8a3d 55% 100%);
  transform-origin: 50% 100%;
  animation: flame 1.15s ease-in-out infinite alternate;
  opacity: 0.45;
  box-shadow: 0 0 32px rgba(255, 211, 106, 0.5);
}

body.lit .flame {
  opacity: 1;
}

.icing {
  width: 255px;
  height: 72px;
  border-radius: 50% 50% 18px 18px;
  background: linear-gradient(180deg, #fff2c7, #ffd36a);
}

.cake-body {
  width: 310px;
  height: 150px;
  display: flex;
  justify-content: space-around;
  padding-top: 24px;
  border-radius: 28px 28px 46px 46px;
  background: linear-gradient(135deg, #d95f7b, #7245a4 48%, #244f7f);
}

.cake-body span {
  width: 16px;
  height: 92px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.36);
}

.plate {
  width: 338px;
  height: 36px;
  margin-top: -2px;
  border-radius: 50%;
  background: linear-gradient(90deg, #d9f7ef, #86b7ff);
}

.primary-action,
.secondary-action,
.pig-action {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  color: #14202a;
  font-weight: 800;
  background: linear-gradient(90deg, var(--gold), var(--mint));
  cursor: pointer;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.24);
}

.pig-action {
  min-height: 42px;
  padding: 0 18px;
  color: var(--ink);
  background: rgba(255, 178, 194, 0.18);
  border: 1px solid rgba(255, 178, 194, 0.42);
  box-shadow: none;
}

.orbit-panel,
.wish-panel {
  margin-top: 28px;
  padding: clamp(22px, 4vw, 38px);
  border: 1px solid rgba(255, 250, 240, 0.16);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.orbit-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(300px, 1.1fr);
  gap: clamp(26px, 5vw, 58px);
  align-items: center;
}

.orbit-panel.video-unlocked {
  border-color: rgba(255, 178, 194, 0.46);
  box-shadow: 0 0 42px rgba(255, 178, 194, 0.14);
}

#messageText {
  min-height: 104px;
  margin: 18px 0 0;
  font-size: 1.08rem;
}

.constellation {
  position: relative;
  min-height: 360px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 211, 106, 0.16), transparent 35%),
    rgba(255, 250, 240, 0.035);
  overflow: hidden;
}

.constellation.video-unlocked {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 178, 194, 0.24), transparent 35%),
    radial-gradient(circle at 82% 68%, rgba(140, 230, 207, 0.12), transparent 18rem),
    rgba(255, 250, 240, 0.045);
}

.star {
  position: absolute;
  z-index: 2;
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 50%;
  background: #fff7b0;
  box-shadow: 0 0 18px #ffd36a, 0 0 42px rgba(255, 211, 106, 0.46);
  cursor: pointer;
  transform: translate(-50%, -50%) scale(0.82);
  transition: transform 180ms ease, background 180ms ease;
}

body.lit .star {
  animation: pulse 1.8s ease-in-out infinite alternate;
}

.star:hover {
  transform: translate(-50%, -50%) scale(1.22);
  background: #ffffff;
}

.star.found {
  background: var(--pig);
  box-shadow: 0 0 18px var(--pig), 0 0 58px rgba(255, 178, 194, 0.72);
}

.star-1 { left: 19%; top: 62%; }
.star-2 { left: 34%; top: 28%; animation-delay: 120ms; }
.star-3 { left: 52%; top: 47%; animation-delay: 260ms; }
.star-4 { left: 71%; top: 22%; animation-delay: 360ms; }
.star-5 { left: 82%; top: 68%; animation-delay: 520ms; }

.line {
  position: absolute;
  pointer-events: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 250, 240, 0.58), transparent);
  transform-origin: left center;
  opacity: 0.18;
}

body.lit .line {
  opacity: 0.8;
}

.line-a { left: 20%; top: 58%; width: 150px; transform: rotate(-58deg); }
.line-b { left: 36%; top: 30%; width: 126px; transform: rotate(27deg); }
.line-c { left: 54%; top: 45%; width: 142px; transform: rotate(-35deg); }
.line-d { left: 72%; top: 25%; width: 172px; transform: rotate(65deg); }

.star-progress {
  position: absolute;
  left: 18px;
  bottom: 16px;
  z-index: 3;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(12, 23, 34, 0.82);
  border: 1px solid rgba(255, 178, 194, 0.38);
  font-size: 0.86rem;
  font-weight: 800;
}

.unlocked-video-card[hidden] {
  display: none;
}

.unlocked-video-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  margin-top: -28px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 178, 194, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 178, 194, 0.16), rgba(255, 211, 106, 0.09)),
    rgba(12, 23, 34, 0.82);
}

.unlocked-video-card h3 {
  margin: 0;
  font-family: "Noto Serif TC", serif;
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.2;
}

.unlocked-video-card p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.watch-video-action {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  color: #14202a;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--pig));
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

.wish-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(280px, 0.85fr) minmax(260px, 1fr);
  gap: 20px;
  align-items: start;
}

.capsule {
  display: grid;
  gap: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(255, 250, 240, 0.18);
  border-radius: 8px;
  padding: 13px 14px;
  color: var(--ink);
  background: var(--panel-strong);
}

textarea {
  min-height: 106px;
  resize: vertical;
}

::placeholder {
  color: rgba(255, 250, 240, 0.55);
}

.sealed-card {
  min-height: 182px;
  margin: 0;
  padding: 22px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 211, 106, 0.2), rgba(140, 230, 207, 0.08)),
    rgba(255, 250, 240, 0.06);
  font-family: "Noto Serif TC", serif;
  font-size: 1.2rem;
}

.pig-burst-layer {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.flying-pig {
  position: absolute;
  left: var(--start-x);
  bottom: -120px;
  width: var(--pig-size);
  height: calc(var(--pig-size) * 0.82);
  transform: translate(-50%, 0) rotate(var(--spin-start));
  animation: pigFly var(--duration) cubic-bezier(0.16, 0.82, 0.28, 1) forwards;
  animation-delay: var(--delay);
  filter: drop-shadow(0 18px 18px rgba(0, 0, 0, 0.22));
}

.flying-pig .pig-face {
  inset: 18% 4% 0;
}

.flying-pig .pig-ear {
  top: 2%;
  width: 32%;
  height: 38%;
}

.flying-pig .pig-ear-left { left: 7%; }
.flying-pig .pig-ear-right { right: 7%; }

.flying-pig .pig-eye {
  top: 42%;
  width: 8%;
  height: 11%;
}

.flying-pig .pig-eye-left { left: 27%; }
.flying-pig .pig-eye-right { right: 27%; }

.flying-pig .pig-snout {
  bottom: 15%;
  width: 40%;
  height: 29%;
  gap: 11%;
}

.flying-pig .pig-snout span {
  width: 13%;
  height: 42%;
}

.flying-pig::after {
  content: "";
  position: absolute;
  right: -9%;
  bottom: 8%;
  width: 22%;
  height: 22%;
  border: 4px solid var(--pig-dark);
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(30deg);
}

.story-ribbon {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 11;
  width: min(620px, calc(100% - 28px));
  padding: 16px 20px;
  border: 1px solid rgba(255, 178, 194, 0.42);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(18, 24, 34, 0.88);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  transform: translate(-50%, 140%);
  animation: ribbonPop 4.6s ease forwards;
}

.video-surprise[hidden] {
  display: none;
}

.video-surprise {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
}

.video-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 178, 194, 0.28), transparent 26rem),
    rgba(5, 8, 13, 0.78);
  backdrop-filter: blur(12px);
}

.video-stage {
  position: relative;
  width: min(980px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  border: 1px solid rgba(255, 250, 240, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 178, 194, 0.16), rgba(140, 230, 207, 0.08)),
    rgba(10, 19, 28, 0.96);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.5);
}

.video-copy {
  padding: clamp(20px, 4vw, 34px) clamp(20px, 4vw, 38px) 16px;
}

.video-copy p:last-child {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.8;
}

.video-frame {
  position: relative;
  margin: 0 clamp(14px, 4vw, 38px) clamp(14px, 4vw, 38px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #05080d;
  box-shadow: inset 0 0 0 1px rgba(255, 250, 240, 0.1);
}

.video-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.play-video {
  position: absolute;
  left: 50%;
  top: 50%;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  color: #14202a;
  font-weight: 900;
  background: linear-gradient(90deg, var(--gold), var(--pig));
  transform: translate(-50%, -50%);
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.video-frame.playing .play-video {
  display: none;
}

.close-video {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 250, 240, 0.2);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 250, 240, 0.08);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

@keyframes flame {
  from { transform: rotate(-4deg) scaleY(0.96); }
  to { transform: rotate(5deg) scaleY(1.08); }
}

@keyframes pulse {
  from { filter: brightness(0.92); }
  to { filter: brightness(1.34); }
}

@keyframes pigPeek {
  0%, 100% { transform: translateY(0) rotate(7deg); }
  50% { transform: translateY(-10px) rotate(1deg); }
}

@keyframes pigFly {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) rotate(var(--spin-start)) scale(0.76);
  }
  12% {
    opacity: 1;
  }
  68% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift)), calc(-1 * var(--rise))) rotate(var(--spin-end)) scale(1.08);
  }
}

@keyframes ribbonPop {
  0% { transform: translate(-50%, 140%); opacity: 0; }
  12%, 84% { transform: translate(-50%, 0); opacity: 1; }
  100% { transform: translate(-50%, 140%); opacity: 0; }
}

@media (max-width: 820px) {
  .page-shell {
    width: min(100% - 24px, 620px);
    padding-top: 22px;
  }

  .hero,
  .orbit-panel,
  .wish-panel {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding: 36px 0 10px;
  }

  .cake {
    height: 320px;
    transform: scale(0.86);
  }

  .cake-pig {
    right: 18px;
  }

  .constellation {
    min-height: 315px;
  }

  .unlocked-video-card {
    grid-template-columns: 1fr;
    margin-top: 0;
  }

  .watch-video-action {
    width: 100%;
  }

  .flying-pig {
    width: calc(var(--pig-size) * 0.82);
    height: calc(var(--pig-size) * 0.68);
  }

  .wish-panel {
    margin-bottom: 24px;
  }

  .video-surprise {
    padding: 10px;
  }

  .video-stage {
    max-height: 94vh;
  }

  .play-video {
    width: min(260px, calc(100% - 28px));
    white-space: normal;
  }
}

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

  .flying-pig,
  .story-ribbon {
    display: none;
  }
}
