:root {
  --bg: #0c0e13;
  --panel: #181c24;
  --border: #2a3140;
  --fg: #e6ecf2;
  --muted: #8b95a3;
  --accent: #7cc4ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

header {
  max-width: 720px;
  margin: 28px auto 16px;
  padding: 0 20px;
  text-align: center;
}

h1 {
  margin: 0 0 6px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 60ch;
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.game {
  display: grid;
  grid-template-columns: auto 200px;
  gap: 18px;
  justify-content: center;
  margin-bottom: 24px;
}

.playfield-wrap {
  position: relative;
  background: #0c0e13;
  border: 2px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

#playfield {
  display: block;
  background: #0c0e13;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
}

.panel .label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}

.panel .value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.next-panel {
  text-align: center;
}

#nextPreview {
  display: block;
  margin: 4px auto 0;
  background: #0c0e13;
  border-radius: 4px;
}

.action {
  background: var(--accent);
  color: #061018;
  border: none;
  border-radius: 6px;
  padding: 10px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
}

.action:hover { filter: brightness(1.08); }

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 19, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.overlay[hidden] {
  display: none;
}

.overlay-content {
  text-align: center;
  padding: 20px;
}

.overlay-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.overlay-sub {
  color: var(--muted);
  margin-bottom: 14px;
}

#overlayBtn {
  background: var(--accent);
  color: #061018;
  border: none;
  border-radius: 6px;
  padding: 8px 22px;
  font-weight: 600;
  cursor: pointer;
}

.controls {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
}

.controls h2 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.controls ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
  font-size: 0.88rem;
}

kbd {
  background: var(--bg);
  color: var(--fg);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.78rem;
  margin-right: 2px;
}

footer {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

footer code {
  background: var(--panel);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "SF Mono", Consolas, monospace;
  font-size: 0.78rem;
}

@media (max-width: 600px) {
  .game { grid-template-columns: 1fr; align-items: center; }
  .sidebar { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .panel { min-width: 100px; }
  .controls ul { grid-template-columns: 1fr; }
}
