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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a1628 0%, #0d2847 50%, #0a3d62 100%);
    min-height: 100vh;
    color: #fff;
}

/* ===== Основной контейнер ===== */
.main-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
    padding: 20px;
    min-height: 100vh;
}

.container {
    text-align: center;
    padding: 20px;
    max-width: 500px;
    width: 100%;
}

/* ===== Информация об игроке ===== */
.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.player-info .header-logo {
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
}

.game-title {
    font-size: 3rem;
    font-weight: bold;
    background: linear-gradient(90deg, #218ad5, #1dbdd6, #5ee2f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-shadow: 0 0 30px rgba(33, 138, 213, 0.5);
}

.scores {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.score-box {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 15px 30px;
    min-width: 120px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.score-label {
    display: block;
    font-size: 0.9rem;
    color: #aaa;
    margin-bottom: 5px;
}

.score-box span:last-child {
    font-size: 1.8rem;
    font-weight: bold;
    color: #1dbdd6;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-info p {
    font-size: 0.95rem;
    color: #ccc;
}

#new-game-btn {
    background: linear-gradient(135deg, #218ad5, #1dbdd6);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(33, 138, 213, 0.4);
}

#new-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(33, 138, 213, 0.6);
}

#new-game-btn:active {
    transform: translateY(0);
}

.game-container {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 15px;
    border: 2px solid rgba(33, 138, 213, 0.2);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 10px;
}

.cell {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.15s ease;
}

.cell[data-value="2"] { background: linear-gradient(135deg, #218ad5, #1dbdd6); }
.cell[data-value="4"] { background: linear-gradient(135deg, #1dbdd6, #5ee2f0); }
.cell[data-value="8"] { background: linear-gradient(135deg, #1966a8, #218ad5); }
.cell[data-value="16"] { background: linear-gradient(135deg, #14b8a6, #1dbdd6); }
.cell[data-value="32"] { background: linear-gradient(135deg, #0ea5e9, #38bdf8); }
.cell[data-value="64"] { background: linear-gradient(135deg, #0284c7, #0ea5e9); }
.cell[data-value="128"] { background: linear-gradient(135deg, #22d3ee, #5ee2f0); }
.cell[data-value="256"] { background: linear-gradient(135deg, #06b6d4, #22d3ee); }
.cell[data-value="512"] { background: linear-gradient(135deg, #0891b2, #14b8a6); }
.cell[data-value="1024"] { background: linear-gradient(135deg, #0e7490, #155e75); font-size: 1.7rem; }
.cell[data-value="2048"] { background: linear-gradient(135deg, #218ad5, #1dbdd6); font-size: 1.7rem; box-shadow: 0 0 20px rgba(33, 138, 213, 0.8); }
.cell[data-value="4096"] { background: linear-gradient(135deg, #0f172a, #1e3a5f); font-size: 1.5rem; }
.cell[data-value="8192"] { background: linear-gradient(135deg, #fbbf24, #d97706); font-size: 1.5rem; }

.cell.empty {
    background: rgba(255, 255, 255, 0.05);
}

.cell.new {
    animation: pop 0.2s ease;
}

.cell.merged {
    animation: merge 0.2s ease;
}

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

@keyframes merge {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.game-over.hidden {
    display: none;
}

.game-over h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #218ad5;
}

.game-over p {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: #ccc;
}

.game-over button {
    background: linear-gradient(135deg, #218ad5, #1dbdd6);
    color: #fff;
    border: none;
    padding: 15px 35px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(33, 138, 213, 0.4);
}

.game-over button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(33, 138, 213, 0.6);
}

.controls-info {
    margin-top: 25px;
    color: #888;
    font-size: 0.85rem;
}

.controls-info p {
    margin: 5px 0;
}

/* Адаптивность для мобильных */
@media (max-width: 450px) {
    .game-title {
        font-size: 2.2rem;
    }

    .cell {
        width: 65px;
        height: 65px;
        font-size: 1.5rem;
    }

    .score-box {
        padding: 10px 20px;
        min-width: 100px;
    }

    .score-box span:last-child {
        font-size: 1.4rem;
    }

    .game-info {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 350px) {
    .cell {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .game-title {
        font-size: 1.8rem;
    }
}

/* Адаптивность */
@media (max-width: 900px) {
    .main-wrapper {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 450px) {
    .game-title {
        font-size: 2.2rem;
    }

    .cell {
        width: 65px;
        height: 65px;
        font-size: 1.5rem;
    }

    .score-box {
        padding: 10px 20px;
        min-width: 100px;
    }

    .score-box span:last-child {
        font-size: 1.4rem;
    }

    .game-info {
        flex-direction: column;
        text-align: center;
    }

    .header-logo {
        width: 40px;
        height: 40px;
        border-radius: 10px;
    }
}

@media (max-width: 350px) {
    .cell {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }

    .game-title {
        font-size: 1.8rem;
    }

    .login-container {
        padding: 25px;
    }
}
