/* Berry Garden — Mignuti Kids
 * Shares the Banana Berry palette with Flappy Berry / Banana Berry Jump.
 * Cosy, no fail-state idle game. Layout stays serene: one canvas + a tiny
 * HUD. All interaction is handled on the canvas itself.
 */

:root {
  --color-cream: #fff8e7;
  --color-sky: #4ecdc4;
  --color-banana: #ffd93d;
  --color-berry: #de1c56;
  --color-ink: #2c2c2c;
  --color-leaf: #4aa84f;
  --color-grass: #6dc76f;
  --color-earth: #8a6239;
  --color-earth-dark: #6b4a2b;
  --radius: 18px;
  --shadow-card: 0 8px 24px rgba(44, 44, 44, 0.18);
}

* {
  box-sizing: border-box;
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-cream);
  color: var(--color-ink);
  font-family:
    ui-rounded,
    "SF Pro Rounded",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  overscroll-behavior: contain;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  overflow: hidden;
}

.stage {
  position: fixed;
  inset: 0;
  display: block;
  /* Soft sky-to-cream gradient; the canvas paints most of the scene. */
  background: linear-gradient(180deg, #cfeeea 0%, #fff8e7 70%, #ffe9c7 100%);
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  background: transparent;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Harvest basket in the top-left corner. */
.basket {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-card);
  font-weight: 900;
  font-size: clamp(18px, 4vw, 22px);
  color: var(--color-ink);
  pointer-events: none;
  min-height: 40px;
}

.basket__icon {
  width: 26px;
  height: 26px;
  display: inline-block;
  background: var(--color-berry);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M5 9h14l-1.3 9.3a2 2 0 0 1-2 1.7H8.3a2 2 0 0 1-2-1.7L5 9Zm2.5-2L9 4h6l1.5 3H7.5ZM3 9h18v2H3V9Z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M5 9h14l-1.3 9.3a2 2 0 0 1-2 1.7H8.3a2 2 0 0 1-2-1.7L5 9Zm2.5-2L9 4h6l1.5 3H7.5ZM3 9h18v2H3V9Z'/></svg>");
}

/* Harvest pop: briefly scale up the basket when a berry lands. */
.basket.is-pop {
  animation: basketPop 340ms ease both;
}

@keyframes basketPop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.18);
  }
  100% {
    transform: scale(1);
  }
}

.controls {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 120ms ease;
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn:focus-visible {
  outline: 3px solid var(--color-berry);
  outline-offset: 3px;
}

.icon {
  width: 22px;
  height: 22px;
  display: inline-block;
  background: var(--color-ink);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.icon-sound-off {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm13.59 2L14 9.41 15.41 8 18 10.59 20.59 8 22 9.41 19.41 12 22 14.59 20.59 16 18 13.41 15.41 16 14 14.59 16.59 12z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm13.59 2L14 9.41 15.41 8 18 10.59 20.59 8 22 9.41 19.41 12 22 14.59 20.59 16 18 13.41 15.41 16 14 14.59 16.59 12z'/></svg>");
}

.icon-sound-on {
  -webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm11 0.5A3.5 3.5 0 0 1 17.5 14a3.5 3.5 0 0 1-3.5 3.5v-7zm0-4.5a8 8 0 0 1 8 8 8 8 0 0 1-8 8v-2a6 6 0 0 0 6-6 6 6 0 0 0-6-6V6z'/></svg>");
  mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='black' d='M3 10v4h4l5 4V6L7 10H3zm11 0.5A3.5 3.5 0 0 1 17.5 14a3.5 3.5 0 0 1-3.5 3.5v-7zm0-4.5a8 8 0 0 1 8 8 8 8 0 0 1-8 8v-2a6 6 0 0 0 6-6 6 6 0 0 0-6-6V6z'/></svg>");
}

/* Overlay shared with other Mignuti games. */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(44, 44, 44, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 20px;
  pointer-events: auto;
  animation: fadeIn 180ms ease both;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  background: var(--color-cream);
  border: 4px solid var(--color-leaf);
  border-radius: 28px;
  padding: clamp(20px, 5vw, 36px) clamp(22px, 6vw, 42px);
  text-align: center;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-card);
}

.overlay-title {
  margin: 0 0 10px;
  font-size: clamp(26px, 6.5vw, 40px);
  color: var(--color-berry);
  font-weight: 900;
  letter-spacing: 0.01em;
}

.overlay-sub {
  margin: 0 0 18px;
  font-size: clamp(16px, 3.6vw, 20px);
  color: var(--color-ink);
  line-height: 1.4;
}

.big-btn {
  display: inline-block;
  min-width: 200px;
  min-height: 56px;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  background: var(--color-leaf);
  color: #fff;
  font-weight: 800;
  font-size: clamp(18px, 4vw, 22px);
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 6px 0 #2f7b33;
  transition:
    transform 100ms ease,
    box-shadow 100ms ease;
}

.big-btn:hover {
  transform: translateY(-1px);
}

.big-btn:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #2f7b33;
}

.big-btn:focus-visible {
  outline: 3px solid var(--color-banana);
  outline-offset: 4px;
}

.overlay-hint {
  margin: 14px 0 0;
  font-size: 14px;
  opacity: 0.7;
  line-height: 1.4;
}

/* Daily berry highlight on the start overlay */
.overlay-daily {
  display: inline-block;
  margin: 6px 0 14px;
  padding: 6px 12px;
  background: var(--color-banana);
  color: var(--color-ink);
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
}
.overlay-daily:empty {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .overlay {
    animation: none;
  }
  .big-btn {
    transition: none;
  }
  .basket.is-pop {
    animation: none;
  }
}
