:root {
  --ink: #171717;
  --paper: #f8f8f8;
  --line: #2a2a2a;
  --muted: #555;
  --btn: #202020;
  --btn-ink: #fff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  font-family: "Courier New", "SFMono-Regular", Menlo, monospace;
  background: var(--paper);
  color: var(--ink);
}

body {
  display: grid;
  place-items: center;
  touch-action: none;
}

.app-shell {
  width: min(100vw, 560px);
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
}

.hud {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.hud-pill {
  text-align: center;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 7px 8px;
  font-size: clamp(13px, 3vw, 15px);
  font-weight: 700;
}

.stage-wrap {
  position: relative;
  min-height: 0;
  border: 2px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  text-align: center;
  gap: 12px;
  padding: 20px;
  background: rgb(255 255 255 / 88%);
}

.overlay.show {
  display: grid;
}

.overlay h1 {
  margin: 0;
  font-size: clamp(26px, 7vw, 40px);
  letter-spacing: 0.02em;
}

.overlay p {
  margin: 0;
  max-width: 290px;
  font-size: clamp(14px, 3.4vw, 17px);
  color: var(--muted);
  line-height: 1.4;
}

.overlay button,
.controls button {
  border: 2px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.overlay button {
  padding: 10px 18px;
  background: var(--btn);
  color: var(--btn-ink);
  font-size: 15px;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.controls button {
  padding: 14px 10px;
  background: #fff;
  color: var(--ink);
  font-size: clamp(16px, 4.4vw, 18px);
}

.controls button:active,
.overlay button:active {
  transform: translateY(1px);
}

.status-row {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #404040;
  pointer-events: none;
}
