* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1f2430;
  color: #e6e6e6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

.app {
  background: #2b3140;
  padding: 24px 28px 28px;
  border-radius: 14px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  text-align: center;
}

h1 {
  margin: 0 0 18px;
  font-size: 22px;
  letter-spacing: 1px;
}

.panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  background: #1f2430;
  padding: 12px 18px;
  border-radius: 10px;
  margin-bottom: 14px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}

.stat-label {
  font-size: 11px;
  color: #8b93a7;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ff6b6b;
}

.reset {
  font-size: 26px;
  line-height: 1;
  background: #3a4252;
  border: none;
  border-radius: 10px;
  width: 48px;
  height: 48px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}

.reset:hover {
  background: #46506a;
}

.reset:active {
  transform: scale(0.92);
}

.controls {
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  color: #b9c0d0;
}

#difficulty {
  background: #1f2430;
  color: #e6e6e6;
  border: 1px solid #3a4252;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
}

.board {
  display: grid;
  gap: 3px;
  justify-content: center;
  margin: 0 auto;
  user-select: none;
}

.cell {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #4a5570;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.1s ease;
}

.cell:hover:not(.revealed) {
  background: #58658a;
}

.cell.revealed {
  background: #2b3140;
  cursor: default;
  box-shadow: inset 0 0 0 1px #1f2430;
}

.cell.flag {
  background: #4a5570;
}

.cell.mine {
  background: #c0392b;
  color: #fff;
}

.cell[data-n="1"] { color: #4aa3ff; }
.cell[data-n="2"] { color: #2ecc71; }
.cell[data-n="3"] { color: #ff6b6b; }
.cell[data-n="4"] { color: #9b59b6; }
.cell[data-n="5"] { color: #e67e22; }
.cell[data-n="6"] { color: #1abc9c; }
.cell[data-n="7"] { color: #ecf0f1; }
.cell[data-n="8"] { color: #95a5a6; }

.hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: #8b93a7;
}
