/* ===== UNIVERSAL GAME BOARD SYSTEM ===== */

/* Import Google Fonts */
@import url("https://fonts.googleapis.com/css2?family=Fredoka+One:wght@400&family=Baloo+2:wght@400;500;600;700;800&display=swap");

/* CSS Custom Properties for Universal Theming */
:root {
  /* Colors - Dark Navy Blue Theme */
  --color-primary: #0a0e1a;
  --color-secondary: #1a2332;
  --color-accent: #2d3748;
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;

  /* Player Colors */
  --color-red: #ef4444;
  --color-blue: #3b82f6;
  --color-green: #16a34a;
  --color-yellow: #ffff00;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.35rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 1rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.4rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  background: radial-gradient(circle at center, #182235 0%, #0a0f1a 100%);
  color: var(--color-text);
  margin: 0;
  padding: 0;
  touch-action: manipulation;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden; /* Prevent horizontal scrollbar */
}

.body-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--spacing-md);
}

.container-main {
  width: 100%;
  max-width: 90vw;
  margin: 0 auto;
  position: relative;
}

/* ===== UNIVERSAL BOARD LAYOUT ===== */
.game-container {
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-lg);
}

/* ===== ACTION TOGGLE BUTTON ===== */
.action-toggle-container {
  position: fixed;
  top: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 1000;
}

.action-toggle-button {
  background: linear-gradient(145deg, #8b5cf6, #7c3aed);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(139, 92, 246, 0.3);
  cursor: pointer;
  box-shadow: 0 6px 20px 0 rgba(139, 92, 246, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 20px rgba(139, 92, 246, 0.2);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
  z-index: 30;
  min-width: 120px;
}

.action-toggle-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.action-toggle-button:hover::before {
  left: 100%;
}

.action-toggle-button:hover {
  background: linear-gradient(145deg, #7c3aed, #6d28d9);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px 0 rgba(139, 92, 246, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.action-toggle-button:active {
  transform: translateY(0);
}

.action-toggle-button.active {
  background: linear-gradient(145deg, #16a34a, #15803d);
  border-color: rgba(22, 163, 74, 0.3);
  box-shadow: 0 6px 20px 0 rgba(22, 163, 74, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 20px rgba(22, 163, 74, 0.2);
}

.action-toggle-button.active:hover {
  background: linear-gradient(145deg, #15803d, #166534);
}

/* ===== HOME BUTTON ===== */
.home-button-container {
  position: fixed;
  top: var(--spacing-lg);
  left: var(--spacing-lg);
  z-index: 1000;
}

.home-button {
  background: linear-gradient(145deg, #6b7280, #4b5563);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: var(--spacing-sm);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(107, 114, 128, 0.3);
  cursor: pointer;
  box-shadow: 0 6px 20px 0 rgba(107, 114, 128, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 20px rgba(107, 114, 128, 0.2);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  z-index: 30;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.home-button:hover::before {
  left: 100%;
}

.home-button:hover {
  background: linear-gradient(145deg, #4b5563, #374151);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px 0 rgba(107, 114, 128, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.home-button:active {
  transform: translateY(0);
}

.home-button svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

/* ===== GAME BOARD SYSTEM ===== */
.game-board-container {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  max-width: 600px;
  margin: 0 auto;
}

.game-board {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  grid-template-rows: repeat(18, 1fr);
  gap: 2px;
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #0b1220, #0a0e1a);
  border-radius: var(--radius-lg);
  padding: var(--spacing-sm);
  border: 2px solid #2c3a4d;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
}

/* ===== BOARD NODES ===== */
.node {
  width: 100%;
  height: 100%;

  background: linear-gradient(145deg, #1e2a3a, #1a2332);
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.1),
    inset 0 -1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.node.light {
  background: linear-gradient(145deg, #2c3a4d, #1e2a3a);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.15),
    inset 0 -1px 3px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.node.dark {
  background: linear-gradient(145deg, #1a2332, #0f1419);
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.08),
    inset 0 -1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
}

.node:hover {
  transform: scale(1.05);
  z-index: 10;
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.2),
    inset 0 -1px 3px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.3),
    0 0 15px rgba(44, 58, 77, 0.4);
}

/* Treasury Node */
.treasury-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  color: rgba(192, 132, 252, 0.9);
  text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

/* Individual Treasury Nodes - styled to look like one merged cell */
.node.treasury {
  background: linear-gradient(145deg, #1e2a3a, #0b1220);
  border: none; /* Remove individual borders */
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.1),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

/* Frozen Treasury Styling */
.node.treasury-frozen {
  background: linear-gradient(145deg, #0a0e1a, #1a2332);
  border: 2px solid rgba(147, 197, 253, 0.6) !important;
  box-shadow: 0 0 20px rgba(147, 197, 253, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.05),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4) !important;
}

.treasury-frozen-content {
  color: rgba(147, 197, 253, 0.9) !important;
  text-shadow: 0 0 10px rgba(147, 197, 253, 0.8) !important;
}

/* Treasury area cells that are not the main treasury - hide them visually */
.node.treasury-area:not(.treasury) {
  display: none;
}

/* Single border around the entire treasury area */
.game-board-container::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: calc(2 * (100% / 18) + 2px); /* Width of 2 cells + gap */
  height: calc(2 * (100% / 18) + 2px); /* Height of 2 cells + gap */
  border: 3px solid rgba(44, 58, 77, 0.8);
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(44, 58, 77, 0.6),
    inset 0 1px 2px rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: 1;
}

/* Treasury access indicator - cells that can reach treasury with current dice roll */
.node.treasury-accessible {
  background: linear-gradient(145deg, #fbbf24, #f59e0b);
  border: 2px solid rgba(251, 191, 36, 0.8);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
  animation: treasuryGlow 2s ease-in-out infinite alternate;
}

@keyframes treasuryGlow {
  0% {
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
  }
  100% {
    box-shadow: 0 0 25px rgba(251, 191, 36, 0.8);
  }
}

/* Collector access indicator - cells that can reach collector with current dice roll */
.node.collector-accessible {
  background: linear-gradient(145deg, #10b981, #059669);
  border: 2px solid rgba(16, 185, 129, 0.8);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
  animation: collectorGlow 2s ease-in-out infinite alternate;
}

@keyframes collectorGlow {
  0% {
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
  }
  100% {
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.8);
  }
}

/* Big treasury content for merged cell */
.treasury-content.treasury-big {
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
  gap: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  border-radius: 0.5rem;
  background: rgba(192, 132, 252, 0.1);
  border: 1px solid rgba(192, 132, 252, 0.3);
}

/* Node Selection States */
.node.selected {
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* Valid move highlighting for each player */
.node.valid-move-red {
  background: linear-gradient(145deg, #fca5a5, #ef4444);
  border: 2px solid #fecaca;
  box-shadow: var(--shadow-md);
}

.node.valid-move-blue {
  background: linear-gradient(145deg, #93c5fd, #3b82f6);
  border: 2px solid #dbeafe;
  box-shadow: var(--shadow-md);
}

.node.valid-move-green {
  background: linear-gradient(145deg, #86efac, #16a34a);
  border: 2px solid #bbf7d0;
  box-shadow: var(--shadow-md);
}

.node.valid-move-yellow {
  background: linear-gradient(145deg, #fef08a, #ffff00);
  border: 2px solid #fef3c7;
  box-shadow: var(--shadow-md);
}

/* Override valid move background for home cells - keep home cell color */
.node.home-red.valid-move-red {
  background: linear-gradient(145deg, #fca5a5, #ef4444) !important;
}

.node.home-blue.valid-move-blue {
  background: linear-gradient(145deg, #93c5fd, #3b82f6) !important;
}

.node.home-green.valid-move-green {
  background: linear-gradient(145deg, #86efac, #16a34a) !important;
}

.node.home-yellow.valid-move-yellow {
  background: linear-gradient(145deg, #fef08a, #ffff00) !important;
}

/* ===== PIECE SYSTEM ===== */
.piece {
  width: 90%;
  height: 90%;
  pointer-events: none;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all var(--transition-fast);
  z-index: 5;
  position: relative;
}

.piece svg {
  filter: drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.5));
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.node:hover .piece {
  transform: scale(1.1);
}

/* Diamond indicator for pieces carrying diamonds */
.diamond-indicator {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 12px;
  height: 12px;
  background-color: rgba(192, 132, 252, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  animation: diamondPulse 2s infinite;
}

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

/* Highlight current player's pieces when dice is rolled */
.node.current-player-piece {
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-md);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

/* Highlight piece during current turn */
.piece.current-turn-piece {
  transform: scale(1.1);
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.7))
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

/* ===== DICE SYSTEM ===== */
.dice {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-lg);
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: bold;
  transition: border-color var(--transition-normal);
  z-index: 20;
  cursor: pointer;
  transform: translate(-50%, -50%);
  /* Ensure dice size is fixed and not affected by star boxes */
  min-width: 50px;
  min-height: 50px;
  max-width: 50px;
  max-height: 50px;
}

/* ===== STAR BOX SYSTEM ===== */
.star-box {
  position: absolute;
  width: 35px; /* Match action button size */
  height: 35px; /* Match action button size */
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(0, 0, 0, 0.3);
  box-shadow: var(--shadow-md);
  display: none; /* Start hidden by default */
  align-items: center;
  justify-content: center;
  font-size: 18px; /* Reduced base diamond size */
  z-index: 15;
  transition: all var(--transition-normal);
}

/* ===== PLAYER PALETTE SYSTEM ===== */
.player-palette {
  position: absolute;
  display: none; /* Completely hidden by default */
  gap: var(--spacing-sm);
  z-index: 25;
  transition: all var(--transition-normal);
  opacity: 1; /* Fully opaque when shown */
  pointer-events: none; /* Not clickable by default */
}

.player-palette.show {
  display: flex; /* Show when action selection mode is active */
  pointer-events: auto; /* Clickable when active */
}

.palette-button {
  width: 35px;
  height: 35px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--color-text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.palette-button:hover {
  transform: scale(1.1);
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-md);
}

.palette-button:active {
  transform: scale(0.95);
}

/* Palette positioning - equal distance from dice */
.palette-left {
  left: -210px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: row;
}

.palette-right {
  right: -210px;
  top: 50%;
  transform: translateY(-50%);
  flex-direction: row;
}

.palette-top {
  top: -210px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
}

.palette-bottom {
  bottom: -210px;
  left: 50%;
  transform: translateX(-50%);
  flex-direction: column;
}

/* Player-specific palette colors */
.palette-red .palette-button {
  border-color: rgba(239, 68, 68, 0.5);
  background-color: rgba(239, 68, 68, 0.1);
}

.palette-red .palette-button:hover {
  border-color: rgba(239, 68, 68, 0.8);
  background-color: rgba(239, 68, 68, 0.2);
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.palette-blue .palette-button {
  border-color: rgba(59, 130, 246, 0.5);
  background-color: rgba(59, 130, 246, 0.1);
}

.palette-blue .palette-button:hover {
  border-color: rgba(59, 130, 246, 0.8);
  background-color: rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.palette-green .palette-button {
  border-color: rgba(22, 163, 74, 0.5);
  background-color: rgba(22, 163, 74, 0.1);
}

.palette-green .palette-button:hover {
  border-color: rgba(22, 163, 74, 0.8);
  background-color: rgba(22, 163, 74, 0.2);
  box-shadow: 0 0 15px rgba(22, 163, 74, 0.3);
}

.palette-yellow .palette-button {
  border-color: rgba(255, 255, 0, 0.5);
  background-color: rgba(255, 255, 0, 0.1);
}

.palette-yellow .palette-button:hover {
  border-color: rgba(255, 255, 0, 0.8);
  background-color: rgba(255, 255, 0, 0.2);
  box-shadow: 0 0 15px rgba(255, 255, 0, 0.3);
}

/* Bot selected action button highlighting */
.palette-button.bot-selected {
  transform: scale(1.2);
  border-color: rgba(255, 255, 255, 0.9) !important;
  background-color: rgba(255, 255, 255, 0.3) !important;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
    0 0 40px rgba(255, 255, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.2) !important;
  animation: botActionPulse 1s ease-in-out infinite;
  z-index: 100;
}

@keyframes botActionPulse {
  0%,
  100% {
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8),
      0 0 40px rgba(255, 255, 255, 0.4), inset 0 0 10px rgba(255, 255, 255, 0.2);
  }
  50% {
    transform: scale(1.3);
    box-shadow: 0 0 30px rgba(255, 255, 255, 1),
      0 0 60px rgba(255, 255, 255, 0.6), inset 0 0 15px rgba(255, 255, 255, 0.3);
  }
}

/* Diamond display styling */
.star-box .star {
  font-size: 18px;
  color: #c084fc;
  text-shadow: 0 0 8px rgba(192, 132, 252, 0.6);
  animation: diamondGlow 2s ease-in-out infinite alternate;
}

.star-box .star.earned {
  animation: diamondEarned 0.8s ease-out;
}

@keyframes diamondGlow {
  0% {
    text-shadow: 0 0 8px rgba(192, 132, 252, 0.6);
    transform: scale(1);
  }
  100% {
    text-shadow: 0 0 12px rgba(192, 132, 252, 0.9);
    transform: scale(1.05);
  }
}

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

/* Star box positioning - 4 stars in same line with proper spacing to avoid collision */
/* Horizontal positioning for top/bottom dice (red/green) - 4 stars in one line */
.star-box-left-1 {
  left: -175px;
  top: 50%;
  transform: translateY(-50%);
}

.star-box-left-2 {
  left: -135px;
  top: 50%;
  transform: translateY(-50%);
}

.star-box-left-3 {
  left: -95px;
  top: 50%;
  transform: translateY(-50%);
}

.star-box-left-4 {
  left: -55px;
  top: 50%;
  transform: translateY(-50%);
}

.star-box-right-1 {
  right: -175px;
  top: 50%;
  transform: translateY(-50%);
}

.star-box-right-2 {
  right: -135px;
  top: 50%;
  transform: translateY(-50%);
}

.star-box-right-3 {
  right: -95px;
  top: 50%;
  transform: translateY(-50%);
}

.star-box-right-4 {
  right: -55px;
  top: 50%;
  transform: translateY(-50%);
}

/* Vertical positioning for left/right dice (yellow/blue) - 4 stars in one line */
.star-box-above-1 {
  top: -175px;
  left: 50%;
  transform: translateX(-50%);
}

.star-box-above-2 {
  top: -135px;
  left: 50%;
  transform: translateX(-50%);
}

.star-box-above-3 {
  top: -95px;
  left: 50%;
  transform: translateX(-50%);
}

.star-box-above-4 {
  top: -55px;
  left: 50%;
  transform: translateX(-50%);
}

.star-box-below-1 {
  bottom: -175px;
  left: 50%;
  transform: translateX(-50%);
}

.star-box-below-2 {
  bottom: -135px;
  left: 50%;
  transform: translateX(-50%);
}

.star-box-below-3 {
  bottom: -95px;
  left: 50%;
  transform: translateX(-50%);
}

.star-box-below-4 {
  bottom: -55px;
  left: 50%;
  transform: translateX(-50%);
}

.dice-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dice.active {
  border-color: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-xl), 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Dice Positioning */
.dice-red {
  background-color: var(--color-red);
  color: white;
  top: -25px;
  left: 50%;
}

.dice-blue {
  background-color: var(--color-blue);
  color: white;
  top: 50%;
  left: calc(100% + 25px);
}

.dice-green {
  background-color: var(--color-green);
  color: white;
  top: calc(100% + 25px);
  left: 50%;
}

.dice-yellow {
  background-color: var(--color-yellow);
  color: var(--color-primary);
  top: 50%;
  left: -25px;
}

/* ===== DICE DOTS SYSTEM ===== */
.dice-dots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  width: 30px;
  height: 30px;
  padding: 4px;
}

/* Crown display for winners */
.crown-display {
  font-size: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
}

/* Rank number on crown */
.crown-display::after {
  content: attr(data-rank);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 26px;
  font-weight: 900;
  color: #1e293b;
  text-shadow: 0 3px 6px rgba(255, 255, 255, 0.9);
  z-index: 1;
  font-family: "Inter", sans-serif;
}

.dice-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.dice-roll-dot {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  width: 30px;
  height: 30px;
  padding: 4px;
}

.dice-roll-dot .dice-dot:nth-child(5) {
  opacity: 1;
}

/* Action icon for special dice roll */
.dice-action-icon {
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  animation: actionPulse 1.5s ease-in-out infinite;
}

/* Bot thinking indicator */
.bot-thinking {
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  animation: botThinking 2s ease-in-out infinite;
}

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

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

/* Dot patterns for different dice values */
.dice-value-1 .dice-dot:nth-child(5) {
  opacity: 1;
}
.dice-value-2 .dice-dot:nth-child(3),
.dice-value-2 .dice-dot:nth-child(7) {
  opacity: 1;
}
.dice-value-3 .dice-dot:nth-child(1),
.dice-value-3 .dice-dot:nth-child(5),
.dice-value-3 .dice-dot:nth-child(9) {
  opacity: 1;
}

/* ===== MODAL SYSTEM ===== */
.modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background: radial-gradient(circle at center, #182235 0%, #0a0f1a 100%);
  justify-content: center;
  align-items: center;
  animation: modalFadeIn 0.3s ease-out;
}

.modal.show {
  display: flex !important;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0px);
  }
  to {
    opacity: 1;
    backdrop-filter: blur(5px);
  }
}

/* ===== ENHANCED GAME START MODAL ===== */

/* ===== GAME MODE SELECTOR ===== */
.game-mode-selector {
  margin-bottom: var(--spacing-lg);
}

/* ===== MODE TABS ===== */
.mode-tabs {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
  border-bottom: 2px solid rgba(255, 255, 255, 0.1);
  padding-bottom: var(--spacing-sm);
}

.mode-tab {
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.3) 0%,
    rgba(30, 41, 59, 0.1) 100%
  );
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--spacing-md) var(--spacing-xl);
  color: var(--color-text-muted);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
  overflow: hidden;
  min-width: 120px;
  text-align: center;
}

.mode-tab::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(251, 191, 36, 0.5),
    transparent
  );
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.mode-tab:hover {
  border-color: rgba(251, 191, 36, 0.3);
  color: var(--color-text);
  transform: translateY(-2px);
}

.mode-tab:hover::before {
  opacity: 1;
}

.mode-tab.active {
  border-color: rgba(251, 191, 36, 0.6);
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.1) 0%,
    rgba(251, 191, 36, 0.05) 100%
  );
  color: #fbbf24;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.2);
  transform: translateY(-3px);
}

.mode-tab.active::before {
  opacity: 1;
  background: linear-gradient(90deg, transparent, #fbbf24, transparent);
}

/* ===== MODE CONTENT ===== */
.mode-content {
  position: relative;
}

.mode-panel {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.mode-panel.active {
  display: block;
}

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

.game-mode-selector h3 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fbbf24;
  margin: 0 0 var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.mode-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.mode-option {
  cursor: pointer;
  position: relative;
}

.mode-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-card {
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.3) 0%,
    rgba(30, 41, 59, 0.1) 100%
  );
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  text-align: center;
  transition: all var(--transition-normal);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: var(--spacing-sm);
}

.mode-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(251, 191, 36, 0.5),
    transparent
  );
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.mode-option:hover .mode-card {
  border-color: rgba(251, 191, 36, 0.3);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.2);
  transform: translateY(-2px);
}

.mode-option:hover .mode-card::before {
  opacity: 1;
}

.mode-option input[type="radio"]:checked + .mode-card {
  border-color: rgba(251, 191, 36, 0.6);
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.1) 0%,
    rgba(251, 191, 36, 0.05) 100%
  );
  box-shadow: 0 6px 25px rgba(251, 191, 36, 0.3);
  transform: translateY(-3px);
}

.mode-option input[type="radio"]:checked + .mode-card::before {
  opacity: 1;
  background: linear-gradient(90deg, transparent, #fbbf24, transparent);
}

.mode-icon {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.mode-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--spacing-xs);
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.1);
}

.mode-description {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  font-weight: 500;
  line-height: 1.4;
}

/* ===== GAME LOGO ===== */
.game-logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--spacing-xl) 0;
}

.game-logo {
  max-width: 300px;
  max-height: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 20px rgba(251, 191, 36, 0.3));
  transition: all var(--transition-normal);
}

.game-logo:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 6px 25px rgba(251, 191, 36, 0.5));
}

.game-start-content {
  background: rgba(26, 35, 50, 0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 0 50px rgba(251, 191, 36, 0.1);
  width: 98%;
  max-width: 1400px;
  max-height: 95vh;
  overflow-y: auto;
  animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  /* Hide scrollbar but keep scrolling functionality */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

/* Hide scrollbar for WebKit browsers (Chrome, Safari, Edge) */
.game-start-content::-webkit-scrollbar {
  display: none;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(-50px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.game-title {
  font-size: 4.5rem;
  font-weight: 400;
  margin: 0;
  letter-spacing: 3px;
  position: relative;
  color: #ffd700;
  text-shadow: 
    /* 3D shadow layers for depth */ 2px 2px 0px #b8860b,
    4px 4px 0px #daa520, 6px 6px 0px #cd853f, 8px 8px 0px #8b7355,
    /* Soft highlight */ 0px 0px 20px rgba(255, 215, 0, 0.8),
    0px 0px 40px rgba(255, 215, 0, 0.4),
    /* Inner glow */ inset 0px 1px 0px rgba(255, 255, 255, 0.3),
    inset 0px -1px 0px rgba(139, 69, 19, 0.3);
  background: linear-gradient(
    135deg,
    #ffd700 0%,
    #ffed4e 25%,
    #ffd700 50%,
    #ff8c00 75%,
    #ff6b00 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleGlow 2s ease-in-out infinite alternate;
  transform: perspective(500px) rotateX(5deg);
}

/* Mixed font styling for "wim" and "bo" */
.game-title::before {
  content: "Wim";
  font-family: "Fredoka One", cursive;
  font-weight: 400;
}

.game-title::after {
  content: "bo";
  font-family: "Baloo 2", cursive;
  font-weight: 800;
}

@keyframes titleGlow {
  from {
    text-shadow: 2px 2px 0px #b8860b, 4px 4px 0px #daa520, 6px 6px 0px #cd853f,
      8px 8px 0px #8b7355, 0px 0px 20px rgba(255, 215, 0, 0.8),
      0px 0px 40px rgba(255, 215, 0, 0.4),
      inset 0px 1px 0px rgba(255, 255, 255, 0.3),
      inset 0px -1px 0px rgba(139, 69, 19, 0.3);
    transform: perspective(500px) rotateX(5deg) scale(1);
  }
  to {
    text-shadow: 2px 2px 0px #b8860b, 4px 4px 0px #daa520, 6px 6px 0px #cd853f,
      8px 8px 0px #8b7355, 0px 0px 30px rgba(255, 215, 0, 1),
      0px 0px 60px rgba(255, 215, 0, 0.6),
      inset 0px 1px 0px rgba(255, 255, 255, 0.5),
      inset 0px -1px 0px rgba(139, 69, 19, 0.5);
    transform: perspective(500px) rotateX(5deg) scale(1.02);
  }
}

.game-subtitle {
  font-size: 1.5rem;
  color: var(--color-text-muted);
  margin: var(--spacing-sm) 0 0;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.game-info {
  padding: 0 var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
}

.info-section h3 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fbbf24;
  margin: 0 0 var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.3);
}

.info-section {
  margin-bottom: 0;
}

.info-section p {
  color: var(--color-text-muted);
  line-height: 1.6;
  margin: 0;
  text-align: left;
}

.info-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.info-section li {
  color: var(--color-text);
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
  padding-left: var(--spacing-lg);
  position: relative;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
}

.info-section li::before {
  content: "•";
  color: #fbbf24;
  font-weight: bold;
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1rem;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.info-section li strong {
  color: #fbbf24;
  font-weight: 700;
  text-shadow: 0 0 5px rgba(251, 191, 36, 0.3);
}

.game-controls {
  display: flex;
  gap: var(--spacing-md);
  justify-content: center;
  padding: var(--spacing-md) var(--spacing-xl);
}

.start-button {
  background: linear-gradient(145deg, #16a34a, #15803d);
  color: white;
  font-weight: 700;
  font-size: 1.25rem;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(22, 163, 74, 0.3);
  cursor: pointer;
  box-shadow: 0 6px 20px 0 rgba(22, 163, 74, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 20px rgba(22, 163, 74, 0.2);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 1px;
  min-width: 150px;
}

.start-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

.start-button:hover::before {
  left: 100%;
}

.start-button:hover {
  background: linear-gradient(145deg, #15803d, #166534);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px 0 rgba(22, 163, 74, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.start-button:active {
  transform: translateY(0);
}

/* ===== ENHANCED HOW TO PLAY SECTION ===== */

.info-section h3 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fbbf24;
  margin: 0 0 var(--spacing-lg);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  text-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
  position: relative;
}

.info-section h3::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.5), transparent);
  margin-left: var(--spacing-md);
}

.info-section p {
  color: var(--color-text-muted);
  line-height: 1.7;
  margin: 0;
  text-align: left;
  font-size: 1rem;
  font-weight: 500;
}

.info-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--spacing-md);
}

.info-section li {
  color: var(--color-text);
  line-height: 1.7;
  padding: var(--spacing-md);
  position: relative;
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.info-section li::before {
  content: "•";
  color: var(--color-text);
  font-weight: bold;
  position: absolute;
  left: var(--spacing-md);
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
}

.info-section li {
  padding-left: calc(var(--spacing-md) + 1.5rem);
}

.info-section li strong {
  font-weight: 700;
}

/* ===== PIECES INFORMATION STYLES ===== */
.pieces-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
}

.piece-info {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
  padding: var(--spacing-lg);
  background: linear-gradient(
    135deg,
    rgba(30, 41, 59, 0.3) 0%,
    rgba(30, 41, 59, 0.1) 100%
  );
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.piece-icon {
  font-size: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.05) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.queen-icon {
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

.rook-icon {
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

.piece-details {
  flex: 1;
}

.piece-details h4 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 var(--spacing-sm) 0;
  text-align: left;
}

.piece-details p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 0 0 var(--spacing-sm) 0;
  line-height: 1.4;
  font-weight: 500;
}

.piece-details p:last-child {
  margin-bottom: 0;
}

.pieces-note {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.15) 0%,
    rgba(59, 130, 246, 0.08) 100%
  );
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-md);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}

.pieces-note::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8, #3b82f6);
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

.pieces-note p {
  font-size: 1rem;
  color: var(--color-text-muted);
  margin: 0;
  line-height: 1.6;
  font-weight: 500;
}

.pieces-note p strong {
  color: #3b82f6;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* Responsive design for game start modal */
@media (max-width: 768px) {
  .game-start-content {
    width: 98%;
    max-height: 98vh;
    max-width: 1200px;
  }

  .game-logo-container {
    padding: var(--spacing-lg) 0;
  }

  .game-logo {
    max-width: 250px;
    max-height: 120px;
  }

  .game-title {
    font-size: 3rem;
    letter-spacing: 2px;
    text-shadow: 1px 1px 0px #b8860b, 2px 2px 0px #daa520, 3px 3px 0px #cd853f,
      4px 4px 0px #8b7355, 0px 0px 15px rgba(255, 215, 0, 0.8),
      0px 0px 30px rgba(255, 215, 0, 0.4),
      inset 0px 1px 0px rgba(255, 255, 255, 0.3),
      inset 0px -1px 0px rgba(139, 69, 19, 0.3);
  }

  .game-subtitle {
    font-size: 1.2rem;
  }

  .info-section {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
  }

  .info-section h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
  }

  .info-section li {
    padding: var(--spacing-sm);
    font-size: 0.95rem;
  }

  .info-section li::before {
    font-size: 1rem;
  }

  .piece-info {
    padding: var(--spacing-md);
    gap: var(--spacing-md);
  }

  .piece-icon {
    font-size: 2rem;
    width: 3rem;
    height: 3rem;
  }

  .piece-details h4 {
    font-size: 1.1rem;
  }

  .piece-details p {
    font-size: 0.9rem;
  }

  .game-controls {
    flex-direction: column;
    align-items: center;
    padding: var(--spacing-lg);
  }

  .start-button {
    width: 100%;
    max-width: 700px;
    font-size: 1.2rem;
    padding: var(--spacing-md) var(--spacing-xl);
  }
}

@media (max-width: 480px) {
  .game-logo-container {
    padding: var(--spacing-md) 0;
  }

  .game-logo {
    max-width: 200px;
    max-height: 100px;
  }

  .game-title {
    font-size: 2.5rem;
    letter-spacing: 1px;
    text-shadow: 1px 1px 0px #b8860b, 2px 2px 0px #daa520, 3px 3px 0px #cd853f,
      0px 0px 10px rgba(255, 215, 0, 0.8), 0px 0px 20px rgba(255, 215, 0, 0.4),
      inset 0px 1px 0px rgba(255, 255, 255, 0.3),
      inset 0px -1px 0px rgba(139, 69, 19, 0.3);
  }

  .game-info {
    padding: 0 var(--spacing-md);
  }

  .info-section {
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
  }

  .info-section h3 {
    font-size: 1.3rem;
    margin-bottom: var(--spacing-sm);
  }

  .info-section li {
    font-size: 0.9rem;
    padding: var(--spacing-sm);
  }

  .info-section li::before {
    font-size: 0.9rem;
  }

  .piece-info {
    padding: var(--spacing-sm);
    gap: var(--spacing-sm);
  }

  .piece-icon {
    font-size: 1.8rem;
    width: 2.5rem;
    height: 2.5rem;
  }

  .piece-details h4 {
    font-size: 1rem;
  }

  .piece-details p {
    font-size: 0.85rem;
  }

  .start-button {
    font-size: 1.1rem;
    padding: var(--spacing-sm) var(--spacing-lg);
    letter-spacing: 1px;
  }

  /* Game mode selector responsive */
  .mode-options {
    grid-template-columns: 1fr;
    gap: var(--spacing-sm);
  }

  .mode-card {
    padding: var(--spacing-md);
    min-height: 100px;
  }

  .mode-icon {
    font-size: 1.5rem;
  }

  .mode-title {
    font-size: 1rem;
  }

  .mode-description {
    font-size: 0.85rem;
  }
}

.modal-content {
  background: transparent;
  color: var(--color-text);
  margin: auto;
  padding: var(--spacing-2xl);
  border: 1px solid #2d3748;
  width: 90%;
  max-width: 600px;
  text-align: center;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 10000;
}

.winner-title {
  font-size: 1.875rem;
  font-weight: 700;
  margin-bottom: var(--spacing-md);
}

.modal-subtitle {
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-lg);
}

.restart-button {
  width: 100%;
  background-color: var(--color-green);
  color: white;
  font-weight: 700;
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-lg);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-normal);
}

.restart-button:hover {
  background-color: #15803d;
  transform: scale(1.05);
}

.restart-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px #22c55e, 0 0 0 4px rgba(34, 197, 94, 0.5);
}

/* Winner message color variants */
.winner-red {
  color: var(--color-red);
}
.winner-blue {
  color: var(--color-blue);
}
.winner-green {
  color: var(--color-green);
}
.winner-yellow {
  color: var(--color-yellow);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .action-toggle-container {
    top: var(--spacing-sm);
    right: var(--spacing-sm);
  }

  .action-toggle-button {
    font-size: 0.8rem;
    padding: var(--spacing-xs) var(--spacing-sm);
    min-width: 100px;
  }

  .home-button-container {
    top: var(--spacing-sm);
    left: var(--spacing-sm);
  }

  .home-button {
    width: 40px;
    height: 40px;
    padding: var(--spacing-xs);
  }

  .home-button svg {
    width: 20px;
    height: 20px;
  }

  .game-board-container {
    max-width: 440px; /* 10% larger than 400px for mobile */
  }

  .dice {
    width: 22px; /* 20% smaller than 28px for mobile */
    height: 22px; /* 20% smaller than 28px for mobile */
    font-size: 0.6rem; /* Smaller font for mobile */
  }

  .dice-red {
    top: -25px; /* Adjusted to prevent collision with game board */
  }
  .dice-blue {
    left: calc(100% + 25px); /* Adjusted to prevent collision with game board */
  }
  .dice-green {
    top: calc(100% + 25px); /* Adjusted to prevent collision with game board */
  }
  .dice-yellow {
    left: -25px; /* Adjusted to prevent collision with game board */
  }

  /* Responsive star boxes */
  .star-box {
    width: 26px; /* Match action button size */
    height: 26px; /* Match action button size */
    font-size: 7px; /* Much smaller diamond size */
    border-radius: 5px; /* Match action button border radius */
    display: flex;
    align-items: center;
    justify-content: center; /* Center the diamond properly */
  }

  /* Responsive player palettes */
  .palette-button {
    width: 26px; /* Slightly increased for better touch target */
    height: 26px; /* Slightly increased for better touch target */
    font-size: 11px; /* Slightly reduced icon size */
    border-radius: 5px; /* Reduced corner radius for more compact look */
    display: flex;
    align-items: center;
    justify-content: center; /* Center the icons properly */
  }

  .palette-left {
    left: -205px; /* Equal distance from dice */
  }

  .palette-right {
    right: -205px; /* Equal distance from dice */
  }

  .palette-top {
    top: -205px; /* Equal distance from dice */
  }

  .palette-bottom {
    bottom: -205px; /* Equal distance from dice */
  }

  /* Horizontal positioning for top/bottom dice - 4 stars in one line with proper spacing */
  .star-box-left-1 {
    left: -120px; /* Adjusted for smaller board */
  }
  .star-box-left-2 {
    left: -95px; /* Adjusted for smaller board */
  }
  .star-box-left-3 {
    left: -70px; /* Adjusted for smaller board */
  }
  .star-box-left-4 {
    left: -45px; /* Adjusted for smaller board */
  }
  .star-box-right-1 {
    right: -120px; /* Adjusted for smaller board */
  }
  .star-box-right-2 {
    right: -95px; /* Adjusted for smaller board */
  }
  .star-box-right-3 {
    right: -70px; /* Adjusted for smaller board */
  }
  .star-box-right-4 {
    right: -45px; /* Adjusted for smaller board */
  }

  /* Vertical positioning for left/right dice - 4 stars in one line with proper spacing */
  .star-box-above-1 {
    top: -120px; /* Adjusted for smaller board */
  }
  .star-box-above-2 {
    top: -95px; /* Adjusted for smaller board */
  }
  .star-box-above-3 {
    top: -70px; /* Adjusted for smaller board */
  }
  .star-box-above-4 {
    top: -45px; /* Adjusted for smaller board */
  }
  .star-box-below-1 {
    bottom: -120px; /* Adjusted for smaller board */
  }
  .star-box-below-2 {
    bottom: -95px; /* Adjusted for smaller board */
  }
  .star-box-below-3 {
    bottom: -70px; /* Adjusted for smaller board */
  }
  .star-box-below-4 {
    bottom: -45px; /* Adjusted for smaller board */
  }
}

@media (max-width: 480px) {
  .action-toggle-container {
    top: var(--spacing-xs);
    right: var(--spacing-xs);
  }

  .action-toggle-button {
    font-size: 0.75rem;
    padding: var(--spacing-xs);
    min-width: 80px;
  }

  .home-button-container {
    top: var(--spacing-xs);
    left: var(--spacing-xs);
  }

  .home-button {
    width: 36px;
    height: 36px;
    padding: var(--spacing-xs);
  }

  .home-button svg {
    width: 18px;
    height: 18px;
  }

  .container-main {
    max-width: 95vw;
  }

  .game-board-container {
    max-width: 355px; /* Set to 345px for small mobile */
  }

  .dice {
    width: 30px !important; /* Set to 30px for small mobile */
    height: 30px !important; /* Set to 30px for small mobile */
    min-width: 30px !important; /* Override base min-width */
    min-height: 30px !important; /* Override base min-height */
    max-width: 30px !important; /* Override base max-width */
    max-height: 30px !important; /* Override base max-height */
    font-size: 0.7rem; /* Larger font for small mobile */
    border: 2px solid rgba(255, 255, 255, 0.3); /* Reduced border for small mobile */
    border-radius: 0.25rem; /* Reduced corner radius for small mobile */
  }

  .dice-red {
    top: -15px; /* Adjusted for 30px dice */
  }
  .dice-blue {
    left: calc(100% + 15px); /* Adjusted for 30px dice */
  }
  .dice-green {
    top: calc(100% + 15px); /* Adjusted for 30px dice */
  }
  .dice-yellow {
    left: -15px; /* Adjusted for 30px dice */
  }

  /* Small treasury diamond for small mobile */
  .treasury-content.treasury-big {
    font-size: 1rem; /* Smaller diamond for small mobile */
  }

  /* Small screen star boxes */
  .star-box {
    width: 22px; /* Match action button size */
    height: 22px; /* Match action button size */
    font-size: 6px; /* Much smaller diamond size */
    border-radius: 4px; /* Match action button border radius */
    display: flex;
    align-items: center;
    justify-content: center; /* Center the diamond properly */
  }

  /* Small screen player palettes */
  .palette-button {
    width: 22px; /* Slightly increased for better touch target */
    height: 22px; /* Slightly increased for better touch target */
    font-size: 10px; /* Keep small font for icons */
    border-radius: 4px; /* Reduced corner radius for more compact look */
    display: flex;
    align-items: center;
    justify-content: center; /* Center the icons properly */
  }

  .palette-left {
    left: -145px; /* Equal distance from dice for small mobile */
  }

  .palette-right {
    right: -145px; /* Equal distance from dice for small mobile */
  }

  .palette-top {
    top: -145px; /* Equal distance from dice for small mobile */
  }

  .palette-bottom {
    bottom: -145px; /* Equal distance from dice for small mobile */
  }

  /* Horizontal positioning for top/bottom dice - 4 stars in one line with proper spacing */
  .star-box-left-1 {
    left: -110px; /* Increased gap from dice - positioned farther */
  }
  .star-box-left-2 {
    left: -85px; /* Increased gap from dice - positioned farther */
  }
  .star-box-left-3 {
    left: -60px; /* Increased gap from dice - positioned farther */
  }
  .star-box-left-4 {
    left: -35px; /* Increased gap from dice - positioned farther */
  }
  .star-box-right-1 {
    right: -110px; /* Increased gap from dice - positioned farther */
  }
  .star-box-right-2 {
    right: -85px; /* Increased gap from dice - positioned farther */
  }
  .star-box-right-3 {
    right: -60px; /* Increased gap from dice - positioned farther */
  }
  .star-box-right-4 {
    right: -35px; /* Increased gap from dice - positioned farther */
  }

  /* Vertical positioning for left/right dice - 4 stars in one line with proper spacing */
  .star-box-above-1 {
    top: -110px; /* Increased gap from dice - positioned farther */
  }
  .star-box-above-2 {
    top: -85px; /* Increased gap from dice - positioned farther */
  }
  .star-box-above-3 {
    top: -60px; /* Increased gap from dice - positioned farther */
  }
  .star-box-above-4 {
    top: -35px; /* Increased gap from dice - positioned farther */
  }
  .star-box-below-1 {
    bottom: -110px; /* Increased gap from dice - positioned farther */
  }
  .star-box-below-2 {
    bottom: -85px; /* Increased gap from dice - positioned farther */
  }
  .star-box-below-3 {
    bottom: -60px; /* Increased gap from dice - positioned farther */
  }
  .star-box-below-4 {
    bottom: -35px; /* Increased gap from dice - positioned farther */
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
.dice:focus,
.node:focus {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

/* Home Base Color Highlighting */
.node.home-red {
  background: linear-gradient(145deg, #fca5a5, #ef4444);
}

.node.home-blue {
  background: linear-gradient(145deg, #93c5fd, #3b82f6);
}

.node.home-green {
  background: linear-gradient(145deg, #86efac, #16a34a);
}

.node.home-yellow {
  background: linear-gradient(145deg, #fef08a, #ffff00);
}

/* Reduced hover effects for home cells - less shadow/glow */
.node.home-red:hover,
.node.home-blue:hover,
.node.home-green:hover,
.node.home-yellow:hover {
  transform: scale(1.02); /* Reduced scale from 1.05 */
  z-index: 10;
  border-radius: var(--radius-sm); /* Reduced border radius from default */
  box-shadow: inset 0 1px 3px rgba(255, 255, 255, 0.15),
    inset 0 -1px 3px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.2),
    0 0 8px rgba(44, 58, 77, 0.2); /* Reduced glow from 15px to 8px and opacity from 0.4 to 0.2 */
}

/* Reduced piece scaling for home cells */
.node.home-red:hover .piece,
.node.home-blue:hover .piece,
.node.home-green:hover .piece,
.node.home-yellow:hover .piece {
  transform: scale(1.05); /* Reduced scale from 1.1 to 1.05 */
}

/* ===== COLLECTOR POINTS ===== */
.collector-point {
  background: #666666; /* Default neutral color */
  border: 2px solid rgba(102, 102, 102, 0.6);
  box-shadow: 0 0 8px rgba(102, 102, 102, 0.3);
  animation: collectorGlow 2s ease-in-out infinite alternate;
  position: relative;
  border-radius: 50%;
}

.collector-point::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 50%;
}

.collector-content {
  display: none; /* Hide any content */
}

@keyframes collectorGlow {
  0% {
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
    transform: scale(1.01);
  }
}

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

/* Collector point color variants for each player - matching home cell gradients */
.collector-green {
  background: linear-gradient(
    145deg,
    #86efac,
    #16a34a
  ) !important; /* Same as home-green */
  border-color: rgba(22, 163, 74, 0.8) !important;
  box-shadow: 0 0 8px rgba(22, 163, 74, 0.4) !important;
}

.collector-yellow {
  background: linear-gradient(
    145deg,
    #fef08a,
    #ffff00
  ) !important; /* Same as home-yellow */
  border-color: rgba(255, 255, 0, 0.8) !important;
  box-shadow: 0 0 8px rgba(255, 255, 0, 0.4) !important;
}

.collector-red {
  background: linear-gradient(
    145deg,
    #fca5a5,
    #ef4444
  ) !important; /* Same as home-red */
  border-color: rgba(239, 68, 68, 0.8) !important;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4) !important;
}

.collector-blue {
  background: linear-gradient(
    145deg,
    #93c5fd,
    #3b82f6
  ) !important; /* Same as home-blue */
  border-color: rgba(59, 130, 246, 0.8) !important;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4) !important;
}

/* ===== SAFE CELLS ===== */
.safe-cell {
  background-color: #10b981;
  border: 2px solid #64748b;
}

/* ===== TELEPORT DESTINATION ===== */
.teleport-destination {
  background: linear-gradient(145deg, #8b5cf6, #7c3aed) !important;
  border: 3px solid rgba(139, 92, 246, 0.8) !important;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.6) !important;
  animation: teleportGlow 2s ease-in-out infinite alternate !important;
  cursor: pointer !important;
}

.teleport-destination:hover {
  transform: scale(1.1) !important;
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.9) !important;
}

@keyframes teleportGlow {
  0% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.6);
    transform: scale(1);
  }
  100% {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.9);
    transform: scale(1.02);
  }
}

/* Player Names Section */
.player-names-section {
  margin: 20px 0;
}

.player-names-section h3 {
  color: var(--color-text);
  margin-bottom: 15px;
  font-size: 1.1rem;
  font-weight: 600;
}

.player-names-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 20px;
}

.player-name-input {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.player-color-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.player-color-red {
  background-color: var(--color-red);
}

.player-color-blue {
  background-color: var(--color-blue);
}

.player-color-green {
  background-color: var(--color-green);
}

.player-color-yellow {
  background-color: var(--color-yellow);
}

.player-name-input input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  background: rgba(30, 41, 59, 0.3);
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.player-name-input input:focus {
  outline: none;
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.15);
  background: rgba(30, 41, 59, 0.5);
}

.player-name-input input::placeholder {
  color: var(--color-text-muted);
  opacity: 0.6;
}

/* Player Name Display in Dice - Base Styles */
.player-name-display {
  position: absolute;
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 10;
  min-width: fit-content;
  text-align: center;
}

/* Red Player - Left side - Expands to the LEFT, fixed gap on RIGHT (dice side) */
.player-name-red {
  right: calc(100% + 10px); /* Fixed 10px gap from dice */
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--color-red);
}

/* Blue Player - Above side - Vertical text - Expands UPWARD, fixed gap on BOTTOM (dice side) */
.player-name-blue {
  bottom: calc(100% + 10px); /* Fixed 10px gap from dice */
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  background-color: var(--color-blue);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 10px 6px;
  height: auto;
  width: auto;
}

/* Green Player - Right side - Expands to the RIGHT, fixed gap on LEFT (dice side) */
.player-name-green {
  left: calc(100% + 10px); /* Fixed 10px gap from dice */
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--color-green);
}

/* Yellow Player - Below side - Vertical text - Expands DOWNWARD, fixed gap on TOP (dice side) */
.player-name-yellow {
  top: calc(100% + 10px); /* Fixed 10px gap from dice */
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--color-yellow);
  color: var(--color-primary);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  padding: 10px 6px;
  height: auto;
  width: auto;
}

/* Responsive adjustments for player names */
@media (max-width: 768px) {
  .player-names-container {
    gap: 12px;
  }

  .player-name-display {
    font-size: 0.7rem;
    padding: 4px 8px;
  }

  .player-name-blue {
    padding: 8px 4px;
  }

  .player-name-yellow {
    padding: 8px 4px;
  }
}

/* Extra spacing for very small mobile screens */
@media (max-width: 480px) {
  .player-name-display {
    font-size: 0.65rem;
    padding: 4px 6px;
  }

  .player-name-blue,
  .player-name-yellow {
    padding: 6px 4px;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .node {
    border: 1px solid var(--color-text);
  }

  .player-name-input input {
    border-color: var(--color-text);
  }

  .player-name-display {
    border: 2px solid var(--color-text);
    background: var(--color-background) !important;
    color: var(--color-text) !important;
  }
}
