:root {
  --ink: #17141d;
  --red: #e2322b;
  --paper: #f4f0e8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  background-image:
    radial-gradient(circle at 20% 10%, rgba(226, 50, 43, 0.12), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(90, 120, 200, 0.10), transparent 45%);
  color: var(--paper);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#wrap {
  position: relative;
  height: calc(100% - 28px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  box-shadow: 0 0 0 3px #000, 0 0 0 5px #2a2532, 0 20px 60px rgba(0, 0, 0, 0.6);
}

#help {
  height: 28px;
  line-height: 28px;
  text-align: center;
  font-size: 12px;
  color: #8a8494;
}
#help b { color: var(--paper); font-weight: 600; }

/* ---------------------------------------------------------- touch */
body.touch #wrap { height: 100%; }
body.touch #help { display: none; }
body.touch #screen { box-shadow: none; }

#touch[hidden] { display: none; }
#touch {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#touch .dpad,
#touch button {
  pointer-events: auto;
  touch-action: none;
}
#touch .dpad {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 150px;
  height: 76px;
  display: flex;
  border-radius: 38px;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.25);
}
#touch .dpad span {
  flex: 1;
  display: grid;
  place-items: center;
  font-size: 26px;
  color: rgba(255, 255, 255, 0.75);
}
#touch .btns {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  gap: 14px;
  align-items: flex-end;
}
#touch button {
  font: 700 14px ui-monospace, Menlo, monospace;
  color: #fff;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
}
#touch button.a { width: 84px; height: 84px; background: rgba(226, 50, 43, 0.55); }
#touch button.b { width: 66px; height: 66px; margin-bottom: 30px; }
#touch button.on { transform: scale(0.94); filter: brightness(1.4); }
#touch #tpause {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  right: max(10px, env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  font-size: 12px;
}
