:root {
  color-scheme: dark;
  --page: #132238;
  --frame: #101827;
  --paper: #f4d49b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow: hidden;
  background: radial-gradient(circle at 50% 10%, #4478b4 0, var(--page) 58%);
  font-family: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
}

body {
  display: grid;
  place-items: center;
}

.game-shell {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  aspect-ratio: 16 / 9;
  background: var(--frame);
  border: 0;
  outline: 6px solid #0b1020;
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .42);
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none;
}

.mute-button {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  min-width: 96px;
  height: 38px;
  border: 3px solid rgba(17, 25, 40, .82);
  border-radius: 8px;
  background: rgba(244, 212, 155, .9);
  color: #152039;
  font: 800 14px "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
  box-shadow: inset 0 -4px 0 rgba(93, 56, 24, .28);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.mute-button:active {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 rgba(93, 56, 24, .28);
}

.touch-controls {
  position: absolute;
  inset: auto 14px 14px 14px;
  display: grid;
  grid-template-columns: 58px 58px 1fr 74px;
  gap: 10px;
  pointer-events: none;
}

.touch-controls button {
  width: 58px;
  height: 58px;
  border: 3px solid rgba(17, 25, 40, .82);
  border-radius: 8px;
  background: rgba(244, 212, 155, .76);
  color: #152039;
  font-size: 0;
  font-weight: 900;
  box-shadow: inset 0 -5px 0 rgba(93, 56, 24, .28);
  pointer-events: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-controls button::before {
  font-size: 25px;
}

.touch-controls [data-control="left"]::before {
  content: "<";
}

.touch-controls [data-control="right"]::before {
  content: ">";
}

.touch-controls [data-control="jump"] {
  grid-column: 4;
  width: 74px;
  height: 74px;
}

.touch-controls [data-control="jump"]::before {
  content: "^";
}

.touch-controls button:active,
.touch-controls button.is-down {
  transform: translateY(2px);
  box-shadow: inset 0 -2px 0 rgba(93, 56, 24, .28);
}

@media (hover: hover) and (pointer: fine) {
  .touch-controls {
    opacity: 0;
  }
}

@media (max-width: 720px) {
  .game-shell {
    width: min(100vw, calc(100vh * 16 / 9));
    outline: 0;
    border-radius: 0;
  }
}
