*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 32px 16px;
    width: 100%;
    max-width: 420px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #f8fafc;
}

.mode-selector {
    display: flex;
    gap: 24px;
    font-size: 0.95rem;
    color: #94a3b8;
}

.mode-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: color 0.2s;
}

.mode-selector label:hover {
    color: #e2e8f0;
}

.mode-selector input[type="radio"] {
    accent-color: #6366f1;
}

.status {
    font-size: 1.1rem;
    font-weight: 500;
    color: #94a3b8;
    min-height: 1.6em;
    transition: color 0.3s;
}

.status.winner {
    color: #4ade80;
    font-size: 1.3rem;
}

.status.draw {
    color: #fb923c;
}

.status.thinking {
    color: #818cf8;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    width: 300px;
    height: 300px;
}

@media (max-width: 360px) {
    .board {
        width: 270px;
        height: 270px;
    }
}

.cell {
    background: #1e293b;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    border: 2px solid transparent;
}

.cell:hover:not(.taken):not(.disabled) {
    background: #273549;
    border-color: #334155;
}

.cell.taken {
    cursor: default;
}

.cell.disabled {
    cursor: default;
}

.cell[data-mark="X"] {
    color: #818cf8;
}

.cell[data-mark="O"] {
    color: #f472b6;
}

.cell.pop {
    animation: pop 0.2s ease-out;
}

@keyframes pop {
    0% { transform: scale(0.7); opacity: 0.5; }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.cell.winner-cell {
    background: #1e3a2f;
    border-color: #4ade80;
}

.btn {
    padding: 12px 32px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.thinking-dots::after {
    content: '';
    animation: dots 1s steps(3, end) infinite;
}

@keyframes dots {
    0%   { content: ''; }
    33%  { content: '.'; }
    66%  { content: '..'; }
    100% { content: '...'; }
}
