* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.main-container {
    max-width: 720px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 120, 255, 0.08);
    text-align: center;
    border: 1px solid rgba(0, 120, 255, 0.05);
}



.game-info {
    display: flex;
    justify-content: space-between;
    padding: 15px 25px;
    background: #f8fafc;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 16px;
    color: #34495e;
}

.game-info .item {
    text-align: center;
}

.game-info span {
    color: #0078ff;
    font-weight: 600;
    font-size: 18px;
}

.game-box {
    margin-bottom: 25px;
}

.restart-btn {
    padding: 10px 24px;
    background: linear-gradient(120deg, #0078ff, #40a9ff);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 120, 255, 0.2);
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 120, 255, 0.25);
}

/* 2048 棋盘样式 */
.game-2048 {
    display: block; /* 改成 block */
    background: #f1f5f9;
    padding: 12px;
    border-radius: 12px;
    margin: 20px auto; /* 加 auto 水平居中 */
    width: fit-content; /* 宽度自适应格子 */
}

.grid {
    display: grid;
    grid-template-columns: repeat(4, 80px);
    grid-template-rows: repeat(4, 80px);
    gap: 10px;
    margin: 0 auto; /* 加这句让网格居中 */
}

.cell {
    width: 80px;
    height: 80px;
    background: #e2e8f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
    transition: all 0.2s ease;
}

/* 2048 数字配色（柔和高级蓝） */
.n-2 {
    background: #e0f2fe;
    color: #0c4a6e;
}

.n-4 {
    background: #bae6fd;
    color: #075985;
}

.n-8 {
    background: #7dd3fc;
    color: #082f50;
}

.n-16 {
    background: #38bdf8;
    color: #fff;
}

.n-32 {
    background: #0ea5e9;
    color: #fff;
}

.n-64 {
    background: #0284c7;
    color: #fff;
}

.n-128 {
    background: #0369a1;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 120, 255, 0.2);
}

.n-256 {
    background: #075985;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 120, 255, 0.3);
}

.n-512 {
    background: #0c4a6e;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 120, 255, 0.4);
}

.n-1024 {
    background: #082f50;
    color: #fff;
    box-shadow: 0 0 10px rgba(0, 120, 255, 0.5);
}

.n-2048 {
    background: #021a36;
    color: #fff;
    box-shadow: 0 0 15px rgba(0, 120, 255, 0.6);
}

.game-message {
    font-size: 18px;
    font-weight: 600;
    color: #0ea5e9;
    height: 30px;
    margin-bottom: 10px;
}

.success {
    color: #10b981;
}

.failed {
    color: #ef4444;
}

/* 规则卡片 */
.rule-card {
    max-width: 600px;
    margin: 30px auto 0;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    text-align: left;
    border: 1px solid rgba(0, 120, 255, 0.1);
}

.rule-card h3 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #0078ff;
    display: inline-block;
}

.rule-card ul {
    list-style: none;
    font-size: 14px;
    color: #34495e;
    line-height: 1.8;
}

.rule-card li {
    margin-bottom: 6px;
    padding-left: 18px;
    position: relative;
}

.rule-card li::before {
    content: "•";
    color: #0078ff;
    font-weight: bold;
    position: absolute;
    left: 0;
}

.rule-card .key {
    color: #0078ff;
    font-weight: 500;
}

@media (max-width: 768px) {
    .main-container {
        margin: 20px;
        padding: 20px;
    }

    .grid {
        grid-template-columns: repeat(4, 65px);
        grid-template-rows: repeat(4, 65px);
        gap: 8px;
    }

    .cell {
        width: 65px;
        height: 65px;
        font-size: 20px;
    }
}