@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@600;700;800&family=Nunito:wght@700;800;900&display=swap');

:root {
  --ink: #263238;
  --navy: #203047;
  --cream: #fffdf0;
  --yellow: #ffd62e;
  --gold: #f5a900;
  --green: #36b65a;
  --deep-green: #167540;
  --blue: #34a9e4;
  --coral: #ff655b;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  background: #c7f1ff;
}

button { font: inherit; }

.game-shell {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  height: 100vh;
  min-height: 610px;
}

.topbar {
  z-index: 10;
  display: flex;
  min-height: 82px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(16px, 3vw, 44px);
  color: white;
  background: var(--navy);
  box-shadow: 0 5px 0 rgba(15, 30, 48, .18);
}

.brand { display: flex; align-items: center; gap: 12px; line-height: 1; }
.brand-bee { font-size: 3rem; filter: drop-shadow(0 4px 0 rgba(0,0,0,.18)); transform: rotate(-8deg); }
.brand div { display: flex; flex-direction: column; }
.brand span { color: var(--yellow); font-family: "Baloo 2"; font-size: 1.05rem; font-weight: 800; }
.brand strong { font-family: "Baloo 2"; font-size: clamp(1.2rem, 2.2vw, 1.65rem); letter-spacing: -.02em; }

.stats { display: flex; align-items: center; gap: clamp(10px, 2vw, 22px); }
.stat-pill { display: flex; align-items: center; gap: 8px; }
.stat-pill small, .energy-label { font-size: .72rem; font-weight: 900; letter-spacing: .06em; }
.stat-pill strong { display: block; color: var(--yellow); font-size: 1.35rem; }
.stat-icon { font-size: 1.7rem; }
.energy-wrap { width: min(25vw, 220px); }
.energy-label { display: flex; justify-content: space-between; margin-bottom: 4px; color: #dff7ff; }
.energy-label strong { color: white; }
.energy-track { height: 15px; overflow: hidden; padding: 3px; border-radius: 100px; background: #111c2b; box-shadow: inset 0 1px 2px #0008; }
.energy-bar { width: 60%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffb51b, #fff147); box-shadow: 0 0 10px #ffdc44; transition: width .4s ease; }
.icon-button { width: 46px; height: 46px; border: 0; border-radius: 50%; cursor: pointer; font-size: 1.35rem; background: #ffffff18; color: white; box-shadow: inset 0 0 0 2px #ffffff24; }
.icon-button:hover, .icon-button:focus-visible { background: #ffffff30; outline: 3px solid var(--yellow); }

.mission-strip {
  z-index: 9;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 54px);
  padding: 8px 20px;
  background: #fffef4;
  box-shadow: 0 5px 14px rgba(44, 78, 65, .14);
}
.level-badge { padding: 8px 18px; border-radius: 18px; color: white; font-weight: 900; letter-spacing: .08em; background: var(--blue); box-shadow: 0 4px 0 #2180b2; }
.target-copy { display: flex; align-items: center; gap: 9px; }
.target-copy .tiny-label { color: #71827c; font-size: .7rem; font-weight: 900; letter-spacing: .08em; }
.target-copy strong { font-size: 1.2rem; }
.target-icon { font-size: 2.1rem; }
.progress-dots { display: flex; gap: 9px; }
.progress-dot { width: 32px; height: 32px; display: grid; place-items: center; border: 3px solid #d7e2d8; border-radius: 50%; color: transparent; background: white; transition: .25s ease; }
.progress-dot.done { border-color: #2fbd5d; color: white; background: #2fbd5d; transform: scale(1.08); }

.garden {
  position: relative;
  min-height: 390px;
  overflow: hidden;
  background-color: #81d95c;
  background-image: linear-gradient(to bottom, transparent 62%, rgba(50, 149, 70, .2) 62%), url('garden-bg.png');
  background-position: center;
  background-size: cover;
  isolation: isolate;
}
.garden::after { content: ""; position: absolute; inset: auto 0 0; z-index: -1; height: 22%; background: linear-gradient(0deg, rgba(25, 117, 47, .55), transparent); }
.sun { position: absolute; top: 14px; right: 5%; font-size: 4rem; animation: spin 18s linear infinite; }
.cloud { position: absolute; color: white; font-size: 4rem; opacity: .82; filter: drop-shadow(0 3px 0 #8ad6ea); animation: drift 12s ease-in-out infinite alternate; }
.cloud-one { top: 12%; left: 8%; }
.cloud-two { top: 22%; right: 20%; font-size: 3rem; animation-delay: -5s; }

.message-bubble {
  position: absolute;
  z-index: 8;
  top: 16px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 80%;
  padding: 10px 18px;
  border: 3px solid white;
  border-radius: 22px;
  font-size: clamp(1rem, 2vw, 1.25rem);
  background: #fffbe7eF;
  box-shadow: 0 6px 0 rgba(55, 96, 72, .16);
  transform: translateX(-50%);
}
.message-bubble.pop { animation: bubblePop .35s ease; }

.garden-items { position: absolute; inset: 0; }
.garden-item {
  position: absolute;
  z-index: 3;
  width: clamp(72px, 8vw, 108px);
  height: clamp(72px, 8vw, 108px);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: clamp(3rem, 6vw, 5rem);
  line-height: 1;
  background: transparent;
  filter: drop-shadow(0 9px 3px rgba(41, 80, 38, .25));
  transform: translate(-50%, -50%);
  transition: filter .2s, transform .2s;
  -webkit-tap-highlight-color: transparent;
}
.garden-item::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 50%; background: #ffffff00; transition: .2s; }
.garden-item:hover, .garden-item:focus-visible { outline: 0; filter: drop-shadow(0 11px 4px rgba(41, 80, 38, .3)) brightness(1.08); transform: translate(-50%, -50%) scale(1.13); }
.garden-item:focus-visible::after { background: #fff8; box-shadow: 0 0 0 5px #ffe34e; }
.garden-item.visited { animation: flowerHappy .6s ease; }
.garden-item.selected::after { background: #fff8; box-shadow: 0 0 0 6px var(--yellow), 0 0 25px white; }
.garden-item.wrong { animation: shake .45s ease; }
.garden-item.obstacle { font-size: clamp(2.5rem, 5vw, 4.2rem); filter: drop-shadow(0 6px 3px rgba(36, 61, 34, .25)); }

.bee {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 46%;
  width: 80px;
  height: 70px;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: left .8s cubic-bezier(.3,.8,.3,1), top .8s cubic-bezier(.3,.8,.3,1);
  filter: drop-shadow(0 8px 4px rgba(40, 58, 32, .25));
}
.bee-emoji { font-size: clamp(3.7rem, 7vw, 5.6rem); animation: hover .9s ease-in-out infinite alternate; }
.bee.flying .bee-emoji { animation: flyWiggle .18s ease-in-out infinite alternate; }
.bee.collecting .bee-emoji { animation: nectarSip .4s ease-in-out 3 alternate; }
.pollen { position: absolute; width: 13px; height: 13px; border: 3px solid #e2a500; border-radius: 50%; opacity: 0; background: #fff343; box-shadow: 0 0 8px #fff043; transition: opacity .3s, transform .3s; }
.pollen-one { left: 19px; top: 30px; }
.pollen-two { right: 18px; top: 20px; }
.pollen-three { right: 24px; bottom: 9px; }
.bee.has-pollen .pollen { opacity: 1; transform: scale(1.15); }

.pollen-burst { position: absolute; z-index: 9; width: 10px; height: 10px; border-radius: 50%; pointer-events: none; background: #ffe82f; box-shadow: 0 0 7px #fff; animation: pollenFly .9s ease-out forwards; }
.nectar-drop { position: absolute; z-index: 8; pointer-events: none; font-size: 1.5rem; animation: nectarRise 1s ease-out forwards; }

.growth-bed {
  position: absolute;
  z-index: 5;
  right: 2.5%;
  bottom: 14px;
  width: 170px;
  padding: 7px 10px 9px;
  border: 3px solid #fff9;
  border-radius: 18px;
  text-align: center;
  background: #4b9a47dd;
  box-shadow: 0 5px 0 #28783f;
}
.growth-title { color: white; font-size: .7rem; letter-spacing: .08em; }
.growth-items { display: flex; justify-content: center; gap: 8px; margin-top: 3px; font-size: 1.55rem; }
.growth-items span.grow { animation: grow .7s cubic-bezier(.2,1.6,.4,1); }

.lesson-card {
  z-index: 10;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 18px;
  color: white;
  font-size: clamp(1rem, 2vw, 1.25rem);
  background: var(--deep-green);
}
.lesson-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--deep-green); background: var(--yellow); }
.lesson-icon { font-size: 1.7rem; }

.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(24, 70, 66, .56); backdrop-filter: blur(6px); transition: opacity .3s; }
.overlay.hidden { visibility: hidden; opacity: 0; pointer-events: none; }
.start-screen { background: linear-gradient(#61c7edaa, #78cf68bb), url('garden-bg.png') center/cover; }
.start-card, .celebration-card {
  width: min(620px, 94vw);
  padding: clamp(24px, 4vw, 42px);
  border: 7px solid white;
  border-radius: 38px;
  text-align: center;
  background: #fffdf0;
  box-shadow: 0 14px 0 rgba(26, 91, 70, .3), 0 25px 60px #194c4544;
  animation: cardIn .55s cubic-bezier(.2,1.25,.4,1);
}
.start-garden, .finish-wreath { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 3.4rem; }
.start-garden b, .finish-wreath b { font-size: 5.5rem; filter: drop-shadow(0 7px 0 #f6b91e); transform: rotate(-7deg); }
.eyebrow { margin: 4px 0; color: #2f9361; font-size: .8rem; font-weight: 900; letter-spacing: .14em; }
h1, h2 { margin: 4px 0 14px; font-family: "Baloo 2", system-ui, sans-serif; line-height: .95; letter-spacing: -.035em; color: var(--navy); }
h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); }
h2 { font-size: clamp(2.2rem, 6vw, 3.7rem); }
h1 em, h2 em { color: #ed8b12; font-style: normal; }
.start-instruction { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px auto; font-size: 1.12rem; }
.start-instruction span { font-size: 2rem; }
.primary-button { min-height: 58px; padding: 12px 28px; border: 0; border-radius: 21px; cursor: pointer; color: #233344; font-size: 1.25rem; font-weight: 900; background: var(--yellow); box-shadow: 0 7px 0 #d99400; transition: transform .15s, box-shadow .15s; }
.primary-button:hover, .primary-button:focus-visible { outline: 4px solid white; box-shadow: 0 7px 0 #d99400, 0 0 0 7px var(--navy); transform: translateY(-2px); }
.primary-button:active { box-shadow: 0 3px 0 #d99400; transform: translateY(4px); }
.big-icon { font-size: 5rem; }
.celebration-card > p:not(.eyebrow) { font-size: 1.1rem; }
.final-score { display: inline-flex; gap: 8px; margin: 8px 0; padding: 10px 20px; border-radius: 99px; color: #5c4800; font-size: 1.25rem; background: #fff0a3; }
.confetti { position: fixed; z-index: 60; top: -20px; width: 13px; height: 22px; border-radius: 4px; pointer-events: none; animation: confettiFall 2.4s linear forwards; }

@keyframes hover { to { transform: translateY(-6px) rotate(3deg); } }
@keyframes flyWiggle { from { transform: rotate(-9deg) translateY(-2px); } to { transform: rotate(8deg) translateY(2px); } }
@keyframes nectarSip { to { transform: rotate(16deg) scale(.93); } }
@keyframes flowerHappy { 50% { transform: translate(-50%, -50%) scale(1.3) rotate(8deg); } }
@keyframes bubblePop { 50% { transform: translateX(-50%) scale(1.08); } }
@keyframes shake { 25% { transform: translate(-58%, -50%) rotate(-7deg); } 75% { transform: translate(-42%, -50%) rotate(7deg); } }
@keyframes pollenFly { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
@keyframes nectarRise { to { transform: translateY(-55px) scale(1.3); opacity: 0; } }
@keyframes grow { from { transform: scale(.2) translateY(20px); } to { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { to { transform: translateX(28px); } }
@keyframes cardIn { from { transform: translateY(30px) scale(.9); opacity: 0; } }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(740deg); } }

@media (max-width: 720px) {
  body { overflow: auto; }
  .game-shell { min-height: 100svh; }
  .topbar { min-height: 70px; gap: 8px; padding: 8px 12px; }
  .brand-bee { font-size: 2.2rem; }
  .brand span { display: none; }
  .brand strong { max-width: 130px; font-size: 1rem; line-height: 1; }
  .stats { gap: 8px; }
  .stat-pill small, .energy-label span { display: none; }
  .stat-icon { font-size: 1.2rem; }
  .stat-pill strong { font-size: 1.05rem; }
  .energy-wrap { width: 82px; }
  .energy-label { justify-content: flex-end; }
  .icon-button { width: 40px; height: 40px; }
  .mission-strip { min-height: 60px; gap: 12px; justify-content: space-between; padding: 6px 10px; }
  .level-badge { padding: 7px 10px; font-size: .75rem; }
  .target-copy .tiny-label { display: none; }
  .target-copy strong { font-size: 1rem; }
  .target-icon { font-size: 1.6rem; }
  .progress-dot { width: 25px; height: 25px; }
  .garden { min-height: 470px; }
  .message-bubble { top: 9px; width: max-content; max-width: 92%; padding: 8px 13px; }
  .growth-bed { right: 10px; bottom: 10px; width: 142px; }
  .lesson-card { min-height: 64px; justify-content: flex-start; font-size: 1rem; }
}

@media (max-height: 720px) and (min-width: 721px) {
  .game-shell { min-height: 560px; }
  .topbar { min-height: 70px; }
  .mission-strip { min-height: 58px; }
  .lesson-card { min-height: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
  .bee { transition-duration: .15s; }
}
