html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #05060a;
  overflow: hidden;
}

#wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #05060a;
}

#screen {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #05060a;
}

#namebox {
  position: fixed;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  display: none;
  width: 240px;
  padding: 8px 10px;
  background: #0a0d16;
  border: 2px solid #c8b06a;
  color: #e8ecf4;
  font-family: 'Galmuri9', 'Galmuri11', monospace;
  font-size: 18px;
  text-align: center;
  outline: none;
  letter-spacing: 2px;
}

#namebox::placeholder {
  color: #4a5268;
  letter-spacing: 1px;
}

body.touch {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

#touchui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  font-family: 'Galmuri9', sans-serif;
}

#touchui > * {
  pointer-events: auto;
}

#dpad {
  position: absolute;
  left: calc(8px + env(safe-area-inset-left));
  bottom: calc(12px + env(safe-area-inset-bottom));
  width: 112px;
  height: 112px;
  opacity: 0.55;
}

.dp {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 22, 36, 0.72);
  border: 1px solid #4a5474;
  color: #aab2c8;
  font-size: 13px;
}

.dp-u { left: 38px; top: 0; width: 36px; height: 38px; border-radius: 6px 6px 0 0; }
.dp-d { left: 38px; bottom: 0; width: 36px; height: 38px; border-radius: 0 0 6px 6px; }
.dp-l { left: 0; top: 38px; width: 38px; height: 36px; border-radius: 6px 0 0 6px; }
.dp-r { right: 0; top: 38px; width: 38px; height: 36px; border-radius: 0 6px 6px 0; }
.dp-c { left: 38px; top: 38px; width: 36px; height: 36px; background: rgba(18, 22, 36, 0.5); border: none; }

.tbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(18, 22, 36, 0.72);
  border: 1px solid #4a5474;
  color: #aab2c8;
  opacity: 0.6;
}

.tbtn.on {
  background: rgba(64, 74, 108, 0.85);
  opacity: 0.95;
}

#btnz {
  position: absolute;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-size: 22px;
  color: #e8c060;
  border-color: #6a5a34;
}

#btnx {
  position: absolute;
  right: calc(26px + env(safe-area-inset-right));
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 16px;
}
