:root {
  color-scheme: dark;
  --ink: #f8fbff;
  --page: #162434;
  --panel: #24384b;
  --edge: #6f8196;
  --accent: #94d13d;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.14)),
    var(--page);
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
}

.shell {
  position: relative;
  width: min(100vw, calc(100dvh * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #0e1722;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #9fb4c8;
}

.audio-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid var(--edge);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel), transparent 6%);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22), 0 5px 0 rgba(20, 31, 45, 0.3);
  cursor: pointer;
  touch-action: manipulation;
}

.audio-toggle:disabled {
  display: none;
}

.sound-icon {
  position: relative;
  width: 22px;
  height: 20px;
}

.sound-icon::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  background: var(--ink);
  box-shadow: 7px -5px 0 1px var(--ink), 7px 5px 0 1px var(--ink);
  clip-path: polygon(0 18%, 45% 18%, 100% 0, 100% 100%, 45% 82%, 0 82%);
}

.sound-icon::after {
  content: "";
  position: absolute;
  right: 0;
  top: 2px;
  width: 9px;
  height: 16px;
  border: 3px solid var(--accent);
  border-left: 0;
  border-radius: 0 12px 12px 0;
}

.audio-toggle.muted {
  border-color: #d95f5f;
}

.audio-toggle.muted .sound-icon::after {
  right: -1px;
  top: 8px;
  width: 18px;
  height: 4px;
  border: 0;
  border-radius: 2px;
  background: #ff6b6b;
  transform: rotate(-35deg);
}

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

.touch-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 3px solid var(--edge);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel), transparent 8%);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22);
  pointer-events: auto;
  touch-action: none;
}

.touch-button.jump {
  grid-column: 5;
  width: 60px;
  height: 60px;
  border-color: var(--accent);
}

.touch-button.fire {
  grid-column: 4;
  align-self: center;
  width: 56px;
  height: 56px;
  border-color: #ffb43d;
}

.fire-orb {
  position: relative;
  width: 26px;
  height: 26px;
  border: 3px solid #fff4b8;
  border-radius: 50%;
  background:
    radial-gradient(circle at 65% 32%, #fff4b8 0 13%, transparent 14%),
    radial-gradient(circle at 42% 42%, #ffec6e 0 30%, #ff8f2f 31% 58%, #b92d2d 59%);
  box-shadow:
    0 0 0 3px #211f30,
    0 0 12px rgba(255, 163, 46, 0.7);
}

.fire-orb::after {
  content: "";
  position: absolute;
  right: -11px;
  top: 7px;
  width: 12px;
  height: 9px;
  background: #ff8f2f;
  box-shadow: 4px 0 0 #b92d2d;
  clip-path: polygon(0 50%, 100% 0, 76% 50%, 100% 100%);
}

.arrow {
  width: 0;
  height: 0;
  border-style: solid;
}

.arrow.left {
  border-width: 11px 15px 11px 0;
  border-color: transparent var(--ink) transparent transparent;
}

.arrow.right {
  border-width: 11px 0 11px 15px;
  border-color: transparent transparent transparent var(--ink);
}

.arrow.up {
  border-width: 0 13px 17px 13px;
  border-color: transparent transparent var(--ink) transparent;
}

@media (hover: none), (pointer: coarse) {
  .touch-controls {
    display: grid;
  }
}

@media (max-aspect-ratio: 16 / 9) {
  .shell {
    width: 100vw;
  }
}
