:root {
    --background: linear-gradient(135deg, #1a1a1a, #4a4a4a);
    --container-bg: rgba(255, 255, 255, 0.1);
    --text-color: #ffffff;
    --cell-bg: rgba(255, 255, 255, 0.1);
    --cell-hover: rgba(255, 255, 255, 0.2);
    --button-bg: #ff4757;
    --button-hover: #ff6b81;
}

[data-theme="light"] {
    --background: linear-gradient(135deg, #e0e0e0, #ffffff);
    --container-bg: rgba(0, 0, 0, 0.1);
    --text-color: #333333;
    --cell-bg: rgba(0, 0, 0, 0.1);
    --cell-hover: rgba(0, 0, 0, 0.2);
    --button-bg: #2196f3;
    --button-hover: #1976d2;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Arial', sans-serif;
    background: var(--background);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
}

#themeToggle {
    background: var(--container-bg);
    border: none;
    padding: 10px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
}

#themeToggle:hover {
    transform: scale(1.1);
}

[data-theme="light"] .sun {
    display: none;
}

[data-theme="light"] .moon {
    display: block;
}

[data-theme="dark"] .sun {
    display: block;
}

[data-theme="dark"] .moon {
    display: none;
}

.container {
    text-align: center;
    background: var(--container-bg);
    padding: 2rem;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

h1 {
    color: var(--text-color);
    margin-bottom: 2rem;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.status {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: var(--text-color);
    height: 1.5em;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 2rem;
    max-width: 400px;
    width: 100%;
}

.cell {
    background: var(--cell-bg);
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.cell:hover {
    background: var(--cell-hover);
    transform: scale(1.05);
}

.cell.x {
    color: #ff4757;
}

.cell.o {
    color: #2ed573;
}

#restartButton {
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#restartButton:hover {
    background: var(--button-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

@media screen and (max-width: 480px) {
    .container {
        padding: 1rem;
        margin: 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    .cell {
        font-size: 2rem;
    }

    #restartButton {
        padding: 10px 20px;
        font-size: 1rem;
    }
}
