/* CSS Variables */
:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --card-bg: rgba(255, 255, 255, 0.05);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.8);
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-light: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 8px 25px rgba(0, 0, 0, 0.2);
  --shadow-heavy: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #0A0A23;
    color: #FFFFFF;
    margin: 0;
    min-height: 100vh;
    user-select: none;
    touch-action: manipulation;
}

/* Game-specific styles - header styles are in shared game-header.css */

/* Mode Selection Screen */
.mode-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 20px;
}

.mode-container {
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.mode-container h2 {
    font-size: 2.5rem;
    margin-bottom: 40px;
    color: #FFFFFF;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 30px;
}

.mode-btn {
    background: linear-gradient(135deg, #003566, #001D3D);
    border: 2px solid #00B4DB;
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #FFFFFF;
    text-align: center;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 180, 219, 0.3);
    border-color: #4CAF50;
}

.mode-icon {
    font-size: 4rem;
    margin-bottom: 15px;
}

.mode-btn h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #00B4DB;
}

.mode-btn p {
    font-size: 1rem;
    opacity: 0.8;
    line-height: 1.4;
}

/* Game container */
.game-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Game info panel */
.game-info {
    background: #003566;
    border-radius: 15px;
    padding: 20px;
    min-width: 250px;
    border: 2px solid #00B4DB;
}

.player-info {
    margin-bottom: 20px;
}

.player {
    display: flex;
    flex-direction: column;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.player.active {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    transform: scale(1.05);
}

.player-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.player-position {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Dice container */
.dice-container {
    text-align: center;
    margin-bottom: 20px;
}

.dice {
    width: 60px;
    height: 60px;
    background: #FFFFFF;
    border-radius: 10px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}

.dice.rolling {
    animation: roll 0.5s ease-in-out;
}

@keyframes roll {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(90deg); }
    50% { transform: rotate(180deg); }
    75% { transform: rotate(270deg); }
}

.dice-face {
    font-size: 2rem;
    font-weight: bold;
    color: #0A0A23;
}

.roll-btn {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.roll-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.roll-btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
}

/* Game status */
.game-status {
    text-align: center;
}

#gameMessage {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Board container */
.board-container {
    background: #003566;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #00B4DB;
}

/* Game board */
.board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 2px;
    width: 500px;
    height: 500px;
    background: #001D3D;
    border-radius: 10px;
    padding: 10px;
}

.square {
    background: linear-gradient(135deg, #FFFFFF 0%, #F0F8FF 100%);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    color: #0A0A23;
    position: relative;
    transition: all 0.3s ease;
    border: 1px solid rgba(0, 180, 219, 0.2);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.square:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 180, 219, 0.3);
}

/* Special squares styling */
.square[data-number="1"] {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #8B4513;
    font-weight: 900;
    border: 3px solid #FF6347;
}

.square[data-number="1"]::after {
    content: '🏠';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.8rem;
}

.square[data-number="100"] {
    background: linear-gradient(135deg, #FF1493, #FF69B4);
    color: white;
    font-weight: 900;
    border: 3px solid #FFD700;
    animation: victory 2s ease-in-out infinite;
}

.square[data-number="100"]::after {
    content: '👑';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.8rem;
}

@keyframes victory {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
}

/* Connection lines */
.connection-line {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.snake-connection {
    animation: snakeFlow 3s ease-in-out infinite;
}

.ladder-connection {
    animation: ladderFlow 2s ease-in-out infinite;
}

@keyframes snakeFlow {
    0%, 100% { 
        opacity: 0.7;
        filter: brightness(1);
    }
    50% { 
        opacity: 0.9;
        filter: brightness(1.2);
    }
}

@keyframes ladderFlow {
    0%, 100% { 
        opacity: 0.7;
        filter: brightness(1);
    }
    50% { 
        opacity: 0.9;
        filter: brightness(1.3);
    }
}

/* Board enhancements */
.board {
    position: relative;
    background: 
        linear-gradient(45deg, #001D3D 25%, transparent 25%), 
        linear-gradient(-45deg, #001D3D 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #001D3D 75%), 
        linear-gradient(-45deg, transparent 75%, #001D3D 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.board::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    background: linear-gradient(45deg, #00B4DB, #0083B0);
    border-radius: 15px;
    z-index: -1;
}

.square.snake {
    background: linear-gradient(45deg, #FF6B6B, #FF8E53);
    color: white;
    animation: pulse 2s infinite;
    position: relative;
    overflow: hidden;
}

.square.snake::before {
    content: '🐍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    z-index: 1;
    animation: snakeWiggle 3s ease-in-out infinite;
}

.square.snake::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.3) 2px, transparent 2px),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.2) 1px, transparent 1px),
        linear-gradient(45deg, transparent 40%, rgba(139, 69, 19, 0.3) 50%, transparent 60%);
    z-index: 0;
}

.square.ladder {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
    animation: glow 2s infinite;
    position: relative;
    overflow: hidden;
}

.square.ladder::before {
    content: '🪜';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    z-index: 1;
    animation: ladderShine 2.5s ease-in-out infinite;
}

.square.ladder::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(90deg, rgba(139, 69, 19, 0.4) 2px, transparent 2px, transparent 8px, rgba(139, 69, 19, 0.4) 10px),
        linear-gradient(0deg, rgba(139, 69, 19, 0.6) 1px, transparent 1px, transparent 6px, rgba(139, 69, 19, 0.6) 7px);
    background-size: 12px 8px;
    z-index: 0;
}

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

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(76, 175, 80, 0.5); }
    50% { box-shadow: 0 0 15px rgba(76, 175, 80, 0.8); }
}

@keyframes snakeWiggle {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-5deg); }
    75% { transform: translate(-50%, -50%) rotate(5deg); }
}

@keyframes ladderShine {
    0%, 100% { transform: translate(-50%, -50%) scale(1); filter: brightness(1); }
    50% { transform: translate(-50%, -50%) scale(1.1); filter: brightness(1.3); }
}

/* Snake tail styling */
.square.snake-tail {
    background: linear-gradient(45deg, #8B4513, #A0522D);
    color: white;
    position: relative;
    border: 2px solid #FF6B6B;
}

.square.snake-tail::before {
    content: '🐍';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(180deg);
    font-size: 1.2rem;
    opacity: 0.7;
    z-index: 1;
}

/* Ladder top styling */
.square.ladder-top {
    background: linear-gradient(45deg, #228B22, #32CD32);
    color: white;
    position: relative;
    border: 2px solid #4CAF50;
}

.square.ladder-top::before {
    content: '🏁';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    z-index: 1;
    animation: flag 2s ease-in-out infinite;
}

@keyframes flag {
    0%, 100% { transform: translate(-50%, -50%) rotate(-5deg); }
    50% { transform: translate(-50%, -50%) rotate(5deg); }
}

.square.player1 {
    box-shadow: inset 0 0 0 3px #FF6B6B;
}

.square.player2 {
    box-shadow: inset 0 0 0 3px #4CAF50;
}

.square.both-players {
    box-shadow: inset 0 0 0 3px #FF6B6B, inset 0 0 0 6px #4CAF50;
}

/* Player tokens */
.player-token {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 10;
    border: 2px solid white;
    animation: bounce 0.5s ease-in-out;
}

.player-token.player1 {
    background: #FF6B6B;
    top: 2px;
    left: 2px;
}

.player-token.player2 {
    background: #4CAF50;
    bottom: 2px;
    right: 2px;
}

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

/* Special effects */
.special-effect {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    z-index: 1000;
    pointer-events: none;
    animation: specialEffect 2s ease-out forwards;
}

.snake-effect {
    color: #FF6B6B;
}

.ladder-effect {
    color: #4CAF50;
}

@keyframes specialEffect {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* Add decorative elements to certain squares */
.square[data-number="10"], .square[data-number="20"], .square[data-number="30"], 
.square[data-number="40"], .square[data-number="50"], .square[data-number="60"], 
.square[data-number="70"], .square[data-number="80"], .square[data-number="90"] {
    background: linear-gradient(135deg, #E6E6FA, #D8BFD8);
    border: 2px solid #9370DB;
}

.square[data-number="10"]::after, .square[data-number="20"]::after, .square[data-number="30"]::after,
.square[data-number="40"]::after, .square[data-number="50"]::after, .square[data-number="60"]::after,
.square[data-number="70"]::after, .square[data-number="80"]::after, .square[data-number="90"]::after {
    content: '⭐';
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 0.7rem;
    animation: twinkle 2s ease-in-out infinite;
}

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

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        align-items: center;
    }
    
    .board {
        width: 350px;
        height: 350px;
    }
    
    .square {
        font-size: 0.6rem;
    }
    
    .player-token {
        width: 15px;
        height: 15px;
        font-size: 0.6rem;
    }
    
    .square.snake::before, .square.ladder::before {
        font-size: 1rem;
    }
    
    .square.snake-tail::before, .square.ladder-top::before {
        font-size: 0.8rem;
    }
}/* Mobile o
ptimizations */
@media (max-width: 768px) {
  .square {
    min-height: 35px !important;
    min-width: 35px !important;
    font-size: 0.8rem !important;
  }
  
  .roll-btn {
    padding: 15px 25px !important;
    font-size: 1.1rem !important;
    touch-action: manipulation;
  }
  
  .dice {
    width: 60px !important;
    height: 60px !important;
  }
  
  .mode-btn {
    padding: 15px 20px !important;
    touch-action: manipulation;
  }
}

/* Touch feedback */
.roll-btn:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.mode-btn:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}