/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
    background: rgba(30, 30, 46, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    font-size: 2.5rem;
    color: #4cc9f0;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(76, 201, 240, 0.5);
}

header h1 i {
    margin-right: 15px;
    color: #f72585;
}

.subtitle {
    font-size: 1.1rem;
    color: #a9a9a9;
    font-weight: 400;
}

/* 游戏头部样式 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(40, 40, 60, 0.8);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score-container, .best-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px 25px;
    text-align: center;
    min-width: 120px;
}

.score-title, .best-title {
    color: #a9a9a9;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.score, .best {
    font-size: 2.2rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.score {
    color: #4cc9f0;
}

.best {
    color: #f72585;
}

.new-game-btn {
    background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 15px rgba(247, 37, 133, 0.3);
}

.new-game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(247, 37, 133, 0.5);
    background: linear-gradient(135deg, #f72585 0%, #9d0b6e 100%);
}

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

/* 游戏说明样式 */
.game-instructions {
    background: rgba(40, 40, 60, 0.8);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-instructions h3 {
    color: #4cc9f0;
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.game-instructions ul {
    list-style: none;
    padding-left: 10px;
}

.game-instructions li {
    margin-bottom: 10px;
    padding-left: 25px;
    position: relative;
    color: #ccc;
}

.game-instructions li:before {
    content: "•";
    color: #f72585;
    position: absolute;
    left: 0;
    font-size: 1.5rem;
}

.game-instructions li strong {
    color: #fff;
    background: rgba(247, 37, 133, 0.2);
    padding: 2px 8px;
    border-radius: 5px;
}

/* 游戏棋盘样式 */
.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.game-board {
    width: 400px;
    height: 400px;
    background: rgba(60, 60, 80, 0.8);
    border-radius: 10px;
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.grid-cell {
    background: rgba(80, 80, 100, 0.6);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: #f5f5f5;
    transition: all 0.2s ease;
}

/* 方块颜色根据数值 */
.tile-2 { background: #2a9d8f; color: #fff; }
.tile-4 { background: #e9c46a; color: #333; }
.tile-8 { background: #f4a261; color: #fff; }
.tile-16 { background: #e76f51; color: #fff; }
.tile-32 { background: #e63946; color: #fff; }
.tile-64 { background: #9d4edd; color: #fff; }
.tile-128 { background: #4361ee; color: #fff; font-size: 2.2rem; }
.tile-256 { background: #3a0ca3; color: #fff; font-size: 2.2rem; }
.tile-512 { background: #7209b7; color: #fff; font-size: 2.2rem; }
.tile-1024 { background: #f72585; color: #fff; font-size: 1.9rem; }
.tile-2048 { background: #4cc9f0; color: #fff; font-size: 1.9rem; box-shadow: 0 0 20px rgba(76, 201, 240, 0.5); }

/* 控制方式样式 */
.controls {
    background: rgba(40, 40, 60, 0.8);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls h3 {
    color: #4cc9f0;
    margin-bottom: 15px;
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.keyboard-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

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

.key {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3);
    user-select: none;
    transition: all 0.2s ease;
}

.key:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.5);
}

/* 页脚样式 */
footer {
    text-align: center;
    color: #a9a9a9;
    font-size: 0.9rem;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

footer p {
    margin-bottom: 5px;
}

.github-link {
    color: #4cc9f0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.github-link i {
    font-size: 1.1rem;
}

/* 消息弹窗样式 */
.message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.message-box {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    border: 2px solid #4cc9f0;
    box-shadow: 0 0 30px rgba(76, 201, 240, 0.3);
}

.message-box h2 {
    color: #4cc9f0;
    font-size: 2.2rem;
    margin-bottom: 20px;
}

.message-box p {
    color: #ccc;
    font-size: 1.2rem;
    margin-bottom: 30px;
    line-height: 1.5;
}

.message-btn {
    background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin: 0 10px;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(247, 37, 133, 0.3);
}

.message-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(247, 37, 133, 0.5);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .game-board {
        width: 300px;
        height: 300px;
    }
    
    .grid-cell {
        font-size: 2rem;
    }
    
    .tile-128, .tile-256, .tile-512 {
        font-size: 1.7rem;
    }
    
    .tile-1024, .tile-2048 {
        font-size: 1.5rem;
    }
    
    .key {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .score-container, .best-container {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .game-board {
        width: 280px;
        height: 280px;
    }
    
    .grid-cell {
        font-size: 1.8rem;
    }
    
    .key {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .message-box {
        padding: 25px;
    }
}


/* 头部布局样式 */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}

.header-left {
    flex: 1;
}

/* 语言选择器样式 */
.language-selector {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

.language-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a9a9a9;
    font-size: 0.9rem;
    cursor: pointer;
}

.language-selector i {
    color: #4cc9f0;
    font-size: 1.2rem;
}

.language-dropdown {
    background: rgba(40, 40, 60, 0.9);
    color: #f5f5f5;
    border: 1px solid rgba(76, 201, 240, 0.5);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    font-family: 'Noto Sans SC', sans-serif;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    min-width: 140px;
}

.language-dropdown:hover {
    border-color: #4cc9f0;
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.3);
}

.language-dropdown:focus {
    border-color: #4cc9f0;
    box-shadow: 0 0 15px rgba(76, 201, 240, 0.5);
}

.language-dropdown option {
    background: rgba(30, 30, 46, 0.95);
    color: #f5f5f5;
    padding: 10px;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .language-selector {
        position: relative;
        margin-top: 15px;
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .language-dropdown {
        min-width: 120px;
        font-size: 0.85rem;
        padding: 6px 10px;
    }
}