/* Panel «Vivir» (src3d/hud.js): necesidades con color propio, ánimo con cara, retrato 3D. */
@property --v { syntax: '<number>'; inherits: false; initial-value: 0; }

/* ---- Fila del personaje: retrato · nombre y qué hace · ánimo y lo urgente */
#p-vivir .hud-who { grid-template-columns: 44px minmax(0, 1fr) auto; column-gap: 10px; align-items: center; margin-bottom: 10px; }
#p-vivir .avatar { width: 44px; height: 44px; padding: 0; background: transparent; border: 2px solid var(--mood, #6fe0a0); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35), 0 0 12px var(--mood, #6fe0a0); transition: border-color 0.4s, box-shadow 0.4s; }
#p-vivir .avatar img { width: 100%; height: 100%; object-fit: cover; }
.hud-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0; max-width: 46vw; }

.hud-mood { --mc: #6fe0a0; display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 9px 3px 3px; border-radius: 999px; font-size: 12.5px; font-weight: 800; line-height: 1.2; color: var(--mc); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--mc); white-space: nowrap; transition: color 0.4s, border-color 0.4s; }
.hud-mood span { overflow: hidden; text-overflow: ellipsis; }
.hud-face { width: 20px; height: 20px; }

.hud-alert { --c: #ff6b5a; display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 12px; font-weight: 800; line-height: 1.2; color: var(--c); white-space: nowrap; }
.hud-alert > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.hud-alert-ico { flex: none; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--c); color: #12151b; }
.hud-alert-ico svg { width: 11px; height: 11px; }
.hud-alert.crit .hud-alert-ico { animation: hudBeat 1.1s ease-in-out infinite; }

/* ---- Necesidades: 4 × 2, anillo con el valor y el ícono en el color de cada una */
.hud-needs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.hud-need { --c: #7fd8ff; --c2: rgba(127, 216, 255, 0.17); display: flex; align-items: center; gap: 6px; min-width: 0; padding: 4px 5px 4px 4px; border-radius: 12px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.035); transition: background 0.3s, border-color 0.3s; }
.hud-gauge { --v: 0; position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--c); background: conic-gradient(var(--c) calc(var(--v) * 1%), rgba(255, 255, 255, 0.12) 0); transition: --v 0.5s; }
.hud-gauge::before { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: #191d25; }
.hud-gauge svg { position: relative; width: 15px; height: 15px; }
.hud-ntxt { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.hud-nlbl { font-size: 11px; font-weight: 700; line-height: 1.15; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-nval { display: flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: 10.5px; line-height: 1.1; color: var(--ink-2); }
.hud-nval b { font-weight: 700; }
.hud-tr { width: 10px; height: 10px; visibility: hidden; }
.hud-tr.up { visibility: visible; color: var(--ok); }
.hud-tr.down { visibility: visible; color: var(--ink-3); transform: rotate(180deg); }

/* baja: anillo con fondo rojizo y número en rojo; la más urgente, con borde de su color */
.hud-need.low .hud-gauge { background: conic-gradient(var(--c) calc(var(--v) * 1%), rgba(255, 107, 90, 0.3) 0); }
.hud-need.low .hud-nval { color: var(--bad); }
.hud-need.low .hud-tr.down { color: var(--bad); }
.hud-need.top { background: var(--c2); border-color: var(--c); }
.hud-need.crit .hud-gauge { animation: hudBeat 1.1s ease-in-out infinite; }
@keyframes hudBeat { 50% { transform: scale(1.12); box-shadow: 0 0 10px var(--c); } }

/* ---- Celular: más bajo que antes (el panel no tapa la casa) */
@media (max-width: 600px) {
  .hud-needs { gap: 4px; }
  .hud-need { gap: 4px; padding: 3px 2px 3px 3px; border-radius: 11px; }
  .hud-gauge { width: 25px; height: 25px; }
  .hud-gauge::before { inset: 2.5px; }
  .hud-gauge svg { width: 13px; height: 13px; }
  .hud-nlbl { font-size: 10px; letter-spacing: -0.1px; }
  .hud-nval { font-size: 9.5px; }
  .hud-tr { width: 9px; height: 9px; }
}
@media (max-height: 760px) and (max-width: 600px) {
  #p-vivir .hud-who { grid-template-columns: 40px minmax(0, 1fr) auto; margin-bottom: 7px; }
  #p-vivir .avatar { width: 40px; height: 40px; }
  .hud-mood { font-size: 12px; padding-right: 8px; }
  .hud-face { width: 18px; height: 18px; }
  .hud-alert { font-size: 11.5px; }
}
@media (min-width: 601px) {
  .hud-gauge { width: 34px; height: 34px; }
  .hud-gauge svg { width: 16px; height: 16px; }
  .hud-nlbl { font-size: 12px; }
  .hud-nval { font-size: 11px; }
  #p-vivir .avatar { width: 48px; height: 48px; }
  #p-vivir .hud-who { grid-template-columns: 48px minmax(0, 1fr) auto; }
}

/* Letra grande (Opciones) */
body.fs .hud-nlbl { font-size: calc(11px * var(--fs)); }
body.fs .hud-nval { font-size: calc(10.5px * var(--fs)); }
body.fs .hud-mood { font-size: calc(12.5px * var(--fs)); }
body.fs .hud-alert { font-size: calc(12px * var(--fs)); }
@media (max-width: 600px) {
  body.fs .hud-nlbl { font-size: calc(10px * var(--fs)); }
  body.fs .hud-nval { font-size: calc(9.5px * var(--fs)); }
}

@media (prefers-reduced-motion: reduce) {
  .hud-need.crit .hud-gauge, .hud-alert.crit .hud-alert-ico { animation: none; }
  .hud-gauge { transition: none; }
}
