/* Fuente MMORPG V2 — Cinzel Decorative */
@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700&display=swap');

/* Paleta e identidad V2.0 */
:root {
    --font-medieval-v2: 'Cinzel Decorative', cursive;
    --v2-bg: #121212;
    --v2-primary: #b8860b;
    --v2-text: #e0d7c6;
    --gold-old: #b8860b;
    --gold-glow: #8b6508;
    --dark-bg: #121212;
    --text-parchment: #e0d7c6;
    --glass-effect: rgba(0, 0, 0, 0.7);
    --border-medieval: 2px solid #3d3d3d;
}

* {
    font-family: var(--font-medieval-v2) !important;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--v2-bg);
    color: var(--v2-text);
}

.game-title {
    font-family: var(--font-medieval-v2) !important;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--v2-primary);
    text-shadow: 0 0 24px rgba(184, 134, 11, 0.35);
}

/* 1. Definir el Efecto de Cristal (Actualizado para el Plan Pure Glass) */
.v2-glass {
    background: rgba(0, 0, 0, 0.6) !important; /* Semi-transparente y sutil */
    backdrop-filter: blur(15px) brightness(0.8) !important; /* El desenfoque es la clave */
    -webkit-backdrop-filter: blur(15px) brightness(0.8) !important;
    border: none !important; /* Quitamos el borde sólido viejo */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7) !important; /* Sombras profundas */
}

.v2-panel-glass {
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(15px) brightness(0.8) !important;
    -webkit-backdrop-filter: blur(15px) brightness(0.8) !important;
    border: none !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7) !important;
    border-radius: 4px;
}

/* Header V2: título centrado */
.v2-header-bar {
    border-color: rgba(184, 134, 11, 0.35) !important;
}

.v2-header-bar .v2-header-title-block {
    width: 100%;
    text-align: center;
}

/* Login: ocultar contenedor decorativo cuando ya hay sesión (el gate ya oculta botones) */
body.v2-auth--ready #v2LoginSlot.v2-login-dock--hide-when-authed {
    opacity: 0.45;
    pointer-events: none;
}

/* Roster de héroes (chips) */
.v2-hero-roster-title {
    font-size: 0.65rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(224, 215, 198, 0.75);
    margin: 0 0 0.5rem;
}

.v2-hero-nick-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.v2-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    border-radius: 2px;
    border: 1px solid rgba(184, 134, 11, 0.45);
    background: rgba(0, 0, 0, 0.5);
    color: var(--v2-text);
    font-size: 0.75rem;
}

.v2-hero-chip--placeholder {
    opacity: 0.85;
    font-style: italic;
}

.v2-hero-chip-meta {
    font-size: 0.65rem;
    color: rgba(224, 215, 198, 0.55);
}

/* Pantalla elegir héroe: chips y título más legibles en escritorio (antes ~10px parecía “lejos”) */
@media (min-width: 640px) {
    #heroChoice .v2-hero-roster-title {
        font-size: 0.72rem;
        margin-bottom: 0.6rem;
    }
    #heroChoice .v2-hero-chip {
        font-size: 0.8125rem;
        padding: 0.4rem 0.75rem;
    }
    #heroChoice .v2-hero-chip-meta {
        font-size: 0.7rem;
    }
}
@media (min-width: 1024px) {
    #heroChoice .v2-hero-roster-title {
        font-size: 0.8rem;
    }
    #heroChoice .v2-hero-chip {
        font-size: 0.875rem;
        padding: 0.45rem 0.85rem;
    }
}

/* CTA dorado envejecido */
.v2-button-gold {
    background: linear-gradient(145deg, #8b6508, #b8860b);
    color: #000;
    border: 1px solid #5e4506;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    cursor: url("./assets/cursors/sword.png") 4 2, auto !important;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(139, 101, 8, 0.3);
    border-radius: 4px;
}

.v2-button-gold:hover {
    filter: brightness(1.2);
    box-shadow: 0 0 20px rgba(184, 134, 11, 0.6);
}

/* Footer fijo versión (esquina inferior derecha) */
.v2-footer-version {
    position: fixed;
    bottom: 0.65rem;
    right: 0.65rem;
    z-index: 10055;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: rgba(224, 215, 198, 0.55);
    pointer-events: none;
    text-transform: uppercase;
}

/* Franja de personaje activo (puente) */
.v2-active-hero-strip {
    margin-top: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    border: 1px solid rgba(184, 134, 11, 0.35);
    background: rgba(0, 0, 0, 0.45);
    font-size: 0.7rem;
    color: var(--v2-text);
}

.v2-active-hero-strip.hidden {
    display: none !important;
}

/* Contenedor principal (marco suave alrededor del juego bajo el header) */
.v2-auth-mirror {
    pointer-events: none;
}

.v2-mirror-line:empty::before {
    content: "\00a0";
    opacity: 0;
}

#v2MainGlass.v2-main-shell {
    padding: 0.25rem;
}

@media (min-width: 768px) {
    #v2MainGlass.v2-main-shell {
        padding: 0.5rem;
        border: 1px solid rgba(184, 134, 11, 0.22);
        border-radius: 4px;
        background: rgba(0, 0, 0, 0.25);
    }
}

/* 2. Recuperar el Brillo Dorado Mágico (Adaptado) */
@keyframes goldShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.v2-gold-shimmer-border {
    position: relative;
    padding: 3px; /* Espacio para que se vea el brillo */
    background: linear-gradient(
        270deg,
        #b8860b, /* Oro Viejo */
        #ffdf00, /* Oro Brillante */
        #b8860b
    );
    background-size: 400% 400%;
    animation: goldShimmer 4s ease infinite; /* El movimiento */
    border-radius: 4px;
    z-index: 1;
}

/* 3. El contenido interior (Pure Glass) que tapa el centro del brillo */
.v2-gold-shimmer-border .v2-content {
    background: transparent !important; /* ¡¡PURE GLASS!! No solidity */
    border-radius: 2px;
    position: relative;
    z-index: 2;
    padding: 20px;
}

/* ========== v0.1.9 — Atmósfera, pulido Guild Hall, tarjetas ciudad ========== */

.v2-ui-root #rpg-root.v2-rpg-root {
    position: relative;
    z-index: 1;
}

/* --- Fondo atmosférico (niebla + relámpago + paralaje vía --v2-parallax-*) --- */
.v2-atmosphere {
    --v2-parallax-x: 0;
    --v2-parallax-y: 0;
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Capa base = fondo nítido; sin blur global (el blur era lo que “lavaba” toda la pantalla) */
.v2-atmosphere-gradient {
    position: absolute;
    inset: -8%;
    background-color: #121212;
    background-image:
        radial-gradient(ellipse 85% 65% at 45% 25%, rgba(60, 45, 85, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse 70% 50% at 70% 75%, rgba(25, 55, 75, 0.06) 0%, transparent 50%),
        linear-gradient(180deg, rgba(8, 10, 18, 0.06) 0%, rgba(12, 12, 18, 0.12) 50%, rgba(8, 8, 14, 0.14) 100%),
        url("./assets/backgrounds/fondo.png?v=99");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    filter: brightness(1);
    transform: translate3d(
        calc(var(--v2-parallax-x) * -18px),
        calc(var(--v2-parallax-y) * -14px),
        0
    );
    -webkit-transform: translate3d(
        calc(var(--v2-parallax-x) * -18px),
        calc(var(--v2-parallax-y) * -14px),
        0
    );
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transition: transform 0.35s ease-out, filter 0.15s ease-out;
}

/* Relámpago: destello breve sin volver a difuminar el fondo */
.v2-atmosphere--flash .v2-atmosphere-gradient {
    filter: brightness(1.18) saturate(1.06) contrast(1.02);
}

/* Destello localizado: esquina superior derecha (se activa con .v2-atmosphere--flash) */
.v2-atmosphere-lightning-tr {
    position: absolute;
    top: -5%;
    right: -8%;
    width: min(52vmin, 85%);
    height: min(48vmin, 55%);
    pointer-events: none;
    opacity: 0;
    background:
        radial-gradient(ellipse 70% 55% at 78% 18%, rgba(255, 255, 255, 0.65) 0%, rgba(200, 220, 255, 0.35) 18%, transparent 52%),
        radial-gradient(ellipse 50% 40% at 92% 8%, rgba(255, 255, 255, 0.5) 0%, transparent 45%),
        linear-gradient(155deg, transparent 40%, rgba(180, 200, 255, 0.12) 70%, transparent 85%);
    mix-blend-mode: screen;
    filter: blur(0.5px);
    transition: opacity 0.06s ease-out;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.v2-atmosphere--flash .v2-atmosphere-lightning-tr {
    opacity: 1;
}

/* Niebla muy suave (opcional); antes opacidad alta + screen lavaba el fondo */
.v2-atmosphere-fog {
    position: absolute;
    inset: -15%;
    opacity: 0.07;
    mix-blend-mode: normal;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background:
        radial-gradient(ellipse 100% 60% at 15% 35%, rgba(200, 210, 230, 0.2) 0%, transparent 58%),
        radial-gradient(ellipse 90% 55% at 85% 25%, rgba(180, 190, 220, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse 75% 50% at 50% 75%, rgba(100, 110, 140, 0.1) 0%, transparent 52%);
    background-size: 240% 240%;
    background-position: 12% 28%, 78% 42%, 48% 72%;
    animation: v2-fog-drift-a 110s ease-in-out infinite;
}

.v2-atmosphere-fog--slow {
    opacity: 0.05;
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    animation: v2-fog-drift-b 155s ease-in-out infinite alternate;
    mix-blend-mode: normal;
    background:
        radial-gradient(ellipse 120% 70% at 40% 45%, rgba(220, 225, 240, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 100% 60% at 75% 30%, rgba(190, 200, 230, 0.1) 0%, transparent 50%);
    background-size: 260% 260%;
    background-position: 40% 50%, 70% 35%;
}

/* Tercio inferior: antes ~0.88 opacidad cubría el paisaje; ahora solo un velo ligero */
.v2-atmosphere-fog-bottom {
    position: absolute;
    left: -8%;
    right: -8%;
    bottom: 0;
    height: 42%;
    pointer-events: none;
    opacity: 0.09;
    will-change: transform;
    mix-blend-mode: normal;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background:
        radial-gradient(ellipse 115% 95% at 50% 100%, rgba(100, 110, 145, 0.2) 0%, transparent 68%),
        linear-gradient(to top, rgba(20, 24, 38, 0.22) 0%, transparent 65%);
    background-size: 120% 140%;
    animation: v2-fog-bottom-drift 72s ease-in-out infinite alternate;
}

@keyframes v2-fog-bottom-drift {
    0% {
        transform: translate3d(-3%, 0, 0) scaleX(1.02) scaleY(1);
        background-position: 48% 100%, 50% 0%;
    }
    50% {
        transform: translate3d(4%, -4%, 0) scaleX(1.06) scaleY(1.04);
        background-position: 52% 100%, 50% 0%;
    }
    100% {
        transform: translate3d(-3%, 0, 0) scaleX(1.02) scaleY(1);
        background-position: 48% 100%, 50% 0%;
    }
}

@keyframes v2-fog-drift-a {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        background-position: 12% 28%, 78% 42%, 48% 72%;
    }
    20% {
        transform: translate3d(5%, -3%, 0) rotate(0.4deg) scale(1.03);
        background-position: 22% 38%, 68% 48%, 55% 65%;
    }
    40% {
        transform: translate3d(10%, -6%, 0) rotate(-0.25deg) scale(1.06);
        background-position: 35% 48%, 58% 55%, 62% 58%;
    }
    60% {
        transform: translate3d(6%, 2%, 0) rotate(0.2deg) scale(1.04);
        background-position: 48% 42%, 45% 62%, 50% 50%;
    }
    80% {
        transform: translate3d(-2%, 4%, 0) rotate(-0.15deg) scale(1.02);
        background-position: 8% 32%, 82% 38%, 42% 78%;
    }
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        background-position: 12% 28%, 78% 42%, 48% 72%;
    }
}

@keyframes v2-fog-drift-b {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1.03);
        background-position: 40% 50%, 70% 35%;
    }
    25% {
        transform: translate3d(-8%, 5%, 0) rotate(-0.5deg) scale(1.06);
        background-position: 55% 45%, 58% 42%;
    }
    50% {
        transform: translate3d(-14%, -4%, 0) rotate(0.35deg) scale(1.08);
        background-position: 70% 55%, 45% 48%;
    }
    75% {
        transform: translate3d(-5%, -8%, 0) rotate(-0.2deg) scale(1.04);
        background-position: 32% 58%, 78% 32%;
    }
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1.03);
        background-position: 40% 50%, 70% 35%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .v2-atmosphere-fog,
    .v2-atmosphere-fog--slow,
    .v2-atmosphere-fog-bottom {
        animation: none !important;
    }
    .v2-atmosphere-gradient {
        transform: none !important;
        transition: none !important;
    }
    #cityView .city-view-nav button[id^="building"]:hover .relative.w-9 {
        animation: none !important;
    }
}

/* --- Tarjetas de menú ciudad (Taberna, Herrería, …) --- */
#cityView .city-view-nav button[id^="building"] {
    transition:
        transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1),
        box-shadow 0.28s ease,
        filter 0.28s ease,
        border-color 0.2s ease;
}

/* v0.1.9.2 — hover: brillo dorado en el borde, tarjeta elevada */
#cityView .city-view-nav button[id^="building"]:hover {
    transform: translateY(-7px) scale(1.025);
    box-shadow:
        0 18px 42px rgba(0, 0, 0, 0.58),
        0 0 32px rgba(251, 191, 36, 0.42),
        0 0 56px rgba(245, 158, 11, 0.22),
        0 0 0 1px rgba(253, 224, 71, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    filter: brightness(1.3);
}

#cityView .city-view-nav button[id^="building"]:hover .relative.w-9 {
    animation: v2-building-icon-pulse 1.25s ease-in-out infinite;
}

#cityView .city-view-nav button[id^="building"]:focus-visible .relative.w-9 {
    animation: v2-building-icon-wiggle 0.65s ease;
}

#cityView .city-view-nav button[id^="building"]:active {
    transform: translateY(-3px) scale(1.015);
}

@keyframes v2-building-icon-pulse {
    0%,
    100% {
        transform: scale(1);
        filter: brightness(1);
        box-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
    }
    50% {
        transform: scale(1.07);
        filter: brightness(1.28);
        box-shadow: 0 0 28px rgba(253, 224, 71, 0.95), 0 0 44px rgba(245, 158, 11, 0.45);
    }
}

@keyframes v2-building-icon-wiggle {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-4deg) scale(1.06); }
    50% { transform: rotate(3deg) scale(1.05); }
    75% { transform: rotate(-2deg) scale(1.04); }
}

/* --- Detalles del miembro: HP / Mana / AC (primera fila de chips) --- */
#panel-inventario-equipo > .grid.grid-cols-3.gap-2.mb-3 .guild-stat-chip-label {
    color: #c8c8c8 !important;
}

#panel-inventario-equipo > .grid.grid-cols-3.gap-2.mb-3 .guild-stat-chip-value {
    color: #ffd700 !important;
    text-shadow: 0 0 12px rgba(255, 215, 0, 0.35);
}

/* Barra XP dentro del panel de detalles (relleno indigo → cian vibrante) */
#panel-inventario-equipo .border.border-gray-600\/80 .h-full.bg-indigo-500,
#panel-inventario-equipo .h-full.rounded.transition-all[class*="bg-indigo"] {
    background: linear-gradient(90deg, #0891b2, #22d3ee, #67e8f9, #22d3ee) !important;
    background-size: 200% 100%;
    animation: v2-xp-shimmer-bar 3s ease-in-out infinite;
    box-shadow:
        0 0 10px rgba(34, 211, 238, 0.45),
        0 0 18px rgba(34, 211, 238, 0.2);
}

@keyframes v2-xp-shimmer-bar {
    0%, 100% { background-position: 0% 50%; filter: brightness(1); }
    50% { background-position: 100% 50%; filter: brightness(1.08); }
}

/* Barra XP global (header) */
#rpg-root #xpBarFill {
    background: linear-gradient(90deg, #0e7490, #06b6d4, #22d3ee, #67e8f9) !important;
    background-size: 200% 100%;
    animation: v2-xp-shimmer-bar 3.2s ease-in-out infinite;
    box-shadow:
        0 0 10px rgba(34, 211, 238, 0.4),
        0 0 20px rgba(6, 182, 212, 0.15);
}

/* Atributos STR… — iconos con micro-interacción */
.guild-attrs-grid-wrap .guild-stat-chip-icon {
    font-size: 1rem;
    line-height: 1;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.guild-attrs-grid-wrap .guild-stat-chip:hover .guild-stat-chip-icon {
    transform: scale(1.14);
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.5));
}

/* Miembro escuadra seleccionado — pulso suave en retrato */
.group-member-slot.ring-2.ring-amber-400 .w-8.h-8.rounded-full {
    animation: v2-member-avatar-glow 2.2s ease-in-out infinite;
}

@keyframes v2-member-avatar-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.35);
    }
    50% {
        box-shadow: 0 0 14px 2px rgba(255, 215, 0, 0.4);
    }
}

@media (prefers-reduced-motion: reduce) {
    #panel-inventario-equipo .h-full.rounded.transition-all[class*="bg-indigo"],
    #rpg-root #xpBarFill {
        animation: none !important;
    }
    .group-member-slot.ring-2.ring-amber-400 .w-8.h-8.rounded-full {
        animation: none !important;
    }
}

/* Sobrescribe Cinzel global en combate: Montserrat para nombres y log (v2-index) */
.v2-ui-root .rpg-combat-card-name,
.v2-ui-root .rpg-unit-name,
.v2-ui-root .rpg-character-card header h3 {
    font-family: "Montserrat", sans-serif !important;
    text-transform: none !important;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.v2-ui-root #combatLogBox,
.v2-ui-root #combatLogBox *,
.v2-ui-root .combat-log-message {
    font-family: "Montserrat", sans-serif !important;
    text-transform: none !important;
    font-size: 14px;
    line-height: 1.4;
}

.v2-ui-root .combat-log-highlight {
    font-family: "Montserrat", sans-serif !important;
    font-weight: 800;
}

/* ——— v0.2.2 — Móvil / táctil: capa estática; sin backdrop-blur ni filter-blur en cristal V2 y atmósfera ——— */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .v2-glass,
    .v2-panel-glass {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.75) !important;
    }

    /* Relámpago: sin blur (solo gradientes planos) */
    .v2-atmosphere-lightning-tr {
        filter: none !important;
        -webkit-filter: none !important;
    }

    .v2-atmosphere-gradient {
        filter: none !important;
        -webkit-filter: none !important;
    }

    .v2-atmosphere--flash .v2-atmosphere-gradient {
        filter: none !important;
        -webkit-filter: none !important;
    }

    /* Niebla global: sin animación pesada ni filtros sobre fondo en movimiento */
    .v2-atmosphere-fog,
    .v2-atmosphere-fog--slow,
    .v2-atmosphere-fog-bottom {
        filter: none !important;
        -webkit-filter: none !important;
        animation: none !important;
        will-change: auto !important;
    }

    .guild-attrs-grid-wrap .guild-stat-chip:hover .guild-stat-chip-icon {
        filter: none;
    }
}
