:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --surface: #1e293b;
    --border: rgba(255,255,255,0.1);
    
    --board-color: #2563eb; /* Classic blue board */
    --board-shadow: #1d4ed8;
    --empty-hole: #0f172a;
    --p1-color: #ef4444; /* Red */
    --p1-shadow: #b91c1c;
    --p2-color: #eab308; /* Yellow */
    --p2-shadow: #a16207;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(239, 68, 68, 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(234, 179, 8, 0.05), transparent 25%);
}

.game-container {
    width: 100%;
    max-width: 600px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 60px; /* Space for navbar */
}

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

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.highlight {
    color: var(--p1-color);
    text-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.turn-indicator {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.player-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 1.1rem;
    opacity: 0.4;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.player-badge.p1 {
    color: var(--p1-color);
}

.player-badge.p2 {
    color: var(--p2-color);
}

.player-badge.active.p1 {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--p1-color);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.player-badge.active.p2 {
    opacity: 1;
    background: rgba(234, 179, 8, 0.1);
    border-color: var(--p2-color);
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.2);
}

.controls-row {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.btn {
    background: var(--surface);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.primary-btn {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--board-color);
    color: #60a5fa;
    box-shadow: 0 0 15px rgba(37, 99, 235, 0.2);
}

.primary-btn:hover {
    background: var(--board-color);
    color: white;
}

.game-area {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

.board-wrapper {
    background: var(--board-shadow);
    padding: 10px;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    /* The board itself acts as the mask */
}

.board {
    display: flex;
    background: var(--board-color);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 2px solid #3b82f6;
}

.column {
    display: flex;
    flex-direction: column;
    padding: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.column:hover {
    background: rgba(255,255,255,0.05);
}

.cell-slot {
    width: 50px;
    height: 50px;
    margin: 5px;
    border-radius: 50%;
    background: var(--empty-hole);
    box-shadow: inset 0 5px 10px rgba(0,0,0,0.5), 0 2px 0 rgba(255,255,255,0.2);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Tokens are absolutely positioned inside the cell slot but visually dropped in */
.token {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-400px); /* Start high up for drop animation */
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1; /* Below the board mask if we used SVG, but here we just animate them inside overflow hidden */
}

/* Because standard div masking is hard for Connect 4 without SVG, 
we animate the token INSIDE the individual cell after a delay, 
or we do standard state update. For simplicity: */

.cell-slot.p1 .token {
    background: radial-gradient(circle at 30% 30%, #f87171, var(--p1-color) 60%, var(--p1-shadow));
    transform: translateY(0);
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.4), 0 3px 5px rgba(0,0,0,0.3);
}

.cell-slot.p2 .token {
    background: radial-gradient(circle at 30% 30%, #fde047, var(--p2-color) 60%, var(--p2-shadow));
    transform: translateY(0);
    box-shadow: inset -2px -2px 6px rgba(0,0,0,0.4), 0 3px 5px rgba(0,0,0,0.3);
}

.cell-slot.win .token {
    animation: pulse 1s infinite alternate;
    box-shadow: 0 0 20px rgba(255,255,255,0.8);
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

@media (max-width: 500px) {
    .cell-slot {
        width: 12vw;
        height: 12vw;
        max-width: 45px;
        max-height: 45px;
        margin: 3px;
    }
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    z-index: 10;
    border-radius: 12px;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.overlay h2 {
    font-size: 2.5rem;
    text-shadow: 0 0 10px rgba(255,255,255,0.3);
    text-align: center;
}

.overlay h2.p1-win { color: var(--p1-color); text-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
.overlay h2.p2-win { color: var(--p2-color); text-shadow: 0 0 20px rgba(234, 179, 8, 0.5); }
.overlay h2.draw { color: var(--text-main); }
