:root {
  --bg-top: #bfe6c8;
  --bg-bot: #8fd0a3;
  --panel: #ffffff;
  --ink: #234234;
  --muted: #6b8a78;
  --accent: #1f7a4d;
  --accent-2: #2fae6b;
  --soil: #6e4a32;
  --shadow: 0 6px 20px rgba(20, 60, 40, 0.18);
  --radius: 18px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ── Opening poster splash ───────────────────────────────────────────────── */
.splash {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: #0f1f17;
  transition: opacity .6s ease;
}
.splash img { width: 100%; height: 100%; object-fit: contain; }
.splash.hide { opacity: 0; pointer-events: none; }
.splash.gone { display: none; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: url('/public/backgroundTile.png') repeat;
  overscroll-behavior: none;
  user-select: none;
}
/* Centre the 9:19 frame; the gradient above shows as letterbox bars on wider screens. */
body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; }

/* The locked 9:19 frame: the largest 9:19 rectangle that fits the viewport, centred
   (the body letterboxes the rest with the page gradient). container-type makes it the
   reference for the app's cqw/cqh sizing AND the containing block for the fixed
   overlays (sheet/toast/modal), so they stay inside the frame too. */
#frame {
  --fh: min(100dvh, calc(100vw * 19 / 9));
  --pad: calc(var(--fh) * 0.05);   /* top/bottom gap; shared so overlays can match the canvas */
  position: relative;
  width: min(100vw, calc(100dvh * 9 / 19));
  height: var(--fh);
  padding: var(--pad) 0;   /* gap above & below the playable canvas (border-box shrinks #app) */
  overflow: hidden;
  container-type: size;
  transform: translateZ(0);   /* guarantees #frame is the containing block for ALL fixed overlays (helper, sheets, modal) */
}
/* The app fills the frame. */
#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* ── Top bar ──────────────────────────────────────────────────────────────── */
#topbar {
  position: relative; z-index: 10;   /* lift its backing/shadow above the screens below */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bot));   /* the header's backing, full frame width */
  box-shadow: var(--shadow);
}
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: .3px; white-space: nowrap; }
.topbar-btn {
  border: none; border-radius: 999px; padding: 7px 12px;
  font-size: .8rem; font-weight: 800; white-space: nowrap; cursor: pointer;
  background: var(--accent); color: #fff; box-shadow: var(--shadow);
}
.topbar-btn:disabled { background: #b9cabf; color: #eef5f0; box-shadow: none; cursor: default; }
.stats { display: flex; gap: 8px; margin-left: auto; } /* pushed to the right */
.stat {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: .95rem;
  box-shadow: var(--shadow);
}
.stat b { color: var(--accent); }

/* ── Greenhouse grid ──────────────────────────────────────────────────────────── */
/* Two columns of potting windows, three rows each. Cells flow down the first
   column, then the second — so the right column is the second set of three. */
/* A single row of potted flowers, left to right. Scrolls sideways if the row
   gets narrower than the pots want to be. */
#greenhouse {
  flex: 1; position: relative; overflow: hidden; min-height: 0;
  background: #cfe6d2;
}
/* Backdrop frame at the background image's aspect (2160×3840), covering the
   scene. The art fills it; the plots are %-positioned children, so they stay
   anchored to the painting and scale/move with it — exactly like the shop. */
.greenhouse-frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  aspect-ratio: 2160 / 3840;
  min-width: 100%; min-height: 100%;
}
.greenhouse-bg-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ── Greenhouse swipe carousel ────────────────────────────────────────────── */
/* One pot per slide; the track slides horizontally to browse. The backdrop stays
   put behind the clipped viewport. touch-action: pan-y lets us own the horizontal
   drag while leaving vertical gestures to the browser. */
.gh-carousel { position: absolute; inset: 0; overflow: hidden; z-index: 2; touch-action: pan-y; }
.gh-track { position: absolute; inset: 0; display: flex; will-change: transform; transition: transform .28s ease; }
.gh-slide { position: relative; flex: 0 0 100%; height: 100%; }
.gh-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 6;
  width: 44px; height: 44px; padding: 0; border: none; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; line-height: 1; font-weight: 800;
  background: rgba(20, 20, 28, .5); color: #fff; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.gh-prev { left: 3%; }
.gh-next { right: 3%; }
.gh-arrow.hidden { display: none; }
.gh-dots { position: absolute; left: 50%; bottom: 2%; transform: translateX(-50%); display: flex; gap: 8px; z-index: 6; }
.gh-dot {
  width: 11px; height: 11px; padding: 0; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .5); box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.gh-dot.active { background: var(--accent); }
/* Fixed pot-action bar: same #app coordinate space and Y as the To Shop button
   (bottom: 14%), centred. Shows the buttons for whichever pot is in view. */
.gh-actions {
  position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%);
  z-index: 60; display: flex; gap: 6px; justify-content: center;   /* above #toolbar (z50) so it stays tappable */
  width: min(360px, 86%); pointer-events: auto;
}
.gh-actions.hidden { display: none; }
/* Pot info card: a child of #greenhouse (so it shares the flower's stacking context)
   anchored at the top — #greenhouse already begins just beneath the banner. z-index 1
   keeps it BEHIND the carousel/flower (z-index 2) yet above the backdrop. Centred at
   80% of the screen width; shows the pot in view. */
.gh-card {
  position: absolute; left: 50%; top: 6px; transform: translateX(-50%); z-index: 1;
  width: 80cqw; aspect-ratio: 4 / 3;
  container-type: size;       /* so the name/badge can size in cqh/cqw of the card */
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start;
  padding: 12px 14px; min-width: 0;
  background: url('/public/flowerCard.png') center / 100% 100% no-repeat;
  border-radius: 14px; box-shadow: var(--shadow); cursor: pointer;
}
.gh-card.hidden { display: none; }

/* One plot = a flower-in-pot stage with its card + buttons overlaid. Anchored to
   the backdrop by its centre (left/top/width set inline, in image-%). */
.plot-cell {
  position: absolute; transform: translate(-50%, -50%);
  aspect-ratio: 3 / 5;      /* gives the stack vertical room; scales with width */
  display: flex; flex-direction: column; gap: 8px;
}
/* The pot stands at the bottom; the flower window grows out of it. */
/* The stage is the sizing container; the planter is a square that fits it and
   scales with it (cqw/cqh track the stage on resize). */
/* z-index lifts the whole stage (pot + flower) in front of the info card. The
   stage is its own stacking context (container-type: size → layout containment),
   so the flower can only out-layer the card by raising the stage itself. */
.plot-stage { position: relative; flex: 1; min-height: 0; container-type: size; z-index: 3; }
.planter {
  position: absolute; left: 50%; bottom: -15%; transform: translateX(-50%);
  /* Size to the cell (which scales with the backdrop) — no viewport cap, so the
     pot tracks the art. cqh guards against overflow in the tall cell.
     ×3: pot + flower scaled to 300% (the flower is a % of the pot, so it follows). */
  width: calc(min(96cqw, 56cqh) * 3);
  aspect-ratio: 1 / 1;          /* matches the square pot.png */
}
/* The pot fills the planter; everything below is expressed as a fraction of it,
   so pot + flower always scale and stay anchored together. */
.plot-pot {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center bottom;
  pointer-events: none; z-index: 1;   /* behind the plant — the flower draws in front */
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .3));
}
/* The flower: base sits at the pot's soil line (a % up the pot), width is a
   multiple of the pot's width, height follows via aspect-ratio. Grows up out of
   the soil and scales with the pot. */
.plot-stage .plot {
  position: absolute; left: 43%; bottom: 37%; transform: translateX(-50%);
  width: 99%; aspect-ratio: 3 / 4;
  z-index: 2;
}
.plot-stage .plot:active { transform: translateX(-50%) scale(0.96); }
.plot-panel {
  /* The pot's info card, anchored to the TOP of its carousel slide so it rests just
     under the top banner — centred on screen at 80% of the screen width (vw, so it's
     independent of the slide/frame size). It slides with its pot, one card per pot. */
  position: absolute; left: 50%; top: 3%; transform: translateX(-50%);   /* rests just under the top banner */
  width: 80cqw; aspect-ratio: 4 / 3; z-index: 2;   /* behind the stage so 3D flowers draw in front */
  container-type: size;   /* so the rarity badge can size in cqh/cqw of the card */
  min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-start;
  padding: 12px 14px; min-width: 0;
  background: url('/public/flowerCard.png') center / 100% 100% no-repeat;
  border-radius: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
}
/* The name sits in the card's header band; its font is auto-fit in JS so any
   name length shrinks to fit this area. */
.card-header {
  height: 24%; width: 100%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.card-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.panel-name { font-weight: 800; line-height: 1.05; white-space: nowrap; text-align: center; position: relative; top: calc(20px - 7cqh); }
.panel-status { font-size: 1.148rem; }
.panel-serves { font-size: 0.91rem; line-height: 1.2; text-align: center; position: relative; top: -6%; }
.panel-serves b { color: var(--accent); }
/* The gloss copy drops to its own line, beneath the domain token. */
.panel-serves .muted { display: block; }
.panel-top { display: flex; flex-direction: column; gap: 6px; }
.panel-actions { display: flex; gap: 6px; margin-top: auto; } /* pinned to the panel bottom */
/* Action buttons as their own layer, centered on the pot. */
.plot-actions {
  position: absolute; left: 50%; bottom: 0%; transform: translateX(calc(-50% - 50px));
  z-index: 4;                 /* above the info card, pot, and flower */
  display: flex; gap: 6px; justify-content: center; flex-wrap: wrap;
  width: 88%;
}
.panel-btn {
  flex: 1; border: none; border-radius: 10px; padding: 16px 2px;
  font-size: 0.8rem; font-weight: 800; color: #fff; cursor: pointer;
  background: var(--accent);
}
.panel-btn:active { transform: translateY(1px); }
.panel-btn:disabled { cursor: default; }
.panel-btn.waiting { background: rgba(120, 132, 124, .85); }   /* watering on cooldown — shows the countdown */
.panel-btn.cut { background: #c85b8e; }
/* No window box anymore — the flower sits transparently against the greenhouse
   backdrop. The element is just the clickable area holding the 3D canvas. */
.plot {
  position: relative;
  min-height: 0;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition: transform .12s ease;
}
.plot:active { transform: translateX(-50%) scale(0.96); }
.plot.breedable { animation: pulse 1.4s ease-in-out infinite; }
/* Selected breed pick: a bobbing down-arrow pointing at the pot (no bounding box). */
.plot.selected::after {
  content: '⬇'; position: absolute; left: 50%; top: -8%; z-index: 5;
  transform: translateX(-50%); pointer-events: none;
  font-size: clamp(1.6rem, 7cqmin, 4rem); line-height: 1;
  color: #ff4f97; text-shadow: 0 2px 6px rgba(0, 0, 0, .45);
  animation: arrow-bob .8s ease-in-out infinite;
}
@keyframes arrow-bob {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(22%); }
}
@keyframes pulse {
  0%, 100% { box-shadow: inset 0 -6px 10px rgba(0,0,0,.08), 0 0 0 2px #ff7eb6; }
  50% { box-shadow: inset 0 -6px 10px rgba(0,0,0,.08), 0 0 0 4px #ff7eb6aa; }
}

.plot-art { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; }
.plot-art canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.flower-svg { width: 100%; height: 100%; display: block; }
.flower-img { width: 100%; height: 100%; display: block; object-fit: cover; }
.live-host { position: relative; overflow: hidden; }
.live-host canvas { position: absolute; inset: 0; }
.plot-empty {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; color: #ffffff; opacity: .65; font-weight: 700;
  bottom: 26%; top: auto; height: 74%;
}
.plot-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: .62rem; text-align: center; padding: 2px 3px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plot.bloomed .plot-label { background: rgba(47, 174, 107, 0.92); color: #fff; }

.sway { transform-box: fill-box; transform-origin: bottom center; animation: sway 3.4s ease-in-out infinite; }
@keyframes sway { 0%, 100% { transform: rotate(-2.5deg); } 50% { transform: rotate(2.5deg); } }

/* ── Toolbar ──────────────────────────────────────────────────────────────── */
#toolbar {
  position: relative; z-index: 50;   /* keep the bottom bar above floating overlays so its buttons stay clickable */
  display: flex;
  gap: 10px;
  padding: 10px 14px calc(env(safe-area-inset-bottom) + 12px);
}
.tool {
  position: relative;
  flex: 1;
  border: none;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 10px 6px;
  font-size: 1.4rem;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer;
  transition: transform .1s ease;
}
.tool span { font-size: .72rem; font-weight: 700; color: var(--muted); }
.tool:active { transform: translateY(2px); }
.tool.active { background: var(--accent); }
.tool.active span { color: #eafff3; }

/* Count badge on a toolbar button (e.g. the basket) — hidden at zero. */
.tool .badge {
  position: absolute; top: 4px; right: 8px;
  min-width: 18px; height: 18px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 800; line-height: 1;
  color: #fff; background: #e0567f; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}
.tool .badge.hidden { display: none; }

/* Screen switching: hide helpers */
#greenhouse.hidden, #shop.hidden, .action-row.hidden, .tool-tab.hidden { display: none; }

/* Toolbar becomes: context actions over the two screen tabs */
#toolbar { flex-direction: column; }
.tool-actions { display: flex; }
.action-row { display: flex; gap: 10px; flex: 1; }
.tool-tabs { display: flex; gap: 10px; }
.tool-tab {
  flex: 1; border: none; border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow);
  padding: 12px 6px; cursor: pointer; transition: transform .1s ease;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 1.2rem; color: var(--muted);
}
.tool-tab span { font-size: .95rem; font-weight: 800; }
.tool-tab:active { transform: translateY(2px); }
.tool-tab.active { background: var(--accent); color: #fff; }
.tool-tab.active span { color: #fff; }

/* "To Shop" overlay button on the greenhouse — anchored to the lower-right. */
.to-shop {
  position: absolute; right: 3%; bottom: 19%; left: auto; top: auto;
  z-index: 30;
  border: none; border-radius: 999px; padding: 9px 16.5px;
  font-size: 0.75rem; font-weight: 800; cursor: pointer; white-space: nowrap;
  background: var(--accent); color: #fff; box-shadow: var(--shadow);
}
.to-shop:active { transform: translateY(1px); }
.to-shop.hidden { display: none; }
/* The Greenhouse pill on the shop screen — same look as "To Shop", mirrored to
   the left side (20% from the screen's left edge) with a left-pointing arrow. */
/* The Greenhouse pill keeps the original (un-shrunk) To Shop size, anchored to
   the left edge of the frame (no centering transform). */
.to-greenhouse {
  left: 2%; right: auto; top: auto; bottom: 8px; transform: none;   /* just above the bottom bar */
  padding: clamp(10px, 1.9cqw, 36px) clamp(18px, 3.4cqw, 66px);
  font-size: clamp(1rem, 3.4cqw, 3rem);
}
.to-greenhouse:active { transform: translateY(1px); }

/* ── Shop screen (a flat scene) ───────────────────────────────────────────── */
.shop-screen { flex: 1; position: relative; overflow: hidden; }
.shop-scene { position: absolute; inset: 0; overflow: hidden; }
.shop-layer { position: absolute; left: 0; right: 0; }

/* Backdrop frame: a box at the background image's aspect (2160×3840) that covers
   the scene. The bg image fills it, and the for-sale bouquets are %-positioned
   children — so they stay anchored to the art and scale/move with it. */
.shop-frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  aspect-ratio: 2160 / 3840;
  min-width: 100%; min-height: 100%;
}
.shop-bg-img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.shop-bouquet {
  position: absolute; width: 27%;
  transform: translate(-50%, -100%);   /* anchored bottom-centre on its (x,y) point */
  transform-origin: bottom center;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .4));
  pointer-events: none;   /* display only — visitors buy them, the player can't tap-sell */
}

/* Domain tag for a displayed bouquet — pinned at the bouquet's base (same x,y
   anchor point). Tells the player WHAT need the bouquet addresses (the colour-
   coded domain) and VIA WHAT attributes (its colour + bloom form). Non-interactive
   so taps fall through to the bouquet for serving a customer / selling. */
.shop-tag {
  position: absolute; transform: translate(-50%, 2%);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  pointer-events: none; text-align: center; line-height: 1.1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
}
.shop-tag-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(22, 17, 26, .82); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  border: 1px solid color-mix(in srgb, var(--dom) 60%, transparent);
  color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.shop-tag-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dom); box-shadow: 0 0 5px var(--dom); }
.shop-tag-attrs {
  font-size: 9.5px; font-weight: 600; color: #f1ebe6;
  background: rgba(22, 17, 26, .66); padding: 1px 6px; border-radius: 999px; white-space: nowrap;
}

/* The shared domain chip — used inline in the seed stall, plot panels, and the
   served-customer reveal. Same colour token as the shelf tag, sized for body text. */
.dom-chip {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: middle;
  padding: 1px 9px 1px 7px; border-radius: 999px;
  background: color-mix(in srgb, var(--dom) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--dom) 55%, transparent);
  color: color-mix(in srgb, var(--dom) 72%, #fff); font-weight: 700; white-space: nowrap;
}
.dom-chip .dom-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dom); box-shadow: 0 0 5px var(--dom); flex: none; }
.cust-need-reveal { font-size: 13px; margin: 2px 0 4px; text-align: center; }
.cust-need-reveal .dom-chip { color: color-mix(in srgb, var(--dom) 50%, #fff); }

/* ── Customer at the counter — their card art with the quote written into the
   blank parchment panel on the right side ─────────────────────────────────── */
.shop-customer {
  top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start; gap: 8px; padding-top: 16%; pointer-events: none; z-index: 40;
}
.cust-card {
  position: relative; pointer-events: auto;
  width: 90%; max-width: 960px; aspect-ratio: 3 / 2;
  background-position: center; background-repeat: no-repeat; background-size: 100% 100%;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .4));
  /* background-image (the customer's card) is set inline per visitor */
}
/* The quote sits over the card's right-hand parchment panel. */
.cust-quote {
  position: absolute; left: 55.5%; top: 15%; width: 35%; height: 68%;
  transform: translateX(-10px);
  display: flex; align-items: center; justify-content: flex-start; overflow: hidden;
}
.cust-quote-txt {
  width: 100%; text-align: left; color: #3a2f22; font-style: italic; font-weight: 600;
  line-height: 1.34; font-family: Georgia, 'Times New Roman', serif;
  /* font-size is auto-fit in JS to fill the panel without overflowing */
}
.cust-hint {
  pointer-events: none; font-size: .9rem; font-weight: 400; color: #fff;
  background: rgba(0, 0, 0, .5); padding: 4px 12px; border-radius: 999px;
}
/* Served-customer outcome: the Continue button sits below the card, to the right. */
.cust-resolve-bar {
  pointer-events: auto; width: 90%; max-width: 960px;
  display: flex; align-items: center; justify-content: flex-end; gap: 16px;
}
.cust-reward { color: #fff; font-weight: 700; opacity: .85; }
.cust-continue {
  border: none; border-radius: 999px; cursor: pointer; color: #fff; background: var(--accent);
  font-weight: 800; padding: clamp(8px, 1.3cqw, 16px) clamp(16px, 2.6cqw, 30px);
  font-size: clamp(.9rem, 2cqw, 1.5rem); box-shadow: var(--shadow);
}
.cust-continue:active { transform: translateY(1px); }
/* Open / Close the shop. */
.shop-toggle {
  position: absolute; top: 3%; right: 3%; z-index: 45; cursor: pointer; border: none;
  border-radius: 999px; padding: clamp(8px, 1.3cqw, 16px) clamp(14px, 2.4cqw, 28px);
  font-weight: 800; font-size: clamp(.85rem, 2cqw, 1.4rem);
  background: rgba(20, 20, 28, .78); color: #fff; box-shadow: var(--shadow);
}
.shop-toggle:active { transform: translateY(1px); }
.cust-resolution { font-size: 1.1rem; line-height: 1.45; font-style: italic; margin: 8px 0 12px; }

/* ── Welcome screen (tap the title art to begin) ──────────────────────────── */
.welcome {
  position: fixed; inset: 0; z-index: 500; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: #fcb683;
  opacity: 1; transition: opacity .35s ease;
}
.welcome.leaving { opacity: 0; }
.welcome-img {
  max-height: 86cqh; max-width: 92cqw; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
.welcome-hint {
  color: #fff; font-weight: 800; font-size: 1.2rem; letter-spacing: .5px; opacity: .9;
  animation: pulse 1.6s ease-in-out infinite;
}
/* First-run intro sequence. While it runs, the shop's buttons are hidden so just
   the painted background shows. */
body.intro-seq .shop-supplies,
body.intro-seq .shop-make,
body.intro-seq .to-greenhouse,
body.intro-seq .shop-toggle,
body.intro-seq .shop-customer,
body.intro-seq #toolbar { display: none; }

/* The intro art laid OVER the shop (a scrim, so the shop reads behind it). It
   fades in (the 2s dim), and out when dismissed. */
.intro-overlay {
  position: fixed; inset: var(--pad) 0; z-index: 400;   /* match the canvas — stop at the 5% top/bottom gaps */
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: rgba(0, 0, 0, .55);
  opacity: 0; transition: opacity .5s ease;
}
.intro-overlay.show { opacity: 1; }
.intro-overlay.leaving { opacity: 0; }
.intro-overlay-img {
  max-height: 78cqh; max-width: 90cqw; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
}
/* Greenhouse call-to-action, drawn over the intro art (fades in at the 5s mark). */
.intro-greenhouse {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%); z-index: 1;
  border: none; border-radius: 999px; cursor: pointer; white-space: nowrap;
  background: var(--accent); color: #fff; box-shadow: 0 12px 36px rgba(0, 0, 0, .5);
  padding: clamp(12px, 1.9cqw, 30px) clamp(20px, 3.4cqw, 60px);
  font-weight: 800; font-size: clamp(1.1rem, 3cqw, 2.6rem);
  opacity: 0; transition: opacity .4s ease;
}
.intro-greenhouse.show { opacity: 1; }
.intro-greenhouse:active { transform: translateX(-50%) translateY(1px); }

/* ── Shelf placement editor (?edit) ───────────────────────────────────────── */
.shop-editor-overlay { position: absolute; inset: 0; z-index: 60; cursor: crosshair; }
/* Ghost footprints — where items will pile, anchored bottom-centre like the real thing. */
.sez-ghosts { position: absolute; inset: 0; pointer-events: none; }
.sez-ghost {
  position: absolute; aspect-ratio: 1 / 1;
  transform: translate(-50%, -100%); transform-origin: bottom center;
  border: 2px dashed rgba(255, 255, 255, .6); border-radius: 8px;
  background: rgba(124, 92, 214, .12);
}
/* Draggable zone anchor. */
.sez-marker {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; align-items: center; gap: 6px; cursor: grab; touch-action: none;
}
.sez-marker.is-dragging { cursor: grabbing; }
.sez-dot {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
}
.sez-marker.is-selected .sez-dot { background: #ffd23f; }
.sez-label {
  font-size: .8rem; font-weight: 800; color: #fff; white-space: nowrap;
  background: rgba(0, 0, 0, .6); padding: 2px 8px; border-radius: 999px;
}
/* Controls panel, fixed to the viewport. */
.shop-editor-panel {
  position: fixed; left: 12px; bottom: 12px; z-index: 200; width: 250px;
  background: rgba(24, 22, 32, .94); color: #fff; border-radius: 14px;
  padding: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
  font-size: .85rem; display: flex; flex-direction: column; gap: 8px;
}
.sez-title { font-weight: 800; }
.sez-hint { display: block; font-weight: 500; font-size: .7rem; opacity: .65; }
.sez-empty { opacity: .7; font-size: .8rem; }
.sez-sel { display: flex; flex-direction: column; gap: 6px; }
.sez-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sez-f span { opacity: .8; }
.sez-f input {
  width: 130px; padding: 4px 8px; border-radius: 8px; border: none;
  background: rgba(255, 255, 255, .12); color: #fff; font: inherit;
}
.sez-f input[type="number"] { width: 88px; }
.shop-editor-panel button {
  border: none; border-radius: 999px; padding: 7px 12px; cursor: pointer;
  font: inherit; font-weight: 700; background: var(--accent); color: #fff;
}
.sez-del { background: #c0392b !important; }
.sez-actions { display: flex; gap: 8px; }
.sez-actions button { flex: 1; background: rgba(255, 255, 255, .16) !important; }

/* ── First-bouquet fanfare (one-time, ~3s) ────────────────────────────────── */
.celebrate {
  position: fixed; inset: 0; z-index: 300; display: flex;
  align-items: center; justify-content: center; pointer-events: none;
  background: rgba(0, 0, 0, .25);
  opacity: 0; transition: opacity .3s ease;
}
.celebrate.hidden { display: none; }
.celebrate.show { opacity: 1; }
.celebrate-card {
  text-align: center; color: #fff; padding: 28px 36px; border-radius: 22px;
  background: linear-gradient(160deg, #7c5cd6, #c44d9b);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  transform: scale(.8); transition: transform .35s cubic-bezier(.2, 1.4, .4, 1);
}
.celebrate.show .celebrate-card { transform: scale(1); }
.celebrate-burst { font-size: 3.4rem; line-height: 1; }
.celebrate-card h2 { margin: 10px 0 4px; font-size: 1.8rem; }
.celebrate-card p { margin: 0; opacity: .92; }

/* Shopkeeper + speech bubble — tucked into the upper-left of the shop window. */
.shop-keeper { top: 8px; left: 0; display: flex; align-items: flex-start; justify-content: flex-start; gap: 8px; padding: 0 14px; pointer-events: none; }
.keeper-face { font-size: 2.2rem; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3)); }
/* ── First-run tutorial helper (floats, hops between anchors) ───────────────── */
.tutor-helper {
  position: fixed; z-index: 70; pointer-events: none;   /* action steps never block the target */
  display: flex; align-items: flex-start; gap: clamp(6px, 2cqw, 12px); max-width: 84cqw;
  transition: left .45s cubic-bezier(.34, 1.25, .64, 1), top .45s cubic-bezier(.34, 1.25, .64, 1), opacity .3s ease;
}
.tutor-helper.tappable { pointer-events: auto; }   /* info steps are tappable to continue */
.tutor-helper.over-sheet { z-index: 1000; }        /* float above the Seed Book sheet (z 300) */
.tutor-helper.leaving { opacity: 0; transform: scale(.9); }
.tutor-face { font-size: clamp(2rem, 9.6cqw, 4rem); line-height: 1; flex: 0 0 auto; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35)); }
.tutor-bubble {
  background: rgba(255, 255, 255, .97); color: var(--ink);
  padding: 0.7em 1em; border-radius: 1.1em; font-size: clamp(.8rem, 3.6cqw, 1.5rem); font-weight: 600; line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .32);
}
.tutor-helper.tappable .tutor-bubble { cursor: pointer; }
.tutor-helper.tappable .tutor-bubble::after { content: '  ›'; opacity: .5; font-weight: 800; }
/* The static shopkeeper steps aside while the tutorial helper is guiding. */
body.tutorial-active .shop-keeper { display: none; }
/* Before the first flower is cut, the shop's make/supplies/varieties/basket stay hidden. */
body.pre-firstcut .shop-make,
body.pre-firstcut .shop-supplies,
body.pre-firstcut #btnDex,
body.pre-firstcut #btnBasket { display: none; }
/* After the first bouquet is displayed (before the first sale), ONLY Open shop shows. */
body.pre-firstsale .shop-make,
body.pre-firstsale .shop-supplies,
body.pre-firstsale .to-greenhouse,
body.pre-firstsale #btnDex,
body.pre-firstsale #btnBasket { display: none; }

.keeper-bubble {
  position: relative; max-width: min(240px, calc(50cqw - 60px));   /* never cross the screen's X centre */
  background: rgba(255, 255, 255, 0.93); color: var(--ink);
  padding: 9px 13px; border-radius: 14px; font-size: .574rem; font-weight: 600; line-height: 1.35;
  box-shadow: var(--shadow);
}
.keeper-bubble::before {
  content: ''; position: absolute; left: -7px; top: 13px;
  border: 7px solid transparent; border-right-color: rgba(255, 255, 255, 0.93); border-left: 0;
}

/* Make-bouquet call to action, floated dead-center over the shop background.
   The layer itself is click-through; only the button takes pointer events. */
.shop-cta { top: 0; bottom: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 18px; padding-bottom: 8px; pointer-events: none; }
.cta-bouquet {
  pointer-events: auto;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border: none; border-radius: 33px; cursor: pointer;
  /* Scale with the window (clamped so it stays sane at the extremes). */
  padding: clamp(10px, 1.6cqw, 30px) clamp(16px, 2.7cqw, 51px);
  background: var(--accent); color: #fff;
  font-weight: 800; font-size: clamp(.9rem, 2.2cqw, 1.875rem); letter-spacing: .3px;
  box-shadow: 0 15px 42px rgba(0, 0, 0, .38);
  transition: transform .12s ease;
}
.cta-bouquet:active { transform: translateY(2px); }
.cta-bouquet:disabled { background: rgba(120, 132, 124, .82); box-shadow: none; cursor: default; }
/* Make bouquet sits centered in the .shop-cta column, its bottom ~1% above the top
   of the Greenhouse button: same 8px baseline + the Greenhouse button's height (~40px)
   plus a 1% gap. Tune this margin if the Greenhouse button height differs. */
.shop-make { margin-bottom: 48px; }
/* Supplies is pulled out to the lower-right corner, mirroring the Greenhouse
   button on the left at the same height (bottom: 8px), just above the bottom bar. */
.shop-supplies {
  position: absolute; right: 2%; bottom: 8px; z-index: 30;
  flex-direction: row; align-items: center;
}
.cta-bouquet .cta-ic { font-size: clamp(1.4rem, 4cqw, 3.3rem); line-height: 1; }
.cta-bouquet .cta-sub { font-size: .8rem; font-weight: 700; opacity: .9; max-width: 15em; text-align: center; }

/* Emoji icon centered in a seed-list row (e.g. the Supplies menu). */
.supply-ic { display: flex; align-items: center; justify-content: center; font-size: 1.9rem; }


/* ── Sheet (modal) ────────────────────────────────────────────────────────── */
.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 40, 30, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity .2s ease;
}
.sheet.open { opacity: 1; }
.sheet.hidden { display: none; }
.sheet-card {
  position: relative;
  width: 100%; max-width: 560px;
  max-height: 82cqh; overflow-y: auto;
  background: var(--panel);
  border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(env(safe-area-inset-bottom) + 22px);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.25);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2,.8,.2,1);
}
.sheet.open .sheet-card { transform: translateY(0); }

/* Centered variant (e.g. the first-visit greenhouse primer): a card in the middle
   of the screen rather than a sheet rising from the bottom. */
.sheet.centered { align-items: center; }
.sheet.centered .sheet-card {
  margin: 0 16px;
  border-radius: 22px;
  max-height: 86cqh;
  transform: translateY(14px) scale(.97);
}
.sheet.centered.open .sheet-card { transform: translateY(0) scale(1); }

/* Large modal variant (the Spell book): a big centered panel with 50px padding
   on all sides, rather than a bottom sheet. */
.sheet.large { align-items: center; }
.sheet.large .sheet-card {
  width: min(960px, 94cqw); max-width: none;
  max-height: 90cqh; margin: 0;
  border-radius: 22px; padding: 50px;
  transform: translateY(14px) scale(.97);
}
.sheet.large.open .sheet-card { transform: translateY(0) scale(1); }

/* Near-fullscreen modal (the plant-a-seed picker): fills the screen with 50px of
   padding on every side. */
.sheet.full { align-items: center; }
.sheet.full .sheet-card {
  width: 96cqw; max-width: none;
  height: 94cqh; max-height: none;
  margin: 0; border-radius: 22px; padding: 12px 40px 40px;   /* top matches the close button (top:12px) */
  background: #275425;
  display: flex; flex-direction: column;
  transform: translateY(14px) scale(.98);
}
.sheet.full.open .sheet-card { transform: translateY(0) scale(1); }
.sheet.full #sheetBody { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Heading/intro read light over the dark surround. */
.sheet.full #sheetBody > h2 { color: #fff; }
.sheet.full #sheetBody > .muted { color: rgba(255, 255, 255, .85); }

/* The codex (open book) at its native aspect; cards live in %-positioned page
   panels pinned to the painted pages (marked up via the ?edit layout editor). */
/* Stage holds the codex centered in the available space without overflowing onto
   the page-nav below it (which would steal the buttons' clicks). */
.codex-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.codex-frame {
  position: relative;
  width: 100%; height: 100%;   /* fill the sheet — no longer locked to the old book image's aspect */
  background: #8abd97; border-radius: 8px;
}
.codex-bg { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; }
/* Page-turn dots under the codex (one per page; tap to jump). */
.codex-dots { display: flex; align-items: center; justify-content: center; gap: 10px; padding-top: 14px; flex: 0 0 auto; }
.codex-dot {
  width: 12px; height: 12px; padding: 0; border: none; border-radius: 50%; cursor: pointer;
  background: rgba(74, 56, 38, .3);
}
.codex-dot.active { background: var(--accent); }
.codex-panel {
  position: absolute; container-type: inline-size; pointer-events: none;   /* size cards off WIDTH, not the tall height; empty area doesn't steal clicks */
  /* Fixed grid rows (set inline per panel: grid-template-rows:repeat(rows,1fr)) so
     every card cell is the same size, even on a partial page. */
  /* Rows are content-height (set inline) and packed to the top, so cards aren't
     stretched tall with empty space. */
  display: grid; grid-auto-rows: min-content; align-content: start; row-gap: 3%; column-gap: 2%; padding: 1%;
}
/* Compact seed cards: uniform cell size, no card backing. */
.codex-panel .seed-item {
  pointer-events: auto;   /* cards are clickable; the panel around them is not */
  min-height: 0; min-width: 0; width: 100%; height: 100%; position: relative;
  flex-direction: row; align-items: center; gap: 3cqw; padding: 1cqw 2cqw; text-align: left;
  background: none; overflow: hidden;
}
.codex-panel .seed-item:active { background: none; }
/* In-stock seeds (not locked) get a card background. */
.codex-panel .seed-item:not(.locked) { background: #e8e7b7; border-radius: 2cqw; }
/* Locked (no seeds): dim everything except the name + rarity badge. The card is a
   disabled <button>, so set the text colour explicitly or the browser greys it. */
.codex-panel .seed-item.locked { color: var(--ink); -webkit-text-fill-color: currentColor; }
.codex-panel .seed-item.locked .seed-name { opacity: 1; filter: none; }
.codex-panel .seed-item.locked .seed-icon,
.codex-panel .seed-item.locked .seed-traits,
.codex-panel .seed-item.locked .seed-gloss,
.codex-panel .seed-item.locked .seed-bag-count { opacity: .5; filter: grayscale(1); }
/* Horizontal divider between cards (not after the last one in a column). */
.codex-panel .seed-item { border-bottom: 0.3cqw solid rgba(74, 56, 38, .35); }
.codex-panel .seed-item:last-child { border-bottom: none; }
.codex-panel .seed-icon-col { display: flex; flex-direction: column; align-items: center; gap: 1.5cqw; flex: 0 0 auto; }
.codex-panel .seed-icon { width: 20cqw; height: auto; aspect-ratio: 1; flex: 0 0 auto; }
.codex-panel .seed-rarity .rarity { font-size: 3cqw; padding: 0.8cqw 2cqw; border-width: 0.3cqw; }
.codex-panel .seed-meta { flex: 1; min-width: 0; }
.codex-panel .seed-name { font-size: 4.5cqw; justify-content: flex-start; }
.codex-panel .seed-traits { gap: 1cqw; margin: 1.4cqw 0 0.8cqw; justify-content: flex-start; }
.codex-panel .seed-traits .trait { font-size: 3cqw; padding: 0.7cqw 1.4cqw; }
.codex-panel .seed-gloss { font-size: 3.2cqw; }
.codex-panel .seed-bag-count { position: absolute; right: 2cqw; bottom: 0.5cqw; margin: 0; font-size: 3cqw; }

/* ── Codex page-layout editor (?edit) ─────────────────────────────────────── */
.codex-editor-overlay { position: absolute; inset: 0; z-index: 60; }
.cez-rect {
  position: absolute; border: 2px dashed #ffd23f; background: rgba(255, 210, 63, .12);
  cursor: grab; touch-action: none;
}
.cez-rect:active { cursor: grabbing; }
.cez-label {
  position: absolute; top: 2px; left: 4px; font-size: .8rem; font-weight: 800; color: #fff;
  background: rgba(0, 0, 0, .6); padding: 1px 6px; border-radius: 6px;
}
.cez-handle {
  position: absolute; right: -8px; bottom: -8px; width: 18px; height: 18px; border-radius: 50%;
  background: #ffd23f; border: 2px solid #fff; cursor: nwse-resize;
}
.codex-editor-panel {
  position: fixed; left: 12px; bottom: 12px; z-index: 200; width: 230px;
  background: rgba(24, 22, 32, .94); color: #fff; border-radius: 14px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; font-size: .85rem; box-shadow: 0 8px 30px rgba(0, 0, 0, .5);
}
.cez-title { font-weight: 800; }
.cez-hint { display: block; font-weight: 500; font-size: .7rem; opacity: .65; }
.cez-f { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cez-f input { width: 80px; padding: 4px 8px; border-radius: 8px; border: none; background: rgba(255, 255, 255, .12); color: #fff; font: inherit; }
.cez-actions { display: flex; gap: 6px; }
.codex-editor-panel button { flex: 1; border: none; border-radius: 999px; padding: 7px 10px; cursor: pointer; font: inherit; font-weight: 700; background: rgba(255, 255, 255, .16); color: #fff; }
.sheet-card h2 { margin: 0 0 12px; font-size: 1.3rem; }
.sheet-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: #eef3ef; color: var(--muted);
  font-size: 1rem; cursor: pointer;
}
.muted { color: var(--muted); }
.sheet-footer { margin-top: 18px; text-align: center; }

/* Buttons */
.primary, .ghost {
  border: none; border-radius: 14px; padding: 14px 18px;
  font-size: 1rem; font-weight: 700; cursor: pointer; width: 100%;
}
.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(31,122,77,.35); }
.primary:active { transform: translateY(1px); }
.primary:disabled { background: #b9cabf; box-shadow: none; }
.ghost { background: #eef3ef; color: var(--accent); }
.btn-row { display: flex; gap: 10px; }
.btn-row .primary, .btn-row .ghost { width: auto; flex: 1; }
.link-danger { background: none; border: none; color: #c0594d; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Result / detail card */
.result { text-align: center; }
.result-icon { width: 130px; height: 130px; margin: 0 auto 6px; }
.result-icon.tall { width: 150px; height: 180px; }
.result-name { font-weight: 700; margin-bottom: 6px; }

/* Rarity badge */
.rarity {
  display: inline-block; font-size: .68rem; font-weight: 800;
  padding: 2px 8px; border-radius: 999px; border: 1px solid;
  vertical-align: middle; letter-spacing: .3px;
}
/* 3× larger rarity indicator on the greenhouse flower cards only. */
/* Rarity badge scales with the pot card (cqh/cqw track the card as it resizes). */
.plot-panel .rarity, .gh-card .rarity { font-size: 9cqh; padding: 1.5cqh 4cqw; border-width: 0.6cqh; }
/* Rarity token pinned to the upper-right of the pot's info card. */
.card-rarity { position: absolute; top: 3cqh; right: 2cqw; z-index: 2; }

/* Seed list */
.seed-list { display: flex; flex-direction: column; gap: 8px; }
.seed-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: #f4f8f5; border: none; border-radius: 14px; padding: 8px 12px;
  cursor: pointer; text-align: left;
}
.seed-item.static { cursor: default; }
.seed-item:not(.static):active { background: #e7f0ea; }
/* Discovered but not in the bag — shown for reference, can't be planted. */
.seed-item.locked { opacity: .5; filter: grayscale(1); cursor: default; }
.seed-item.locked:active { background: #f4f8f5; }
.seed-icon { width: 52px; height: 52px; flex: 0 0 52px; }
.seed-meta { flex: 1; min-width: 0; }
.seed-name { font-weight: 700; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
/* Trait preview in the plant-a-seed picker: what you'll grow + the need it serves. */
.seed-traits { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 2px; }
.seed-traits .trait {
  font-size: .78rem; font-weight: 700; color: #5a4b8a;
  background: rgba(124, 92, 214, .12); padding: 2px 8px; border-radius: 999px;
}
.seed-gloss { font-size: .82rem; font-style: italic; }

/* Dex grid */
.dex-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dex-card {
  position: relative;
  background: #f4f8f5; border-radius: 14px; padding: 8px 6px; text-align: center;
}
.dex-icon { width: 100%; aspect-ratio: 1; }
.dex-name { font-size: .72rem; font-weight: 700; margin: 2px 0 4px; line-height: 1.1; }
.mini-gift {
  position: absolute; top: 4px; right: 4px;
  border: none; background: rgba(255,255,255,.85); border-radius: 50%;
  width: 26px; height: 26px; cursor: pointer; font-size: .8rem;
}

.empty-state { text-align: center; padding: 20px 0; }

/* Commonplace Book — pressed-flower illustration + the spell's reading. */
.book-list { display: flex; flex-direction: column; gap: 10px; }
.book-entry {
  display: flex; gap: 12px; align-items: center;
  background: #f6f1e6; border: 1px solid #e6dcc6; border-radius: 14px; padding: 10px 12px;
}
.book-illus {
  flex: 0 0 64px; width: 64px; height: 72px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.6); border-radius: 10px; overflow: hidden;
}
.book-illus img { width: 100%; height: 100%; object-fit: contain; }
.book-meta { flex: 1; min-width: 0; }
.book-title { font-weight: 800; font-size: 1rem; }
.book-reading { font-size: .82rem; font-style: italic; line-height: 1.35; color: #6b5d44; }

/* First-visit greenhouse primer */
.intro-steps { margin: 4px 0 18px; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }
.intro-steps li { line-height: 1.4; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + 20%); transform: translate(-50%, 10px);
  background: rgba(35, 66, 52, 0.95); color: #fff;
  padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: .9rem;
  z-index: 60; opacity: 0; transition: opacity .25s ease, transform .25s ease;
  max-width: 90cqw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.hidden { display: none; }
/* Greenhouse: anchored (via inline left/top) just above the current flower's top. */
.toast.gh-toast { bottom: auto; transform: translate(-50%, calc(-100% - 10px)); }
.toast.gh-toast.show { transform: translate(-50%, -100%); }

/* ── Bouquet tool ─────────────────────────────────────────────────────────── */
.bq-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column;
  background: #2a2622; opacity: 0; transition: opacity .2s ease;
}
.bq-modal.open { opacity: 1; }
.bq-modal.hidden { display: none; }
.bq-head {
  display: flex; align-items: center; gap: 10px; color: #fff; background: #1f1c19;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
}
.bq-title { flex: 1; text-align: center; font-weight: 800; }
.bq-icon { width: 34px; height: 34px; border: none; border-radius: 50%; background: #3a352f; color: #fff; font-size: 1rem; cursor: pointer; }
.bq-head-spacer { width: 34px; flex: 0 0 34px; }   /* balances the close button so the title stays centred */

/* "You need a vase" prompt — floated dead-center over the arranger for maximum
   visibility; a one-tap buy when affordable, greyed (but left up) when not. */
.bq-vasewarn {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 20; max-width: calc(100% - 40px);
  border: none; border-radius: 16px; cursor: pointer;
  padding: 18px 24px; font-size: 1.02rem; font-weight: 800; text-align: center; line-height: 1.35;
  background: #e0a93a; color: #3a2a06;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .5);
}
.bq-vasewarn:active { transform: translate(-50%, -50%) translateY(1px); }
.bq-vasewarn:disabled { background: #6b6256; color: #cfc7b8; cursor: default; box-shadow: none; }
.bq-vasewarn.hidden { display: none; }

/* Live spell reading of the current arrangement, between the stage and actions. */
.bq-spell {
  background: #15120f; color: #e9dcc8;
  padding: 10px 16px; font-size: .9rem; font-weight: 600; line-height: 1.35;
  text-align: center; font-style: italic;
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.bq-spell.hidden { display: none; }

/* Sell / Send action bar, between the stage and the cut-flower tray. */
.bq-actions { display: flex; gap: 10px; padding: 10px 12px; background: #1f1c19; }
.bq-action {
  flex: 1; border: none; border-radius: 12px; padding: 13px 10px;
  font-size: .95rem; font-weight: 800; color: #fff; cursor: pointer;
  transition: transform .1s ease;
}
.bq-action.sell { background: var(--accent); }
.bq-action.send { background: #c85b8e; }
.bq-action:active { transform: translateY(1px); }
.bq-stage {
  position: relative; flex: 1; overflow: hidden;
  background: #efe4d3;   /* fallback; the real backdrop + bouquets come from #bqShopFrame */
  touch-action: none;
  perspective: 1400px;   /* 3D depth for the turntable sway */
}
/* Idle turntable is now a REAL 3D rotation driven in the renderer (bouquet3d.js):
   the 3D head scene spins about Y so heads turn to show their sides and deeper
   ones parallax further, and the 2D stems are redrawn each frame to follow. No
   CSS animation here — that would double up with the renderer's rotation. */
.bq-scene { position: absolute; inset: 0; transform-style: flat; }
/* The for-sale bouquets shown on the arranger backdrop are display-only. */
#bqShopFrame .shop-bouquet { pointer-events: none; cursor: default; }

/* Decorative vase at the bottom-centre of the arranger: its lower body sits below
   the stage edge, the mouth + upper body showing so flowers read as rising out of
   it — in front of the stems (paints after the stems SVG), behind the 3D bloom
   canvas (appended after it). Sized by HEIGHT (not width) so the random vase art in
   /public/vase_* — which varies in aspect ratio — all renders at a sensible size
   with its top visible. */
.bq-vase {
  position: absolute; left: 50%; bottom: 0; transform: translate(-50%, 45%);
  height: 45%; width: auto; pointer-events: none;
  filter: drop-shadow(0 -2px 8px rgba(0, 0, 0, .35));
}
.bq-vase.hidden { display: none; }

/* Sold-bouquet keepsake cards — a small fanned pile low in the lower-right,
   behind the live blooms (zero-size anchor; each card is offset off it). */
.bq-sold { position: absolute; right: 14px; bottom: 14px; width: 0; height: 0; z-index: 1; pointer-events: none; }
.bq-sold-card {
  position: absolute; right: 0; bottom: 0;
  /* Scale with the screen (keeps the 464×528 proportions), bounded so it never
     gets absurd on a very large display. */
  width: min(48cqw, 42cqh, 560px);
  aspect-ratio: 464 / 528;
  transform-origin: bottom right;
  transition: opacity .35s ease, transform .35s ease;
}
/* The arrangement picture (transparent), bottom-anchored so its stems meet the
   vase, then lifted 25% higher relative to it so the blooms rise out of the vase. */
.bq-sold-flowers {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; object-position: center bottom;
  transform: translateY(-25%);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .5));   /* lift the flowers off the backdrop */
}
/* The vase asset, grouped at the bottom-centre so the bouquet stands in it. */
.bq-sold-vase {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: 46%; height: auto; pointer-events: none;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .45));
}
.bq-hint { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 28px; color: #a4937c; font-size: .9rem; pointer-events: none; }
/* Stems sit behind every bloom: they carry no z-index and are the first child,
   so in the flattened scene they paint under the blooms (z-index ≥ 100). */
.bq-stems { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.bq-flower {
  position: absolute; height: 360px; width: auto; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-drag: none;
  transform-origin: 50% 50%;    /* bloom rides the stem end; rotates about its own center */
  filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.22));
}
.bq-flower.selected { outline: 2px dashed #2fae6b; outline-offset: 2px; border-radius: 6px; }
/* SPIKE: the bloom <img> is now an invisible pointer/selection proxy — the real
   flower is the 3D head drawn on the overlay canvas. Fixed box = a stable grab
   area; no drop-shadow since there's nothing to shade. */
.bq-flower.bq-proxy { height: 150px; width: 110px; filter: none; }
/* Floats inside the stage frame (bottom-centered) over the flowers, instead of a
   bar below the canvas. pointer-events stay on the buttons; the bar itself is a
   translucent pill so it reads on top of the arrangement. */
.bq-controls { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; z-index: 1000000;
  background: rgba(31, 28, 25, 0.72); border-radius: 14px; color: #fff;
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.bq-controls.hidden { display: none; }
.bq-ctl { display: flex; align-items: center; gap: 8px; flex: 1; font-size: 1.05rem; }
.bq-ctl input { flex: 1; accent-color: var(--accent-2); }
.bq-cbtn { border: none; border-radius: 10px; padding: 8px 12px; font-weight: 700; background: #3a352f; color: #fff; cursor: pointer; }
.bq-cbtn.del { background: #7a2f3a; }
.bq-tray { display: flex; gap: 8px; overflow-x: auto; background: #15120f;
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 12px); }
.bq-tray-item { flex: 0 0 auto; width: 64px; padding: 0; border: none; background: none;
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.bq-tray-thumb { position: relative; width: 64px; height: 64px; padding: 4px;
  border-radius: 12px; background: #fff; }
.bq-tray-thumb img { width: 100%; height: 100%; object-fit: contain; }
.bq-tray-ct { position: absolute; right: 3px; bottom: 2px; font-size: .62rem; font-weight: 800;
  color: var(--ink); background: rgba(255, 255, 255, 0.85); border-radius: 6px; padding: 0 4px; }
.bq-tray-tok { font-size: .66rem; padding: 1px 6px 1px 5px; gap: 3px; }
.bq-tray-tok .dom-dot { width: 6px; height: 6px; }
.bq-tray-empty { color: #8a7d6c; padding: 18px; white-space: nowrap; }

.bq-send-panel { position: fixed; inset: 0; z-index: 90; display: none;
  align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.55); padding: 20px; }
.bq-send-panel.open { display: flex; }
.bq-send-card { position: relative; width: 100%; max-width: 360px; background: var(--panel); border-radius: 18px;
  padding: 20px; text-align: center; box-shadow: var(--shadow); }
.bq-send-card h3 { margin: 0 0 12px; }
.bq-send-card .bq-icon { position: absolute; top: 10px; right: 10px; background: #eef3ef; color: var(--muted); }
.bq-preview { width: 100%; border-radius: 12px; background: #efe4d3; margin-bottom: 12px; }
.bq-send-card input { width: 100%; padding: 12px 14px; border: 1px solid #cdd8d0; border-radius: 12px;
  font-size: 1rem; margin-bottom: 10px; }
.bq-send-card .primary { width: 100%; }
.bq-send-note { font-size: .76rem; margin: 10px 0 0; }
.bq-sale { font-size: .92rem; font-weight: 700; margin: 0 0 12px; }
.bq-sale b { color: #c9961f; }

/* ── Economy: golden petals 🌼 ─────────────────────────────────────────────── */
/* A bloom that grew a golden petal shows a small corner glint (no box ring). */
.plot.has-golden::after {
  content: '🌼'; position: absolute; top: 5px; right: 6px; font-size: 1.1rem;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
  animation: goldGlint 1.8s ease-in-out infinite;
}
@keyframes goldGlint { 0%, 100% { transform: scale(1); opacity: .92; } 50% { transform: scale(1.18); opacity: 1; } }

.golden-chip {
  font-size: .68rem; font-weight: 800; color: #7a5a06;
  background: #fbe7a6; border: 1px solid #efc94d; border-radius: 999px;
  padding: 2px 8px; align-self: flex-start;
}
.panel-btn.golden { background: linear-gradient(180deg, #f0c64b, #d6a51c); color: #4a3705; }

/* Buy button used in the seed/vase stall sheets. */
.buy-btn {
  flex: 0 0 auto; border: none; border-radius: 999px; padding: 9px 14px;
  font-size: .82rem; font-weight: 800; color: #4a3705; cursor: pointer;
  background: linear-gradient(180deg, #f0c64b, #d6a51c);
}
.buy-btn:active { transform: translateY(1px); }
.buy-btn:disabled { background: #e6ddc7; color: #a99; cursor: default; }
.vase-big { font-size: 3.4rem; line-height: 1; margin-bottom: 4px; }
