: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-x: #3b82f6;
    /* Blue */
    --color-o: #f59e0b;
    /* Orange */
    --color-grid: rgba(255, 255, 255, 0.15);
}

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(59, 130, 246, 0.15), transparent 25%),
        radial-gradient(circle at 90% 50%, rgba(245, 158, 11, 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: 40px;
    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: 30px;
}

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-x {
    color: var(--color-x);
}

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

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

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

@keyframes ai-pulse {

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

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

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

.grid-line {
    stroke: var(--color-grid);
    stroke-width: 4;
    stroke-linecap: round;
}

/* Invisible click targets */
.cell {
    fill: transparent;
}

.cell:hover {
    fill: rgba(255, 255, 255, 0.05);
}

/* SVG Path Draw Animations */
.mark-x {
    stroke: var(--color-x);
    stroke-width: 10;
    stroke-linecap: round;
    fill: none;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: draw 0.3s ease forwards;
}

.mark-o {
    stroke: var(--color-o);
    stroke-width: 10;
    stroke-linecap: round;
    fill: none;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: draw 0.4s ease forwards;
}

@keyframes draw {
    to {
        stroke-dashoffset: 0;
    }
}

.win-line {
    stroke: #10b981;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    animation: draw 0.5s ease-out forwards;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.5));
}

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;
    }
}