html, body {
  margin: 0;
  background: #000000;
  overflow: hidden;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
canvas {
  display: inline-block;
}
/* Star Wars crawl effect */
#crawl-container {
  position: fixed;
  bottom: 20vh;
  left: 50%;
  width: 400px;
  height: 60vh;
  max-height: 500px;
  margin-left: -200px;
  perspective: 600px;
  opacity: 0;
  animation: fadein 1s ease-in forwards;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

/* Press Enter prompt */
#press-enter {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: monospace;
  font-size: 14px;
  color: #ffffff;
  text-align: center;
  z-index: 999;
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

.crawl {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
  animation: crawl 35s ease-in-out forwards;
  transform: rotateX(70deg) translateZ(0);
}

@keyframes crawl {
  0% {
    transform: rotateX(70deg) translateZ(0) translateY(400px);
    opacity: 1;
  }
  98% {
    opacity: 1;
  }
  100% {
    transform: rotateX(70deg) translateZ(0) translateY(-1200px);
    opacity: 0;
  }
}

.crawl h1, .crawl p {
  color: #ffd14a;
  text-align: center;
  font-family: monospace;
  margin: 0;
  padding: 10px;
}

.crawl h1 {
  font-size: 46px;
  font-weight: bold;
  margin-bottom: 20px;
  letter-spacing: 5px;
}

.crawl p {
  font-size: 33px;
  line-height: 1.6;
  letter-spacing: 2px;
}

/* Mobile controls */
#mobile-controls {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 500;
}

#bottom-controls {
  position: fixed;
  bottom: 15px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  pointer-events: auto;
  padding: 0 15px 0 0;
  box-sizing: border-box;
}

#dpad-slider {
  width: 200px;
  height: 90px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #ffd14a;
  border-radius: 45px;
  position: relative;
  margin-left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

#dpad-slider {
    position:relative;
    top: -10px;
    left: -10px;
}

#slider-indicator {
  width: 60px;
  height: 60px;
  background: rgba(255, 209, 74, 0.3);
  border: 2px solid #ffd14a;
  border-radius: 50%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  transition: left 0.1s ease-out, background 0.1s;
  pointer-events: none;
}

#dpad-slider.active #slider-indicator {
  background: rgba(255, 209, 74, 0.5);
}

.mobile-btn {
  border: 2px solid #ffd14a;
  background: rgba(0, 0, 0, 0.7);
  color: #ffd14a;
  font-size: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  transition: all 0.1s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-btn:active {
  background: rgba(255, 209, 74, 0.3);
  transform: scale(0.95);
}

.fire-btn {
  width: 80px;
  height: 80px;
  font-size: 32px;
  background: rgba(255, 209, 74, 0.2);
  margin-right: 40px;
}

.fire-btn {
    position:relative;
    top: -10px;
}

.fire-btn:active {
  background: rgba(255, 209, 74, 0.5);
}

/* Hide mobile controls on desktop by default */
@media (min-width: 769px) {
  #mobile-controls {
    display: none;
  }
  
  canvas {
    width: auto;
    height: 85vh;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
  }
  
  /* Desktop crawl positioning - centered on screen */
  #crawl-container {
    top: 15%;
    bottom: auto;
    height: 600px;
    max-height: 600px;
    margin-top: -200px;
  }
  
  .crawl {
    animation: crawl 40s ease-in-out forwards;
  }
}

/* Show mobile controls on touch devices / small screens */
@media (max-width: 768px) {
  html, body {
    align-items: flex-start;
    padding-top: 2px;
  }
  
  canvas {
    width: auto;
    height: 68vh;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
  }
  
  #bottom-controls {
    bottom: 3vh;
  }
  
  #dpad-slider {
    width: 260px;
    height: 98px;
    margin-left: 25px;
  }
  
  .fire-btn {
    width: 104px;
    height: 104px;
    font-size: 42px;
    margin-right: 20px;
  }
}