/* ============================================================
   Garden Add-Venture — styles
   Wordless addition game for ages ~4-10. Color & icons only.
   ============================================================ */

:root {
  --garden-1: #123524;
  --garden-2: #1f6b3a;
  --ink: #fff8ec;
  --good: #4ade80;
  --good-dark: #1fa855;
  --bad: #ff6b6b;
  --gold: #ffd23f;
  --amber: #ff9f45;
  --pink: #ff8fc8;
  --locked: #33523f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--garden-1);
  color: var(--ink);
  font-family: "Baloo 2", "Comic Sans MS", "Trebuchet MS", system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#stars-bg, #confetti-canvas { position: fixed; inset: 0; }
#stars-bg { z-index: 0; }
#confetti-canvas { z-index: 4; pointer-events: none; }

#app { position: relative; z-index: 1; height: 100vh; width: 100vw; }

/* ---------- Screen switching ---------- */
.screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ---------- Top bar / HUD ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  z-index: 5;
}

.icon-btn {
  font-size: 30px;
  line-height: 1;
  background: rgba(255,255,255,0.1);
  border: 3px solid rgba(255,255,255,0.22);
  border-radius: 16px;
  padding: 8px 12px;
  cursor: pointer;
  color: var(--ink);
  transition: transform .12s ease, background .12s ease;
}
.icon-btn:hover { background: rgba(255,255,255,0.2); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn.big { font-size: 46px; padding: 14px 20px; }

.star-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 28px;
  font-weight: 900;
  background: rgba(255, 210, 63, 0.18);
  border: 3px solid rgba(255, 210, 63, 0.45);
  border-radius: 18px;
  padding: 6px 16px;
  margin-left: auto;
}
.star-icon { font-size: 26px; }
.star-bump { animation: starBump .45s ease; }

/* ============================================================
   GARDEN PATH (LEVEL MAP)
   ============================================================ */
#path-trail {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column-reverse; /* level 1 at bottom, climb upward */
  align-items: center;
  gap: 26px;
  padding: 40px 0 60px;
  scroll-behavior: smooth;
}

.path-node {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: transform .15s ease;
}
.path-node:hover { transform: scale(1.06); }
.path-node.locked { cursor: not-allowed; filter: grayscale(0.9) brightness(0.55); }
.path-node.locked:hover { transform: none; }

.path-node:nth-child(odd)  { margin-left: 110px; }
.path-node:nth-child(even) { margin-right: 110px; }

.path-emoji {
  font-size: 78px;
  line-height: 1;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,0.5));
}
.path-node.current .path-emoji { animation: floaty 3s ease-in-out infinite; }

.path-label {
  margin-top: -4px;
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  color: var(--amber);
}

.path-stars {
  display: flex;
  gap: 2px;
  font-size: 20px;
  margin-top: 2px;
}
.path-stars .on { color: var(--gold); }
.path-stars .off { color: var(--locked); }

.path-lock {
  position: absolute;
  top: 46%; left: 50%;
  transform: translate(-50%, -60%);
  font-size: 38px;
}

#reset-zone {
  position: fixed;
  bottom: 0; left: 0;
  width: 70px; height: 70px;
  z-index: 20;
}

/* ============================================================
   MISSION / GAMEPLAY
   ============================================================ */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 6px;
}
.progress-dots .dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  border: 2px solid rgba(255,255,255,0.3);
  transition: transform .2s ease, background .2s ease;
}
.progress-dots .dot.done {
  background: var(--good);
  border-color: var(--good);
  transform: scale(1.2);
}
.progress-dots .dot.goal { background: transparent; border: none; font-size: 18px; }
.progress-dots .dot.goal::after { content: "🏵️"; }

.combo-badge {
  position: absolute;
  top: 78px; right: 22px;
  font-size: 28px;
  font-weight: 900;
  color: var(--gold);
  opacity: 0;
  transform: scale(0.5);
  z-index: 5;
}
.combo-badge.show { animation: comboPop .5s ease; }

/* Icon-counting question (levels 1-2) */
.icon-question {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 10px 20px;
  max-width: 1000px;
  margin: 0 auto;
}
.icon-question.active { display: flex; }
.icon-group {
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px 12px;
  max-width: 380px;
}
.icon-plus {
  font-size: clamp(38px, 6vw, 64px);
  font-weight: 900;
  color: var(--amber);
  flex-shrink: 0;
}
.count-obj {
  font-size: clamp(38px, 7vw, 66px);
  line-height: 1;
  cursor: pointer;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
  animation: idleBob 3s ease-in-out infinite;
  transition: transform .1s ease;
}
.count-obj:nth-child(3n)   { animation-delay: .4s; }
.count-obj:nth-child(3n+1) { animation-delay: .8s; }
.count-obj.boing { animation: boing .5s ease; }
.count-obj.celebrate { animation: celebrate .6s ease; }

/* Digit question (levels 3+) */
.equation {
  flex: 1;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-size: clamp(48px, 10vw, 100px);
  font-weight: 900;
  text-shadow: 0 4px 0 rgba(0,0,0,0.35), 0 0 30px rgba(255,159,69,0.3);
}
.equation.active { display: flex; }
.eq-op { color: var(--amber); }
.eq-num { color: var(--ink); }
.eq-huh {
  color: var(--gold);
  background: rgba(255,255,255,0.08);
  border: 4px dashed rgba(255,255,255,0.35);
  border-radius: 18px;
  padding: 0 20px;
}

/* Answer boxes (shared by both question modes) */
.answer-boxes {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 3vw, 30px);
  padding: 16px 20px 40px;
  flex-wrap: wrap;
}
.answer-box {
  width: clamp(88px, 16vw, 136px);
  height: clamp(88px, 16vw, 136px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(40px, 8vw, 70px);
  font-weight: 900;
  color: #123524;
  border: none;
  border-radius: 26px;
  cursor: pointer;
  box-shadow: 0 8px 0 rgba(0,0,0,0.28), 0 12px 22px rgba(0,0,0,0.35);
  transition: transform .08s ease, box-shadow .08s ease;
}
.answer-box:nth-child(1) { background: linear-gradient(180deg, #ffe27a, #ffd23f); }
.answer-box:nth-child(2) { background: linear-gradient(180deg, #9be8ff, #5ad1ff); }
.answer-box:nth-child(3) { background: linear-gradient(180deg, #ffb3da, #ff8fc8); }
.answer-box:nth-child(4) { background: linear-gradient(180deg, #ffc999, #ff9f45); }

.answer-box:hover { transform: translateY(-4px); }
.answer-box:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,0.28), 0 6px 12px rgba(0,0,0,0.35); }

.answer-box.typing-match { outline: 6px solid var(--gold); outline-offset: 4px; }
.answer-box.correct {
  background: linear-gradient(180deg, #6bf0a4, #3ddc84) !important;
  color: #0c4a2a;
  animation: pop .5s ease;
}
.answer-box.wrong {
  background: linear-gradient(180deg, #ff9a9a, #ff6b6b) !important;
  animation: wobble .5s ease;
}
.answer-box.dim { opacity: 0.35; pointer-events: none; }
.answer-boxes.locked .answer-box { pointer-events: none; }

/* ============================================================
   REWARD
   ============================================================ */
#screen-reward { align-items: center; justify-content: center; }
.reward-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 40px 60px;
  background: rgba(18, 53, 36, 0.85);
  border: 4px solid var(--gold);
  border-radius: 32px;
  box-shadow: 0 0 60px rgba(255, 210, 63, 0.4);
}
.reward-stars { display: flex; gap: 16px; font-size: 80px; }
.reward-stars .rstar { color: var(--locked); transform: scale(0.3); opacity: 0; }
.reward-stars .rstar.on {
  color: var(--gold);
  text-shadow: 0 0 24px var(--gold);
  animation: starPop .5s ease forwards;
}
.reward-critter {
  font-size: 110px;
  transform: scale(0);
  animation: critterDrop .6s cubic-bezier(.2,1.4,.4,1) .4s forwards;
}
.reward-buttons { display: flex; gap: 28px; margin-top: 8px; }

/* ============================================================
   BUG BOOK (COLLECTION)
   ============================================================ */
.critter-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, 120px);
  gap: 18px;
  justify-content: center;
  align-content: start;
  padding: 20px 24px 60px;
}
.critter-cell {
  width: 120px; height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 62px;
  background: rgba(255,255,255,0.07);
  border: 3px solid rgba(255,255,255,0.18);
  border-radius: 24px;
}
.critter-cell.owned {
  background: rgba(255, 210, 63, 0.14);
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(255,210,63,0.3);
  animation: floaty 3s ease-in-out infinite;
}
.critter-cell.empty { opacity: 0.3; font-size: 40px; }

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes idleBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes boing {
  0% { transform: scale(1); }
  30% { transform: scale(1.4) translateY(-14px); }
  60% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
@keyframes celebrate {
  0% { transform: scale(1) rotate(0); }
  25% { transform: scale(1.3) rotate(-12deg); }
  50% { transform: scale(1.2) rotate(12deg); }
  75% { transform: scale(1.25) rotate(-8deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.18); } 100% { transform: scale(1); } }
@keyframes wobble {
  0%,100% { transform: translateX(0) rotate(0); }
  20% { transform: translateX(-10px) rotate(-5deg); }
  40% { transform: translateX(10px) rotate(5deg); }
  60% { transform: translateX(-7px) rotate(-3deg); }
  80% { transform: translateX(7px) rotate(3deg); }
}
@keyframes starBump {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); color: var(--gold); }
  100% { transform: scale(1); }
}
@keyframes starPop {
  0% { transform: scale(0.3) rotate(-30deg); opacity: 0; }
  60% { transform: scale(1.3) rotate(8deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes critterDrop {
  0% { transform: scale(0) rotate(-40deg); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes comboPop {
  0% { opacity: 0; transform: scale(0.5) translateY(10px); }
  40% { opacity: 1; transform: scale(1.3) translateY(0); }
  100% { opacity: 1; transform: scale(1); }
}
