* {
    box-sizing: border-box;
}

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

.container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

h1 {
    text-align: center;
    font-size: 36px;
    margin: 0 0 20px 0;
    color: #2c3e50;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.game-info {
    display: flex;
    gap: 20px;
}

.info-item {
    background: #ecf0f1;
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
    border: 2px solid #bdc3c7;
}

.label {
    color: #7f8c8d;
}

#mine-count, #timer {
    color: #e74c3c;
    margin-left: 5px;
}

.game-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#difficulty {
    padding: 8px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 6px;
    background: white;
    font-size: 14px;
}

#new-game, #restart-game {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

#new-game:hover, #restart-game:hover {
    background: #2980b9;
}

.game-board {
    display: inline-block;
    background: #95a5a6;
    border: 3px solid #7f8c8d;
    border-radius: 8px;
    padding: 5px;
    margin: 0 auto;
}

.cell {
    width: 25px;
    height: 25px;
    border: 2px solid;
    border-top-color: #ffffff;
    border-left-color: #ffffff;
    border-right-color: #7f8c8d;
    border-bottom-color: #7f8c8d;
    background: #c0c0c0;
    display: inline-block;
    text-align: center;
    line-height: 21px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    user-select: none;
    transition: all 0.1s;
}

.cell:hover {
    background: #d0d0d0;
}

.cell.revealed {
    border: 1px solid #7f8c8d;
    background: #ecf0f1;
    cursor: default;
}

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

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

.cell.flagged::before {
    content: "🚩";
    font-size: 12px;
}

.cell.mine {
    background: #e74c3c;
}

.cell.mine::before {
    content: "💣";
    font-size: 12px;
}

.cell.mine-hit {
    background: #c0392b;
    animation: explode 0.5s;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Number colors */
.cell.num-1 { color: #0000ff; }
.cell.num-2 { color: #008000; }
.cell.num-3 { color: #ff0000; }
.cell.num-4 { color: #000080; }
.cell.num-5 { color: #800000; }
.cell.num-6 { color: #008080; }
.cell.num-7 { color: #000000; }
.cell.num-8 { color: #808080; }

.instructions {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #7f8c8d;
    line-height: 1.5;
}

.instructions p {
    margin: 5px 0;
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.game-over-content {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 400px;
}

.game-over-content h2 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 28px;
}

.game-over-content p {
    color: #7f8c8d;
    margin-bottom: 25px;
    font-size: 16px;
}

.hidden {
    display: none !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    h1 {
        font-size: 28px;
    }
    
    .game-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .game-info {
        justify-content: center;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    #difficulty {
        flex: 1;
        max-width: 250px;
    }
    
    .cell {
        width: 20px;
        height: 20px;
        line-height: 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .cell {
        width: 18px;
        height: 18px;
        line-height: 14px;
        font-size: 10px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
}
