* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #c0c0c0 0%, #808080 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    padding: 20px;
}

.game-container {
    background: #c0c0c0;
    border: 2px outset #c0c0c0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.game-header {
    margin-bottom: 20px;
}

.game-header h1 {
    color: #000;
    font-size: 2.5em;
    margin-bottom: 15px;
    font-weight: bold;
    text-shadow: 1px 1px 0px #fff;
}

.game-stats {
    display: flex;
    justify-content: space-around;
    background: #000;
    color: #ff0000;
    padding: 10px;
    border: 2px inset #c0c0c0;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.2em;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.8em;
    color: #ffff00;
}

.stat-value {
    font-size: 1.5em;
    min-width: 40px;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 10px;
    background: #c0c0c0;
    border: 1px inset #c0c0c0;
}

.difficulty-selector {
    display: flex;
    gap: 5px;
}

.difficulty-btn {
    padding: 8px 16px;
    border: 2px outset #c0c0c0;
    background: #c0c0c0;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
}

.difficulty-btn:hover {
    background: #d0d0d0;
}

.difficulty-btn.active {
    border: 2px inset #c0c0c0;
    background: #a0a0a0;
}

.restart-btn {
    width: 40px;
    height: 40px;
    border: 2px outset #c0c0c0;
    background: #c0c0c0;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.restart-btn:hover {
    background: #d0d0d0;
}

.restart-btn:active {
    border: 2px inset #c0c0c0;
}

.game-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.game-board {
    display: inline-grid;
    gap: 1px;
    background: #808080;
    border: 3px inset #c0c0c0;
    padding: 3px;
}

.cell {
    width: 24px;
    height: 24px;
    border: 2px outset #c0c0c0;
    background: #c0c0c0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    user-select: none;
    position: relative;
}

.cell:hover {
    background: #d0d0d0;
}

.cell.revealed {
    border: 1px solid #808080;
    background: #c0c0c0;
    cursor: default;
}

.cell.revealed:hover {
    background: #c0c0c0;
}

.cell.mine {
    background: #ff0000;
}

.cell.flagged {
    background: #c0c0c0;
}

.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: #000; }
.cell.number-8 { color: #808080; }

.game-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-message.show {
    display: flex;
}

.message-content {
    background: #c0c0c0;
    border: 3px outset #c0c0c0;
    padding: 40px;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.message-content h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: #000;
}

.message-content p {
    font-size: 1.3em;
    margin-bottom: 25px;
    color: #333;
}

.btn {
    padding: 12px 24px;
    border: 2px outset #c0c0c0;
    background: #c0c0c0;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.btn:hover {
    background: #d0d0d0;
}

.btn:active {
    border: 2px inset #c0c0c0;
}

.game-instructions {
    background: #f0f0f0;
    border: 2px inset #c0c0c0;
    padding: 20px;
    text-align: left;
    margin-top: 20px;
}

.game-instructions h3 {
    color: #000;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.game-instructions ul {
    margin-bottom: 20px;
    padding-left: 20px;
}

.game-instructions li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.legend {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.cell.demo.covered {
    border: 2px outset #c0c0c0;
}

.cell.demo.flagged {
    border: 2px outset #c0c0c0;
    font-size: 10px;
}

.cell.demo.revealed {
    border: 1px solid #808080;
}

.cell.demo.number {
    color: #ff0000;
}

@media (max-width: 600px) {
    .game-container {
        padding: 15px;
        margin: 10px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .game-stats {
        font-size: 1em;
    }
    
    .game-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .difficulty-selector {
        justify-content: center;
    }
    
    .difficulty-btn {
        padding: 10px 20px;
        font-size: 16px;
    }
    
    .cell {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .legend {
        justify-content: center;
        gap: 10px;
    }
    
    .legend-item {
        flex-direction: column;
        text-align: center;
    }
}