:root {
  /* dreamy dusk: periwinkle -> lavender -> dusty pink */
  --bg-top: #565fa9;
  --bg-mid: #8678bd;
  --bg-bottom: #bf95c5;
  --ink: #fff9f0;
  --muted: #e9e2f7;
  --gold: #ffe88b;
  --gold-soft: rgba(255, 232, 139, 0.35);
  --pink: #f7bfd8;
  --card: rgba(255, 255, 255, 0.13);
  --card-border: rgba(255, 255, 255, 0.3);
  --paper: #fdf8ec;
  --paper-ink: #3d4380;
  --night: #2e3374;
  --night-deep: #23285c;
  --danger: #ffd2d2;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-mid) 55%, var(--bg-bottom) 100%) fixed;
  color: var(--ink);
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}

.hand { font-family: 'Caveat', cursive; }

/* ---- soft pastel clouds ---- */
body::before,
body::after {
  content: '';
  position: fixed;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  filter: blur(60px);
}
body::before {
  width: 55vw;
  height: 40vh;
  left: -15vw;
  top: 8vh;
  background: rgba(247, 191, 216, 0.22);
}
body::after {
  width: 50vw;
  height: 36vh;
  right: -12vw;
  bottom: 6vh;
  background: rgba(255, 232, 139, 0.14);
}

/* ---- tiny background stars ---- */
.bg-stars {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bg-stars span {
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  opacity: 0.5;
  animation: twinkle 3.5s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50% { opacity: 0.7; transform: scale(1.15); }
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 660px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

h1 {
  font-family: 'Caveat', cursive;
  font-size: clamp(2.6rem, 8vw, 3.6rem);
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--gold);
  text-shadow: 0 0 24px var(--gold-soft);
}

h1.hello {
  font-size: clamp(4.2rem, 14vw, 6rem);
  margin-bottom: 0;
  line-height: 1.05;
}

.its-sam {
  font-size: clamp(1.8rem, 6vw, 2.3rem);
  color: var(--ink);
  margin: 0 0 22px;
}

h2 {
  font-family: 'Caveat', cursive;
  font-size: clamp(1.9rem, 6vw, 2.4rem);
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--gold);
}

p { margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

a { color: var(--gold); }

.btn {
  display: inline-block;
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 14px 28px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffe88b, #ffc9a3);
  color: #5b4620;
  box-shadow: 0 4px 22px rgba(255, 214, 150, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(255, 214, 150, 0.5); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--card-border);
  box-shadow: none;
}
.btn-ghost:hover { box-shadow: none; border-color: var(--gold); color: var(--gold); }

.btn-small { padding: 9px 18px; font-size: 0.92rem; }

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 16px;
  backdrop-filter: blur(6px);
}

/* choice cards */
.choice {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 18px;
  padding: 18px 20px;
  margin-bottom: 14px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.choice:hover { border-color: var(--gold); transform: translateY(-2px); }
.choice .title { font-weight: 800; font-size: 1.12rem; display: block; margin-bottom: 4px; }
.choice .sub { color: var(--muted); font-size: 0.92rem; }
.choice .fav {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  color: #5b4620;
  background: var(--gold);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: 8px;
  vertical-align: 2px;
}

/* shape picker */
.shape-row { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 18px 0; }
.shape-opt {
  cursor: pointer;
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  width: 108px;
  text-align: center;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.15s ease;
}
.shape-opt.active { border-color: var(--gold); color: var(--ink); }
.shape-opt .demo {
  display: block;
  width: 64px;
  height: 48px;
  margin: 0 auto 8px;
  background: var(--paper);
}
.shape-opt .demo.rect { border-radius: 6px; }
.shape-opt .demo.square { width: 52px; height: 52px; border-radius: 4px; }
.shape-opt .demo.oval { width: 62px; height: 46px; border-radius: 50%; }
.shape-opt .demo.heart {
  width: 54px;
  height: 50px;
  clip-path: url(#clip-heart);
}
.shape-opt .demo.wavy {
  width: 64px;
  height: 46px;
  clip-path: url(#clip-wavy);
}

/* camera / crop stage */
.stage {
  position: relative;
  width: 100%;
  background: var(--night-deep);
  border-radius: 16px;
  overflow: hidden;
  touch-action: none;
}
.stage video, .stage img.crop-img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.stage video.mirror { transform: scaleX(-1); }
.stage svg.guide { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.stage img.crop-img {
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
}

.preview-frame {
  margin: 0 auto;
  max-width: 420px;
}
.preview-frame img { display: block; width: 100%; }

/* drawing */
.canvas-holder { position: relative; width: 100%; }
.canvas-holder canvas {
  display: block;
  width: 100%;
  border-radius: 14px;
  touch-action: none;
  cursor: crosshair;
}
.star-holder {
  max-width: 340px;
  margin: 0 auto;
}
.star-holder canvas {
  background: radial-gradient(ellipse at center, var(--night) 0%, var(--night-deep) 100%);
  border: 1.5px dashed rgba(255, 232, 139, 0.45);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 12px 0;
}
.swatch {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  padding: 0;
}
.swatch.active { border-color: var(--gold); }
.pen-size {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--card);
  border: 2px solid var(--card-border);
  cursor: pointer;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.pen-size.active { border-color: var(--gold); }
.pen-size i {
  display: block;
  border-radius: 50%;
  background: currentColor;
}

/* form bits */
input[type="text"], textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.12);
  border: 1.5px solid var(--card-border);
  border-radius: 12px;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  padding: 13px 16px;
  outline: none;
}
input[type="text"]::placeholder, textarea::placeholder { color: rgba(255, 249, 240, 0.55); }
input[type="text"]:focus, textarea:focus { border-color: var(--gold); }
textarea { min-height: 200px; resize: vertical; line-height: 1.7; }

.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 16px 0;
  font-size: 0.94rem;
  color: var(--muted);
  cursor: pointer;
}
.check input { margin-top: 4px; accent-color: var(--gold); }

.error {
  color: var(--danger);
  font-size: 0.92rem;
  margin-top: 10px;
  min-height: 1.2em;
}

.step { display: none; }
.step.active { display: block; animation: fadeUp 0.4s ease; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.back-link {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 18px;
}
.back-link:hover { color: var(--gold); }

/* self-hosted video */
.video-embed { margin: 20px 0; display: flex; justify-content: center; }
.video-embed video {
  width: 100%;
  max-width: 340px;
  border-radius: 18px;
  border: 1.5px solid var(--card-border);
  box-shadow: 0 10px 40px rgba(60, 50, 120, 0.35);
  background: var(--night-deep);
}

/* done screen */
.done-star {
  width: 130px;
  height: 130px;
  margin: 10px auto 20px;
  display: block;
  filter: drop-shadow(0 0 18px var(--gold-soft));
  animation: twinkle 3s ease-in-out infinite;
}

/* note paper preview for typed messages */
.paper-note {
  background: var(--paper);
  color: var(--paper-ink);
  border-radius: 10px;
  padding: 20px 22px;
  white-space: pre-wrap;
  font-size: 1rem;
  max-height: 420px;
  overflow-y: auto;
}
