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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #333;
}

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    padding: 30px;
    max-width: 600px;
    width: 100%;
}

/* Game Header */
.game-header {
    text-align: center;
    margin-bottom: 25px;
}

.title-section h1 {
    color: #333;
    font-size: 2.5em;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.title-section h1 i {
    color: #e74c3c;
    animation: pulse 2s infinite;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 20px;
}

/* Difficulty Selector */
.difficulty-selector {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.difficulty-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.difficulty-btn:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.difficulty-btn.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.difficulty-btn i {
    color: #ffc107;
}

/* Game Stats */
.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 5px;
}

.stat-item i {
    font-size: 1.5em;
    color: #007bff;
}

.label {
    font-size: 0.8em;
    color: #666;
    font-weight: 600;
}

.value {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
}

.reset-button {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

.reset-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.reset-button:active {
    transform: translateY(0);
}

/* Game Area */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    background: #333;
    padding: 3px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.cell {
    width: 35px;
    height: 35px;
    background: #ddd;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1em;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.cell:hover {
    background: #bbb;
    transform: scale(1.05);
}

.cell.revealed {
    background: #f8f9fa;
    cursor: default;
    transform: scale(1);
}

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

.cell.mine {
    background: #e74c3c;
    color: white;
}

.cell.flagged {
    background: #ffc107;
    color: #333;
}

.cell.flagged::before {
    content: "🚩";
    font-size: 1.2em;
}

.cell.number-1 { color: #007bff; }
.cell.number-2 { color: #28a745; }
.cell.number-3 { color: #dc3545; }
.cell.number-4 { color: #6f42c1; }
.cell.number-5 { color: #fd7e14; }
.cell.number-6 { color: #20c997; }
.cell.number-7 { color: #6c757d; }
.cell.number-8 { color: #495057; }

/* Message */
.message {
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    animation: slideIn 0.5s ease;
}

.message.win {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.message.lose {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
}

.message.hidden {
    display: none;
}

/* Instructions */
.instructions {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
}

.instructions h3 {
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instructions h3 i {
    color: #007bff;
}

.instruction-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.instruction-item i {
    color: #007bff;
    font-size: 1.2em;
    min-width: 20px;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.control-btn {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(108, 117, 125, 0.3);
}

/* Footer */
.game-footer {
    text-align: center;
    color: #666;
    font-size: 0.9em;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    .title-section h1 {
        font-size: 2em;
    }
    
    .game-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .difficulty-selector {
        flex-direction: column;
        align-items: center;
    }
    
    .difficulty-btn {
        width: 100%;
        max-width: 200px;
    }
    
    .cell {
        width: 30px;
        height: 30px;
        font-size: 1em;
    }
    
    .instruction-grid {
        grid-template-columns: 1fr;
    }
    
    .game-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .control-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes cellReveal {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.cell.revealed {
    animation: cellReveal 0.3s ease;
}

@keyframes flagPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.cell.flagged {
    animation: flagPulse 0.5s ease;
}