:root {
    --primary-color: #4a6fa5;
    --secondary-color: #6b8cbc;
    --accent-color: #ff6b6b;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    background-color: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.game-container {
    display: flex;
    flex-direction: column;
    padding: 30px;
}

@media (min-width: 768px) {
    .game-container {
        flex-direction: row;
    }
}

.game-info {
    flex: 1;
    padding: 20px;
    background-color: var(--light-color);
    border-radius: 10px;
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .game-info {
        margin-bottom: 0;
        margin-right: 20px;
    }
}

.game-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    color: var(--dark-color);
    min-height: 40px;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 300px;
}

.cell {
    aspect-ratio: 1;
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.cell:hover {
    background-color: #f5f7fa;
    transform: translateY(-2px);
}

.cell.x {
    color: var(--accent-color);
}

.cell.o {
    color: var(--primary-color);
}

.cell.winning {
    background-color: var(--success-color);
    color: white;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--light-color);
    color: var(--dark-color);
}

.btn-secondary:hover {
    background-color: #dfe6e9;
    transform: translateY(-2px);
}

.btn-accent {
    background-color: var(--accent-color);
    color: white;
}

.btn-accent:hover {
    background-color: #ff8e8e;
    transform: translateY(-2px);
}

.stats {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding: 15px;
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--dark-color);
    opacity: 0.7;
}

.difficulty-selector {
    margin: 20px 0;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.difficulty-btn {
    flex: 1;
    padding: 10px;
    background-color: var(--light-color);
    border: 2px solid transparent;
}

.difficulty-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.game-history {
    margin-top: 20px;
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
}

.history-item:last-child {
    border-bottom: none;
}

.win {
    color: var(--success-color);
}

.loss {
    color: var(--accent-color);
}

.draw {
    color: var(--warning-color);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--shadow);
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

.modal p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background-color: var(--accent-color);
    opacity: 0;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

.ai-thinking {
    opacity: 0.7;
    pointer-events: none;
}