* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  overflow: hidden;
  background: #111;
  user-select: none;
}

#game-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

/* ---------- Menú ---------- */
#menu {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(77, 171, 247, 0.15), transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(255, 107, 107, 0.12), transparent 40%),
    radial-gradient(circle at 50% 30%, #1e3a5f, #0d1520 70%);
  z-index: 10;
  overflow-y: auto;
  padding: 24px;
  gap: 12px;
}

/* Fondo animado del menú (células flotantes) */
#menu-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 5;
  pointer-events: none;
}

/* Botones superiores: configuración y recarga */
.top-btns {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 20;
  display: flex;
  gap: 10px;
}

#gear-btn,
#recharge-top-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  border-radius: 50%;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.05));
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#gear-btn {
  width: 46px;
  height: 46px;
}

#recharge-top-btn {
  height: 46px;
  padding: 0 18px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  border-color: rgba(81, 207, 102, 0.4);
  background: linear-gradient(135deg, rgba(81, 207, 102, 0.25), rgba(81, 207, 102, 0.1));
  white-space: nowrap;
}

#recharge-top-btn:hover {
  transform: scale(1.05);
  background: linear-gradient(135deg, rgba(81, 207, 102, 0.4), rgba(81, 207, 102, 0.15));
  border-color: #51cf66;
  box-shadow: 0 4px 20px rgba(81, 207, 102, 0.35);
}

/* Modal de configuración (abre con el engranaje) */
#settings-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}

/* Modal de recarga de saldo */
#recharge-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 20px;
}

.settings-modal-box {
  width: min(420px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 28px;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(30, 45, 70, 0.95), rgba(13, 21, 32, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Botones de selección de sala */
.room-btn {
  width: 100%;
  padding: 13px 16px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.5px;
}

.room-btn:hover {
  transform: scale(1.03);
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.room-btn.selected {
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
  transform: scale(1.03);
}

#room-bs-btn {
  border-color: rgba(255, 212, 59, 0.5);
  background: linear-gradient(135deg, rgba(255, 212, 59, 0.15), rgba(255, 212, 59, 0.05));
}

#room-bs-btn:hover {
  background: linear-gradient(135deg, rgba(255, 212, 59, 0.3), rgba(255, 212, 59, 0.1));
  border-color: #ffd43b;
  box-shadow: 0 4px 20px rgba(255, 212, 59, 0.2);
}

#room-usd-btn {
  border-color: rgba(77, 171, 247, 0.5);
  background: linear-gradient(135deg, rgba(77, 171, 247, 0.15), rgba(77, 171, 247, 0.05));
}

#room-usd-btn:hover {
  background: linear-gradient(135deg, rgba(77, 171, 247, 0.3), rgba(77, 171, 247, 0.1));
  border-color: #4dabf7;
  box-shadow: 0 4px 20px rgba(77, 171, 247, 0.2);
}

#room-select {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Saldo de la cuenta (BS y USDT) */
#balance-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.balance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.balance-label {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.balance-value {
  font-size: 17px;
  font-weight: 800;
  color: #ffd43b;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

#balance-usdt {
  color: #4dabf7;
}

#recharge-btn {
  margin-top: 4px;
  border-color: rgba(255, 212, 59, 0.5);
  background: linear-gradient(135deg, rgba(255, 212, 59, 0.2), rgba(255, 212, 59, 0.08));
}

#recharge-btn:hover {
  background: linear-gradient(135deg, rgba(255, 212, 59, 0.35), rgba(255, 212, 59, 0.15));
  border-color: #ffd43b;
  box-shadow: 0 4px 20px rgba(255, 212, 59, 0.25);
}

/* Área de recarga de saldo (Bs. por pago móvil) */
.recharge-section-title {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  width: 100%;
  text-align: center;
}

.settings-modal-box input[type="number"],
.settings-modal-box input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
}

.settings-modal-box input:focus {
  border-color: #ffd43b;
}

.recharge-amounts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.recharge-amount {
  padding: 10px 8px;
  border-radius: 10px;
  border: 2px solid rgba(255, 212, 59, 0.4);
  background: linear-gradient(135deg, rgba(255, 212, 59, 0.15), rgba(255, 212, 59, 0.05));
  color: #ffd43b;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.recharge-amount:hover {
  transform: scale(1.04);
  background: linear-gradient(135deg, rgba(255, 212, 59, 0.3), rgba(255, 212, 59, 0.1));
  border-color: #ffd43b;
}

.recharge-amount.selected {
  background: linear-gradient(135deg, rgba(255, 212, 59, 0.35), rgba(255, 212, 59, 0.15));
  border-color: #ffd43b;
  box-shadow: 0 0 15px rgba(255, 212, 59, 0.25);
}

.payment-info {
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 212, 59, 0.4);
}

.payment-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffd43b;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.payment-info p {
  margin: 3px 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.payment-info b {
  color: #fff;
}

#recharge-submit {
  border-color: rgba(81, 207, 102, 0.5);
  background: linear-gradient(135deg, rgba(81, 207, 102, 0.2), rgba(81, 207, 102, 0.08));
}

#recharge-submit:hover {
  background: linear-gradient(135deg, rgba(81, 207, 102, 0.35), rgba(81, 207, 102, 0.15));
  border-color: #51cf66;
  box-shadow: 0 4px 20px rgba(81, 207, 102, 0.2);
}

#recharge-msg {
  font-size: 13px;
  min-height: 16px;
  margin: 0;
}

#recharge-history {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.recharge-history-title {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
}

.recharge-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.recharge-item .amt {
  font-weight: 800;
  color: #ffd43b;
}

.recharge-item .st {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}

.recharge-item .st.pending {
  background: rgba(255, 212, 59, 0.15);
  color: #ffd43b;
}

.recharge-item .st.approved {
  background: rgba(81, 207, 102, 0.15);
  color: #51cf66;
}

.recharge-item .st.rejected {
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
}

/* Sub-salas (BOLÍVARES: 10/50/500 BS, DÓLARES: 1$/5$) */
.subroom-select {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.subroom-btn {
  border-color: rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
}

.subroom-btn:hover {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.1));
  border-color: rgba(255, 255, 255, 0.6);
}

.back-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: transparent;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.logo {
  font-size: 56px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
  text-shadow: 0 0 30px rgba(255, 107, 107, 0.4), 0 4px 20px rgba(0, 0, 0, 0.5);
  background: linear-gradient(135deg, #fff, #ffd43b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  line-height: 1.1;
  animation: logo-glow 3s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 212, 59, 0.15));
}

@keyframes logo-glow {
  0%, 100% { filter: drop-shadow(0 0 20px rgba(255, 212, 59, 0.15)); }
  50% { filter: drop-shadow(0 0 35px rgba(255, 212, 59, 0.35)); }
}

.logo span {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: rgba(255, 255, 255, 0.6);
  font-size: 15px;
  letter-spacing: 1px;
  margin-bottom: 8px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Grid del menú: principal + lateral */
.menu-grid {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.menu-side {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-box {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  padding: 26px 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  width: min(400px, 92vw);
  max-width: 100%;
  position: relative;
  overflow: hidden;
}

/* Brillo superior sutil en las cajas */
.menu-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
}

.main-box {
  width: min(400px, 92vw);
}

.box-title {
  font-size: 16px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

#name-input {
  width: 100%;
  max-width: 280px;
  padding: 13px 18px;
  font-size: 18px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#name-input:focus {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2), 0 0 20px rgba(255, 107, 107, 0.1);
  background: rgba(0, 0, 0, 0.5);
}

.skin-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.skin-option {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.skin-option:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.skin-option.selected {
  border-color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.5), 0 4px 15px rgba(0, 0, 0, 0.4);
}

#play-btn {
  width: 100%;
  max-width: 280px;
  padding: 15px;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  letter-spacing: 1px;
  box-shadow: 0 6px 20px rgba(238, 90, 36, 0.3);
}

#play-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 35px rgba(238, 90, 36, 0.5);
  filter: brightness(1.1);
}

#play-btn:active:not(:disabled) {
  transform: translateY(0);
}

#play-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.hint {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
    text-align: center;
    line-height: 1.5;
  }

/* ---------- Joystick virtual (móvil) ---------- */
#joystick-base {
  position: fixed;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.35);
  pointer-events: none;
  z-index: 6;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

#joystick-thumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2));
  border: 2px solid rgba(255, 255, 255, 0.6);
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ---------- Inspector en tiempo real ---------- */
/* Contenedor superior izquierdo: FPS + botón inspector */
#top-left {
  position: absolute;
  top: 20px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 50;
}

#inspector-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(20, 30, 45, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 50;
  user-select: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

#inspector-btn:hover {
  background: rgba(40, 60, 85, 0.9);
}

#menu-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 30, 45, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  z-index: 50;
  user-select: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, background 0.15s;
}

#menu-btn:hover {
  background: rgba(230, 80, 80, 0.9);
  transform: scale(1.08);
}

#inspector-panel {
  position: fixed;
  top: 60px;
  left: 20px;
  width: 280px;
  max-height: 70vh;
  overflow-y: auto;
  background: rgba(10, 15, 25, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 12px;
  color: #fff;
  font-family: monospace;
  font-size: 12px;
  z-index: 50;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
}

.insp-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #ffd43b;
}

.insp-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.insp-row b.ok { color: #51cf66; }
.insp-row b.warn { color: #ffd43b; }
.insp-row b.bad { color: #ff6b6b; }

.insp-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 700;
  color: #4dabf7;
}

.insp-empty {
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 0;
}

.insp-drop {
  padding: 3px 0;
  color: #ffd43b;
}

.insp-reason {
  display: block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}

.insp-error {
  padding: 3px 0;
  color: #ff6b6b;
  word-break: break-word;
}

/* ---------- Overlay: girar dispositivo (móvil) ---------- */
#rotate-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, #1e3a5f, #0d1520 70%);
}

.rotate-box {
  text-align: center;
  color: #fff;
  padding: 24px;
}

.rotate-icon {
  font-size: 72px;
  animation: rotate-hint 1.6s ease-in-out infinite;
  margin-bottom: 16px;
}

.rotate-box h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.rotate-box p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 15px;
}

@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

/* ---------- Toggle de música ---------- */
.sound-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}

.sound-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sound-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #ffd43b;
  cursor: pointer;
}

/* Selección de modo de juego */
.mode-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  width: 100%;
  max-width: 280px;
}

.mode-btn {
  flex: 1;
  padding: 11px 14px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}

.mode-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.15);
}

.mode-btn.selected {
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(238, 90, 36, 0.4);
}

.mode-btn.locked {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
}

.mode-btn.locked:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.08);
}

/* Registro / inicio de sesión */
#auth-box {
  width: min(320px, 92vw);
  padding: 20px 22px;
  align-items: stretch;
}

#auth-box input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  outline: none;
  margin-bottom: 10px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

#auth-box input:focus {
  border-color: #4dabf7;
  box-shadow: 0 0 0 3px rgba(77, 171, 247, 0.2), 0 0 20px rgba(77, 171, 247, 0.1);
  background: rgba(0, 0, 0, 0.5);
}

.auth-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.auth-btns button {
  flex: 1;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}

.auth-btns button:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#auth-register-btn {
  background: linear-gradient(135deg, #4dabf7, #1971c2) !important;
  border-color: transparent !important;
  box-shadow: 0 4px 15px rgba(77, 171, 247, 0.25);
}

#auth-register-btn:hover {
  box-shadow: 0 6px 20px rgba(77, 171, 247, 0.4);
  filter: brightness(1.1);
}

#auth-msg {
  margin-top: 10px;
  font-size: 13px;
  text-align: center;
  min-height: 18px;
}

#auth-welcome {
  color: #fff;
  font-size: 16px;
  text-align: center;
  margin-bottom: 10px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

#auth-logout-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 107, 107, 0.2);
  border: 2px solid rgba(255, 107, 107, 0.4);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

#auth-logout-btn:hover {
  background: rgba(255, 107, 107, 0.35);
  box-shadow: 0 4px 15px rgba(255, 107, 107, 0.2);
}

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#score {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 30px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 22px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(6px);
}

/* Contenedor del puntaje + dinero */
#score-wrap {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 20;
}

#score-wrap #score {
  position: static;
  transform: none;
}

/* Dinero obtenido (al lado del puntaje) */
#money {
  font-size: 22px;
  font-weight: 800;
  color: #ffd43b;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 212, 59, 0.4);
  backdrop-filter: blur(6px);
  white-space: nowrap;
}

/* Contador de FPS */
#fps-counter {
  font-size: 13px;
  font-weight: 700;
  color: #51cf66;
  background: rgba(0, 0, 0, 0.5);
  padding: 4px 10px;
  border-radius: 10px;
  border: 1px solid rgba(81, 207, 102, 0.3);
  font-family: monospace;
  pointer-events: none;
  z-index: 5;
}

#leaderboard {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 190px;
  color: #fff;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

#leaderboard h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #ffd43b;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.lb-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 3px 0;
}

.lb-row.me {
  color: #ffd43b;
  font-weight: 700;
}

#minimap-wrap {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 160px;
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

#minimap {
  width: 100%;
  height: 100%;
}

/* ---------- Botones de zoom ---------- */
#zoom-btns {
  position: absolute;
  bottom: 200px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

#zoom-in-btn,
#zoom-out-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(20, 30, 45, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, background 0.15s;
  backdrop-filter: blur(4px);
}

#zoom-in-btn:hover,
#zoom-out-btn:hover {
  background: rgba(40, 60, 85, 0.85);
  transform: scale(1.08);
}

#zoom-in-btn:active,
#zoom-out-btn:active {
  transform: scale(0.92);
}

/* ---------- Botón de división (móvil) ---------- */
#split-btn {
  position: absolute;
  bottom: 280px;
  right: 30px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #74c0fc, #1971c2);
  border: 3px solid rgba(255, 255, 255, 0.6);
  display: none; /* solo visible en dispositivos táctiles */
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, opacity 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Mostrar el botón de división solo en pantallas táctiles (móvil/tablet) */
@media (hover: none) and (pointer: coarse) {
  #split-btn {
    display: flex;
  }
}

#split-btn:hover {
  transform: scale(1.08);
}

#split-btn:active {
  transform: scale(0.92);
}

#split-icon {
  font-size: 30px;
  line-height: 1;
}

/* ---------- Botón de turbo ---------- */
#turbo-btn {
  position: absolute;
  bottom: 200px;
  right: 30px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffd43b, #f59f00);
  border: 3px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, opacity 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#turbo-btn:hover {
  transform: scale(1.08);
}

#turbo-btn.active {
  background: radial-gradient(circle at 35% 35%, #ffe066, #ff922b);
  box-shadow: 0 0 25px rgba(255, 217, 59, 0.8);
  animation: turbo-pulse 0.5s infinite alternate;
}

#turbo-btn.cooldown {
  opacity: 0.5;
  cursor: not-allowed;
}

#turbo-icon {
  font-size: 34px;
  line-height: 1;
}

#turbo-cooldown {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

@keyframes turbo-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

/* ---------- Botón del poder divisor ---------- */
#splitter-btn {
  position: absolute;
  bottom: 120px;
  right: 30px;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8787, #c92a2a);
  border: 3px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s, opacity 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#splitter-btn:hover {
  transform: scale(1.08);
}

#splitter-btn.active {
  background: radial-gradient(circle at 35% 35%, #ffc9c9, #e03131);
  box-shadow: 0 0 25px rgba(255, 107, 107, 0.8);
  animation: splitter-pulse 0.6s infinite alternate;
}

#splitter-btn.cooldown {
  opacity: 0.4;
  cursor: not-allowed;
}

#splitter-icon {
  font-size: 30px;
  line-height: 1;
}

/* ---------- Botón del centinela ---------- */
#sentinel-btn {
  position: absolute;
  bottom: 120px;
  right: 115px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #74c0fc, #1971c2);
  border: 3px solid rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#sentinel-btn:hover {
  transform: scale(1.08);
}

#sentinel-btn.active {
  box-shadow: 0 0 25px rgba(77, 171, 247, 0.8);
  animation: splitter-pulse 0.6s infinite alternate;
}

#sentinel-icon {
  font-size: 26px;
  line-height: 1;
}

#sentinel-btn.disabled {
  filter: grayscale(0.7) brightness(0.6);
  pointer-events: none;
}

#sentinel-cooldown {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

#splitter-status {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

/* Icono de la pasiva: misil teledirigido (aparece con 5+ misiles).
   Se muestra FUERA del botón principal, arriba a la derecha. */
#guided-icon {
  position: absolute;
  top: -26px;
  right: -22px;
  width: 30px;
  height: 30px;
  font-size: 17px;
  line-height: 30px;
  text-align: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3bf, #ffd43b);
  border: 2px solid #e8590c;
  box-shadow: 0 0 12px rgba(255, 212, 59, 0.9);
  filter: sepia(1) saturate(3) hue-rotate(-10deg);
  animation: guided-pulse 0.8s infinite alternate;
  pointer-events: none;
  z-index: 7;
}

@keyframes guided-pulse {
  from { transform: scale(1) rotate(-15deg); }
  to { transform: scale(1.2) rotate(15deg); }
}

@keyframes splitter-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.12); }
}

/* ---------- Indicador de enfriamiento de fusión ---------- */
#merge-cooldown {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.75);
  color: #ffd43b;
  font-size: 15px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 20px;
  border: 2px solid rgba(255, 212, 59, 0.5);
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  animation: merge-fade 0.3s ease;
}

@keyframes merge-fade {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Muerte ---------- */
#death-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  z-index: 8;
  color: #fff;
  gap: 16px;
}

#death-screen h2 {
  font-size: 40px;
}

#death-screen p {
  font-size: 20px;
  color: rgba(255, 255, 255, 0.8);
}

#respawn-btn {
  padding: 12px 30px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

/* ---------- Desconexión (reanudar partida) ---------- */
#disconnect-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  z-index: 60;
  color: #fff;
  gap: 16px;
}

#disconnect-screen h2 {
  font-size: 36px;
  color: #ffd43b;
}

#disconnect-screen p {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.8);
}

#resume-btn {
  padding: 14px 36px;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #51cf66, #2b8a3e);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(81, 207, 102, 0.4);
}

#resume-btn:hover {
  transform: scale(1.05);
}

/* ---------- Responsive ---------- */
/* Pantallas medianas (tablets) */
@media (max-width: 768px) {
  .logo {
    font-size: 48px;
    margin-bottom: 6px;
  }

  .menu-box {
    padding: 22px 24px;
    gap: 14px;
      }

  /* HUD: reducir tamaños y reposicionar */
  #score {
    font-size: 22px;
    top: 12px;
  }

  #leaderboard {
    top: 12px;
    right: 12px;
    min-width: 150px;
    font-size: 12px;
    padding: 10px 12px;
  }

  #minimap-wrap {
    width: 120px;
    height: 120px;
    bottom: 12px;
    left: 12px;
  }

  #zoom-btns {
    bottom: 150px;
    left: 12px;
    gap: 8px;
  }

  #zoom-in-btn,
  #zoom-out-btn {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  #turbo-btn {
    width: 56px;
    height: 56px;
    bottom: 150px;
    right: 20px;
  }

  #split-btn {
    width: 56px;
    height: 56px;
    bottom: 210px;
    right: 20px;
  }

  #split-icon {
    font-size: 24px;
  }

  #turbo-icon {
    font-size: 26px;
  }

  #splitter-btn {
    width: 56px;
    height: 56px;
    bottom: 90px;
    right: 20px;
  }

  #splitter-icon {
    font-size: 24px;
  }
}

/* Pantallas pequeñas (móviles) */
@media (max-width: 480px) {
  .logo {
    font-size: 36px;
  }

  .menu-box {
    padding: 16px 16px;
    gap: 12px;
    border-radius: 12px;
  }

  #name-input {
    font-size: 16px;
    padding: 10px 12px;
  }

  #play-btn {
    font-size: 17px;
    padding: 12px;
  }

  .mode-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  .skin-option {
    width: 32px;
    height: 32px;
  }

  .hint {
    font-size: 11px;
      }

  #auth-box {
    padding: 14px 16px;
  }

  #auth-box input {
    font-size: 13px;
    padding: 8px 10px;
  }

  .auth-btns button {
    font-size: 12px;
    padding: 8px;
  }

  /* HUD móvil */
  #score {
    font-size: 15px;
    padding: 4px 14px;
    top: 10px;
  }

  #leaderboard {
    min-width: 100px;
    font-size: 10px;
    padding: 6px 8px;
    top: 10px;
  }

  #minimap-wrap {
    width: 70px;
    height: 70px;
    bottom: 10px;
    left: 10px;
    border-radius: 8px;
  }

  #zoom-btns {
    bottom: 90px;
    left: 8px;
    gap: 5px;
  }

  #zoom-in-btn,
  #zoom-out-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
    border-width: 1.5px;
  }

  #turbo-btn {
    width: 40px;
    height: 40px;
    bottom: 100px;
    right: 10px;
    border-width: 2px;
  }

  #split-btn {
    width: 40px;
    height: 40px;
    bottom: 145px;
    right: 10px;
    border-width: 2px;
  }

  #split-icon {
    font-size: 17px;
  }

  #turbo-icon {
    font-size: 18px;
  }

  #splitter-btn {
    width: 40px;
    height: 40px;
    bottom: 55px;
    right: 10px;
    border-width: 2px;
  }

  #splitter-icon {
    font-size: 17px;
  }

  #splitter-status {
    font-size: 10px;
    padding: 1px 5px;
    bottom: -6px;
  }

  #turbo-cooldown {
    font-size: 10px;
    padding: 1px 5px;
    bottom: -6px;
  }

  #merge-cooldown {
    font-size: 11px;
    padding: 4px 10px;
    bottom: 10px;
  }

  /* Joystick más pequeño en móvil */
  #joystick-base {
    width: 100px;
    height: 100px;
  }

  #joystick-thumb {
    width: 44px;
    height: 44px;
  }
}

/* Modo horizontal (landscape): pantalla baja, botones pegados al borde inferior.
   Va al final para sobrescribir las media queries de max-width cuando aplica. */
@media (orientation: landscape) and (max-height: 500px) {
  #turbo-btn {
    bottom: 90px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  #split-btn {
    bottom: 150px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  #splitter-btn {
    bottom: 30px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  #zoom-btns {
    bottom: 90px;
    left: 12px;
    gap: 6px;
  }

  #zoom-in-btn,
  #zoom-out-btn {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  #minimap-wrap {
    width: 90px;
    height: 90px;
    bottom: 10px;
    left: 10px;
  }

  #turbo-icon {
    font-size: 26px;
  }

  #split-icon {
    font-size: 24px;
  }

  #splitter-icon {
    font-size: 24px;
  }

  #score {
    font-size: 16px;
    top: 8px;
  }

  #leaderboard {
    top: 8px;
    font-size: 10px;
    padding: 6px 8px;
    min-width: 100px;
  }

  /* Joystick compacto en landscape */
  #joystick-base {
    width: 90px;
    height: 90px;
  }

  #joystick-thumb {
    width: 40px;
    height: 40px;
  }
}