/* ============================================================
   ESTILOS — Muñecas Ragdoll v2 (energía + orbes + expresiones)
   ============================================================ */
:root {
  --bg: #0d1117; --panel: #161c26; --line: #2a3342;
  --txt: #dfe7f2; --dim: #8b98ab; --on: #39d98a; --off: #ff5c5c; --accent: #4ea1ff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  overflow: hidden;
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--txt);
}
canvas { display: block; cursor: grab; }
canvas:active { cursor: grabbing; }

#ui {
  position: fixed; top: 16px; left: 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px;
  width: 258px; user-select: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  max-height: calc(100vh - 32px);
  overflow-y: auto; overflow-x: hidden;
}
/* Scrollbar styling */
#ui::-webkit-scrollbar { width: 5px; }
#ui::-webkit-scrollbar-track { background: #0d1117; border-radius: 3px; }
#ui::-webkit-scrollbar-thumb { background: #2a3342; border-radius: 3px; }
#ui::-webkit-scrollbar-thumb:hover { background: var(--accent); }
#uiHead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 12px 11px 14px; cursor: default;
}
#uiHead h1 { font-size: 12.5px; font-weight: 600; letter-spacing: 0.6px; }
#btnMin { width: 26px; height: 26px; flex: none; padding: 0; font-size: 13px; line-height: 1; }
#uiBody { padding: 0 14px 14px; }
#uiBody p { font-size: 11px; color: var(--dim); margin-bottom: 12px; line-height: 1.45; }
.row { display: flex; gap: 7px; margin-bottom: 8px; }
button {
  flex: 1; padding: 8px 0; border: 1px solid var(--line); border-radius: 8px;
  background: #1d2530; color: var(--txt); font-size: 11.5px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
button:hover { background: #242e3c; }
button.on  { border-color: var(--on); color: var(--on); }
button.off { border-color: var(--off); color: var(--off); }
label { font-size: 11px; color: var(--dim); display: block; margin: 6px 0 4px; }
input[type=range] { width: 100%; accent-color: var(--accent); margin-bottom: 6px; }
#estado {
  font-size: 11px; color: var(--dim);
  border-top: 1px solid var(--line); padding-top: 9px; margin-top: 6px;
}
#estado b { color: var(--txt); }
#energiaBar {
  height: 7px; background: #0b1018; border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden; margin: 7px 0 4px;
}
#energiaFill {
  height: 100%; width: 100%; background: #39d98a;
  transition: width 0.12s, background 0.12s;
}
#leyenda {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px;
  margin: 8px 0 4px; font-size: 9.5px; color: var(--dim); line-height: 1.5;
}
#leyenda span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
#leyenda i { width: 9px; height: 3px; border-radius: 2px; flex: none; }
#ajustes { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; }
#ajustes .tit { font-size: 9.5px; letter-spacing: 0.4px; color: var(--accent); margin-bottom: 6px; }
#ajustes label { display: flex; justify-content: space-between; margin: 5px 0 2px; }
#ajustes b { color: var(--txt); }
#ajustes input[type=range] { margin-bottom: 2px; }
#hint {
  position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--dim); background: rgba(13, 17, 23, 0.7);
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--line);
  white-space: nowrap;
}
#guardadoInfo { font-size: 9.5px; color: var(--dim); margin-top: 6px; }

/* ========== BARRAS DE VIDA SOBRE LAS MUÑECAS ========== */
.barra-vida-container {
  position: fixed; pointer-events: none; z-index: 10;
  display: flex; flex-direction: column; align-items: center;
  transform: translate(-50%, -100%);
  transition: opacity 0.3s;
}
.barra-vida-nombre {
  font-size: 9px; color: #dfe7f2; font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  margin-bottom: 2px; white-space: nowrap;
}
.barra-vida-track {
  width: 52px; height: 6px; background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.15); border-radius: 4px;
  overflow: hidden;
}
.barra-vida-fill {
  height: 100%; border-radius: 3px;
  transition: width 0.2s, background 0.2s;
}
.barra-vida-muerto {
  font-size: 8px; color: #ff5c5c; font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  margin-top: 1px;
}
.barra-vida-portador {
  font-size: 8px; color: #ffcf3f; font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  margin-top: 1px;
}

/* HUD central: marcador y estado. pointer-events:none es obligatorio, o se
   come los arrastres de cámara, que ocupan toda la pantalla. */
#hud {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 20; pointer-events: none; text-align: center;
  font-size: 12px; color: #e8eef7;
  background: rgba(11,17,32,0.72);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 12px;
  padding: 8px 18px; min-width: 260px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}
#marcador { font-size: 17px; font-weight: 800; letter-spacing: 1px; }
#hudPie {
  display: flex; gap: 12px; justify-content: center;
  font-size: 10.5px; color: #8b97ab; margin-top: 4px;
}

/* Anuncios dramáticos y destello de sangre. Ambos por encima de todo y
   sin capturar el ratón. */
#dramaBanner{position:fixed;top:38%;left:50%;transform:translate(-50%,-50%);
  z-index:40;pointer-events:none;opacity:0;
  font-size:46px;font-weight:900;letter-spacing:3px;font-family:inherit;
  text-shadow:0 0 18px rgba(0,0,0,.95),0 4px 0 rgba(0,0,0,.6);
  transition:opacity .25s;white-space:nowrap}
#dramaFlash{position:fixed;inset:0;z-index:35;pointer-events:none;opacity:0;
  background:radial-gradient(ellipse at center,rgba(255,0,0,0) 42%,rgba(150,0,10,.85) 100%);
  transition:opacity .12s}

/* ─── Mobile: fullscreen landscape, sin panel ─── */
@media (max-width: 1024px), (pointer: coarse) {
  #ui { display: none !important; }
  #hint { display: none; }
  body { overflow: hidden; touch-action: none; }
  canvas { cursor: none; }
}
#btnMobileMenu { display: none; }
@media (max-width: 1024px), (pointer: coarse) {
  #btnMobileMenu {
    display: block !important;
    position: fixed; bottom: 10px; right: 10px; z-index: 50;
    width: 44px; height: 44px; border-radius: 50%;
    background: rgba(22,28,38,0.85); color: #dfe7f2;
    border: 1px solid #2a3342; font-size: 20px;
    cursor: pointer; touch-action: manipulation;
  }
}
