:root {
    --bg-color: #0b0f19;
    --text-color: #f8fafc;
    --primary-cyan: #06b6d4;
    --primary-pink: #ec4899;
    --board-light: #1e293b;
    --board-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: radial-gradient(circle at 50% 0%, #1e293b 0%, #0b0f19 70%);
}

.hidden {
    display: none !important;
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 3rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

#menu-status {
    color: var(--primary-cyan);
    font-weight: 500;
    min-height: 1.5rem;
    margin-top: 1rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    backdrop-filter: blur(10px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

header {
    text-align: center;
    width: 100%;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--primary-cyan), var(--primary-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.status-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

#turn-indicator {
    font-size: 1.2rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.player-turn {
    color: var(--primary-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.ai-turn {
    color: var(--primary-pink);
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.5);
}

.scores {
    display: flex;
    gap: 1.5rem;
}

.score {
    font-weight: 500;
}

.p1-score { color: var(--primary-cyan); }
.p2-score { color: var(--primary-pink); }

.board-wrapper {
    padding: 10px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(236, 72, 153, 0.2));
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    overflow: hidden;
}

.cell {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.cell.light {
    background-color: var(--board-light);
}

.cell.dark {
    background-color: var(--board-dark);
}

.cell.valid-move {
    cursor: pointer;
}

.cell.valid-move::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: rgba(6, 182, 212, 0.5);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary-cyan);
    animation: pulse 1.5s infinite;
}

.piece {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    position: relative;
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 10;
}

.piece:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.piece.player1 {
    background: radial-gradient(circle at 30% 30%, #22d3ee, var(--primary-cyan));
    box-shadow: 0 4px 10px rgba(6, 182, 212, 0.4), inset 0 -4px 8px rgba(0,0,0,0.3);
}

.piece.player2 {
    background: radial-gradient(circle at 30% 30%, #f472b6, var(--primary-pink));
    box-shadow: 0 4px 10px rgba(236, 72, 153, 0.4), inset 0 -4px 8px rgba(0,0,0,0.3);
}

.piece.selected {
    transform: scale(1.15);
    box-shadow: 0 0 20px 5px currentColor;
}

.piece.player1.selected {
    color: var(--primary-cyan);
}

.piece.player2.selected {
    color: var(--primary-pink);
}

.piece.king::before {
    content: '👑';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-content {
    background: var(--glass-bg);
    padding: 3rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
    transform: scale(1);
    transition: transform 0.3s ease;
}

.modal.hidden .modal-content {
    transform: scale(0.9);
}

#modal-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-cyan);
}

#modal-message {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #cbd5e1;
}

button {
    background: linear-gradient(135deg, var(--primary-cyan), #0284c7);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(6, 182, 212, 0.4);
}

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

button:disabled {
    background: #475569;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.room-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

.join-room-wrapper {
    display: flex;
    gap: 0.5rem;
}

#room-code-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: var(--text-color);
    padding: 0.8rem;
    border-radius: 8px;
    font-size: 1.1rem;
    text-transform: uppercase;
    text-align: center;
    outline: none;
}

#room-code-input:focus {
    border-color: var(--primary-cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

#btn-join-room {
    flex: 1;
}

.room-info {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: #cbd5e1;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    display: inline-block;
}

#room-code-display {
    color: var(--primary-pink);
    font-weight: 700;
    letter-spacing: 2px;
}

@media (max-width: 600px) {
    .board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }
    .cell {
        width: 40px;
        height: 40px;
    }
    .piece {
        width: 30px;
        height: 30px;
    }
    .piece.king::before {
        font-size: 0.8rem;
    }
    h1 {
        font-size: 2rem;
    }
}
