/* Game Board Layout */
#game-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  margin: 2rem auto;
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 8px;
}

/* Individual Card Styling */
.card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  aspect-ratio: 1;
}

/* Card Type Colors */
.card.red-joker {
  background-color: var(--red-joker);
}

.card.black-joker {
  background-color: var(--black-joker);
}

.card.card-a {
  background-color: var(--card-a);
}

.card.card-2 {
  background-color: var(--card-2);
}

.card.card-3 {
  background-color: var(--card-3);
}

.card.card-4 {
  background-color: var(--card-4);
}

.card.collapsed {
  background-color: var(--card-collapsed);
  opacity: 0.6;
  cursor: not-allowed;
}

.card.collapsed:hover {
  transform: none;
  box-shadow: none;
}

/* Path Visualization Styles (Task 3.1) */

/* Movement path highlighting */
.card.path-start {
  box-shadow: 0 0 0 4px #22c55e; /* green-500 */
  border-color: #22c55e;
  z-index: 15;
}

.card.path-step {
  background: linear-gradient(135deg, var(--card-bg-color, #6b7280) 0%, #22c55e 100%);
  border: 2px solid #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
  z-index: 10;
  position: relative;
}

.card.path-end {
  box-shadow: 0 0 0 4px #f59e0b; /* amber-500 */
  border-color: #f59e0b;
  background: linear-gradient(135deg, var(--card-bg-color, #6b7280) 0%, #f59e0b 100%);
  z-index: 15;
}

/* Path step indicators */
.card.path-step::after {
  content: attr(data-step-number);
  position: absolute;
  top: -8px;
  right: -8px;
  background: #22c55e;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: bold;
  z-index: 20;
  border: 2px solid white;
}

/* Path direction indicators */
.card.path-step.from-up::before {
  content: '↓';
}

.card.path-step.from-down::before {
  content: '↑';
}

.card.path-step.from-left::before {
  content: '→';
}

.card.path-step.from-right::before {
  content: '←';
}

.card.path-step::before {
  position: absolute;
  top: 2px;
  left: 2px;
  color: white;
  font-size: 0.875rem;
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  z-index: 25;
}

/* Smooth transitions for path visualization */
.card.path-start,
.card.path-step,
.card.path-end {
  transition: all 0.2s ease-in-out;
}

/* Joker path highlighting (different colors) */
.card.joker-path-start {
  box-shadow: 0 0 0 4px #8b5cf6; /* violet-500 */
  border-color: #8b5cf6;
}

.card.joker-path-step {
  background: linear-gradient(135deg, var(--card-bg-color, #6b7280) 0%, #8b5cf6 100%);
  border: 2px solid #8b5cf6;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

.card.joker-path-step::after {
  background: #8b5cf6;
}

.card.joker-path-end {
  box-shadow: 0 0 0 4px #ec4899; /* pink-500 */
  border-color: #ec4899;
  background: linear-gradient(135deg, var(--card-bg-color, #6b7280) 0%, #ec4899 100%);
}

/* Path clearing animation */
.card.path-clearing {
  animation: pathClearFade 0.3s ease-out forwards;
}

@keyframes pathClearFade {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0.8;
    transform: scale(0.95);
  }
}

/* Real-time Valid Destination Highlighting (Task 3.2) */

/* Valid destination indicators */
.card.valid-destination {
  box-shadow: 0 0 0 3px #10b981; /* emerald-500 */
  border-color: #10b981;
  cursor: pointer;
  position: relative;
  z-index: 12;
}

.card.valid-destination::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #10b981;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: bold;
  z-index: 15;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card.valid-destination:hover {
  box-shadow: 0 0 0 3px #059669; /* emerald-600 */
  border-color: #059669;
  transform: translateY(-3px);
}

.card.valid-destination:hover::after {
  background: #059669;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Invalid destination indicators (disabled state) */
.card.invalid-destination {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.card.invalid-destination:hover {
  transform: none;
  box-shadow: none;
}

/* Joker valid destinations (different styling) */
.card.joker-valid-destination {
  box-shadow: 0 0 0 3px #8b5cf6; /* violet-500 */
  border-color: #8b5cf6;
  cursor: pointer;
  position: relative;
  z-index: 12;
}

.card.joker-valid-destination::after {
  content: '⭐';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #8b5cf6;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  z-index: 15;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card.joker-valid-destination:hover {
  box-shadow: 0 0 0 3px #7c3aed; /* violet-600 */
  border-color: #7c3aed;
  transform: translateY(-3px);
}

.card.joker-valid-destination:hover::after {
  background: #7c3aed;
  transform: translate(-50%, -50%) scale(1.1);
}

/* Distance indicators for numbered cards */
.card.valid-destination.distance-1::before {
  content: '1';
}

.card.valid-destination.distance-2::before {
  content: '2';
}

.card.valid-destination.distance-3::before {
  content: '3';
}

.card.valid-destination.distance-4::before {
  content: '4';
}

.card.valid-destination::before {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(16, 185, 129, 0.9);
  color: white;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: bold;
  z-index: 16;
}

/* Smooth transitions for destination highlighting */
.card.valid-destination,
.card.joker-valid-destination,
.card.invalid-destination {
  transition: all 0.15s ease-in-out;
}

/* Pulse animation for current valid destinations */
.card.valid-destination.pulse,
.card.joker-valid-destination.pulse {
  animation: destinationPulse 1.5s infinite;
}

@keyframes destinationPulse {
  0%, 100% {
    box-shadow: 0 0 0 3px var(--destination-color, #10b981);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0.4);
  }
}

/* Immediate destination (one click away) */
.card.immediate-destination {
  box-shadow: 0 0 0 4px #f59e0b; /* amber-500 */
  border-color: #f59e0b;
}

.card.immediate-destination::after {
  content: '→';
  background: #f59e0b;
}

.card.immediate-destination:hover {
  box-shadow: 0 0 0 4px #d97706; /* amber-600 */
  border-color: #d97706;
}