body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(-45deg, #dfe9f3, #f9f9f9, #e0f7fa, #fff);
  background-size: 400% 400%;
  animation: gradientShift 10s ease infinite;
  color: #333;
  padding: 20px;
  margin: 0;
  text-align: center;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

h1 {
  margin-bottom: 30px;
  font-size: 28px;
  color: #444;
}

.container {
  display: flex;
  justify-content: center;
  gap: 60px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.player {
  background-color: #fefefe;
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  width: 250px;
  animation: popIn 0.6s ease;
}

select {
  width: 100%;
  padding: 10px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid #ccc;
}

.actions {
  margin: 20px;
}

button {
  padding: 12px 25px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background-color: #3498db;
  color: white;
  transition: transform 0.1s ease, background-color 0.3s ease;
}

button:hover {
  background-color: #2980b9;
}

button:active {
  transform: scale(0.96);
}

#result {
  font-size: 22px;
  margin: 20px 0;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
}

#result.show {
  opacity: 1;
  transform: translateY(0);
}

#scores {
  font-size: 18px;
  margin-top: 10px;
}

#history {
  max-width: 500px;
  margin: 30px auto;
  padding: 15px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

#history h3 {
  margin-top: 0;
  font-size: 20px;
  color: #555;
}

#historyList {
  list-style-type: decimal;
  padding-left: 20px;
  font-size: 16px;
  color: #333;
}

#historyList li {
  opacity: 0;
  animation: fadeIn 0.6s ease forwards;
}

#historyList li:nth-child(odd) {
  animation-delay: 0.1s;
}
#historyList li:nth-child(even) {
  animation-delay: 0.2s;
}

@keyframes popIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    transform: translateX(-20px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.battle-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.battle-box {
  font-size: 80px;
  display: flex;
  align-items: center;
  gap: 60px;
  animation: zoomIn 0.4s ease forwards;
}

.battle-box.animate #p1Icon {
  animation: slideInLeft 0.5s ease forwards;
}
.battle-box.animate #p2Icon {
  animation: slideInRight 0.5s ease forwards;
}

.vs {
  font-size: 60px;
  animation: pulse 0.6s infinite alternate;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-200px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(200px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes screenShake {
  0% { transform: translate(0px, 0px); }
  20% { transform: translate(-10px, 5px); }
  40% { transform: translate(10px, -5px); }
  60% { transform: translate(-6px, 4px); }
  80% { transform: translate(6px, -4px); }
  100% { transform: translate(0px, 0px); }
}

.shake {
  animation: screenShake 0.5s ease;
}
.rules-section {
  margin: 40px auto;
  text-align: center;
}

.rule-icons button {
  margin: 8px;
  padding: 12px 20px;
  font-size: 16px;
  border: none;
  border-radius: 12px;
  background-color: #2ecc71;
  color: white;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.rule-icons button:hover {
  background-color: #27ae60;
}

.rules-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.rules-modal.hidden {
  display: none;
}

.rules-content {
  background: white;
  padding: 30px;
  border-radius: 20px;
  width: 90%;
  max-width: 500px;
  text-align: left;
  position: relative;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  animation: popIn 0.4s ease;
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 16px;
  font-size: 24px;
  cursor: pointer;
}

.rules-content h4 {
  margin-top: 0;
}
.background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(to right, #dfe9f3, #ffffff);
}

.background .circle {
  position: absolute;
  width: 40px;
  height: 40px;
  background: rgba(52, 152, 219, 0.4);
  border-radius: 50%;
  animation: float 12s infinite ease-in-out;
}

.background .circle:nth-child(1) {
  top: 20%;
  left: 15%;
  width: 60px;
  height: 60px;
  animation-duration: 18s;
  background-color: rgba(255, 99, 132, 0.3);
}

.background .circle:nth-child(2) {
  top: 60%;
  left: 80%;
  animation-duration: 14s;
  background-color: rgba(255, 206, 86, 0.3);
}

.background .circle:nth-child(3) {
  top: 30%;
  left: 50%;
  animation-duration: 16s;
  background-color: rgba(54, 162, 235, 0.3);
}

.background .circle:nth-child(4) {
  top: 70%;
  left: 25%;
  animation-duration: 20s;
  background-color: rgba(75, 192, 192, 0.3);
}

.background .circle:nth-child(5) {
  top: 10%;
  left: 70%;
  animation-duration: 22s;
  background-color: rgba(153, 102, 255, 0.3);
}

@keyframes float {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.7;
  }
  50% {
    transform: translateY(-100px) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 0.7;
  }
}

/* ===== THREE.JS BATTLE CANVAS ===== */
#threeCanvas {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

/* ===== BATTLE LABELS ===== */
#battleLabels {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 8% 12%;
  box-sizing: border-box;
}

.battle-label {
  font-family: 'Segoe UI', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #222244;
  background: rgba(220, 235, 255, 0.75);
  backdrop-filter: blur(8px);
  padding: 10px 24px;
  border-radius: 50px;
  letter-spacing: 1px;
  border: 2px solid rgba(100,140,220,0.4);
  box-shadow: 0 4px 16px rgba(80,100,200,0.15);
  animation: labelPop 0.4s ease forwards;
}

@keyframes labelPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Clash flash overlay */
@keyframes clashFlash {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

