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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f0f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

body {
  touch-action: manipulation;
  user-select: none;
}

h1 {
    margin-bottom: 20px;
    color: #333;
}

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

#restart-btn, #reload-btn {
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    background: #4a90d9;
    color: white;
    border: none;
    border-radius: 4px;
}

#reload-btn {
    background: #40d63b;
}

#restart-btn:hover, #reload-btn:hover {
    background: #357abd;
}

#game-status {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    height: 27px;
}

.mobile-controls {
    margin-bottom: 10px;
    margin-top: 10px;
}

.mobile-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 32px;
    cursor: pointer;
}

.mobile-controls input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.flag-counter {
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
}

.timer {
    margin-bottom: 20px;
    font-size: 24px;
    font-weight: bold;
}

.grid {
    display: grid;
    grid-template-columns: repeat(10, 36px);
    grid-template-rows: repeat(10, 36px);
    gap: 2px;
    background: #ccc;
    border: 4px solid #999;
    user-select: none;
    width: 386px;
    height: 386px;
}

.square {
    background: #4a90d9;
    border: none;
    cursor: pointer;
    font-weight: bold;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.square:not(.revealed) {
    background: #85c1e9;
}

.cheat-value-reveal {
    position: relative;
    top: -10px;
    right: -14px;
    font-size: 10px;
    color: black;
}

.cheat-value-flag {
    position: relative;
    top: 10px;
    right: -8px;
    font-size: 10px;
    color: black;
}

.cheat-value-reveal.safe , .cheat-value-flag.safe {
    color: green;
}

.cheat-value-reveal.unsafe , .cheat-value-flag.unsafe {
    color: red;
}

.cheat-value-reveal.hidden, .cheat-value-flag.hidden {
    display: none;
}

.square:hover:not(.revealed):not(.flagged) {
    background: #5aa0e9;
}

.square:hidden {
    background: #4a90d9;
}

.square.revealed {
    background: #ddd;
    cursor: default;
}

.square.revealed.empty {
    background: #eee;
}

.square.revealed.mine {
    background: #e74c3c;
}

.square.flagged {
    background: #f1c40f;
}

.square.flagged:hover:not(.revealed) {
    background: #f39c12;
}

.square.number-1 { color: #3498db; }
.square.number-2 { color: #2ecc71; }
.square.number-3 { color: #e74c3c; }
.square.number-4 { color: #9b59b6; }
.square.number-5 { color: #f39c12; }
.square.number-6 { color: #1abc9c; }
.square.number-7 { color: #34495e; }
.square.number-8 { color: #7f8c8d; }
