/* ── Reset ── */
@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Nunito:wght@700;900&display=swap');

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

body {
  font-family: 'Bangers', 'Impact', system-ui, sans-serif;
  background: #e8200a;
  color: #1a1a1a;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

canvas {
  display: block;
}

/* ── Pop Art Halftone Dots Utility ── */
@keyframes driftDots {
  from { background-position: 0px 0px, 20px 20px; }
  to   { background-position: 40px 40px, -20px -20px; }
}

/* ── Overlay / Splash ── */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  /* Bold pop art red background */
  background: #e8200a;
  z-index: 100;
  transition: opacity 0.5s ease;
  overflow: hidden;
}

/* Halftone dot pattern over overlay */
#overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle 5px at center, rgba(0,0,0,0.18) 100%, transparent 100%),
    radial-gradient(circle 3px at center, rgba(255,255,255,0.07) 100%, transparent 100%);
  background-size: 26px 26px, 42px 42px;
  background-position: 0 0, 12px 12px;
  animation: driftDots 18s linear infinite;
  pointer-events: none;
  z-index: 0;
}

/* Diagonal comic-speed rays emanating from center */
#overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: conic-gradient(
    from 0deg at 50% 48%,
    rgba(255,220,0,0.22) 0deg,
    rgba(255,220,0,0)    11deg,
    rgba(255,220,0,0)    18deg,
    rgba(255,220,0,0.16) 18deg,
    rgba(255,220,0,0)    28deg,
    rgba(255,220,0,0)    36deg,
    rgba(255,220,0,0.22) 36deg,
    rgba(255,220,0,0)    46deg,
    rgba(255,220,0,0)    54deg,
    rgba(255,220,0,0.16) 54deg,
    rgba(255,220,0,0)    64deg,
    rgba(255,220,0,0)    72deg,
    rgba(255,220,0,0.22) 72deg,
    rgba(255,220,0,0)    82deg,
    rgba(255,220,0,0)    90deg,
    rgba(255,220,0,0.16) 90deg,
    rgba(255,220,0,0)    100deg,
    rgba(255,220,0,0)    108deg,
    rgba(255,220,0,0.22) 108deg,
    rgba(255,220,0,0)    118deg,
    rgba(255,220,0,0)    126deg,
    rgba(255,220,0,0.16) 126deg,
    rgba(255,220,0,0)    136deg,
    rgba(255,220,0,0)    144deg,
    rgba(255,220,0,0.22) 144deg,
    rgba(255,220,0,0)    154deg,
    rgba(255,220,0,0)    162deg,
    rgba(255,220,0,0.16) 162deg,
    rgba(255,220,0,0)    172deg,
    rgba(255,220,0,0)    180deg,
    rgba(255,220,0,0.22) 180deg,
    rgba(255,220,0,0)    190deg,
    rgba(255,220,0,0)    198deg,
    rgba(255,220,0,0.16) 198deg,
    rgba(255,220,0,0)    208deg,
    rgba(255,220,0,0)    216deg,
    rgba(255,220,0,0.22) 216deg,
    rgba(255,220,0,0)    226deg,
    rgba(255,220,0,0)    234deg,
    rgba(255,220,0,0.16) 234deg,
    rgba(255,220,0,0)    244deg,
    rgba(255,220,0,0)    252deg,
    rgba(255,220,0,0.22) 252deg,
    rgba(255,220,0,0)    262deg,
    rgba(255,220,0,0)    270deg,
    rgba(255,220,0,0.16) 270deg,
    rgba(255,220,0,0)    280deg,
    rgba(255,220,0,0)    288deg,
    rgba(255,220,0,0.22) 288deg,
    rgba(255,220,0,0)    298deg,
    rgba(255,220,0,0)    306deg,
    rgba(255,220,0,0.16) 306deg,
    rgba(255,220,0,0)    316deg,
    rgba(255,220,0,0)    324deg,
    rgba(255,220,0,0.22) 324deg,
    rgba(255,220,0,0)    334deg,
    rgba(255,220,0,0)    342deg,
    rgba(255,220,0,0.16) 342deg,
    rgba(255,220,0,0)    352deg,
    rgba(255,220,0,0)    360deg
  );
  pointer-events: none;
  z-index: 0;
}

#overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Logo ── */
#splash-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.9;
  user-select: none;
  animation: logoEntry 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
  z-index: 2;
  /* Starburst / explosion shape behind logo via pseudo */
}

/* Starburst behind logo */
#splash-logo::before {
  content: '';
  position: absolute;
  inset: -30px -40px;
  background: #FFD700;
  clip-path: polygon(
    50% 0%, 61% 20%, 82% 8%, 72% 28%, 98% 28%,
    80% 44%, 99% 58%, 78% 58%, 85% 82%, 64% 68%,
    50% 90%, 36% 68%, 15% 82%, 22% 58%, 1% 58%,
    20% 44%, 2% 28%, 28% 28%, 18% 8%, 39% 20%
  );
  z-index: -1;
  animation: starPulse 2.2s ease-in-out infinite;
}

@keyframes logoEntry {
  from { opacity: 0; transform: scale(0.6) rotate(-8deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes starPulse {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50%       { transform: scale(1.06) rotate(3deg); }
}

.splash-num {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 7.5rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 0.85;
  color: #1a1a1a;
  /* Bold comic outline via text-shadow */
  text-shadow:
    -4px -4px 0 #fff,
     4px -4px 0 #fff,
    -4px  4px 0 #fff,
     4px  4px 0 #fff,
     0   -5px 0 #fff,
     0    5px 0 #fff,
    -5px  0   0 #fff,
     5px  0   0 #fff;
  animation: numWobble 2.8s ease-in-out infinite;
}

@keyframes numWobble {
  0%, 100% { transform: rotate(-4deg) scale(1); }
  50%       { transform: rotate(3deg) scale(1.04); }
}

.splash-word {
  font-family: 'Bangers', 'Impact', sans-serif;
  font-size: 5.5rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 0.9;
  color: #e8200a;
  text-shadow:
    -3px -3px 0 #fff,
     3px -3px 0 #fff,
    -3px  3px 0 #fff,
     3px  3px 0 #fff,
     0   -4px 0 #fff,
     0    4px 0 #fff,
    -4px  0   0 #fff,
     4px  0   0 #fff;
  animation: wordBounce 2.8s ease-in-out infinite 0.15s;
}

@keyframes wordBounce {
  0%, 100% { transform: translateY(0) rotate(2deg); }
  50%       { transform: translateY(-5px) rotate(-1deg); }
}

/* Speech bubble tagline */
#splash-tagline {
  font-family: 'Bangers', sans-serif;
  font-size: 1.3rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #1a1a1a;
  background: #FFD700;
  padding: 0.35rem 1.2rem 0.3rem;
  border: 3px solid #1a1a1a;
  border-radius: 40px;
  box-shadow: 4px 4px 0 #1a1a1a;
  margin-top: 0.4rem;
  animation: fadeIn 0.8s ease 0.3s both;
  position: relative;
  z-index: 2;
}

/* Speech bubble tail */
#splash-tagline::after {
  content: '';
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 14px solid #1a1a1a;
}
#splash-tagline::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 11px solid #FFD700;
  z-index: 1;
}

#status-text {
  font-family: 'Nunito', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255,255,255,0.85);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.3rem;
  animation: fadeIn 0.8s ease 0.5s both;
  position: relative;
  z-index: 2;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}

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

/* ── Start Button — Pop Art Style ── */
button {
  font-family: 'Bangers', sans-serif;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  transform: translateY(-3px) scale(1.04);
}

button:active {
  transform: translateY(1px) scale(0.97);
  box-shadow: 2px 2px 0 #1a1a1a !important;
}

#start-btn {
  font-family: 'Bangers', sans-serif;
  padding: 0.85rem 3rem 0.7rem;
  font-size: 1.8rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 4px solid #1a1a1a;
  border-radius: 8px;
  background: linear-gradient(180deg, #00d4ff 0%, #009ac0 100%);
  color: #1a1a1a;
  box-shadow: 5px 5px 0 #1a1a1a;
  margin-top: 0.6rem;
  animation: fadeIn 0.8s ease 0.7s both, btnPulse 2.2s ease-in-out infinite 1.5s;
  position: relative;
  z-index: 2;
  overflow: hidden;
}

/* Comic highlight stripe */
#start-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: rgba(255,255,255,0.25);
  pointer-events: none;
  border-radius: 4px 4px 0 0;
}

@keyframes btnPulse {
  0%, 100% { box-shadow: 5px 5px 0 #1a1a1a; }
  50%       { box-shadow: 5px 5px 0 #1a1a1a, 0 0 20px rgba(0,212,255,0.5); }
}

/* ── Bold bottom & top stripe bars ── */
#overlay .stripe-bar,
#overlay .top-stripe-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 12px;
  background: repeating-linear-gradient(
    90deg,
    #1a1a1a 0px,
    #1a1a1a 24px,
    #FFD700 24px,
    #FFD700 48px
  );
  z-index: 2;
}
#overlay .stripe-bar     { bottom: 0; }
#overlay .top-stripe-bar { top: 0; }

/* ── HUD ── */
#hud {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  z-index: 50;
  pointer-events: none;
}

#chaos-meter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Bangers', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: #FFD700;
  text-shadow: 2px 2px 0 #1a1a1a, -1px -1px 0 #1a1a1a;
  background: rgba(0,0,0,0.7);
  padding: 0.3rem 0.75rem 0.2rem;
  border: 3px solid #FFD700;
  border-radius: 8px;
  box-shadow: 3px 3px 0 #1a1a1a;
}

#chaos-bar {
  width: 110px;
  height: 12px;
  background: rgba(255,255,255,0.15);
  border: 2px solid #FFD700;
  border-radius: 6px;
  overflow: hidden;
}

#chaos-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #FFD700, #FF8C00, #e8200a);
  border-radius: 4px;
  transition: width 0.3s ease;
}

#tool-indicator {
  font-family: 'Bangers', sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 2px 2px 0 #1a1a1a, -1px -1px 0 #1a1a1a;
  background: rgba(0,0,0,0.65);
  padding: 0.25rem 0.7rem 0.15rem;
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 6px;
}

#guy-count {
  margin-left: auto;
  font-family: 'Bangers', sans-serif;
  font-size: 1.2rem;
  letter-spacing: 0.1em;
  color: #FFD700;
  text-shadow: 2px 2px 0 #1a1a1a, -1px -1px 0 #1a1a1a;
  background: rgba(0,0,0,0.7);
  padding: 0.3rem 0.75rem 0.2rem;
  border: 3px solid #FFD700;
  border-radius: 8px;
  box-shadow: 3px 3px 0 #1a1a1a;
}