* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #1c1d1f; color: #cfd2cc;
  font: 15px/1.45 -apple-system, system-ui, sans-serif; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; }

#phone { height: 100%; display: grid; gap: 18px; touch-action: none;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  grid-template: "screen screen" auto "pad actions" 1fr / 1fr 1fr; align-items: center; }
@media (orientation: landscape) {
  #phone { grid-template: "pad screen actions" 1fr / 1fr auto 1fr; }
}

#bezel { grid-area: screen; position: relative; justify-self: center;
  background: #0d0e0f; padding: 10px; border-radius: 10px; box-shadow: inset 0 0 0 1px #2c2e31; }
canvas { display: block; image-rendering: pixelated; background: #d8e0d0;
  width: min(calc(100vw - 52px), 600px); aspect-ratio: 3 / 2; }
@media (orientation: landscape) {
  /* what the two 168 px button clusters, the gaps, the page's sides and the bezel leave */
  canvas { width: min(calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right)) - 412px),
                      calc((100vh - 60px) * 1.5), 600px); }
}
#message { position: absolute; inset: 10px; display: flex; align-items: center; justify-content: center;
  padding: 12px; text-align: center; background: rgb(13 14 15 / 0.85); color: #e8e8e0; font-size: 13px; }
#message[hidden] { display: none; }

.cluster { position: relative; justify-self: center; }
button { font: inherit; color: #cfd2cc; background: #34373b; border: 0; touch-action: none;
  box-shadow: 0 3px 0 #141516; }
button.held { background: #5b6066; transform: translateY(2px); box-shadow: 0 1px 0 #141516; }

#pad { grid-area: pad; width: 168px; height: 168px; }
#pad button { position: absolute; width: 60px; height: 60px; border-radius: 12px; }
#pad .up { left: 54px; top: 0; }
#pad .down { left: 54px; bottom: 0; }
#pad .left { left: 0; top: 54px; }
#pad .right { right: 0; top: 54px; }
#pad button::after { content: ""; position: absolute; inset: 0; margin: auto; width: 0; height: 0;
  border: 9px solid transparent; }
#pad .up::after { border-bottom-color: #9da2a6; transform: translateY(-4px); }
#pad .down::after { border-top-color: #9da2a6; transform: translateY(4px); }
#pad .left::after { border-right-color: #9da2a6; transform: translateX(-4px); }
#pad .right::after { border-left-color: #9da2a6; transform: translateX(4px); }

#actions { grid-area: actions; width: 168px; height: 168px; }
#actions button { position: absolute; border-radius: 50%; font-weight: 600; }
#actions .fire { width: 76px; height: 76px; right: 0; top: 30px; font-size: 22px; background: #6b3a35; }
#actions .fire.held { background: #8f4c45; }
#actions .ok { width: 58px; height: 58px; left: 4px; top: 70px; }
#actions .back { width: 46px; height: 46px; left: 20px; top: 0; font-size: 14px; }
