/* 扫雷游戏样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

body {
    background-color: #f0f2f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 20px;
    width: 100%;
}

header h1 {
    font-size: 2rem;
    color: #4a148c;
    margin-bottom: 10px;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.controls {
    margin: 20px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.difficulty-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
}

.difficulty-btn {
    background-color: #4a148c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.difficulty-btn.active {
    background-color: #7b1fa2;
    font-weight: bold;
}

.difficulty-btn:hover {
    background-color: #7b1fa2;
}

.game-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 400px;
    margin-bottom: 15px;
    background-color: white;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.mines-left, .timer {
    display: flex;
    align-items: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: #4a148c;
}

.mines-left span, .timer span {
    margin-left: 5px;
}

#minesweeper-board {
    display: grid;
    grid-template-columns: repeat(var(--cols), 30px);
    grid-template-rows: repeat(var(--rows), 30px);
    gap: 2px;
    background-color: #bdbdbd;
    border: 3px solid #7b7b7b;
    padding: 5px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}

.cell {
    width: 30px;
    height: 30px;
    background-color: #c0c0c0;
    border: 2px solid;
    border-color: #fff #7b7b7b #7b7b7b #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
}

.cell.revealed {
    background-color: #d9d9d9;
    border-color: #7b7b7b;
    border-width: 1px;
}

.cell.flagged {
    background-color: #c0c0c0;
    color: red;
}

.cell.mine {
    background-color: #ff0000;
}

.cell.number-1 { color: blue; }
.cell.number-2 { color: green; }
.cell.number-3 { color: red; }
.cell.number-4 { color: darkblue; }
.cell.number-5 { color: brown; }
.cell.number-6 { color: teal; }
.cell.number-7 { color: black; }
.cell.number-8 { color: gray; }

button {
    background-color: #4a148c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #7b1fa2;
}

.home-button {
    margin-top: 20px;
    background-color: #333;
}

.home-button:hover {
    background-color: #555;
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    display: none;
    z-index: 100;
}

.game-over h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.game-over p {
    margin-bottom: 20px;
}

.instructions {
    margin: 20px 0;
    text-align: center;
    max-width: 500px;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    #minesweeper-board {
        grid-template-columns: repeat(var(--cols), 25px);
        grid-template-rows: repeat(var(--rows), 25px);
    }
    
    .cell {
        width: 25px;
        height: 25px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    #minesweeper-board {
        grid-template-columns: repeat(var(--cols), 20px);
        grid-template-rows: repeat(var(--rows), 20px);
    }
    
    .cell {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    .game-info {
        font-size: 0.9rem;
    }
}
