:root {
  --bg: #fbfbfb;
  --fg: #1c1c1c;
  --dim: #7a7a7a;
  --rule: #e4e4e4;
  --frame: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131313;
    --fg: #eaeaea;
    --dim: #8b8b8b;
    --rule: #2a2a2a;
    --frame: #1b1b1b;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 40px;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Helvetica, Arial, sans-serif;
}

main { width: 100%; max-width: 900px; }

/* ---------- game ---------- */

.game-frame {
  position: relative;
  background: var(--frame);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 10px 10px 4px;
  overflow: hidden;
}

.game-frame canvas {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
  cursor: pointer;
}

.game-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 2px 6px;
  font-size: 12px;
  color: var(--dim);
}

.hud-key {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fg);
}

.touch-only { display: none; }

@media (hover: none) and (pointer: coarse) {
  .game-hud .keys { display: none; }
  .touch-only { display: inline; }
}
