:root {
  --ink: #e9f0ed;
  --muted: #7f9690;
  --paper: #101615;
  --card: #18211f;
  --line: #2b3b37;
  --mint: #1f6b53;
  --mint-dark: #63d4a1;
  --yellow: #f0c75e;
  --red: #e26767;
  --cell: #263531;
  --cell-shadow: #182420;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Space Grotesk", sans-serif;
}

.game-shell {
  width: min(100% - 32px, 700px);
  margin: 0 auto;
  padding: 58px 0 34px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow,
.metric-label,
.help-row,
footer {
  color: var(--muted);
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--mint-dark);
  font-size: 0.7rem;
}

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 9vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.08em;
  line-height: 0.85;
}

h1 span {
  color: var(--mint-dark);
}

.hero-mark {
  color: var(--yellow);
  font-size: 3.3rem;
  line-height: 0.8;
  transform: rotate(12deg);
}

.game-card {
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 22px 50px rgba(0, 0, 0, 0.25);
}

.game-topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-bottom: 21px;
  border-bottom: 1px solid var(--line);
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.metric-right {
  align-items: flex-end;
  text-align: right;
}

.metric strong {
  color: var(--ink);
  font-family: "DM Mono", monospace;
  font-size: 1.55rem;
  font-weight: 500;
  letter-spacing: -0.06em;
}

.reset-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: #202c29;
  cursor: pointer;
  font: 500 0.82rem "Space Grotesk", sans-serif;
  transition: 0.2s ease;
}

.reset-button:hover {
  border-color: var(--mint-dark);
  background: #285342;
  transform: translateY(-1px);
}

.reset-button span:first-child {
  color: var(--mint-dark);
  font-size: 1.05rem;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}

.status-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.board-wrap {
  padding: 9px;
  border-radius: 10px;
  background: #0b100f;
}

.board {
  display: grid;
  grid-template-columns: repeat(16, 1fr);
  grid-template-rows: repeat(16, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  aspect-ratio: 1;
  padding: 2px;
  border-radius: 5px;
  background: #111b18;
  user-select: none;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 2px;
  color: var(--ink);
  background: var(--cell);
  box-shadow: inset 0 -2px 0 var(--cell-shadow);
  cursor: pointer;
  font: 600 clamp(0.65rem, 2.3vw, 1rem) "DM Mono", monospace;
  line-height: 1;
  transition: filter 0.12s ease, background 0.12s ease;
}

.cell:hover:not(.revealed) {
  filter: brightness(1.08);
}

.cell:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--mint-dark);
  outline-offset: 1px;
}

.cell.revealed {
  background: #17231f;
  box-shadow: none;
  cursor: default;
}

.cell.flagged {
  color: var(--red);
  background: #382a2b;
}

.cell.mine {
  color: #fff;
  background: var(--red);
  box-shadow: none;
}

.cell.exploded {
  background: #c83e48;
}

.cell.wrong-flag {
  color: var(--red);
  background: #382a2b;
  box-shadow: none;
}

.number-1 { color: #78b8ff; }
.number-2 { color: #63d4a1; }
.number-3 { color: #ff8d78; }
.number-4 { color: #bda2ff; }
.number-5, .number-6, .number-7, .number-8 { color: #ffb86b; }

.help-row {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding-top: 20px;
  letter-spacing: 0.04em;
  text-transform: none;
}

kbd {
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #202c29;
  font: inherit;
}

footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding-top: 22px;
  letter-spacing: 0.06em;
}

.footer-dot {
  color: var(--yellow);
}

@media (max-width: 520px) {
  .game-shell {
    width: min(100% - 20px, 700px);
    padding-top: 34px;
  }

  .game-card {
    border-radius: 16px;
  }

  .help-row {
    gap: 8px;
    font-size: 0.56rem;
  }

  .help-row kbd {
    padding: 2px 3px;
  }

  footer {
    font-size: 0.58rem;
  }
}
