/* Цветовая палитра */
:root {
    --bg-primary: #FAF7F2;
    --bg-secondary: #FFF9F5;
    --text-primary: #4A4A4A;
    --text-secondary: #7A7A7A;
    --accent: #B76E79;
    --accent-light: #D4A5AC;
    --gold: #D4AF37;
    --gold-light: #F5E6B8;
    --shadow: rgba(183, 110, 121, 0.15);
    --shadow-strong: rgba(183, 110, 121, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 24px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Заголовок */
header {
    text-align: center;
    margin-bottom: 24px;
}

h1 {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Информация об игроках */
.game-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow);
}

.player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.player .symbol {
    font-size: 24px;
    font-weight: 700;
}

.player.you .symbol {
    color: var(--accent);
}

.player.computer .symbol {
    color: var(--text-secondary);
}

.player .label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vs {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Игровое поле */
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 8px 32px var(--shadow);
    margin-bottom: 24px;
}

.cell {
    width: 90px;
    height: 90px;
    background: var(--bg-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.cell:hover:not(.taken) {
    background: var(--bg-secondary);
    transform: scale(1.02);
}

.cell:active:not(.taken) {
    transform: scale(0.98);
}

.cell.taken {
    cursor: not-allowed;
}

.cell.x {
    color: var(--accent);
    animation: popIn 0.3s ease;
}

.cell.o {
    color: var(--text-secondary);
    animation: popIn 0.3s ease;
}

.cell.winner {
    background: var(--gold-light);
    box-shadow: 0 0 20px var(--gold);
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Кнопка рестарта */
.restart-btn {
    padding: 14px 32px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    background: white;
    border: 2px solid var(--accent-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.restart-btn:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.restart-btn:active {
    transform: scale(0.98);
}

/* Модальное окно */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    padding: 32px 24px;
    border-radius: 24px;
    text-align: center;
    max-width: 320px;
    width: 100%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: bounce 0.6s ease;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.modal-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.promo-code {
    font-family: 'Nunito', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--gold);
    background: var(--gold-light);
    padding: 12px 24px;
    border-radius: 12px;
    margin-bottom: 24px;
    letter-spacing: 4px;
    display: none;
}

.promo-code.visible {
    display: block;
    animation: popIn 0.4s ease;
}

.modal-btn {
    width: 100%;
    padding: 16px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow-strong);
}

.modal-btn:active {
    transform: translateY(0);
}

/* Адаптация под маленькие экраны */
@media (max-width: 360px) {
    .cell {
        width: 75px;
        height: 75px;
        font-size: 40px;
    }

    .board {
        gap: 10px;
        padding: 16px;
    }

    h1 {
        font-size: 24px;
    }
}