/* Soft, still ambient wash to calm the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 214, 228, 0.35) 0%, transparent 42%),
    radial-gradient(circle at 85% 88%, rgba(214, 232, 240, 0.35) 0%, transparent 45%);
}

main {
  max-width: 44rem;
  animation: fade-in 0.7s ease;
}

.header h1 { font-weight: 500; }

.subtitle {
  text-align: center;
  color: var(--muted);
  margin: 0 auto 1.75rem;
  max-width: 30rem;
  line-height: 1.7;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.25rem;
  justify-content: center;
  align-items: flex-end;
  margin-bottom: 1.5rem;
}

.tool-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
}

.tool-label {
  font-family: "Fredoka", sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.tools {
  display: flex;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.6);
  padding: 0.3rem;
  border-radius: 14px;
  border: 1.5px solid #f1e3da;
}
/* dark mode: the toolbar pill needs a dark surface so its light button text reads */
html.dark .tools { background: var(--card); border-color: var(--border); }

.tool-btn {
  font-family: "Fredoka", sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tool-btn:hover { color: var(--ink); }

.tool-btn.is-active {
  background: var(--pick-bg);
  color: var(--primary-dark);
}

/* Undo sits quietly greyed-out until there's something to undo */
.tool-btn:disabled { opacity: 0.4; cursor: default; }
.tool-btn:disabled:hover { color: var(--muted); }

/* Sand color swatches — the button itself is a finger-sized (44px) target;
   the cozy little circle is drawn by the ::before so the look stays gentle. */
.swatches { gap: 0.15rem; flex-wrap: wrap; justify-content: center; }

.swatch {
  width: 2.75rem;  /* ≥44px touch target */
  height: 2.75rem;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.swatch::before {
  content: "";
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--sw);
  border: 2px solid #e7d9cf;
  transition: transform 0.1s, box-shadow 0.15s;
}

.swatch:hover::before { transform: scale(1.1); }

.swatch.is-active::before {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--pick-bg);
}

/* Garden canvases */
.garden-wrap {
  position: relative;
  width: 100%;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(150, 120, 80, 0.18);
  border: 3px solid #e9dcc4;
  line-height: 0;
}

/* A dark cream frame is jarring in the app's dark chrome; keep the tray recessed instead. */
html.dark .garden-wrap {
  border-color: #2b2444;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* Quiet inner vignette: the sand settles a touch lower against the tray walls. Sits above
   both canvases, never captures pointers, and is pure CSS so it's never baked into a save. */
.garden-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 2px 18px rgba(60, 45, 25, 0.10),
    inset 0 -1px 8px rgba(255, 255, 255, 0.05);
}
/* On dark sands a warm inset shadow just muddies — go cool, with a faint lit top edge. */
.garden-wrap.sand-dark::after {
  box-shadow:
    inset 0 2px 22px rgba(0, 0, 0, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.garden-wrap canvas {
  display: block;
  width: 100%;
  /* hold the 0.66 aspect before JS sets an explicit height, so there's no load flash */
  aspect-ratio: 3 / 2;
  touch-action: none;
}

#stones {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  main { animation: none; }
}

/* Phones: give the sand the top of the screen and drop the controls into thumb reach.
   The intro copy and group labels are read once — hide them so no pixel above the
   toolbar is stolen from sand. Desktop / the website keep the full layout. */
@media (max-width: 700px) {
  main { display: flex; flex-direction: column; }
  .header { order: 0; }
  .garden-wrap { order: 1; }
  .toolbar { order: 2; margin: 0.9rem 0 0; gap: 0.5rem 0.75rem; }
  .subtitle { display: none; }
  .tool-label { display: none; }
  .tool-btn { padding: 0.5rem 0.85rem; font-size: 0.88rem; }
}

/* Short viewports (landscape phones): the tray height is capped in JS; here just
   reclaim the vertical space the intro copy would eat. */
@media (max-height: 520px) {
  .subtitle { display: none; }
  .header { margin-bottom: 0.4rem; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Shown only when a save actually fails — a garden that has quietly stopped
   being saved should say so rather than let you find out on the next reload. */
.garden-note {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--pick-border);
  border-radius: 14px;
  background: var(--pick-bg);
  color: var(--primary-dark);
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
}
