:root {
  --accent: #ff8a5c;
  --accent-strong: #ff6a3d;
  --accent-soft: rgba(255, 138, 92, 0.18);
  --accent-faint: rgba(255, 138, 92, 0.08);
  --accent-contrast: #fff5ed;
  --gold: #ffd48c;
  --page-top: #0d1b2f;
  --page-bottom: #24111c;
  --panel: rgba(15, 24, 40, 0.62);
  --panel-border: rgba(255, 255, 255, 0.14);
  --text-main: #fff4ea;
  --text-soft: #f6d8c7;
  --text-muted: #cdaea0;
  --shadow-strong: 0 30px 70px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.22);
  --display-font: "Baskerville Old Face", "Palatino Linotype", "Book Antiqua", serif;
  --body-font: "Century Gothic", "Trebuchet MS", "Gill Sans", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body-font);
  color: var(--text-main);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 170, 124, 0.25), transparent 24rem),
    radial-gradient(circle at 84% 14%, rgba(255, 212, 140, 0.18), transparent 22rem),
    radial-gradient(circle at 72% 76%, rgba(255, 106, 61, 0.2), transparent 28rem),
    linear-gradient(135deg, var(--page-top), var(--page-bottom));
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.ambient,
.sparkles,
.balloons,
.confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.ambient {
  filter: blur(100px);
  opacity: 0.72;
}

.ambient--left {
  background: radial-gradient(circle at center, rgba(255, 138, 92, 0.45), transparent 60%);
  transform: translate(-22%, -14%);
}

.ambient--right {
  background: radial-gradient(circle at center, rgba(255, 212, 140, 0.32), transparent 60%);
  transform: translate(34%, 12%);
}

.sparkles span {
  position: absolute;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: rgba(255, 245, 237, 0.85);
  box-shadow: 0 0 18px rgba(255, 245, 237, 0.9);
  animation: twinkle 5s ease-in-out infinite;
}

.sparkles span:nth-child(1) { top: 11%; left: 14%; animation-delay: 0s; }
.sparkles span:nth-child(2) { top: 18%; right: 16%; animation-delay: 1.1s; }
.sparkles span:nth-child(3) { top: 35%; left: 76%; animation-delay: 2.2s; }
.sparkles span:nth-child(4) { top: 64%; left: 9%; animation-delay: 1.8s; }
.sparkles span:nth-child(5) { top: 78%; right: 22%; animation-delay: 0.7s; }
.sparkles span:nth-child(6) { top: 48%; left: 48%; animation-delay: 2.7s; }

.balloon {
  position: absolute;
  width: 4.2rem;
  height: 5.3rem;
  border-radius: 50% 50% 46% 46%;
  box-shadow: inset -10px -12px 20px rgba(0, 0, 0, 0.08), 0 18px 32px rgba(0, 0, 0, 0.12);
  animation: floatUp 10s ease-in-out infinite;
}

.balloon::before {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  width: 0.7rem;
  height: 0.7rem;
  background: inherit;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  transform: translateX(-50%);
}

.balloon::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: 6rem;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0));
}

.balloon--peach {
  top: 14%;
  left: 7%;
  background: linear-gradient(180deg, #ffc2a8, #ff8a5c);
}

.balloon--gold {
  top: 9%;
  right: 11%;
  background: linear-gradient(180deg, #ffe2b8, #ffbd66);
  animation-delay: 1.4s;
}

.balloon--coral {
  top: 57%;
  right: 7%;
  background: linear-gradient(180deg, #ffb0ab, #ff7566);
  animation-delay: 2.2s;
}

.balloon--cream {
  top: 68%;
  left: 9%;
  background: linear-gradient(180deg, #fff2d9, #ffd48c);
  animation-delay: 0.8s;
}

.editor-toggle-chip {
  position: fixed;
  top: 1.4rem;
  right: 1.4rem;
  z-index: 30;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow-soft);
}

.app-shell {
  position: relative;
  z-index: 2;
  width: min(1180px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  display: grid;
  grid-template-columns: 21rem minmax(0, 1fr);
  gap: 1.6rem;
}

.control-panel,
.hero-card,
.surprise-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 2rem;
  backdrop-filter: blur(24px);
  box-shadow: var(--shadow-strong);
}

.control-panel {
  position: sticky;
  top: 1.5rem;
  padding: 1.7rem;
  align-self: start;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.eyebrow,
.overline,
.surprise-label {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
}

.control-panel h1 {
  margin: 0;
  font: 400 clamp(2rem, 2.6vw, 2.75rem)/1.05 var(--display-font);
}

.panel-copy {
  margin: 1rem 0 1.3rem;
  color: var(--text-soft);
  line-height: 1.6;
}

.wish-form {
  display: grid;
  gap: 0.95rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  color: var(--text-soft);
  font-size: 0.93rem;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.95rem 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 12, 24, 0.42);
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: rgba(255, 212, 140, 0.75);
  background: rgba(12, 18, 32, 0.62);
  transform: translateY(-1px);
}

.field textarea {
  resize: vertical;
  min-height: 8rem;
}

.panel-actions,
.hero-actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.panel-actions {
  margin-top: 1.3rem;
}

.primary-button,
.secondary-button {
  padding: 0.95rem 1.25rem;
  border-radius: 999px;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--accent-contrast);
  box-shadow: 0 16px 28px rgba(255, 106, 61, 0.28);
}

.secondary-button {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.primary-button:hover,
.secondary-button:hover,
.editor-toggle-chip:hover,
.gift-box:hover {
  transform: translateY(-2px) scale(1.01);
}

.panel-tip {
  margin-top: 1.2rem;
  padding: 1rem 1.05rem;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  line-height: 1.6;
}

.celebration-stage {
  display: grid;
  gap: 1.4rem;
}

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 1.8rem;
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 1.2rem;
  min-height: 34rem;
}

.hero-card::before {
  content: "";
  position: absolute;
  inset: auto 1.4rem 1.1rem auto;
  width: 14rem;
  height: 14rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.09), transparent 70%);
}

.hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-copy h2 {
  margin: 0;
  font: 400 clamp(3.2rem, 7vw, 5.8rem)/0.94 var(--display-font);
  text-wrap: balance;
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  color: var(--text-soft);
}

.hero-pill {
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.hero-dot {
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--gold);
}

.hero-message {
  max-width: 38rem;
  margin: 1.35rem 0;
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text-soft);
}

.signature {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.05);
  width: fit-content;
}

.signature-label {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.signature strong {
  font-size: 1.12rem;
}

.spotlight {
  position: relative;
  display: grid;
  place-items: center;
}

.halo {
  position: absolute;
  inset: 8% 10% 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 212, 140, 0.18), transparent 65%);
  filter: blur(16px);
}

.cake {
  position: relative;
  z-index: 1;
  width: min(18rem, 100%);
  margin-bottom: 2rem;
  transition: transform 0.35s ease;
}

.cake-top,
.cake-middle,
.cake-bottom {
  margin: 0 auto;
  border-radius: 1.1rem;
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.3);
}

.cake-top {
  width: 62%;
  height: 2rem;
  background: linear-gradient(180deg, #fff7f2, #ffd7c3);
}

.cake-middle {
  width: 74%;
  height: 3.3rem;
  background: linear-gradient(180deg, #ffc3a4, #ff946d);
}

.cake-bottom {
  width: 88%;
  height: 4rem;
  background: linear-gradient(180deg, #ffd9ae, #ffc05e);
}

.cake-plate {
  width: 100%;
  height: 0.8rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.12));
  margin-top: 0.45rem;
}

.candles {
  position: relative;
  width: 58%;
  margin: 0 auto -0.45rem;
  display: flex;
  justify-content: space-between;
}

.candle {
  position: relative;
  width: 0.95rem;
  height: 4rem;
  border-radius: 999px;
  background:
    repeating-linear-gradient(135deg, #fff1e1 0 6px, #ff7f63 6px 12px);
  box-shadow: inset -2px -3px 5px rgba(0, 0, 0, 0.1);
}

.flame {
  position: absolute;
  left: 50%;
  top: -1.25rem;
  width: 0.95rem;
  height: 1.45rem;
  transform: translateX(-50%);
  border-radius: 55% 55% 55% 55%;
  background: radial-gradient(circle at 35% 28%, #fffde1 0 30%, #ffc751 32% 58%, #ff7a32 60% 100%);
  box-shadow: 0 0 16px rgba(255, 199, 81, 0.8);
  animation: flicker 0.9s ease-in-out infinite alternate;
  transform-origin: center bottom;
}

.cake.is-candles-out .flame {
  opacity: 0;
  transform: translateX(-50%) translateY(0.55rem) scale(0.2);
}

.gift-box {
  position: relative;
  z-index: 2;
  width: 11rem;
  height: 11rem;
  background: none;
}

.gift-base,
.gift-lid {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 9rem;
  border-radius: 1rem;
  background: linear-gradient(180deg, #ffb4a8, #ff8a5c);
  box-shadow: var(--shadow-soft);
}

.gift-base {
  bottom: 0.8rem;
  height: 6.7rem;
}

.gift-lid {
  top: 1.55rem;
  height: 2.6rem;
  transition: transform 0.45s ease, rotate 0.45s ease;
}

.gift-ribbon {
  position: absolute;
  background: linear-gradient(180deg, #ffeec6, #ffd48c);
}

.gift-ribbon--vertical {
  top: 1.65rem;
  bottom: 0.8rem;
  left: 50%;
  width: 1rem;
  transform: translateX(-50%);
}

.gift-ribbon--horizontal {
  left: 1rem;
  right: 1rem;
  top: 3.3rem;
  height: 1rem;
}

.gift-bow {
  position: absolute;
  top: 0.4rem;
  left: 50%;
  width: 3.2rem;
  height: 2.2rem;
  transform: translateX(-50%);
}

.gift-bow::before,
.gift-bow::after {
  content: "";
  position: absolute;
  top: 0;
  width: 1.6rem;
  height: 2rem;
  border: 0.45rem solid #ffe7b0;
  border-radius: 70% 70% 68% 68%;
}

.gift-bow::before {
  left: 0;
  transform: rotate(-18deg);
}

.gift-bow::after {
  right: 0;
  transform: rotate(18deg);
}

.gift-heart {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, 0) scale(0.2);
  font-size: 2.5rem;
  color: #fff8f0;
  opacity: 0;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
  transition: transform 0.42s ease, opacity 0.42s ease;
}

.celebration-stage.is-open .gift-lid {
  transform: translateX(-50%) translateY(-4rem) rotate(-10deg);
}

.celebration-stage.is-open .gift-heart {
  opacity: 1;
  transform: translate(-50%, -3.2rem) scale(1);
}

.celebration-stage.is-open .cake {
  transform: translateY(-0.35rem);
}

.surprise-panel {
  max-height: 0;
  padding: 0 1.5rem;
  overflow: hidden;
  opacity: 0;
  transform: translateY(1rem) scale(0.98);
  border-color: transparent;
  box-shadow: none;
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    max-height 0.45s ease,
    padding 0.35s ease,
    border-color 0.25s ease;
}

.celebration-stage.is-open .surprise-panel {
  max-height: 120rem;
  padding: 1.5rem;
  opacity: 1;
  transform: none;
  border-color: var(--panel-border);
  box-shadow: var(--shadow-strong);
}

.surprise-header h3 {
  margin: 0;
  font: 400 clamp(1.8rem, 3.5vw, 2.5rem)/1.1 var(--display-font);
}

.wish-grid {
  margin-top: 1.3rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.wish-note {
  padding: 1.25rem;
  border-radius: 1.35rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)),
    rgba(6, 11, 20, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 14rem;
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.wish-note.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.note-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--gold);
  font-size: 0.9rem;
}

.wish-note h4 {
  margin: 1rem 0 0.75rem;
  font: 400 1.45rem/1.15 var(--display-font);
}

.wish-note p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.7;
}

body.gift-mode .control-panel {
  max-height: 0;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateX(-1.5rem);
  pointer-events: none;
  border-color: transparent;
  box-shadow: none;
}

body.gift-mode .app-shell {
  gap: 0;
  grid-template-columns: 0 minmax(0, 1fr);
}

body.gift-mode .celebration-stage {
  grid-column: 1 / -1;
}

body.gift-mode .hero-card,
body.gift-mode .surprise-panel {
  max-width: 100%;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.25; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1); }
}

@keyframes floatUp {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-1rem) rotate(2deg); }
}

@keyframes flicker {
  0% { transform: translateX(-50%) scaleY(1) rotate(-2deg); }
  100% { transform: translateX(-50%) scaleY(1.08) rotate(3deg); }
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100% - 1.2rem, 64rem);
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: relative;
    top: 0;
  }

  .hero-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .wish-grid {
    grid-template-columns: 1fr;
  }

  body.gift-mode .app-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding-top: 4.3rem;
  }

  .control-panel,
  .hero-card,
  .surprise-panel {
    border-radius: 1.5rem;
  }

  .control-panel,
  .hero-card,
  .surprise-panel {
    padding: 1.2rem;
  }

  .hero-copy h2 {
    font-size: 3rem;
  }

  .gift-box {
    width: 9.2rem;
    height: 9.2rem;
  }

  .gift-base,
  .gift-lid {
    width: 7.8rem;
  }

  .panel-actions,
  .hero-actions {
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
