* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

.container {
    text-align: center;
    padding: 20px;
}

h1 {
    font-size: 3rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 20px;
}

.status {
    font-size: 1.5rem;
    color: #4ecdc4;
    font-weight: 300;
}

.timer {
    font-size: 1.5rem;
    color: #ff6b6b;
    font-weight: 300;
}

.mode-btn {
    padding: 8px 20px;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.game-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.cell {
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.cell.suggestion-x::before,
.cell.suggestion-x::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 4px;
    background: rgba(255, 107, 107, 0.3);
    border-radius: 2px;
}

.cell.suggestion-x::before {
    transform: rotate(45deg);
}

.cell.suggestion-x::after {
    transform: rotate(-45deg);
}

.cell.suggestion-o::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border: 4px solid rgba(78, 205, 196, 0.3);
    border-radius: 50%;
}

.suggestion-score {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 0.8rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 10px;
    color: #fff;
    font-family: monospace;
}

.cell.x::before,
.cell.x::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 4px;
    background: #ff6b6b;
    border-radius: 2px;
}

.cell.x::before {
    transform: rotate(45deg);
}

.cell.x::after {
    transform: rotate(-45deg);
}

.cell.o::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    border: 4px solid #4ecdc4;
    border-radius: 50%;
    animation: appear 0.3s ease-in-out;
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 20px 0;
    font-size: 1.2rem;
}

.score {
    padding: 10px 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
}

.player-x {
    color: #ff6b6b;
}

.player-o {
    color: #4ecdc4;
}

.restart-btn {
    padding: 12px 30px;
    font-size: 1.2rem;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    border: none;
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.restart-btn:hover {
    transform: translateY(-2px);
}

.game-wrapper {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 20px 0;
}

.engine-panel {
    display: none;
    background: rgba(44, 49, 60, 0.95);
    padding: 25px;
    border-radius: 16px;
    width: 100%;
    margin-top: 25px;
}

.engine-panel.visible {
    display: block;
}

.engine-title {
    font-size: 1.5rem;
    color: #4ecdc4;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.engine-controls {
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

#engineDepth {
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    margin: 10px 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(78, 205, 196, 0.3);
    color: #fff;
}

.best-moves {
    margin-top: 20px;
}

.best-moves-title {
    font-size: 1.3rem;
    color: #ff6b6b;
    margin-bottom: 15px;
}

.best-moves li {
    padding: 15px;
    margin: 12px 0;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.1rem;
}

.best-moves .move-score {
    font-weight: bold;
    color: #4ecdc4;
    background: rgba(78, 205, 196, 0.1);
    padding: 5px 10px;
    border-radius: 8px;
}

.evaluation-section {
    margin-top: 20px;
}

.evaluation-title {
    font-size: 1.2rem;
    color: #ff6b6b;
    margin-bottom: 15px;
}

.evaluation-bar {
    height: 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
    position: relative;
    overflow: hidden;
}

.evaluation-fill {
    position: absolute;
    height: 100%;
    left: 0;
    top: 0;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
    transition: width 0.3s ease;
}

.evaluation-text {
    font-size: 1.1rem;
    color: #fff;
    margin-top: 10px;
    text-align: center;
}

/* Медиа-запрос для мобильных устройств */
@media screen and (max-width: 768px) {
    body {
        padding: 20px 10px;
        min-height: 100vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .container {
        width: 100%;
        max-width: none;
        padding: 15px;
        margin: 0;
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    h1 {
        font-size: 2rem;
        margin-bottom: 20px;
        background: linear-gradient(90deg, #ff6b6b, #4ecdc4);
        background-clip: text;
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        text-align: center;
    }

    .game-controls {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 25px;
        width: 100%;
    }

    .mode-switch {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .mode-btn {
        width: 100%;
        padding: 12px;
        font-size: 1.1rem;
        border-radius: 12px;
    }

    .board {
        width: 100%;
        max-width: 320px;
        aspect-ratio: 1;
        margin: 15px auto;
        gap: 8px;
        padding: 8px;
    }

    .cell {
        font-size: 36px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .status {
        font-size: 1.3rem;
        margin: 15px 0;
        text-align: center;
    }

    .timer {
        font-size: 1.3rem;
        margin: 10px 0;
        text-align: center;
    }

    .score-board {
        flex-direction: row;
        justify-content: center;
        gap: 20px;
        margin: 20px 0;
    }

    .score {
        font-size: 1.2rem;
        padding: 10px 20px;
        border-radius: 12px;
        background: rgba(255, 255, 255, 0.1);
    }

    .engine-panel {
        position: relative;
        width: 100%;
        max-height: none;
        margin-top: 25px;
        padding: 20px;
        border-radius: 16px;
    }

    .engine-controls {
        flex-direction: column;
        gap: 15px;
    }

    #engineDepth {
        width: 100%;
        padding: 10px;
        font-size: 1.1rem;
        margin: 10px 0;
        border-radius: 8px;
    }

    .best-moves {
        margin-top: 15px;
        font-size: 1.1rem;
    }

    .best-moves li {
        padding: 8px 12px;
        margin: 8px 0;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }
}

/* Дополнительные стили для iPhone SE и других маленьких экранов */
@media screen and (max-width: 380px) {
    .board {
        max-width: 280px;
    }

    .cell {
        font-size: 32px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .mode-btn {
        padding: 10px;
        font-size: 1rem;
    }
}

@keyframes appear {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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