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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #FF8A65 0%, #FF7043 100%);
    min-height: 100vh;
    color: #fff;
    overflow-x: hidden;
}

/* 扁平化设计 - 主容器 */
.game-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 扁平化设计 - 游戏头部 */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 20px;
    letter-spacing: 3px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.game-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.stat {
    text-align: center;
    flex: 1;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* 游戏描述 */
.game-description {
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.game-description p {
    font-size: 1rem;
    opacity: 0.9;
    line-height: 1.5;
}

/* 扁平化设计 - 游戏控制 */
.game-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    justify-content: center;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    background: #ED6C02;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(237, 108, 2, 0.3);
}

.btn:hover {
    background: #E65100;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(237, 108, 2, 0.4);
}

.btn:disabled {
    background: #666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.15);
}

.start-btn {
    background: #4CAF50;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.start-btn:hover {
    background: #45a049;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

/* 扁平化设计 - 游戏板 */
.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.game-board {
    position: relative;
    width: 400px;
    height: 400px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.grid-container {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grid-row {
    display: flex;
    gap: 10px;
    flex: 1;
}

.grid-cell {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tile-container {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
}

/* 数字瓦片 */
.tile {
    position: absolute;
    width: 85px;
    height: 85px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 2rem;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 不同数字的颜色 */
.tile-2 { background: #EEE4DA; color: #776E65; }
.tile-4 { background: #EDE0C8; color: #776E65; }
.tile-8 { background: #F2B179; color: #F9F6F2; }
.tile-16 { background: #F59563; color: #F9F6F2; }
.tile-32 { background: #F67C5F; color: #F9F6F2; }
.tile-64 { background: #F65E3B; color: #F9F6F2; }
.tile-128 { background: #EDCF72; color: #F9F6F2; font-size: 1.75rem; }
.tile-256 { background: #EDCC61; color: #F9F6F2; font-size: 1.75rem; }
.tile-512 { background: #EDC850; color: #F9F6F2; font-size: 1.75rem; }
.tile-1024 { background: #EDC53F; color: #F9F6F2; font-size: 1.5rem; }
.tile-2048 { background: #EDC22E; color: #F9F6F2; font-size: 1.5rem; box-shadow: 0 0 20px rgba(237, 194, 46, 0.5); }

/* 超级数字 */
.tile-4096 { background: #FF6B6B; color: #F9F6F2; font-size: 1.25rem; }
.tile-8192 { background: #4ECDC4; color: #F9F6F2; font-size: 1.25rem; }

/* 瓦片动画 */
.tile-new {
    animation: tileAppear 0.2s ease;
}

.tile-merged {
    animation: tileMerge 0.15s ease;
}

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

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

/* 扁平化设计 - 说明区域 */
.instructions {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.instruction-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
}

.key-hint {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 2px;
}

/* 扁平化设计 - 弹窗 */
.game-over-popup, .victory-popup, .help-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over-popup.show, .victory-popup.show, .help-popup.show {
    display: flex;
}

.popup-content {
    background: linear-gradient(135deg, #FF8A65 0%, #FF7043 100%);
    border-radius: 25px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-height: 80vh;
    overflow-y: auto;
}

.popup-content h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    font-weight: 300;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.final-score {
    margin-bottom: 30px;
    padding: 25px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(20px);
}

.score-display, .move-display, .best-tile-display {
    margin-bottom: 15px;
    font-size: 1.125rem;
    font-weight: 500;
}

.score-display:last-child, .move-display:last-child, .best-tile-display:last-child {
    margin-bottom: 0;
}

.final-score span {
    font-weight: 700;
    color: #FFD700;
    text-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.victory-message {
    margin-bottom: 25px;
}

.victory-message p {
    font-size: 1.125rem;
    margin-bottom: 20px;
    opacity: 0.9;
}

.popup-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 帮助弹窗特殊样式 */
.help-content {
    text-align: left;
    max-width: 500px;
}

.help-content h2 {
    text-align: center;
}

.help-section {
    margin-bottom: 25px;
}

.help-section h3 {
    color: #FFD700;
    margin-bottom: 12px;
    font-size: 1.125rem;
    font-weight: 600;
}

.help-section p {
    margin-bottom: 12px;
    opacity: 0.9;
    line-height: 1.5;
}

.help-section ul {
    margin-left: 20px;
    opacity: 0.9;
}

.help-section li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .game-container {
        padding: 15px;
    }
    
    .game-header h1 {
        font-size: 2rem;
    }
    
    .game-board {
        width: 320px;
        height: 320px;
    }
    
    .tile {
        width: 68px;
        height: 68px;
        font-size: 1.5rem;
    }
    
    .tile-128, .tile-256, .tile-512 {
        font-size: 1.25rem;
    }
    
    .tile-1024, .tile-2048 {
        font-size: 1rem;
    }
    
    .tile-4096, .tile-8192 {
        font-size: 0.875rem;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        min-width: 200px;
    }
    
    .instructions {
        flex-direction: column;
        gap: 15px;
    }
    
    .popup-content {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .popup-actions {
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    .game-board {
        width: 280px;
        height: 280px;
    }
    
    .tile {
        width: 58px;
        height: 58px;
        font-size: 1.25rem;
    }
    
    .tile-128, .tile-256, .tile-512 {
        font-size: 1rem;
    }
    
    .tile-1024, .tile-2048 {
        font-size: 0.875rem;
    }
    
    .tile-4096, .tile-8192 {
        font-size: 0.75rem;
    }
}