body {
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 16px; /* 根据需要调整基本字体大小 */
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh; /* 让内容充满整个视口高度 */
}

#game-area {
    width: calc(100vw - 30px); /* 从视口宽度中减去30px以获得一些边距 */
    max-width: 600px; /* 限制最大宽度 */
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
}

#grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 1fr 表示“分数单位”，每个方格占用可用空间的一份 */
    grid-template-rows: repeat(5, 1fr);
    gap: 5px; /* 方格之间的间隔 */
    width: 100%; /* 宽度设置为100%以填充父容器 */
}

.grid-cell {
    background-color: #4CAF50;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    aspect-ratio: 1; /* 保持方格为正方形 */
    padding: 8px; /* 减小内边距以缩小方格 */
    font-size: 3vw; /* 字体大小根据视口宽度调整 */
}

.grid-cell.fade-out {
    animation: fadeOut 0.2s ease-out forwards;
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

#timer {
    font-size: 2em;
    margin-bottom: 10px;
}

.input-area, .difficulty-selection {
    margin-bottom: 10px;
}

#records-area {
    width: 100%; /* 定义宽度以使内部元素可以居中 */
    display: flex;
    flex-direction: column;
    align-items: center; /* 使内部元素垂直居中 */
    margin-top: 20px;
}

button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center; /* 文字居中显示 */
}

input[type="text"], select {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

@media (max-width: 768px) {
    #grid {
        grid-template-columns: repeat(5, 15vw); /* 调整为视口宽度的15%，以缩小方格大小 */
        grid-template-rows: repeat(5, 15vw);
    }
}

p {
    text-align: center; /* 使段落文本居中 */
    margin-top: 10px;
    margin-bottom: 20px;
    font-size: 16px; /* 调整字体大小 */
    color: #333; /* 设定字体颜色 */
}

button {
    padding: 10px 20px;
    background-color: #0099ff; /* 海蓝色 */
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-align: center;
}
