:root { --bar: 52px; --bg: #0b0614; --line: #2a1745; --muted: #cdb4f9; --dim: #6f639e; --yellow: #ffe066; }
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--muted);
  overflow: hidden; overscroll-behavior: none;
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.bar {
  height: var(--bar); display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
}
.bar a { color: var(--muted); text-decoration: none; font-weight: 600; }
.bar a:hover { color: #fff; }
.title { height: 14px; width: auto; image-rendering: pixelated; }
.stage {
  height: calc(100vh - var(--bar)); height: calc(100dvh - var(--bar));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 8px max(8px, env(safe-area-inset-bottom));
}
canvas {
  width: min(96vw, calc((100vh - var(--bar) - 56px) * 16 / 9));
  width: min(96vw, calc((100dvh - var(--bar) - 56px) * 16 / 9));
  height: auto; aspect-ratio: 16 / 9;
  image-rendering: pixelated; image-rendering: crisp-edges;
  border: 4px solid var(--line); border-radius: 10px;
  box-shadow: 0 0 70px rgba(123, 44, 191, .35);
  outline: none; touch-action: none;
}
canvas:focus-visible { border-color: #4c3579; }
.keys, .rotate { margin: 0; color: var(--dim); font-size: 13px; text-align: center; }
.rotate { display: none; color: var(--yellow); }
/* phones: no keyboard hint, and nudge portrait players to turn sideways */
@media (pointer: coarse) { .keys { display: none; } }
@media (orientation: portrait) and (max-width: 700px) {
  .rotate { display: block; }
  .bar .back span { display: none; }
}
/* landscape phones: give the game every pixel */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --bar: 38px; }
  .title { height: 11px; }
  .stage { padding-top: 4px; gap: 0; }
  canvas { width: min(96vw, calc((100dvh - var(--bar) - 12px) * 16 / 9)); border-width: 2px; }
  .keys { display: none; }
}
