/* Chess Board Container */
.chessboard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 3px solid #2d3748;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Individual Square */
.square {
    aspect-ratio: 1/1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.piece.white {
    color: #fafafa;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.55));
}

.piece.black {
    color: #111111;
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.25));
}

.square.light {
    background-color: #e6ebef;
}

.square.dark {
    background-color: #6f8899;
}


.square.last-move {
    background-color: rgba(255, 255, 0, 0.4) !important;
}
/* Piece Styling */
.piece {
    font-size: calc(min(70vh, 85vw, 550px) / 10);
    cursor: grab;
    user-select: none;
    transition: transform 0.1s;
}


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

/* Check Highlighting */
.square.check-red {
    background-color: #ff6b6b !important;
    animation: pulse 1s infinite;
}

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

/* Flipped Board for Black Player */
.chessboard.flipped {
    transform: rotate(180deg);
}

.chessboard.flipped .piece {
    transform: rotate(180deg);
}

.chessboard.flipped .piece:active {
    transform: rotate(180deg) scale(1.1);
}

/* Drag and Drop Feedback */
.square:hover {
    opacity: 0.9;
}

/* Role Display Styles */
.role-display {
    margin-bottom: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: bold;
    text-align: center;
    animation: fadeIn 0.5s;
}

.role-badge {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    border-radius: 2rem;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.white-role {
    background: linear-gradient(135deg, #f0f0f0, #d0d0d0);
    color: #1a1a1a;
}

.black-role {
    background: linear-gradient(135deg, #2d2d2d, #1a1a1a);
    color: #ffffff;
}

.spectator-role {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #ffffff;
}

/* Player Count Styles */
.player-count {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    flex-wrap: wrap;
    justify-content: center;
}

.count-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.count-item.filled {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.count-item.empty {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.white-dot {
    background: #f0f0f0;
    box-shadow: 0 0 8px rgba(240, 240, 240, 0.6);
}

.black-dot {
    background: #2d2d2d;
    box-shadow: 0 0 8px rgba(45, 45, 45, 0.6);
}

.spectator-dot {
    background: #667eea;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
}

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

/* Responsive adjustments for smaller screens */
@media (max-height: 800px) {
    .piece {
        font-size: calc(min(55vh, 75vw, 420px) / 10);
    }
    
    .role-badge {
        font-size: 0.875rem;
        padding: 0.4rem 1.2rem;
    }
    
    .player-count {
        font-size: 0.75rem;
    }
}

@media (max-height: 650px) {
    .piece {
        font-size: calc(min(45vh, 65vw, 320px) / 10);
    }
}

/* Button Disabled State */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none !important;
}


.square.last-move {
    background-color: rgba(198, 176, 110, 0.55) !important; /* Muted gold */
    transition: background-color 0.2s ease;
}
.square.last-move-capture {
    background-color: rgba(191, 122, 57, 0.6) !important; /* Rich amber */
}
