:root {
  --p1-color: #3b82f6;
  --p2-color: #ef4444;
  --bg-dark: #0f172a;
  --glass: rgba(0, 0, 0, 0.6);
  --border: rgba(255, 255, 255, 0.15);
}

body {
  /* Background Image with Dark Overlay */
  background:
    linear-gradient(rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.8)),
    url("background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;

  color: white;
  font-family: "Outfit", sans-serif;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
  font-size: 14px;
}

.arena {
  width: 95%;
  max-width: 800px;
  text-align: center;
  position: relative;
}

header h1 {
  font-size: 2rem;
  margin: 0;
  font-weight: 900;
  letter-spacing: -1px;
  text-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

header h1 span {
  color: var(--p2-color);
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

#start-btn {
  background: white;
  border: none;
  padding: 8px 20px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  margin: 15px 0;
  transition: 0.3s;
  z-index: 10;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
  font-family: "Outfit", sans-serif;
}

#start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
}

#start-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.battle-floor {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 10px;
  perspective: 1000px;
}

.player-side {
  flex: 1;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 15px;
  backdrop-filter: blur(12px);
  transition: 0.4s;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.player-side.active-turn {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.15);
}

.display-container {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  margin-bottom: 10px;
}

.mystery-box {
  width: 100px;
  height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 3rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
  0%,
  100% {
    border-color: rgba(255, 255, 255, 0.1);
    transform: scale(1);
  }

  50% {
    border-color: var(--p1-color);
    transform: scale(1.05);
  }
}

.pokemon-img {
  width: 100%;
  max-width: 140px;
  filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.6));
  animation: appear 0.5s ease-out;
  transition: transform 0.2s;
  z-index: 2;
}

/* Combat Animations */
@keyframes lunge-right {
  0% {
    transform: translateX(0);
  }

  40% {
    transform: translateX(40px) rotate(5deg);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes lunge-left {
  0% {
    transform: translateX(0);
  }

  40% {
    transform: translateX(-40px) rotate(-5deg);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes damage-flash {
  0% {
    filter: brightness(1) sepia(0) saturate(1) hue-rotate(0deg);
  }

  20% {
    filter: brightness(3) sepia(1) saturate(5) hue-rotate(-50deg);
    opacity: 0.8;
  }

  100% {
    filter: brightness(1);
    opacity: 1;
  }
}

.lunge-right {
  animation: lunge-right 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.lunge-left {
  animation: lunge-left 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hit-flash {
  animation: damage-flash 0.3s ease-out;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pokemon-name {
  text-transform: capitalize;
  font-size: 1.2rem;
  margin: 5px 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.type-badge {
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.15);
  padding: 3px 10px;
  border-radius: 20px;
  margin-top: -2px;
  margin-bottom: 8px;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 1px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  margin-bottom: 3px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.bar-container {
  height: 8px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hp-fill {
  height: 100%;
  width: 100%;
  background: #22c55e;
  transition:
    0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275),
    background 0.4s;
}

.hp-fill.high {
  background: linear-gradient(to right, #4ade80, #22c55e);
}

.hp-fill.mid {
  background: linear-gradient(to right, #fbbf24, #f59e0b);
}

.hp-fill.low {
  background: linear-gradient(to right, #ef4444, #b91c1c);
}

.energy-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #3b82f6);
  box-shadow: 0 0 10px #3b82f6;
  transition: 0.4s;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.moves-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.move-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  padding: 8px 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.move-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.2);
  background: rgba(255, 255, 255, 0.2);
}

.move-btn::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: rgba(255, 255, 255, 0.4);
}

/* Move Types Colors */
.type-normal {
  background: #737373;
}

.type-fire {
  background: #b91c1c;
}

.type-water {
  background: #1d4ed8;
}

.type-grass {
  background: #15803d;
}

.type-electric {
  background: #a16207;
}

.type-ice {
  background: #0e7490;
}

.type-fighting {
  background: #9a3412;
}

.type-poison {
  background: #7e22ce;
}

.type-ground {
  background: #a16207;
}

.type-flying {
  background: #4f46e5;
}

.type-psychic {
  background: #be185d;
}

.type-bug {
  background: #65a30d;
}

.type-rock {
  background: #78716c;
}

.type-ghost {
  background: #4c1d95;
}

.type-dragon {
  background: #7f1d1d;
}

.type-steel {
  background: #52525b;
}

.type-dark {
  background: #1e293b;
}

.type-fairy {
  background: #db2777;
}

.move-name {
  font-weight: 800;
  font-size: 0.75rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.move-meta {
  font-size: 0.65rem;
  opacity: 0.9;
  margin-top: 1px;
  text-transform: uppercase;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.3 !important;
}

.vs {
  font-size: 2rem;
  font-weight: 900;
  font-style: italic;
  opacity: 0.4;
  text-shadow: 0 0 20px black;
}

.battle-log {
  margin-top: 15px;
  background: rgba(0, 0, 0, 0.6);
  padding: 10px;
  border-radius: 10px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.9rem;
  backdrop-filter: blur(5px);
}

.damage-text {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: 900;
  color: #ef4444;
  text-shadow:
    0 0 5px black,
    0 0 10px black;
  animation: floatUp 1s forwards;
  pointer-events: none;
  z-index: 100;
}

@keyframes floatUp {
  0% {
    opacity: 1;
    transform: translate(-50%, 0) scale(0.5);
  }

  20% {
    transform: translate(-50%, -20px) scale(1.2);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -60px) scale(1);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px) rotate(-5deg);
  }

  75% {
    transform: translateX(10px) rotate(5deg);
  }
}

.shake {
  animation: shake 0.3s ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(244, 147, 251, 0.8);
  }
}

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #1e293b;
  padding: 20px;
  border-radius: 15px;
  max-width: 400px;
  width: 90%;
  border: 1px solid var(--border);
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.modal-content h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

.poke-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 10px;
  margin-top: 15px;
  max-height: 300px;
  overflow-y: auto;
  padding: 5px;
}

.poke-grid::-webkit-scrollbar {
  width: 6px;
}

.poke-grid::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

.poke-option {
  background: rgba(255, 255, 255, 0.05);
  padding: 5px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.poke-option:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--p1-color);
  transform: translateY(-3px);
}

.poke-option img {
  width: 50px;
  height: 50px;
  image-rendering: pixelated;
}

.poke-option p {
  margin: 2px 0 0;
  font-size: 0.7rem;
  text-transform: capitalize;
  color: #94a3b8;
}

@media (max-width: 600px) {
  .battle-floor {
    flex-direction: column;
    gap: 20px;
  }

  .vs {
    transform: rotate(90deg);
    margin: 5px;
    font-size: 1.5rem;
  }

  header h1 {
    font-size: 1.5rem;
  }
}

#result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.5s;
}

#result-text {
  font-size: 4rem;
  font-weight: 900;
  text-transform: uppercase;
  transform: scale(0);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
}

.winner-anim img {
  animation: joyful-bounce 0.6s infinite alternate;
  filter: drop-shadow(0 0 20px #fbbf24);
}

.loser-anim img {
  filter: grayscale(1) brightness(0.4) !important;
  transform: translateY(30px) rotate(-10deg) !important;
  opacity: 0.6;
  transition: 1s all ease;
}

@keyframes joyful-bounce {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-10px) scale(1.1);
  }
}

.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #f00;
  animation: fall linear forwards;
  z-index: 150;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}
