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

:root {
  --ink: #3d164f;
  --purple: #681b78;
  --purple-dark: #461052;
  --cream: #fff9e8;
  --pink: #ff3d88;
  --coral: #ff715f;
  --yellow: #ffd23f;
  --yellow-deep: #eca900;
  --mint: #78db91;
  --sky: #60cef5;
  --paper: #fffdf7;
  --shadow: 0 12px 0 rgba(70, 16, 82, 0.14), 0 22px 44px rgba(70, 16, 82, 0.16);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(255,255,255,.9) 0 5px, transparent 6px),
    radial-gradient(circle at 84% 8%, rgba(255,255,255,.75) 0 7px, transparent 8px),
    linear-gradient(145deg, #91e6f9 0%, #c9f4da 47%, #fff5a5 100%);
  overflow-x: hidden;
}

button { font: inherit; }

button:focus-visible {
  outline: 5px solid #1f74ff;
  outline-offset: 4px;
}

.game-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  color: white;
  font-family: Arial, sans-serif;
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 1;
  transform: rotate(-18deg);
  border: 4px solid white;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 5px 0 var(--purple-dark);
}

.eyebrow, .challenge-number, .feedback-label, .tray-label {
  margin: 0;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.brand .eyebrow { color: var(--purple); }

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: clamp(1.75rem, 4.2vw, 2.7rem);
  line-height: .9;
  letter-spacing: -.035em;
}

.score-card {
  display: flex;
  min-width: 126px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 16px;
  color: white;
  font-size: 1.25rem;
  border: 3px solid white;
  border-radius: 20px;
  background: var(--purple);
  box-shadow: 0 6px 0 var(--purple-dark);
}

.score-icon { font-size: 1.45rem; }

.mission-card {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 26px;
  padding: 17px 22px;
  border: 4px solid var(--purple);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 7px 0 rgba(70,16,82,.18);
}

.challenge-number { color: var(--pink); }

.mission-card h2 {
  margin-bottom: 1px;
  font-family: "Baloo 2", system-ui, sans-serif;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1;
}

.clue {
  margin-bottom: 0;
  color: #6c4b75;
  font-size: 1rem;
  font-weight: 700;
}

.progress-wrap { min-width: 230px; }

.progress-label {
  display: block;
  margin-bottom: 5px;
  color: #6c4b75;
  font-size: .8rem;
  font-weight: 900;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.progress-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.progress-segment {
  width: 48px;
  height: 14px;
  border: 2px solid #dbcbe0;
  border-radius: 99px;
  background: #eee5ef;
  transition: .35s ease;
}

.progress-segment.filled {
  border-color: var(--yellow-deep);
  background: var(--yellow);
  transform: translateY(-2px);
}

.play-area {
  position: relative;
  min-height: 560px;
  margin-top: -3px;
  overflow: hidden;
  border: 4px solid var(--purple);
  border-top-width: 0;
  border-radius: 0 0 38px 38px;
  background:
    radial-gradient(circle at 14% 72%, rgba(255,255,255,.75) 0 2px, transparent 3px),
    radial-gradient(circle at 90% 24%, rgba(255,255,255,.7) 0 3px, transparent 4px),
    linear-gradient(180deg, #f6effa 0%, #fffdf4 74%);
  box-shadow: var(--shadow);
}

.evidence-tag {
  position: absolute;
  z-index: 4;
  top: 24px;
  left: 24px;
  padding: 8px 13px;
  color: white;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .08em;
  border-radius: 10px;
  background: var(--purple);
  transform: rotate(-2deg);
}

.flower-stage {
  position: relative;
  display: grid;
  min-height: 555px;
  place-items: center;
  overflow: hidden;
}

.flower-stage::after {
  position: absolute;
  right: -70px;
  bottom: -90px;
  width: 250px;
  height: 250px;
  content: "";
  border: 40px solid rgba(96,206,245,.14);
  border-radius: 50%;
}

.flower-wrap {
  position: relative;
  z-index: 2;
  width: min(550px, 86vw);
  aspect-ratio: 1;
  transform: scale(1);
  transition: transform .7s cubic-bezier(.2,.9,.2,1);
}

.flower-wrap.zoomed { transform: scale(1.43); }

.flower-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 20px 18px rgba(92, 23, 105, .18));
  user-select: none;
}

.hotspot-layer { position: absolute; inset: 0; }

.hotspot {
  position: absolute;
  display: grid;
  min-width: 58px;
  min-height: 58px;
  padding: 0;
  place-items: center;
  cursor: pointer;
  border: 3px dashed rgba(255,255,255,.95);
  border-radius: 50%;
  background: rgba(255, 210, 63, .16);
  box-shadow: 0 0 0 4px rgba(104, 27, 120, .15);
  animation: pulse 1.55s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.hotspot:hover { background: rgba(255, 210, 63, .35); }
.hotspot::after { color: white; content: "⌕"; font-size: 1.8rem; font-weight: 900; }

.hotspot.petals {
  inset: 5% 7% 6% 7%;
  width: 86%;
  height: 89%;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.hotspot.petals::after {
  position: absolute;
  top: 23%;
  left: 13%;
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 3px dashed white;
  border-radius: 50%;
  background: rgba(104,27,120,.18);
  box-shadow: 0 0 0 5px rgba(255,61,136,.25);
  animation: pulse 1.55s ease-in-out infinite;
}

.hotspot.center-decoy {
  z-index: 2;
  top: 30%;
  left: 32%;
  width: 36%;
  height: 38%;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  animation: none;
}

.hotspot.center-decoy::after { content: none; }

.hotspot.pollen { top: 32%; left: 58%; width: 13%; height: 13%; }
.hotspot.stigma { top: 28%; left: 45%; width: 13%; height: 15%; }

.hotspot.location {
  width: 64px;
  height: 64px;
  border-style: solid;
  border-color: white;
  background: var(--yellow);
  box-shadow: 0 6px 0 var(--yellow-deep), 0 0 0 5px rgba(104,27,120,.24);
}

.hotspot.location::after { content: "•••"; color: #8f5400; font-size: 1.25rem; letter-spacing: -2px; }
.location-one { top: 23%; left: 17%; }
.location-two { top: 31%; left: 46%; }
.location-three { top: 67%; left: 71%; }

.sun-ray {
  position: absolute;
  width: 50px;
  height: 10px;
  border-radius: 99px;
  background: var(--yellow);
  opacity: .7;
}

.ray-one { top: 16%; right: 15%; transform: rotate(-35deg); }
.ray-two { top: 27%; right: 10%; width: 34px; transform: rotate(-10deg); }
.ray-three { bottom: 18%; left: 10%; transform: rotate(28deg); }

.try-again {
  position: absolute;
  z-index: 5;
  right: 22px;
  bottom: 20px;
  min-height: 28px;
  margin: 0;
  color: var(--purple);
  font-size: 1rem;
  font-weight: 900;
}

.feedback {
  position: absolute;
  z-index: 8;
  right: 24px;
  bottom: 24px;
  left: 24px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 17px;
  padding: 16px 18px;
  border: 4px solid var(--purple);
  border-radius: 24px;
  background: white;
  box-shadow: 0 8px 0 rgba(70,16,82,.22), 0 16px 30px rgba(70,16,82,.16);
  animation: slideUp .45s cubic-bezier(.2,.9,.2,1);
}

.feedback[hidden] { display: none; }

.badge-pop {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  font-size: 2.15rem;
  border: 5px solid white;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px var(--yellow-deep);
  animation: badgeBounce .55s .15s both;
}

.feedback-label { margin-bottom: 1px; color: #b26000; }
.feedback h3 { margin-bottom: 0; font: 800 1.35rem/1 "Baloo 2", sans-serif; }
.feedback p:last-child { margin: 2px 0 0; font-size: 1rem; font-weight: 700; }

.next-button, .play-again {
  min-height: 54px;
  padding: 10px 21px;
  cursor: pointer;
  color: white;
  font-size: 1rem;
  font-weight: 900;
  border: 0;
  border-radius: 16px;
  background: var(--purple);
  box-shadow: 0 5px 0 var(--purple-dark);
  transition: transform .15s, box-shadow .15s;
}

.next-button:active, .play-again:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--purple-dark); }

.badge-tray {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: fit-content;
  max-width: 94%;
  margin: -1px auto 0;
  padding: 13px 22px;
  color: white;
  border-radius: 0 0 22px 22px;
  background: var(--purple);
}

.tray-label { white-space: nowrap; }
.badge-slots { display: flex; gap: 8px; }

.badge-slot {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: rgba(255,255,255,.6);
  font-size: 1rem;
  font-weight: 900;
  border: 2px dashed rgba(255,255,255,.45);
  border-radius: 50%;
}

.badge-slot.earned {
  color: var(--purple);
  border: 2px solid white;
  background: var(--yellow);
  animation: badgeBounce .5s both;
}

.tap-tip { font-size: .88rem; font-weight: 800; white-space: nowrap; }

.case-solved {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background: rgba(61, 22, 79, .85);
  backdrop-filter: blur(8px);
}

.case-solved[hidden] { display: none; }

.solved-card {
  position: relative;
  width: min(540px, 100%);
  padding: 44px clamp(24px, 6vw, 58px) 38px;
  overflow: hidden;
  text-align: center;
  border: 5px solid var(--purple-dark);
  border-radius: 36px;
  background: var(--paper);
  box-shadow: 0 12px 0 #2f0a39, 0 25px 70px rgba(0,0,0,.35);
  animation: solvedIn .65s cubic-bezier(.2,.9,.2,1);
}

.solved-card::before, .solved-card::after {
  position: absolute;
  width: 110px;
  height: 110px;
  content: "";
  border-radius: 50%;
  background: var(--pink);
  opacity: .13;
}

.solved-card::before { top: -55px; left: -30px; }
.solved-card::after { right: -30px; bottom: -55px; background: var(--sky); }

.solved-badge { font-size: 4.4rem; filter: drop-shadow(0 7px 0 rgba(236,169,0,.35)); }
.solved-card .eyebrow { margin-top: 8px; color: #a05a00; }
.solved-card h2 { margin-bottom: 5px; color: var(--purple); font: 800 clamp(2.5rem, 9vw, 4.3rem)/.95 "Baloo 2", sans-serif; }
.solved-card > p:not(.eyebrow) { font-size: 1.2rem; font-weight: 800; line-height: 1.4; }

.final-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0;
  padding: 15px 18px;
  color: var(--purple);
  font-size: 1.05rem;
  font-weight: 800;
  border: 3px solid #f0d96c;
  border-radius: 17px;
  background: #fff6bf;
}

.final-score strong { font-size: 1.6rem; }
.play-again { width: 100%; font-size: 1.15rem; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes badgeBounce {
  0% { opacity: 0; transform: scale(.3) rotate(-18deg); }
  70% { transform: scale(1.18) rotate(8deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes solvedIn {
  from { opacity: 0; transform: scale(.7) rotate(-3deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@media (max-width: 720px) {
  .game-shell { width: min(100% - 16px, 680px); padding-top: 10px; }
  .brand-mark { width: 48px; height: 48px; font-size: 2.65rem; }
  .score-card { min-width: 104px; padding: 8px 12px; }
  .mission-card { grid-template-columns: 1fr; gap: 10px; padding: 14px 16px; }
  .progress-wrap { min-width: 0; }
  .progress-label { text-align: left; }
  .progress-segment { width: auto; }
  .play-area, .flower-stage { min-height: 470px; }
  .flower-wrap { width: min(480px, 108vw); }
  .flower-wrap.zoomed { transform: scale(1.3); }
  .feedback { right: 12px; bottom: 12px; left: 12px; grid-template-columns: auto 1fr; gap: 12px; padding: 13px; }
  .badge-pop { width: 56px; height: 56px; font-size: 1.65rem; }
  .next-button { grid-column: 1 / -1; width: 100%; }
  .feedback p:last-child { font-size: .94rem; }
  .badge-tray { gap: 10px; padding: 11px 14px; }
  .tap-tip { display: none; }
}

@media (max-width: 430px) {
  .topbar { gap: 8px; }
  .brand { gap: 8px; }
  .brand .eyebrow { font-size: .63rem; }
  h1 { font-size: 1.55rem; }
  .score-card { min-width: 88px; font-size: 1rem; }
  .score-icon { display: none; }
  .play-area, .flower-stage { min-height: 430px; }
  .evidence-tag { top: 16px; left: 14px; }
  .flower-wrap { width: 118vw; }
  .badge-tray { max-width: 100%; }
  .tray-label { display: none; }
}

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