* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  background: #0a1f1e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', monospace;
  overflow: hidden;
}

#mng-game-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1160px;
  background: #000;
  display: flex;
  flex-direction: column;
}

#mng-canvas-frame {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

#game-canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: #E5F1EF;
}

#mng-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #0F4C49;
  border-bottom: 2px solid #123332;
  flex: 0 0 auto;
}

#mng-toolbar-title {
  color: #F4FBFB;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 1px;
}

#mng-fullscreen-btn {
  background: rgba(21,94,89,0.85);
  color: #F4FBFB;
  border: 2px solid #123332;
  padding: 5px 9px;
  font-family: inherit;
  font-size: 10px;
  cursor: pointer;
  border-radius: 3px;
}

/* Touch controls: absolute overlay INSIDE the canvas frame, semi-transparent,
   so the canvas itself always gets the full available space. */
#mng-touch-controls {
  display: none;
  position: absolute;
  left: 0; right: 0; bottom: 0;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px;
  pointer-events: none; /* only the buttons themselves are interactive */
}

@media (pointer: coarse) {
  #mng-touch-controls { display: flex; }
}

#mng-dpad {
  display: grid;
  grid-template-columns: 40px 40px 40px;
  grid-template-rows: 40px 40px;
  gap: 3px;
  pointer-events: auto;
}
#mng-dpad button:nth-child(1) { grid-column: 2; grid-row: 1; }
#mng-dpad button:nth-child(2) { grid-column: 1; grid-row: 2; }
#mng-dpad button:nth-child(3) { grid-column: 3; grid-row: 2; }
#mng-dpad button:nth-child(4) { grid-column: 2; grid-row: 2; }

.mng-dpad-btn {
  background: rgba(21,94,89,0.55);
  color: rgba(244,251,251,0.9);
  border: 2px solid rgba(18,51,50,0.55);
  font-size: 15px;
  border-radius: 4px;
  backdrop-filter: blur(1px);
}

#mng-action-btn {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(3,166,166,0.55);
  color: rgba(244,251,251,0.95);
  border: 3px solid rgba(18,51,50,0.55);
  font-family: inherit;
  font-weight: bold;
  font-size: 11px;
  pointer-events: auto;
}

#mng-mobile-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,31,30,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#mng-mobile-warning-box {
  background: #0F4C49;
  border: 2px solid #123332;
  border-radius: 6px;
  padding: 20px;
  max-width: 340px;
  color: #F4FBFB;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}
#mng-mobile-dismiss {
  margin-top: 14px;
  background: #03A6A6;
  color: #F4FBFB;
  border: 2px solid #123332;
  padding: 8px 18px;
  font-family: inherit;
  font-weight: bold;
  font-size: 12px;
  border-radius: 4px;
}

.mng-mobile-icon { font-size: 32px; margin-bottom: 10px; }
