/* Neon Swarm - layout, touch controls */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  background: #000;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Courier New', monospace;
}
body {
  position: relative;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
/* The canvas is sized and positioned by js/game.js (layout()). Its backing
   store matches the device resolution, so pixels stay crisp at any size. */
#game {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  outline: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* System buttons (menu / sound) */
#sys {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  display: flex;
  gap: 8px;
  z-index: 6;
}
.sbtn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(64, 240, 255, 0.45);
  background: rgba(10, 4, 32, 0.6);
  color: #9ff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  opacity: 0.75;
  transition: opacity 0.15s, background 0.15s;
}
.sbtn:hover, .sbtn.on { opacity: 1; background: rgba(64, 240, 255, 0.2); }
.sbtn:focus-visible { outline: 2px solid #40f0ff; outline-offset: 2px; }
.sbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#b-sound .x { display: none; }
#b-sound.off { color: #f88; border-color: rgba(255, 120, 120, 0.5); }
#b-sound.off .x { display: inline; }
#b-sound.off .w { display: none; }

/* Touch controls - only shown on touch devices */
#touch {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: none;
  z-index: 5;
}
body.touch #touch { display: block; }
.tbtn {
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: var(--b, 64px);
  height: var(--b, 64px);
  border-radius: 50%;
  border: 2px solid rgba(64, 240, 255, 0.6);
  background: radial-gradient(circle at 50% 40%, rgba(64, 240, 255, 0.22), rgba(10, 4, 32, 0.55) 70%);
  color: #bff;
  font: bold 13px 'Courier New', monospace;
  letter-spacing: 1px;
  pointer-events: auto;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  box-shadow: 0 0 12px rgba(64, 240, 255, 0.25);
  -webkit-user-select: none;
  user-select: none;
}
.tbtn.on { background: rgba(64, 240, 255, 0.45); box-shadow: 0 0 22px rgba(64, 240, 255, 0.7); }
.tbtn svg { width: 46%; height: 46%; fill: currentColor; }
#t-left { left: calc(12px + env(safe-area-inset-left)); }
#t-right { left: calc(24px + var(--b, 64px) + env(safe-area-inset-left)); }
#t-fire {
  right: calc(12px + env(safe-area-inset-right));
  width: calc(var(--b, 64px) * 1.3);
  height: calc(var(--b, 64px) * 1.3);
  border-color: rgba(255, 80, 140, 0.75);
  color: #fcd;
  background: radial-gradient(circle at 50% 40%, rgba(255, 60, 140, 0.3), rgba(30, 4, 20, 0.55) 70%);
  box-shadow: 0 0 14px rgba(255, 60, 140, 0.3);
  font-size: 15px;
}
#t-fire.on { background: rgba(255, 60, 140, 0.5); box-shadow: 0 0 24px rgba(255, 60, 140, 0.8); }
#t-q, #t-e { width: calc(var(--b, 64px) * 0.82); height: calc(var(--b, 64px) * 0.82); font-size: 12px; }
#t-q {
  right: calc(24px + var(--b, 64px) * 1.3 + env(safe-area-inset-right));
  border-color: rgba(0, 255, 255, 0.7);
  color: #0ff;
}
#t-e {
  right: calc(12px + var(--b, 64px) * 0.24 + env(safe-area-inset-right));
  bottom: calc(26px + var(--b, 64px) * 1.3 + env(safe-area-inset-bottom));
  border-color: rgba(255, 102, 255, 0.75);
  color: #f6f;
  background: radial-gradient(circle at 50% 40%, rgba(255, 102, 255, 0.25), rgba(30, 4, 30, 0.55) 70%);
}
.tbtn small { font-size: 9px; opacity: 0.8; letter-spacing: 0; }

@media (prefers-reduced-motion: reduce) {
  .sbtn, .tbtn { transition: none; }
}
