* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background: #0C0D14;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding-top: 16px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #E0E0E0;
}

@media (max-height: 600px), (max-width: 500px) {
  body {
    padding-top: 6px;
    align-items: flex-start;
  }
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ── Toolbar ───────────────────────────────────────────────── */
#toolbar {
  display: flex;
  gap: 8px;
}

#difficulty {
  display: flex;
  gap: 6px;
}

.diff-btn {
  background: rgba(255, 255, 255, 0.06);
  color: #AAA;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.diff-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #DDD;
}

.diff-btn.active {
  background: #4FC3F7;
  color: #0C0D14;
  border-color: #4FC3F7;
}

/* ── Header bar ────────────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #13141D;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 16px;
  width: 100%;
  max-width: fit-content;
}

.lcd {
  font-family: 'Courier New', Courier, monospace;
  font-size: 28px;
  font-weight: bold;
  color: #FF5252;
  background: #1A1A25;
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 60px;
  text-align: center;
  letter-spacing: 2px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#face-btn {
  font-size: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}

#face-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

#face-btn:active {
  transform: scale(0.93);
}

/* ── Grid container ────────────────────────────────────────── */
#grid-container {
  background: #13141D;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 6px;
  overflow: auto;
  max-width: 95vw;
  max-height: 80vh;
}

#grid {
  display: grid;
  gap: 1px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

/* ── Cells ─────────────────────────────────────────────────── */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.08s;
  border-radius: 2px;
}

.cell.unrevealed {
  background: #2A2B38;
  border-top: 2px solid #3A3B4A;
  border-left: 2px solid #3A3B4A;
  border-right: 2px solid #1A1B24;
  border-bottom: 2px solid #1A1B24;
}

.cell.unrevealed:hover {
  background: #33344A;
}

.cell.revealed {
  background: #1C1D28;
  border: 1px solid rgba(255, 255, 255, 0.03);
  cursor: default;
}

.cell.revealed.empty {
  background: #191A24;
}

/* Number colors */
.cell.n1 { color: #42A5F5; }
.cell.n2 { color: #66BB6A; }
.cell.n3 { color: #EF5350; }
.cell.n4 { color: #AB47BC; }
.cell.n5 { color: #8D6E63; }
.cell.n6 { color: #26A69A; }
.cell.n7 { color: #37474F; }
.cell.n8 { color: #78909C; }

/* Mine */
.cell.mine {
  background: #2A2B38;
  font-size: inherit;
}

.cell.mine-hit {
  background: #5C1A1A !important;
}

/* Flag */
.cell.flagged::after {
  content: '\1F6A9';
  font-size: inherit;
}

/* Revealed mine */
.cell.mine-revealed::after {
  content: '\1F4A3';
  font-size: inherit;
}

/* Wrong flag */
.cell.wrong-flag {
  background: #3A1A1A;
}

.cell.wrong-flag::after {
  content: '\274C';
  font-size: inherit;
}
