/* ====== 2048 GAME ====== */
.game2048-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 24px;
    width: 100%;
    box-sizing: border-box;
    touch-action: none;
}

.game2048-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 400px;
    gap: 16px;
    flex-wrap: wrap;
}

.game2048-score-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(6, 182, 212, 0.05));
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 12px;
    min-width: 100px;
}

.game2048-score-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--secondary);
    font-weight: 600;
}

.game2048-score-value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--accent-cyan);
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.5);
}

.game2048-best-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(74, 222, 128, 0.05));
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: 12px;
    min-width: 100px;
}

.game2048-best-value {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-display);
    color: var(--accent-green);
    text-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
}

.game2048-milestone {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(139, 92, 246, 0.05));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    color: #a78bfa;
}

.game2048-milestone-icon {
    font-size: 16px;
}

.game2048-board-wrapper {
    position: relative;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.game2048-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 12px;
    background: rgba(20, 20, 24, 0.8);
    border-radius: 16px;
    border: 2px solid var(--border-subtle);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.game2048-cell {
    width: 90px;
    height: 90px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.game2048-cell-empty {
    background: rgba(255, 255, 255, 0.03);
    border: 2px dashed rgba(255, 255, 255, 0.08);
}

/* Tile colors by value */
.game2048-cell-2 {
    background: linear-gradient(135deg, #e8e4e0, #d6d2ce);
    color: #776e65;
    font-size: 32px;
}

.game2048-cell-4 {
    background: linear-gradient(135deg, #e8e0c8, #d6cebc);
    color: #776e65;
    font-size: 32px;
}

.game2048-cell-8 {
    background: linear-gradient(135deg, #f2b179, #e69c5e);
    color: #fff;
    font-size: 32px;
}

.game2048-cell-16 {
    background: linear-gradient(135deg, #f59563, #e57c47);
    color: #fff;
    font-size: 30px;
}

.game2048-cell-32 {
    background: linear-gradient(135deg, #f67c5f, #e45d41);
    color: #fff;
    font-size: 30px;
}

.game2048-cell-64 {
    background: linear-gradient(135deg, #f65e3b, #d84315);
    color: #fff;
    font-size: 30px;
    box-shadow: 0 0 30px rgba(246, 94, 59, 0.4);
}

.game2048-cell-128 {
    background: linear-gradient(135deg, #edcf72, #d4b44a);
    color: #fff;
    font-size: 26px;
    box-shadow: 0 0 30px rgba(237, 207, 114, 0.4);
}

.game2048-cell-256 {
    background: linear-gradient(135deg, #edcc61, #d4b33a);
    color: #fff;
    font-size: 26px;
    box-shadow: 0 0 35px rgba(237, 204, 97, 0.5);
}

.game2048-cell-512 {
    background: linear-gradient(135deg, #edc850, #d4ad28);
    color: #fff;
    font-size: 26px;
    box-shadow: 0 0 40px rgba(237, 200, 80, 0.6);
}

.game2048-cell-1024 {
    background: linear-gradient(135deg, #edc53f, #d4a817);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 0 45px rgba(237, 197, 63, 0.7);
}

.game2048-cell-2048 {
    background: linear-gradient(135deg, #edc22e, #d4a400);
    color: #fff;
    font-size: 22px;
    box-shadow: 0 0 50px rgba(237, 194, 46, 0.8);
    animation: tile2048Glow 1.5s ease-in-out infinite;
}

.game2048-cell-super {
    background: linear-gradient(135deg, #3c3a32, #2d2b24);
    color: #fff;
    font-size: 18px;
    box-shadow: 0 0 50px rgba(6, 182, 212, 0.6);
}

@keyframes tile2048Glow {

    0%,
    100% {
        box-shadow: 0 0 50px rgba(237, 194, 46, 0.8);
    }

    50% {
        box-shadow: 0 0 70px rgba(237, 194, 46, 1);
    }
}

/* New tile animation */
.game2048-cell-new {
    animation: tileAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tileAppear {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    50% {
        transform: scale(1.1);
    }

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

/* Merge animation */
.game2048-cell-merged {
    animation: tileMerge 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

    50% {
        transform: scale(1.15);
    }

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

.game2048-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.game2048-hint {
    font-size: 13px;
    color: var(--secondary);
    text-align: center;
    max-width: 300px;
}

.game2048-pax-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 24px;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.95), rgba(34, 197, 94, 0.95));
    border-radius: 16px;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 10px 40px rgba(74, 222, 128, 0.5);
    z-index: 100;
    animation: paxPopup 1.5s ease-out forwards;
    pointer-events: none;
}

@keyframes paxPopup {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    15% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }

    30% {
        transform: translate(-50%, -50%) scale(1);
    }

    70% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -100%) scale(0.8);
        opacity: 0;
    }
}

.game2048-game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 12, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-radius: 16px;
    backdrop-filter: blur(4px);
}

.game2048-game-over h3 {
    font-size: 32px;
    font-weight: 800;
    color: #ef4444;
    font-family: var(--font-display);
}

.game2048-game-over .final-score {
    font-size: 20px;
    color: var(--secondary);
}

.game2048-game-over .pax-summary {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-cyan);
}

/* Touch controls visual indicator */
.game2048-swipe-hint {
    display: none;
    font-size: 12px;
    color: var(--secondary);
    text-align: center;
    margin-top: 8px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 500px) {
    .game2048-container {
        padding: 16px 8px;
        gap: 16px;
    }

    .game2048-header {
        justify-content: center;
        gap: 12px;
    }

    .game2048-score-box,
    .game2048-best-box {
        padding: 10px 16px;
        min-width: 80px;
    }

    .game2048-score-value,
    .game2048-best-value {
        font-size: 22px;
    }

    .game2048-board {
        gap: 8px;
        padding: 8px;
        border-radius: 12px;
    }

    .game2048-cell {
        width: 70px;
        height: 70px;
        border-radius: 8px;
    }

    .game2048-cell-2,
    .game2048-cell-4,
    .game2048-cell-8 {
        font-size: 26px;
    }

    .game2048-cell-16,
    .game2048-cell-32,
    .game2048-cell-64 {
        font-size: 24px;
    }

    .game2048-cell-128,
    .game2048-cell-256,
    .game2048-cell-512 {
        font-size: 20px;
    }

    .game2048-cell-1024,
    .game2048-cell-2048,
    .game2048-cell-super {
        font-size: 16px;
    }

    .game2048-swipe-hint {
        display: block;
    }
}

@media (max-width: 380px) {
    .game2048-board {
        gap: 6px;
        padding: 6px;
    }

    .game2048-cell {
        width: 60px;
        height: 60px;
        border-radius: 6px;
    }

    .game2048-cell-2,
    .game2048-cell-4,
    .game2048-cell-8 {
        font-size: 22px;
    }

    .game2048-cell-16,
    .game2048-cell-32,
    .game2048-cell-64 {
        font-size: 20px;
    }

    .game2048-cell-128,
    .game2048-cell-256,
    .game2048-cell-512 {
        font-size: 18px;
    }

    .game2048-cell-1024,
    .game2048-cell-2048,
    .game2048-cell-super {
        font-size: 14px;
    }
}

@media (max-width: 320px) {
    .game2048-board {
        gap: 4px;
        padding: 4px;
    }

    .game2048-cell {
        width: 52px;
        height: 52px;
        border-radius: 5px;
    }

    .game2048-cell-2,
    .game2048-cell-4,
    .game2048-cell-8,
    .game2048-cell-16,
    .game2048-cell-32,
    .game2048-cell-64 {
        font-size: 18px;
    }

    .game2048-cell-128,
    .game2048-cell-256,
    .game2048-cell-512,
    .game2048-cell-1024,
    .game2048-cell-2048,
    .game2048-cell-super {
        font-size: 12px;
    }
}