* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1 {
    text-align: center;
    color: white;
    font-size: 2.5em;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.controls {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.difficulty-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.difficulty-selector label {
    font-weight: bold;
    color: #555;
}

.difficulty-selector select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.difficulty-selector select:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-small {
    padding: 6px 12px;
    font-size: 14px;
}

.game-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.info-item {
    background: #f8f9fa;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: bold;
    color: #555;
    border: 2px solid #e9ecef;
}

.info-item span:last-child {
    color: #667eea;
    margin-left: 5px;
}

.game-board-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.game-board {
    display: inline-grid;
    gap: 1px;
    background: #333;
    border: 3px solid #333;
    border-radius: 10px;
    padding: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.cell {
    width: 30px;
    height: 30px;
    background: linear-gradient(145deg, #e6e6e6, #ffffff);
    border: 2px outset #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s;
    position: relative;
}

.cell:hover {
    background: linear-gradient(145deg, #f0f0f0, #ffffff);
}

.cell.revealed {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    cursor: default;
}

.cell.flagged {
    background: linear-gradient(145deg, #ffd700, #ffed4e);
    color: #dc3545;
    font-size: 16px;
}

.cell.flagged::before {
    content: "🚩";
}

.cell.mine {
    background: #dc3545;
    color: white;
    font-size: 16px;
}

.cell.mine::before {
    content: "💣";
}

.cell.exploded {
    background: #ff6b6b;
    animation: explode 0.3s ease-out;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.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; }

.game-result {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-result.show {
    display: flex;
}

.result-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
}

.result-content h2 {
    margin-bottom: 20px;
    font-size: 2em;
}

.result-content h2.win {
    color: #28a745;
}

.result-content h2.lose {
    color: #dc3545;
}

#resultStats {
    margin: 20px 0;
    line-height: 1.8;
    color: #666;
}

.records {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.records h3 {
    color: #555;
    margin-bottom: 15px;
    text-align: center;
}

.record-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.record-item span:first-child {
    font-weight: bold;
    color: #555;
}

.record-item span:last-child {
    color: #667eea;
    font-weight: bold;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .game-info {
        justify-content: center;
    }
    
    .cell {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
    
    .record-list {
        grid-template-columns: 1fr;
    }
}

/* 难度特定的网格布局 */
.game-board.beginner {
    grid-template-columns: repeat(9, 1fr);
}

.game-board.intermediate {
    grid-template-columns: repeat(16, 1fr);
}

.game-board.expert {
    grid-template-columns: repeat(30, 1fr);
}

@media (max-width: 768px) {
    .game-board.expert {
        grid-template-columns: repeat(30, 1fr);
    }
    
    .game-board.expert .cell {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}
