* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #87CEEB; color: #fff; font-family: monospace, "Microsoft YaHei";
  overflow: hidden; height: 100vh; touch-action: none;
}

/* 准星 */
#crosshair {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 20px; height: 20px; pointer-events: none; z-index: 10;
  display: none; 
}
#crosshair::before, #crosshair::after {
  content: ''; position: absolute; background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 2px #000;
}
#crosshair::before { top: 9px; left: 0; width: 20px; height: 2px; }
#crosshair::after { top: 0; left: 9px; width: 2px; height: 20px; }

/* FPS 显示 */
#fpsDisplay {
  position: absolute; top: 20px; left: 20px; z-index: 99;
  background: rgba(0,0,0,0.5); color: #0ff; padding: 6px 12px;
  font-size: 14px; font-weight: bold; border-radius: 4px;
  border: 1px solid #0ff; pointer-events: none;
}

#ui {
  position: absolute; top: 20px; right: 20px; z-index: 10;
  background: rgba(0,0,0,0.5); padding: 15px; border: 1px solid rgba(255,255,255,0.3);
  color: #fff; font-size: 14px; line-height: 1.6; pointer-events: none;
  border-radius: 8px; text-shadow: 1px 1px 2px #000;
}

#mobileControls {
  position: absolute; bottom: 20px; left: 0; width: 100%;
  display: flex; justify-content: space-between; padding: 0 20px; z-index: 10; pointer-events: none;
}

.ctrl-btn {
  width: 55px; height: 55px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.2); border: 2px solid #fff;
  color: #fff; font-size: 20px; display: flex; justify-content: center; align-items: center;
  pointer-events: auto; user-select: none; -webkit-user-select: none;
  text-shadow: 1px 1px 2px #000; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  font-weight: bold;
}
.ctrl-btn:active { background: rgba(255, 255, 255, 0.5); }

.d-pad { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.dpad-row { display: flex; gap: 5px; }
.dpad-btn { width: 50px; height: 50px; font-size: 18px; }

.action-group { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.action-row { display: flex; gap: 10px; }

#mEsc {
  position: absolute; top: 20px; left: 20px; z-index: 100;
  width: 50px; height: 50px; font-size: 14px;
  border-color: #ff4444; color: #ff4444; display: none;
}

#hotbar {
  position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 10px; z-index: 20;
}
.slot {
  width: 50px; height: 50px; background: rgba(0,0,0,0.5); border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px; display: flex; justify-content: center; align-items: center;
  font-size: 24px; cursor: pointer; pointer-events: auto; user-select: none;
  transition: all 0.2s;
}
.slot:hover { background: rgba(255,255,255,0.2); }
.slot.active {
  border-color: #0ff; box-shadow: 0 0 15px #0ff; background: rgba(0, 255, 255, 0.2);
  transform: scale(1.1);
}

#overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(5, 5, 10, 0.8); display: flex; flex-direction: column;
  justify-content: center; align-items: center; z-index: 100; text-align: center;
  backdrop-filter: blur(5px);
}
#overlay h1 { color: #fff; font-size: 2.5em; text-shadow: 0 0 20px #0ff; margin-bottom: 20px; }
#overlay p { color: #ccc; margin-bottom: 10px; line-height: 1.8; }
.btn {
  background: #fff; color: #000; border: none; padding: 15px 40px;
  font-size: 1.2em; font-weight: bold; border-radius: 8px; cursor: pointer;
  box-shadow: 0 0 20px rgba(255,255,255,0.4); font-family: inherit;
  display: inline-flex; justify-content: center; align-items: center;
}
.btn:hover { background: #0ff; box-shadow: 0 0 30px #0ff; }

#respawnMsg {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  color: #ff4444; font-size: 2em; font-weight: bold; text-shadow: 0 0 10px #ff4444, 1px 1px 2px #000;
  pointer-events: none; opacity: 0; transition: opacity 0.5s; z-index: 50;
  text-align: center;
}

#rotateOverlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: #05050a; display: none; flex-direction: column;
  justify-content: center; align-items: center; z-index: 9999; text-align: center;
}
.rotate-icon {
  font-size: 80px; margin-bottom: 20px; animation: rotateAnim 2s infinite ease-in-out;
}
#rotateOverlay h2 { color: #0ff; font-size: 2em; margin-bottom: 10px; }
#rotateOverlay p { color: #888; }
@keyframes rotateAnim {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

@media (max-width: 768px) {
  #hotbar { bottom: 150px; }
  .slot { width: 40px; height: 40px; font-size: 20px; }
  #fpsDisplay { top: 15px; left: 15px; font-size: 12px; padding: 4px 8px; }
}