:root {
  --ink: #342c54;
  --muted: #756e8f;
  --purple: #7865b9;
  --purple-dark: #5e4ca0;
  --lavender: #e7ddff;
  --peach: #ffd9c9;
  --cream: #fffaf2;
  --white: rgba(255, 255, 255, 0.84);
  --line: rgba(93, 76, 160, 0.15);
  --shadow: 0 28px 80px rgba(76, 58, 126, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background:
    radial-gradient(circle at 8% 15%, rgba(255, 218, 197, 0.75), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(220, 205, 255, 0.85), transparent 30%),
    linear-gradient(150deg, #fffaf3 0%, #f8f3ff 47%, #eff3ff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background-image: radial-gradient(#7865b9 0.7px, transparent 0.7px);
  background-size: 28px 28px;
  mask-image: linear-gradient(to bottom, black, transparent 80%);
}

.sky { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.star, .moon { position: absolute; color: rgba(120, 101, 185, 0.42); }
.star-one { top: 10%; left: 11%; font-size: 28px; }
.star-two { top: 31%; right: 9%; font-size: 38px; }
.star-three { top: 72%; left: 8%; font-size: 20px; }
.moon { top: 8%; right: 13%; font-size: 62px; transform: rotate(-12deg); }

.page-shell { width: min(900px, calc(100% - 32px)); margin: 0 auto; padding: 64px 0 36px; position: relative; }
.hero { text-align: center; margin-bottom: 40px; }
.eyebrow { display: flex; justify-content: center; align-items: center; gap: 12px; color: var(--purple); font-size: 12px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.eyebrow span { display: block; width: 36px; height: 1px; background: var(--purple); opacity: 0.45; }
h1, h2 { font-family: "DM Serif Display", Georgia, serif; font-weight: 400; }
h1 { margin: 14px 0 18px; font-size: clamp(48px, 8vw, 78px); line-height: 0.96; letter-spacing: -0.035em; }
h1 em { color: var(--purple); font-style: italic; }
.intro { width: min(590px, 100%); margin: 0 auto; color: var(--muted); font-size: 17px; line-height: 1.7; }

.maker-card, .story-card {
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 32px;
  background: var(--white);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.maker-card { padding: clamp(24px, 5vw, 48px); }
.card-heading { display: flex; gap: 17px; align-items: center; margin-bottom: 32px; }
.book-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 auto; border-radius: 18px; background: linear-gradient(135deg, var(--lavender), var(--peach)); font-size: 25px; }
.step { margin: 0 0 3px; color: var(--purple); font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; font-weight: 700; }
.card-heading h2 { margin: 0; font-size: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 23px 20px; }
label, legend { color: var(--ink); font-size: 13px; font-weight: 700; }
input, select {
  display: block;
  width: 100%;
  margin-top: 9px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,0.72);
  color: var(--ink);
  font: inherit;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input:focus, select:focus { border-color: var(--purple); box-shadow: 0 0 0 4px rgba(120,101,185,0.12); }
fieldset { grid-column: 1 / -1; padding: 0; border: 0; margin: 0; }
.mood-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 9px; }
.mood-options input { position: absolute; opacity: 0; pointer-events: none; }
.mood-options span { display: block; padding: 12px 8px; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,0.68); text-align: center; cursor: pointer; transition: 160ms ease; }
.mood-options input:checked + span { background: var(--lavender); border-color: rgba(120,101,185,0.45); color: var(--purple-dark); }
.create-button {
  width: 100%; margin-top: 30px; padding: 16px 22px; border: 0; border-radius: 16px;
  color: white; background: linear-gradient(135deg, var(--purple), var(--purple-dark));
  font: 700 15px "DM Sans", sans-serif; cursor: pointer; box-shadow: 0 14px 28px rgba(94,76,160,0.25);
  display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform 160ms ease, box-shadow 160ms ease;
}
.create-button:hover { transform: translateY(-2px); box-shadow: 0 18px 35px rgba(94,76,160,0.32); }
.create-button:disabled { opacity: 0.65; cursor: wait; transform: none; }
.status { min-height: 20px; margin: 12px 0 -8px; text-align: center; color: #9b4c65; font-size: 13px; }

.story-card { margin-top: 28px; padding: clamp(28px, 5vw, 50px); animation: reveal 450ms ease both; }
.story-topline { display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--purple); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.story-card h2 { font-size: clamp(32px, 5vw, 46px); margin: 16px 0 22px; }
.story-text { color: #514968; font-family: "DM Serif Display", Georgia, serif; font-size: 20px; line-height: 1.85; }
.story-text p { margin: 0 0 18px; }
.text-button, .again-button { border: 0; background: transparent; color: var(--purple-dark); font-weight: 700; cursor: pointer; }
.text-button { padding: 6px 0; }
.again-button { margin-top: 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 13px; background: #f6f0ff; }
footer { padding: 34px 20px 0; text-align: center; color: var(--muted); font-size: 13px; }
footer p { margin: 5px; }
footer .small { font-size: 11px; opacity: 0.78; }
@keyframes reveal { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-width: 650px) {
  .page-shell { padding-top: 44px; }
  .form-grid { grid-template-columns: 1fr; }
  .mood-options { grid-template-columns: repeat(2, 1fr); }
  .moon { right: 4%; opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }
