html, body {
  margin: 0;
  height: 100%;
  background: #06050f;
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 960px;
  height: 540px;
}

#stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#crt {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) calc(var(--px, 2px) * 3), rgba(0, 0, 0, 0.2) calc(var(--px, 2px) * 3), rgba(0, 0, 0, 0.2) calc(var(--px, 2px) * 4)),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.35) 100%);
}

#boot {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ecba46;
  font: bold 20px/1.3 monospace;
  letter-spacing: 2px;
  background: #06050f;
}

#rotate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: #ffeaa0;
  font: bold 20px/1.4 sans-serif;
  background: #06050f;
}

#rotate[hidden], #touch[hidden], #boot[hidden] { display: none; }

/* сенсорное управление */
#touch {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

#stick {
  position: absolute;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  width: 128px;
  height: 128px;
  border-radius: 50%;
  background: rgba(40, 60, 160, 0.25);
  border: 3px solid rgba(236, 186, 70, 0.55);
  pointer-events: auto;
}

#knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  background: rgba(236, 186, 70, 0.7);
  border: 3px solid #08081a;
}

#buttons {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 76px 76px;
  gap: 10px;
  pointer-events: auto;
}

.b {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 3px solid #08081a;
  background: rgba(40, 70, 168, 0.8);
  color: #fff;
  font: bold 14px/1 sans-serif;
  touch-action: none;
}

.b.small { height: 52px; border-radius: 26px; font-size: 13px; }
.b.red { background: rgba(200, 40, 60, 0.85); }
.b.gold { background: rgba(236, 186, 70, 0.85); color: #3a1c00; }
.b.hero { background: rgba(60, 140, 90, 0.85); }
.b.on { filter: brightness(1.5); transform: scale(0.94); }

#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: 16px;
  pointer-events: auto;
}
