/**
 * ============================================================================
 * CHECKERS JUNIOR - ULTRA GAMING UI/UX
 * ============================================================================
 * 3D board with animated pieces, capture effects, strategic visuals
 * Professional gaming interface with smooth animations
 * ============================================================================
 */

@import url("https://fonts.googleapis.com/css2?family=Fredoka+One&family=Poppins:wght@400;600;700;800&display=swap");

:root {
  /* Gaming Colors - Strategy Theme */
  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --player-color: #ef4444;
  --ai-color: #3b82f6;
  --king-gold: #f59e0b;
  --highlight-move: #10b981;
  --highlight-capture: #ef4444;

  /* Gradients */
  --bg-strategy: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-board: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
  --player-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  --ai-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  --king-gradient: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);

  /* Shadows */
  --glow-player: 0 0 20px rgba(239, 68, 68, 0.6);
  --glow-ai: 0 0 20px rgba(59, 130, 246, 0.6);
  --glow-king: 0 0 25px rgba(245, 158, 11, 0.8);
  --shadow-piece: 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-board: 0 15px 50px rgba(0, 0, 0, 0.5);

  /* Animations */
  --bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: "Poppins", sans-serif;
  background: var(--bg-strategy);
  color: #fff;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

/* ========================================================================
   ANIMATED BACKGROUND
   ======================================================================== */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
      circle at 20% 50%,
      rgba(239, 68, 68, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(59, 130, 246, 0.1) 0%,
      transparent 50%
    );
  animation: strategyPulse 15s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes strategyPulse {
  0%,
  100% {
    opacity: 0.3;
  }
  50% {
    opacity: 0.6;
  }
}

/* ========================================================================
   GAME CONTAINER
   ======================================================================== */
.game-container {
  position: relative;
  z-index: 10;
  max-width: 900px;
  width: 100%;
}

/* Header */
.game-header {
  text-align: center;
  margin-bottom: 2rem;
  animation: slideInDown 0.8s var(--bounce);
}

.game-title {
  font-family: "Fredoka One", cursive;
  font-size: 3.5rem;
  background: linear-gradient(135deg, #fff 0%, #f0f9ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  text-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
}

.game-subtitle {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

/* ========================================================================
   GAME INFO BAR
   ======================================================================== */
.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
  animation: fadeInUp 0.8s var(--smooth) 0.2s both;
}

.player-info {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 1.5rem;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s var(--smooth);
}

.player-info.active {
  border-color: var(--highlight-move);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
  transform: scale(1.05);
}

.player-info.ai {
  flex-direction: row-reverse;
}

.player-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: var(--shadow-piece);
}

.player-info:not(.ai) .player-avatar {
  background: var(--player-gradient);
}

.player-info.ai .player-avatar {
  background: var(--ai-gradient);
}

.player-details {
  flex: 1;
}

.player-name {
  font-family: "Fredoka One", cursive;
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 0.3rem;
}

.player-score {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.7);
}

.player-pieces-count {
  font-weight: 700;
  color: var(--king-gold);
}

/* ========================================================================
   CHECKERS BOARD - 3D EFFECT
   ======================================================================== */
.board-container {
  background: var(--bg-board);
  padding: 2rem;
  border-radius: 30px;
  box-shadow: var(--shadow-board);
  animation: fadeInUp 0.8s var(--smooth) 0.4s both;
}

.checkers-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  background: #1a202c;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  overflow: hidden;
  aspect-ratio: 1;
  max-width: 600px;
  margin: 0 auto;
}

/* Board Squares */
.board-square {
  aspect-ratio: 1;
  position: relative;
  cursor: pointer;
  transition: all 0.3s var(--smooth);
}

.board-square.light {
  background: var(--board-light);
}

.board-square.dark {
  background: var(--board-dark);
}

.board-square.selectable:hover {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.3),
    rgba(5, 150, 105, 0.3)
  );
  transform: scale(1.05);
  box-shadow: inset 0 0 20px rgba(16, 185, 129, 0.5);
}

.board-square.selected {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.5),
    rgba(5, 150, 105, 0.5)
  );
  box-shadow: inset 0 0 30px rgba(16, 185, 129, 0.8);
  animation: pulseSelected 1s ease-in-out infinite;
}

@keyframes pulseSelected {
  0%,
  100% {
    box-shadow: inset 0 0 30px rgba(16, 185, 129, 0.6);
  }
  50% {
    box-shadow: inset 0 0 40px rgba(16, 185, 129, 1);
  }
}

/* Move Indicators */
.move-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.6);
  animation: pulse 1.5s ease-in-out infinite;
  pointer-events: none;
}

.capture-indicator {
  background: rgba(239, 68, 68, 0.7);
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  animation: pulseCap 1s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0.6;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
  }
}

@keyframes pulseCap {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
  }
}

/* ========================================================================
   GAME PIECES - 3D ANIMATED
   ======================================================================== */
.game-piece {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: all 0.3s var(--bounce);
  box-shadow: var(--shadow-piece);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.game-piece.player {
  background: var(--player-gradient);
  border: 3px solid #fff;
}

.game-piece.ai {
  background: var(--ai-gradient);
  border: 3px solid #fff;
}

.game-piece.king {
  border-color: var(--king-gold);
  border-width: 4px;
  box-shadow: var(--shadow-piece), var(--glow-king);
}

.game-piece.king::after {
  content: "👑";
  position: absolute;
  font-size: 1.8rem;
  animation: crownFloat 2s ease-in-out infinite;
}

@keyframes crownFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.game-piece.selectable:hover {
  transform: translate(-50%, -50%) scale(1.15);
  box-shadow: var(--shadow-piece), 0 0 30px currentColor;
  z-index: 10;
}

.game-piece.selected {
  transform: translate(-50%, -50%) scale(1.2);
  animation: pieceSelected 0.5s var(--bounce);
  z-index: 10;
}

@keyframes pieceSelected {
  0% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
  }
  100% {
    transform: translate(-50%, -50%) scale(1.2);
  }
}

/* Moving animation */
.game-piece.moving {
  transition: all 0.5s var(--smooth);
  z-index: 20;
}

/* Captured animation */
.game-piece.captured {
  animation: captureAnim 0.6s var(--smooth) forwards;
}

@keyframes captureAnim {
  0% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.5) rotate(180deg);
    opacity: 0.5;
  }
  100% {
    transform: translate(-50%, -50%) scale(0) rotate(360deg);
    opacity: 0;
  }
}

/* ========================================================================
   CONTROLS
   ======================================================================== */
.game-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  animation: fadeInUp 0.8s var(--smooth) 0.6s both;
}

.control-btn {
  font-family: "Fredoka One", cursive;
  font-size: 1.1rem;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  color: #fff;
  cursor: pointer;
  transition: all 0.3s var(--bounce);
}

.control-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.control-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.control-btn.primary {
  background: var(--highlight-move);
  border-color: var(--highlight-move);
}

.control-btn.primary:hover:not(:disabled) {
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.5);
}

/* ========================================================================
   STATUS MESSAGE
   ======================================================================== */
.status-message {
  text-align: center;
  margin-top: 1.5rem;
  font-family: "Fredoka One", cursive;
  font-size: 1.5rem;
  color: #fff;
  min-height: 2rem;
  animation: fadeIn 0.5s var(--smooth);
}

.status-message.thinking {
  color: var(--ai-color);
  animation: pulse 1s ease-in-out infinite;
}

/* ========================================================================
   GAME OVER MODAL
   ======================================================================== */
.game-over-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.game-over-modal.active {
  display: flex;
  animation: fadeIn 0.3s var(--smooth);
}

.modal-content {
  background: var(--bg-board);
  border-radius: 30px;
  padding: 3rem;
  text-align: center;
  border: 3px solid rgba(255, 255, 255, 0.3);
  animation: popIn 0.5s var(--bounce);
  max-width: 500px;
}

.modal-icon {
  font-size: 6rem;
  margin-bottom: 1rem;
  animation: celebration 1s var(--bounce);
}

.modal-title {
  font-family: "Fredoka One", cursive;
  font-size: 3rem;
  color: #fff;
  margin-bottom: 1rem;
}

.modal-message {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
}

/* ========================================================================
   ANIMATIONS
   ======================================================================== */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes celebration {
  0% {
    transform: scale(0) rotate(0deg);
  }
  50% {
    transform: scale(1.3) rotate(180deg);
  }
  100% {
    transform: scale(1) rotate(360deg);
  }
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 768px) {
  .game-title {
    font-size: 2.5rem;
  }

  .game-info {
    flex-direction: column;
  }

  .board-container {
    padding: 1rem;
  }

  .checkers-board {
    gap: 1px;
  }

  .game-controls {
    flex-direction: column;
    width: 100%;
  }

  .control-btn {
    width: 100%;
  }
}
