/* Little Explorers — shared styles for the kids' nature games. */
:root {
  --kx-ink: #2b2d42;
  --kx-paper: #fffaf0;
  --kx-sky: #bfe9ff;
  --kx-grass: #7ed957;
  --kx-grass-dark: #4fae3b;
  --kx-sun: #ffd84d;
  --kx-pink: #ff5d8f;
  --kx-font: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", "Nunito", "Varela Round", system-ui, sans-serif;
  --kx-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  --kx-lift: 0 5px 0 rgba(43, 45, 66, 0.2), 0 10px 22px rgba(43, 45, 66, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { touch-action: manipulation; } /* no double-tap zoom on the menus either */
body {
  font-family: var(--kx-font);
  color: var(--kx-ink);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

/* Full-screen game pages: no scrolling, zooming, selecting or long-press menus. */
body.kx-game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background: var(--kx-sky);
}
.kx-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* Top bar: big round buttons in the corners. */
.kx-bar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  pointer-events: none;
}
.kx-bar-side { display: flex; gap: 10px; pointer-events: auto; }
.kx-btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  color: var(--kx-ink);
  font: 28px/1 var(--kx-emoji);
  display: grid;
  place-items: center;
  box-shadow: var(--kx-lift);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.kx-btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 45, 66, 0.2); }
.kx-btn.is-on { background: #fff4c2; }
@media (max-width: 480px), (max-height: 480px) {
  .kx-btn { width: 50px; height: 50px; font-size: 24px; }
}

/* Short prompt pill ("Find the turtle!"). */
.kx-banner {
  position: fixed;
  z-index: 21;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  max-width: calc(100vw - 180px);
  padding: 10px 22px;
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--kx-lift);
  font-size: clamp(18px, 3.2vw, 26px);
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -120%);
}
.kx-banner.in { animation: kx-drop-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }
.kx-banner.out { animation: kx-drop-out 0.3s ease-in forwards; }
@keyframes kx-drop-in { from { opacity: 0; transform: translate(-50%, -120%); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes kx-drop-out { from { opacity: 1; transform: translate(-50%, 0); } to { opacity: 0; transform: translate(-50%, -120%); } }

/* "New creature!" sticker that slides up from the bottom. */
.kx-sticker {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px 10px 12px;
  background: #fff;
  border: 3px solid #ffd84d;
  border-radius: 24px;
  box-shadow: 0 6px 0 rgba(43, 45, 66, 0.15), 0 14px 32px rgba(43, 45, 66, 0.2);
  pointer-events: none;
  transform: translate(-50%, 160%);
  animation: kx-sticker-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
.kx-sticker img { width: 68px; height: 68px; animation: kx-wiggle 0.9s ease-in-out infinite; }
.kx-sticker small {
  display: block;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #c27c00;
}
.kx-sticker b { display: block; font-size: 24px; font-weight: 800; }
.kx-sticker.out { animation: kx-sticker-out 0.35s ease-in forwards; }
@keyframes kx-sticker-in { from { transform: translate(-50%, 160%); } to { transform: translate(-50%, 0); } }
@keyframes kx-sticker-out { from { transform: translate(-50%, 0); } to { transform: translate(-50%, 180%); } }
@keyframes kx-wiggle { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }

/* Big praise overlay. */
.kx-celebrate {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 4px;
  pointer-events: none;
  animation: kx-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.kx-celebrate-emoji { font: 96px/1.1 var(--kx-emoji); animation: kx-bounce 0.8s ease-in-out infinite; }
.kx-celebrate-text {
  font-size: clamp(44px, 9vw, 92px);
  font-weight: 800;
  color: #fff;
  text-align: center;
  padding: 0 20px;
  text-shadow:
    0 6px 0 var(--kx-ink),
    3px 3px 0 var(--kx-ink), -3px 3px 0 var(--kx-ink), 3px -3px 0 var(--kx-ink), -3px -3px 0 var(--kx-ink),
    0 3px 0 var(--kx-ink), 0 -3px 0 var(--kx-ink), 3px 0 0 var(--kx-ink), -3px 0 0 var(--kx-ink);
}
.kx-celebrate.out { animation: kx-pop-out 0.4s ease-in both; }
@keyframes kx-pop-in { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes kx-pop-out { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.3); } }
@keyframes kx-bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

.kx-fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 24; }

/* Big friendly buttons for in-game menus (DOM overlays). */
.kx-big {
  appearance: none;
  border: 0;
  border-radius: 24px;
  padding: 16px 28px;
  min-height: 72px;
  min-width: 72px;
  background: #fff;
  color: var(--kx-ink);
  font: 800 26px/1.1 var(--kx-font);
  box-shadow: var(--kx-lift);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.kx-big:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(43, 45, 66, 0.2); }

@media (prefers-reduced-motion: reduce) {
  .kx-sticker img, .kx-celebrate-emoji { animation: none; }
}
