:root {
  --violet-black: #13091d;
  --violet: #24112f;
  --violet-soft: #3a1b49;
  --gold: #d4b56b;
  --gold-bright: #eed89d;
  --ivory: #f6f0fb;
  --lavender: #bda9ca;
  --line: rgba(212, 181, 107, 0.3);
}

body {
  background:
    radial-gradient(circle at 84% 16%, rgba(128, 75, 151, 0.3), transparent 28%),
    radial-gradient(circle at 13% 64%, rgba(89, 40, 108, 0.28), transparent 34%),
    linear-gradient(145deg, #0d0713, var(--violet-black) 42%, #21102c 100%);
  color: var(--ivory);
  font-family: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(circle, rgba(238, 216, 157, 0.42) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(246, 240, 251, 0.2) 0 1px, transparent 1.3px);
  background-position: 0 0, 41px 57px;
  background-size: 121px 137px, 173px 149px;
  content: "";
  mask-image: linear-gradient(to bottom, #000, transparent 78%);
  pointer-events: none;
}

.preview-nav {
  border-bottom: 1px solid rgba(212, 181, 107, 0.18);
  color: var(--ivory);
}

.hero-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: clamp(38px, 8vw, 112px);
}

.eyebrow,
.section-no,
.brand-signoff {
  color: var(--gold);
}

h1 {
  margin-left: -0.05em;
  background: linear-gradient(150deg, #fff 6%, #e7d9ef 48%, #b999c8 100%);
  background-clip: text;
  color: transparent;
  font-size: clamp(62px, 9vw, 118px);
  letter-spacing: 0.09em;
  text-shadow: 0 22px 60px rgba(5, 0, 12, 0.72);
}

.lead,
.privacy,
.result-summary,
footer,
.dialog-note,
.result-poem cite,
.theme-note,
.date-panel label span {
  color: var(--lavender);
}

.moon-stage {
  width: min(70vw, 410px);
  margin-top: 38px;
  color: var(--gold);
  isolation: isolate;
}

.moon-stage::after {
  position: absolute;
  top: 2%;
  right: 9%;
  width: 8px;
  height: 8px;
  background: var(--gold-bright);
  box-shadow: -9px 9px 20px rgba(238, 216, 157, 0.92);
  content: "";
  transform: rotate(45deg);
  animation: amethyst-star-glint 4.8s ease-in-out infinite;
}

.moon-portrait {
  inset: 6%;
  filter: saturate(0.72) sepia(0.2) hue-rotate(238deg) contrast(1.08) brightness(0.96);
  box-shadow: 0 0 0 12px rgba(212, 181, 107, 0.045), 0 35px 90px rgba(3, 0, 9, 0.72), 0 0 72px rgba(137, 87, 160, 0.28);
  animation: amethyst-moon-breathe 10s ease-in-out infinite;
  will-change: transform, box-shadow;
}

.moon-orbit {
  inset: -2%;
  animation: amethyst-halo-breathe 10s ease-in-out infinite;
}

.moon-orbit::before {
  display: none;
}

.theme-note {
  right: -3%;
  bottom: 5%;
  padding: 12px 16px;
  border-left: 1px solid var(--gold);
  background: rgba(19, 9, 29, 0.62);
  backdrop-filter: blur(10px);
}

.date-panel {
  padding: clamp(34px, 5vw, 60px);
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(62, 30, 76, 0.76), rgba(19, 9, 29, 0.88));
  box-shadow: 0 42px 110px rgba(3, 0, 10, 0.5);
  backdrop-filter: blur(18px);
}

input {
  border: 0;
  border-bottom: 1px solid rgba(212, 181, 107, 0.42);
  background: rgba(11, 4, 18, 0.3);
  color: var(--ivory);
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline-color: var(--gold-bright);
}

.form-error {
  color: #efb6d8;
}

.primary-button {
  border: 1px solid var(--gold);
  background: linear-gradient(100deg, #b69243, var(--gold-bright) 46%, #c7a052);
  color: #24112f;
  box-shadow: 0 12px 34px rgba(7, 1, 14, 0.26);
}

.text-button {
  border: 1px solid var(--line);
  color: var(--ivory);
}

.result {
  border-top: 1px solid var(--line);
}

#moon-card {
  border: 0;
  border-radius: 28px;
  box-shadow: 0 42px 110px rgba(3, 0, 10, 0.62), 0 0 70px rgba(114, 65, 138, 0.16);
}

.result:not([hidden]) #moon-card {
  animation: amethyst-card-reveal 0.85s cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.result-poem {
  border-left: 1px solid var(--gold);
}

footer {
  border-top: 1px solid rgba(212, 181, 107, 0.18);
}

dialog {
  border: 1px solid rgba(212, 181, 107, 0.55);
  border-radius: 24px;
  background: var(--violet-black);
  color: var(--ivory);
}

#saved-image {
  border: 1px solid var(--line);
  border-radius: 18px;
}

@keyframes amethyst-moon-breathe {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
    box-shadow: 0 0 0 12px rgba(212, 181, 107, 0.045), 0 35px 90px rgba(3, 0, 9, 0.72), 0 0 64px rgba(137, 87, 160, 0.22);
  }
  50% {
    transform: translate3d(0, -6px, 0) scale(1.012);
    box-shadow: 0 0 0 15px rgba(212, 181, 107, 0.06), 0 42px 100px rgba(3, 0, 9, 0.76), 0 0 92px rgba(156, 98, 181, 0.38);
  }
}

@keyframes amethyst-halo-breathe {
  0%, 100% { opacity: 0.58; }
  50% { opacity: 0.92; }
}

@keyframes amethyst-star-glint {
  0%, 72%, 100% { opacity: 0.58; transform: rotate(45deg) scale(0.82); }
  82% { opacity: 1; transform: rotate(45deg) scale(1.28); }
}

@keyframes amethyst-card-reveal {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .date-panel {
    border-radius: 26px;
  }

  .moon-stage {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .moon-portrait,
  .moon-orbit,
  .moon-stage::after,
  .result:not([hidden]) #moon-card {
    animation: none;
  }
}
