* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: #1a1a1a;
  color: #fff;
  font-family: 'Courier New', Courier, monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-color: #111;
  transition: transform 0.5s ease;
}

#game-container.inverted-view {
  transform: rotate(180deg);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: 20px;
}

.inverted-view #ui-layer {
  transform: rotate(180deg);
}

#height-meter-container {
  width: 10px;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  position: absolute;
  right: 10px;
  top: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#height-meter-fill {
  width: 100%;
  height: 0%;
  background-color: #ffaa00;
  transition: height 0.1s linear;
}

#stats {
  font-size: 16px;
  text-shadow: 1px 1px 2px #000;
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
}

.overlay.hidden {
  display: none;
}

.inverted-view .overlay {
  transform: rotate(180deg);
}

h1 {
  font-size: 48px;
  margin-bottom: 30px;
  color: #ffcc00;
  text-shadow: 2px 2px 0px #aa6600;
  letter-spacing: 2px;
}

button {
  background-color: #ffaa00;
  color: #111;
  border: none;
  padding: 15px 30px;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  margin-bottom: 20px;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #ffcc00;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}

input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Mobile Controls */
#mobile-controls {
  position: absolute;
  bottom: 30px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 30px;
  box-sizing: border-box;
  pointer-events: none;
  z-index: 50;
}

#dpad {
  display: flex;
  gap: 20px;
}

.control-btn {
  pointer-events: auto;
  width: 70px;
  height: 70px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.8);
  font-size: 30px;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
  background-color: rgba(255, 255, 255, 0.3);
}

@media (hover: hover) and (pointer: fine) {
  #mobile-controls {
    display: none;
  }
}
