/* Tema V2 — paleta y la regla global de letra */
/* D-MINIMIZAR-F3 D-MF3-2 — las letras salen de fuentes.css (antes, @import de Google Fonts). */
/* D-LETRA D-LT-2 (claude/_CLAUDE_D_LETRA_MESA.md) — hasta 0.9.5.991 la regla * de abajo ponía Cinzel Decorative (sólo capitales)
   a TODO con !important: cualquier texto sin su propio !important salía en versalitas. Ahora * lleva la letra de texto
   (--ui-fuente-texto, ui/tokens.css) y los títulos la de títulos; Cinzel Decorative queda sólo para el logo (--ui-fuente-logo). */

/* Paleta e identidad V2.0 */
:root {
    --font-medieval-v2: var(--ui-fuente-logo, 'Cinzel Decorative', 'Cinzel', serif);
    --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(--ui-fuente-texto, 'Nunito', system-ui, sans-serif) !important;
    text-transform: none;
    -webkit-font-smoothing: antialiased;
}

/* D-LT-2 — los títulos (y lo que llevan dentro), en la letra de títulos. Gana a * por especificidad; las hojas que quieren otra
   cosa en un título (el Diario con .diario-ventana *, las pantallas con su clase) siguen ganando por la suya. */
h1, h2, h3, h4, h5, h6, legend,
h1 *, h2 *, h3 *, h4 *, h5 *, h6 *, legend * {
    font-family: var(--ui-fuente-titulo, 'Cinzel', Georgia, serif) !important;
}

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;
}

/* D-OPCIONES-REDISENO A-2 — aquí estaba la capa atmosférica (#v2Atmosphere: fondo.png, niebla, relámpagos y paralaje). */

@media (prefers-reduced-motion: reduce) {
    #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 en retrato (rojo / ámbar legacy) */
.group-member-slot.mercenary-slot-selected .w-8.h-8.rounded-full,
.group-member-slot.ring-2.ring-amber-400 .w-8.h-8.rounded-full {
    animation: v2-member-avatar-glow-red 2.2s ease-in-out infinite;
}

@keyframes v2-member-avatar-glow-red {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 60, 80, 0.45);
    }
    50% {
        box-shadow: 0 0 14px 3px rgba(255, 45, 65, 0.65);
    }
}

@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.mercenary-slot-selected .w-8.h-8.rounded-full,
    .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: var(--ui-fuente-texto) !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: var(--ui-fuente-texto) !important;
    text-transform: none !important;
    font-size: 14px;
    line-height: 1.4;
}

.v2-ui-root .combat-log-highlight {
    font-family: var(--ui-fuente-texto) !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;
    }

    .guild-attrs-grid-wrap .guild-stat-chip:hover .guild-stat-chip-icon {
        filter: none;
    }
}
