:root {
    --square-size: 60px;
    --board-size: calc(var(--square-size) * 8);
    --red-glow: #ff0055;
    --blue-glow: #00f3ff;
    --dark-tile: #1a1b26;
    --light-tile: #24283b;
}

@media (max-width: 500px) {
    :root {
        --square-size: 40px;
    }
}

.checkers-board {
    display: grid;
    grid-template-columns: repeat(8, var(--square-size));
    grid-template-rows: repeat(8, var(--square-size));
    width: var(--board-size);
    height: var(--board-size);
    margin: 20px auto;
    border: 4px solid var(--primary);
    box-shadow: 0 0 20px var(--primary), inset 0 0 10px var(--primary);
    background: var(--dark-tile);
    position: relative;
}

.tile {
    width: var(--square-size);
    height: var(--square-size);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

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

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

.tile.valid-move::after {
    content: '';
    width: 15px;
    height: 15px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    box-shadow: 0 0 10px #fff;
}

.tile.last-move-source {
    background-color: rgba(255, 255, 255, 0.15) !important;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.2);
}

.tile.last-move-dest {
    background-color: rgba(255, 255, 255, 0.25) !important;
    box-shadow: inset 0 0 15px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 1;
    /* Ensure border is visible */
}


.piece {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
}

.piece.red {
    background: var(--red-glow);
    box-shadow: 0 0 15px var(--red-glow), inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.piece.blue {
    background: var(--blue-glow);
    box-shadow: 0 0 15px var(--blue-glow), inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.piece.king::before {
    content: 'K';
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    color: #fff;
    text-shadow: 0 0 5px #000;
}

.piece.selected {
    transform: scale(1.1);
    border-color: #fff;
    box-shadow: 0 0 25px #fff;
    z-index: 10;
}

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

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: var(--board-size);
    margin: 0 auto;
    width: 100%;
}

.player-tag {
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.player-tag.red {
    color: var(--red-glow);
    border-color: var(--red-glow);
}

.player-tag.blue {
    color: var(--blue-glow);
    border-color: var(--blue-glow);
}

.player-tag.active {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px currentColor;
}

/* Turn Indicator (Matches Dots & Boxes) */
.turn-badge {
    background: var(--surface);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-family: inherit;
    /* Reset arcade font for cleaner badge look if desired, or keep it */
    letter-spacing: 1px;
}

.turn-badge.red {
    background: rgba(255, 0, 85, 0.2);
    border-color: var(--red-glow);
    color: var(--red-glow);
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
}

.turn-badge.blue {
    background: rgba(0, 243, 255, 0.2);
    border-color: var(--blue-glow);
    color: var(--blue-glow);
    box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
}

.game-msg {
    margin: 20px auto;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    padding: 10px;
    border-radius: 12px;
    text-align: center;
    max-width: 80%;
    min-height: 1.5rem;
    transition: all 0.3s ease;
}

/* Modal Styling (Matches Dots & Boxes) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(20, 20, 30, 0.95);
    margin: auto;
    padding: 40px;
    border: 1px solid var(--primary);
    width: 80%;
    max-width: 500px;
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(0, 243, 255, 0.2), inset 0 0 20px rgba(0, 243, 255, 0.05);
    text-align: center;
    position: relative;
    animation: scaleIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal h2 {
    font-size: 3rem !important;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-family: 'Press Start 2P', cursive;
    /* Keep arcade font for titles */
}

.modal p {
    font-size: 1.5rem !important;
    color: var(--text-dim);
    margin-bottom: 40px;
}

.modal-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.modal-actions button {
    padding: 12px 30px;
    font-size: 1.1rem;
    min-width: 160px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Lobby Styling */
.game-modes {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.mode-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    flex: 1 1 280px;
    max-width: 320px;
    transition: all 0.3s ease;
}

.mode-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 10px 30px rgba(0, 243, 255, 0.15);
}

.mode-card h3 {
    margin: 0 0 10px 0;
    color: var(--primary);
    font-size: 1.4rem;
}

.mode-desc {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.full-width {
    width: 100%;
}

.small {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.neon-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-family: inherit;
}

#stats-banner {
    background: rgba(0, 243, 255, 0.05);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 243, 255, 0.2);
    display: inline-block;
}