:root {
  --cream: #fff9f3;
  --ink: #3a2e2a;
  --ink-soft: #7a6a63;
  --rose: #c2496b;
  --rose-deep: #a93a58;
  --blush: #fbe3e6;
  --sage: #7d9b76;
  --gold: #d9a441;
  --card: #ffffff;
  --line: #f0e2d6;
  --shadow: 0 10px 30px rgba(178, 90, 110, 0.12);
  --radius: 18px;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--sans); color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .serif { font-family: var(--serif); }
.hidden { display: none !important; }

/* ---------- header ---------- */
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; max-width: 1280px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand .logo {
  width: 44px; height: 44px; border-radius: 14px;
  background: linear-gradient(135deg, #f4a7b9, var(--rose));
  display: grid; place-items: center; font-size: 24px;
  box-shadow: var(--shadow);
}
.brand b { font-family: var(--serif); font-size: 20px; display: block; line-height: 1.1; }
.brand small { color: var(--ink-soft); font-size: 12px; }
nav.links a {
  margin-left: 22px; text-decoration: none; color: var(--ink-soft);
  font-size: 14px; font-weight: 600;
}
nav.links a:hover { color: var(--rose); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 26px 20px 8px; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 0 0 10px; line-height: 1.12; }
.hero h1 em { color: var(--rose); font-style: italic; }
.hero p { color: var(--ink-soft); font-size: 16px; margin: 0 0 6px; }
.hero .steps { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.step {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.step b { color: var(--rose); margin-right: 6px; }

/* ---------- studio layout ---------- */
.studio {
  display: grid; grid-template-columns: 300px 1fr 300px; gap: 18px;
  max-width: 1280px; margin: 22px auto 0; padding: 0 20px; align-items: start;
}
.sidebar {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; position: sticky; top: 16px;
}
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; border: 0; background: none; padding: 13px 4px; font-size: 13px; font-weight: 700;
  color: var(--ink-soft); cursor: pointer; font-family: var(--sans);
}
.tab.active { color: var(--rose); box-shadow: inset 0 -3px 0 var(--rose); }
.panel { display: none; padding: 14px; max-height: 560px; overflow-y: auto; }
.panel.active { display: block; }
.panel h4 { margin: 4px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }

#palette { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swatch {
  border: 1px solid var(--line); border-radius: 12px; background: #fffdf9;
  padding: 6px 4px 8px; cursor: pointer; font-family: var(--sans);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: transform 0.12s, box-shadow 0.12s;
  position: relative;
}
.swatch:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--rose); }
.swatch svg { width: 52px; height: 52px; }
.swatch span { font-size: 10.5px; font-weight: 600; color: var(--ink-soft); }
.swatch em {
  display: none; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; font-size: 11px; font-style: normal; font-weight: 600;
  padding: 5px 10px; border-radius: 8px; white-space: nowrap; z-index: 5; pointer-events: none;
}
.swatch:hover em { display: block; }

.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: #fffdf9; border-radius: 999px;
  padding: 7px 13px 7px 8px; margin: 0 6px 8px 0; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft); font-family: var(--sans);
}
.chip .dot { width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.08); }
.chip.active { border-color: var(--rose); color: var(--rose-deep); box-shadow: 0 0 0 2px rgba(194,73,107,0.15); }

.preset {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 1px solid var(--line); background: #fffdf9; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: var(--sans); color: var(--ink);
  transition: transform 0.12s, box-shadow 0.12s;
}
.preset:hover { transform: translateX(3px); box-shadow: var(--shadow); border-color: var(--rose); }
.preset .pe { font-size: 20px; }

/* ---------- stage ---------- */
.stage-col { display: flex; flex-direction: column; gap: 12px; }
.stage-wrap { position: relative; }
svg#stage {
  width: 100%; height: auto; aspect-ratio: 420 / 470;
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); touch-action: none; cursor: default;
  transition: background 0.4s;
}
svg#stage .bloom { cursor: grab; }
svg#stage .bloom:active { cursor: grabbing; }
.spin-slow { animation: spin 14s linear infinite; transform-origin: center; transform-box: fill-box; }
@keyframes spin { to { transform: rotate(360deg); } }

.stage-bar {
  display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap;
}
.btn {
  border: 0; border-radius: 999px; padding: 12px 22px; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: var(--sans); transition: transform 0.12s, box-shadow 0.12s;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--rose), var(--rose-deep)); color: #fff;
  box-shadow: 0 8px 22px rgba(194, 73, 107, 0.35); font-size: 16px; padding: 14px 34px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(194,73,107,0.45); }
.btn-ghost { background: var(--card); border: 1px solid var(--line); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--rose); color: var(--rose); }
#flowerCount { font-size: 13px; color: var(--ink-soft); font-weight: 600; }

/* selection toolbar */
#selToolbar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; gap: 4px; background: rgba(255,255,255,0.96);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px;
  box-shadow: var(--shadow); z-index: 5;
}
#selToolbar button {
  border: 0; background: none; font-size: 17px; cursor: pointer; padding: 7px 9px;
  border-radius: 50%; line-height: 1;
}
#selToolbar button:hover { background: var(--blush); }
#selToolbar button.danger:hover { background: #ffe1e1; }

/* ---------- message panel ---------- */
.msg-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; position: sticky; top: 16px;
}
.msg-panel h3 { margin: 0 0 4px; font-size: 19px; }
.msg-panel p.sub { margin: 0 0 14px; font-size: 13px; color: var(--ink-soft); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.05em; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; font-family: var(--sans); background: #fffdf9; color: var(--ink);
}
.field input:focus, .field textarea:focus { outline: 2px solid rgba(194,73,107,0.3); border-color: var(--rose); }
.field textarea { min-height: 86px; resize: vertical; }
.msg-panel .btn-primary { width: 100%; margin-top: 4px; }
.fineprint { font-size: 11.5px; color: var(--ink-soft); text-align: center; margin-top: 10px; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; background: rgba(58, 46, 42, 0.5);
  display: none; place-items: center; z-index: 50; padding: 20px;
  backdrop-filter: blur(3px);
}
.modal.open { display: grid; }
.modal-card {
  background: #fff; border-radius: 22px; padding: 30px; max-width: 440px; width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25); text-align: center; position: relative;
  animation: pop 0.25s ease-out;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.modal-card h2 { margin: 0 0 6px; font-size: 26px; }
.modal-card p { color: var(--ink-soft); font-size: 14px; margin: 0 0 18px; }
#modalClose {
  position: absolute; top: 12px; right: 14px; border: 0; background: none;
  font-size: 20px; cursor: pointer; color: var(--ink-soft);
}
.share-row { display: flex; gap: 8px; margin-bottom: 14px; }
#shareLink {
  flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 12px; color: var(--ink-soft); background: #faf6f1; min-width: 0;
}
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions .btn { padding: 12px 8px; font-size: 13.5px; }
.modal-actions .wide { grid-column: 1 / -1; }

/* ---------- info sections ---------- */
.info { max-width: 1080px; margin: 60px auto 0; padding: 0 20px; }
.info h2 { text-align: center; font-size: 30px; margin-bottom: 8px; }
.info > p.lead { text-align: center; color: var(--ink-soft); max-width: 640px; margin: 0 auto 30px; }
.cards3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mini-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); text-align: center;
}
.mini-card .ic { font-size: 34px; margin-bottom: 10px; }
.mini-card h3 { margin: 0 0 8px; font-size: 18px; }
.mini-card p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.55; }

footer.site {
  margin-top: 70px; border-top: 1px solid var(--line); padding: 30px 20px 40px;
  text-align: center; color: var(--ink-soft); font-size: 13px;
}
footer.site .brand { justify-content: center; margin-bottom: 10px; }

/* ---------- reveal page ---------- */
#revealPage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 30px 20px 60px; position: relative; overflow: hidden; }
#petals { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.petal {
  position: absolute; top: -30px; border-radius: 60% 40% 60% 40%;
  animation: fall linear infinite; opacity: 0.85;
}
@keyframes fall {
  0% { transform: translateY(-30px) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(340deg); }
}
.reveal-head { text-align: center; z-index: 2; margin-bottom: 6px; animation: fadeUp 0.8s ease-out both; }
.reveal-head h1 { font-size: clamp(28px, 5vw, 42px); margin: 0; }
.reveal-head h1 em { color: var(--rose); }
.reveal-head p { color: var(--ink-soft); margin: 8px 0 0; }
svg#viewStage { width: min(430px, 88vw); height: auto; z-index: 2; filter: drop-shadow(0 18px 30px rgba(178,90,110,0.2)); }
.bloom-in { animation: bloomIn 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes bloomIn { from { transform: scale(0); } to { transform: scale(1); } }
.fade-in { animation: fadeUp 0.9s ease-out both; }
.pop-in { animation: pop 0.5s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } }

#msgCard {
  z-index: 2; background: #fffdf9; border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); max-width: 440px; width: 100%; padding: 26px 28px; margin-top: 22px;
  text-align: center; animation: fadeUp 0.8s 1s ease-out both; position: relative;
}
#msgCard::before {
  content: "✉"; position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #f4a7b9, var(--rose));
  display: grid; place-items: center; font-size: 18px; box-shadow: var(--shadow);
}
#cardTo { font-family: var(--serif); font-size: 20px; color: var(--rose-deep); margin: 6px 0 10px; }
#cardMsg { font-size: 16.5px; line-height: 1.65; font-style: italic; margin: 0 0 12px; }
#cardFrom { font-size: 14px; color: var(--ink-soft); font-weight: 600; margin: 0; }
.reveal-cta { z-index: 2; margin-top: 28px; text-align: center; animation: fadeUp 0.8s 1.3s ease-out both; }
.reveal-cta p { color: var(--ink-soft); font-size: 14px; margin: 0 0 12px; }
.reveal-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .studio { grid-template-columns: 1fr; }
  .sidebar, .msg-panel { position: static; }
  .panel { max-height: 340px; }
  .cards3 { grid-template-columns: 1fr; }
  nav.links { display: none; }
}
