* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
}

h1 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #c0c0c0;
    padding: 10px;
    border: 3px outset #ffffff;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.mines-counter, .timer {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 5px 10px;
    background-color: #000;
    color: #f00;
    border: 2px inset #7b7b7b;
    font-family: 'Digital-7', monospace;
}

.game-controls {
    display: flex;
    gap: 10px;
}

button {
    padding: 8px 16px;
    background-color: #c0c0c0;
    color: #000;
    border: 3px outset #ffffff;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #d0d0d0;
}

button:active {
    border: 3px inset #ffffff;
}

select {
    padding: 8px;
    border: 2px inset #7b7b7b;
    font-size: 1rem;
    background-color: #ffffff;
}

#game-board {
    display: grid;
    /* 调整网格列以适应不同难度 */
    gap: 0;
    margin: 0 auto;
    background-color: #c0c0c0;
    padding: 6px;
    border: 3px outset #ffffff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: fit-content; /* 使容器宽度自适应内容 */
}

.cell {
    width: 20px; /* 固定宽度 */
    height: 20px; /* 固定高度 */
    background-color: #c0c0c0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 12px; /* 更小的字体大小 */
    cursor: pointer;
    user-select: none;
    border: 2px outset #ffffff;
    transition: none; /* 移除过渡效果以更贴近经典体验 */
}

.cell:hover {
    background-color: #d0d0d0;
}

.cell.revealed {
    background-color: #d0d0d0;
    border: 1px solid #7b7b7b;
    border-style: solid;
    border-width: 1px;
    border-top-color: #7b7b7b;
    border-left-color: #7b7b7b;
    border-right-color: #ffffff;
    border-bottom-color: #ffffff;
}

.cell.flagged {
    background-color: #c0c0c0;
    color: #ff0000;
    position: relative;
}

.cell.flagged::after {
    content: "🚩";
    position: absolute;
    font-size: 12px;
}

.cell.mine {
    background-color: #ff0000;
    position: relative;
}

.cell.mine::after {
    content: "💣";
    position: absolute;
    font-size: 12px;
}

.cell.number-1 { color: #0000ff; }
.cell.number-2 { color: #008000; }
.cell.number-3 { color: #ff0000; }
.cell.number-4 { color: #000080; }
.cell.number-5 { color: #800000; }
.cell.number-6 { color: #008080; }
.cell.number-7 { color: #000000; }
.cell.number-8 { color: #808080; }

footer {
    text-align: center;
    margin-top: 20px;
    color: #333;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #c0c0c0;
    padding: 30px;
    border: 3px outset #ffffff;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal h2 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.modal p {
    margin-bottom: 20px;
}

/* 响应式设计 */
@media (max-width: 600px) {
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-controls {
        width: 100%;
        justify-content: center;
    }
    
    .cell {
        width: 18px; /* 在小屏幕上更小的格子 */
        height: 18px;
        font-size: 10px;
    }
    
    .cell.flagged::after,
    .cell.mine::after {
        font-size: 10px;
    }
}
