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

body {
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* Oversized so rotating corners never peek out of the viewport.
   repeating-conic-gradient with a 60° period (green+cream) — start and end
   color are both green so the repeat boundary is seamless. 10° blend zones. */
#bg {
  position: fixed;
  width: 200vmax;
  height: 200vmax;
  top: 50%;
  left: 50%;
  background: repeating-conic-gradient(
    #2d7a2d 0deg,
    #2d7a2d 20deg,
    #fef3c7 30deg,
    #fef3c7 50deg,
    #2d7a2d 60deg
  );
  animation: spin 40s linear infinite;
  z-index: 0;
}

@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Bear: centered on screen */
#bear-btn {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  background: none;
  border: none;
  cursor: crosshair;
  padding: 0;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.08s ease-out;
}

#bear-btn:active {
  transform: translate(-50%, -50%) scale(0.95);
}

#bear-btn img {
  width: clamp(300px, 55vmin, 650px);
  height: auto;
  display: block;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.4));
}

/* Fists: fixed in bottom corners */
.fist {
  position: fixed;
  bottom: 0;
  z-index: 1;
  background: none;
  border: none;
  cursor: crosshair;
  padding: 0;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.08s ease-out;
}

.fist img {
  width: 38vw;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,0.35));
}

#fist-right {
  right: 0;
  transform-origin: bottom right;
}

#fist-right:active {
  transform: scale(0.93);
}

#fist-left {
  left: 0;
  transform-origin: bottom left;
}

#fist-left:active {
  transform: scale(0.93);
}

#fist-left img {
  transform: scaleX(-1);
}

/* Overlay */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.78);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  -webkit-user-select: none;
  user-select: none;
}

#overlay.visible {
  display: flex;
}

#overlay h1 {
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: clamp(3.5rem, 14vw, 9rem);
  color: #ff2020;
  text-shadow: 4px 4px 0 #000, 6px 6px 0 rgba(0,0,0,0.4);
  letter-spacing: 0.04em;
  margin-bottom: 1.25rem;
  line-height: 1;
}

#overlay p {
  font-family: sans-serif;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: #ddd;
  margin-bottom: 2rem;
}

#bmac-link {
  display: inline-block;
  background: #fd0;
  color: #000;
  text-decoration: none;
  padding: 0.85rem 2.2rem;
  border-radius: 10px;
  font-family: sans-serif;
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 700;
  margin-bottom: 1rem;
  transition: background 0.15s, transform 0.1s;
}

#bmac-link:hover {
  background: #e6cc00;
  transform: translateY(-1px);
}

#fight-again-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.55);
  padding: 0.5rem 1.2rem;
  font-family: sans-serif;
  font-size: 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

#fight-again-btn:hover {
  border-color: rgba(255, 255, 255, 0.7);
  color: rgba(255, 255, 255, 0.9);
}

#corner-credit {
  position: fixed;
  top: 0.85rem;
  left: 1rem;
  z-index: 5;
  font-family: sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

#corner-credit a {
  color: rgba(0, 0, 0, 0.65);
  text-decoration: none;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.85);
}

#corner-credit a:hover {
  color: rgba(0, 0, 0, 0.9);
}

/* ── Bear effect animations ─────────────────────────────────────────── */

@keyframes crit-flash {
  0%, 100% { filter: drop-shadow(0 8px 32px rgba(0,0,0,0.4)); }
  35%       { filter: drop-shadow(0 8px 32px rgba(0,0,0,0.4))
                       drop-shadow(0 0 30px #ff3333)
                       drop-shadow(0 0 60px #ff0000)
                       brightness(1.4); }
}
#bear-btn img.anim-crit { animation: crit-flash 0.7s ease-out forwards; }

@keyframes stun-flash {
  0%, 100% { filter: drop-shadow(0 8px 32px rgba(0,0,0,0.4)); }
  50%       { filter: drop-shadow(0 8px 32px rgba(0,0,0,0.4))
                       drop-shadow(0 0 40px #ffd700)
                       drop-shadow(0 0 80px #ffaa00)
                       brightness(1.5); }
}
#bear-btn img.anim-stun { animation: stun-flash 0.4s ease-in-out 5; }

@keyframes bear-shake {
  0%, 100% { transform: translateX(0) rotate(0deg); }
  20%       { transform: translateX(-12px) rotate(-3deg); }
  50%       { transform: translateX(10px)  rotate(2deg); }
  80%       { transform: translateX(-6px)  rotate(-1deg); }
}
#bear-btn img.anim-shake { animation: bear-shake 0.5s ease-out forwards; }

@keyframes bear-dazed {
  0%, 100% { transform: rotate(0deg); }
  20%       { transform: rotate(-9deg) scale(1.02); }
  50%       { transform: rotate(8deg)  scale(0.99); }
  80%       { transform: rotate(-4deg); }
}
#bear-btn img.anim-dazed { animation: bear-dazed 0.9s ease-in-out forwards; }

@keyframes bear-dodge {
  0%, 100% { transform: translateX(0); }
  40%       { transform: translateX(var(--dodge-x, 55px)); }
}
#bear-btn img.anim-dodge { animation: bear-dodge 0.5s ease-in-out forwards; }

@keyframes bear-flinch {
  0%, 100% { transform: scale(1) translateY(0); }
  50%       { transform: scale(0.97) translateY(-5px); }
}
#bear-btn img.anim-flinch { animation: bear-flinch 0.3s ease-out forwards; }

/* ── Floating effect text ────────────────────────────────────────────── */

.effect-text {
  position: fixed;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: clamp(1.3rem, 4.5vmin, 2.8rem);
  pointer-events: none;
  z-index: 4;
  white-space: nowrap;
  animation: float-up 1.4s ease-out forwards;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.9), -1px -1px 0 rgba(0,0,0,0.6);
}

@keyframes float-up {
  0%   { opacity: 1; transform: translateX(-50%) translateY(0); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-90px); }
}

/* ── Stars (critical hit) ────────────────────────────────────────────── */

.star {
  position: fixed;
  top: 50%;
  left: 50%;
  font-size: clamp(1rem, 2.5vmin, 1.8rem);
  color: #ffd700;
  text-shadow: 0 0 6px #ff8800;
  pointer-events: none;
  z-index: 3;
  animation: star-fly 0.9s ease-out forwards;
}

@keyframes star-fly {
  0%   { opacity: 1; transform: translate(-50%, -50%) translate(0, 0) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -50%) translate(var(--dx), var(--dy)) scale(0.3); }
}
