:root {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #1e293b;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent2: #a78bfa;
  --good: #34d399;
  --bad: #f87171;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: radial-gradient(1200px 800px at 20% -10%, #1e3a5f 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

.game-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.game-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.game-header h1 {
  font-size: 1.35rem;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 12px;
  border: 1px solid #334155;
  border-radius: 999px;
  transition: all 0.2s;
  white-space: nowrap;
}
.back-link:hover { color: var(--accent); border-color: var(--accent); }

.hud {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.hud .stat {
  background: var(--card);
  border: 1px solid #334155;
  border-radius: var(--radius);
  padding: 8px 16px;
  text-align: center;
  min-width: 90px;
}
.hud .stat .label { font-size: 0.72rem; color: var(--muted); letter-spacing: 1px; }
.hud .stat .value { font-size: 1.2rem; font-weight: 700; color: var(--accent); }

.btn {
  background: linear-gradient(135deg, var(--accent), #0ea5e9);
  color: #04263a;
  border: none;
  border-radius: 999px;
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(56, 189, 248, 0.35); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: var(--bg2); color: var(--text); border: 1px solid #334155; }

.hint { color: var(--muted); font-size: 0.85rem; text-align: center; line-height: 1.6; }

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-radius: var(--radius);
  z-index: 10;
  backdrop-filter: blur(3px);
}
.overlay h2 { font-size: 1.6rem; }
.overlay p { color: var(--muted); }
.overlay.hidden { display: none; }

canvas { display: block; touch-action: none; }

.board-wrap { position: relative; }
