body {
  font-family:
    'Courier New', 'Courier', 'Menlo', 'Monaco', 'Consolas', monospace;
  margin: 0;
  padding: 0;
  background: black;
  color: #2cd03a;

  /* Center the screen horizontally, align to top vertically */
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh; /* Full viewport height */
  width: 100vw; /* Full viewport width */
  overflow: hidden; /* Prevent body scrollbars */
  padding-top: 1rem; /* Small top margin */
}

#screen {
  /* Use viewport dimensions for responsive sizing */
  width: 98vw;
  height: calc(100vh - 1rem); /* Full height minus body padding */
  margin: 0;
  padding: 0;
  overflow: hidden; /* Hide scrollbars for clean appearance */

  /* Ensure monospace font for proper character sizing */
  font-family:
    'Courier New', 'Courier', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 16px; /* Base font size for character measurement */
  line-height: 1.1; /* Tight line spacing for ASCII art */

  /* Center text content horizontally */
  text-align: center;
  white-space: pre; /* Preserve spaces and newlines */
}

.inverted {
  background-color: #3fff00;
  color: black;
}

/* Mobile Controls */
.mobile-controls {
  display: none; /* Hidden by default */
  position: fixed;
  bottom: 5%;
  left: 5%;
  z-index: 1000;
  padding: 15px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
  touch-action: manipulation; /* Optimize touch response */
}

.mobile-controls.visible {
  display: block;
}

/* D-Pad (Left Side) */
.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.dpad-middle {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dpad-center {
  width: 50px;
  height: 50px;
}

.control-btn {
  width: 50px;
  height: 50px;
  font-size: 20px;
  font-weight: bold;
  border: 2px solid #2cd03a;
  background: rgba(44, 208, 58, 0.2);
  color: #2cd03a;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
  background: rgba(44, 208, 58, 0.5);
  transform: scale(0.95);
}

/* Action Buttons (Right Side) */
.action-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  position: fixed;
  bottom: 5%;
  right: 5%;
  padding: 15px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 10px;
}

.action-middle {
  display: flex;
  align-items: center;
  gap: 5px;
}

.action-center {
  width: 50px;
  height: 50px;
}

.action-btn {
  width: 50px;
  height: 50px;
  font-size: 18px;
  font-weight: bold;
  border: 2px solid #2cd03a;
  background: rgba(44, 208, 58, 0.2);
  color: #2cd03a;
  border-radius: 50%; /* Circular buttons for action buttons */
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.action-btn:active {
  background: rgba(44, 208, 58, 0.5);
  transform: scale(0.95);
}

/* Menu Button (Top Right) */
.menu-btn {
  display: none; /* Hidden by default */
  position: fixed;
  top: 5%;
  right: 5%;
  width: 45px;
  height: 45px;
  font-size: 24px;
  font-weight: bold;
  border: 2px solid #2cd03a;
  background: rgba(0, 0, 0, 0.7);
  color: #2cd03a;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  z-index: 1001;
}

.menu-btn.visible {
  display: block;
}

.menu-btn:active {
  background: rgba(44, 208, 58, 0.4);
  transform: scale(0.95);
}
