@import url("https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap");

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Fredoka", system-ui, sans-serif;
  color: #1a2e1a;
  background: linear-gradient(180deg, #87ceeb 0%, #b8e986 55%, #6ab04c 100%);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: manipulation;
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

header {
  text-align: center;
  margin-bottom: 0.75rem;
}

.back {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.back a {
  color: #2d5016;
  font-weight: 600;
  text-decoration: none;
}

.back a:hover {
  text-decoration: underline;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
}

.tagline {
  margin: 0.25rem 0 0;
  font-size: 1.05rem;
  opacity: 0.85;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
}

.stat {
  background: rgba(255, 255, 255, 0.75);
  border: 3px solid #2d5016;
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

.stat .label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  margin-right: 0.35rem;
}

.btn {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 3px solid #2d5016;
  border-radius: 999px;
  padding: 0.4rem 1.1rem;
  min-height: 44px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #2d5016;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn.primary {
  background: #ffd93d;
  color: #1a2e1a;
}

.btn.secondary {
  background: #fff;
  color: #1a2e1a;
}

#game {
  display: block;
  width: 100%;
  max-width: 960px;
  height: auto;
  margin: 0 auto;
  border: 4px solid #2d5016;
  border-radius: 16px;
  background: #7ec850;
  box-shadow: 0 12px 0 rgba(45, 80, 22, 0.35);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-controls {
  display: none;
  justify-content: center;
  margin-top: 0.75rem;
}

.fire-btn {
  font-size: 1.15rem;
  padding: 0.65rem 2rem;
  min-width: 200px;
  touch-action: manipulation;
}

body.touch-mode .touch-controls {
  display: flex;
}

body.touch-mode .help-desktop {
  display: none;
}

body.touch-mode .help-touch {
  display: block;
}

.help-touch {
  display: none;
}

.help {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.45;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

.help p {
  margin: 0;
  background: rgba(255, 255, 255, 0.6);
  padding: 0.65rem 1rem;
  border-radius: 12px;
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 40, 20, 0.55);
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

.card {
  background: #fff9e6;
  border: 4px solid #2d5016;
  border-radius: 20px;
  padding: 1.5rem 2rem;
  text-align: center;
  max-width: 90vw;
  box-shadow: 0 16px 0 #2d5016;
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.card p {
  margin: 0 0 1.25rem;
  font-size: 1.1rem;
}

@media (pointer: coarse) {
  .stat {
    padding: 0.5rem 1.1rem;
    font-size: 1.05rem;
  }

  .btn {
    min-height: 48px;
  }

  .touch-controls {
    display: flex;
  }

  .help-desktop {
    display: none;
  }

  .help-touch {
    display: block;
  }
}
