/* ──────────────────────────────────────────────────────────
   Garden AI · Monet's Garden Edition
   Impressionist watercolor — lavender, sage, mist, cream
   ────────────────────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  /* Watercolor palette */
  --cream:        #f6efe1;
  --cream-soft:   #faf4e6;
  --paper:        #fbf6ea;
  --lavender:     #b6a4d1;
  --lavender-dp:  #8d77b3;
  --lavender-pale:#e6dcef;
  --sage:         #9bb39c;
  --sage-deep:    #6b8a72;
  --sage-pale:    #d8e2d5;
  --mist:         #e7c9c5;
  --mist-deep:    #c89c98;
  --pond:         #a8c2c6;
  --pond-deep:    #6f9095;
  --wood:         #b89070;
  --wood-deep:    #8b6747;
  --wood-shadow:  #5e4731;
  --ink:          #4a4458;
  --ink-soft:     #6b6479;
  --ink-faint:    #968fa0;
  --gold:         #c8a868;

  --r-soft:   22px;
  --r-petal:  32px;
  --r-pebble: 14px;

  --shadow-paper: 0 1px 1px rgba(74,68,88,.04),
                  0 6px 18px rgba(141,119,179,.08),
                  0 24px 48px -16px rgba(107,138,114,.18);
}

/* ── Type ── */
body {
  font-family: 'EB Garamond', 'Cormorant Garamond', Georgia, serif;
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: "liga", "kern";
}

h1, h2, h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-weight: 500; letter-spacing: .01em; }

/* ──────────────────────────────────────────────────────────
   Watercolor paper backdrop
   Layered: cream wash + diffuse color blooms + paper grain
   ────────────────────────────────────────────────────────── */
body::before {
  content: "";
  position: fixed; inset: 0;
  z-index: 0;
  background:
    /* lavender bloom */
    radial-gradient(circle at 12% 18%, rgba(182,164,209,.42) 0%, rgba(182,164,209,0) 38%),
    /* sage bloom */
    radial-gradient(circle at 88% 14%, rgba(155,179,156,.38) 0%, rgba(155,179,156,0) 42%),
    /* mist pink bloom */
    radial-gradient(circle at 78% 88%, rgba(231,201,197,.45) 0%, rgba(231,201,197,0) 38%),
    /* pond blue-green */
    radial-gradient(circle at 8% 82%, rgba(168,194,198,.36) 0%, rgba(168,194,198,0) 40%),
    /* warm sun */
    radial-gradient(circle at 50% 50%, rgba(245,225,180,.20) 0%, rgba(245,225,180,0) 55%),
    var(--cream);
  filter: blur(0.4px);
}
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 0.29  0 0 0 0 0.27 0 0 0 0 0.34  0 0 0 0.10 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: .55;
  mix-blend-mode: multiply;
}

/* Floating decorative botanical accents (SVG, soft watercolor) */
.bg-decoration { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.bg-decoration svg { position: absolute; }
.bloom { animation: drift 26s ease-in-out infinite; opacity: .55; }
.bloom-1 { top: 4%;   left: -2%;  width: 220px; animation-delay: -3s; }
.bloom-2 { top: 38%;  right: -3%; width: 260px; animation-delay: -9s; opacity: .42; }
.bloom-3 { bottom: 6%; left: 4%;  width: 200px; animation-delay: -14s; opacity: .50; }
.bloom-4 { bottom: 22%; right: 6%; width: 180px; animation-delay: -19s; opacity: .38; }
@keyframes drift {
  0%,100% { transform: translateY(0) rotate(0deg); }
  50%     { transform: translateY(-18px) rotate(4deg); }
}

main, header, footer { position: relative; z-index: 2; }

/* ──────────────────────────────────────────────────────────
   Header — a journal opening page
   ────────────────────────────────────────────────────────── */
header {
  text-align: center;
  padding: 64px 24px 28px;
}
.kicker {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: var(--sage-deep);
  letter-spacing: .02em;
  transform: rotate(-2deg);
  display: inline-block;
  margin-bottom: 4px;
}
.logo {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-style: italic;
  font-size: 56px;
  color: var(--ink);
  letter-spacing: -.01em;
  line-height: 1.05;
}
.logo .amp {
  font-family: 'Caveat', cursive;
  font-style: normal;
  font-size: 70px;
  color: var(--lavender-dp);
  margin: 0 4px;
  vertical-align: -6px;
}
.tagline {
  margin-top: 14px;
  font-size: 17px;
  color: var(--ink-soft);
  font-style: italic;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}
.header-rule {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 22px;
  color: var(--lavender);
}
.header-rule .line {
  width: 70px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--lavender), transparent);
}
.header-rule .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lavender); }

/* ──────────────────────────────────────────────────────────
   Layout
   ────────────────────────────────────────────────────────── */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 22px 80px;
}

/* ──────────────────────────────────────────────────────────
   Journal card — watercolor paper
   ────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background:
    radial-gradient(circle at 20% 0%,  rgba(182,164,209,.10), transparent 55%),
    radial-gradient(circle at 100% 100%, rgba(155,179,156,.10), transparent 55%),
    var(--paper);
  border-radius: var(--r-petal);
  padding: 36px 36px 40px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-paper);
  border: 1px solid rgba(141,119,179,.10);
}
/* Soft deckle edge */
.card::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 8px at 50% 0%, rgba(74,68,88,.05), transparent 70%),
    radial-gradient(120% 8px at 50% 100%, rgba(74,68,88,.05), transparent 70%);
}

/* Step "chapter" label — handwritten ribbon */
.step-label {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: 'Caveat', cursive;
  font-size: 22px;
  color: var(--lavender-dp);
  margin-bottom: 6px;
  transform: rotate(-1deg);
}
.step-label::before {
  content: "";
  width: 28px; height: 1px;
  background: var(--lavender);
}

/* Card header (each step) */
.card-header {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px dashed rgba(141,119,179,.22);
}
.card-icon {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 34px;
  line-height: 1;
  color: var(--sage-deep);
  font-weight: 500;
}
.card-header h3 {
  font-size: 26px;
  color: var(--ink);
  font-style: italic;
  line-height: 1.1;
}
.card-hint {
  font-size: 14px;
  color: var(--ink-soft);
  margin-top: 4px;
  font-style: italic;
}
.ref-badge {
  margin-left: auto;
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: var(--mist-deep);
  background: rgba(231,201,197,.35);
  border: 1px solid rgba(200,156,152,.4);
  border-radius: 999px;
  padding: 2px 14px;
  white-space: nowrap;
}

/* Soft botanical divider */
.divider {
  border: none;
  margin: 30px 0;
  height: 22px;
  background: center / 200px no-repeat url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 22' fill='none' stroke='%23b6a4d1' stroke-linecap='round'><path d='M2 11 H78' stroke-width='1' opacity='.5'/><path d='M122 11 H198' stroke-width='1' opacity='.5'/><circle cx='100' cy='11' r='2.5' fill='%23b6a4d1' stroke='none'/><path d='M100 4 q-6 4 -4 7 t4 0 q2 -3 -4 -7z M100 18 q6 -4 4 -7 t-4 0 q-2 3 4 7z' fill='%239bb39c' fill-opacity='.55' stroke='none'/></svg>");
}

/* ──────────────────────────────────────────────────────────
   STEP 1 · Wooden picture-frame drop zone
   ────────────────────────────────────────────────────────── */
.drop-zone {
  position: relative;
  min-height: 240px;
  cursor: pointer;
  border-radius: 6px;
  /* wood frame — multi-layered */
  padding: 22px;
  background:
    linear-gradient(135deg, #d9b48c 0%, #b78a64 22%, #8b6747 50%, #b78a64 78%, #d9b48c 100%);
  box-shadow:
    inset 0 0 0 1px rgba(94,71,49,.4),
    inset 0 0 0 3px rgba(255,240,220,.18),
    inset 0 0 0 4px rgba(94,71,49,.3),
    inset 0 4px 8px rgba(255,240,220,.18),
    inset 0 -4px 8px rgba(94,71,49,.3),
    0 14px 30px -10px rgba(94,71,49,.45),
    0 4px 10px rgba(94,71,49,.18);
  transition: transform .25s ease, filter .25s ease;
  overflow: hidden;
}
/* faint wood grain */
.drop-zone::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='40'><filter id='w'><feTurbulence type='turbulence' baseFrequency='0.012 0.55' numOctaves='2' seed='5'/><feColorMatrix values='0 0 0 0 0.36  0 0 0 0 0.26 0 0 0 0 0.17  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23w)'/></svg>");
  mix-blend-mode: multiply;
  opacity: .55;
}
.drop-zone:hover { transform: translateY(-2px) rotate(-.25deg); }
.drop-zone.drag-over { filter: brightness(1.05); transform: translateY(-2px) rotate(-.5deg); }
.drop-zone.has-image { padding: 16px; }

.drop-content {
  position: relative;
  z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
  min-height: 196px;
  border-radius: 4px;
  background:
    radial-gradient(circle at 30% 20%, rgba(231,201,197,.35), transparent 55%),
    radial-gradient(circle at 80% 80%, rgba(168,194,198,.30), transparent 55%),
    var(--cream-soft);
  border: 1px solid rgba(94,71,49,.18);
  padding: 30px 24px;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
}
.drop-icon {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 48px;
  color: var(--sage-deep);
  line-height: 1;
  margin-bottom: 6px;
}
.drop-content > span:nth-child(2) {
  font-size: 19px;
  color: var(--ink);
  font-style: italic;
}
.file-types {
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: var(--ink-faint);
  font-style: normal;
  letter-spacing: .02em;
}
.preview-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
  border-radius: 4px;
  position: relative;
  z-index: 1;
  box-shadow: inset 0 0 0 1px rgba(94,71,49,.25);
}
.remove-btn {
  position: absolute; top: 32px; right: 32px;
  width: 32px; height: 32px; border-radius: 50%;
  border: none;
  background: rgba(74,68,88,.75);
  color: #fff; font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 2;
  backdrop-filter: blur(4px);
  transition: background .2s;
}
.remove-btn:hover { background: var(--mist-deep); }

/* ──────────────────────────────────────────────────────────
   STEP 2/3/4 · Inputs — handwritten on cream paper
   ────────────────────────────────────────────────────────── */
textarea, input[type="text"] {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(141,119,179,.25);
  border-radius: var(--r-pebble);
  background:
    linear-gradient(transparent 0 31px, rgba(141,119,179,.10) 31px 32px) 0 4px / 100% 32px,
    var(--cream-soft);
  color: var(--ink);
  font-family: 'EB Garamond', 'Cormorant Garamond', serif;
  font-size: 17px;
  line-height: 32px;
  resize: vertical;
  transition: border-color .25s, box-shadow .25s;
}
input[type="text"] {
  resize: none;
  background: var(--cream-soft);
  line-height: 1.4;
}
textarea::placeholder, input::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}
textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--lavender);
  box-shadow: 0 0 0 4px rgba(182,164,209,.18);
}

/* ──────────────────────────────────────────────────────────
   Reference image uploader — pressed flowers grid
   ────────────────────────────────────────────────────────── */
.ref-uploader { width: 100%; }
.ref-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-start;
}
.ref-thumb {
  position: relative;
  width: 92px; height: 92px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--cream-soft);
  box-shadow:
    0 1px 0 rgba(255,255,255,.6),
    0 2px 6px rgba(141,119,179,.18),
    inset 0 0 0 1px rgba(141,119,179,.18);
  transform: rotate(-1.5deg);
  transition: transform .2s;
}
.ref-thumb:nth-child(even) { transform: rotate(2deg); }
.ref-thumb:hover { transform: rotate(0) scale(1.04); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ref-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border-radius: 50%;
  border: none;
  background: rgba(74,68,88,.7);
  color: #fff; font-size: 11px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  backdrop-filter: blur(3px);
}
.ref-del:hover { background: var(--mist-deep); }

.ref-add-btn {
  width: 92px; height: 92px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--lavender-dp);
  font-family: 'Caveat', cursive;
  font-size: 15px;
  background:
    radial-gradient(circle at 50% 50%, rgba(230,220,239,.6), rgba(230,220,239,0) 70%),
    var(--cream-soft);
  border: 1.5px dashed rgba(141,119,179,.45);
  transition: all .25s;
  flex-shrink: 0;
  text-align: center;
  padding: 4px;
}
.ref-add-btn:hover {
  border-color: var(--lavender);
  background:
    radial-gradient(circle at 50% 50%, rgba(230,220,239,.9), rgba(230,220,239,0) 70%),
    var(--cream-soft);
  transform: rotate(-1deg);
}
.ref-add-icon {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 28px;
  line-height: 1;
  color: var(--lavender-dp);
  font-weight: 400;
}
.ref-count-row {
  margin-top: 12px;
  font-family: 'Caveat', cursive;
  font-size: 17px;
  color: var(--ink-soft);
}

/* ──────────────────────────────────────────────────────────
   Options row
   ────────────────────────────────────────────────────────── */
.options-row {
  display: flex; gap: 18px; align-items: flex-end;
}
.option-group { display: flex; flex-direction: column; gap: 8px; flex-shrink: 0; }
.option-group label {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  color: var(--sage-deep);
  font-weight: 500;
  letter-spacing: .01em;
}
.flex-1 { flex: 1; }
.select-wrapper { position: relative; min-width: 160px; }
.select-wrapper::after {
  content: '⌄';
  position: absolute; right: 16px; top: 50%;
  transform: translateY(-65%);
  color: var(--lavender-dp);
  pointer-events: none;
  font-size: 18px;
}
select {
  width: 100%;
  padding: 13px 38px 13px 16px;
  border: 1px solid rgba(141,119,179,.25);
  border-radius: var(--r-pebble);
  background: var(--cream-soft);
  color: var(--ink);
  font-family: inherit; font-size: 16px;
  appearance: none; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
select:focus { outline: none; border-color: var(--lavender); box-shadow: 0 0 0 4px rgba(182,164,209,.18); }

/* ──────────────────────────────────────────────────────────
   Generate area — a wax seal / ribbon
   ────────────────────────────────────────────────────────── */
.generate-area {
  text-align: center;
  margin: 36px 0 40px;
  position: relative;
}
.generate-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 12px;
  padding: 18px 56px;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 500;
  color: var(--cream-soft);
  letter-spacing: .02em;
  background:
    radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), transparent 50%),
    linear-gradient(135deg, var(--lavender-dp) 0%, #7a6299 60%, var(--lavender-dp) 100%);
  border: none;
  border-radius: 100px;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255,255,255,.3) inset,
    0 -2px 8px rgba(74,68,88,.2) inset,
    0 10px 28px -6px rgba(141,119,179,.55),
    0 4px 10px rgba(74,68,88,.15);
  transition: all .25s ease;
}
.generate-btn .sparkle {
  font-family: 'Caveat', cursive;
  font-style: normal;
  font-size: 26px;
  color: #f0e6d2;
}
.generate-btn.small { padding: 12px 32px; font-size: 18px; }
.generate-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow:
    0 1px 0 rgba(255,255,255,.3) inset,
    0 -2px 8px rgba(74,68,88,.2) inset,
    0 16px 36px -6px rgba(141,119,179,.65),
    0 6px 14px rgba(74,68,88,.18);
}
.generate-btn:active:not(:disabled) { transform: translateY(-1px); }
.generate-btn:disabled { opacity: .4; cursor: not-allowed; filter: saturate(.4); }
.api-note {
  margin-top: 14px;
  font-family: 'Caveat', cursive;
  font-size: 16px;
  color: var(--ink-faint);
  font-style: normal;
}

/* ──────────────────────────────────────────────────────────
   RESULT · a watercolor on a gallery wall
   ────────────────────────────────────────────────────────── */
.result-card { padding: 36px 36px 40px; }
.result-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
}
.result-header h2 {
  font-size: 32px;
  font-style: italic;
  color: var(--ink);
  font-weight: 500;
}
.result-header h2::before {
  content: "~ ";
  color: var(--lavender-dp);
  font-family: 'Caveat', cursive;
  font-style: normal;
}
.icon-btn {
  padding: 9px 22px;
  border: 1px solid rgba(141,119,179,.3);
  border-radius: 999px;
  background: var(--cream-soft);
  color: var(--ink);
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
}
.icon-btn:hover { background: var(--lavender-pale); border-color: var(--lavender); }

/* Gallery wall + frame for the result image */
.canvas-wrapper {
  position: relative;
  margin: 0 auto 28px;
  padding: 28px 28px 50px;
  background:
    /* picture light */
    radial-gradient(ellipse 70% 35% at 50% -5%, rgba(255,245,220,.55), transparent 70%),
    /* wall texture */
    linear-gradient(180deg, #efe6d3 0%, #e8dec9 100%);
  border-radius: 4px;
  box-shadow:
    inset 0 0 60px rgba(94,71,49,.08),
    0 2px 0 rgba(255,255,255,.5) inset;
  line-height: 0;
}
/* nail above the frame */
.canvas-wrapper::before {
  content: "";
  position: absolute;
  top: 8px; left: 50%;
  width: 8px; height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d4a878, #6b4f30);
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  z-index: 3;
}
/* hanging wire */
.canvas-wrapper::after {
  content: "";
  position: absolute;
  top: 12px; left: 50%;
  width: 1px; height: 18px;
  margin-left: -.5px;
  background: rgba(74,68,88,.4);
  z-index: 2;
}
.result-img {
  width: 100%;
  display: block;
  border-radius: 2px;
  /* gold inner mat + soft frame */
  padding: 14px;
  background:
    linear-gradient(135deg, #f3e5c8 0%, #e6d3a4 50%, #f3e5c8 100%);
  box-shadow:
    inset 0 0 0 1px rgba(94,71,49,.2),
    inset 0 0 0 14px transparent,
    inset 14px 14px 0 -1px rgba(94,71,49,.15),
    0 16px 36px -10px rgba(94,71,49,.45),
    0 6px 14px rgba(94,71,49,.2);
  box-sizing: content-box;
}
/* caption plate */
.canvas-wrapper .caption {
  position: absolute;
  bottom: 14px; left: 50%;
  transform: translateX(-50%);
  font-family: 'Caveat', cursive;
  font-size: 18px;
  color: var(--ink-soft);
  font-style: normal;
  letter-spacing: .04em;
}
#maskCanvas {
  position: absolute;
  top: 42px; left: 42px;
  width: calc(100% - 84px) !important;
  height: calc(100% - 134px) !important;
  border-radius: 2px;
  cursor: crosshair;
  touch-action: none;
}
.edit-hint {
  position: absolute;
  top: 50px; left: 50%;
  transform: translateX(-50%);
  background: rgba(74,68,88,.85);
  color: #fbf6ea;
  font-family: 'Caveat', cursive;
  font-size: 19px;
  padding: 6px 20px;
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 4;
  backdrop-filter: blur(6px);
}

/* ──────────────────────────────────────────────────────────
   Edit toolbar
   ────────────────────────────────────────────────────────── */
.edit-toolbar {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 16px;
  padding: 16px 20px;
  background:
    radial-gradient(circle at 100% 0%, rgba(182,164,209,.15), transparent 70%),
    var(--cream-soft);
  border: 1px solid rgba(141,119,179,.22);
  border-radius: var(--r-soft);
  margin-bottom: 18px;
}
.brush-control { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; }
.brush-label {
  font-family: 'Caveat', cursive;
  font-size: 19px;
  color: var(--sage-deep);
  white-space: nowrap;
}
.brush-control input[type="range"] { flex: 1; accent-color: var(--lavender-dp); }
.brush-size-val {
  font-family: 'Caveat', cursive;
  font-size: 17px; color: var(--ink-soft); min-width: 44px;
}
.toolbar-actions { display: flex; gap: 10px; }
.toolbar-btn {
  padding: 8px 18px;
  border: 1px solid rgba(141,119,179,.3);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
}
.toolbar-btn:hover { border-color: var(--lavender); background: var(--lavender-pale); }
.toolbar-btn.danger:hover { border-color: var(--mist-deep); color: var(--mist-deep); background: rgba(231,201,197,.3); }

/* ──────────────────────────────────────────────────────────
   Edit prompt area
   ────────────────────────────────────────────────────────── */
.edit-prompt-area { margin-bottom: 20px; }
.edit-section-label {
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 20px;
  color: var(--lavender-dp);
  margin-bottom: 10px;
}
.edit-prompt-area textarea { margin-bottom: 14px; }
.edit-ref-row { margin-bottom: 12px; }
.toggle-ref-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  border: 1px solid rgba(141,119,179,.3);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
}
.toggle-ref-btn:hover { background: var(--lavender-pale); border-color: var(--lavender); }
.toggle-ref-count { font-family: 'Caveat', cursive; font-style: normal; font-size: 17px; color: var(--lavender-dp); }
.toggle-arrow { font-size: 12px; color: var(--ink-faint); transition: transform .25s; }
.toggle-arrow.open { transform: rotate(90deg); }

.edit-ref-panel {
  background:
    radial-gradient(circle at 0% 0%, rgba(231,201,197,.25), transparent 60%),
    var(--cream-soft);
  border: 1px solid rgba(141,119,179,.22);
  border-radius: var(--r-soft);
  padding: 18px;
  margin-bottom: 16px;
}
.edit-ref-hint {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}

.edit-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.cancel-btn {
  padding: 11px 26px;
  border: 1px solid rgba(141,119,179,.25);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 15px;
  cursor: pointer;
  transition: all .2s;
}
.cancel-btn:hover { background: var(--cream-soft); }

/* Result action bar */
.result-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.action-btn {
  flex: 1; min-width: 130px;
  padding: 13px 18px;
  border: 1px solid rgba(141,119,179,.28);
  border-radius: 999px;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 16px;
  cursor: pointer;
  transition: all .25s;
  text-align: center;
  background: var(--paper);
  color: var(--ink);
}
.action-btn:hover { background: var(--lavender-pale); border-color: var(--lavender); transform: translateY(-1px); }
.action-btn.primary {
  background: linear-gradient(135deg, var(--sage-deep), #5a7660);
  color: var(--cream-soft);
  border-color: transparent;
  box-shadow: 0 6px 16px -4px rgba(107,138,114,.45);
}
.action-btn.primary:hover { background: linear-gradient(135deg, #5a7660, var(--sage-deep)); border-color: transparent; }
.action-btn.ghost { background: transparent; color: var(--ink-soft); }
.action-btn.ghost:hover { background: var(--cream-soft); }
.in-edit-mode .result-actions { display: none; }
.in-edit-mode .result-header .icon-btn { display: none; }

/* ──────────────────────────────────────────────────────────
   Loading — watercolor blooming
   ────────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(74,68,88,.45);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.loading-card {
  background:
    radial-gradient(circle at 30% 20%, rgba(182,164,209,.25), transparent 60%),
    radial-gradient(circle at 80% 90%, rgba(155,179,156,.25), transparent 60%),
    var(--paper);
  border-radius: var(--r-petal);
  padding: 50px 56px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(74,68,88,.35);
  max-width: 400px; width: 90%;
  border: 1px solid rgba(141,119,179,.22);
}
.garden-loader {
  display: flex; gap: 10px; justify-content: center;
  margin-bottom: 26px;
}
.garden-loader span {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: block;
  animation: bloom 1.6s ease-in-out infinite;
}
.garden-loader span:nth-child(1) { background: var(--lavender); animation-delay: 0s; }
.garden-loader span:nth-child(2) { background: var(--sage); animation-delay: .15s; }
.garden-loader span:nth-child(3) { background: var(--mist); animation-delay: .3s; }
.garden-loader span:nth-child(4) { background: var(--pond); animation-delay: .45s; }
.garden-loader span:nth-child(5) { background: var(--gold); animation-delay: .6s; }
@keyframes bloom {
  0%, 100% { transform: scale(.6); opacity: .4; filter: blur(0); }
  50%      { transform: scale(1.4); opacity: 1; filter: blur(1px); }
}
.loading-card h3 {
  font-size: 24px; font-style: italic;
  color: var(--ink); margin-bottom: 8px;
}
.loading-card p {
  font-family: 'Caveat', cursive;
  font-size: 17px; color: var(--ink-soft);
  margin-bottom: 24px;
}
.progress-bar {
  height: 4px; background: var(--lavender-pale);
  border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--lavender), var(--sage), var(--mist));
  border-radius: 999px;
  animation: progress 3s ease-in-out infinite;
}
@keyframes progress { 0% { width: 5% } 50% { width: 80% } 100% { width: 95% } }

/* Toast */
.toast {
  position: fixed; bottom: 32px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--cream-soft);
  padding: 14px 22px;
  border-radius: 999px;
  display: flex; align-items: center; gap: 12px;
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 15px;
  z-index: 200;
  max-width: 540px; width: 90%;
  box-shadow: 0 12px 36px rgba(74,68,88,.35);
  animation: slideUp .35s ease;
}
@keyframes slideUp { from { transform: translateX(-50%) translateY(20px); opacity: 0; } to { transform: translateX(-50%) translateY(0); opacity: 1; } }
.toast-icon { font-size: 18px; flex-shrink: 0; color: var(--mist); }
.toast-msg { flex: 1; line-height: 1.5; }
.toast-close {
  background: none; border: none; color: var(--ink-faint);
  cursor: pointer; font-size: 16px; padding: 2px 6px;
}
.toast-close:hover { color: var(--cream-soft); }

/* Footer */
footer {
  text-align: center;
  padding: 40px 24px 60px;
  font-family: 'Caveat', cursive;
  font-size: 19px;
  color: var(--ink-soft);
}
footer .flourish { color: var(--lavender-dp); margin: 0 8px; }
footer strong { color: var(--ink); font-weight: 500; }

/* Responsive */
@media (max-width: 600px) {
  .logo { font-size: 42px; }
  .logo .amp { font-size: 54px; }
  main { padding: 16px 14px 80px; }
  .card { padding: 26px 22px 30px; border-radius: 24px; }
  .card-header h3 { font-size: 22px; }
  .options-row { flex-direction: column; align-items: stretch; }
  .generate-btn { width: 100%; justify-content: center; }
  .result-actions { flex-direction: column; }
  .action-btn { width: 100%; }
  .canvas-wrapper { padding: 18px 18px 38px; }
  .result-img { padding: 8px; }
  #maskCanvas { top: 26px; left: 26px; width: calc(100% - 52px) !important; height: calc(100% - 90px) !important; }
}
