:root {
  color-scheme: dark;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #11253d, #1f3b63 50%, #2c5f69);
  color: #f5f7ff;
  padding: 12px;
}

.game-shell {
  width: min(96vw, 760px);
}

.panel {
  background: rgba(8, 16, 28, 0.83);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

#statusText {
  margin: 0 0 16px;
  color: #bcdcff;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.badge {
  background: #1d4c6f;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 1rem;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  background: #ffcf4d;
  color: #14213d;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.game-area {
  position: relative;
  min-height: 560px;
  border-radius: 20px;
  overflow: hidden;
  background: radial-gradient(circle at top, #2f7f4e, #153728 70%);
  border: 3px solid rgba(255, 255, 255, 0.16);
  cursor: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.world {
  position: absolute;
  inset: 0;
  width: 3200px;
  height: 2200px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.15), transparent 22%),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(135deg, #1f5b40, #0d2e1f 70%);
  background-size: auto, 80px 80px, 80px 80px, auto;
  transform-origin: top left;
}

.hitbox {
  position: absolute;
  width: 96px;
  height: 96px;
  border: 2px dashed rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.15) inset;
}

.slapper {
  position: absolute;
  width: clamp(64px, 11vw, 84px);
  height: clamp(64px, 11vw, 84px);
  z-index: 4;
  pointer-events: none;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.3));
}

.slapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(7, 12, 20, 0.68);
  z-index: 3;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  color: #102138;
  border-radius: 20px;
  padding: 24px;
  max-width: 280px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}

.overlay-card h2 {
  margin-top: 0;
}

.hint {
  margin: 14px 0 0;
  color: #cfe5ff;
  text-align: center;
}

.bug {
  position: absolute;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: none;
  background: transparent;
  font-size: 2rem;
  transform: translate(-50%, -50%);
  user-select: none;
  outline: none;
}

.bug:hover,
.bug:focus-visible {
  outline: none;
  box-shadow: none;
}

.bug.squashed {
  transform: translate(-50%, -50%) scale(0.7);
  opacity: 0.7;
}

@keyframes bob {
  from {
    transform: translate(-50%, -50%) translateY(0);
  }
  to {
    transform: translate(-50%, -50%) translateY(-8px);
  }
}

@media (max-width: 600px) {
  body {
    padding: 8px;
    align-items: start;
  }

  .panel {
    padding: 14px;
  }

  .hud {
    flex-direction: column;
    align-items: stretch;
  }

  .game-area {
    min-height: min(78vh, 560px);
  }

  .overlay-card {
    width: min(86vw, 280px);
    padding: 18px;
  }
}
