/* ============================================================
   VILLA Z — Estilos de juego (POIs, Inventario, Loot Panel)
   ============================================================ */

/* ── Mapa: filtro de tiles ────────────────────────────────── */
/* El filtro día/noche lo aplica game.js dinámicamente vía updateTilePaneFilter() */
.leaflet-tile-pane {
  transition: filter 2s ease;
}
/* Modo nieve: mapa blanco brillante (activar con body.weather-snow) */
body.weather-snow .leaflet-tile-pane {
  filter: grayscale(1) brightness(1.15) contrast(0.85) saturate(0) !important;
}

/* ── POI Markers ──────────────────────────────────────────── */
.poi-marker {
  position: relative;
  width: 46px; height: 46px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}

.poi-danger {
  position: absolute;
  top: -8px; right: -10px;
  background: #cc1111;
  border: 1.5px solid #ff4444;
  border-radius: 8px;
  padding: 1px 4px;
  font-size: 14px;
  line-height: 1.3;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 1px;
  box-shadow: 0 1px 6px rgba(200,0,0,0.7);
  animation: danger-pulse 1.8s ease-in-out infinite;
  z-index: 10;
}

@keyframes danger-pulse {
  0%, 100% { box-shadow: 0 1px 6px rgba(200,0,0,0.7); }
  50%       { box-shadow: 0 1px 10px rgba(255,60,60,1); }
}

.poi-bg {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: rgba(240, 240, 248, 0.85);
  border: 2px solid var(--poi-color, rgba(255,255,255,0.3));
  transition: border-color 0.3s, box-shadow 0.3s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

.poi-emoji {
  position: relative;
  font-size: 20px;
  line-height: 1;
  z-index: 1;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

.poi-label {
  position: absolute;
  bottom: -22px; left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(32,32,46,0.88);
  color: #bbb;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,0.08);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.poi-marker:hover .poi-label  { opacity: 1; }
.poi-marker.nearby  .poi-label { opacity: 1; color: #ffcc55; }

/* Estado: cerca del jugador */
.poi-marker.nearby .poi-bg {
  border-color: #ffcc00;
  box-shadow: 0 0 0 0 rgba(255,204,0,0.5);
  animation: poi-nearby 1.4s ease-out infinite;
}

/* Estado: saqueado */
.poi-marker.looted .poi-bg {
  border-color: #660000;
  opacity: 0.55;
}
.poi-marker.looted .poi-emoji { filter: grayscale(0.8) drop-shadow(0 1px 2px rgba(0,0,0,0.8)); }

/* Estado: zona segura */
.poi-marker.safe .poi-bg { border-color: #6688ff; }

@keyframes poi-nearby {
  0%   { box-shadow: 0 0 0 0   rgba(255,204,0,0.6); }
  70%  { box-shadow: 0 0 0 16px rgba(255,204,0,0);   }
  100% { box-shadow: 0 0 0 0   rgba(255,204,0,0);    }
}


/* ── Backdrop del panel de loot ──────────────────────────── */
#loot-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 599;
  transition: opacity 0.25s;
}
#loot-backdrop.hidden { opacity: 0; pointer-events: none; }

/* ── Panel de Loot ────────────────────────────────────────── */
#loot-panel {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 580px;
  max-width: 96vw;
  background: rgba(32,32,46,0.97);
  border: 1px solid rgba(139,0,0,0.4);
  z-index: 600;
  pointer-events: all;
  display: flex; flex-direction: column;
  max-height: 70vh;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 8px 48px rgba(0,0,0,0.8), 0 0 30px rgba(139,0,0,0.12);
}
#loot-panel.hidden {
  opacity: 0;
  transform: translate(-50%, -46%);
  pointer-events: none;
}

/* Esquinas */
#loot-panel::before, #loot-panel::after {
  content: ''; position: absolute;
  width: 12px; height: 12px;
  border-color: rgba(139,0,0,0.6); border-style: solid;
}
#loot-panel::before { top:-1px; left:-1px; border-width:2px 0 0 2px; }
#loot-panel::after  { bottom:-1px; right:-1px; border-width:0 2px 2px 0; }

#loot-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(139,0,0,0.2);
}

#loot-loc-icon { font-size: 28px; flex-shrink: 0; }

#loot-loc-info { flex: 1; }
#loot-loc-name {
  font-family: 'Courier New', monospace;
  font-size: 14px; font-weight: bold;
  color: #ddd; letter-spacing: 0.08em;
  line-height: 1.3;
}
#loot-loc-status {
  font-family: 'Courier New', monospace;
  font-size: 14px; letter-spacing: 0.12em;
  margin-top: 3px;
}
.status-intact   { color: #44cc44; }
.status-partial  { color: #ccaa22; }
.status-looted   { color: #aa2222; }

#loot-close {
  background: transparent; border: 1px solid rgba(139,0,0,0.35);
  color: #666; font-size: 14px; width: 28px; height: 28px;
  cursor: pointer; flex-shrink: 0;
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
}
#loot-close:hover { background: #8b0000; color: #fff; border-color: #8b0000; }

#loot-desc {
  padding: 6px 16px;
  font-family: 'Courier New', monospace;
  font-size: 11px; color: #555; letter-spacing: 0.06em;
  font-style: italic;
}

/* ── Navegación de habitaciones ───────────────────────────── */
#room-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(139,0,0,0.2);
  background: rgba(0,0,0,0.25);
}

#room-title-wrap {
  flex: 1; text-align: center;
  font-family: 'Courier New', monospace;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}

#room-emoji {
  font-size: 22px; line-height: 1;
}

#room-name {
  font-size: 12px; font-weight: bold;
  color: #ccc; letter-spacing: 0.1em;
  text-transform: uppercase;
}

.room-counter {
  font-size: 10px; color: #555; letter-spacing: 0.15em;
}

.room-nav-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  color: #888;
  font-family: 'Courier New', monospace;
  font-size: 11px;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: 3px;
  transition: all 0.18s;
  white-space: nowrap;
  min-width: 70px;
  text-align: center;
}
.room-nav-btn:hover:not(:disabled) {
  background: rgba(139,0,0,0.25);
  border-color: rgba(139,0,0,0.5);
  color: #ddd;
}
.room-nav-btn:disabled {
  opacity: 0.22;
  cursor: not-allowed;
}
.room-nav-btn.room-nav-danger {
  background: rgba(139,0,0,0.2);
  border-color: rgba(200,0,0,0.45);
  color: #cc4444;
  animation: room-danger-pulse 1.6s ease-in-out infinite;
}
.room-nav-btn.room-nav-danger:hover:not(:disabled) {
  background: rgba(180,0,0,0.4);
}
@keyframes room-danger-pulse {
  0%, 100% { box-shadow: none; }
  50%       { box-shadow: 0 0 8px rgba(200,0,0,0.5); }
}
.room-nav-label { font-size: 10px; letter-spacing: 0.08em; }

/* Descripción ambiental de la habitación */
#room-atm-desc {
  padding: 8px 16px;
  font-family: 'Courier New', monospace;
  font-size: 11px; color: #6a7a6a; letter-spacing: 0.05em;
  font-style: italic; line-height: 1.5;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: rgba(0,0,0,0.15);
}

#loot-items-list {
  flex: 1; overflow-y: auto; padding: 8px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,0,0,0.3) transparent;
}

.loot-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.15s;
}
.loot-item:hover { background: rgba(255,255,255,0.03); }

.loot-item-emoji { font-size: 22px; flex-shrink: 0; }
.loot-item-info  { flex: 1; }
.loot-item-name  {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #ccc; letter-spacing: 0.06em;
}
.loot-item-desc  {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #555; margin-top: 2px; letter-spacing: 0.04em;
}

.loot-take-btn {
  background: transparent; border: 1px solid rgba(139,0,0,0.4);
  color: #cc3333; font-family: 'Courier New', monospace;
  font-size: 15px; letter-spacing: 0.15em;
  padding: 4px 8px; cursor: pointer;
  transition: all 0.2s; flex-shrink: 0;
  text-transform: uppercase;
}
.loot-take-btn:hover { background: #8b0000; color: #fff; border-color: #8b0000; }
.loot-take-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.loot-item.taken { opacity: 0.35; }
.loot-item.taken .loot-take-btn { display: none; }
.loot-item.taken .loot-item-name::after { content: ' ✓'; color: #33aa33; }

#loot-actions {
  padding: 12px 16px;
  border-top: 1px solid rgba(139,0,0,0.2);
  display: flex; gap: 8px;
}

#take-all-btn {
  flex: 1;
  background: rgba(139,0,0,0.15); border: 1px solid rgba(139,0,0,0.5);
  color: #cc3333; font-family: 'Courier New', monospace;
  font-size: 14px; letter-spacing: 0.2em;
  padding: 8px; cursor: pointer;
  transition: all 0.2s; text-transform: uppercase;
}
#take-all-btn:hover { background: #8b0000; color: #fff; border-color: #8b0000; }
#take-all-btn:disabled { opacity: 0.3; cursor: not-allowed; }

#loot-inv-warning {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #aa4444; letter-spacing: 0.06em;
  text-align: center; padding: 0 16px 8px;
  min-height: 18px;
}

/* ── Inventario ───────────────────────────────────────────── */
#inventory-bar {
  position: absolute;
  right: 8px; bottom: 80px;
  display: grid; grid-template-columns: repeat(2, 52px); gap: 5px;
  pointer-events: all; z-index: 510;
}

.inv-slot {
  width: 52px; height: 52px;
  background: rgba(32,32,46,0.88);
  border: 1px solid rgba(139,0,0,0.25);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: border-color 0.2s, background 0.2s;
  font-family: 'Courier New', monospace;
}
.inv-slot:hover { border-color: rgba(139,0,0,0.6); background: rgba(20,4,4,0.9); }
.inv-slot.occupied { border-color: rgba(139,0,0,0.45); }
.inv-slot.selected { border-color: #ffcc00; background: rgba(30,24,0,0.88); }

.inv-slot .slot-emoji { font-size: 22px; line-height: 1; display: block; width: 100%; text-align: center; overflow: hidden; white-space: nowrap; }
.inv-slot .slot-img   { width: 28px; height: 28px; object-fit: contain; display: block; }
.inv-slot .slot-label {
  font-size: 15px; color: #666; letter-spacing: 0.05em;
  margin-top: 2px; text-align: center;
  max-width: 46px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.inv-slot.occupied .slot-label { color: #888; }

.inv-slot .slot-num {
  position: absolute; top: 2px; left: 4px;
  font-size: 14px; color: #333; letter-spacing: 0;
}
.inv-slot.selected .slot-num { color: #ffcc00; }

/* ── Menú contextual de inventario ───────────────────────────── */
#inv-context-menu {
  position: fixed;
  transform: translate(-100%, -50%);
  z-index: 9999;
  background: rgba(10, 8, 6, 0.97);
  border: 1px solid rgba(180, 50, 50, 0.6);
  border-radius: 4px;
  padding: 4px;
  min-width: 130px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.8);
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: inv-ctx-in 0.1s ease;
}
@keyframes inv-ctx-in {
  from { opacity: 0; transform: translate(-90%, -50%); }
  to   { opacity: 1; transform: translate(-100%, -50%); }
}
.inv-ctx-label {
  font-size: 15px;
  color: #888;
  letter-spacing: 0.12em;
  padding: 3px 6px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-ctx-btn {
  background: none;
  border: none;
  color: #bbb;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: 0.12em;
  padding: 5px 8px;
  text-align: left;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.1s, color 0.1s;
}
.inv-ctx-use:hover  { background: rgba(40, 120, 40, 0.3); color: #66ee66; }
.inv-ctx-drop:hover { background: rgba(120, 30, 30, 0.3); color: #ee5555; }

/* Tooltip al hover */
.inv-slot .slot-tooltip {
  position: absolute;
  right: calc(100% + 6px); top: 50%;
  transform: translateY(-50%);
  background: rgba(32,32,46,0.96);
  border: 1px solid rgba(139,0,0,0.3);
  color: #ccc;
  font-size: 15px; letter-spacing: 0.06em;
  padding: 4px 8px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
  z-index: 1;
}
.inv-slot:hover .slot-tooltip { opacity: 1; }

.inv-slot-use-hint {
  position: absolute; bottom: 2px; right: 3px;
  font-size: 15px; color: #444;
}

/* ── Barras de durabilidad ─────────────────────────────────── */
.slot-dur {
  position: absolute; bottom: 3px; left: 4px; right: 4px;
  height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px;
}
.slot-dur-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }

.eq-dur {
  position: absolute; bottom: 3px; left: 4px; right: 4px;
  height: 3px; background: rgba(255,255,255,0.1); border-radius: 2px;
}
.eq-dur-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }

/* Slots vacíos: número tenue */
.inv-slot.empty { opacity: 0.5; }

/* ── Indicador de controles (actualizado) ─────────────────── */
#hint {
  bottom: 16px !important;
}

/* ── Nombre del arma equipada (legacy) ───────────────────── */
#equipped-weapon {
  display: flex; align-items: center; gap: 6px;
  font-size: 14px; color: #c4a46a; letter-spacing: 0.1em;
  margin-top: 6px;
  border-top: 1px solid rgba(139,0,0,0.15);
  padding-top: 6px;
}
#equipped-weapon .eq-emoji { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════
   SIDEBAR IZQUIERDO — Perfil del personaje
   ═══════════════════════════════════════════════════════════ */

#sidebar-left {
  position: absolute;
  top: 16px; left: 16px;
  width: 240px;
  background: rgba(32,32,46,0.92);
  border: 1px solid rgba(139,0,0,0.35);
  z-index: 510;
  pointer-events: all;
  display: flex;
  flex-direction: column;
  gap: 0;
  box-shadow: 2px 0 20px rgba(0,0,0,0.6);
}

/* Esquinas tácticas */
#sidebar-left::before, #sidebar-left::after {
  content: ''; position: absolute;
  width: 10px; height: 10px;
  border-color: rgba(139,0,0,0.55); border-style: solid;
}
#sidebar-left::before { top:-1px; left:-1px; border-width:2px 0 0 2px; }
#sidebar-left::after  { bottom:-1px; right:-1px; border-width:0 2px 2px 0; }

/* ── Paper Doll: retrato + slots laterales ──────────────── */
#portrait-doll {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  border-bottom: 1px solid rgba(139,0,0,0.18);
  background: rgba(0,0,0,0.35);
  height: 148px;
  overflow: hidden;
}

.doll-col {
  display: flex;
  flex-direction: column;
  flex: 0 0 50px;
  width: 50px;
  max-width: 50px;
  overflow: hidden;
  gap: 0;
}

.doll-left { }
.doll-right { }

.doll-slot {
  flex: 0 0 74px;
  height: 74px;
  max-height: 74px;
  overflow: hidden;
  padding: 4px 3px;
  border: none;
  border-radius: 0;
  box-sizing: border-box;
}


/* Líneas de conexión entre slot y parte del cuerpo */
.doll-left .doll-slot::after {
  content: '─';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(80,80,80,0.3);
  font-size: 14px;
}

.doll-right .doll-slot::before {
  content: '─';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(80,80,80,0.3);
  font-size: 14px;
}

#char-portrait {
  display: block;
  flex: 0 0 104px;
  image-rendering: pixelated;
  border-left: none;
  border-right: none;
}

/* ── Nombre y Nivel ─────────────────────────────────────── */
#char-name-side {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  font-weight: bold;
  color: #ddddcc;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 7px 8px 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#char-level-side {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: #6688cc;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 0 8px 6px;
}

/* ── Barras de stats ────────────────────────────────────── */
.side-bar-row {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
}

.xp-row { padding-top: 5px; }

.side-bar-lbl {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #5577cc;
  letter-spacing: 0.15em;
  min-width: 14px;
  text-align: right;
}

.side-bar-icon {
  font-size: 15px;
  min-width: 16px;
  text-align: center;
  line-height: 1;
}

.side-bar-track {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.04);
  overflow: hidden;
}

.side-bar-fill {
  height: 100%;
  transition: width 0.2s;
}

.side-bar-val {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #777;
  min-width: 24px;
  text-align: right;
  letter-spacing: 0;
}

/* ── Separador ──────────────────────────────────────────── */
.side-sep {
  height: 1px;
  background: rgba(139,0,0,0.2);
  margin: 4px 8px;
}

/* ── Arma equipada ──────────────────────────────────────── */
#weapon-side {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #c4a46a;
  letter-spacing: 0.08em;
}

#w-emoji-side { font-size: 16px; }

/* ── Botones del menú ───────────────────────────────────── */
#sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 6px 8px 10px;
}

.side-btn {
  background: rgba(139,0,0,0.1);
  border: 1px solid rgba(139,0,0,0.35);
  color: #cc5555;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: 0.15em;
  padding: 7px 6px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s;
  text-transform: uppercase;
}

.side-btn:hover {
  background: rgba(139,0,0,0.3);
  border-color: #8b0000;
  color: #ff8888;
}

.side-btn.active {
  background: rgba(139,0,0,0.35);
  border-color: #cc3333;
  color: #ffaaaa;
}

/* ── Aviso supervivencia crítica ────────────────────────── */
#surv-warn {
  display: none;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #cc3333;
  letter-spacing: 0.1em;
  text-align: center;
  padding: 0 8px 8px;
  animation: warn-blink 1s ease-in-out infinite;
}

@keyframes warn-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

/* ═══════════════════════════════════════════════════════════
   MODALES DE JUEGO
   ═══════════════════════════════════════════════════════════ */

.game-modal {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  backdrop-filter: blur(2px);
}

.game-modal.hidden {
  display: none;
}

.modal-inner {
  background: rgba(32,32,46,0.97);
  border: 1px solid rgba(139,0,0,0.45);
  width: 560px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.8);
}

/* Esquinas del modal */
.modal-inner::before, .modal-inner::after {
  content: ''; position: absolute;
  width: 14px; height: 14px;
  border-color: rgba(139,0,0,0.6); border-style: solid;
}
.modal-inner::before { top:-1px; left:-1px; border-width:2px 0 0 2px; }
.modal-inner::after  { bottom:-1px; right:-1px; border-width:0 2px 2px 0; }

.modal-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(139,0,0,0.2);
  flex-shrink: 0;
}

.modal-title {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  font-weight: bold;
  color: #ddd;
  letter-spacing: 0.18em;
  flex: 1;
}

.modal-subtitle {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: #555;
  letter-spacing: 0.1em;
}

.modal-close {
  background: transparent;
  border: 1px solid rgba(139,0,0,0.35);
  color: #666;
  font-size: 14px;
  width: 28px; height: 28px;
  cursor: pointer;
  font-family: 'Courier New', monospace;
  transition: all 0.2s;
  flex-shrink: 0;
}
.modal-close:hover { background: #8b0000; color: #fff; border-color: #8b0000; }

.modal-hint {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: #333;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 8px 16px;
  border-top: 1px solid rgba(255,255,255,0.03);
  flex-shrink: 0;
}

/* ── Modal Inventario ───────────────────────────────────── */
#inv-modal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,0,0,0.3) transparent;
}

.inv-modal-slot {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(139,0,0,0.18);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 64px;
}
.inv-modal-slot:hover { background: rgba(139,0,0,0.1); border-color: rgba(139,0,0,0.45); }
.inv-modal-slot.empty {
  opacity: 0.25;
  cursor: default;
  pointer-events: none;
}

.inv-modal-emoji { font-size: 26px; flex-shrink: 0; }

.inv-modal-info { flex: 1; overflow: hidden; }
.inv-modal-name {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #ccc;
  letter-spacing: 0.06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-modal-desc {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #555;
  margin-top: 3px;
  letter-spacing: 0.04em;
}

.inv-modal-use {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #cc4444;
  letter-spacing: 0.12em;
  border: 1px solid rgba(139,0,0,0.4);
  background: transparent;
  padding: 3px 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  text-transform: uppercase;
}
.inv-modal-use:hover { background: #8b0000; color: #fff; border-color: #8b0000; }

/* ── Modal Amigos ───────────────────────────────────────── */
.modal-tabs {
  display: flex;
  border-bottom: 1px solid rgba(139,0,0,0.2);
  flex-shrink: 0;
}

.modal-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #555;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: 0.15em;
  padding: 9px 6px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.modal-tab:hover { color: #888; }
.modal-tab.active {
  color: #cc5555;
  border-bottom-color: #8b0000;
}

.tab-badge {
  display: inline-block;
  background: #8b0000;
  color: #fff;
  font-size: 14px;
  padding: 1px 4px;
  margin-left: 4px;
  border-radius: 2px;
  vertical-align: middle;
}
.tab-badge:empty { display: none; }

/* Búsqueda de amigos */
.social-search {
  display: flex;
  gap: 6px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  flex-shrink: 0;
}

#social-search-input {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(139,0,0,0.3);
  color: #ccc;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  outline: none;
}
#social-search-input::placeholder { color: #333; }
#social-search-input:focus { border-color: rgba(139,0,0,0.6); }

#social-search-btn {
  background: rgba(139,0,0,0.15);
  border: 1px solid rgba(139,0,0,0.4);
  color: #cc4444;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: 0.15em;
  padding: 6px 12px;
  cursor: pointer;
  transition: all 0.2s;
}
#social-search-btn:hover { background: #8b0000; color: #fff; }

/* Resultados de búsqueda */
#social-search-results {
  border-bottom: 1px solid rgba(255,255,255,0.04);
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,0,0,0.3) transparent;
}
#social-search-results:empty { display: none; }

/* Contenido de la pestaña social */
#social-content {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,0,0,0.3) transparent;
}

.social-loading {
  padding: 24px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #444;
  letter-spacing: 0.12em;
}

.social-empty {
  padding: 28px 16px;
  text-align: center;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #333;
  letter-spacing: 0.08em;
  line-height: 1.8;
}

/* Tarjeta de jugador (amigos / solicitudes / resultados) */
.social-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.15s;
}
.social-card:hover { background: rgba(255,255,255,0.02); }

.social-card-avatar {
  width: 38px; height: 38px;
  background: rgba(60,80,40,0.3);
  border: 1px solid rgba(80,100,60,0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.social-card-info { flex: 1; overflow: hidden; }
.social-card-name {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: #ccc;
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.social-card-stats {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: #555;
  margin-top: 3px;
  letter-spacing: 0.04em;
}

.social-card-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.social-btn {
  background: transparent;
  border: 1px solid rgba(139,0,0,0.35);
  color: #cc4444;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  letter-spacing: 0.12em;
  padding: 4px 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  white-space: nowrap;
}
.social-btn:hover { background: #8b0000; color: #fff; border-color: #8b0000; }
.social-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.social-btn:disabled:hover { background: transparent; color: #cc4444; border-color: rgba(139,0,0,0.35); }

.social-btn.accept {
  border-color: rgba(0,100,0,0.5);
  color: #44aa44;
}
.social-btn.accept:hover { background: #005500; color: #fff; border-color: #005500; }

.social-btn.cancel {
  border-color: rgba(80,80,0,0.5);
  color: #aaaa44;
}
.social-btn.cancel:hover { background: #555500; color: #fff; border-color: #555500; }

/* ═══════════════════════════════════════════════════════════
   SLOTS DE EQUIPAMIENTO (paper doll — dentro de portrait-doll)
   ═══════════════════════════════════════════════════════════ */

.equip-slot {
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: background 0.15s;
}

.equip-slot:hover {
  background: rgba(255,255,255,0.06);
}

.equip-slot.eq-occupied:hover {
  background: rgba(255,255,255,0.08);
}

/* Empty slots: faded placeholder */
.equip-slot:not(.eq-occupied) .eq-slot-inner {
  opacity: 0.22;
  filter: grayscale(1);
}

.eq-slot-inner {
  font-size: 22px;
  line-height: 1;
  display: block;
  width: 100%;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

/* Empty slot: faint abbreviation below emoji */
.eq-slot-name {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: rgba(120,120,120,0.45);
  letter-spacing: 0.05em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  max-width: 100%;
}

/* Hide abbreviation when item is equipped */
.equip-slot.eq-occupied .eq-slot-name {
  display: none;
}

/* Occupied placeholder — keep rule for specificity */
.equip-slot.eq-occupied .eq-slot-name-unused {
  color: #5aaa35;
}


/* ═══════════════════════════════════════════════════════════
   WEAPON HOTBAR — 4 slots de armas, bottom center
   ═══════════════════════════════════════════════════════════ */

#weapon-hotbar {
  position: absolute;
  bottom: 88px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 6px;
  pointer-events: none;
  z-index: 510;
}

.wh-slot {
  width: 58px; height: 58px;
  background: rgba(32,32,46,0.86);
  border: 1px solid rgba(35,35,35,0.9);
  border-radius: 3px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative;
  font-family: 'Courier New', monospace;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.wh-slot.active {
  border-color: rgba(139,0,0,0.85);
  background: rgba(18,4,4,0.94);
  box-shadow: 0 0 14px rgba(139,0,0,0.28), inset 0 0 6px rgba(139,0,0,0.08);
}

.wh-slot.locked { opacity: 0.2; }

.wh-key {
  position: absolute; top: 3px; left: 5px;
  font-size: 15px; color: #2a2a2a; letter-spacing: 0;
}
.wh-slot.active .wh-key { color: rgba(139,0,0,0.7); }

.wh-icon { font-size: 22px; line-height: 1; margin-bottom: 2px; display: block; width: 100%; text-align: center; overflow: hidden; white-space: nowrap; }

.wh-name {
  font-size: 15px; color: #3a3a3a;
  text-align: center; letter-spacing: 0.04em;
  max-width: 54px; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.wh-slot.active .wh-name { color: #888; }

.wh-ammo {
  position: absolute; bottom: 3px; right: 4px;
  font-size: 14px; color: #cc6600; font-weight: bold;
  letter-spacing: 0;
}
.wh-ammo.empty { color: #8b0000; }

/* Mover el hint arriba del hotbar */
#hint { bottom: 158px !important; }

/* ═══════════════════════════════════════════════════════════
   NOTIFICATION TOASTS
   ═══════════════════════════════════════════════════════════ */

#notif-container {
  position: absolute;
  top: 68px; left: 50%;
  transform: translateX(-50%);
  z-index: 700;
  display: flex; flex-direction: column;
  align-items: center; gap: 5px;
  pointer-events: none;
}

.notif-toast {
  background: rgba(32,32,46,0.93);
  border: 1px solid rgba(40,40,40,0.9);
  color: #777;
  font-family: 'Courier New', monospace;
  font-size: 14px; letter-spacing: 0.14em;
  padding: 6px 18px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.18s;
}
.notif-toast.show { opacity: 1; }
.notif-toast.pickup { border-color: rgba(30,90,30,0.7); color: #55aa55; }
.notif-toast.equip  { border-color: rgba(139,0,0,0.5);  color: #cc5555; }
.notif-toast.warn   { border-color: rgba(100,80,0,0.6); color: #aa8822; }
.notif-toast.full   { border-color: rgba(100,20,20,0.6); color: #aa3333; }

/* ── Separador adicional ──────────────────────────────────── */
.social-status-tag {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: #555;
  border: 1px solid rgba(255,255,255,0.06);
  padding: 3px 7px;
}

/* ═══════════════════════════════════════════════════════════
   PANEL INVENTARIO — slide-in desde la derecha
   ═══════════════════════════════════════════════════════════ */

#inv-backdrop {
  display: none;
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 695;
  backdrop-filter: blur(1px);
}

#inv-panel {
  position: absolute;
  top: 0; right: 0;
  width: 272px; height: 100%;
  background: rgba(32,32,46,0.97);
  border-left: 1px solid rgba(139,0,0,0.3);
  z-index: 700;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  pointer-events: all;
  box-shadow: -4px 0 24px rgba(0,0,0,0.6);
}
#inv-panel.open { transform: translateX(0); }

/* Esquinas tácticas */
#inv-panel::before, #inv-panel::after {
  content: ''; position: absolute;
  width: 10px; height: 10px;
  border-color: rgba(139,0,0,0.5); border-style: solid;
}
#inv-panel::before { top:-1px; left:-1px; border-width:2px 0 0 2px; }
#inv-panel::after  { bottom:-1px; right:-1px; border-width:0 2px 2px 0; }

#inv-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px 11px;
  border-bottom: 1px solid rgba(139,0,0,0.2);
  flex-shrink: 0;
}

/* ── Panel de STATS (slide-in) ──────────────────────────────── */
#stats-backdrop {
  display: none;
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 690;
  pointer-events: all;
}
#stats-panel {
  position: absolute;
  top: 0; right: 0;
  width: 272px; height: 100%;
  background: rgba(32,32,46,0.97);
  border-left: 1px solid rgba(139,0,0,0.3);
  z-index: 700;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
  pointer-events: all;
  box-shadow: -4px 0 24px rgba(0,0,0,0.6);
}
#stats-panel.open { transform: translateX(0); }
#stats-panel::before, #stats-panel::after {
  content: ''; position: absolute;
  width: 10px; height: 10px;
  border-color: rgba(139,0,0,0.5); border-style: solid;
}
#stats-panel::before { top:-1px; left:-1px; border-width:2px 0 0 2px; }
#stats-panel::after  { bottom:-1px; right:-1px; border-width:0 2px 2px 0; }
#stats-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px 11px;
  border-bottom: 1px solid rgba(139,0,0,0.2);
  flex-shrink: 0;
}
#stats-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,0,0,0.25) transparent;
}
.sp-section {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #444;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  padding: 10px 0 5px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  margin-bottom: 6px;
}
.sp-section:first-child { padding-top: 2px; }
.sp-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.sp-icon  { font-size: 14px; min-width: 18px; text-align: center; }
.sp-label {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: #666;
  letter-spacing: 0.04em;
  min-width: 90px;
}
.sp-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.04);
  overflow: hidden;
}
.sp-bar-fill {
  height: 100%;
  transition: width 0.3s, background 0.3s;
}
.sp-val {
  font-family: 'Courier New', monospace;
  font-size: 15px;
  color: #888;
  min-width: 36px;
  text-align: right;
  letter-spacing: 0;
}
.sp-temp-label {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  letter-spacing: 0.18em;
  text-align: center;
  padding: 3px 0 6px;
  opacity: 0.85;
}
.inv-panel-title-group { display: flex; flex-direction: column; gap: 2px; }
.inv-panel-title {
  font-family: 'Courier New', monospace;
  font-size: 15px; font-weight: bold;
  color: #ddd; letter-spacing: 0.2em;
}
#inv-panel-slots {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #444; letter-spacing: 0.1em;
}

/* Grid de slots — 4 columnas */
#inv-panel-grid {
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  overflow-y: auto;
  flex: 1;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,0,0,0.25) transparent;
}

.inv-p-slot {
  aspect-ratio: 1;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(139,0,0,0.14);
  border-radius: 3px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer; position: relative;
  transition: border-color 0.1s, background 0.1s;
  font-family: 'Courier New', monospace;
  user-select: none;
}
.inv-p-slot:hover       { border-color: rgba(139,0,0,0.4); background: rgba(20,4,4,0.5); }
.inv-p-slot.occupied    { border-color: rgba(139,0,0,0.3); }
.inv-p-slot.selected    { border-color: rgba(255,204,0,0.8); background: rgba(30,24,0,0.7); }
.inv-p-slot.empty       { opacity: 0.38; cursor: default; }

/* Rareza por categoría */
.inv-p-slot.cat-weapon  { border-color: rgba(139,0,0,0.35); }
.inv-p-slot.cat-weapon.selected { border-color: #cc4444; }
.inv-p-slot.cat-equip   { border-color: rgba(60,100,40,0.35); }
.inv-p-slot.cat-equip.selected  { border-color: #55aa44; }

.inv-p-icon { font-size: 20px; line-height: 1; display: block; width: 100%; text-align: center; overflow: hidden; white-space: nowrap; }
.inv-p-icon img.inv-p-icon-img { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; }
.inv-p-label {
  font-size: 14px; color: #444; letter-spacing: 0.04em;
  text-align: center; max-width: 54px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  margin-top: 2px;
}
.inv-p-slot.occupied .inv-p-label { color: #777; }
.inv-p-slot.selected .inv-p-label { color: #cc9900; }

.inv-p-num {
  position: absolute; top: 2px; left: 4px;
  font-size: 15px; color: #2a2a2a;
}
.inv-p-slot.selected .inv-p-num { color: #aa8800; }

.inv-p-badge {
  position: absolute; top: 2px; right: 3px;
  font-size: 14px; color: #3a3a3a; letter-spacing: 0;
}
.inv-p-slot.cat-weapon .inv-p-badge { color: #6a2a2a; }
.inv-p-slot.cat-equip  .inv-p-badge { color: #2a5a2a; }

/* Panel de detalle */
#inv-panel-detail {
  padding: 12px 14px;
  border-top: 1px solid rgba(139,0,0,0.15);
  min-height: 120px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 4px;
}
#inv-detail-icon {
  font-size: 26px; line-height: 1; margin-bottom: 2px;
}
#inv-detail-icon img.inv-detail-icon-img { width: 32px; height: 32px; object-fit: contain; }
#inv-detail-name {
  font-family: 'Courier New', monospace;
  font-size: 14px; color: #ccc; letter-spacing: 0.08em;
}
#inv-detail-desc {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #555; letter-spacing: 0.04em;
  line-height: 1.7;
}
#inv-detail-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
}
#inv-detail-use, #inv-detail-drop {
  flex: 1;
  padding: 7px 0;
  background: transparent;
  font-family: 'Courier New', monospace;
  font-size: 15px; letter-spacing: 0.18em;
  text-transform: uppercase; cursor: pointer;
  transition: all 0.15s;
}
#inv-detail-use {
  border: 1px solid rgba(139,0,0,0.5);
  color: #cc4444;
}
#inv-detail-use:hover { background: #8b0000; color: #fff; border-color: #8b0000; }
#inv-detail-drop {
  border: 1px solid rgba(80,80,80,0.5);
  color: #666;
}
#inv-detail-drop:hover { background: #333; color: #aaa; border-color: #555; }

.inv-panel-footer {
  padding: 7px 12px;
  font-family: 'Courier New', monospace;
  font-size: 14px; color: #252525;
  letter-spacing: 0.1em;
  border-top: 1px solid rgba(255,255,255,0.03);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   LOOT PANEL — grid de items con categorías
   ═══════════════════════════════════════════════════════════ */

/* Vacío */
.loot-empty {
  padding: 32px 16px;
  text-align: center;
}
.loot-empty-icon { font-size: 32px; margin-bottom: 8px; opacity: 0.4; }
.loot-empty-text {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #444;
  letter-spacing: 0.2em; margin-bottom: 4px;
}
.loot-empty-sub {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #2a2a2a; letter-spacing: 0.08em;
}

/* Label de categoría */
.loot-cat-label {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px 5px;
  font-family: 'Courier New', monospace;
  font-size: 14px; color: #444;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.loot-cat-label span { font-size: 14px; }

/* Grid de items por categoría */
.loot-items-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(255,255,255,0.02);
  margin-bottom: 4px;
}

/* Card de item */
.loot-item-card {
  background: rgba(32,32,46,0.7);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  transition: background 0.15s;
}
.loot-item-card:hover { background: rgba(20,8,8,0.9); }

.loot-card-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 5px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.6));
}
.loot-card-name {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #ccc;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 100%;
}
.loot-card-desc {
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #444;
  letter-spacing: 0.03em;
  margin-bottom: 6px;
  line-height: 1.5;
}
.loot-card-count {
  position: absolute; top: 6px; right: 8px;
  font-family: 'Courier New', monospace;
  font-size: 15px; color: #666;
  font-weight: bold;
}
.loot-card-btn {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(139,0,0,0.3);
  color: #aa3333;
  font-family: 'Courier New', monospace;
  font-size: 14px; letter-spacing: 0.16em;
  padding: 4px 0;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}
.loot-card-btn:hover { background: #8b0000; color: #fff; border-color: #8b0000; }
.loot-card-act {
  border-color: rgba(40,100,160,0.5) !important;
  color: #4499cc !important;
  margin-bottom: 4px;
}
.loot-card-act:hover { background: #1a4a7a !important; color: #fff !important; border-color: #1a4a7a !important; }

/* Colores por categoría */
.loot-cat-weapons   .loot-card-icon { filter: drop-shadow(0 2px 6px rgba(139,0,0,0.4)); }
.loot-cat-equipment .loot-card-icon { filter: drop-shadow(0 2px 6px rgba(60,120,40,0.4)); }
.loot-cat-weapons   .loot-card-btn  { border-color: rgba(139,0,0,0.45); }
.loot-cat-equipment .loot-card-btn  { border-color: rgba(40,100,40,0.45); color: #448844; }
.loot-cat-equipment .loot-card-btn:hover { background: #226622; border-color: #226622; }

/* El grid de loot funciona bien con el ancho de 580px */

/* ── Toggle del sidebar (visible en mobile) ─────────────── */
#sidebar-toggle {
  display: none;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: rgba(20,0,0,0.55);
  border: none;
  border-bottom: 1px solid rgba(139,0,0,0.2);
  color: #666;
  font-family: 'Courier New', monospace;
  font-size: 15px;
  letter-spacing: .12em;
  padding: 6px 10px;
  cursor: pointer;
  pointer-events: all;
  flex-shrink: 0;
}
#sidebar-toggle:active { background: rgba(40,0,0,0.7); }
#sidebar-toggle-icon { font-size: 14px; color: #8b0000; }
.sidebar-toggle-label { color: #444; }

/* Sidebar colapsado: solo muestra el toggle */
#sidebar-left.collapsed {
  width: 30px !important;
  overflow: hidden;
  min-height: 0;
}
#sidebar-left.collapsed > *:not(#sidebar-toggle) {
  display: none !important;
}
#sidebar-left.collapsed #sidebar-toggle {
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  width: 30px;
  height: 80px;
  justify-content: center;
  align-items: center;
}
#sidebar-left.collapsed .sidebar-toggle-label {
  writing-mode: vertical-rl;
  font-size: 14px;
  letter-spacing: .08em;
}

/* ── Responsive: Mobile ─────────────────────────────────── */
@media (max-width: 600px) {

  /* Mostrar botón toggle */
  #sidebar-toggle { display: flex; }

  /* Sidebar más angosto, auto-colapsado en pantallas chicas */
  #sidebar-left {
    width: 175px;
    top: 8px;
    left: 8px;
  }

  /* Retrato más pequeño */
  #char-portrait {
    width: 80px !important;
    height: 112px !important;
  }

  /* Slots del paper doll más compactos */
  .doll-col { flex: 0 0 42px; width: 42px; max-width: 42px; }
  .doll-slot { flex: 0 0 56px; height: 56px; max-height: 56px; padding: 2px; }
  #portrait-doll { height: 112px; }
  .eq-slot-inner { font-size: 14px !important; }
  .eq-slot-name  { font-size: 15px  !important; }

  /* Stats del sidebar más compactos */
  .side-bar-row { gap: 3px; }
  #char-name-side { font-size: 14px; }

  /* Panel top-right más pequeño */
  #p-tr {
    top: 8px; right: 8px;
    font-size: 15px;
    min-width: 100px;
    padding: 7px 10px;
  }
  #day-label { font-size: 14px; letter-spacing: .1em; }

  /* Minimap más pequeño y más arriba */
  #p-br { bottom: 70px; right: 8px; }
  #minimap-canvas { width: 100px !important; height: 100px !important; }

  /* Inventory bar: slots más pequeños */
  .inv-slot {
    width: 42px !important;
    height: 42px !important;
    font-size: 18px !important;
  }

  /* Weapon hotbar más compacto */
  .wh-slot { min-width: 54px !important; padding: 4px 6px !important; }
  .wh-name { display: none; }

  /* Logout centrado arriba */
  #logout-btn { font-size: 15px; padding: 4px 10px; }

  /* Chat: mitad de pantalla pegado al fondo izquierdo */
  #chat-panel {
    left: 0 !important;
    right: auto !important;
    width: 50vw !important;
    min-width: 220px;
    border-left: none;
    border-radius: 0 4px 0 0;
  }
  /* Inventario en la derecha: slots más pequeños */
  #inventory-bar {
    right: 4px !important;
    bottom: 60px !important;
    gap: 3px !important;
  }
  #chat-messages { height: 120px; }
  #chat-input { font-size: 14px; } /* evita zoom automático en iOS */

  /* Loot panel: ancho completo */
  #loot-panel {
    width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    top: auto !important;
    bottom: 0 !important;
    max-height: 60vh;
    overflow-y: auto;
    border-radius: 0;
  }
  #loot-panel.hidden {
    transform: translateY(100%) !important;
  }

  /* Modales full-screen en mobile */
  .game-modal .modal-inner {
    width: 95vw !important;
    max-height: 85vh !important;
  }

  /* Hint oculto en mobile (sin teclado) */
  #hint { display: none; }
}

/* ── Chat Global ─────────────────────────────────────────── */
#chat-panel {
  position: fixed;
  bottom: 0; left: 244px;
  width: 270px;
  background: rgba(4,4,6,0.92);
  border: 1px solid rgba(139,0,0,0.28);
  border-bottom: none;
  z-index: 550;
  font-family: 'Courier New', monospace;
  pointer-events: all;
  border-radius: 4px 4px 0 0;
}

#chat-header {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  background: rgba(20,0,0,0.45);
  border-bottom: 1px solid rgba(139,0,0,0.15);
  cursor: pointer;
  font-size: 14px; color: #666; letter-spacing: .1em;
  border-radius: 4px 4px 0 0;
  user-select: none;
}
#chat-header > span:first-child { flex: 1; }
#chat-toggle {
  background: none; border: none; color: #444;
  font-size: 14px; cursor: pointer; padding: 0;
  transition: transform .2s;
}
#chat-panel.open #chat-toggle { transform: rotate(180deg); }

.chat-new-dot {
  color: #cc3333; font-size: 14px; display: none;
}
#chat-panel.has-new .chat-new-dot { display: inline; animation: chatPulse 1s infinite; }
#chat-panel.open    .chat-new-dot { display: none; }

@keyframes chatPulse {
  0%, 100% { opacity: 1; } 50% { opacity: 0.3; }
}

#chat-messages {
  display: none;
  height: 150px;
  overflow-y: auto;
  padding: 6px 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(139,0,0,0.25) transparent;
}
#chat-panel.open #chat-messages { display: block; }

.chat-msg {
  margin-bottom: 4px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}
.chat-user  { color: #4488ff; font-weight: bold; margin-right: 4px; }
.chat-msg.chat-own .chat-user { color: #44aa55; }
.chat-time  { color: #2a2a2a; font-size: 15px; margin-right: 4px; }
.chat-text  { color: #999; }

/* Mensajes de actividad del sistema */
.chat-msg.chat-system {
  font-size: 15px;
  opacity: 0.75;
  font-style: italic;
  border-left: 2px solid rgba(200,160,40,0.3);
  padding-left: 5px;
  margin-left: -5px;
}
.chat-msg.chat-system .chat-text { color: #aa8822; }
.chat-msg.chat-system .chat-time { color: #3a3010; }

#chat-input-row {
  display: none;
  padding: 5px 6px;
  gap: 5px;
  border-top: 1px solid rgba(139,0,0,0.12);
}
#chat-panel.open #chat-input-row { display: flex; }

#chat-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(139,0,0,0.18);
  color: #ccc;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  padding: 4px 7px;
  outline: none;
  border-radius: 2px;
}
#chat-input::placeholder { color: #2a2a2a; }
#chat-input:focus { border-color: rgba(68,136,255,0.45); background: rgba(255,255,255,0.08); }

#chat-send {
  background: rgba(20,0,0,0.6);
  border: 1px solid rgba(139,0,0,0.3);
  color: #8b0000;
  font-size: 16px;
  padding: 0 9px;
  cursor: pointer;
  border-radius: 2px;
  transition: all .15s;
}
#chat-send:hover { background: #8b0000; color: #fff; }

/* ══════════════════════════════════════════════════════════
   SISTEMA DE CLANES
   ══════════════════════════════════════════════════════════ */

/* Badge de clan en el sidebar */
.clan-badge-side {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  margin: 0 8px 4px;
  background: rgba(139,0,0,0.08);
  border: 1px solid rgba(139,0,0,0.2);
  font-size: 14px;
  letter-spacing: .08em;
  overflow: hidden;
}
.clan-badge-side.hidden { display: none; }

#clan-badge-tag {
  color: #8b0000;
  font-size: 15px;
  background: rgba(139,0,0,0.15);
  border: 1px solid rgba(139,0,0,0.3);
  padding: 1px 4px;
  flex-shrink: 0;
}

#clan-badge-name {
  color: #888;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Panel del clan en el modal ─────────────────────────── */
.clan-info-block {
  padding: 1rem 1.2rem;
  border: 1px solid rgba(139,0,0,0.2);
  margin: 0.5rem 0.8rem;
  background: rgba(139,0,0,0.04);
  position: relative;
}

.clan-info-tag {
  font-size: 0.8rem;
  letter-spacing: .2em;
  color: #8b0000;
  background: rgba(139,0,0,0.12);
  border: 1px solid rgba(139,0,0,0.3);
  padding: 2px 6px;
  display: inline-block;
  margin-bottom: 6px;
}

.clan-info-name {
  font-size: 1rem;
  letter-spacing: .15em;
  color: #ddd;
  margin-bottom: 4px;
}

.clan-info-meta {
  font-size: 0.8rem;
  color: #555;
  letter-spacing: .08em;
}

.clan-info-stats {
  display: flex;
  gap: 1.2rem;
  margin-top: 0.8rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.clan-stat-item {
  text-align: center;
}
.clan-stat-val {
  display: block;
  font-size: 1rem;
  color: #8b0000;
  letter-spacing: .05em;
}
.clan-stat-lbl {
  display: block;
  font-size: 0.9rem;
  color: #444;
  letter-spacing: .12em;
  margin-top: 2px;
}

/* Lista de miembros */
.clan-members-title {
  font-size: 0.9rem;
  letter-spacing: .25em;
  color: #444;
  padding: 0.5rem 1.2rem 0.3rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: 0.5rem;
}

.clan-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.45rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  font-size: 0.9rem;
}
.clan-member-row:hover { background: rgba(139,0,0,0.04); }

.clan-member-role {
  font-size: 0.9rem;
  letter-spacing: .1em;
  color: #444;
  min-width: 50px;
}
.clan-member-role.leader { color: #ffcc44; }
.clan-member-role.officer { color: #8888cc; }

.clan-member-name {
  flex: 1;
  color: #ccc;
  letter-spacing: .05em;
}

.clan-member-kills {
  font-size: 0.83rem;
  color: #8b0000;
}

/* Botón de salir del clan */
.btn-leave-clan {
  display: block;
  width: calc(100% - 1.6rem);
  margin: 0.8rem 0.8rem 0.3rem;
  background: transparent;
  border: 1px solid rgba(139,0,0,0.3);
  color: #8b0000;
  font-family: 'Courier New', monospace;
  font-size: 0.87rem;
  letter-spacing: .2em;
  padding: 0.55rem;
  cursor: pointer;
  transition: all .2s;
}
.btn-leave-clan:hover {
  background: rgba(139,0,0,0.12);
  border-color: #8b0000;
}

/* ── Búsqueda de clanes ─────────────────────────────────── */
.clan-search-wrap {
  padding: 0.6rem 0.8rem 0;
}

.clan-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 1.2rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background .15s;
}
.clan-result-row:hover { background: rgba(139,0,0,0.06); }

.clan-result-tag {
  font-size: 0.8rem;
  color: #8b0000;
  background: rgba(139,0,0,0.1);
  border: 1px solid rgba(139,0,0,0.25);
  padding: 1px 5px;
  flex-shrink: 0;
}

.clan-result-info {
  flex: 1;
  overflow: hidden;
}
.clan-result-name {
  font-size: 0.93rem;
  color: #ccc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clan-result-sub {
  font-size: 0.9rem;
  color: #444;
  margin-top: 1px;
}

.btn-join-clan {
  background: transparent;
  border: 1px solid rgba(139,0,0,0.4);
  color: #8b0000;
  font-family: 'Courier New', monospace;
  font-size: 0.77rem;
  letter-spacing: .15em;
  padding: 3px 8px;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
}
.btn-join-clan:hover {
  background: rgba(139,0,0,0.15);
  border-color: #cc0000;
}

/* ── Sección invitar jugador (líder) ────────────────────── */
.clan-invite-section {
  border-top: 1px solid rgba(139,0,0,0.15);
  margin-top: 0.4rem;
}
.clan-invite-form {
  display: flex;
  gap: 6px;
  padding: 0.4rem 0.8rem 0.2rem;
}
.clan-invite-form input {
  flex: 1;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(139,0,0,0.3);
  color: #ccc;
  font-family: 'Courier New', monospace;
  font-size: 0.87rem;
  padding: 5px 8px;
  border-radius: 2px;
  outline: none;
}
.clan-invite-form input:focus { border-color: rgba(139,0,0,0.6); }
#btn-clan-invite {
  background: transparent;
  border: 1px solid rgba(139,0,0,0.4);
  color: #8b0000;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  letter-spacing: .1em;
  padding: 4px 10px;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 2px;
  transition: all .15s;
}
#btn-clan-invite:hover { background: rgba(139,0,0,0.15); border-color: #cc0000; }

/* ── Fila de invitación pendiente ───────────────────────── */
.clan-inv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid rgba(139,0,0,0.08);
}
.clan-inv-info {
  flex: 1;
  min-width: 0;
}
.clan-inv-name {
  font-size: 0.93rem;
  color: #ccc;
  letter-spacing: .06em;
}
.clan-inv-sub {
  font-size: 0.93rem;
  color: #666;
  margin-top: 2px;
}
.clan-inv-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.btn-inv-accept {
  background: transparent;
  border: 1px solid rgba(40,160,60,0.5);
  color: #3c9;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  letter-spacing: .08em;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 2px;
  transition: all .15s;
}
.btn-inv-accept:hover { background: rgba(40,160,60,0.15); }
.btn-inv-decline {
  background: transparent;
  border: 1px solid rgba(139,0,0,0.35);
  color: #a33;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  letter-spacing: .08em;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: 2px;
  transition: all .15s;
}
.btn-inv-decline:hover { background: rgba(139,0,0,0.12); }

/* ── Formulario de crear clan ───────────────────────────── */
.clan-create-form {
  padding: 0.8rem;
}

.clan-create-form .field {
  margin-bottom: 1rem;
}

.clan-create-form .field label {
  display: block;
  font-size: 0.9rem;
  letter-spacing: .2em;
  color: #444;
  margin-bottom: 0.35rem;
}

.clan-create-form .field input {
  width: 100%;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.06);
  border-bottom-color: rgba(139,0,0,0.3);
  color: #ccc;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  padding: 0.5rem 0.7rem;
  outline: none;
  transition: border-color .2s;
}
.clan-create-form .field input:focus {
  border-color: rgba(139,0,0,0.55);
}

.clan-field-hint {
  font-size: 0.9rem;
  color: #333;
  margin-top: 3px;
}

.btn-create-clan {
  width: 100%;
  background: transparent;
  border: 1px solid #8b0000;
  color: #8b0000;
  font-family: 'Courier New', monospace;
  font-size: 0.93rem;
  letter-spacing: .3em;
  padding: 0.65rem;
  cursor: pointer;
  transition: all .2s;
  margin-top: 0.5rem;
}
.btn-create-clan:hover:not(:disabled) {
  background: #8b0000;
  color: #fff;
  box-shadow: 0 0 20px rgba(139,0,0,0.4);
}
.btn-create-clan:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.clan-form-error {
  font-size: 0.83rem;
  color: #cc2222;
  letter-spacing: .05em;
  min-height: 1rem;
  margin: 0.4rem 0;
}

/* ── Pixel-art item icons ───────────────────────────────── */
.item-icon {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: inline-block;
  vertical-align: middle;
}

