body {
    font-family: Arial, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    margin: 0;
    background-color: #faf8ef;
}

button {
    padding: 20px 50px;
    font-size: 50px;
    margin: 0 10px;
    cursor: pointer;
    background: linear-gradient(135deg, #fce19c 0%, #f4d06f 100%);
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: Arial, sans-serif;
    font-weight: bold;
    color: #776e65;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

p {
    font-size: 24px;
    margin: 10px 0;
}

/* 游戏容器：宽度根据屏幕大小变化 */
#grid-container {
    width: 80vw;           /* 占屏幕宽度 90% */
    aspect-ratio: 1;       /* 宽高 1:1 自动保持正方形 */
    padding: 10px;
    background-color: #bbada0;
    border-radius: 10px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 10px;
}

/* 单元格比例自动缩放 */
.grid-cell {
    background-color: #ccc0b3;
    border-radius: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: calc(7vw);   /* 字体自动变大/变小 */
    font-weight: bold;
    color: #776e65;
}


#gameover {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(82, 79, 79, 0.541);
    border-radius: 10px;
    justify-content: center;
}

#gameover p {
    width: auto;
    font-size: 48px;
    padding: 20px;
    color: white;
    text-align: center;
}


/* 大标题样式 */
h1 {
    font-size: 15vw;
    margin: 0;
    text-align: center;
    color: #776e65;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Press Start 2P', cursive, Arial, sans-serif;
}

/* 游戏分数和提示信息样式 */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.001);
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.01);
}

#score {
    font-size: 70px;
    font-weight: bold;
    color: #776e65;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#score span {
    color: #f4d06f;
    font-size: 16px;
}

/* 提示信息样式 */
.game-info p {
    font-size: 60px;
    font-weight: bold;
    color: #776e65;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#hint {
    margin-top: 10px;
    color: #f4d06f;
    animation: glow 2s infinite;
}

.tip {
    text-align: center;
    font-size: 40px;
}

.back-btn-box {
    padding: 20px;
    margin-top: 20px;
}

@keyframes glow {
    0% { text-shadow: 0 0 10px #f4d06f; }
    50% { text-shadow: 0 0 20px #f4d06f; }
    100% { text-shadow: 0 0 10px #f4d06f; }
}

/* 手机适配 */
@media screen and (max-width: 600px) {

    body {
        height: auto;
        padding: 20px 0;
        justify-content: flex-start;
    }

    h1 {
        font-size: 38px;
    }

    button {
        padding: 10px 20px;
        font-size: 16px;
    }

    .game-info {
        width: 90%;
        justify-content: space-between;
    }

    #grid-container {
        width: 300px;
        height: 300px;
        padding: 10px;
        gap: 10px;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 1fr);
    }

    .grid-cell {
        font-size: 20px;
    }

    #hint {
        font-size: 14px;
    }
}


