@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');

body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 2rem 1rem;
    font-family: 'Poppins', sans-serif;
    color: #fafafa;
}

#checkers-board {
  width: 100%; /* Make the board take the full width of its container */
  aspect-ratio: 1 / 1; /* Ensure the board remains a perfect square */
  border: 3px solid #6a4f4b; /* A woody border color */
  background-image: url('../images/board.png');
  background-size: 100% 100%; /* Show the entire image, including its borders */
  background-position: center;
  display: grid; /* Use CSS Grid for a robust layout */
  grid-template-columns: repeat(12, 1fr); /* Create 12 equal columns */
  grid-template-rows: repeat(12, 1fr); /* Create 12 equal rows */
}

.square {
  /* Width and height are now controlled by the grid */
  display: flex;
  align-items: center;
  justify-content: center;
}

.white-square {
  background-color: transparent; /* Make light squares see-through */
}

.black-square {
  background-color: transparent; /* rgba(0, 0, 0, 0.2);  Add a subtle tint for dark squares */
}

.piece {
  width: 80%; /* Make piece size relative to the square */
  height: 80%; /* Make piece size relative to the square */
  border-radius: 50%;
}

.red {
  background-image: url('../images/red-piece.png');
  background-size: contain;
  background-repeat: no-repeat;
}

.black {
  background-image: url('../images/black-piece.png');
  background-size: contain;
  background-repeat: no-repeat;
}

.jumping {
  z-index: 10;
  position: relative; /* Needed for z-index to work */
  animation: arc-jump 0.5s ease-in-out forwards;
}

.sliding {
  transition: transform 0.3s ease-out;
  z-index: 5; /* Above other pieces but below a jumping piece */
  position: relative;
}
.player-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #cccccc;
}

.player-info.active-player {
    border-color: #ffeb3b;
    box-shadow: 0 0 10px #ffeb3b;
}

#game-container {
    width: 100%; /* Ensure the container tries to fill the available space */
    max-width: 600px; /* Allow the board to be larger on bigger screens */
    margin: 20px auto; /* Center the entire game container */
}

.player-info {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 10px 0;
    gap: 15px;
    width: 100%;
    max-width: 600px; /* Match new board width */
    border-radius: 10px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-photo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid #4f545c;    
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#game-message {
    text-align: center;
    color: #f0f0f0; /* Lighter color for better visibility */
    font-weight: bold;
    display: none;
    font-size: 1.1rem; /* Slightly larger font */
    min-height: 24px; /* Ensure it takes up space even when empty */
    margin-top: 10px;
    padding: 5px 10px; /* Add some padding */
    background-color: rgba(44, 47, 51, 0.8); /* Semi-transparent dark background */
    border-radius: 5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7); 
}

/* --- King Piece Specific Images (Must come AFTER general piece styles) --- */

/* Use a specific image for the red king */
.piece.red-king {
  background-image: url('../images/red-king.png');
  background-size: contain;
  background-repeat: no-repeat;
}

/* Use a specific image for the black king */
.piece.black-king {
  background-image: url('../images/black-king.png');
  background-size: contain;
  background-repeat: no-repeat;
}

.selected {
  border: 2px solid yellow;
  box-sizing: border-box;
}

#current-player { /* Styling for the current player text */
    font-size: 1.2rem;
    font-weight: bold;
    color: #f0f0f0;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
}

.game-over-message {
    font-size: 1.5em; /* Make it larger */
    color: #e74c3c; /* A more impactful color, like red */
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.7); /* Add a subtle glow */
    animation: pulse-game-over 1.5s infinite alternate; /* Add a pulsing animation */
}

@keyframes pulse-game-over {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(1.05); opacity: 0.9; }
}

.possible-move::after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(255, 255, 0, 0.5);
    box-shadow: 0 0 8px rgba(255, 255, 0, 0.7);
    animation: pulse 1.5s infinite;
}

@keyframes pulse { 0% { opacity: 0.7; } 50% { opacity: 1; } 100% { opacity: 0.7; } }

.captured {
  animation: fade-out-and-shrink 0.4s forwards;
  transform-origin: center;
}

@keyframes fade-out-and-shrink {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0);
  }
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    align-content: center;
}

/* Ensure the modal is hidden by default */
.modal-overlay:not(.visible) {
    display: none;
}

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

.modal-content {
    background-color: #2c2f33;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid #4f545c;
    animation: modal-fade-in 0.3s ease-out;
    position: relative;
}

.modal-title {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 2rem;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.modal-text {
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    font-size: 1.1rem;
    color: #cccccc;
    margin-bottom: 1.5rem;
}

@keyframes modal-fade-in {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

#restart-button {
    /* Overriding Tailwind classes for a more custom look */
    background-image: linear-gradient(to right, #4ade80, #34d399);
    color: #1a1a1a;
    font-weight: bold;
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    cursor: pointer;
    margin-top: 1rem;
}

#restart-button:hover {
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
    transform: translateY(-2px); /* Add a slight lift effect on hover */
}

@keyframes arc-jump {
  0% {
    transform: translate(var(--dx-start), var(--dy-start)) scale(1);
    animation-timing-function: ease-in;
  }
  50% {
    transform: translate(var(--dx-mid), var(--dy-mid)) scale(1.3);
    animation-timing-function: ease-out;
  }
  100% {
    transform: translate(var(--dx-end), var(--dy-end)) scale(1);
  }
}