/**
 * 2048数字游戏样式表
 * 采用现代化设计和glassmorphism效果
 */

/* 游戏容器样式 */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 游戏头部 - glassmorphism设计 */
.game-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 15px 25px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /*box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);*/
    position: relative;
    overflow: hidden;
    width: 100%;
}

/* 头部内容 */
.header-content h1 {
    margin: 0 0 5px 0;
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
    position: relative;
    text-align: center;
}

/* 添加闪光动画效果 */
.header-content h1::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

.game-subtitle {
    margin: 0;
    color: rgba(0, 0, 0, 0.6);
    font-size: 0.95rem;
    font-weight: 400;
    text-align: center;
}

/* 分数容器 */
.score-container {
    display: flex;
    gap: 15px;
    margin: 10px 0;
    justify-content: center;
}

.score-box {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 10px 15px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    min-width: 80px;
    transition: all 0.3s ease;
}

.score-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.best-score {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 193, 7, 0.2));
}

.score-label {
    font-size: 0.9rem;
    color: rgba(0, 0, 0, 0.6);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 游戏控制按钮 */
.game-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.button:active {
    transform: translateY(0);
}

.button.secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.button.secondary:hover {
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.button.third {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.button.third:hover {
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.button:disabled:hover {
    transform: none;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* 游戏板容器 */
.game-board-container {
    position: relative;
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

/* 游戏板 */
.game-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 8px;
    padding: 15px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    width: 500px;
    height: 500px;
}

/* 数字方块 */
.tile {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    border-radius: 12px;
    transition: all 0.15s ease-in-out;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    aspect-ratio: 1;
    position: relative;
}

.tile-empty {
    background: rgba(238, 228, 218, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 数字方块颜色 */
.tile-2 {
    background: linear-gradient(135deg, #eee4da, #ede0c8);
    color: #776e65;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tile-4 {
    background: linear-gradient(135deg, #ede0c8, #f2b179);
    color: #776e65;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tile-8 {
    background: linear-gradient(135deg, #f2b179, #f59563);
    color: #f9f6f2;
    box-shadow: 0 2px 8px rgba(245, 149, 99, 0.3);
}

.tile-16 {
    background: linear-gradient(135deg, #f59563, #f67c5f);
    color: #f9f6f2;
    box-shadow: 0 2px 8px rgba(246, 124, 95, 0.3);
}

.tile-32 {
    background: linear-gradient(135deg, #f67c5f, #f65e3b);
    color: #f9f6f2;
    box-shadow: 0 2px 8px rgba(246, 94, 59, 0.3);
}

.tile-64 {
    background: linear-gradient(135deg, #f65e3b, #edcf72);
    color: #f9f6f2;
    box-shadow: 0 2px 8px rgba(237, 207, 114, 0.3);
}

.tile-128 {
    background: linear-gradient(135deg, #edcf72, #fdbf5e);
    color: #f9f6f2;
    font-size: 1.8rem;
    box-shadow: 0 2px 8px rgba(253, 191, 94, 0.4);
}

.tile-256 {
    background: linear-gradient(135deg, #fdbf5e, #fdb63f);
    color: #f9f6f2;
    font-size: 1.8rem;
    box-shadow: 0 2px 8px rgba(253, 182, 63, 0.4);
}

.tile-512 {
    background: linear-gradient(135deg, #fdb63f, #f29220);
    color: #f9f6f2;
    font-size: 1.8rem;
    box-shadow: 0 2px 8px rgba(242, 146, 32, 0.4);
}

.tile-1024 {
    background: linear-gradient(135deg, #f29220, #ff6b6b);
    color: #f9f6f2;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

.tile-2048 {
    background: linear-gradient(135deg, #ff6b6b, #4ecdc4);
    color: #f9f6f2;
    font-size: 1.5rem;
    box-shadow: 0 2px 8px rgba(78, 205, 196, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 2px 8px rgba(78, 205, 196, 0.5);
    }
    to {
        box-shadow: 0 4px 16px rgba(78, 205, 196, 0.8);
    }
}

/* 更大数字的方块 */
.tile-4096, .tile-8192 {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #f9f6f2;
    font-size: 1.3rem;
    box-shadow: 0 2px 8px rgba(118, 75, 162, 0.5);
}

/* 游戏结束覆盖层 */
.game-over-overlay, .win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 100;
}

.game-over-content, .win-content {
    text-align: center;
    padding: 30px;
}

.game-over-content h2, .win-content h2 {
    font-size: 2.5rem;
    margin: 0 0 20px 0;
    color: #333;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.final-score {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 20px 0;
    font-size: 1.2rem;
    color: #666;
}

.final-score span:last-child {
    font-size: 2rem;
    font-weight: 700;
    color: #333;
}

.new-record {
    background: linear-gradient(135deg, #ffd700, #ff8c00);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 15px 0;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

.game-over-buttons, .win-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* 游戏说明区域 */
.game-instructions {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 15px 25px;
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    /*box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);*/
    width: 100%;
}

.game-instructions h3 {
    margin: 0 0 12px 0;
    font-size: 1.3rem;
    color: #333;
    text-align: center;
}

.instructions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 15px;
}

.instruction-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.instruction-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.instruction-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.instruction-text strong {
    color: #333;
    font-size: 1rem;
}

.instruction-text {
    color: #666;
    line-height: 1.2;
    font-size: 0.85rem;
}

.game-tips h4 {
    margin: 8px 0;
    font-size: 1.1rem;
    color: #333;
    text-align: center;
}

.game-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 8px;
}

.game-tips ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.game-tips li {
    padding: 4px 0;
    color: #666;
    position: relative;
    padding-left: 18px;
    font-size: 0.85rem;
    line-height: 1.3;
}

.game-tips li::before {
    content: '💡';
    position: absolute;
    left: 0;
    top: 4px;
}

/* 提示气泡样式 */
.hint-bubble {
    animation: hintFadeIn 0.3s ease-out;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .game-container {
        max-width: 98%;
        padding: 15px;
    }
    
    .instructions-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .game-tips ul {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .game-container {
        padding: 15px;
        max-width: 100%;
    }
    
    .game-header {
        padding: 15px;
        max-width: 100%;
    }
    
    .header-content h1 {
        font-size: 1.8rem;
    }
    
    .game-subtitle {
        font-size: 0.9rem;
    }
    
    .score-container {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .score-box {
        min-width: 70px;
        padding: 8px 12px;
    }
    
    .score-value {
        font-size: 1.3rem;
    }
    
    .game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .button {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .game-board {
        width: 90vw;
        height: 90vw;
        max-width: 400px;
        max-height: 400px;
        padding: 10px;
        gap: 6px;
    }
    
    .tile {
        font-size: 1.3rem;
    }
    
    .tile-128, .tile-256, .tile-512 {
        font-size: 1.1rem;
    }
    
    .tile-1024, .tile-2048 {
        font-size: 0.95rem;
    }
    
    .instructions-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .instruction-item {
        flex-direction: column;
        text-align: center;
        gap: 6px;
        padding: 8px;
    }
    
    .game-instructions {
        max-width: 100%;
        padding: 12px 20px;
    }
    
    .game-tips ul {
        grid-template-columns: 1fr;
    }
    
    .game-over-content, .win-content {
        padding: 15px;
    }
    
    .game-over-content h2, .win-content h2 {
        font-size: 1.8rem;
    }
    
    .game-over-buttons, .win-buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.6rem;
    }
    
    .game-board {
        width: 95vw;
        height: 95vw;
        max-width: 350px;
        max-height: 350px;
        gap: 4px;
        padding: 8px;
    }
    
    .tile {
        font-size: 1.1rem;
    }
    
    .tile-128, .tile-256, .tile-512 {
        font-size: 0.95rem;
    }
    
    .tile-1024, .tile-2048 {
        font-size: 0.8rem;
    }
    
    .score-value {
        font-size: 1.2rem;
    }
    
    .instruction-text {
        font-size: 0.8rem;
    }
    
    .game-tips li {
        font-size: 0.8rem;
    }
    
    .instructions-grid {
        grid-template-columns: 1fr;
    }
    
    .game-instructions {
        padding: 10px 15px;
    }
}