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

body {
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
    overscroll-behavior: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-wrapper {
    max-width: 500px;
    width: 100%;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.title-section {
    text-align: center;
    margin-bottom: 15px;
}

.game-title {
    font-size: 48px;
    font-weight: bold;
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.subtitle {
    color: #7c3aed;
    font-size: 16px;
}

.score-section {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.score-box {
    background: #7c3aed;
    color: white;
    border-radius: 10px;
    padding: 10px 20px;
    text-align: center;
    min-width: 100px;
}

.score-box .label {
    font-size: 12px;
    font-weight: bold;
    opacity: 0.8;
}

.score-box .value {
    font-size: 28px;
    font-weight: bold;
}

.controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.control-btn {
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.4);
}

.control-btn:hover {
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.instructions {
    margin-top: 10px;
    color: #7c3aed;
    font-size: 14px;
}

.game-container {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    background: #bbada0;
    border-radius: 10px;
    padding: 10px;
    position: relative;
}

.cell {
    aspect-ratio: 1;
    background: rgba(238, 228, 218, 0.35);
    border-radius: 10px;
}

.bubble {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: white;
    border-radius: 50%;
    transition: all 0.15s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.bubble-2 { background: linear-gradient(135deg, #ffeaa7, #fdcb6e); color: #333; }
.bubble-4 { background: linear-gradient(135deg, #fab1a0, #ff7675); }
.bubble-8 { background: linear-gradient(135deg, #fd79a8, #e84393); }
.bubble-16 { background: linear-gradient(135deg, #a29bfe, #6c5ce7); }
.bubble-32 { background: linear-gradient(135deg, #74b9ff, #0984e3); }
.bubble-64 { background: linear-gradient(135deg, #81ecec, #00b894); }
.bubble-128 { background: linear-gradient(135deg, #ffeaa7, #fdcb6e); font-size: 28px; }
.bubble-256 { background: linear-gradient(135deg, #fab1a0, #ff7675); font-size: 28px; }
.bubble-512 { background: linear-gradient(135deg, #fd79a8, #e84393); font-size: 28px; }
.bubble-1024 { background: linear-gradient(135deg, #a29bfe, #6c5ce7); font-size: 24px; }
.bubble-2048 { background: linear-gradient(135deg, #ffd700, #ff8c00); font-size: 24px; }

.bubble-new {
    animation: appear 0.2s ease;
}

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

.bubble-merge {
    animation: merge 0.2s ease;
}

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

.game-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    z-index: 100;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.message-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
}

#messageTitle {
    font-size: 36px;
    color: #7c3aed;
    margin-bottom: 15px;
}

#messageText {
    font-size: 20px;
    color: #333;
    margin-bottom: 25px;
}

.message-btn {
    background: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin: 5px;
    transition: transform 0.2s;
}

.message-btn:hover {
    transform: scale(1.05);
}

.message-btn.keep-playing {
    background: linear-gradient(45deg, #667eea 0%, #764ba2 100%);
}

.hidden {
    display: none !important;
}

.how-to-play {
    margin-top: 20px;
    text-align: center;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
}

/* Mobile responsive */
@media (max-width: 600px) {
    .game-title {
        font-size: 36px;
    }

    .bubble {
        font-size: 24px;
    }

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

    .bubble-1024, .bubble-2048 {
        font-size: 18px;
    }
}
