/* =====================================================================
   GUILD HALL — Salón del Gremio (lobby social 2D top-down)
   Layout vertical 3:4. Funciona en mobile portrait y desktop centrado.
   Todo prefijado con .gh- para no chocar con clan_cave_*.
   ===================================================================== */

/* Container principal del salón.
   Mobile: full viewport sin bordes ni radius (pantalla completa).
   Desktop: vertical 3:4 más grande, centrado, ocupa todo el alto disponible. */
.gh-frame {
  --gh-bg-1: #1a0e2a;
  --gh-bg-2: #0a0414;
  --gh-stone: #3a2d4a;
  --gh-gold: #e9b963;
  --gh-text: #f4ecd8;
  --gh-text-dim: rgba(244,236,216,0.6);
  --gh-border: rgba(233,185,99,0.35);
  --gh-cyan: #6cd4ff;

  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  position: fixed;
  top: 0; left: 0;
  background: linear-gradient(180deg, var(--gh-bg-1) 0%, var(--gh-bg-2) 100%);
  overflow: hidden;
  z-index: 100;
  margin: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Desktop: el frame es vertical 3:4 centrado, ocupa todo el alto.
   El espacio sobrante a los costados queda con el background general (oscuro). */
@media (min-width: 900px) {
  .gh-frame {
    aspect-ratio: 3 / 4;
    width: auto;
    height: 100vh;
    height: 100dvh;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--gh-border);
    border-right: 1px solid var(--gh-border);
  }
}

/* HEADER */
.gh-header {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, rgba(0,0,0,0.6), rgba(0,0,0,0.25));
  border-bottom: 1px solid var(--gh-border);
  flex-shrink: 0;
  z-index: 5;
}
.gh-back-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--gh-text);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.gh-back-btn:hover { color: var(--gh-gold); border-color: var(--gh-gold); }
.gh-back-btn i { font-size: 16px; }

.gh-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 15px;
  color: var(--gh-gold);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gh-header-title i { font-size: 18px; }

.gh-header-count {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(108,212,255,0.12);
  border: 1px solid rgba(108,212,255,0.35);
  color: var(--gh-cyan);
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}
.gh-header-count i { font-size: 13px; }

/* Timer "La puerta se cierra en X" en el header del lobby */
.gh-event-timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: linear-gradient(180deg, rgba(184,132,255,0.18), rgba(110,58,204,0.18));
  border: 1px solid rgba(184,132,255,0.5);
  color: #d8c3ff;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  margin-left: 8px;
}
.gh-event-timer i { font-size: 13px; color: #b884ff; }
.gh-event-timer-value { color: #fff; font-weight: 800; }
.gh-event-timer.is-imminent {
  background: linear-gradient(180deg, rgba(255,90,90,0.25), rgba(180,40,40,0.25));
  border-color: rgba(255,90,90,0.7);
  color: #ffd2d2;
  animation: gh-event-timer-pulse 1s ease-in-out infinite;
}
.gh-event-timer.is-imminent i { color: #ff6a6a; }
.gh-event-timer.is-closed {
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.2);
  color: #aaa;
  animation: none;
}
@keyframes gh-event-timer-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 6px rgba(255,90,90,0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 14px rgba(255,90,90,0.8); }
}
@media (max-width: 600px) {
  .gh-event-timer { font-size: 10px; padding: 4px 8px; gap: 4px; margin-left: 4px; }
  .gh-event-timer-label { display: none; } /* en mobile solo el value */
}

/* STAGE — área del juego (top-down) */
.gh-stage-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.gh-stage {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #1a1028;
}

/* Fondo: imagen top-down de la sala (mesa central, antorchas, banderas) */
.gh-stage-bg {
  position: absolute;
  inset: 0;
  background-image: url('/assets/guild_hall/floor.webp');
  background-size: cover;
  background-position: center;
  background-color: #1a0e2a; /* fallback color por si la imagen tarda */
}
/* Viñeteado sutil para que los bordes se fundan con el frame */
.gh-stage-bg::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.45) 100%);
  pointer-events: none;
}

/* Grid removido — la imagen ya tiene texturas de piso */
.gh-stage-grid { display: none; }

/* Container de actores */
.gh-actors {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* PORTAL — anclado al centro de la mesa (~50% horizontal, ~54% vertical).
   Tamaño aproximado al diámetro de la mesa en floor.png. */
.gh-portal {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  width: 28%;            /* ajustado al tamaño de la mesa */
  aspect-ratio: 1 / 1;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.gh-portal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
  transition: opacity 0.4s, filter 0.4s, transform 0.4s;
}
/* Animación cuando está abierto: pulso lento y glow cyan */
.gh-portal.is-open .gh-portal-img {
  filter: drop-shadow(0 0 16px rgba(108,212,255,0.8))
          drop-shadow(0 0 30px rgba(108,212,255,0.5));
  animation: gh-portal-pulse 3s ease-in-out infinite;
}
@keyframes gh-portal-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
/* Cuando está cerrado: efecto sutil de "respirando" la magia atrapada */
.gh-portal.is-closed .gh-portal-img {
  animation: gh-portal-idle 4.5s ease-in-out infinite;
}
@keyframes gh-portal-idle {
  0%, 100% { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6)) drop-shadow(0 0 8px rgba(108,212,255,0.2)); }
  50%      { filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6)) drop-shadow(0 0 14px rgba(108,212,255,0.45)); }
}

/* Countdown encima del portal */
.gh-portal-countdown {
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  border: 2px solid rgba(108,212,255,0.6);
  border-radius: 10px;
  padding: 6px 14px;
  text-align: center;
  font-family: var(--font-mono);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 0 18px rgba(108,212,255,0.4);
  animation: gh-cd-pulse 2.4s ease-in-out infinite;
  z-index: 10;
}
@keyframes gh-cd-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(108,212,255,0.3); }
  50%      { box-shadow: 0 0 24px rgba(108,212,255,0.7); }
}
.gh-cd-label {
  font-family: var(--font-title);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244,236,216,0.7);
  font-weight: 700;
  margin-bottom: 2px;
}
.gh-cd-value {
  font-size: 16px;
  font-weight: 800;
  color: #6cd4ff;
  letter-spacing: 0.06em;
  text-shadow: 0 0 8px rgba(108,212,255,0.7);
}

/* CTA "ENTRAR" sobre el portal abierto */
.gh-portal-cta {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #f0c674, #b97f2e);
  color: #2a1a00;
  padding: 5px 14px;
  border-radius: 10px;
  border: 2px solid rgba(0,0,0,0.4);
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.18em;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 14px rgba(233,185,99,0.5);
  animation: gh-cta-bounce 1.3s ease-in-out infinite;
  pointer-events: none;
  white-space: nowrap;
  z-index: 12;
}
.gh-portal-cta i { font-size: 11px; }
@keyframes gh-cta-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-4px); }
}
/* Portal cerrado: deja pasar clicks al stage (no se puede entrar).
   Portal abierto: captura el click para ir a la cueva. */
.gh-portal.is-open  { pointer-events: auto !important; cursor: pointer; }
.gh-portal.is-closed { pointer-events: none; cursor: not-allowed; }
.gh-portal.is-open .gh-portal-img,
.gh-portal.is-open .gh-portal-cta { pointer-events: none; }

/* Badge "La puerta se cierra en X" — debajo del portal cuando está abierto.
   Visible directo sobre la puerta, no se confunde con el contador "abre en". */
.gh-portal-closes-in {
  position: absolute;
  bottom: -42px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(180deg, rgba(184,132,255,0.95), rgba(110,58,204,0.95));
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(110,58,204,0.6);
  pointer-events: none;
  z-index: 13;
}
.gh-portal-closes-in i { font-size: 14px; }
.gh-pci-value { color: #fff; font-weight: 900; }
.gh-portal-closes-in.is-imminent {
  background: linear-gradient(180deg, rgba(255,90,90,0.98), rgba(180,40,40,0.98));
  border-color: rgba(255,200,200,0.6);
  animation: gh-pci-pulse 1s ease-in-out infinite;
}
.gh-portal-closes-in.is-closed {
  background: rgba(0,0,0,0.7);
  border-color: rgba(255,255,255,0.25);
  color: #ccc;
  animation: none;
}
@keyframes gh-pci-pulse {
  0%, 100% { transform: translateX(-50%) scale(1); box-shadow: 0 4px 14px rgba(255,90,90,0.6); }
  50%      { transform: translateX(-50%) scale(1.06); box-shadow: 0 4px 22px rgba(255,90,90,1); }
}
@media (max-width: 600px) {
  .gh-portal-closes-in { bottom: -38px; padding: 5px 11px; font-size: 11px; }
  .gh-pci-label { display: none; }
}

/* LEADERBOARD — botón flotante + panel slide */
.gh-lb-fab {
  position: absolute;
  top: 60px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(233,185,99,0.95), rgba(184,132,30,0.85));
  color: #2a1a00;
  border: 2px solid rgba(0,0,0,0.3);
  border-radius: 50%;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: transform 0.15s, filter 0.15s;
}
.gh-lb-fab:hover { filter: brightness(1.15); transform: scale(1.06); }
.gh-lb-fab:active { transform: scale(0.94); }
.gh-lb-fab i { font-size: 18px; }

/* Botón de info — debajo del trophy */
.gh-info-fab {
  position: absolute;
  top: 108px;
  right: 12px;
  width: 38px;
  height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, rgba(108,212,255,0.95), rgba(42,143,200,0.85));
  color: #061a2a;
  border: 2px solid rgba(0,0,0,0.3);
  border-radius: 50%;
  cursor: pointer;
  z-index: 30;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: transform 0.15s, filter 0.15s;
  animation: gh-info-pulse 2.6s ease-in-out infinite;
}
.gh-info-fab:hover { filter: brightness(1.15); transform: scale(1.06); }
.gh-info-fab:active { transform: scale(0.94); }
.gh-info-fab i { font-size: 18px; }
@keyframes gh-info-pulse {
  0%, 100% { box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 0 0 rgba(108,212,255,0.6); }
  50%      { box-shadow: 0 4px 12px rgba(0,0,0,0.5), 0 0 0 8px rgba(108,212,255,0); }
}

/* ============================================================
   INFO MODAL — explicación del evento + premios
   ============================================================ */
.gh-info-modal {
  position: fixed; inset: 0;
  z-index: 9998;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.gh-info-modal.is-open { opacity: 1; pointer-events: auto; }
.gh-info-backdrop {
  position: absolute; inset: 0;
  background: rgba(5,2,12,0.78);
  backdrop-filter: blur(6px);
}
.gh-info-content {
  position: relative;
  width: min(92vw, 480px);
  max-height: 88vh;
  overflow-y: auto;
  background: linear-gradient(180deg, rgba(20,12,40,0.98), rgba(15,8,30,1));
  border: 1px solid rgba(233,185,99,0.45);
  border-radius: 14px;
  padding: 22px 18px 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 30px rgba(233,185,99,0.15);
  transform: scale(0.94) translateY(8px);
  transition: transform 0.22s ease;
  color: #e8e6f0;
}
.gh-info-modal.is-open .gh-info-content { transform: scale(1) translateY(0); }

.gh-info-close {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(233,185,99,0.4);
  background: rgba(15,8,30,0.8);
  color: #e8e6f0;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.gh-info-close:hover { background: rgba(233,185,99,0.2); }
.gh-info-close i { font-size: 16px; }

.gh-info-head {
  text-align: center;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(233,185,99,0.2);
  margin-bottom: 14px;
}
.gh-info-head i.ph-fill {
  font-size: 36px;
  color: #e9b963;
  filter: drop-shadow(0 0 8px rgba(233,185,99,0.5));
}
.gh-info-head h2 {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  margin: 6px 0 4px;
  color: #f4e4be;
  letter-spacing: 0.04em;
}
.gh-info-sub {
  font-size: 12px;
  color: #a59bbf;
  margin: 0;
}

.gh-info-section { margin-bottom: 16px; }
.gh-info-section-title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: #e9b963;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}
.gh-info-section-title i { font-size: 15px; }
.gh-info-list {
  margin: 0; padding-left: 18px;
  font-size: 13px; line-height: 1.55;
  color: #d8d4e8;
}
.gh-info-list li { margin-bottom: 4px; }
.gh-info-list b { color: #f4e4be; }

/* PRIZES */
.gh-info-prizes { background: rgba(233,185,99,0.05); padding: 12px; border-radius: 10px; border: 1px solid rgba(233,185,99,0.18); }
.gh-info-prize-row {
  display: flex; gap: 10px;
  padding: 8px 0;
  align-items: flex-start;
}
.gh-info-prize-row + .gh-info-prize-row { border-top: 1px dashed rgba(233,185,99,0.2); }
.gh-info-medal {
  flex: 0 0 36px;
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.gh-info-participation .gh-info-medal { font-size: 20px; color: #6cd4ff; }
.gh-info-prize-body { flex: 1; }
.gh-info-prize-title {
  font-weight: 700;
  font-size: 13px;
  color: #f4e4be;
  margin-bottom: 2px;
}
.gh-info-prize-body ul {
  margin: 2px 0 0; padding-left: 16px;
  font-size: 12.5px; line-height: 1.5;
  color: #d8d4e8;
}
.gh-info-prize-body ul li { margin-bottom: 1px; }
.gh-info-prize-body b { color: #ffd766; }
.gh-info-top1 .gh-info-prize-title { color: #ffd766; }
.gh-info-top2 .gh-info-prize-title { color: #d4d4d4; }
.gh-info-top3 .gh-info-prize-title { color: #d4881f; }

.gh-info-tip {
  display: flex; align-items: flex-start; gap: 8px;
  background: rgba(108,212,255,0.08);
  border: 1px solid rgba(108,212,255,0.25);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  color: #c4d8e8;
  line-height: 1.4;
}
.gh-info-tip i { font-size: 16px; color: #6cd4ff; flex: 0 0 auto; margin-top: 1px; }

/* Mobile */
@media (max-width: 600px) {
  .gh-info-content { width: 95vw; padding: 18px 14px 16px; }
  .gh-info-head h2 { font-size: 19px; }
  .gh-info-medal { flex: 0 0 30px; font-size: 22px; }
}

.gh-lb-panel {
  position: absolute;
  top: 56px;
  right: 8px;
  width: min(90%, 320px);
  max-height: 60vh;
  background: linear-gradient(180deg, rgba(20,12,40,0.97), rgba(15,8,30,0.99));
  border: 1px solid rgba(233,185,99,0.4);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  z-index: 31;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  backdrop-filter: blur(10px);
  transform: scale(0.92) translateY(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s, opacity 0.2s;
  transform-origin: top right;
}
.gh-lb-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.gh-lb-head {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.4);
  flex-shrink: 0;
}
.gh-lb-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 800;
  color: var(--gh-gold);
  letter-spacing: 0.06em;
}
.gh-lb-title i { font-size: 16px; }
.gh-lb-close {
  width: 26px; height: 26px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--gh-text);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.gh-lb-close i { font-size: 13px; }
.gh-lb-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gh-lb-empty {
  text-align: center;
  font-style: italic;
  padding: 20px;
  color: var(--gh-text-dim);
  font-size: 12px;
}
.gh-lb-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
  transition: background 0.15s, border-color 0.15s;
}
.gh-lb-row.is-podium {
  background: linear-gradient(90deg, rgba(233,185,99,0.12), rgba(255,255,255,0.02));
  border-color: rgba(233,185,99,0.3);
}
.gh-lb-row.is-mine {
  background: linear-gradient(90deg, rgba(108,212,255,0.15), rgba(108,212,255,0.04));
  border-color: rgba(108,212,255,0.5);
  box-shadow: 0 0 10px rgba(108,212,255,0.2);
}
.gh-lb-rank {
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  color: var(--gh-text-dim);
}
.gh-lb-row.is-podium .gh-lb-rank { font-size: 18px; }
.gh-lb-clan { min-width: 0; }
.gh-lb-name {
  font-family: var(--font-title);
  font-size: 12px;
  font-weight: 700;
  color: var(--gh-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gh-lb-row.is-mine .gh-lb-name { color: var(--gh-cyan); }
.gh-lb-meta {
  display: flex;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--gh-text-dim);
  margin-top: 1px;
}
.gh-lb-meta i { font-size: 10px; }
.gh-lb-floor {
  text-align: center;
  padding: 2px 8px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(108,212,255,0.3);
  border-radius: 6px;
}
.gh-lb-floor-num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 900;
  color: var(--gh-cyan);
  line-height: 1.1;
}
.gh-lb-floor-lbl {
  font-family: var(--font-title);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  color: var(--gh-text-dim);
}

/* TRANSICIÓN al entrar al portal — video full-screen */
.gh-portal-transition {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: gh-pt-in 0.25s ease-out;
  transition: opacity 0.38s ease-out;
}
@keyframes gh-pt-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* 2026-05-09: fade-out smooth cuando termina el video — el overlay se
   desvanece SOBRE la pantalla de combate (que ya está montada debajo). */
.gh-portal-transition.is-leaving {
  opacity: 0;
  pointer-events: none;
}
.gh-pt-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gh-pt-text {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(0,0,0,0.65);
  border: 1px solid rgba(108,212,255,0.5);
  border-radius: 10px;
  backdrop-filter: blur(6px);
  font-family: var(--font-title, sans-serif);
  font-size: 14px;
  font-weight: 800;
  color: #6cd4ff;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 0 14px rgba(108,212,255,0.7);
  white-space: nowrap;
}
.gh-pt-text i { font-size: 16px; animation: gh-pt-pulse 0.8s ease-in-out infinite; }
@keyframes gh-pt-pulse {
  0%, 100% { opacity: 0.7; transform: scale(0.95); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

/* 2026-05-09 v2: tip overlaid sobre el video del portal — estilo cyan que
   matchea con el pill "Viajando a la cueva" para coherencia visual.
   Se muestra arriba del pill principal (en la parte inferior del video). */
.gh-pt-tip {
  position: absolute;
  bottom: calc(12% + 60px);                 /* arriba del .gh-pt-text */
  left: 50%;
  transform: translateX(-50%);
  max-width: min(440px, 84vw);
  padding: 14px 22px;
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(108,212,255,0.45);
  border-radius: 14px;
  box-shadow:
    0 8px 28px rgba(0,0,0,0.6),
    0 0 22px rgba(108,212,255,0.18),
    inset 0 1px 0 rgba(108,212,255,0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
  animation: gh-pt-tip-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}
@keyframes gh-pt-tip-in {
  from { opacity: 0; transform: translate(-50%, 18px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.gh-pt-tip-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-title, sans-serif);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #6cd4ff;
  text-shadow: 0 0 10px rgba(108,212,255,0.55);
}
.gh-pt-tip-label i {
  font-size: 14px;
  color: #6cd4ff;
  filter: drop-shadow(0 0 8px rgba(108,212,255,0.7));
  animation: gh-pt-tip-icon 1.6s ease-in-out infinite;
}
@keyframes gh-pt-tip-icon {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.12); }
}
.gh-pt-tip-text {
  font-family: var(--font-body, sans-serif);
  font-size: 14px;
  font-weight: 500;
  color: #f4ecd8;
  line-height: 1.45;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 3px rgba(0,0,0,0.7);
}
@media (max-width: 600px) {
  .gh-pt-tip {
    bottom: calc(12% + 54px);
    padding: 11px 16px;
    max-width: 90vw;
  }
  .gh-pt-tip-text { font-size: 13px; }
  .gh-pt-tip-label { font-size: 9.5px; letter-spacing: 0.2em; }
}

/* Mobile: portal un poco más arriba que en desktop, 5% más chico */
@media (max-width: 900px) {
  .gh-portal {
    width: 26.6%;     /* 5% más chico que el 28% de desktop */
    top: 53%;          /* 3% más abajo que la versión anterior (era 50%) */
  }
  .gh-portal-countdown { top: -36px; padding: 4px 10px; }
  .gh-cd-label { font-size: 8px; }
  .gh-cd-value { font-size: 13px; }
}

/* ACTOR — un PJ en el stage. Hay 2 modos:
   - is-fullbody: sprite full-body (PNG con transparencia, sin recorte) — clan_cave/chars/
   - default: avatar circular recortado (genérico /assets/races/) */
.gh-actor {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
  cursor: default;
  transition: left 0.4s ease, top 0.4s ease;
  user-select: none;
}
.gh-actor.is-self { z-index: 10; }
.gh-actor.is-self .gh-actor-charname { color: var(--gh-gold); }
.gh-actor.is-self .gh-actor-img { filter: drop-shadow(0 0 10px rgba(233,185,99,0.8)); }

.gh-actor-sprite {
  position: relative;
  line-height: 0;
}

/* Avatar circular (genérico) — 2026-05-09 +30% sobre tamaños base */
.gh-actor:not(.is-fullbody) .gh-actor-img {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid rgba(0,0,0,0.5);
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  background: rgba(40,30,60,0.8);
}

/* Sprite full-body (PNG transparente) — 2026-05-09 +30% */
.gh-actor.is-fullbody .gh-actor-img {
  width: 39px;
  height: auto;
  display: block;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.7));
  background: transparent;
  border: none;
}
/* Compensación por razas con más whitespace en su PNG */
.gh-actor.is-fullbody[data-race="elf"]    .gh-actor-img,
.gh-actor.is-fullbody[data-race="undead"] .gh-actor-img {
  width: 50px;
}

/* Flip horizontal para los del lado derecho que miran a la mesa */
.gh-actor.gh-flip .gh-actor-img { transform: scaleX(-1); }

/* === Barras HP/MP — pequeñas, JUSTO ARRIBA del nombre === */
.gh-actor-bars {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 44px;
  margin-top: 2px;
  margin-bottom: 1px;
  pointer-events: none;
}
.gh-actor-bar {
  height: 2.5px;
  border-radius: 99px;
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(0,0,0,0.55);
  overflow: hidden;
}
.gh-actor-bar-fill { height: 100%; border-radius: 99px; transition: width 0.3s ease; }
.gh-actor-bar-hp .gh-actor-bar-fill {
  background: linear-gradient(90deg, #ff6378 0%, #ff8a98 100%);
  box-shadow: 0 0 4px rgba(255,99,120,0.4);
}
.gh-actor-bar-hp.is-low .gh-actor-bar-fill {
  background: linear-gradient(90deg, #d9342f 0%, #ff6378 100%);
  animation: ghBarLowPulse 1.2s ease-in-out infinite;
}
.gh-actor-bar-mp .gh-actor-bar-fill {
  background: linear-gradient(90deg, #5aa6ff 0%, #8cc6ff 100%);
  box-shadow: 0 0 4px rgba(90,166,255,0.4);
}
@keyframes ghBarLowPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* === Fila avatar + nombre === */
.gh-actor-name-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}
.gh-actor-mini-avatar {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid rgba(233,185,99,0.7);
  background-color: rgba(20,12,40,0.95);
  background-size: cover;
  background-position: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.6);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gh-actor-mini-avatar-fallback {
  font-family: var(--font-title, sans-serif);
  font-weight: 800;
  font-size: 8.5px;
  color: var(--gh-gold, #e9b963);
  background: linear-gradient(135deg, rgba(60,30,90,0.9), rgba(20,12,40,0.95));
}
.gh-actor.is-self .gh-actor-mini-avatar {
  border-color: var(--gh-gold, #e9b963);
  box-shadow: 0 0 8px rgba(233,185,99,0.7);
}

.gh-actor-shadow {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 6px;
  background: radial-gradient(ellipse, rgba(0,0,0,0.6), transparent 70%);
  z-index: -1;
}
.gh-actor.is-fullbody .gh-actor-shadow { width: 30px; bottom: -1px; }

.gh-actor-name {
  margin-top: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-body);
  font-size: 10.5px;
  font-weight: 700;
  background: rgba(0,0,0,0.7);
  padding: 1px 7px;
  border-radius: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.95);
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gh-actor-charname {
  color: #fff;
}
.gh-actor-clan {
  color: var(--gh-cyan);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Bubble de chat encima del PJ */
.gh-actor-bubble {
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #1a0a08;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  max-width: 180px;
  min-width: 50px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.55);
  animation: gh-bubble-in 0.22s ease-out;
  white-space: normal;
  word-wrap: break-word;
  pointer-events: none;
  z-index: 20;
}
.gh-actor-bubble::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
  border-bottom: 0;
}
@keyframes gh-bubble-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* OVERLAY HOST — wrapper appendeado al body que actúa como "puerta" para el
   FAB y drawer. Tiene exactamente las mismas dimensiones que el frame del juego:
   - Mobile: full viewport
   - Desktop: aspect-ratio 3:4 centrado (mismo que .gh-frame)
   pointer-events: none para no bloquear clicks fuera; sus hijos los reactivan. */
#gh-chat-overlay-host {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
  z-index: 9999;
}
@media (min-width: 900px) {
  #gh-chat-overlay-host {
    aspect-ratio: 3 / 4;
    width: auto;
    left: 50% !important;
    transform: translateX(-50%);
  }
}

/* CHAT FAB — botón flotante en esquina inferior derecha del overlay host.
   En mobile, host = viewport → FAB en esquina del celu.
   En desktop, host = frame del juego → FAB DENTRO del frame, sobre la imagen. */
#gh-chat-overlay-host .gh-chat-fab {
  position: absolute !important;
  right: 16px !important;
  bottom: 16px !important;
  top: auto !important;
  left: auto !important;
  width: 54px !important;
  height: 54px !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f0c674, #b97f2e);
  color: #2a1a00;
  border: 2px solid rgba(0,0,0,0.4);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6), 0 0 0 4px rgba(0,0,0,0.2);
  transition: transform 0.15s, filter 0.15s;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  font-family: inherit;
  padding: 0;
}
.gh-chat-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #f0c674, #b97f2e);
  color: #2a1a00;
  border: 2px solid rgba(0,0,0,0.4);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.6), 0 0 0 4px rgba(0,0,0,0.2);
  z-index: 9999;
  transition: transform 0.15s, filter 0.15s;
}
.gh-chat-fab:hover { filter: brightness(1.15); transform: translateY(-2px); }
.gh-chat-fab:active { transform: scale(0.94); }
.gh-chat-fab i { font-size: 24px; }
.gh-chat-fab-badge {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 22px; height: 22px;
  padding: 0 6px;
  background: #ff5566;
  color: #fff;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--gh-bg-2);
  box-shadow: 0 0 10px rgba(255,85,102,0.8);
  animation: gh-badge-pulse 2s ease-in-out infinite;
}
@keyframes gh-badge-pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(255,85,102,0.6); }
  50% { box-shadow: 0 0 14px rgba(255,85,102,1); }
}

/* CHAT DRAWER — slide up desde abajo del overlay-host (= frame en desktop, viewport en mobile) */
#gh-chat-overlay-host .gh-chat-drawer {
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  height: 60%;
  max-height: 480px;
  pointer-events: auto;
}
.gh-chat-drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 60vh;
  max-height: 480px;
  background: linear-gradient(180deg, rgba(20,12,40,0.97) 0%, rgba(15,8,30,0.99) 100%);
  border-top: 1px solid var(--gh-border);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10000;
  backdrop-filter: blur(10px);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.6);
}
.gh-chat-drawer.is-open { transform: translateY(0); }
.gh-chat-drawer-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.45);
  border-bottom: 1px solid var(--gh-border);
  flex-shrink: 0;
}
.gh-chat-drawer-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-title);
  font-size: 14px;
  font-weight: 800;
  color: var(--gh-gold);
  letter-spacing: 0.04em;
}
.gh-chat-drawer-title i { font-size: 18px; }
.gh-chat-drawer-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--gh-text);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
}
.gh-chat-drawer-close:hover { color: var(--gh-gold); border-color: var(--gh-gold); }
.gh-chat-drawer-close i { font-size: 15px; }

/* Backdrop — cubre el overlay-host (= frame del juego en desktop, viewport en mobile) */
#gh-chat-overlay-host .gh-chat-backdrop {
  position: absolute !important;
  inset: 0 !important;
  pointer-events: none;
}
#gh-chat-overlay-host .gh-chat-backdrop.is-active {
  pointer-events: auto;
}
.gh-chat-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.gh-chat-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

.gh-chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.gh-chat-feed::-webkit-scrollbar { width: 4px; }
.gh-chat-feed::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.gh-chat-empty {
  text-align: center;
  font-style: italic;
  color: var(--gh-text-dim);
  padding: 14px 8px;
  font-size: 12px;
}
.gh-chat-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12.5px;
  line-height: 1.45;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255,255,255,0.02);
  word-break: break-word;
}
.gh-chat-line:hover { background: rgba(255,255,255,0.05); }
.gh-chat-line.is-self {
  background: rgba(108,212,255,0.08);
  border-left: 2px solid var(--gh-cyan);
  padding-left: 8px;
}
.gh-chat-clan {
  color: var(--gh-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.gh-chat-name {
  color: var(--gh-gold);
  font-weight: 800;
  flex-shrink: 0;
}
.gh-chat-msg {
  color: var(--gh-text);
  flex: 1;
  min-width: 0;
}

.gh-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.gh-chat-input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--gh-text);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.gh-chat-input:focus { border-color: var(--gh-gold); }
.gh-chat-input::placeholder { color: var(--gh-text-dim); }
.gh-chat-send {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #f0c674, #b97f2e);
  color: #2a1a00;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.15s;
  flex-shrink: 0;
}
.gh-chat-send:hover { filter: brightness(1.15); }
.gh-chat-send i { font-size: 15px; }

/* LOADING + EMPTY STATES */
.gh-loading,
.gh-error,
.gh-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  min-height: 60vh;
  text-align: center;
}
.gh-loading i { font-size: 36px; color: var(--gh-gold); }
.gh-error i { font-size: 32px; color: var(--blood); }
.gh-empty-state i { font-size: 56px; color: var(--gh-text-dim); }
.gh-empty-state h2 {
  font-family: var(--font-title);
  font-size: 18px;
  color: var(--gh-gold);
  margin: 0;
}
.gh-empty-state p {
  color: var(--gh-text-dim);
  font-size: 13.5px;
  max-width: 340px;
  line-height: 1.5;
  margin: 0;
}

/* Mobile fine-tuning — el frame ya ocupa toda la pantalla */
@media (max-width: 900px) {
  /* Avatar genérico circular — 2026-05-09 +30% */
  .gh-actor:not(.is-fullbody) .gh-actor-img { width: 26px; height: 26px; }
  /* Sprite full-body — 2026-05-09 +30% */
  .gh-actor.is-fullbody .gh-actor-img { width: 34px; }
  .gh-actor.is-fullbody[data-race="elf"]    .gh-actor-img,
  .gh-actor.is-fullbody[data-race="undead"] .gh-actor-img { width: 44px; }
  .gh-actor.is-fullbody .gh-actor-shadow { width: 22px; }
  .gh-actor:not(.is-fullbody) .gh-actor-shadow { width: 18px; }
  .gh-actor-name { font-size: 9.5px; max-width: 90px; padding: 0 5px; }
  .gh-actor-bars { width: 38px; }
  .gh-actor-bar { height: 2px; }
  .gh-actor-mini-avatar { width: 14px; height: 14px; font-size: 8px; }
  .gh-header-title { font-size: 14px; }
  .gh-chat-fab { width: 48px; height: 48px; right: 12px; bottom: 12px; }
  .gh-chat-fab i { font-size: 22px; }
  .gh-chat-drawer { height: 70%; max-height: none; }
}

/* Pantallas muy chicas — 2026-05-09 +30% */
@media (max-width: 480px) {
  .gh-actor:not(.is-fullbody) .gh-actor-img { width: 23px; height: 23px; }
  .gh-actor.is-fullbody .gh-actor-img { width: 29px; }
  .gh-actor.is-fullbody[data-race="elf"]    .gh-actor-img,
  .gh-actor.is-fullbody[data-race="undead"] .gh-actor-img { width: 39px; }
  .gh-actor-name { font-size: 9.5px; max-width: 80px; }
}
