:root {
  --ink: #21362c;
  --cream: #fff8e8;
  --grass: #d9dfc8;
  --grass-deep: #b8c6a8;
  --night: #12302f;
  --amber: #f0bd64;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family:
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    sans-serif;
  color: var(--cream);
  background:
    linear-gradient(160deg, #102f30 0%, #1c443b 56%, #2c5140 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 72px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(12, 40, 37, 0.62);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 248, 232, 0.75);
  border-radius: 50%;
  font-size: 15px;
}

.nav {
  display: flex;
  gap: 24px;
  font-size: 14px;
}

.shell {
  display: flex;
  justify-content: center;
  padding: 104px 20px 60px;
}

.board-panel {
  width: min(560px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 248, 232, 0.16);
  border-radius: 8px;
  background: rgba(20, 55, 49, 0.7);
  box-shadow: 0 26px 70px rgba(4, 22, 20, 0.32);
}

.kicker {
  margin: 0;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
}

h1 {
  margin: 10px 0 0;
  font-size: 44px;
  line-height: 1.12;
}

.tagline {
  margin: 12px 0 0;
  color: rgba(255, 248, 232, 0.78);
  line-height: 1.6;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 18px;
}

.toolbar button {
  border: 1px solid rgba(255, 248, 232, 0.4);
  border-radius: 8px;
  padding: 9px 16px;
  background: transparent;
  color: var(--cream);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.toolbar .mode.active {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
}

.stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(8, 32, 30, 0.42);
  font-weight: 800;
}

.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--amber);
}

.board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(8, 29, 27, 0.46);
  user-select: none;
}

.cell {
  border: 0;
  border-radius: 4px;
  aspect-ratio: 1;
  padding: 0;
  background: var(--grass);
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

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

.cell.revealed {
  background: var(--grass-deep);
  cursor: default;
}

.cell.flagged {
  background: #f0c47a;
  color: #7c3f1d;
}

.cell.boom {
  background: #c8553d;
  color: #fff8e8;
}

.cell[data-number="1"] {
  color: #2f6f9f;
}

.cell[data-number="2"] {
  color: #4a7b3a;
}

.cell[data-number="3"] {
  color: #c25b2b;
}

.cell[data-number="4"] {
  color: #8f3d3d;
}

.cell[data-number="5"] {
  color: #6d2f55;
}

.cell[data-number="6"],
.cell[data-number="7"],
.cell[data-number="8"] {
  color: #31394d;
}

.status {
  min-height: 24px;
  margin: 18px 0 0;
  color: rgba(255, 248, 232, 0.82);
  text-align: center;
}

@media (max-width: 560px) {
  .shell {
    padding: 92px 10px 40px;
  }

  .board-panel {
    padding: 20px 14px 22px;
  }

  h1 {
    font-size: 36px;
  }

  .toolbar {
    gap: 8px;
  }

  .toolbar button {
    padding: 8px 12px;
    font-size: 13px;
  }

  .stats {
    padding: 8px 10px;
    font-size: 13px;
  }

  .board {
    gap: 3px;
    padding: 6px;
  }

  .cell {
    font-size: 15px;
  }
}

@media (max-width: 380px) {
  .board {
    gap: 2px;
    padding: 5px;
  }

  .cell {
    font-size: 13px;
  }
}
