:root {
  --bg: #eef3ea;
  --surface: #ffffff;
  --text: #0f2415;
  --muted: #2d4a32;
  --accent: #22863a;
  --accent-dark: #145a28;
  --accent-2: #d97706;
  --border: #9cb892;
  --shadow: rgba(15, 36, 21, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Nunito", system-ui, sans-serif;
  background: #fff;
  min-height: 100vh;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
}

body.modal-open {
  overflow: hidden;
}

.app {
  text-align: center;
  width: min(98vw, 960px);
}

header h1 {
  font-weight: 800;
  font-size: clamp(2rem, 4.5vmin, 3.25rem);
  letter-spacing: -0.02em;
  color: var(--accent-dark);
  text-shadow: 0 1px 0 #fff;
}

.subtitle {
  color: var(--muted);
  margin-top: 0.25rem;
  font-weight: 700;
  margin-left: auto;
  margin-right: auto;
  white-space: nowrap;
  max-width: none;
  font-size: clamp(0.7rem, 1.65vw, 1.5rem);
  letter-spacing: -0.01em;
}

.wheel-wrap {
  position: relative;
  width: min(88vmin, 820px);
  aspect-ratio: 1;
  margin: 0.75rem auto 0;
}

#wheel {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 0 5px #fff,
    0 0 0 12px var(--accent),
    0 16px 40px var(--shadow);
  display: block;
}

.pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 40px solid var(--accent-2);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.35));
  z-index: 3;
}

.spin-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22%;
  aspect-ratio: 1;
  max-width: 150px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: linear-gradient(145deg, #34a853, var(--accent));
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(0.85rem, 2.8vmin, 1.15rem);
  cursor: pointer;
  z-index: 4;
  box-shadow:
    0 5px 0 var(--accent-dark),
    0 10px 28px var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.spin-btn:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.05);
}

.spin-btn:active:not(:disabled) {
  transform: translate(-50%, -48%) scale(0.98);
  box-shadow:
    0 2px 0 var(--accent-dark),
    0 6px 20px var(--shadow);
}

.spin-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal:not([hidden]) {
  pointer-events: auto;
}

.modal.modal--visible {
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(15, 36, 21, 0.55);
  cursor: pointer;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 720px);
  background: var(--surface);
  border: 3px solid var(--accent);
  border-radius: 20px;
  padding: clamp(1.5rem, 4vmin, 2.5rem);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  transform: scale(0.88) translateY(24px);
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.modal.modal--visible .modal-panel {
  transform: scale(1) translateY(0);
}

.modal-label {
  font-size: clamp(1rem, 2.5vmin, 1.25rem);
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.modal-text {
  font-size: clamp(1.35rem, 4vmin, 2.1rem);
  font-weight: 800;
  line-height: 1.4;
  color: var(--text);
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: center;
  align-items: stretch;
}

.modal-btn {
  flex: 1 1 160px;
  max-width: 220px;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 800;
  font-size: clamp(0.95rem, 2.2vmin, 1.15rem);
  cursor: pointer;
  transition: transform 0.12s ease;
}

.modal-btn:active {
  transform: translateY(2px);
}

.modal-btn--spin {
  background: linear-gradient(145deg, #34a853, var(--accent));
  color: #fff;
  box-shadow: 0 4px 0 var(--accent-dark);
}

.modal-btn--ok {
  background: linear-gradient(145deg, #ffd93d, #f59e0b);
  color: #3d2a00;
  box-shadow: 0 4px 0 #b45309;
}

.modal-btn--bad {
  background: linear-gradient(145deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 4px 0 #991b1b;
}

.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 300;
}

.bugs-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 280;
  overflow: hidden;
}

.pest {
  position: absolute;
  font-size: clamp(1.75rem, 4.5vmin, 3.25rem);
  transform: scale(var(--scale, 1));
  animation: pest-wander var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

@keyframes pest-wander {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(var(--scale, 1));
  }
  25% {
    transform: translate(12vw, -8vh) rotate(15deg) scale(var(--scale, 1));
  }
  50% {
    transform: translate(-10vw, 10vh) rotate(-20deg) scale(var(--scale, 1));
  }
  75% {
    transform: translate(8vw, 6vh) rotate(10deg) scale(var(--scale, 1));
  }
  100% {
    transform: translate(0, 0) rotate(0deg) scale(var(--scale, 1));
  }
}

.alert-border {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 290;
  border: clamp(10px, 1.2vmin, 18px) solid #ef4444;
  box-shadow:
    inset 0 0 100px rgba(239, 68, 68, 0.45),
    0 0 40px rgba(239, 68, 68, 0.35);
  animation: alert-blink 0.5s ease-in-out infinite alternate;
}

body.alert-active {
  animation: screen-shake 0.35s ease-in-out 3;
}

@keyframes alert-blink {
  from {
    border-color: #ef4444;
    opacity: 1;
  }
  to {
    border-color: #fecaca;
    opacity: 0.55;
  }
}

@keyframes screen-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-4px, 2px);
  }
  75% {
    transform: translate(4px, -2px);
  }
}