/* MEGA CORE — retro arcade shell styling */

:root {
  --bg: #0a0a12;
  --panel: #14142a;
  --accent: #29adff;
  --ink: #e0e0f0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background:
    radial-gradient(circle at 50% 0%, #1b1b3a 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  font-family: "Courier New", Courier, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

#game {
  /* Internal resolution is 256x224; scale up crisply for that pixel look. */
  width: 768px;
  height: 672px;
  max-width: 95vw;
  max-height: 82vh;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #000;
  border: 3px solid var(--accent);
  border-radius: 6px;
  box-shadow:
    0 0 0 4px #000,
    0 0 28px rgba(41, 173, 255, 0.45),
    0 12px 40px rgba(0, 0, 0, 0.6);
  outline: none;
}

#hint {
  font-size: 12px;
  letter-spacing: 0.5px;
  color: #8a8ac0;
  text-align: center;
  max-width: 768px;
  line-height: 1.6;
  user-select: none;
}

#hint::before {
  content: "▸ ";
  color: var(--accent);
}

/* ------------------------------------------------------------ on-screen controls */
#controls {
  position: fixed;
  inset: 0;
  pointer-events: none; /* only the buttons are interactive */
  z-index: 50;
  font-family: "Courier New", Courier, monospace;
}

#controls .ctl {
  pointer-events: auto;
  position: absolute; /* within .dpad / .actions; the menu button overrides to fixed */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #eaf2ff;
  background: rgba(20, 26, 54, 0.55);
  border: 2px solid rgba(120, 160, 255, 0.55);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  backdrop-filter: blur(2px);
}
#controls .ctl.active {
  background: rgba(41, 173, 255, 0.7);
  border-color: #bdf4ff;
  transform: scale(0.94);
}

/* Menu / pause button — visible on every device. */
.ctl-menu {
  position: fixed;
  top: 10px;
  right: 10px;
  width: 50px;
  height: 36px;
  font-size: 16px;
  letter-spacing: 2px;
}

/* The D-pad + action cluster only appear on touch (or when forced). */
.dpad, .actions { display: none; }
body.touch .dpad, body.force-touch .dpad,
body.touch .actions, body.force-touch .actions { display: block; }

.dpad { position: fixed; left: 18px; bottom: 22px; width: 168px; height: 168px; pointer-events: none; }
.dpad .ctl { width: 56px; height: 56px; font-size: 20px; }
.dpad .up    { left: 56px; top: 0; }
.dpad .down  { left: 56px; top: 112px; }
.dpad .left  { left: 0;   top: 56px; }
.dpad .right { left: 112px; top: 56px; }

.actions { position: fixed; right: 18px; bottom: 22px; width: 170px; height: 168px; pointer-events: none; }
.actions .ctl { border-radius: 50%; }
.actions .jump  { right: 0;   bottom: 0;   width: 74px; height: 74px; font-size: 26px; border-color: rgba(120,255,170,0.6); }
.actions .shoot { right: 80px; bottom: 18px; width: 66px; height: 66px; font-size: 24px; border-color: rgba(255,210,90,0.6); }
.actions .slide { right: 18px; bottom: 86px; width: 64px; height: 40px; border-radius: 12px; font-size: 12px; letter-spacing: 1px; border-color: rgba(190,160,255,0.6); }

/* On phones, give the canvas more vertical room and float controls over it. */
@media (pointer: coarse) {
  #frame { padding: 6px; gap: 6px; }
  #hint { display: none; }
  #game { max-height: 64vh; max-width: 99vw; }
}
