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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5rem;
}

.game-mode-selector {
    margin-bottom: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 10px;
    border: 2px solid #667eea;
}

.game-mode-selector label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    margin-right: 10px;
}

.mode-select {
    padding: 8px 15px;
    font-size: 1rem;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.mode-select:hover {
    border-color: #764ba2;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.mode-select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.mode-description {
    margin-top: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 6px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.5;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
}

.player-turn {
    font-size: 1.2rem;
    font-weight: bold;
}

#current-player {
    color: #667eea;
    text-transform: uppercase;
}

.game-status {
    font-size: 1.1rem;
    color: #e74c3c;
    font-weight: bold;
}

.chessboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    aspect-ratio: 1;
    border: 4px solid #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.square {
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.square.light {
    background: #f0d9b5;
}

.square.dark {
    background: #b58863;
}

.square:hover {
    filter: brightness(0.9);
}

.square.selected {
    background: #baca44 !important;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.square.valid-move {
    position: relative;
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background: rgba(20, 85, 30, 0.5);
    border-radius: 50%;
}

.square.valid-move.has-piece::after {
    width: 90%;
    height: 90%;
    background: transparent;
    border: 4px solid rgba(20, 85, 30, 0.5);
    border-radius: 50%;
}

.square.in-check {
    background: #e74c3c !important;
    animation: pulse 1s infinite;
}

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

.piece {
    user-select: none;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}

.square.can-move {
    position: relative;
}

.square.can-move::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 3px solid #4CAF50;
    border-radius: 4px;
    pointer-events: none;
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
        border-color: #4CAF50;
    }
    50% {
        box-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
        border-color: #66BB6A;
    }
}

.controls {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

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

.btn:active {
    transform: translateY(0);
}

.captured-pieces {
    margin-top: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.captured-white, .captured-black {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
}

.captured-white h3, .captured-black h3 {
    font-size: 1rem;
    margin-bottom: 10px;
    color: #333;
}

#captured-white, #captured-black {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 50px;
}

.captured-piece {
    font-size: 1.5rem;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .square {
        font-size: 2rem;
    }

    .captured-pieces {
        grid-template-columns: 1fr;
    }
}

