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

html, body {
  width: 100%;
  height: 100%;
  background: #000;
  overflow: hidden;
  touch-action: none;
  font-family: 'Segoe UI', Arial, sans-serif;
}

#game-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

#game {
  height: 100%;
  width: auto;
  max-width: 100%;
  aspect-ratio: 9 / 16;
  image-rendering: pixelated;
  background: #87ceeb;
  display: block;
}

@media (min-aspect-ratio: 9/16) {
  #game {
    width: auto;
    height: 100%;
  }
}
@media (max-aspect-ratio: 9/16) {
  #game {
    width: 100%;
    height: auto;
  }
}

#loading {
  position: absolute;
  inset: 0;
  background: #0b0b12;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.loading-box {
  text-align: center;
  color: #fff;
}

.loading-icon {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  animation: spin 1.4s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-title {
  font-size: 28px;
  font-weight: 700;
  margin-top: 16px;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #000;
}

.loading-bar-track {
  width: 260px;
  height: 14px;
  background: #222;
  border: 2px solid #555;
  border-radius: 8px;
  margin: 18px auto 8px;
  overflow: hidden;
}

.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #5ad1ff, #2f8fd0);
  transition: width 0.15s ease-out;
}

#loading-text {
  font-size: 14px;
  opacity: 0.8;
}

#controls {
  position: absolute;
  bottom: 24px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 10;
}

.ctrl-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: rgba(200, 40, 30, 0.85);
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.ctrl-btn:active {
  transform: scale(0.92);
  background: rgba(160, 25, 20, 0.9);
}

.ctrl-btn.mega {
  background: rgba(255, 145, 0, 0.9);
  font-size: 14px;
}
