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

body {
  background: #111;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
}

#gameCanvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#gameContainer {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
}

#gameCanvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100%;
  height: 100%;
}

/* Fullscreen Button - More prominent on mobile */
#fullscreenBtn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 50px;
  height: 50px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 2px solid rgba(255,255,255,0.4);
  color: white;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.4;
  transition: all 0.2s;
}

#fullscreenBtn:active {
  background: rgba(255, 215, 0, 0.3);
  border-color: #FFD700;
  transform: scale(0.9);
}

/* Show more clearly on mobile */
@media (hover: none) and (pointer: coarse) {
  #fullscreenBtn {
    opacity: 0.9;
    top: 15px;
    right: 15px;
    width: 60px;
    height: 60px;
    font-size: 28px;
    background: rgba(0,0,0,0.7);
    border-color: rgba(255,255,255,0.6);
  }
}

/* Mobile Controls - HIDDEN ON DESKTOP */
#mobileControls {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  z-index: 100;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Glassmorphism Base */
.dpad-btn, .jump-btn {
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.1s, border-color 0.1s;
}

#dpadContainer {
  position: absolute;
  bottom: 25px;
  left: 25px;
  bottom: calc(25px + env(safe-area-inset-bottom));
  left: calc(25px + env(safe-area-inset-left));
  width: 140px;
  height: 140px;
  pointer-events: none;
}

#dpadDisc {
  position: relative;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.1), transparent);
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: all;
}

.dpad-btn {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 20px;
  text-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.dpad-up    { top: 4px; left: 47px; }
.dpad-down  { bottom: 4px; left: 47px; }
.dpad-left  { left: 4px; top: 47px; }
.dpad-right { right: 4px; top: 47px; }

.dpad-btn.active, .jump-btn:active {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.2));
  border-color: #FFD700;
  transform: scale(0.85);
  box-shadow: 0 0 25px rgba(255, 215, 0, 0.5), inset 0 0 10px rgba(255, 215, 0, 0.3);
  color: #FFD700;
}

.jump-btn {
  position: absolute;
  bottom: 25px;
  right: 25px;
  bottom: calc(25px + env(safe-area-inset-bottom));
  right: calc(25px + env(safe-area-inset-right));
  width: 90px;
  height: 90px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: bold;
  border-color: rgba(255, 215, 0, 0.3);
}

/* Rotate Hint */
#rotateHint {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 1000;
  color: white;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hint-content {
  animation: bounce 2s infinite;
}

.hint-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(90deg); }
}

/* SHOW/HIDE logic */
@media (hover: none) and (pointer: coarse) {
  #mobileControls {
    display: block;
  }
}

@media (orientation: portrait) and (hover: none) and (pointer: coarse) {
  #rotateHint {
    display: flex;
  }
}

/* Rotate hint font */
#rotateHint p {
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  margin-top: 10px;
}

/* Auto-hide fullscreen button on desktop only */
@media (hover: hover) and (pointer: fine) {
  :fullscreen #fullscreenBtn {
    display: none;
  }
  :-webkit-full-screen #fullscreenBtn {
    display: none;
  }
}

