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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5e6d3;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

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

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

/* Start Screen */
.start-screen {
    animation: slideIn 0.3s ease;
}

.start-screen.hidden {
    display: none;
}

.game-screen {
    animation: slideIn 0.3s ease;
}

.game-screen.hidden {
    display: none;
}

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

.subtitle {
    text-align: center;
    font-size: 1.2em;
    color: #666;
    margin: 20px 0 15px;
    font-weight: 600;
}

.side-selection {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
}

.side-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 25px;
    font-size: 1em;
    border: 2px solid #ccc;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #333;
}

.side-btn:hover {
    border-color: #667eea;
    background: #f5f7ff;
    transform: translateY(-2px);
}

.side-btn.selected {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.side-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid currentColor;
}

.red-side {
    background: #e74c3c;
}

.black-side {
    background: #2c3e50;
}

.difficulty-selection {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.difficulty-btn {
    padding: 12px 24px;
    font-size: 1em;
    border: 2px solid #ccc;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #333;
    min-width: 100px;
}

.difficulty-btn:hover {
    border-color: #f39c12;
    background: #fffbf0;
}

.difficulty-btn.selected {
    border-color: #f39c12;
    background: #f39c12;
    color: white;
}

.random-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.random-btn:hover {
    border-color: #764ba2;
    background: linear-gradient(135deg, #5568d3 0%, #6d3a8f 100%);
}

.random-btn.selected {
    border-color: #764ba2;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-info {
    text-align: center;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
    margin-bottom: 20px;
    min-height: 40px;
}

#ai-selection-text {
    color: #666;
    font-weight: 500;
    margin: 0;
}

.start-game-btn {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.start-game-btn:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.start-game-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

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

.player-info {
    font-size: 1.1em;
    color: #333;
}

#current-player {
    padding: 8px 15px;
    border-radius: 6px;
    background: #667eea;
    color: white;
}

.piece-count {
    display: flex;
    gap: 20px;
    font-size: 0.95em;
    color: #555;
}

#game-stats {
    font-size: 0.9em;
    color: #666;
    text-align: center;
    min-height: 20px;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0;
    margin-bottom: 20px;
    background: #333;
    border: 3px solid #333;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
}

.square {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.square.light {
    background: #f0d9b5;
}

.square.dark {
    background: #b58863;
}

.square.dark:hover {
    background: #a0755f;
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: rgba(255, 215, 0, 0.6);
    border-radius: 50%;
    border: 2px solid #ffd700;
}

.square.selected {
    background: #90EE90 !important;
}

.piece {
    width: 85%;
    height: 85%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.piece:hover {
    transform: scale(1.05);
}

.piece.red {
    background: #e74c3c;
    color: white;
    border: 3px solid #c0392b;
}

.piece.black {
    background: #2c3e50;
    color: white;
    border: 3px solid #1a252f;
}

.piece.king::before {
    content: '♛';
    position: absolute;
    font-size: 1.2em;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

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

button {
    padding: 12px 24px;
    font-size: 1em;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    background: #667eea;
    color: white;
}

button:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

#undo-btn {
    background: #f39c12;
}

#undo-btn:hover {
    background: #e67e22;
}

.game-status {
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    padding: 15px;
    border-radius: 6px;
    min-height: 20px;
}

.game-status.winner {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.game-status.draw {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

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

    h1 {
        font-size: 2em;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
    }

    .piece-count {
        gap: 10px;
    }

    button {
        padding: 10px 16px;
        font-size: 0.9em;
    }
}
