:root {
  color-scheme: light;
  --bg: #f5f1e9;
  --ink: #1f1d1a;
  --muted: #6e665c;
  --accent: #2d6b5f;
  --panel: #fbfaf7;
  --line: #d9d1c3;
  --danger: #9f2f2f;
}

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

body {
  min-height: 100vh;
  background: radial-gradient(circle at top, #fff 0%, var(--bg) 55%);
  color: var(--ink);
  font-family: "Georgia", "Times New Roman", serif;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 20px 48px;
}

.page {
  width: min(920px, 100%);
  display: grid;
  gap: 24px;
}

.header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

h1 {
  font-size: clamp(32px, 4vw, 44px);
  letter-spacing: -0.02em;
}

.subtle {
  color: var(--muted);
  margin-top: 6px;
}

.scoreboard {
  display: flex;
  gap: 16px;
}

.score {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 14px;
  border-radius: 12px;
  min-width: 96px;
  text-align: center;
}

.label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.board-wrap {
  position: relative;
  display: grid;
  place-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px;
}

#board {
  width: min(90vw, 480px);
  aspect-ratio: 1;
  border: 2px solid var(--ink);
  background: #f0eadf;
}

.status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--danger);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.status.show {
  opacity: 1;
}

.controls {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.buttons {
  display: flex;
  gap: 12px;
}

button {
  border: 1px solid var(--ink);
  background: var(--panel);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

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

.dpad {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.dpad-row {
  display: flex;
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 720px) {
  body {
    padding-top: 20px;
  }

  .scoreboard {
    width: 100%;
    justify-content: flex-start;
  }
}
