/* ============================================================================
   AI TACTICAL COMBAT ARENA 2D - HOJA DE ESTILOS PROFESIONAL
   Animaciones Keyframes de Combate, HUD Reactivo y Paleta RPG Táctica
   ============================================================================ */

:root {
    --bg-dark: #0a0b10;
    --bg-surface: #121520;
    --bg-card: #181d2d;
    --bg-card-hover: #22293f;
    --border-color: #2a3350;
    --border-glow: #4f5f8f;
    
    --color-primary: #3b82f6;
    --color-primary-glow: rgba(59, 130, 246, 0.4);
    --color-accent: #8b5cf6;
    --color-gold: #f59e0b;
    --color-hp: #10b981;
    --color-hp-bg: #064e3b;
    --color-mp: #06b6d4;
    --color-mp-bg: #164e63;
    --color-boss-hp: #ef4444;
    --color-boss-hp-bg: #7f1d1d;
    --color-danger: #dc2626;

    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-highlight: #ffffff;

    --font-heading: 'Cinzel', serif;
    --font-body: 'Rajdhani', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 60%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
}

/* LAYOUT PRINCIPAL */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* HEADER GLOBAL */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(18, 21, 32, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px var(--color-primary));
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    letter-spacing: 1.5px;
    color: var(--text-highlight);
    background: linear-gradient(90deg, #ffffff, #93c5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sub-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.sub-badge strong {
    color: #38bdf8;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.engine-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 9999px;
    font-size: 0.8rem;
    color: #34d399;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.user-header-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--bg-card);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.user-avatar-mini {
    font-size: 1.3rem;
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.username-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.level-pill {
    font-size: 0.7rem;
    color: var(--color-gold);
    font-weight: 600;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

.btn-logout:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: var(--color-danger);
}

/* VISTAS Y TRANSICIONES */
.view-screen {
    display: none;
    padding: 2rem;
    flex: 1;
}

.view-screen.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   PANTALLA 1: AUTENTICACIÓN Y SELECCIÓN DE HÉROE
   ============================================================================ */
#auth-screen {
    justify-content: center;
    align-items: center;
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    box-shadow: var(--shadow-soft), var(--shadow-glow);
    overflow: hidden;
}

.auth-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: #fff;
    background: var(--bg-surface);
    border-bottom: 2px solid var(--color-primary);
}

.auth-form {
    display: none;
    padding: 2rem;
}

.auth-form.active {
    display: block;
}

.auth-form h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    margin-bottom: 0.4rem;
    color: #fff;
}

.form-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.4rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: var(--font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-glow);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* SELECTOR DE CLASES */
.class-picker-section {
    margin: 1.5rem 0;
}

.section-label {
    display: block;
    font-weight: 700;
    margin-bottom: 0.8rem;
    color: #fff;
}

.class-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.8rem;
}

.class-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.9rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
}

.class-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--color-primary);
    transform: translateY(-3px);
}

.class-card.selected {
    border-color: var(--color-primary);
    background: rgba(59, 130, 246, 0.15);
    box-shadow: 0 0 12px var(--color-primary-glow);
}

.class-icon {
    font-size: 1.8rem;
    margin-bottom: 0.4rem;
}

.class-card h3 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: #fff;
}

.class-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.class-stats-preview {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.2rem;
    font-size: 0.7rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem;
    border-radius: 4px;
}

.class-stats-preview strong {
    color: #fff;
}

/* BOTONES GLOBALES */
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 0 15px var(--color-primary-glow);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    color: #fff;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    transform: scale(1.02);
}

.btn-block {
    width: 100%;
}

.btn-cta {
    letter-spacing: 1px;
    font-weight: 800;
}

/* ============================================================================
   PANTALLA 2: LOBBY Y SELECCIÓN DE JEFE
   ============================================================================ */
.lobby-container {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.hero-summary-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.hero-avatar-large {
    font-size: 3.5rem;
    background: var(--bg-card);
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-glow);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.hero-details {
    flex: 1;
}

.hero-details h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    color: #fff;
}

.hero-class-tag {
    color: var(--color-gold);
    font-weight: 600;
    font-size: 0.95rem;
}

.hero-progress-bars {
    margin-top: 0.8rem;
    max-width: 400px;
}

.boss-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0 2rem 0;
}

.boss-card {
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.boss-card:hover {
    border-color: var(--color-danger);
    transform: translateY(-4px);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.boss-card.selected {
    border-color: var(--color-danger);
    background: rgba(220, 38, 38, 0.08);
    box-shadow: 0 0 25px rgba(220, 38, 38, 0.3);
}

.boss-portrait-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.boss-sprite-preview {
    font-size: 3rem;
    filter: drop-shadow(0 0 10px rgba(239, 68, 68, 0.5));
}

.difficulty-tag {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.difficulty-tag.hard {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-gold);
    border: 1px solid var(--color-gold);
}

.difficulty-tag.expert {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
    border: 1px solid var(--color-danger);
}

.boss-card h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 0.4rem;
}

.boss-lore {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 1rem;
}

.boss-stats-chips {
    display: flex;
    gap: 0.8rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

.boss-stats-chips span {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
}

.lobby-actions {
    text-align: center;
    margin-top: 2rem;
}

/* ============================================================================
   PANTALLA 3: ESCENARIO DE COMBATE 2D
   ============================================================================ */
.combat-layout {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 1.5rem;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

/* ESCENARIO / ARENA STAGE */
.arena-stage {
    position: relative;
    height: 380px;
    background: linear-gradient(180deg, #0e111a 0%, #171b29 70%, #0d0f17 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 2rem 4rem 3rem 4rem;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8);
}

.arena-background-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(42, 51, 80, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(42, 51, 80, 0.15) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

/* GLOBO DE DIÁLOGO IA SUPERIOR */
.ai-speech-bubble {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 600px;
    width: 90%;
    background: rgba(18, 21, 32, 0.95);
    border: 1px solid #7c3aed;
    border-radius: var(--radius-md);
    padding: 0.9rem 1.4rem;
    box-shadow: 0 0 25px rgba(124, 58, 237, 0.3);
    z-index: 20;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { opacity: 0; transform: translate(-50%, -15px) scale(0.95); }
    to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.3rem;
}

.boss-ai-name-label {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: #c084fc;
}

.boss-ai-intent-pill {
    background: rgba(220, 38, 38, 0.2);
    border: 1px solid var(--color-danger);
    color: #f87171;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    letter-spacing: 0.5px;
}

.bubble-quote {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: #ffffff;
    font-style: italic;
    line-height: 1.3;
}

.bubble-reasoning {
    margin-top: 0.4rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
    padding-top: 0.3rem;
}

.btn-link-mini {
    background: none;
    border: none;
    color: #38bdf8;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0;
}

.btn-link-mini:hover {
    text-decoration: underline;
}

.reasoning-detail {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 0.3rem;
    font-style: normal;
}

/* MARCADOR DE TURNO CENTRAL */
.arena-center-indicator {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
}

.turn-counter-badge {
    background: rgba(10, 11, 16, 0.8);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.turn-counter-badge .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.turn-counter-badge .number {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-gold);
}

/* LADOS DEL COMBATIENTE */
.combatant-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 5;
    width: 280px;
}

.combatant-hud {
    width: 100%;
    background: rgba(15, 18, 28, 0.85);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.8rem;
    margin-bottom: 1.2rem;
    backdrop-filter: blur(8px);
}

.hud-nameplate {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.hud-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.hud-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* BARRAS DE PROGRESO DE HP Y MP */
.hud-bar-wrapper {
    margin-bottom: 0.4rem;
}

.bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.bar-track {
    width: 100%;
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hp-fill {
    background: linear-gradient(90deg, #059669, #10b981);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.hp-fill.danger {
    background: linear-gradient(90deg, #b91c1c, #ef4444);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.hp-fill.boss-fill {
    background: linear-gradient(90deg, #991b1b, #dc2626);
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.5);
}

.mp-fill {
    background: linear-gradient(90deg, #0284c7, #06b6d4);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.exp-fill {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

.hud-status-icons {
    min-height: 20px;
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.status-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid var(--color-primary);
    color: #93c5fd;
}

.status-pill.boss-move {
    background: rgba(220, 38, 38, 0.2);
    border-color: var(--color-danger);
    color: #fca5a5;
}

/* SPRITES 2D Y ANIMACIONES DE COMBATE */
.sprite-anchor {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sprite {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
}

.sprite-figure {
    font-size: 4.5rem;
    z-index: 2;
    transition: transform 0.2s ease;
}

.boss-figure {
    font-size: 5.5rem;
}

.sprite-shadow {
    position: absolute;
    bottom: -10px;
    width: 90px;
    height: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    filter: blur(4px);
    z-index: 1;
}

.sprite-glow {
    position: absolute;
    inset: 10px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 0;
}

.sprite-glow.boss-glow {
    background: radial-gradient(circle, rgba(220, 38, 38, 0.25) 0%, transparent 70%);
}

/* ANIMACIONES KEYFRAMES */

/* 1. Respiración / Idle */
.sprite.idle {
    animation: idle-float 3s ease-in-out infinite alternate;
}

@keyframes idle-float {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}

/* 2. Ataque físico del héroe */
.sprite.attack-hero {
    animation: hero-lunge 0.5s ease-out;
}

@keyframes hero-lunge {
    0% { transform: translateX(0); }
    40% { transform: translateX(80px) scale(1.15); filter: brightness(1.3); }
    100% { transform: translateX(0); }
}

/* 3. Ataque del jefe */
.sprite.attack-boss {
    animation: boss-lunge 0.5s ease-out;
}

@keyframes boss-lunge {
    0% { transform: translateX(0); }
    40% { transform: translateX(-80px) scale(1.15); filter: brightness(1.3); }
    100% { transform: translateX(0); }
}

/* 4. Lanzamiento de magia */
.sprite.cast-magic {
    animation: magic-pulse 0.7s ease-in-out;
}

@keyframes magic-pulse {
    0% { transform: scale(1); filter: brightness(1); }
    50% { transform: scale(1.25); filter: drop-shadow(0 0 25px #06b6d4) brightness(1.8); }
    100% { transform: scale(1); filter: brightness(1); }
}

/* 5. Daño recibido (Sacudida y parpadeo rojo) */
.sprite.hit-damage {
    animation: shake-red 0.5s ease;
}

@keyframes shake-red {
    0%, 100% { transform: translateX(0); filter: none; }
    20% { transform: translateX(-15px) rotate(-5deg); filter: sepia(1) saturate(5) hue-rotate(310deg); }
    40% { transform: translateX(15px) rotate(5deg); filter: sepia(1) saturate(5) hue-rotate(310deg); }
    60% { transform: translateX(-10px); }
    80% { transform: translateX(10px); }
}

/* 6. Postura defensiva */
.sprite.defend-mode {
    animation: shield-vibe 1s ease-in-out infinite alternate;
}

@keyframes shield-vibe {
    0% { filter: drop-shadow(0 0 10px #3b82f6); transform: scale(0.95); }
    100% { filter: drop-shadow(0 0 25px #60a5fa); transform: scale(1.02); }
}

/* NÚMEROS DE DAÑO FLOTANTES */
.floating-damage-container {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 50;
    width: 150px;
    display: flex;
    justify-content: center;
}

.dmg-number {
    position: absolute;
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 900;
    animation: floatUpFade 1.2s ease-out forwards;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

.dmg-number.damage {
    color: #f87171;
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
}

.dmg-number.critical {
    color: #fbbf24;
    font-size: 2.3rem;
    text-shadow: 0 0 15px rgba(245, 158, 11, 0.9);
}

.dmg-number.heal {
    color: #34d399;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

.dmg-number.mana {
    color: #38bdf8;
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.8);
}

@keyframes floatUpFade {
    0% { opacity: 0; transform: translateY(15px) scale(0.7); }
    20% { opacity: 1; transform: translateY(0) scale(1.2); }
    80% { opacity: 1; transform: translateY(-40px) scale(1); }
    100% { opacity: 0; transform: translateY(-60px) scale(0.9); }
}

/* ============================================================================
   PANEL INFERIOR: COMANDOS Y BITÁCORA
   ============================================================================ */
.combat-control-dashboard {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 1.5rem;
    min-height: 260px;
}

.tactical-actions-panel,
.combat-battle-log-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
}

.panel-header h3 {
    font-family: var(--font-heading);
    font-size: 1rem;
    letter-spacing: 1px;
    color: #fff;
}

.phase-indicator {
    font-size: 0.8rem;
    font-weight: 700;
    color: #34d399;
    background: rgba(16, 185, 129, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
    flex: 1;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.action-btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

.action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

.btn-action-icon {
    font-size: 1.6rem;
}

.btn-action-text strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.9rem;
}

.btn-action-text small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-attack:hover:not(:disabled) { border-color: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
.btn-magic:hover:not(:disabled) { border-color: #06b6d4; box-shadow: 0 0 10px rgba(6, 182, 212, 0.3); }
.btn-defend:hover:not(:disabled) { border-color: #3b82f6; box-shadow: 0 0 10px rgba(59, 130, 246, 0.3); }
.btn-item:hover:not(:disabled) { border-color: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, 0.3); }
.btn-history:hover { border-color: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.3); }

.magic-element-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--border-color);
    font-size: 0.85rem;
}

.btn-element {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-element.active,
.btn-element:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: #06b6d4;
    color: #38bdf8;
}

/* BITÁCORA DE COMBATE EN VIVO */
.log-stream {
    flex: 1;
    overflow-y: auto;
    background: rgba(10, 11, 16, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    font-family: var(--font-mono);
    font-size: 0.82rem;
}

.log-entry {
    line-height: 1.4;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-time {
    color: #64748b;
    margin-right: 0.4rem;
}

.log-entry.hero { color: #93c5fd; }
.log-entry.hero strong { color: #60a5fa; }
.log-entry.boss { color: #fca5a5; }
.log-entry.boss strong { color: #f87171; }
.log-entry.system { color: #cbd5e1; }
.log-entry.critical { color: #fde047; font-weight: bold; }
.log-entry.heal { color: #6ee7b7; }

/* MODALES */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
    padding: 1.5rem;
}

.modal-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-soft);
}

.modal-large {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #fff;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.2rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* MODAL DE RESULTADOS */
.result-header {
    text-align: center;
    padding: 2rem 1rem 1rem 1rem;
}

.result-big-icon {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 15px rgba(245, 158, 11, 0.5));
}

.result-header h2 {
    font-family: var(--font-heading);
    font-size: 2rem;
}

.result-header.victory h2 { color: #34d399; }
.result-header.defeat h2 { color: #f87171; }

.result-body {
    padding: 1.5rem;
    text-align: center;
}

.result-stats-box {
    margin-top: 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: left;
}

.stat-item .label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-item .val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.stat-item .val.highlight {
    color: var(--color-gold);
}

/* TABLA DE AUDITORÍA */
.table-responsive {
    overflow-x: auto;
}

.audit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-top: 1rem;
}

.audit-table th {
    background: var(--bg-card);
    padding: 0.75rem;
    text-align: left;
    color: #94a3b8;
    border-bottom: 1px solid var(--border-color);
}

.audit-table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
}

.audit-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* HISTORIAL DE TURNOS */
.turns-log-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.turn-log-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.turn-log-header {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.4rem;
    margin-bottom: 0.6rem;
    color: #38bdf8;
}

.turn-log-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    font-size: 0.8rem;
}

.turn-log-block {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.6rem;
    border-radius: 4px;
}

.turn-log-block pre {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #cbd5e1;
    overflow-x: auto;
    white-space: pre-wrap;
}

/* ESTADÍSTICAS DASHBOARD */
.stats-grid-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.2rem;
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: #38bdf8;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* TOAST NOTIFICATION */
.toast-notification {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--bg-surface);
    border: 1px solid var(--color-primary);
    box-shadow: 0 0 20px var(--color-primary-glow);
    padding: 0.8rem 1.4rem;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 0.9rem;
    z-index: 300;
    animation: toastSlide 0.3s ease;
}

@keyframes toastSlide {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.hidden {
    display: none !important;
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .combat-control-dashboard {
        grid-template-columns: 1fr;
    }

    .arena-stage {
        padding: 1.5rem;
        height: auto;
        min-height: 420px;
    }

    .combatant-side {
        width: 160px;
    }
}

/* COMPONENTES DE ENTRADA Y REGISTRO LIBRE */
.input-with-button {
    display: flex;
    gap: 0.5rem;
}

.input-with-button input {
    flex: 1;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: var(--color-primary);
    color: #fff;
    transform: translateY(-1px);
}

.form-actions-stack {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

.recent-heroes-wrap {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border-color);
}

.section-label-mini {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-heroes-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.hero-chip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    color: #e2e8f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.hero-chip:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

