* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; font-family: 'Segoe UI', system-ui, sans-serif; color: #fff; }
#scene { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }

/* ---------- Màn hình bắt đầu ---------- */
#start-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a3a 0%, #05050f 70%);
}
.panel {
  background: rgba(20, 24, 56, 0.85);
  border: 2px solid #4dd0e1; border-radius: 20px;
  padding: 32px 28px; max-width: 480px; width: 90%;
  text-align: center; box-shadow: 0 0 40px rgba(77,208,225,0.4);
}
.panel h1 { font-size: 2.1rem; margin-bottom: 8px; }
.panel .sub { color: #b0bec5; margin-bottom: 22px; }
#name-input {
  width: 100%; padding: 14px; font-size: 1.1rem; text-align: center;
  border-radius: 12px; border: 2px solid #37474f; background: #0d1330; color: #fff;
  margin-bottom: 16px; outline: none;
}
#name-input:focus { border-color: #4dd0e1; }
#start-btn {
  width: 100%; padding: 16px; font-size: 1.3rem; font-weight: bold;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(90deg, #4dd0e1, #7c4dff); color: #fff;
  transition: transform .1s;
}
#start-btn:active { transform: scale(0.97); }
.help { margin-top: 20px; font-size: 0.82rem; color: #90a4ae; line-height: 1.7; text-align: left; }

#team-select { display: flex; gap: 8px; margin-bottom: 8px; }
.team-btn {
  flex: 1; padding: 10px 4px; font-size: 0.95rem; font-weight: bold; cursor: pointer;
  border: 2px solid #37474f; border-radius: 10px; background: #0d1330; color: #cfd8dc; transition: .12s;
}
.team-btn.sel { border-color: #4dd0e1; background: #15306b; color: #fff; box-shadow: 0 0 12px rgba(77,208,225,0.5); }
.team-note { font-size: 0.72rem; color: #78909c; margin-bottom: 14px; }

#mute-btn {
  pointer-events: auto; cursor: pointer; margin-bottom: 6px;
  background: rgba(0,0,0,0.4); border: 1px solid #455a64; border-radius: 8px;
  color: #fff; font-size: 1.1rem; padding: 4px 8px;
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#top-left { position: absolute; top: 14px; left: 14px; max-width: 46%; }
#planet-label { font-size: 1.3rem; font-weight: bold; text-shadow: 0 0 8px #000; }
#planet-facts { font-size: 0.82rem; color: #cfd8dc; margin-top: 4px; text-shadow: 0 0 6px #000; }

#top-right { position: absolute; top: 14px; right: 14px; text-align: right; }
#scoreboard { font-size: 0.9rem; background: rgba(0,0,0,0.4); border-radius: 10px; padding: 8px 12px; }
.score-row { padding: 2px 0; }
.score-row.me { font-weight: bold; }
.score-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

#minimap {
  position: absolute; bottom: 14px; right: 14px;
  background: rgba(5,8,24,0.7); border: 1px solid #37474f; border-radius: 10px;
}
#hp-bar {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  width: 220px; height: 22px; background: rgba(0,0,0,0.5);
  border: 1px solid #455a64; border-radius: 12px; overflow: hidden;
}
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #66bb6a, #43a047); transition: width .15s; }
#hp-text { position: absolute; inset: 0; text-align: center; line-height: 22px; font-size: 0.78rem; font-weight: bold; }
#speed-readout {
  position: absolute; bottom: 46px; left: 50%; transform: translateX(-50%);
  font-size: 0.78rem; color: #b0bec5; text-shadow: 0 0 6px #000;
}
#killfeed {
  position: absolute; top: 96px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  pointer-events: none; max-width: 90%;
}
.kill-entry {
  background: rgba(0,0,0,0.55); color: #fff; border-left: 3px solid #ff7043;
  padding: 5px 12px; border-radius: 8px; font-size: 0.9rem; font-weight: 600;
  text-shadow: 0 0 6px #000; transition: opacity .6s; white-space: nowrap;
}
#lock-hint {
  position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6); color: #fff; border: 1px solid #4dd0e1; border-radius: 12px;
  padding: 10px 18px; font-size: 0.95rem; pointer-events: none;
}
#respawn-msg {
  position: absolute; top: 45%; left: 50%; transform: translate(-50%,-50%);
  font-size: 1.5rem; font-weight: bold; color: #ff8a65; text-shadow: 0 0 12px #000;
  background: rgba(0,0,0,0.5); padding: 16px 24px; border-radius: 14px;
}

/* ---------- Crosshair (ngắm bắn) ---------- */
#hud::after {
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 26px; height: 26px; transform: translate(-50%,-50%);
  border: 2px solid rgba(255,255,255,0.6); border-radius: 50%;
  box-shadow: 0 0 6px rgba(0,0,0,0.8);
}

/* ---------- Hạ cánh & đi bộ ---------- */
#land-prompt {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  pointer-events: auto; cursor: pointer;
  background: linear-gradient(90deg, #43a047, #2e7d32); color: #fff;
  border: 2px solid #a5d6a7; border-radius: 14px;
  padding: 12px 22px; font-size: 1.05rem; font-weight: bold;
  box-shadow: 0 0 22px rgba(76,175,80,0.6); animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%,100% { transform: translateX(-50%) scale(1); } 50% { transform: translateX(-50%) scale(1.06); } }

#surface-bar {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  max-width: 92%; text-align: center;
  background: rgba(10,14,34,0.78); border: 1px solid #66bb6a; border-radius: 14px;
  padding: 10px 18px;
}
#surface-title { font-size: 1.25rem; font-weight: bold; }
#surface-facts { font-size: 0.82rem; color: #cfd8dc; margin: 4px 0 8px; }
#btn-takeoff {
  pointer-events: auto; cursor: pointer;
  background: linear-gradient(90deg, #4dd0e1, #7c4dff); color: #fff;
  border: none; border-radius: 10px; padding: 9px 18px; font-size: 1rem; font-weight: bold;
}
#btn-takeoff:active { transform: scale(0.96); }

/* Ẩn/hiện theo chế độ */
/* Khi đi bộ: vẫn hiện tâm ngắm, thanh máu, nút bắn (bắn nhau được); ẩn minimap/tốc độ/boost */
body.mode-surface #minimap,
body.mode-surface #speed-readout,
body.mode-surface #planet-label,
body.mode-surface #planet-facts,
body.mode-surface #btn-boost { display: none !important; }
body:not(.mode-surface) #surface-bar,
body:not(.mode-surface) #btn-jump { display: none !important; }

/* ---------- Điều khiển cảm ứng ---------- */
#touch-controls { position: absolute; inset: 0; pointer-events: none; }
#joystick {
  position: absolute; left: 30px; bottom: 30px;
  width: 130px; height: 130px; border-radius: 50%;
  background: rgba(255,255,255,0.08); border: 2px solid rgba(255,255,255,0.25);
  pointer-events: auto; touch-action: none;
}
#joystick-knob {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(77,208,225,0.7); border: 2px solid #fff;
}
#touch-buttons { position: absolute; right: 26px; bottom: 36px; display: flex; flex-direction: column; gap: 18px; pointer-events: auto; }
.touch-btn {
  width: 78px; height: 78px; border-radius: 50%; font-size: 2rem;
  border: 2px solid rgba(255,255,255,0.4); background: rgba(255,255,255,0.12);
  color: #fff; touch-action: none; user-select: none;
}
.touch-btn.fire { background: rgba(255,82,82,0.35); border-color: rgba(255,120,120,0.7); }
.touch-btn.jump { background: rgba(102,187,106,0.35); border-color: rgba(120,220,130,0.7); }
.touch-btn:active { transform: scale(0.92); }
