:root {
  --bg: #f7f3e8;
  --panel: #ffffff;
  --ink: #2d2a26;
  --accent: #c15b2c;
  --accent-2: #1f6f78;
  --tile: #f1d9b3;
  --tile-ink: #2b1e10;
  --shadow: rgba(37, 32, 27, 0.18);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #fff6df 0%, transparent 40%),
    radial-gradient(circle at bottom right, #ffe2c2 0%, transparent 45%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.app {
  width: min(92vw, 520px);
  background: var(--panel);
  padding: 28px;
  border-radius: 20px;
  box-shadow: 0 18px 40px var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.top h1 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 1px;
}

.top .sub {
  margin: 6px 0 0;
  color: rgba(45, 42, 38, 0.7);
}

.hud {
  margin: 18px 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 18px rgba(193, 91, 44, 0.28);
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

#resetBtn {
  background: var(--accent-2);
  box-shadow: 0 10px 18px rgba(31, 111, 120, 0.28);
}

.stats {
  margin-left: auto;
  display: flex;
  gap: 16px;
  font-weight: 600;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  background: rgba(0, 0, 0, 0.03);
  padding: 12px;
  border-radius: 16px;
  position: relative;
  aspect-ratio: 1;
}

.tile {
  background: var(--tile);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: var(--tile-ink);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.06),
    0 10px 18px rgba(45, 42, 38, 0.15);
  transition: transform 0.18s ease;
  user-select: none;
}

.tile.empty {
  background: transparent;
  box-shadow: none;
}

.status {
  margin: 16px 0 0;
  font-weight: 600;
  color: var(--accent-2);
  min-height: 1.2em;
}

@media (max-width: 480px) {
  .app {
    padding: 20px;
  }

  .top h1 {
    font-size: 26px;
  }

  .stats {
    width: 100%;
    justify-content: space-between;
  }
}
