:root {
    --primary-color: #4a6fa5;
    --secondary-color: #166088;
    --accent-color: #4fc3f7;
    --background-color: #f5f7fa;
    --text-color: #333;
    --cell-size: 100px;
    --win-highlight: #fff9c4;
    --x-color: #e53935;
    --o-color: #43a047;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

h1 {
    color: var(--secondary-color);
    margin-bottom: 20px;
    text-align: center;
    font-size: 2.5rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 500px;
    width: 100%;
}

.mode-selection {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.mode-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background-color: rgb(33, 243, 79);
    transform: translateY(-2px);
}

.mode-btn.active {
    background-color: rgb(33, 243, 79);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.status {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
    height: 30px;
    text-align: center;
    min-height: 2.5rem;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 100%;
    max-width: calc(var(--cell-size) * 3 + 20px);
    margin: 10px 0;
}

.cell {
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    height: var(--cell-size);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: bold;
    color: var(--secondary-color);
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1/1;
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background-color: #e3f2fd;
    transform: scale(1.03);
}

.cell.x {
    color: var(--x-color);
}

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

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

.cell.win {
    animation: pulse 1.5s infinite;
    background-color: var(--win-highlight);
    border-color: var(--secondary-color);
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
}

button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    transform: none;
}

.settings {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.toggle-sound {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(26px);
}

.score-display {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    font-size: 1.1rem;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-value {
    font-weight: bold;
    font-size: 1.3rem;
}

@media (max-width: 500px) {
    :root {
        --cell-size: 80px;
    }

    h1 {
        font-size: 2rem;
    }

    .status {
        font-size: 1.2rem;
    }

    .cell {
        font-size: 2.5rem;
    }

    .mode-selection {
        flex-direction: column;
        width: 100%;
    }

    .mode-btn {
        width: 100%;
    }
}

@media (max-width: 350px) {
    :root {
        --cell-size: 70px;
    }
}