/* Bloomcanvas — soft floral/pastel "bloom" theme, distinct from the dark game default. */

:root {
  --bg: #fbf3f7;
  --fg: #4a3b46;
  --muted: #9a86a0;
  --accent: #e77fb3;
  --accent-2: #9bd8c9;
  --scrim: rgba(74, 59, 70, 0.35);
  --panel: rgba(255, 250, 253, 0.96);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: var(--bg);
}

/* ephemeral ambient-particle overlay: never part of the saved artwork */
#fx {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* ---------- corner chrome ---------- */
.chrome {
  position: fixed;
  top: calc(8px + env(safe-area-inset-top));
  right: calc(8px + env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  z-index: 20;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid rgba(74, 59, 70, 0.14);
  background: rgba(255, 255, 255, 0.7);
  color: var(--fg);
  font: 600 16px/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(4px);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.92); }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

/* ---------- bottom toolbar ---------- */
.toolbar { display: none; }

body.state-playing .toolbar,
body.state-paused .toolbar {
  display: flex;
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 15;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin: 0 auto;
  max-width: 100%;
}

.palette {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(74, 59, 70, 0.1);
}

.swatch {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1px rgba(74, 59, 70, 0.12);
  cursor: pointer;
  touch-action: manipulation;
  padding: 0;
}
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--fg); transform: scale(1.08); }

.tool {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(74, 59, 70, 0.1);
  min-height: 44px;
}

.tool-color input[type="color"] {
  width: 32px;
  height: 32px;
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

.tool-label { font-size: 12px; color: var(--muted); }

.tool-size input[type="range"] {
  width: 110px;
  touch-action: manipulation;
}

.tool-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(74, 59, 70, 0.1);
  background: rgba(255, 255, 255, 0.75);
  color: var(--fg);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(4px);
}
.tool-btn:hover { background: rgba(255, 255, 255, 0.95); }
.tool-btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top));
  transform: translate(-50%, -12px);
  background: rgba(74, 59, 70, 0.88);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 40;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity 80ms linear; } }

/* ---------- overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: var(--scrim);
  backdrop-filter: blur(3px);
  z-index: 30;
}

body.state-menu   .overlay-menu,
body.state-paused .overlay-paused { display: grid; }

.panel {
  width: min(420px, 100%);
  padding: 28px 24px;
  border-radius: 20px;
  border: 1px solid rgba(74, 59, 70, 0.08);
  background: var(--panel);
  text-align: center;
  animation: pop 180ms ease-out;
}

@keyframes pop { from { transform: scale(0.96); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .panel { animation: none; } }

.panel h1 { margin: 0 0 6px; font-size: 30px; letter-spacing: 0.5px; color: var(--accent); }
.panel h2 { margin: 0 0 14px; font-size: 24px; }
.tagline  { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.hint     { margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.btn {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 14px 18px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: 700 16px/1 var(--font);
  cursor: pointer;
  touch-action: manipulation;
}
.btn:hover { filter: brightness(1.06); }
