:root {
    --bg-dark: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;

    --color-p1: #ef4444;
    /* Player 1 : Red */
    --color-p2: #eab308;
    /* Player 2 : Yellow */
    --color-board: #2563eb;
    /* Connect 4 Blue Board */
    --color-board-shadow: #1e3a8a;
    --color-hole: #0f172a;
    /* Empty slot */
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', -apple-system, sans-serif;
    background: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 50%, rgba(239, 68, 68, 0.15), transparent 25%),
        radial-gradient(circle at 90% 50%, rgba(234, 179, 8, 0.15), transparent 25%);
    color: var(--text-main);
    user-select: none;
}

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

h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.status-text {
    font-size: 20px;
    font-weight: 600;
    height: 30px;
}

.status-p1 {
    color: var(--color-p1);
}

.status-p2 {
    color: var(--color-p2);
}

.status-draw {
    color: var(--text-muted);
}

.status-ai {
    color: var(--color-p2);
    animation: ai-pulse 1s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(234, 179, 8, 0.5);
    pointer-events: none;
}

@keyframes ai-pulse {

    0%,
    100% {
        opacity: 0.5;
        color: var(--color-p2);
    }

    50% {
        opacity: 1;
        color: #fde047;
    }
}

/* SVG Connect 4 Board */
.board {
    width: 350px;
    height: 300px;
    position: relative;
    cursor: pointer;
}

/* Background panel for the blue Connect-4 rack */
.rack-bg {
    fill: var(--color-board);
    rx: 8px;
    /* Rounded corners */
    ry: 8px;
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.5));
}

/* Base legs of the Connect 4 board */
.rack-leg {
    fill: var(--color-board-shadow);
}

/* The holes punched out of the rack */
.hole-empty {
    fill: var(--color-hole);
    stroke: rgba(0, 0, 0, 0.3);
    stroke-width: 2px;
}

/* The chips dropped inside */
.chip {
    transition: cy 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 2px;
}

.chip-red {
    fill: var(--color-p1);
    filter: drop-shadow(inset 0 -4px 4px rgba(0, 0, 0, 0.4));
}

.chip-yellow {
    fill: var(--color-p2);
    filter: drop-shadow(inset 0 -4px 4px rgba(0, 0, 0, 0.4));
}

.chip-empty {
    fill: transparent;
    stroke: transparent;
}

/* Invisible Columns (to catch mouse click events easily per column) */
.click-column {
    fill: transparent;
}

.click-column:hover {
    fill: rgba(255, 255, 255, 0.05);
}

.win-circle {
    fill: transparent;
    stroke: #10b981;
    stroke-width: 4;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: pulse-win 1s ease-out forwards;
}

@keyframes pulse-win {
    to {
        stroke-dashoffset: 0;
    }
}

button.primary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Outfit', sans-serif;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

button.primary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

button.primary-btn:active {
    transform: translateY(1px);
}

.sys-log {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    text-align: center;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}