/* MMORPG Experience — estilos RPG (v0.0.1n) */

@import url("https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&family=Cinzel:wght@400;600;700&family=Inter:wght@400;500;600;700&display=swap");

/* Variables de tema (por si se quita Tailwind más adelante) */
:root {
  --rpg-dark: #050816;
  --rpg-card: #101827;
  --rpg-accent: #f59e0b;
  --rpg-accent-soft: #78350f;
  --mobile-breakpoint: 768px;
  --rpg-font-display: "Cinzel Decorative", "Cinzel", Georgia, serif;
  --rpg-font-ui: "Cinzel", Georgia, "Times New Roman", serif;
  --rpg-font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: transparent;
  background-image: url("./assets/images/fondo.png");
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: var(--rpg-font-body);
}

/* ——— Títulos oro blanco / platino ——— */
.text-rpgName {
  font-family: var(--rpg-font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  line-height: 1.2;
  background: linear-gradient(to bottom, #ffffff 0%, #fde68a 40%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.8));
}

/* Títulos de paneles y secciones (menú) — Cinzel, oro claro */
.rpg-menu-title {
  font-family: var(--rpg-font-ui);
  color: #fef3c7;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  padding-bottom: 4px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
@media (min-width: 1024px) {
  h2.rpg-menu-title {
    font-size: 1.125rem !important;
    line-height: 1.35;
  }
  h2.rpg-menu-title.rpg-menu-title--combat {
    font-size: 1.25rem !important;
  }
}
.rpg-menu-title--combat {
  color: #fecaca;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.45);
  border-bottom-color: rgba(248, 113, 113, 0.4);
}
/* Encabezado de zona en combate: nombre + FASE / OLEADA estilo RPG clásico */
.combat-zone-title-eq {
  font-family: var(--rpg-font-ui);
  color: #fde68a;
  text-shadow: 0 0 12px rgba(245, 158, 11, 0.35), 0 1px 0 rgba(0, 0, 0, 0.85);
  border-bottom-color: rgba(251, 191, 36, 0.35);
}
.combat-zone-subtitle-eq {
  font-family: var(--rpg-font-ui);
  letter-spacing: 0.06em;
}
.combat-zone-subtitle-eq .combat-header-phase {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.92em;
  color: var(--rpg-accent);
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.35);
}
.combat-zone-subtitle-eq .combat-header-sep {
  color: rgba(180, 83, 9, 0.55);
  font-weight: 400;
  letter-spacing: 0.02em;
}
.combat-zone-subtitle-eq .combat-header-wave {
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.88em;
  color: #cbd5e1;
}
.rpg-heading-cinzel {
  font-family: var(--rpg-font-ui);
}

.text-rpgStat {
  font-family: var(--rpg-font-body);
  color: #d1d5db;
}
.text-rpgLevel {
  color: #ef4444;
  font-weight: 700;
}
.text-rpgGuild {
  color: #f59e0b;
  font-weight: 600;
}

/* Botón de emergencia (login / creación): limpieza localStorage + caches */
.btn-rpg {
  font-family: var(--rpg-font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.45rem 0.65rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(245, 158, 11, 0.45);
  background: rgba(15, 23, 42, 0.85);
  color: #fcd34d;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-rpg:hover {
  background: rgba(120, 53, 15, 0.35);
  border-color: rgba(251, 191, 36, 0.75);
  color: #fef3c7;
}
.btn-rpg:active {
  transform: scale(0.98);
}

/* Crónicas / chat ciudad: sans legible (sin decorativas) */
#logBox.chronicle-log-panel {
  font-family: var(--rpg-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: #e2e8f0;
}
@media (max-width: 768px) {
  #logBox.chronicle-log-panel {
    font-size: 14px;
  }
}
#logBox.chronicle-log-panel .chronicle-chat {
  color: #e2e8f0;
}
@media (min-width: 1024px) {
  #logBox.chronicle-log-panel--city {
    max-height: min(200px, 26vh) !important;
    min-height: 100px !important;
    font-size: 14px;
    line-height: 1.4;
  }
}
.rpg-chat-speaker {
  font-family: var(--rpg-font-body);
  font-weight: 700;
  color: #fbbf24;
}
#cityChatInput {
  font-family: var(--rpg-font-body);
}
#chronicleScrollContent.rpg-chronicle-scroll-body {
  font-family: var(--rpg-font-body);
  font-size: 15px;
  line-height: 1.5;
  color: #e2e8f0;
}

/* Botones de acción (Cinzel + blanco) */
main button.rpg-gradient-btn,
main button.rpg-press-3d,
main #cityChatSendBtn,
main #splashEnterBtn {
  font-family: var(--rpg-font-ui);
  font-weight: 700;
}
/* Cristal + borde ámbar. Nunca fijar ancho aquí: .rpg-panel / .bg-rpgCard van en header, grids y
   modales; width/padding/flex con !important rompía Tailwind (todo el sitio ~320px y header siempre columna). */
.rpg-panel,
.rpg-panel.bg-rpgCard,
.bg-rpgCard {
  background: rgba(10, 15, 25, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  border: 1px solid rgba(245, 158, 11, 0.3) !important;
  border-radius: 0.75rem !important;
}

/* Cartas de combate: ancho = celda de la rejilla (2 columnas); 300px fijos rompía el layout y solapaba fichas */
#combatPartyList .combat-slot-inner.bg-rpgCard,
#combatEnemyList .combat-slot-inner.bg-rpgCard {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 0.5rem 0.45rem !important;
  gap: 0.5rem !important;
}

/* Solo el slot (flex item) lleva min-width:0 para truncar texto; el inner al 100% no debe forzar min 0 */
#combatPartyList .combat-party-row .combat-slot:not(.combat-slot-pet),
#combatEnemyList .combat-slot {
  min-width: 0;
}

/* El JS pone min-width:150px en el nombre; en 2 columnas estrechas fuerza solapamiento */
#combatEnemyList .enemy-name-cell {
  min-width: 0 !important;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Iconos de moneda / UI nítidos en pantallas densas */
img.h-5.w-5,
img.h-6.w-6.object-contain,
img.object-contain {
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
}

/* Botones: Cinzel negrita, texto blanco puro */
.rpg-gradient-btn {
  font-family: var(--rpg-font-ui);
  font-weight: 700;
  background-image: linear-gradient(180deg, var(--rpg-accent-soft) 0%, var(--rpg-accent) 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  border-bottom: 3px solid rgba(0, 0, 0, 0.4) !important;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, filter 0.12s ease-out;
}
.rpg-gradient-btn:hover {
  filter: brightness(1.06);
}
.rpg-gradient-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1px !important;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

/* Mismo relieve 3D sin cambiar el color del gradiente (p. ej. Comenzar aventura, importar) */
.rpg-press-3d {
  font-family: var(--rpg-font-ui);
  font-weight: 700;
  color: #ffffff !important;
  border-bottom: 3px solid rgba(0, 0, 0, 0.4) !important;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}
.rpg-press-3d:active {
  transform: translateY(2px);
  border-bottom-width: 1px !important;
  box-shadow: none;
}

/* Controles de combate: mismo relieve; conservan matices vía filter sobre el gradiente base */
#combatControlBar .combat-ctrl-btn {
  font-family: var(--rpg-font-ui);
  font-weight: 700;
  color: #ffffff !important;
  background-image: linear-gradient(180deg, var(--rpg-accent-soft) 0%, var(--rpg-accent) 100%);
  border-bottom: 3px solid rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  transition: transform 0.08s ease-out, filter 0.12s ease-out;
}
#combatControlBar .combat-ctrl-auto {
  filter: hue-rotate(260deg) saturate(1.15);
}
#combatControlBar .combat-ctrl-farming {
  filter: saturate(0.35) brightness(0.85);
}
#combatControlBar .combat-ctrl-city {
  filter: hue-rotate(-5deg) saturate(0.9);
}
#combatControlBar .combat-ctrl-btn:hover {
  filter: brightness(1.08);
}
#combatControlBar .combat-ctrl-auto:hover {
  filter: hue-rotate(260deg) saturate(1.15) brightness(1.08);
}
#combatControlBar .combat-ctrl-farming:hover {
  filter: saturate(0.35) brightness(0.95);
}
#combatControlBar .combat-ctrl-city:hover {
  filter: hue-rotate(-5deg) saturate(0.9) brightness(1.08);
}
#combatControlBar .combat-ctrl-btn:active {
  transform: translateY(2px);
  border-bottom-width: 1px;
}

/* Barras de vida en combate: tubo de energía */
#combatView .bar-background-hp {
  position: relative;
  height: 20px;
  min-height: 20px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.65), inset 0 -1px 0 rgba(255, 255, 255, 0.06);
  background-color: #0f172a;
}
#combatView .bar-fill-hp {
  position: relative;
  z-index: 1;
  background: linear-gradient(90deg, #047857 0%, #10b981 50%, #4ade80 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
#combatView .bar-hp-pct-overlay {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(10px, 2.4vw, 12px);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #ffffff;
  /* ~Tailwind drop-shadow-md + legibilidad sobre el fill */
  filter: drop-shadow(0 4px 3px rgb(0 0 0 / 0.25)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.2));
  pointer-events: none;
  z-index: 2;
}
#combatView .bar-row-hp .bar-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
}
#combatView .bar-hp-fraction {
  font-size: 9px;
  font-weight: 600;
  color: rgba(209, 213, 219, 0.85);
  text-transform: none;
}

#combatView .combat-slot-inner.combat-slot-ally-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}
#combatView .combat-ally-name.text-rpgName {
  font-size: 0.7rem !important;
  line-height: 1.25 !important;
  letter-spacing: 0.05em !important;
  text-transform: none;
  width: 100%;
  text-align: center;
}
@media (min-width: 640px) {
  #combatView .combat-ally-name.text-rpgName {
    font-size: 0.8rem !important;
  }
}
#combatView .combat-slot-bars--ally {
  min-height: 0 !important;
  flex: 1 1 auto;
}
#combatView .combat-slot-enemy-card {
  min-width: 0;
}

/* Auto-Combat activo: resplandor dorado */
#autoCombatBtn.auto-combat-active {
  box-shadow:
    0 0 0 2px rgba(245, 158, 11, 0.55),
    0 0 22px rgba(250, 204, 21, 0.5),
    0 0 40px rgba(251, 191, 36, 0.25) !important;
  animation: auto-combat-glow 1.2s ease-in-out infinite alternate;
}
@keyframes auto-combat-glow {
  from {
    box-shadow:
      0 0 0 2px rgba(245, 158, 11, 0.45),
      0 0 16px rgba(250, 204, 21, 0.35);
  }
  to {
    box-shadow:
      0 0 0 2px rgba(245, 158, 11, 0.75),
      0 0 32px rgba(250, 204, 21, 0.65),
      0 0 48px rgba(251, 191, 36, 0.35);
  }
}

/* Log de combate: viñeta superior (noticias flotantes) */
.combat-log-smart {
  position: relative;
  isolation: isolate;
}
.combat-log-smart::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 28px;
  background: linear-gradient(to bottom, rgba(5, 8, 22, 0.97), rgba(5, 8, 22, 0.4), transparent);
  pointer-events: none;
  z-index: 3;
  border-radius: 0.75rem 0.75rem 0 0;
}
.combat-log-smart .combat-log-box {
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .app-shell {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
  }
  #combatControlBar .combat-ctrl-btn {
    font-size: max(16px, 0.875rem);
    min-height: 44px;
  }
  #combatLogBox {
    min-height: 0 !important;
  }
  #combat-log:not(.combat-log-visual-collapsed):not(.collapsed) #combatLogBox {
    max-height: min(42vh, 320px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }
}

@keyframes raid-shake {
  0% { transform: translate(0, 0) rotate(0deg); }
  10% { transform: translate(-2px, 1px) rotate(-0.2deg); }
  20% { transform: translate(2px, -1px) rotate(0.2deg); }
  30% { transform: translate(-3px, 2px) rotate(-0.3deg); }
  40% { transform: translate(3px, -2px) rotate(0.3deg); }
  50% { transform: translate(-2px, -1px) rotate(-0.2deg); }
  60% { transform: translate(2px, 1px) rotate(0.2deg); }
  70% { transform: translate(-3px, -2px) rotate(-0.3deg); }
  80% { transform: translate(3px, 2px) rotate(0.3deg); }
  90% { transform: translate(-1px, 1px) rotate(-0.1deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.shake {
  animation: raid-shake 90ms linear infinite;
}

/* Touch: elimina retraso 300ms en móviles, área táctil mínima */
html, body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button, a, [role="button"] {
  touch-action: manipulation;
}

/* Scrollbar del log de crónicas */
#logBox::-webkit-scrollbar {
  width: 6px;
}
#logBox::-webkit-scrollbar-track {
  background: transparent;
}
#logBox::-webkit-scrollbar-thumb {
  background: rgba(55, 65, 81, 0.8);
  border-radius: 3px;
}
#logBox::-webkit-scrollbar-thumb:hover {
  background: rgba(75, 85, 99, 0.9);
}

/* Botón de ciudad resaltado (pantalla por defecto) */
.city-building-highlight {
  box-shadow: 0 0 24px rgba(251, 191, 36, 0.6);
  border-color: rgba(251, 191, 36, 0.9) !important;
}

/* Roster de aventureros en Guild Hall — scroll para 14 personajes */
.roster-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.8) rgba(30, 41, 59, 0.6);
}
.roster-scroll::-webkit-scrollbar {
  width: 5px;
}
.roster-scroll::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.6);
  border-radius: 3px;
}
.roster-scroll::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.8);
  border-radius: 3px;
}

/* Bestiario: contenedor con scroll (30+ enemigos por zona) */
.bestiary-list {
  min-height: 120px;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 119, 6, 0.8) rgba(30, 41, 59, 0.6);
}
/* Scrollbar del Bestiario — delgada y dorada (EverQuest) */
.bestiary-list::-webkit-scrollbar {
  width: 4px;
}
.bestiary-list::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.6);
  border-radius: 2px;
}
.bestiary-list::-webkit-scrollbar-thumb {
  background: rgba(217, 119, 6, 0.8);
  border-radius: 2px;
}
.bestiary-list::-webkit-scrollbar-thumb:hover {
  background: rgba(251, 191, 36, 0.9);
}

/* Ficha de detalle del Bestiario: scroll si hay mucho loot/habilidades */
.bestiary-detail {
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 119, 6, 0.8) rgba(30, 41, 59, 0.6);
}
.bestiary-detail::-webkit-scrollbar {
  width: 4px;
}
.bestiary-detail::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.6);
  border-radius: 2px;
}
.bestiary-detail::-webkit-scrollbar-thumb {
  background: rgba(217, 119, 6, 0.8);
  border-radius: 2px;
}
.bestiary-detail::-webkit-scrollbar-thumb:hover {
  background: rgba(251, 191, 36, 0.9);
}

/* Tooltip flotante del Bestiario (habilidades y loot) */
.enemy-tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  max-width: 320px;
}
.enemy-tooltip .enemy-tooltip-inner,
.enemy-tooltip .master-tooltip {
  background: rgba(10, 15, 28, 0.95);
  border: 1px solid rgba(59, 130, 246, 0.5);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(251, 191, 36, 0.15);
  color: #e5e7eb;
}
.enemy-tooltip .enemy-tooltip-inner {
  border-color: rgba(217, 119, 6, 0.7);
}

/* Encabezado del Bestiario fijo al hacer scroll */
.bestiary-header-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  background: linear-gradient(to bottom, rgba(2, 6, 23, 0.98), rgba(2, 6, 23, 0.95));
  padding-bottom: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Asegurar que el contenido esté por encima del overlay */
.relative {
  position: relative;
  z-index: 1;
}

/* Transiciones suaves en botones de edificios */
button[id^="building"] {
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

/* Platino brillante: degradado metálico para moneda */
.platino-brillante {
  background: linear-gradient(to bottom, #ffffff 0%, #e5e4e2 50%, #b0c4de 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0px 0px 2px rgba(255,255,255,0.5));
}

/* Focus visible para accesibilidad */
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--rpg-accent);
  outline-offset: 2px;
}

/* Ficha de personaje Guild Hall - zona agradable y grande */
#buildingPanel.building-guild-active {
  background: rgba(5, 8, 22, 0.92);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 40px rgba(129, 140, 248, 0.15);
}

/* Rarity glow: box-shadow animado en iconos/slots de ítems (Bazar: fino #0070dd, raro #ffcc00, épico #a335ee, legendario #ff8000) */
.comun,
.fino,
.equip-slot.comun,
.equip-slot.fino,
.inventory-slot.comun,
.inventory-slot.fino,
.bestiary-loot-icon.comun,
.bestiary-loot-icon.fino {
  animation: rarity-glow-fino 2.5s ease-in-out infinite;
}
.bazaar-item.comun,
.bazaar-item.fino {
  animation: none;
  box-shadow: inset 3px 0 0 0 rgba(0, 112, 221, 0.85);
}
.raro,
.equip-slot.raro,
.inventory-slot.raro,
.bestiary-loot-icon.raro {
  animation: rarity-glow-raro 2.5s ease-in-out infinite;
}
.bazaar-item.raro {
  animation: none;
  box-shadow: inset 3px 0 0 0 rgba(255, 204, 0, 0.9);
}
.epico,
.equip-slot.epico,
.inventory-slot.epico {
  animation: rarity-glow-epico 2.5s ease-in-out infinite;
}
.bazaar-item.epico,
.bestiary-loot-icon.epico {
  animation: none;
  box-shadow: inset 3px 0 0 0 rgba(163, 53, 238, 0.9);
}
.bazaar-item-glow.fabled,
.bestiary-loot-icon.fabled {
  animation: rarity-glow-fabled 2.5s ease-in-out infinite;
}
.bazaar-item-glow.artefacto,
.bestiary-loot-icon.artefacto {
  animation: rarity-glow-artefacto 2.5s ease-in-out infinite;
}
@keyframes rarity-glow-fabled {
  0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.6), 0 0 24px rgba(220, 38, 38, 0.3); }
  50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.95), 0 0 40px rgba(220, 38, 38, 0.5); }
}
@keyframes rarity-glow-artefacto {
  0%, 100% { box-shadow: 0 0 12px rgba(251, 146, 60, 0.6), 0 0 24px rgba(234, 88, 12, 0.3); }
  50% { box-shadow: 0 0 20px rgba(251, 146, 60, 0.95), 0 0 40px rgba(234, 88, 12, 0.5); }
}
.legendario,
.equip-slot.legendario,
.inventory-slot.legendario,
.bestiary-loot-icon.legendario {
  animation: rarity-glow-legendario 2.5s ease-in-out infinite;
}
.bazaar-item.legendario {
  animation: none;
  box-shadow: inset 3px 0 0 0 rgba(255, 128, 0, 0.95);
}
@keyframes rarity-glow-fino {
  0%, 100% { box-shadow: 0 0 8px rgba(0, 112, 221, 0.45), 0 0 16px rgba(0, 112, 221, 0.2); }
  50% { box-shadow: 0 0 14px rgba(0, 112, 221, 0.75), 0 0 26px rgba(0, 112, 221, 0.38); }
}
@keyframes rarity-glow-raro {
  0%, 100% { box-shadow: 0 0 8px rgba(255, 204, 0, 0.5), 0 0 16px rgba(255, 204, 0, 0.22); }
  50% { box-shadow: 0 0 16px rgba(255, 204, 0, 0.85), 0 0 28px rgba(255, 204, 0, 0.45); }
}
@keyframes rarity-glow-epico {
  0%, 100% { box-shadow: 0 0 10px rgba(163, 53, 238, 0.5), 0 0 20px rgba(163, 53, 238, 0.22); }
  50% { box-shadow: 0 0 20px rgba(163, 53, 238, 0.9), 0 0 36px rgba(163, 53, 238, 0.48); }
}
@keyframes rarity-glow-legendario {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 128, 0, 0.5), 0 0 24px rgba(255, 128, 0, 0.22); }
  50% { box-shadow: 0 0 24px rgba(255, 128, 0, 0.92), 0 0 44px rgba(255, 128, 0, 0.48); }
}

/* Atlas zone tiers: T3 azul, T4 rojo, T5 naranja con fuego */
.atlas-zone-tier3 { box-shadow: 0 0 12px rgba(59, 130, 246, 0.4); }
.atlas-zone-tier4 { box-shadow: 0 0 12px rgba(239, 68, 68, 0.5); }
.atlas-zone-tier5 {
  animation: atlas-tier5-fire 2.5s ease-in-out infinite;
  box-shadow: 0 0 16px rgba(251, 146, 60, 0.6);
}
@keyframes atlas-tier5-fire {
  0%, 100% { box-shadow: 0 0 12px rgba(251, 146, 60, 0.5), 0 0 24px rgba(234, 88, 12, 0.2); }
  50% { box-shadow: 0 0 20px rgba(251, 146, 60, 0.9), 0 0 40px rgba(234, 88, 12, 0.5); }
}

/* Heavenly Planes - Plane of Air: aura blanca/cian con viento/rayos */
.heavenly-plane-air {
  animation: heavenly-plane-air-glow 2.5s ease-in-out infinite;
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.5);
}
@keyframes heavenly-plane-air-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 255, 255, 0.4), 0 0 20px rgba(34, 211, 238, 0.5); }
  50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.7), 0 0 36px rgba(34, 211, 238, 0.8); }
}

.equip-slot {
  transition: background 0.15s, border-color 0.15s;
}
.equip-slot:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: rgba(129, 140, 248, 0.4);
}

/* Tooltip mejorado para slots de equipo */
.equip-slot[title] {
  cursor: help;
}

/* Slots de equipo: mínimo 44x44px para touch (mobile friendly) */
.equip-slot-droppable {
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
}

/* Selector de Equipo: panel grande para móvil */
#equipmentSelectorModal {
  display: flex;
}
#itemDetailModal.hidden {
  display: none !important;
}
#backupExportModal.hidden,
#backupImportModal.hidden {
  display: none !important;
}
#backupImportCode {
  -webkit-user-select: text;
  user-select: text;
}

/* Chat GM - destacar sobre todo lo demás */
.chronicle-gm-line {
  background: linear-gradient(90deg, rgba(220, 38, 38, 0.25), transparent);
  border-left: 3px solid #ef4444;
  padding: 2px 0 2px 6px;
  margin: 2px 0;
}
.chronicle-gm-name {
  color: #fca5a5 !important;
  text-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}
.chronicle-gm-msg {
  color: #f87171 !important;
  font-weight: 600;
  text-shadow: 0 0 4px rgba(239, 68, 68, 0.5);
}

/* Chat SERVER - aviso global GM entrada (amarillo/púrpura) */
.chronicle-server-line {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.2), transparent);
  border-left: 3px solid #a855f7;
  padding: 2px 0 2px 6px;
  margin: 2px 0;
}
.chronicle-server-msg {
  color: #fbbf24 !important;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

/* Habilidades de Named - destacar en Crónicas */
.chronicle-named-line {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.3), transparent);
  border-left: 3px solid #f59e0b;
  padding: 2px 0 2px 6px;
  margin: 2px 0;
}
.chronicle-named-ability {
  color: #fbbf24 !important;
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
}

/* Pregonero - anuncios de desbloqueo de zona (dorado/negrita) */
.chronicle-pregonero {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.2), transparent);
  border-left: 3px solid #f59e0b;
  padding: 4px 0 4px 8px;
  margin: 3px 0;
  font-weight: 600;
}
.chronicle-pregonero .text-amber-400,
.chronicle-pregonero .text-yellow-200 {
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

#itemDetailModal .item-detail-panel {
  min-height: min(400px, 70vh);
}
#itemDetailModal #itemDetailActions button {
  flex: 1;
  min-width: 100px;
}
@media (max-width: 767px) {
  #itemDetailModal .item-detail-panel {
    max-height: 85vh;
    min-height: 50vh;
  }
}
#itemToast {
  max-width: 90vw;
}

#equipmentSelectorModal.hidden {
  display: none !important;
}
.equipment-selector-panel {
  min-height: 50vh;
}
@media (max-width: 767px) {
  .equipment-selector-panel {
    max-height: 90vh;
    min-height: 60vh;
  }
}
.equipment-selector-item {
  min-height: 44px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.equipment-selector-item:hover,
.equipment-selector-item:active {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(129, 140, 248, 0.5);
}
.equipment-selector-item.equipment-class-compatible {
  border-left: 3px solid rgba(34, 197, 94, 0.8);
}
.equipment-selector-item.equipment-class-incompatible {
  opacity: 0.7;
}

.equip-slot-unico {
  box-shadow: 0 0 12px rgba(255, 51, 51, 0.5);
}

/* Paneles redimensionables: resize + overflow */
.resizable-panel {
  position: relative;
  resize: both;
  overflow: auto;
  min-width: 240px;
  min-height: 160px;
}
.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: se-resize;
  z-index: 10;
  touch-action: none;
  background: linear-gradient(135deg, transparent 50%, rgba(245,158,11,0.6) 50%);
  border-radius: 0 0 4px 0;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.resize-handle:hover {
  opacity: 1;
}

/* Tooltip ítem en móvil: centrado para evitar corte lateral */
@media (max-width: 767px) {
  #masterItemTooltip {
    left: 50% !important;
    transform: translateX(-50%);
    max-width: calc(100vw - 24px);
  }
}

/* Tooltip Maestra (Bazaar, Inventario) */
.master-tooltip {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9), 0 0 1px rgba(255, 255, 255, 0.1);
}
.master-tooltip.border-sky-500\/70 { border-color: rgba(56, 189, 248, 0.7); box-shadow: 0 0 20px rgba(56, 189, 248, 0.25); }
.master-tooltip.border-purple-500\/70 { border-color: rgba(168, 85, 247, 0.7); box-shadow: 0 0 20px rgba(168, 85, 247, 0.25); }
.master-tooltip.border-orange-500\/80 { border-color: rgba(249, 115, 22, 0.8); box-shadow: 0 0 20px rgba(249, 115, 22, 0.25); }
.master-tooltip.border-red-500\/90 { border-color: rgba(239, 68, 68, 0.9); box-shadow: 0 0 24px rgba(239, 68, 68, 0.35); }

/* Barra de control de expedición: contenedor unificado, sin superposición */
#combatControlBar {
  gap: 12px;
  position: relative;
  z-index: 100;
}
#combatControlBar button,
#combatControlBar select,
.combat-log-focus-select,
.combat-log-pause-btn {
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.combat-ctrl-btn {
  min-height: 40px;
  padding: 8px 16px;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
/* Modo Farmeo: toggle con fondo gris oscuro por defecto */
.combat-ctrl-farming {
  border-color: rgba(75, 85, 99, 0.8) !important;
  background: rgba(31, 41, 55, 0.9) !important;
}
.combat-ctrl-farming.border-emerald-500 {
  border-color: rgba(16, 185, 129, 0.9) !important;
  background: rgba(6, 95, 70, 0.8) !important;
}
#autoCombatBtn,
#autoCombatBtn.active {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
#autoCombatBtn.active {
  opacity: 1 !important;
}
#combatControlBar,
#combatControlBar * {
  user-select: auto;
}
/* Floaty text de daño/curación */
.combat-card-wrapper {
  position: relative;
  overflow: visible;
}
.combat-floaty {
  position: absolute;
  left: 50%;
  top: 25%;
  --floaty-offset-x: 0px;
  transform: translate(calc(-50% + var(--floaty-offset-x)), -50%);
  font-weight: 700;
  font-size: 1.1em;
  text-shadow: 0 0 4px rgba(0,0,0,0.9), 0 1px 2px rgba(0,0,0,1);
  pointer-events: none;
  z-index: 20;
  opacity: 1;
  transition: none;
}
.combat-floaty.combat-floaty-animate {
  animation: floatyRise 3.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.combat-floaty.combat-floaty-crit {
  color: #fef08a !important;
  font-size: 1.65em !important;
  font-weight: 900 !important;
  text-shadow: 0 0 10px rgba(254,240,138,0.9), 0 0 4px rgba(0,0,0,0.9);
}
.combat-floaty.combat-floaty-crit.combat-floaty-animate {
  animation: floatyRiseCrit 3.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.combat-floaty.combat-floaty-levelup {
  color: #FFD700 !important;
  font-weight: bold !important;
  font-size: 1.3em !important;
  text-shadow: 0 0 6px rgba(255,215,0,0.9), 0 0 4px rgba(0,0,0,0.9);
}
.combat-floaty.combat-floaty-levelup.combat-floaty-animate {
  animation: floatyRise 3.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
@keyframes floatyRiseCrit {
  0% { transform: translate(calc(-50% + var(--floaty-offset-x)), -50%) scale(1.3); opacity: 1; }
  20% { transform: translate(calc(-50% + var(--floaty-offset-x)), -45px) scale(1.35); opacity: 1; }
  70% { transform: translate(calc(-50% + var(--floaty-offset-x)), -55px) scale(1.2); opacity: 0.95; }
  100% { transform: translate(calc(-50% + var(--floaty-offset-x)), -90px) scale(1.1); opacity: 0; }
}
@keyframes floatyRise {
  0% {
    transform: translate(calc(-50% + var(--floaty-offset-x)), -50%) scale(1);
    opacity: 1;
  }
  40% {
    transform: translate(calc(-50% + var(--floaty-offset-x)), -35px) scale(1.05);
    opacity: 0.98;
  }
  100% {
    transform: translate(calc(-50% + var(--floaty-offset-x)), -85px) scale(1);
    opacity: 0;
  }
}

/* Moneda dorada flotando al ganar platino en el log */
.combat-platinum-line {
  position: relative;
  min-height: 1.5em;
}
.combat-coin-floaty {
  position: absolute;
  left: 0;
  bottom: 0;
  font-size: 1.5em;
  animation: coinFloatUp 2s ease-out forwards;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.8));
}
@keyframes coinFloatUp {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  30% { transform: translateY(-12px) scale(1.1); opacity: 1; }
  100% { transform: translateY(-40px) scale(1); opacity: 0; }
}

/* Loot floaty: desplazamiento hacia inventario */
.combat-loot-floaty-container {
  position: absolute;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.combat-loot-floaty {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.95em;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0) translateX(0);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.combat-loot-floaty-gold { border-color: rgba(251, 191, 36, 0.6); }
.combat-loot-floaty-item { border-color: rgba(34, 197, 94, 0.5); }
.combat-loot-icon { font-size: 1.1em; }
.combat-loot-floaty-animate {
  animation: lootFloatToInventory 2.5s ease-out forwards;
}
@keyframes lootFloatToInventory {
  0% { opacity: 0; transform: translateY(0) translateX(0) scale(0.8); }
  15% { opacity: 1; transform: translateY(-8px) translateX(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) translateX(60px) scale(0.9); }
}

/* Layout estático de combate: 6 slots en 2 columnas (3 filas) - aliados y enemigos */
/* Altura +25% para que la 4ª barra (Maná/Ira/Poder) y los iconos de buffs/debuffs sean visibles sin scroll */
.combat-slots-grid {
  display: grid;
  /* minmax(0,1fr): evita columnas que colapsan o explotan con hijos flex (% ancho) */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  min-height: 350px;
  height: 100%;
  width: 100%;
  padding-bottom: 8px;
}
/* Aliados: 2×3 celdas = 6× .combat-party-row (espejo de #combatEnemyList.combat-slots-enemies-four) */
.combat-slots-allies {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(170px, 1fr));
}
/* Misma fuerza que enemigos: grid !important + minmax(0,1fr) evita columna aliados colapsada a píxeles */
#combatPartyList.combat-slots-allies-six {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(3, minmax(150px, auto)) !important;
  gap: 8px;
  min-height: 300px;
  width: 100%;
  align-content: start;
  justify-items: stretch;
}
#combatPartyList.combat-slots-allies-six .combat-slot:not(.combat-slot-empty) {
  min-width: 0;
  max-width: none;
  width: 100%;
}
/* Fila aliado+mascota: grid (no flex) para que la carta principal tome todo el ancho útil (minmax 0) */
#combatPartyList.combat-slots-allies-six > .combat-party-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 6px;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  align-items: stretch;
}
#combatPartyList.combat-slots-allies-six > .combat-party-row > .combat-slot:not(.combat-slot-pet) {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: none !important;
}
#combatPartyList.combat-slots-allies-six > .combat-party-row > .combat-slot-pet {
  width: auto !important;
  min-width: 72px;
  max-width: 120px;
  justify-self: end;
  flex: none !important;
}
.combat-slot {
  min-height: 170px;
  height: auto;
  flex-shrink: 0;
  flex-grow: 1;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}
.combat-slot-miniboss,
.combat-slot-boss {
  overflow: visible !important;
  min-height: 110px;
}
.combat-slot-boss {
  min-height: 120px;
}
.combat-slot-inner {
  width: 100%;
  height: 100%;
  min-height: 170px;
  box-sizing: border-box;
  overflow: visible;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.combat-slot-miniboss .combat-slot-inner,
.combat-slot-boss .combat-slot-inner {
  overflow: visible !important;
}
.combat-slot[data-enemy-idx]:not(.combat-slot-empty) {
  overflow: visible;
}
.combat-slot-enemy-inner {
  overflow-x: visible;
}
.enemy-name-cell {
  min-width: 0;
  padding-right: 0;
}
.combat-slot-bars {
  flex: 1;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}
.combat-slot-empty {
  visibility: hidden;
  pointer-events: none;
  min-height: 170px;
}
.combat-slot-empty .combat-slot-inner {
  border-color: transparent !important;
  background: transparent !important;
}

/* Pet: miniatura al 50% del tamaño de un personaje normal. Solo HP + barra de ataque. */
.combat-slot-pet {
  width: 50%;
  min-width: 90px;
  max-width: 120px;
  min-height: 44px;
  flex-shrink: 0;
}
.combat-slot-pet .combat-slot-inner {
  min-height: 44px;
  padding: 2px 4px;
  border-color: rgba(245, 158, 11, 0.5) !important;
}
.combat-slot-pet .combat-slot-bars {
  gap: 2px;
}
.combat-party-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-height: 170px;
}
.combat-party-row .combat-slot:not(.combat-slot-pet) {
  flex: 1;
  min-width: 0;
}
.combat-party-row .combat-slot-pet {
  flex-shrink: 0;
  align-self: center;
}
/* Refuerzo genérico (p. ej. sin .six en teoría); .six arriba ya fuerza grid en la fila */
#combatPartyList > .combat-party-row {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Feedback visual: enemigo recibe daño (flash + shake) */
.combat-slot-enemy-hit .combat-slot-inner {
  animation: combat-enemy-hit 0.35s ease-out;
}
.combat-slot-shake .combat-slot-inner {
  animation: combat-enemy-hit 0.35s ease-out, combat-shake 0.35s ease-out;
}
.combat-slot-flash .combat-slot-inner {
  --magic-flash-color: #7c3aed;
  animation: combat-magic-flash 0.35s ease-out;
}
@keyframes combat-enemy-hit {
  0% { filter: brightness(1); box-shadow: 0 0 0 transparent; }
  20% { filter: brightness(1.9); box-shadow: 0 0 12px rgba(239,68,68,0.6); }
  40% { filter: brightness(1.5); box-shadow: 0 0 8px rgba(239,68,68,0.4); }
  100% { filter: brightness(1); box-shadow: 0 0 0 transparent; }
}
@keyframes combat-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-4px); }
  30% { transform: translateX(4px); }
  45% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-1px); }
}
@keyframes combat-magic-flash {
  0% { filter: brightness(1); box-shadow: 0 0 0 transparent; }
  25% { filter: brightness(1.8); box-shadow: 0 0 14px var(--magic-flash-color); }
  50% { filter: brightness(1.5); box-shadow: 0 0 10px var(--magic-flash-color); }
  100% { filter: brightness(1); box-shadow: 0 0 0 transparent; }
}

/* Enemigo muerto: desvanecimiento suave 1.5s para que el floaty de daño sea visible */
.combat-slot-enemy-fade-out {
  animation: combat-enemy-fade-out 1.5s ease-out forwards;
}
@keyframes combat-enemy-fade-out {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* Modo combate inmersivo: oculta navegación, expande combate */
body.combat-ui-active .city-view-nav,
body.combat-ui-active #buildingPanel,
body.combat-ui-active .combat-ui-hide {
  display: none !important;
}
body.combat-ui-active #combatView {
  display: flex !important;
  grid-column: 1 / -1;
  min-height: calc(100vh - 180px);
  max-height: calc(100vh - 120px);
}
body.combat-ui-active #combatLogBox,
body.in-combat #combatLogBox {
  width: 100% !important;
  flex: 0 1 auto;
  overflow-y: auto;
  margin-bottom: 0 !important;
  min-height: 0 !important;
}
body.in-combat #combat-log,
body.combat-ui-active #combat-log {
  width: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  display: flex !important;
  flex-direction: column !important;
  margin-bottom: 0 !important;
  flex-shrink: 0;
}
.combat-log-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: 0;
  overflow: visible;
}
#combat-log {
  margin-bottom: 0;
  min-height: 0;
  max-height: none;
}
.combat-log-dock .combat-log-box {
  background: rgba(0, 0, 0, 0.28);
  border-color: rgba(251, 191, 36, 0.22);
}
.combat-log-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
  font-family: var(--rpg-font-body);
  font-size: 14px;
  line-height: 1.4;
  padding-bottom: 8px;
  min-height: 0;
  max-height: none;
  position: relative;
  z-index: 1;
}

/* Log de combate: registro antiguo + daño con degradados suaves */
#combatLogBox .rpg-combat-log-chronicle {
  font-family: var(--rpg-font-body);
  font-size: 14px;
  line-height: 1.4;
  color: #e2e8f0;
}
@media (min-width: 769px) {
  #combatLogBox .rpg-combat-log-chronicle {
    font-size: 14px;
    line-height: 1.4;
  }
}
.combat-log-damage-dealt {
  font-family: var(--rpg-font-body);
  font-weight: 600;
  background: linear-gradient(180deg, #fefce8 0%, #facc15 42%, #ca8a04 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.85));
}
.combat-log-damage-taken {
  font-family: var(--rpg-font-body);
  font-weight: 600;
  background: linear-gradient(180deg, #fecaca 0%, #ef4444 48%, #7f1d1d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9));
}
.combat-log-damage-dealt strong,
.combat-log-damage-dealt b,
.combat-log-damage-taken strong,
.combat-log-damage-taken b {
  font-weight: 800;
  background: inherit;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* Enemigos: hasta 4 fichas en rejilla 2×2 (misma anchura que columna aliados) */
#combatEnemyList.combat-slots-enemies-four {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, minmax(150px, auto)) !important;
  gap: 8px;
  min-height: 300px;
  width: 100%;
  align-content: start;
  justify-items: stretch;
}
#combatEnemyList.combat-slots-enemies-four .combat-slot:not(.combat-slot-empty) {
  min-width: 0;
  max-width: none;
  width: 100%;
}
#combatEnemyList.combat-slots-enemies-four.combat-enemy-many .combat-slot-inner {
  transform: scale(0.94);
  transform-origin: top center;
}
/* Modo Foco: borde azul suave cuando hay un personaje seleccionado */
#combat-log.combat-log-focus-mode {
  border-color: rgba(59, 130, 246, 0.7);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.25);
}
.combat-log-pause-btn.paused {
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}
.combat-wave-separator {
  background: rgba(75, 85, 99, 0.15);
  letter-spacing: 0.05em;
}
.combat-slot-miniboss .combat-slot-inner {
  transform: scale(1.15);
  transform-origin: top center;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
  border-color: rgba(59, 130, 246, 0.7) !important;
  min-height: 100px;
}
.combat-slot-boss .combat-slot-inner {
  transform: scale(1.3);
  transform-origin: top center;
  box-shadow: 0 0 16px rgba(251, 191, 36, 0.7), 0 0 8px rgba(239, 68, 68, 0.4);
  border-color: rgba(251, 191, 36, 0.8) !important;
  min-height: 115px;
}
.combat-enemy-name-miniboss {
  margin-top: -16px;
  position: relative;
  z-index: 1;
}
.combat-enemy-name-boss {
  margin-top: -20px;
  position: relative;
  z-index: 1;
  font-size: 1.2em !important;
  font-weight: bold !important;
}
.combat-enemy-hpbar-boss {
  min-width: 120%;
}
.combat-glow-miniboss { filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.8)); }
.combat-glow-boss { filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.9)) drop-shadow(0 0 4px rgba(239, 68, 68, 0.5)); }
body.in-combat #buildingPanel {
  display: none !important;
}

/* Ocultar crónicas hasta que la vista ciudad esté activa (splash / héroe / creación no deben mostrar el chat) */
#chroniclesSection.is-chronicles-suppressed {
  display: none !important;
}

/* Crónicas y chat: prioridad de foco durante combate (evita overlays que bloqueen el input) */
#chroniclesSection.chronicles-section-combat,
body.in-combat #chroniclesSection,
body.combat-ui-active #chroniclesSection {
  position: relative;
  z-index: 100;
}
#cityChatInput {
  position: relative;
  z-index: 101;
}

/* Lista de usuarios online: scroll horizontal cuando hay muchos */
.online-users-list {
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}
.online-users-list::-webkit-scrollbar {
  height: 4px;
}
.online-users-list::-webkit-scrollbar-thumb {
  background: rgba(75, 85, 99, 0.6);
  border-radius: 2px;
}

/* ========== Escritorio: barra de combate en flujo + ratón (grid del arena vía Tailwind) ========== */
@media (min-width: 1024px) {
  .combat-control-dock {
    position: relative !important;
    inset: auto !important;
    width: auto !important;
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* Log combate PC: 280px fijas, 14px, scroll */
  #combat-log.combat-log-container {
    overflow-x: hidden;
    overflow-y: visible;
  }
  #combatArenaWrapper #combat-log #combatLogBox {
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: #e5e7eb;
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
    overflow-y: auto !important;
    box-sizing: border-box;
  }
  body.combat-ui-active #combatLogBox,
  body.in-combat #combatLogBox {
    font-size: 14px !important;
    line-height: 1.4 !important;
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
    overflow-y: auto !important;
  }
  #combat-log.combat-log-visual-collapsed #combatLogBox {
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
  }
  #combat-log:not(.combat-log-visual-collapsed):not(.collapsed) #combatLogBox {
    max-height: min(42vh, 360px) !important;
    min-height: 280px !important;
    height: auto !important;
  }
  /* Cara a cara: dos columnas 50/50 a ancho completo del panel de combate */
  #combatView #combatFaceOff.combat-face-off {
    gap: 1rem;
    max-width: none;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
  }
  #combatView .combat-slots-grid {
    grid-template-rows: repeat(3, auto);
    height: auto;
    min-height: 240px;
    align-content: start;
  }
  #combatView .combat-slots-allies {
    grid-template-rows: repeat(3, minmax(min-content, auto));
  }
  #combatView .combat-slots-allies-six {
    grid-template-rows: repeat(3, minmax(min-content, auto)) !important;
    min-height: 260px;
  }
  #combatView .combat-slots-enemies-four {
    grid-template-rows: repeat(2, minmax(min-content, auto)) !important;
    min-height: 260px;
  }
  #combatView .combat-slot:not(.combat-slot-pet),
  #combatView .combat-slot-empty:not(.combat-slot-pet) {
    flex-grow: 0;
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }
  body.combat-ui-active #combatView {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    min-height: min(560px, calc(100dvh - 152px)) !important;
    max-height: calc(100dvh - 88px) !important;
  }
}

/* Ratón en PC: feedback en botones (excluye tarjetas de edificio e iconos de estado) */
@media (min-width: 1024px) and (hover: hover) {
  main button[type="button"]:not(:disabled):not(.combat-status-icon-btn):not([id^="building"]):hover {
    filter: brightness(1.25);
    border-color: #f59e0b !important;
    transition: filter 0.12s ease-out, border-color 0.12s ease-out;
  }
}

/* ========== MOBILE: combate confrontación 2 columnas + log fijo + barra inferior ========== */
@media (max-width: 1023px) {
  body.combat-ui-active #combatView {
    min-height: 100dvh;
    min-height: 100vh;
    max-height: none;
    padding: 8px;
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
    gap: 8px;
    flex-direction: column;
  }
  body.combat-ui-active #combatView .combat-view-head {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  /* Controles: barra fija inferior */
  body.combat-ui-active #combatControlBar.combat-control-dock {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    background: rgba(3, 7, 18, 0.94);
    border-top: 1px solid rgba(245, 158, 11, 0.35);
    box-shadow: 0 -10px 32px rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  /* Arena: grid 2+1 definido con Tailwind en HTML (col-start / col-span) */
  body.combat-ui-active #combatArenaWrapper {
    flex: 1;
    min-height: 0;
  }
  body.combat-ui-active #combatPartyList,
  body.combat-ui-active #combatEnemyList {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    min-height: 0 !important;
    align-items: stretch;
  }
  body.combat-ui-active #combatPartyList > .combat-party-row {
    width: 100%;
    max-width: 100%;
  }
  body.combat-ui-active #combatView .combat-slot,
  body.combat-ui-active #combatView .combat-slot-inner,
  body.combat-ui-active #combatView .combat-slot-bars {
    min-height: 0 !important;
  }
  body.combat-ui-active #combatView .combatant-card-v49 {
    min-height: 0 !important;
  }
  body.combat-ui-active #combatEnemyList .combat-slot {
    flex: 0 0 auto;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0;
  }
  /* Aliados van dentro de .combat-party-row (flex row); hace falta flex:1, no 0 0 auto (evita carta en tira) */
  body.combat-ui-active #combatPartyList:not(.combat-slots-allies-six) .combat-party-row .combat-slot:not(.combat-slot-pet) {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0;
    align-self: stretch;
  }
  body.combat-ui-active #combatPartyList.combat-slots-allies-six > .combat-party-row > .combat-slot:not(.combat-slot-pet) {
    min-width: 0 !important;
    max-width: none !important;
    min-height: 0;
    align-self: stretch;
  }
  body.combat-ui-active #combatPartyList .combat-party-row .combat-slot-pet {
    flex: 0 0 auto !important;
    min-height: 0;
  }
  body.combat-ui-active .combat-slots-allies .combat-slot:not(.combat-slot-empty),
  body.combat-ui-active .combat-slots-enemies .combat-slot:not(.combat-slot-empty) {
    min-height: auto;
  }
  body.combat-ui-active .combat-slot-inner {
    min-height: 0;
    padding: 4px 5px;
  }
  /* Log en muelle inferior: sin altura fija global (compacto vía .combat-log-visual-collapsed) */
  body.combat-ui-active #combat-log {
    padding: 6px 8px;
    border-radius: 10px;
    overflow: hidden;
    flex-direction: column;
    flex-shrink: 0;
  }
  body.combat-ui-active #combat-log #combatLogExpandable {
    flex: 0 1 auto;
    min-height: 0;
    margin-top: 4px;
  }
  body.combat-ui-active #combat-log #combatLogBox {
    flex: 0 1 auto;
    min-height: 0 !important;
    overflow-y: auto !important;
    padding: 6px 8px 8px;
    font-size: 0.75rem;
    line-height: 1.35;
    color: #e5e7eb;
  }
  body.combat-ui-active #combat-log .combat-log-expandable > div:first-of-type {
    margin-bottom: 4px;
  }
  /* Auto-Combat: botón principal más grande en móvil */
  body.combat-ui-active #autoCombatBtn.combat-auto-main {
    min-height: 48px;
    padding-left: 14px;
    padding-right: 14px;
    font-size: max(15px, 0.9rem);
    font-weight: 800;
  }
  #autoCombatBtn,
  #farmingModeBtn,
  #returnToCityBtn {
    min-height: 44px;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  #autoCombatBtn,
  #atlasBestiaryContainer {
    position: relative;
    z-index: 999999 !important;
  }
  body.combat-ui-active #combatControlBar.combat-control-dock {
    z-index: 120 !important;
  }
  .atlas-phase-select {
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }
  .atlas-map-container,
  #atlasBestiaryContainer,
  #buildingPanel .atlas-map-container,
  #buildingContent .atlas-map-container {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box;
  }
  #atlasBestiaryContainer .bestiary-list,
  #atlasBestiaryContainer .bestiary-detail {
    width: 100% !important;
    max-width: 100vw !important;
    box-sizing: border-box;
  }
}

/* Botones Taberna: área táctil 44px */
.tavern-hire-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 10px 14px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Proyectiles VFX */
#combatView {
  position: relative;
}
.combat-vfx-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 15;
  overflow: hidden;
}
/* Muerte: mismo frame que floaty final */
.combat-card-wrapper.combat-dead {
  animation: combatDeathPulse 0.3s ease-out forwards;
}
@keyframes combatDeathPulse {
  0% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(0.98); }
  100% { opacity: 0.6; transform: scale(1); }
}

.combat-projectile {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-left: -8px;
  margin-top: -8px;
  box-shadow: 0 0 12px currentColor;
  animation: projectileFly 0.4s ease-out forwards;
}
@keyframes projectileFly {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--to-x, 0), var(--to-y, 0));
    opacity: 0.3;
  }
}

/* Lay on Hands - partículas doradas */
.combat-loh-particle {
  position: absolute;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  margin-top: -6px;
  border-radius: 50%;
  pointer-events: none;
  animation: lohParticleFly 0.5s ease-out forwards;
}
@keyframes lohParticleFly {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--to-x, 0), var(--to-y, 0)) scale(0.3);
    opacity: 0;
  }
}

/* VFX universal */
.combat-vfx {
  position: absolute;
  margin-left: -8px;
  margin-top: -8px;
  pointer-events: none;
}
.combat-vfx-melee {
  width: 24px;
  height: 4px;
  background: linear-gradient(90deg, #eab308 0%, #fef08a 50%, transparent 100%);
  border-radius: 2px;
  box-shadow: 0 0 8px #eab308;
  animation: vfxMeleeSlash 0.18s ease-out forwards;
}
/* Espada / Corte (Guerrero, Paladín, Monje) */
.combat-vfx-sword {
  width: 28px;
  height: 5px;
  background: linear-gradient(90deg, #eab308 0%, #fef08a 40%, #ca8a04 80%, transparent 100%);
  border-radius: 1px;
  box-shadow: 0 0 10px #eab308, 0 0 4px #fef08a;
  animation: vfxSwordSlash 0.18s ease-out forwards;
}
@keyframes vfxSwordSlash {
  0% { transform: translate(0, 0) scaleX(0.2); opacity: 1; }
  100% { transform: translate(var(--to-x, 0), var(--to-y, 0)) scaleX(1); opacity: 0.85; }
}
/* Daga (Rogue / Pícaro) */
.combat-vfx-dagger {
  width: 16px;
  height: 3px;
  background: linear-gradient(90deg, #64748b 0%, #94a3b8 60%, transparent 100%);
  border-radius: 1px;
  box-shadow: 0 0 6px #475569;
  animation: vfxDaggerStab 0.14s ease-out forwards;
}
@keyframes vfxDaggerStab {
  0% { transform: translate(0, 0) scaleX(0.5); opacity: 1; }
  100% { transform: translate(var(--to-x, 0), var(--to-y, 0)) scaleX(1); opacity: 0.9; }
}
/* Colmillos / Dientes (animales: Lobo, Cocodrilo, etc.) */
.combat-vfx-fangs {
  width: 22px;
  height: 12px;
  background: linear-gradient(180deg, #94a3b8 0%, #64748b 50%, #475569 100%);
  clip-path: polygon(0 100%, 25% 0, 50% 60%, 75% 0, 100% 100%);
  box-shadow: 0 0 8px #64748b, inset 0 1px 0 rgba(255,255,255,0.3);
  animation: vfxFangsBite 0.16s ease-out forwards;
}
@keyframes vfxFangsBite {
  0% { transform: translate(0, 0) scale(0.6); opacity: 1; }
  100% { transform: translate(var(--to-x, 0), var(--to-y, 0)) scale(1); opacity: 0.85; }
}
.combat-vfx-monk {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  box-shadow: 0 0 12px #fbbf24, 0 0 24px #f59e0b;
  animation: vfxMonkBurst 0.15s ease-out forwards;
}
@keyframes vfxMonkBurst {
  0% {
    transform: translate(0, 0) scale(0.5);
    opacity: 1;
  }
  50% {
    transform: translate(calc(var(--to-x, 0) * 0.5), calc(var(--to-y, 0) * 0.5)) scale(1.2);
    opacity: 0.9;
  }
  100% {
    transform: translate(var(--to-x, 0), var(--to-y, 0)) scale(0.8);
    opacity: 0.6;
  }
}
.combat-bard-note {
  position: absolute;
  font-size: 1.2em;
  font-weight: bold;
  pointer-events: none;
  z-index: 18;
  animation: bardNoteFloat 1.8s ease-out forwards;
  text-shadow: 0 0 8px currentColor;
}
@keyframes bardNoteFloat {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-15px) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
  }
}
@keyframes vfxMeleeSlash {
  0% {
    transform: translate(0, 0) scaleX(0.3);
    opacity: 1;
  }
  100% {
    transform: translate(var(--to-x, 0), var(--to-y, 0)) scaleX(1);
    opacity: 0.8;
  }
}
.combat-vfx-arrow {
  width: 20px;
  height: 4px;
  background: linear-gradient(90deg, #94a3b8 0%, #cbd5e1 100%);
  clip-path: polygon(0 30%, 100% 0, 100% 100%, 0 70%);
  box-shadow: 0 0 6px #64748b;
  animation: vfxProjectileFly 0.35s ease-out forwards;
}
.combat-vfx-projectile {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  box-shadow: 0 0 12px currentColor;
  animation: vfxProjectileFly 0.4s ease-out forwards;
}
@keyframes vfxProjectileFly {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--to-x, 0), var(--to-y, 0));
    opacity: 0.3;
  }
}

/* Resaltado de atributos prioritarios por clase (creación de personaje) */
.attr-row-priority {
  border: 2px solid rgba(245, 158, 11, 0.9) !important;
  border-radius: 0.5rem;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.4), inset 0 0 12px rgba(245, 158, 11, 0.08);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(180, 83, 9, 0.06) 100%) !important;
}

/* Panel informativo del Atlas - pergamino/piedra oscura con bordes decorados */
.atlas-zone-panel {
  background: linear-gradient(145deg, #1c1917 0%, #292524 30%, #1c1917 100%) !important;
  background-image:
    linear-gradient(rgba(120, 53, 15, 0.15) 0%, transparent 50%),
    linear-gradient(145deg, #1c1917 0%, #292524 30%, #1c1917 100%) !important;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.5),
    inset 0 0 0 1px rgba(180, 83, 9, 0.3),
    0 0 30px rgba(120, 53, 15, 0.4);
  position: relative;
}
.atlas-zone-panel::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 0.6rem;
  pointer-events: none;
}
.atlas-zone-panel h2 {
  font-family: "Cinzel", "Times New Roman", serif;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Selector de fase inicial: muchas opciones (hasta 10) con scroll nativo del navegador */
.atlas-phase-select {
  min-height: 2.5rem;
  max-height: 3rem;
  -webkit-appearance: menulist-button;
  appearance: menulist-button;
}
.atlas-phase-select option {
  padding: 0.25rem 0.5rem;
}

/* Atlas interactivo - mapa de Antonica */
.atlas-map-container {
  aspect-ratio: 16 / 10;
  min-height: 280px;
  max-height: 70vh;
  padding: 6%;
  box-sizing: border-box;
}
.atlas-map-bg {
  min-height: 100%;
  background-image: url('./assets/images/mapa_antonica.jpg') !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  z-index: 0;
}
.atlas-map-overlay {
  background: transparent !important;
}
.atlas-map-points {
  position: absolute;
  inset: 0;
  z-index: 10;
}
.atlas-map-point-wrapper {
  z-index: 20;
}
.atlas-map-point {
  cursor: pointer;
  position: relative;
  z-index: 20;
}
@media (max-width: 768px) {
  /* Atlas: prioridad de clics en móvil (evita ventanas superpuestas bloqueando iconos) */
  #buildingPanel {
    position: relative;
    z-index: 500;
  }
  .atlas-map-container {
    position: relative;
    z-index: 1;
    min-height: 240px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation;
  }
  .atlas-map-point {
    min-width: 48px;
    min-height: 48px;
    font-size: 10px;
    touch-action: manipulation;
  }
  /* Crónicas y chat: z-index más bajo en móvil para no tapar el Atlas */
  body:not(.in-combat):not(.combat-ui-active) #chroniclesSection {
    z-index: 50;
  }
}

/* Atlas Tier 2 - iconos desbloqueados */
.atlas-tier2-wrapper {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.5);
  animation: atlas-tier2-fade-in 0.6s ease-out forwards;
}
.atlas-tier2-visible {
  opacity: 1;
}
.atlas-tier2-point {
  border-color: rgba(205, 127, 50, 0.9) !important;
  box-shadow: 0 0 12px rgba(205, 127, 50, 0.4);
}
.atlas-tier2-point:hover {
  border-color: rgba(210, 180, 140, 0.95) !important;
  box-shadow: 0 0 18px rgba(205, 127, 50, 0.6);
}
@keyframes atlas-tier2-fade-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
.atlas-map-connectors {
  z-index: 1;
}
.atlas-tier2-connector {
  stroke: rgba(205, 127, 50, 0.5);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  fill: none;
}
.atlas-tier3-connector {
  stroke: rgba(59, 130, 246, 0.5);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  fill: none;
}
.atlas-tier4-connector {
  stroke: rgba(239, 68, 68, 0.5);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  fill: none;
}
.atlas-tier5-connector {
  stroke: rgba(249, 115, 22, 0.6);
  stroke-width: 1;
  stroke-dasharray: 4 3;
  fill: none;
}
.atlas-tier3-visible,
.atlas-tier4-visible,
.atlas-tier5-visible {
  opacity: 1;
  animation: atlas-tier2-fade-in 0.6s ease-out forwards;
}

.health-bar-container {
  display: flex;
  flex-direction: column;
  padding: 5px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.bar-background {
  width: 100%;
  height: 8px;
  background-color: #222;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.1s linear;
}

/* Cast / habilidad: siempre visible; vacío = ranura azul “fantasma”, lleno = gradiente azul */
.ability-bar-bg {
  margin-top: 2px;
  border-radius: 3px;
  padding: 2px;
  border: 1px solid rgba(59, 130, 246, 0.4);
  background: rgba(15, 23, 42, 0.55);
  opacity: 1;
}

.bar-row.ability-bar .ability-cast-track {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(30, 58, 138, 0.35));
  box-shadow: inset 0 0 0 1px rgba(30, 64, 175, 0.45);
  border-radius: 2px;
}

.bar-row.ability-bar.ability-bar-idle .ability-cast-track {
  background: linear-gradient(180deg, rgba(2, 6, 14, 0.98), rgba(8, 12, 28, 0.92));
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.65);
}

.ability-bar-fill {
  height: 100%;
  width: 0%;
  transition: width 0.1s linear;
}

.ability-bar-fill.ability-bar-v2-fill {
  background: linear-gradient(90deg, #1d4ed8, #38bdf8);
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.35);
}

.bar-label {
  font-size: 0.65rem;
  color: #bbb;
  margin-top: 1px;
  text-transform: uppercase;
}

.combatant-card-v49 {
  min-height: 150px;
}

.combat-bars-v49 .bar-background {
  height: 10px;
}
.combat-bars-v49 .bar-background-hp {
  height: 20px !important;
  min-height: 20px !important;
}

/* v4.9.x hotfix: avoid clipping 3rd/4th bars */
#combatView .combat-slot,
#combatView .combat-slot-inner,
#combatView .combat-slot-bars,
#combatView .combat-party-row {
  overflow: visible !important;
}

#combatView .combat-slot,
#combatView .combat-slot-inner,
#combatView .combat-party-row {
  min-height: 170px !important;
}

#combatView .combat-slot-bars {
  min-height: 150px !important;
}

#combatView #combatEnemyList .combat-slot,
#combatView #combatPartyList .combat-slot {
  max-height: none !important;
}
/* =========================================
   ESTILO PROFESIONAL DE JUEGO (v5.2.1)
   Inspirado en image_7.png
   ========================================= */

/* Contenedor principal del cabecero */
.top-bar {
  background-image: url("./assets/images/fondo.png") !important;
  background-color: transparent !important;
  background-size: cover;
  border-bottom: 2px solid #333 !important;
  padding: 20px 0 !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.8);
  position: relative;
  z-index: 100;
}

/* Título Principal (Dorado y Épico) */
.top-bar h1 {
  font-family: 'Cinzel', serif; /* O 'Times New Roman' si no tienes Cinzel */
  color: #e6b800 !important; /* Dorado base */
  text-transform: uppercase;
  letter-spacing: 5px;
  margin: 0;
  font-size: 2.2em;
  /* Efecto de textura dorada y resplandor */
  background: linear-gradient(180deg, #fff 0%, #e6b800 40%, #806600 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(230, 184, 0, 0.6));
}

/* Subtítulo (The Combat Simulator) */
.top-bar h1::after {
  content: "THE COMBAT SIMULATOR";
  display: block;
  font-size: 0.35em;
  color: #aaa;
  letter-spacing: 3px;
  margin-top: 5px;
  -webkit-text-fill-color: #aaa; /* Cancela el gradient del padre */
  filter: none;
}

/* Contenedor de estadísticas (Nivel, XP, Platino) */
.top-bar .stats-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  color: #eee;
  font-family: 'Verdana', sans-serif;
  font-size: 0.9em;
  text-shadow: 1px 1px 2px #000;
}

/* Nivel [ LVL 1 ] (Limpio, sin cajas) */
.top-bar .stat-level {
  color: #ccc;
}

/* Contenedor de la barra de XP */
.top-bar .xp-bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #888;
  font-size: 0.8em;
}

/* Barra de XP Refinada */
.top-bar .xp-bar-wrapper {
  width: 250px;
  height: 10px;
  background: #1a1a1a;
  border: 1px solid #444;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: inset 0 0 5px #000;
}

/* Relleno de la barra de XP (Verde Neón con resplandor) */
.top-bar .xp-bar-fill {
  height: 100%;
  /* Gradiente verde neón a oscuro */
  background: linear-gradient(90deg, #00ff00 0%, #008000 100%);
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.7);
  transition: width 0.3s ease; /* Para que la animación de carga sea suave */
}

/* Panel de Platino (Premium feel con icono) */
.top-bar .stat-platinum {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #ffd700; /* Color Oro */
  font-weight: bold;
  /* Resplandor ámbar suave */
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* Icono de Platino (Requiere que tengas una imagen de monedas) */
.top-bar .stat-platinum::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  background: url('./assets/images/platinum_coins_icon.png') no-repeat center/contain;
  /* Si no tienes imagen, este resplandor simulará la moneda */
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  border-radius: 50%;
}

/* v4.9.39: iconos de estado en combate (hover/focus = tooltip nativo) */
.combat-status-icons .combat-status-icon-btn:focus {
  outline: 1px solid rgba(129, 140, 248, 0.7);
  outline-offset: 1px;
}

/* v4.9.42: parallax de fondo por zona + auras de clase + level-up dorado */

/* v4.9.42: panel de depuración de combate oculto salvo CONFIG.showDebug o clase en body */
#combat-debug-panel {
  display: none !important;
}
body.combat-debug-on #combat-debug-panel {
  display: block !important;
}
#combatView {
  --combat-parallax-x: 0;
  --combat-parallax-y: 0;
  --combat-zone-bg: radial-gradient(ellipse at 50% 28%, rgba(99, 102, 241, 0.28) 0%, rgba(30, 27, 75, 0.55) 42%, #0f172a 100%);
}
#combatView::before {
  content: "";
  position: absolute;
  inset: -14%;
  z-index: 0;
  pointer-events: none;
  border-radius: inherit;
  background: var(--combat-zone-bg);
  background-size: 118% 118%;
  background-position: calc(50% + var(--combat-parallax-x, 0) * 4.5%) calc(50% + var(--combat-parallax-y, 0) * 4.5%);
  opacity: 0.93;
  transition: background-position 0.14s ease-out;
}
#combatView > * {
  position: relative;
  z-index: 1;
}

.combat-card-aura-warrior {
  box-shadow: inset 0 0 32px rgba(220, 38, 38, 0.38), 0 0 0 1px rgba(248, 113, 113, 0.4) !important;
  background-image: radial-gradient(ellipse at 25% 0%, rgba(239, 68, 68, 0.28), transparent 58%), linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.58)) !important;
}
.combat-card-aura-wizard {
  box-shadow: inset 0 0 32px rgba(59, 130, 246, 0.45), 0 0 0 1px rgba(96, 165, 250, 0.42) !important;
  background-image: radial-gradient(ellipse at 72% 8%, rgba(59, 130, 246, 0.26), transparent 58%), linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.58)) !important;
}
.combat-card-aura-druid {
  box-shadow: inset 0 0 32px rgba(34, 197, 94, 0.42), 0 0 0 1px rgba(74, 222, 128, 0.4) !important;
  background-image: radial-gradient(ellipse at 50% 0%, rgba(74, 222, 128, 0.24), transparent 60%), linear-gradient(180deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.58)) !important;
}

.combat-level-up-flash {
  animation: combatLevelUpGoldFlash 0.88s ease-out forwards;
}
@keyframes combatLevelUpGoldFlash {
  0% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0);
    filter: brightness(1);
  }
  40% {
    box-shadow: 0 0 36px 10px rgba(250, 204, 21, 0.88);
    filter: brightness(1.28);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0);
    filter: brightness(1);
  }
}

.combat-level-up-burst {
  position: absolute;
  inset: -8px;
  border-radius: 14px;
  pointer-events: none;
  z-index: 6;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.58) 0%, rgba(250, 204, 21, 0.2) 45%, transparent 72%);
  animation: combatLevelUpBurstAnim 0.72s ease-out forwards;
  opacity: 0;
}
@keyframes combatLevelUpBurstAnim {
  0% {
    opacity: 0;
    transform: scale(0.52);
  }
  42% {
    opacity: 1;
    transform: scale(1.06);
  }
  100% {
    opacity: 0;
    transform: scale(1.38);
  }
}

/* Columnas Tu grupo | Enemigos: misma altura flexible dentro del arena */
#combatPartyView,
#combatEnemyView {
  min-height: 280px;
  flex: 1 1 0;
  box-sizing: border-box !important;
}
@media (min-width: 1024px) {
  #combatPartyView,
  #combatEnemyView {
    min-height: 360px;
  }
}

/* Barra de casteo: track */
#combatView .bar-row.ability-bar .ability-cast-track {
  height: 8px;
  position: relative;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(59, 130, 246, 0.2);
}
#combatView .ability-bar-fill.ability-bar-v2-fill {
  height: 100%;
  transition: width 0.1s linear;
  will-change: width;
}

/* Log de combate: colapsado = discreto; expandido = más historial (siempre bajo el arena) */
#combat-log.combat-log-visual-collapsed #combatLogExpandable {
  display: flex !important;
  flex-direction: column;
}
#combat-log.combat-log-visual-collapsed .combat-log-expandable > div:first-of-type {
  display: none;
}
@media (max-width: 1023px) {
  #combat-log.combat-log-visual-collapsed #combatLogBox {
    max-height: 4.25rem !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }
}
#combat-log.combat-log-visual-collapsed {
  min-height: 0;
}
#combat-log:not(.combat-log-visual-collapsed):not(.collapsed) #combatLogBox {
  max-height: min(38vh, 280px);
}
@media (max-width: 1023px) {
  /* Móvil en combate: muelle h-24 (96px) para no comer espacio a los luchadores */
  body.combat-ui-active #combat-log.combat-log-visual-collapsed {
    max-height: 6rem;
    overflow: hidden;
  }
  body.combat-ui-active #combat-log.combat-log-visual-collapsed #combatLogExpandable {
    max-height: calc(6rem - 2.75rem);
    min-height: 0;
  }
  body.combat-ui-active #combat-log.combat-log-visual-collapsed #combatLogBox {
    flex: 1 1 auto;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: auto !important;
  }
  #combat-log:not(.combat-log-visual-collapsed):not(.collapsed) #combatLogBox {
    max-height: min(42vh, 320px);
  }
}

/* Botón dorado RPG (global) */
.rpg-button-gold {
  background: linear-gradient(to bottom, #2a2a3a, #1a1a2a) !important;
  border: 1px solid #f59e0b !important;
  color: #fbbf24 !important;
  text-shadow: 0 0 5px rgba(245, 158, 11, 0.5) !important;
  box-shadow: inset 0 2px 5px rgba(255,255,255,0.1), 0 5px 15px rgba(0,0,0,0.5) !important;
  transition: all 0.2s ease !important;
  font-family: 'Cinzel', serif !important;
}

.rpg-button-gold:hover {
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.6) !important;
  transform: translateY(-1px);
}

.rpg-button-gold:active {
  transform: translateY(1px);
}