:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #1a1e24;
  --line: #323946;
  --text: #f6f2e8;
  --muted: #aeb7c3;
  --accent: #15c8a6;
  --accent-2: #ffca4f;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  background: radial-gradient(circle at 50% 0%, rgba(21, 200, 166, 0.15), transparent 36%), var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  touch-action: manipulation;
}

.game-wrap {
  width: min(760px, 100%);
  display: grid;
  gap: 14px;
}

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.hud strong,
.hud span {
  display: block;
}

.hud span {
  color: var(--muted);
  font-size: 0.9rem;
}

button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #071412;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

canvas,
.board {
  width: 100%;
  aspect-ratio: 1 / 0.72;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1013;
}

.tip {
  margin: 0;
  color: var(--muted);
  text-align: center;
  line-height: 1.55;
}

.result-popup {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.62);
}

.result-card {
  width: min(340px, 100%);
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.result-card strong {
  font-size: 1.35rem;
}

.result-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.result-card button {
  margin-top: 4px;
}

@media (max-width: 560px) {
  body {
    align-items: start;
    padding: 10px;
  }

  .game-wrap {
    gap: 10px;
  }

  .hud {
    padding: 10px;
  }

  .tip {
    font-size: 0.9rem;
  }
}
