@import url("https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@500;600;700;800&display=swap");

:root {
  --ink: #263128;
  --cream: #fbf7ec;
  --paper: #fffdf5;
  --green: #294f37;
  --lime: #ddeb58;
  --orange: #ff6b35;
  --muted: #718071;
  --line: rgba(38, 49, 40, 0.16);
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: var(--cream);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  background:
    radial-gradient(circle at 12% 10%, rgba(221, 235, 88, 0.2), transparent 24rem),
    var(--cream);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  height: 100svh;
  min-height: 620px;
  display: grid;
  grid-template-rows: 72px 72px 1fr 46px;
  padding: 0 clamp(16px, 3vw, 42px);
}

.topbar,
.hud,
footer {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 34px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--lime);
  font-size: 14px;
}

.icon-button {
  width: 38px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font: 600 18px "DM Mono", monospace;
  cursor: pointer;
}

.hud {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  font-family: "DM Mono", monospace;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.stat-center {
  align-items: center;
}

.stat-right {
  align-items: flex-end;
}

.stat-label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.14em;
}

.stat strong {
  font-size: 19px;
  font-weight: 500;
}

.spray-meter {
  display: flex;
  gap: 4px;
  height: 18px;
  align-items: center;
}

.spray-bar {
  display: block;
  width: 5px;
  height: 14px;
  border-radius: 1px;
  background: var(--ink);
  transition: opacity 180ms ease, transform 180ms ease;
}

.spray-bar.empty {
  opacity: 0.12;
  transform: scaleY(0.55);
}

.arena {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0)),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(41, 79, 55, 0.025) 80px),
    #e9edcf;
  cursor: crosshair;
}

.arena::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 19%;
  background:
    linear-gradient(155deg, transparent 45%, rgba(41, 79, 55, 0.18) 46% 48%, transparent 49%) 0 0 / 60px 30px,
    #cbd77c;
  clip-path: polygon(0 35%, 7% 24%, 14% 42%, 21% 16%, 28% 33%, 36% 14%, 43% 30%, 50% 5%, 58% 36%, 66% 20%, 73% 42%, 81% 15%, 89% 33%, 100% 12%, 100% 100%, 0 100%);
}

.sun {
  position: absolute;
  top: 9%;
  right: 9%;
  width: clamp(58px, 8vw, 100px);
  aspect-ratio: 1;
  border: 1px solid rgba(38, 49, 40, 0.2);
  border-radius: 50%;
  background: var(--lime);
  box-shadow: 0 0 0 13px rgba(221, 235, 88, 0.18);
}

.cloud {
  position: absolute;
  width: 120px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 253, 245, 0.5);
  filter: blur(4px);
}

.cloud-one {
  top: 18%;
  left: 10%;
}

.cloud-two {
  top: 31%;
  right: 26%;
  transform: scale(0.7);
}

.plant {
  position: absolute;
  bottom: 9%;
  z-index: 1;
  color: var(--green);
  font-size: 110px;
  opacity: 0.36;
}

.plant-left {
  left: 3%;
  transform: rotate(-20deg);
}

.plant-right {
  right: 4%;
  transform: rotate(22deg) scaleX(-1);
}

.game-card {
  position: absolute;
  z-index: 20;
  top: 50%;
  left: 50%;
  width: min(620px, calc(100% - 32px));
  padding: clamp(26px, 3.5vw, 42px);
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(255, 253, 245, 0.94);
  border: 1px solid var(--ink);
  box-shadow: 12px 12px 0 rgba(38, 49, 40, 0.12);
  transition: opacity 220ms ease, transform 220ms ease;
}

.game-card.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -46%);
}

.eyebrow {
  font: 500 10px "DM Mono", monospace;
  letter-spacing: 0.16em;
  color: var(--orange);
}

h1,
h2 {
  margin: 10px 0 8px;
  font-size: clamp(38px, 6vw, 62px);
  letter-spacing: -0.065em;
  line-height: 0.95;
}

h2 {
  font-size: clamp(34px, 5vw, 52px);
}

.game-card p {
  margin: 0 auto 24px;
  max-width: 330px;
  color: #5d685e;
  font-size: 14px;
  line-height: 1.6;
}

.game-card .final-score {
  margin: 0 auto 6px;
  color: var(--ink);
  font: 500 20px "DM Mono", monospace;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font: 700 11px "Manrope", sans-serif;
  letter-spacing: 0.11em;
  cursor: pointer;
  box-shadow: 0 5px 0 #0e160f;
  transition: transform 100ms ease, box-shadow 100ms ease, background 150ms ease;
}

.primary-button:hover {
  background: var(--green);
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #0e160f;
}

.control-hint {
  display: block;
  margin-top: 18px;
  color: var(--muted);
  font: 400 10px "DM Mono", monospace;
}

.phone-install {
  display: block;
  margin-top: 9px;
  color: var(--orange);
  font: 500 9px "DM Mono", monospace;
}

@media (display-mode: standalone) {
  .phone-install {
    color: var(--green);
  }

  .phone-install::before {
    content: "HOME SCREEN APP ACTIVE";
    font-weight: 500;
  }

  .phone-install {
    font-size: 0;
  }

  .phone-install::before {
    font-size: 9px;
  }
}

.weapon-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 22px;
}

.weapon-choice {
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.weapon-choice:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}

.weapon-choice.selected {
  border-color: var(--ink);
  background: var(--lime);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.weapon-icon {
  display: grid;
  width: 30px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: var(--lime);
  font: 500 16px "DM Mono", monospace;
}

.weapon-choice b,
.weapon-choice small {
  display: block;
}

.weapon-choice b {
  font: 700 11px "Manrope", sans-serif;
  white-space: nowrap;
}

.weapon-choice small {
  margin-top: 2px;
  color: var(--muted);
  font: 400 8px "DM Mono", monospace;
  white-space: nowrap;
}

.mosquito-layer,
.effect-layer {
  position: absolute;
  z-index: 7;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.effect-layer {
  z-index: 12;
}

.mosquito {
  --x: 62%;
  --y: 34%;
  position: absolute;
  z-index: 8;
  left: var(--x);
  top: var(--y);
  width: clamp(108px, 12vw, 158px);
  aspect-ratio: 3 / 2;
  height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: crosshair;
  filter: drop-shadow(0 8px 4px rgba(38, 49, 40, 0.2));
  transition: left 600ms cubic-bezier(0.3, 0.8, 0.4, 1), top 600ms cubic-bezier(0.3, 0.8, 0.4, 1);
}

.mosquito img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.mosquito:not(.active) {
  opacity: 0;
  pointer-events: none;
}

.mosquito.active {
  animation: hover 380ms ease-in-out infinite alternate;
}

.mosquito.hit {
  animation: hit 280ms ease-out forwards;
}

.weapon-tool {
  position: absolute;
  z-index: 15;
  left: 50%;
  top: 65%;
  width: 94px;
  height: 146px;
  opacity: 0;
  pointer-events: none;
  will-change: left, top, transform;
  transition: opacity 120ms ease;
}

.weapon-tool.visible {
  opacity: 1;
}

.spray-weapon,
.swatter-weapon,
.zapper-weapon {
  position: absolute;
  inset: 0;
  display: none;
}

.weapon-spray .spray-weapon,
.weapon-swatter .swatter-weapon,
.weapon-zapper .zapper-weapon {
  display: block;
}

.weapon-tool.weapon-spray {
  transform: translate(-91px, -25px) rotate(-6deg);
}

.weapon-tool.weapon-spray.attacking {
  animation: can-kick 180ms ease-out;
}

.bottle-body {
  position: absolute;
  inset: 39px 7px 0;
  border: 2px solid var(--ink);
  border-radius: 14px 14px 5px 5px;
  background: var(--orange);
  box-shadow: inset -12px 0 rgba(38, 49, 40, 0.08);
}

.bottle-body::before {
  content: "";
  position: absolute;
  top: -16px;
  left: 24px;
  width: 28px;
  height: 17px;
  border: 2px solid var(--ink);
  background: var(--paper);
}

.nozzle {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 36px;
  width: 52px;
  height: 20px;
  border: 2px solid var(--ink);
  border-radius: 3px 9px 2px 2px;
  background: var(--paper);
}

.nozzle::before {
  content: "";
  position: absolute;
  right: -8px;
  top: 5px;
  width: 8px;
  height: 7px;
  background: var(--ink);
}

.bottle-label {
  position: absolute;
  top: 25px;
  left: 8px;
  right: 8px;
  padding: 10px 2px;
  border: 1px solid var(--ink);
  background: var(--paper);
  text-align: center;
  font: 500 8px/1.2 "DM Mono", monospace;
}

.bottle-label b {
  font-size: 10px;
}

.weapon-tool.weapon-swatter {
  width: 94px;
  height: 190px;
  transform: translate(-47px, -46px) rotate(-18deg);
  transform-origin: 50% 30px;
}

.weapon-tool.weapon-swatter.attacking {
  animation: swatter-smack 220ms ease-out;
}

.swatter-head,
.zapper-head {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 9px;
  width: 76px;
  height: 86px;
  border: 4px solid var(--ink);
  border-radius: 38%;
  background:
    linear-gradient(90deg, transparent 45%, rgba(38, 49, 40, 0.34) 46% 54%, transparent 55%) 0 0 / 15px 15px,
    linear-gradient(transparent 45%, rgba(38, 49, 40, 0.34) 46% 54%, transparent 55%) 0 0 / 15px 15px,
    var(--orange);
  box-shadow: 4px 5px 0 rgba(38, 49, 40, 0.15);
}

.weapon-handle {
  position: absolute;
  top: 78px;
  left: 41px;
  width: 13px;
  height: 112px;
  border: 3px solid var(--ink);
  border-radius: 0 0 7px 7px;
  background: var(--paper);
}

.weapon-tool.weapon-zapper {
  width: 88px;
  height: 180px;
  transform: translate(-44px, -43px) rotate(7deg);
  transform-origin: 50% 35px;
}

.weapon-tool.weapon-zapper.attacking {
  animation: zap-pulse 230ms ease-out;
}

.zapper-head {
  left: 6px;
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--paper) 0 12%, transparent 13%),
    repeating-radial-gradient(circle, transparent 0 8px, rgba(38, 49, 40, 0.22) 9px 11px),
    var(--lime);
  color: var(--ink);
  font: 800 34px "Manrope", sans-serif;
}

.zapper-weapon .weapon-handle {
  top: 68px;
  left: 38px;
}

.attack-particle {
  --tx: 0px;
  --ty: 0px;
  position: absolute;
  pointer-events: none;
}

.attack-particle.spray {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 9px rgba(255, 255, 255, 0.9);
  animation: mist-fly 440ms ease-out forwards;
}

.attack-particle.swatter {
  width: 116px;
  height: 116px;
  border: 3px solid rgba(255, 107, 53, 0.76);
  border-radius: 50%;
  animation: impact-ring 300ms ease-out forwards;
}

.attack-particle.zapper {
  width: 7px;
  height: 38px;
  background: var(--lime);
  clip-path: polygon(50% 0, 100% 0, 66% 42%, 100% 42%, 24% 100%, 40% 56%, 0 56%);
  filter: drop-shadow(0 0 5px white);
  animation: zap-fly 380ms ease-out forwards;
}

.level-banner {
  position: absolute;
  z-index: 25;
  top: 50%;
  left: 50%;
  min-width: 260px;
  padding: 24px 34px;
  border: 2px solid var(--ink);
  background: var(--lime);
  color: var(--ink);
  text-align: center;
  font: 800 clamp(28px, 5vw, 52px)/1 "Manrope", sans-serif;
  box-shadow: 10px 10px 0 rgba(38, 49, 40, 0.16);
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.level-banner small {
  display: block;
  margin-bottom: 8px;
  font: 500 9px "DM Mono", monospace;
  letter-spacing: 0.13em;
}

.level-banner.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -44%);
}

.spray-cloud {
  position: absolute;
  z-index: 9;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  opacity: 0;
  pointer-events: none;
}

.spray-cloud.burst {
  animation: spray 330ms ease-out forwards;
}

.streak {
  position: absolute;
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  color: var(--orange);
  font: 800 22px "Manrope", sans-serif;
  transform: translate(-50%, -50%);
}

.streak.show {
  animation: streak 650ms ease-out forwards;
}

footer {
  justify-content: space-between;
  color: var(--muted);
  font: 400 9px "DM Mono", monospace;
  letter-spacing: 0.05em;
}

footer p {
  margin: 0;
}

.live-dot {
  display: inline-block;
  width: 6px;
  aspect-ratio: 1;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--orange);
}

@keyframes hover {
  from { margin-top: -4px; }
  to { margin-top: 4px; }
}

@keyframes hit {
  35% { transform: translate(-50%, -50%) scale(1.12) rotate(-8deg); }
  100% { transform: translate(-50%, -50%) scale(0.2) rotate(80deg); opacity: 0; }
}

@keyframes can-kick {
  50% { transform: translate(-91px, -21px) rotate(-14deg); }
}

@keyframes swatter-smack {
  0% { transform: translate(-47px, -46px) rotate(-18deg); }
  55% { transform: translate(-47px, -46px) rotate(30deg) scale(0.92); }
  100% { transform: translate(-47px, -46px) rotate(-18deg); }
}

@keyframes zap-pulse {
  50% { transform: translate(-44px, -43px) rotate(7deg) scale(1.13); filter: brightness(1.4); }
}

@keyframes mist-fly {
  0% { opacity: 0.95; transform: translate(-50%, -50%) scale(0.35); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.75); }
}

@keyframes impact-ring {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.18); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.08); }
}

@keyframes zap-fly {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.35) rotate(-12deg); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1.2) rotate(18deg); }
}

@keyframes spray {
  0% { opacity: 0.9; transform: translate(-50%, -50%) scale(0.3); box-shadow: 0 0 white; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); box-shadow: 18px -8px white, -16px 6px white, 5px 16px white; }
}

@keyframes streak {
  0% { opacity: 0; transform: translate(-50%, -10%) scale(0.7); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -100%) scale(1.1); }
}

@media (max-width: 600px) {
  .game-shell {
    min-height: 560px;
    grid-template-rows: 60px 64px 1fr 38px;
    padding: 0 12px env(safe-area-inset-bottom);
  }

  .game-card {
    padding: 26px 16px;
  }

  .weapon-choice {
    min-height: 62px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 3px;
    padding: 7px 3px;
    text-align: center;
  }

  .weapon-choice small {
    display: none;
  }

  .weapon-choice b {
    font-size: 9px;
  }

  .mosquito {
    width: clamp(94px, 29vw, 122px);
  }

  .weapon-tool {
    scale: 0.78;
    transform-origin: top left;
  }

  .plant {
    font-size: 80px;
  }
}

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