/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #dc2626;
    --bg-color: #f8fafc;
    --board-bg: #ffffff;
    --cell-border: #cbd5e1;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    color: var(--text-primary);
}

.container {
    background: var(--bg-color);
    border-radius: 1.5rem;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Game info */
.game-info {
    margin-bottom: 1.5rem;
}

.status {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    padding: 1rem;
    background: var(--board-bg);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.status.winner {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    animation: celebrate 0.5s ease;
}

.status.draw {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Game board */
.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    background: var(--board-bg);
    padding: 1rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.cell {
    aspect-ratio: 1;
    background: var(--bg-color);
    border: 3px solid var(--cell-border);
    border-radius: 0.75rem;
    font-size: 3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
}

.cell:hover:not(:disabled) {
    background: #e0e7ff;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.cell:active:not(:disabled) {
    transform: scale(0.95);
}

.cell:disabled {
    cursor: not-allowed;
}

.cell.x {
    color: var(--primary-color);
    animation: pop 0.3s ease;
}

.cell.o {
    color: var(--secondary-color);
    animation: pop 0.3s ease;
}

.cell.winning {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
    animation: pulse 0.5s ease infinite;
}

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Game controls */
.game-controls {
    text-align: center;
}

.reset-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
    width: 100%;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

/* Footer */
footer {
    margin-top: 2rem;
    text-align: center;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 1.5rem;
    }

    h1 {
        font-size: 2rem;
    }

    .status {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .cell {
        font-size: 2rem;
    }

    .game-board {
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .reset-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.9375rem;
    }
}

/* Focus styles for accessibility */
.cell:focus-visible,
.reset-btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
