/* =========================================================
   ZONA CERO — hoja de estilos del HUD, inventario y menús
   ========================================================= */

:root {
  --bg: #060806;
  --panel: rgba(12, 14, 11, 0.88);
  --panel-border: #3a3f35;
  --text: #d8d5cc;
  --text-dim: #8d8f84;
  --accent: #c8341f;
  --health: #e04b3f;
  --stamina: #d9c34a;
  --hunger: #d98a3a;
  --thirst: #4aa8d9;
  --infection: #7ab848;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  color: var(--text);
  user-select: none;
}

canvas#game {
  position: fixed;
  inset: 0;
  display: block;
  cursor: none;
}

.hidden { display: none !important; }

/* ================= HUD ================= */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#hud-top {
  position: absolute;
  top: 14px;
  left: 18px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-shadow: 0 1px 2px #000;
}
#hud-top .sep { margin: 0 8px; opacity: 0.5; }
#stat-time { color: var(--text); }

/* reloj día/noche (esquina superior derecha): 12 h con AM/PM */
#clock {
  position: absolute;
  top: 12px;
  right: 18px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-right: 3px solid #d8b45a;
  padding: 5px 12px 4px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 0px;
  transition: border-color 1s;
}
#clock-time {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #ffd98a;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px #000;
  line-height: 1.05;
}
#clock-day {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-dim);
}
/* v0.15: estado del clima bajo el reloj (LLUVIA / NEBLINA; vacío = despejado) */
#clock-weather {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-dim);
}
#clock-weather.rain { color: #9fc6e8; }
#clock-weather.fog  { color: #cdd4d8; }
#clock.night { border-right-color: #4a6a9a; }
#clock.night #clock-time { color: #8fb7e8; }

#hud-left {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.statbar {
  position: relative;
  width: 250px;
  height: 21px;
  background: rgba(8, 10, 8, 0.82);
  border: 1px solid #2c2f28;
  border-left: 3px solid #555;
}
.statbar[data-bar="health"]   { border-left-color: var(--health); }
.statbar[data-bar="stamina"]  { border-left-color: var(--stamina); }
.statbar[data-bar="hunger"]   { border-left-color: var(--hunger); }
.statbar[data-bar="thirst"]   { border-left-color: var(--thirst); }
.statbar[data-bar="infection"]{ border-left-color: var(--infection); }

.statbar .fill {
  position: absolute;
  inset: 0;
  width: 100%;
  transition: width 0.15s linear;
}
.statbar[data-bar="health"] .fill    { background: linear-gradient(180deg, #e05a4f, #a83428); }
.statbar[data-bar="stamina"] .fill   { background: linear-gradient(180deg, #e2cd5c, #a89430); }
.statbar[data-bar="hunger"] .fill    { background: linear-gradient(180deg, #e0964a, #a86424); }
.statbar[data-bar="thirst"] .fill    { background: linear-gradient(180deg, #55b2e0, #2a7aa8); }
.statbar[data-bar="infection"] .fill { background: linear-gradient(180deg, #8cc95a, #5a8a2c); }

.statbar .bl {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(240, 240, 235, 0.92);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}
.statbar .bv {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 700;
  color: rgba(240, 240, 235, 0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.statbar.crit { animation: critPulse 0.9s ease-in-out infinite; }
@keyframes critPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(200, 40, 30, 0); }
  50% { box-shadow: 0 0 10px rgba(220, 60, 40, 0.65); }
}

#status-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chip {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 2px 8px;
  background: rgba(8, 10, 8, 0.85);
  border: 1px solid #3a3f35;
}
.chip.sneak { color: #9fc37a; border-color: #55703c; }
.chip.warn { color: #d9c34a; border-color: #8a7a24; }
.chip.bad { color: #e05a4f; border-color: #8a2a22; animation: critPulse 1.1s infinite; }
.chip.heal { color: #d8d5cc; }
.chip.reload { color: #7ab0d8; border-color: #3a5a74; animation: critPulse 1.4s infinite; }
.chip.flash { color: #e8c66a; border-color: #8a7430; }   /* v0.17: linterna encendida */
.chip.adren { color: #e8963a; border-color: #8a5a20; }   /* v0.18: adrenalina activa */
.chip.morph { color: #b8a0d9; border-color: #5a4a74; }   /* v0.18: morfina activa */
.chip.build { color: #e8c66a; border-color: #8a7430; animation: critPulse 1.6s infinite; }  /* v0.20: modo construcción */
.chip.sleep { color: #9fc3d8; border-color: #3a6a8a; }   /* v0.20: durmiendo */

/* derecha: ruido + equipo */
#hud-right {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

#noise-meter {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.nm-label { font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--text-dim); }
.nm-ticks { display: flex; gap: 4px; }
.nm-ticks i {
  width: 7px;
  height: 16px;
  background: #23261f;
  border: 1px solid #33362c;
}
.nm-ticks i.on { background: #c8b03a; border-color: #8a7a24; box-shadow: 0 0 6px rgba(200, 176, 58, 0.5); }
.nm-ticks i.on:nth-child(4), .nm-ticks i.on:nth-child(5) { background: #d94a3a; border-color: #8a2a22; }

#equip-quick {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  padding: 8px 14px;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#eq-weapon { font-size: 16px; font-weight: 700; letter-spacing: 1.5px; color: var(--text); }
#eq-armor, #eq-slots { font-size: 11px; font-weight: 600; letter-spacing: 1.5px; color: var(--text-dim); }
#eq-ammo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #d8b45a;
  font-variant-numeric: tabular-nums;
}
#eq-ammo.empty { color: #e05a4f; }
#eq-flash {                         /* v0.17: estado de la linterna */
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #e8c66a;
  font-variant-numeric: tabular-nums;
}
#eq-flash.empty { color: #e05a4f; }
.action-note { align-self: center; font-size: 11px; color: var(--text-dim); letter-spacing: 0.5px; }

/* prompt de interacción */
#prompt {
  position: absolute;
  bottom: 110px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-left: 3px solid var(--accent);
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
}

/* barra rápida (1-5, v0.17): arma de fuego / secundaria / melee / objeto / objeto */
#hotbar {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 7px;
  pointer-events: none;
}
.hb-slot {
  position: relative;
  width: 56px;
  height: 56px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hb-slot.filled { border-style: solid; background: rgba(16, 19, 16, 0.92); }
.hb-slot.active {
  border-color: #9fc37a;
  box-shadow: 0 0 0 1px #9fc37a, 0 0 12px rgba(159, 195, 122, 0.35);
}
.hb-key {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  background: rgba(8, 10, 8, 0.85);
  border: 1px solid #444a3e;
  padding: 0 4px;
  line-height: 14px;
}
.hb-tag {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text-dim);
}
.hb-item { position: relative; width: 100%; height: 100%; }
.hb-letter {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  width: 24px;
  height: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #101210;
  border: 1px solid rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
}
.hb-count {
  position: absolute;
  top: 3px;
  right: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #9fc37a;
}
.hb-ammo {
  position: absolute;
  top: 20px;
  right: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #d8b45a;
  font-variant-numeric: tabular-nums;
}

/* panel de barra rápida dentro del inventario */
#inv-hotbar { margin-top: 16px; }
#inv-hb-row { display: flex; gap: 7px; }
.ihb-slot {
  flex: 1;
  min-width: 0;
  border: 1px dashed #33362c;
  background: #131611;
  padding: 5px 7px 4px;
  cursor: pointer;
  transition: border-color 0.15s;
  position: relative;
}
.ihb-slot:hover { border-color: #6a705a; }
.ihb-slot.filled { border-style: solid; }
.ihb-slot .ihb-key {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  background: #1a1e18;
  border: 1px solid #444a3e;
  border-bottom-width: 2px;
  padding: 0 5px;
  margin-right: 6px;
}
.ihb-slot .ihb-tag {
  display: block;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  margin-top: 3px;
}
.ihb-slot .ihb-item {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.ihb-slot .ihb-item.empty { color: #6d6f64; font-weight: 500; }

#controls-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  background: rgba(8, 10, 8, 0.7);
  padding: 4px 14px;
  border-radius: 2px;
  transition: opacity 1.6s ease;
  white-space: nowrap;
}
#controls-hint.fade { opacity: 0; }

/* toasts */
#toasts {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 6px;
}
.toast {
  background: rgba(10, 12, 9, 0.92);
  border: 1px solid #3a3f35;
  border-left: 3px solid #6a705a;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.8px;
  padding: 6px 16px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.in { opacity: 1; transform: translateY(0); }
.toast.out { opacity: 0; }
.toast.bad { border-left-color: var(--accent); color: #e88a80; }
.toast.warn { border-left-color: #c8b03a; color: #d9cf8a; }
.toast.save { border-left-color: #7aa05a; color: #b9d69a; }

/* ================= Inventario ================= */

#inv-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(4, 6, 4, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.inv-panel {
  width: min(940px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  background: #101310;
  border: 1px solid #3f443a;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.inv-panel::-webkit-scrollbar { width: 8px; }
.inv-panel::-webkit-scrollbar-thumb { background: #33362c; }

.inv-panel header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid #2c2f28;
}
.inv-panel h2 { font-size: 22px; font-weight: 700; letter-spacing: 3px; }
#inv-cap { font-size: 15px; font-weight: 600; color: #9fc37a; }
.inv-hint { margin-left: auto; font-size: 11px; color: var(--text-dim); letter-spacing: 1px; }

.inv-body {
  display: grid;
  grid-template-columns: 250px 1fr auto;
  gap: 18px;
  padding: 18px 22px 22px;
}
@media (max-width: 860px) {
  .inv-body { grid-template-columns: 1fr; }
}

.inv-body h3 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* equipo */
#inv-equip .eq-slot {
  border: 1px solid #33362c;
  background: #161a15;
  padding: 6px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
}
#inv-equip .eq-slot:hover { border-color: #6a705a; }
#inv-equip .eq-slot.filled { border-left: 3px solid #9fc37a; }
#inv-equip .eq-slot label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-dim);
}
#inv-equip .eq-slot .eq-item {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

#inv-stats {
  margin-top: 12px;
  border-top: 1px dashed #33362c;
  padding-top: 10px;
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
#inv-stats b { color: var(--text); float: right; }
.eq-note { margin-top: 10px; font-size: 10.5px; color: #6d6f64; line-height: 1.4; }

/* rejilla de mochila y contenedor */
#inv-grid, #cont-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 7px;
}

.slot {
  position: relative;
  min-height: 54px;
  border: 1px dashed #33362c;
  background: #131611;
  padding: 7px 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  cursor: pointer;
  overflow: hidden;
}
.slot.filled { border-style: solid; }
.slot:hover { border-color: #6a705a; background: #191d17; }
.slot.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.slot .slot-count {
  position: absolute;
  top: 5px; right: 7px;
  font-size: 11px;
  color: #9fc37a;
  font-weight: 700;
}
.slot.cat-comida { border-left: 3px solid var(--hunger); }
.slot.cat-bebida { border-left: 3px solid var(--thirst); }
.slot.cat-medico { border-left: 3px solid #d8d5cc; }
.slot.cat-arma { border-left: 3px solid #e05a4f; }
.slot.cat-ropa { border-left: 3px solid #9a7ab8; }
.slot.cat-municion { border-left: 3px solid #d8a94f; }
.slot.cat-cargador { border-left: 3px solid #6a9ac8; }
.slot.rotten { background: #171d12; }
.slot.rotten .slot-name::after {
  content: 'PODRIDA';
  display: inline-block;
  margin-left: 6px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #7ab848;
  border: 1px solid #456a2a;
  padding: 0 4px;
  vertical-align: middle;
}

#cont-grid .slot { border-color: #2e4a3a; }
#cont-grid .empty {
  grid-column: 1 / -1;
  color: #6d6f64;
  font-size: 13px;
  padding: 10px;
  text-align: center;
}
.cont-hint { margin-top: 8px; font-size: 11px; color: #6d6f64; }
#inv-cont-wrap { min-width: 220px; max-width: 320px; }

/* barra de acciones */
#action-bar {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
#action-bar button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 8px 18px;
  background: #1c211b;
  color: var(--text);
  border: 1px solid #4a4f42;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
#action-bar button:hover { background: #2a3325; border-color: #6a705a; }
#action-bar button:first-child { border-color: var(--accent); color: #e8a09a; }

/* ================= Menús ================= */

#menu, #deathscreen, #pausescreen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(10, 13, 10, 0.82) 0%, rgba(3, 5, 3, 0.96) 75%);
  cursor: default;
}

.menu-inner { text-align: center; max-width: 640px; padding: 30px; }

#menu h1 {
  font-size: 92px;
  font-weight: 700;
  letter-spacing: 14px;
  line-height: 0.95;
  color: var(--text);
  text-shadow: 0 2px 0 #000, 0 0 42px rgba(200, 52, 31, 0.35);
}
#menu h1 em {
  display: block;
  font-style: normal;
  color: var(--accent);
  text-shadow: 0 3px 0 #2a0c07, 0 0 60px rgba(200, 52, 31, 0.5);
}

.tagline {
  margin-top: 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  color: var(--text-dim);
}
.tagline span { color: #6d6f64; }

.menu-controls {
  margin: 34px auto 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 26px;
  text-align: left;
}
.menu-controls > div {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--text-dim);
}
kbd {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
  background: #1a1e18;
  border: 1px solid #444a3e;
  border-bottom-width: 3px;
  padding: 3px 8px;
  white-space: nowrap;
}

#btn-play, #btn-retry, #btn-resume, #btn-continue {
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 6px;
  padding: 14px 58px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-bottom: 5px solid #6d180c;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s;
}
#btn-play:hover, #btn-retry:hover, #btn-resume:hover, #btn-continue:hover {
  background: #e0452f;
  box-shadow: 0 0 34px rgba(200, 52, 31, 0.5);
  transform: translateY(-2px);
}
#btn-play:active, #btn-retry:active, #btn-resume:active, #btn-continue:active { transform: translateY(1px); border-bottom-width: 2px; }

/* v0.13: columna de botones del menú + botón secundario (continuar/guardar) */
.menu-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
#btn-continue, .btn-secondary {
  font-size: 15px;
  letter-spacing: 4px;
  padding: 11px 40px;
  background: #262b22;
  border-bottom: 4px solid #12150f;
  color: #c9d6b8;
}
#btn-continue:hover, .btn-secondary:hover {
  background: #31382b;
  box-shadow: 0 0 26px rgba(122, 160, 88, 0.28);
  color: #dcecc8;
}
#continue-info {
  margin: -2px 0 0;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: #7f8a70;
  text-align: center;
}
#continue-info::before { content: '» '; color: #9ab06f; }
.death-savegone {
  margin: 4px 0 18px;
  font-size: 13px;
  letter-spacing: 1px;
  color: #a8574d;
}

.menu-tip { margin-top: 22px; font-size: 12.5px; color: #6d6f64; }
.menu-tip b { color: #9a7ab8; }

/* muerte */
.death-title {
  font-size: 74px;
  font-weight: 700;
  letter-spacing: 12px;
  color: var(--accent);
  text-shadow: 0 4px 0 #2a0c07, 0 0 70px rgba(200, 52, 31, 0.55);
}
#death-cause {
  margin: 18px 0 26px;
  font-size: 16.5px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}
.death-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px 34px;
  margin-bottom: 22px;
}
.death-stats > div { display: flex; flex-direction: column; gap: 4px; }
.death-stats span { font-size: 10.5px; font-weight: 700; letter-spacing: 2px; color: #6d6f64; }
.death-stats b { font-size: 30px; font-weight: 700; color: var(--text); }

/* v0.23: obituario — línea de récords + contadores secundarios */
.ds-records {
  margin: 0 0 6px;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: #9ab06f;
}
.death-stats-sub {
  margin: 0 0 16px;
  font-size: 12px;
  color: #6d6f64;
}
.death-stats-sub b { color: var(--text-dim); }

/* v0.23: récords acumulados bajo las ranuras del menú */
#slots-records {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: 1px;
  color: #9ab06f;
  text-align: center;
}

.pause-title {
  font-size: 54px;
  letter-spacing: 16px;
  color: var(--text);
}
#pausescreen p { margin: 12px 0 26px; color: var(--text-dim); }

/* ================= v0.20: Crafteo ================= */

/* pestañas del inventario (header) */
#inv-tabs { display: flex; gap: 6px; margin-left: 8px; }
#inv-tabs button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 6px 16px;
  background: #1a1e18;
  color: var(--text-dim);
  border: 1px solid #3a3f35;
  border-bottom-width: 3px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
#inv-tabs button:hover { background: #232a20; color: var(--text); }
#inv-tabs button.on {
  background: #262e22;
  color: #c9d6b8;
  border-color: #6a705a;
  border-bottom-color: #9fc37a;
}

/* panel de crafteo */
#inv-craft { min-width: 0; }
#craft-subtabs { display: flex; gap: 6px; margin-bottom: 10px; }
#craft-subtabs button {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 5px 14px;
  background: #131611;
  color: var(--text-dim);
  border: 1px dashed #33362c;
  cursor: pointer;
}
#craft-subtabs button:hover { border-color: #6a705a; color: var(--text); }
#craft-subtabs button.on {
  border-style: solid;
  border-color: #7ab85a;
  color: #b9d69a;
  background: #1a2118;
}

#craft-wbinfo {
  font-size: 11px;
  letter-spacing: 1px;
  color: #6d6f64;
  margin-bottom: 10px;
}
#craft-wbinfo.ok { color: #9fc37a; }

#craft-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
}

.craft-recipe {
  position: relative;
  border: 1px solid #33362c;
  background: #131611;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.craft-recipe.locked { opacity: 0.62; }
.craft-recipe:hover { border-color: #6a705a; }

.craft-recipe .cr-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.craft-recipe .cr-icon {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  flex: none;
}
.craft-recipe .cr-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.craft-recipe .cr-wb {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 1px 6px;
  border: 1px solid;
}
.craft-recipe .cr-wb.ok { color: #9fc37a; border-color: #55703c; }
.craft-recipe .cr-wb.lack { color: #d9c34a; border-color: #8a7a24; }

.craft-recipe .cr-desc {
  font-size: 11.5px;
  line-height: 1.35;
  color: #8a8f7a;
}

.craft-recipe .cr-mats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.craft-recipe .cr-mat {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border: 1px solid;
  letter-spacing: 0.4px;
}
.craft-recipe .cr-mat i {
  font-style: normal;
  font-weight: 700;
  margin-left: 4px;
  font-variant-numeric: tabular-nums;
}
.craft-recipe .cr-mat.ok { color: #b9d69a; border-color: #456a2a; }
.craft-recipe .cr-mat.lack { color: #e88a80; border-color: #8a2a22; }

.craft-recipe .cr-btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 7px 14px;
  background: #1c211b;
  color: #c9d6b8;
  border: 1px solid #4a4f42;
  border-bottom-width: 3px;
  border-bottom-color: #9fc37a;
  cursor: pointer;
  align-self: flex-start;
  margin-top: 2px;
  transition: background 0.12s, border-color 0.12s;
}
.craft-recipe .cr-btn:hover:not(:disabled) {
  background: #2a3325;
  border-color: #6a705a;
  color: #dcecc8;
}
.craft-recipe .cr-btn:disabled {
  cursor: not-allowed;
  color: #6d6f64;
  border-bottom-color: #3a3f35;
  background: #161a15;
}

/* ================= v0.22: Ranuras de partida ================= */

/* el menú ahora es más alto (ranuras + enciclopedia): scroll correcto sin
   perder el centrado (margin:auto en el hijo dentro del flex) */
#menu { overflow-y: auto; }
.menu-inner { margin: auto; }
#menu .menu-controls { margin: 24px auto 20px; }

#slots-panel {
  margin: 18px auto 0;
  max-width: 560px;
  width: 100%;
  text-align: left;
}
.slots-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 4px;
  color: #6d6f64;
  text-align: center;
  margin-bottom: 10px;
}
.slots-title::before,
.slots-title::after { content: ' — '; color: #3a3f35; }

#slots-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slot-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 12px 9px 10px;
  background: #131611;
  border: 1px solid #33362c;
  border-left: 3px solid #4a4f42;
  transition: border-color 0.12s, background 0.12s;
}
.slot-row:hover { border-color: #6a705a; background: #161a15; }
.slot-row.empty { border-left-color: #2c3028; opacity: 0.92; }

.slot-num {
  flex: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  background: #1c211b;
  border: 1px solid #444a3e;
  border-bottom-width: 3px;
}
.slot-row.empty .slot-num { color: #6d6f64; }

.slot-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.slot-name {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text);
}
.slot-row.empty .slot-name { color: #8a8f7a; }
.slot-sum {
  font-size: 11px;
  letter-spacing: 0.8px;
  color: #7f8a70;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-row.empty .slot-sum { color: #565b4e; font-style: italic; }

.slot-actions {
  flex: none;
  display: flex;
  gap: 7px;
  align-items: center;
}
.slot-btn {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 7px 14px;
  background: #1c211b;
  color: #c9d6b8;
  border: 1px solid #4a4f42;
  border-bottom-width: 3px;
  border-bottom-color: #7ab85a;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.slot-btn:hover { background: #2a3325; border-color: #6a705a; color: #dcecc8; }

.slot-btn.del {
  border-bottom-color: #8a2a22;
  color: #b07a72;
  padding: 7px 10px;
}
.slot-btn.del:hover { color: #e8a09a; border-color: #6a3a34; background: #211615; }
.slot-btn.del.armed {
  background: #2a1210;
  border-color: #c8341f;
  border-bottom-color: #c8341f;
  color: #ffb4a8;
  animation: slotDelPulse 0.8s ease-in-out infinite alternate;
}
@keyframes slotDelPulse {
  from { box-shadow: 0 0 0 rgba(200, 52, 31, 0); }
  to   { box-shadow: 0 0 16px rgba(200, 52, 31, 0.55); }
}

.slots-hint {
  margin: 8px 0 0;
  font-size: 10.5px;
  letter-spacing: 1px;
  color: #565b4e;
  text-align: center;
}

/* botón ENCICLOPEDIA (menú principal y pausa) */
.btn-ency {
  font-size: 15px;
  letter-spacing: 4px;
  padding: 11px 40px;
  background: #1a2118;
  border: 1px solid #456a2a;
  border-bottom: 4px solid #12150f;
  color: #b9d69a;
}
.btn-ency:hover {
  background: #22301f;
  box-shadow: 0 0 26px rgba(122, 184, 90, 0.3);
  color: #dcecc8;
}

.retry-hint {
  margin: 14px 0 0;
  font-size: 11.5px;
  letter-spacing: 0.8px;
  color: #6d6f64;
}

/* ================= v0.24: selección de PROFESIÓN ================= */

#profscreen {
  position: fixed;
  inset: 0;
  z-index: 45;   /* sobre menús y muerte (40), bajo la enciclopedia (60) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8, 11, 8, 0.88) 0%, rgba(2, 4, 2, 0.97) 78%);
  cursor: default;
}

.prof-panel {
  width: min(1020px, 95vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: #0d100c;
  border: 1px solid #3a3f35;
  border-top: 3px solid #9a7ab8;
  box-shadow: 0 22px 90px rgba(0, 0, 0, 0.8);
  padding: 16px 18px 14px;
}

.prof-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #262b22;
}
.prof-head-txt h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--text);
}
.prof-head-txt h2::first-letter { color: #b99ad6; }
.prof-head-txt span {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #6d6f64;
}
#btn-prof-back {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 8px 18px;
  background: #1c211b;
  color: #c9d6b8;
  border: 1px solid #4a4f42;
  border-bottom-width: 3px;
  border-bottom-color: #8a2a22;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
#btn-prof-back:hover { background: #211615; color: #e8a09a; }

#prof-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 10px;
  margin: 14px 0 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #33362c #0d100c;
  padding: 2px;
}
#prof-list::-webkit-scrollbar { width: 10px; }
#prof-list::-webkit-scrollbar-thumb { background: #262b22; border: 2px solid #0d100c; }

.prof-card {
  border: 1px solid #33362c;
  border-left: 3px solid #8a8f7a;
  background: #131611;
  padding: 11px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.1s;
}
.prof-card:hover { border-color: #6a705a; background: #161a15; transform: translateY(-1px); }
.prof-card.sel {
  border-color: #9a7ab8;
  box-shadow: 0 0 0 1px #9a7ab8, 0 0 22px rgba(154, 122, 184, 0.22);
  background: #17131c;
}

.pc-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pc-icon {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.18);
  flex: none;
}
.pc-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
}
.prof-card.sel .pc-name { color: #d6c2e8; }

.pc-tag {
  font-size: 10px;
  font-style: italic;
  letter-spacing: 0.8px;
  color: #6d6f64;
}
.pc-desc {
  font-size: 11px;
  line-height: 1.45;
  color: #8a8f7a;
  flex: 1;
}
.pc-perks { display: flex; flex-wrap: wrap; gap: 5px; }

#prof-hint {
  font-size: 11.5px;
  letter-spacing: 0.6px;
  color: #9fc37a;
  text-align: center;
  min-height: 16px;
  margin: 2px 0 10px;
}

.prof-actions { display: flex; justify-content: center; }
#btn-prof-start {
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 5px;
  padding: 13px 46px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-bottom: 5px solid #6d180c;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, box-shadow 0.15s, opacity 0.15s;
}
#btn-prof-start:hover:not(:disabled) {
  background: #e0452f;
  box-shadow: 0 0 34px rgba(200, 52, 31, 0.5);
  transform: translateY(-2px);
}
#btn-prof-start:active:not(:disabled) { transform: translateY(1px); border-bottom-width: 2px; }
#btn-prof-start:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  background: #3a3f35;
  border-bottom-color: #262b22;
  color: #9a9f8a;
}

/* v0.24: línea de profesión en el obituario y la pausa */
.ds-prof {
  margin: 2px 0 16px;
  font-size: 12px;
  letter-spacing: 1.5px;
  color: #b99ad6;
}
.pause-prof {
  margin: 2px 0 6px;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: #b99ad6;
}

/* ================= v0.22: Enciclopedia ================= */

#encyclopedia {
  position: fixed;
  inset: 0;
  z-index: 60;   /* por encima de menús (40) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(8, 11, 8, 0.86) 0%, rgba(2, 4, 2, 0.97) 78%);
  cursor: default;
}

.ency-panel {
  width: min(940px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: #0d100c;
  border: 1px solid #3a3f35;
  border-top: 3px solid #7ab85a;
  box-shadow: 0 22px 90px rgba(0, 0, 0, 0.8);
  padding: 16px 18px 14px;
}

.ency-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #262b22;
}
.ency-head-txt h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--text);
}
.ency-head-txt h2::first-letter { color: #9fc37a; }
.ency-head-txt span {
  display: block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #6d6f64;
}
#btn-ency-close {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 8px 18px;
  background: #1c211b;
  color: #c9d6b8;
  border: 1px solid #4a4f42;
  border-bottom-width: 3px;
  border-bottom-color: #8a2a22;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
#btn-ency-close:hover { background: #211615; color: #e8a09a; }

#ency-tabs { display: flex; gap: 6px; margin: 12px 0 10px; flex-wrap: wrap; }
#ency-tabs button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 7px 16px;
  background: #131611;
  color: var(--text-dim);
  border: 1px solid #33362c;
  border-bottom-width: 3px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
#ency-tabs button:hover { background: #1a1e18; color: var(--text); }
#ency-tabs button.on {
  background: #1a2118;
  color: #c9d6b8;
  border-color: #6a705a;
  border-bottom-color: #9fc37a;
}

#ency-body {
  flex: 1;
  overflow-y: auto;
  min-height: 120px;
  padding: 4px 10px 10px 2px;
  scrollbar-width: thin;
  scrollbar-color: #33362c #0d100c;
}
#ency-body::-webkit-scrollbar { width: 10px; }
#ency-body::-webkit-scrollbar-thumb { background: #262b22; border: 2px solid #0d100c; }
#ency-body::-webkit-scrollbar-track { background: transparent; }

.ency-sec { margin: 14px 0 18px; }
.ency-sec h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  color: #c9d6b8;
  padding-left: 10px;
  border-left: 3px solid #7ab85a;
  margin-bottom: 8px;
}
.ency-sec p {
  font-size: 12.5px;
  line-height: 1.55;
  color: #8a8f7a;
  margin: 0 0 9px;
}
.ency-sec p b { color: #c9d6b8; letter-spacing: 0.3px; }

.ency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.ency-card {
  border: 1px solid #33362c;
  background: #131611;
  padding: 10px 12px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: border-color 0.12s;
}
.ency-card:hover { border-color: #6a705a; }

.ec-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ec-icon {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.5);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.18);
  flex: none;
}
.ec-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.5px;
}
.ec-tag {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 1px 6px;
  border: 1px solid;
}
.ec-tag.mil { color: #9fc37a; border-color: #55703c; }
.ec-tag.hos { color: #7ac8d9; border-color: #2a5a6a; }
.ec-tag.sto { color: #d9a520; border-color: #8a6a14; }
.ec-tag.fer { color: #e8934a; border-color: #8a5218; }   /* v0.25: SOLO HOME & TOOLS */

.ec-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.ec-chip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border: 1px solid #3a3f35;
  color: #a8ad96;
  font-variant-numeric: tabular-nums;
}
.ec-chip.ok { color: #b9d69a; border-color: #456a2a; }
.ec-chip.dmg { color: #e88a80; border-color: #8a2a22; }
.ec-chip.noise { color: #d9c34a; border-color: #8a7a24; }
.ec-chip.fire { color: #e8a05a; border-color: #8a5a1a; }
.ec-chip.wb { color: #9a7ab8; border-color: #5a3f72; }
.ec-chip.mat { color: #c8b8a0; border-color: #6a5a44; }

.ec-desc {
  font-size: 11.5px;
  line-height: 1.4;
  color: #8a8f7a;
}
.ec-where {
  font-size: 10.5px;
  line-height: 1.4;
  color: #6d6f64;
  margin-top: -2px;
}
.ec-where::before { content: '⌖ '; color: #9fc37a; }

/* ================== v0.26: VEHÍCULOS ================== */

/* categorías nuevas del inventario: piezas de coche y combustible */
.slot.cat-pieza { border-left: 3px solid #7ab0a8; }
.slot.cat-combustible { border-left: 3px solid #c8341f; }

/* chip AL VOLANTE */
.chip.car { color: #c8dce8; border-color: #3a6a8a; animation: critPulse 1.8s infinite; }

/* ---- CUADRO DE MANDO (dashboard) del coche: abajo-centro, al volante ---- */
#car-dash {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 13, 11, 0.92);
  border: 1px solid #2c3430;
  border-top: 2px solid #4a6a8a;
  padding: 8px 18px 9px;
  min-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 30;
}
#dash-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #c8dce8;
  text-align: center;
}
.dash-main {
  display: flex;
  justify-content: center;
  gap: 26px;
  align-items: baseline;
}
.dash-kv { display: flex; align-items: baseline; gap: 6px; }
.dash-lbl { font-size: 9px; letter-spacing: 1.5px; color: #6d7a70; font-weight: 700; }
#dash-speed {
  font-size: 30px;
  font-weight: 700;
  color: #e8ede8;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.dash-unit { font-size: 11px; color: #8a958c; font-weight: 600; }
#dash-odo {
  font-size: 16px;
  font-weight: 700;
  color: #c8dce8;
  font-variant-numeric: tabular-nums;
}
.dash-bars {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-bar {
  flex: 1;
  height: 9px;
  background: #171c18;
  border: 1px solid #2c3430;
  overflow: hidden;
}
.dash-bar .fill { height: 100%; background: linear-gradient(90deg, #6a8a3a, #9fc37a); }
.dash-bar.temp .fill { background: linear-gradient(90deg, #4a6a8a, #d9822a); }
#dash-fuel-txt, #dash-temp {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8a958c;
  white-space: nowrap;
}
.dash-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8a958c;
}
#dash-engine.ok, #dash-temp.ok, #dash-lights.ok, #dash-tires.ok { color: #9fc37a; }
#dash-engine.warn, #dash-temp.warn, #dash-tires.warn { color: #d9c34a; }
#dash-engine.bad, #dash-temp.bad { color: #e05a4f; animation: critPulse 1.2s infinite; }

/* ---- FICHA DE INSPECCIÓN del coche (modal [Q]) ---- */
#carscreen {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 5, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}
.car-panel {
  width: min(760px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  background: #101310;
  border: 1px solid #3f443a;
  border-top: 3px solid #c8341f;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}
.car-panel::-webkit-scrollbar { width: 8px; }
.car-panel::-webkit-scrollbar-thumb { background: #33362c; }
.car-panel header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid #2c2f28;
}
.car-panel h2 { font-size: 22px; font-weight: 700; letter-spacing: 3px; }
.car-head-txt span { font-size: 12px; color: var(--text-dim); letter-spacing: 1px; }
.car-panel header button, .car-panel .car-act, .car-panel .car-part button {
  margin-left: auto;
  background: #1c211c;
  border: 1px solid #3a3f35;
  color: #d8d5cc;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 6px 14px;
  cursor: pointer;
}
.car-panel header button:hover, .car-panel .car-act:hover:not(:disabled),
.car-panel .car-part button:hover { background: #2c342c; border-color: #6a8a5a; color: #fff; }
.car-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 16px 22px 8px;
}
@media (max-width: 720px) { .car-body { grid-template-columns: 1fr; } }
.car-col h3 {
  font-size: 11px;
  letter-spacing: 2px;
  color: #7a8578;
  margin: 4px 0 8px;
}
.car-kv {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
  border-bottom: 1px dashed #232823;
}
.car-kv span { color: #8a958c; }
.car-kv b { color: #d8d5cc; font-weight: 600; }
.car-kv b.ok { color: #9fc37a; }
.car-kv b.warn { color: #d9c34a; }
.car-kv b.bad { color: #e05a4f; }
.car-fuel {
  height: 14px;
  background: #171c18;
  border: 1px solid #2c3430;
  overflow: hidden;
  margin: 4px 0 6px;
}
.car-fuel .fill { height: 100%; background: linear-gradient(90deg, #8a2418, #c8341f); }
.car-act {
  display: block;
  width: 100%;
  margin: 8px 0 0 !important;
  text-align: center;
}
.car-act:disabled { opacity: 0.45; cursor: not-allowed; }
.car-part {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 3px 0;
  background: #151a15;
  border: 1px solid #232823;
  font-size: 12.5px;
}
.car-part.ok { border-left: 3px solid #6a8a3a; }
.car-part.miss { border-left: 3px solid #c8341f; }
.cp-ico {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8a958c;
  border: 1px solid #3a3f35;
  padding: 1px 4px;
}
.cp-name { font-weight: 600; color: #d8d5cc; }
.cp-state { margin-left: auto; font-size: 10px; letter-spacing: 1px; font-weight: 700; }
.car-part.ok .cp-state { color: #9fc37a; }
.car-part.miss .cp-state { color: #e05a4f; }
.car-part button { margin-left: 6px !important; padding: 4px 10px !important; }
.car-note {
  font-size: 10.5px;
  line-height: 1.45;
  color: #6d6f64;
  margin-top: 10px;
}
.car-actions { padding: 12px 22px 18px; }
.car-actions button {
  width: 100%;
  background: #26301f;
  border: 1px solid #456a2a;
  color: #c9e0b0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 10px 0;
  cursor: pointer;
}
.car-actions button:hover:not(:disabled) { background: #31402a; }
.car-actions button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ==================== v0.27: MULTIJUGADOR ==================== */
/* Paneles de sala (crear / unirse / lobby / aviso) + lista TAB + chip de
   sala. Misma alma visual que las pantallas de profesión y enciclopedia. */

#mpscreen, #mp-lobby, #mp-notice {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 4, 0.82);
}
.mp-panel {
  width: min(680px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: #0d100c;
  border: 1px solid #3a3f35;
  border-top: 3px solid #6aa8d8;
  box-shadow: 0 22px 90px rgba(0, 0, 0, 0.8);
  padding: 16px 18px 14px;
}
.mp-panel.small { width: min(460px, 94vw); border-top-color: #d8a04a; }
.mp-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #262b22;
}
.mp-head-txt h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--text);
}
#mplobby-code { color: #6aa8d8; letter-spacing: 10px; }
.mp-head-txt span {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  letter-spacing: 1.5px;
  color: #8a8d80;
}
.mp-panel > header > button {
  background: #1d2318;
  border: 1px solid #3a4430;
  color: #b8bbab;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.mp-panel > header > button:hover { background: #263020; color: #e6e8dc; }

/* formulario de entrada */
.mp-form { padding: 18px 6px 6px; }
.mp-field span {
  display: block;
  font-size: 11.5px;
  letter-spacing: 3px;
  color: #8a8d80;
  margin-bottom: 6px;
}
.mp-field input, .mp-join input {
  width: 100%;
  background: #10140e;
  border: 1px solid #3a4430;
  color: #e6e8dc;
  font-family: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 10px 14px;
  outline: none;
}
.mp-join input { letter-spacing: 8px; text-align: center; width: 170px; }
.mp-field input:focus, .mp-join input:focus { border-color: #6aa8d8; }
.mp-actions-row {
  display: flex;
  gap: 14px;
  align-items: stretch;
  margin-top: 18px;
  flex-wrap: wrap;
}
.mp-actions-row button, .mp-lobby-actions button, .mp-panel.small > button {
  background: #26301f;
  border: 1px solid #456a2a;
  color: #c9e0b0;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2.5px;
  padding: 12px 20px;
  cursor: pointer;
}
.mp-actions-row button:hover:not(:disabled),
.mp-lobby-actions button:hover:not(:disabled) { background: #31402a; }
.mp-actions-row button:disabled, .mp-lobby-actions button:disabled {
  opacity: 0.45; cursor: not-allowed;
}
button.mp-big {
  background: #2c3a4a !important;
  border-color: #4a6a8a !important;
  color: #c5d8e8 !important;
  flex: 1;
  min-width: 200px;
}
button.mp-big:hover:not(:disabled) { background: #36485c !important; }
.mp-join { display: flex; gap: 10px; flex: 1; min-width: 280px; }
.mp-join button { flex: 1; }
#mp-hint { padding: 14px 6px 4px; font-size: 14px; line-height: 1.5; color: #a8aba0; }
.mp-note {
  padding: 10px 6px 2px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #6d6f64;
  border-top: 1px dashed #262b22;
  margin-top: 10px;
}

/* lobby: plantel */
#mplobby-list { padding: 14px 4px; display: flex; flex-direction: column; gap: 8px; }
.mpl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #10140e;
  border: 1px solid #262b22;
  padding: 10px 14px;
}
.mpl-row.me { border-color: #4a6a8a; }
.mpl-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 8px rgba(0,0,0,0.6); flex: none; }
.mpl-name { font-weight: 700; letter-spacing: 2px; font-size: 16px; color: #e6e8dc; }
.mpl-name i, .mp-list i { font-style: normal; font-size: 11px; color: #8a8d80; }
.mpl-prof { margin-left: auto; font-size: 13px; letter-spacing: 1.5px; color: #9fc37a; }
.mp-lobby-actions { display: flex; gap: 14px; padding: 8px 4px 4px; flex-wrap: wrap; }

/* aviso de sala cerrada */
.mp-panel.small p { padding: 14px 4px; color: #a8aba0; font-size: 14.5px; line-height: 1.5; }
.mp-panel.small > button { width: 100%; }

/* botón del menú principal */
.btn-mp {
  background: #2c3a4a !important;
  border: 1px solid #4a6a8a !important;
  color: #c5d8e8 !important;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 14px 30px;
  cursor: pointer;
}
.btn-mp:hover { background: #36485c !important; color: #fff !important; }

/* chip de sala (status-chips) */
.chip.mp { color: #8ac0e8; border-color: #3a6a8a; }

/* lista de jugadores (TAB mantenido) */
#mp-list {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  min-width: 340px;
  background: rgba(10, 13, 9, 0.92);
  border: 1px solid #3a4430;
  border-top: 2px solid #6aa8d8;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.7);
  padding: 10px 14px 8px;
}
#mp-list h3 {
  font-size: 15px;
  letter-spacing: 4px;
  color: #8ac0e8;
  padding-bottom: 8px;
  border-bottom: 1px solid #262b22;
  margin-bottom: 8px;
}
.mp-row { display: flex; align-items: center; gap: 10px; padding: 5px 2px; }
.mp-row .mp-dot { width: 11px; height: 11px; border-radius: 50%; }
.mp-row .mp-name { font-size: 14px; font-weight: 700; letter-spacing: 1.5px; color: #d8dbd0; }
.mp-row.me .mp-name { color: #8ac0e8; }
.mp-row .mp-hp { margin-left: auto; font-size: 12.5px; color: #9fc37a; }
.mp-row.dead .mp-hp { color: #e05a4f; }
.mp-row .mp-rtt { font-size: 11.5px; color: #6d6f64; min-width: 52px; text-align: right; }
#mp-list .mp-note { border: none; margin: 0; padding: 8px 0 2px; }

/* ==================== v0.28: SERVIDORES + CHAT ==================== */

/* pestañas SALAS / SERVIDORES del panel de multijugador */
.mp-tabs {
  display: flex;
  gap: 0;
  margin: 6px 0 12px;
  border-bottom: 1px solid #2c3325;
}
.mp-tabs button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 3px;
  padding: 8px 22px;
  background: transparent;
  color: #6d7264;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.mp-tabs button:hover { color: #b8bfae; }
.mp-tabs button.sel {
  color: #d8dbd0;
  border-bottom-color: #d8a04a;
}

/* fila de entrada a un mundo: código de 6 + clave de 4 + botón */
.srv-join input {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 5px;
  text-align: center;
  background: #141a11;
  border: 1px solid #4a4f42;
  color: #d8dbd0;
  padding: 8px 10px;
  outline: none;
}
.srv-join #srv-code { width: 130px; }
.srv-join #srv-pass { width: 96px; letter-spacing: 8px; color: #d8a04a; }
.srv-join input:focus { border-color: #d8a04a; }
.srv-join button { flex: 1; min-width: 170px; }

/* MIS MUNDOS — lista local de mundos del navegador */
.srv-mine {
  margin-top: 12px;
  border: 1px solid #2c3325;
  background: rgba(10, 13, 9, 0.6);
  max-height: 218px;
  overflow-y: auto;
}
.srv-mine-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-bottom: 1px solid #2c3325;
}
.srv-mine-head span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: #8d8f84;
}
.srv-mine-head button {
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 2px 9px;
  background: #1c211b;
  color: #8d8f84;
  border: 1px solid #3a3f35;
  border-radius: 3px;
  cursor: pointer;
}
.srv-mine-head button:hover { color: #d8dbd0; border-color: #6a705a; }
.srv-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-bottom: 1px solid #20261c;
}
.srv-row:last-child { border-bottom: none; }
.srv-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.srv-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #d8dbd0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.srv-sum { font-size: 11.5px; color: #6d7264; letter-spacing: 0.5px; }
.srv-actions { display: flex; gap: 8px; flex-shrink: 0; }
.srv-empty {
  padding: 14px 10px;
  font-size: 13px;
  color: #6d7264;
  line-height: 1.5;
}

/* hint del flujo de servidores (código + contraseña al crear) */
.srv-hint {
  padding: 10px 6px 2px;
  color: #a8aba0;
  font-size: 14.5px;
  line-height: 1.55;
}
.srv-hint:empty { display: none; }
.srv-hint b { color: #d8a04a; font-size: 16px; letter-spacing: 2px; }

/* CHAT de sala — registro de líneas (arriba de las barras, abajo-izq) */
#mp-chat {
  position: fixed;
  left: 18px;
  bottom: 254px;
  z-index: 38;
  width: min(400px, 46vw);
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 9px;
  background: rgba(8, 11, 7, 0.55);
  border-left: 2px solid #3a4430;
  pointer-events: none;
}
#mp-chat.pinned { background: rgba(8, 11, 7, 0.82); border-left-color: #6aa8d8; }
.chat-line {
  font-size: 13.5px;
  line-height: 1.35;
  color: #cdd2c4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
  word-break: break-word;
}
.chat-line .chat-name { font-weight: 700; letter-spacing: 1px; }
.chat-line.sys { color: #a8aba0; font-style: italic; font-size: 12.5px; }

/* campo de escritura del chat ([T]) — centrado, sobre la barra rápida */
#mp-chat-form {
  position: fixed;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(560px, 86vw);
  padding: 8px 10px;
  background: rgba(10, 13, 9, 0.94);
  border: 1px solid #3a6a8a;
  border-bottom-width: 3px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.7);
}
#mp-chat-form .chat-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8ac0e8;
  border: 1px solid #3a6a8a;
  padding: 2px 6px;
  flex-shrink: 0;
}
#mp-chat-input {
  flex: 1;
  font-family: inherit;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: #e6e8dc;
  background: #141a11;
  border: 1px solid #4a4f42;
  padding: 6px 9px;
  outline: none;
}
#mp-chat-input:focus { border-color: #6aa8d8; }

/* lista TAB: compañero CAÍDO (reanimable) */
.mp-row.down .mp-hp { color: #e8c35a; }
