:root {
    --primary-color: #ffcc00;
    /* Amarillo Pokemon */
    --primary-dark: #cc9900;
    --red-pokemon: #ff0000;
    --blue-pokemon: #3b4cca;
    --glass-bg: rgba(20, 20, 30, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Colores por Tipo */
    --tipo-fuego: #f08030;
    --tipo-agua: #6890f0;
    --tipo-tierra: #e0c068;
    --tipo-aire: #a890f0;
    /* Volador / Aire */
    --tipo-normal: #a8a878;
    --tipo-electrico: #f8d030;
    --tipo-planta: #78c850;
    --tipo-hielo: #98d8d8;
    --tipo-lucha: #c03028;
    --tipo-veneno: #a040a0;
    --tipo-psiquico: #f85888;
    --tipo-bicho: #a8b820;
    --tipo-fantasma: #705898;
    --tipo-dragon: #7038f8;
    --tipo-siniestro: #705848;
    --tipo-acero: #b8b8d0;
}

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

body {
    font-family: 'Roboto', sans-serif;
    color: white;
    overflow: hidden;
    /* Evitar scroll en la pantalla de batalla principal */
    background-color: #111;
}

/* Background Epic Stadium */
.stadium-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    /* stadium_bg.png is generated by AI */
    background-image: url('stadium_bg.png'), radial-gradient(circle, #2a2a35 0%, #101018 100%);
    background-size: cover;
    background-position: center bottom;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
}

.stadium-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 1;
}

header {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 2rem 0;
    text-shadow: 0 4px 6px rgba(0, 0, 0, 0.6);
}

.title {
    font-family: 'Press Start 2P', cursive;
    color: var(--primary-color);
    font-size: 2.5rem;
    letter-spacing: 2px;
    -webkit-text-stroke: 1px #000;
}

.battlefield {
    position: relative;
    z-index: 10;
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10%;
}

/* Zonas de Entrenadores */
.trainer-zone {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 400px;
}

.trainer-selector {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.5rem;
    border-radius: 15px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.trainer-selector label {
    display: block;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    color: #ccc;
    text-align: center;
}

.select-wrapper select {
    width: 100%;
    padding: 0.8rem;
    font-size: 1.2rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.select-wrapper select:hover {
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.4);
}

.select-wrapper select option {
    background: #222;
    color: white;
}

/* Pokemon Display */
.pokemon-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.pokemon-img {
    width: 300px;
    height: 300px;
    object-fit: contain;
    filter: drop-shadow(0 15px 15px rgba(0, 0, 0, 0.6));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.pokemon-img:hover {
    transform: scale(1.05) translateY(-5px);
    filter: drop-shadow(0 25px 20px rgba(0, 0, 0, 0.8));
}

.pokemon-info {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 50px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    min-width: 250px;
}

.pokemon-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.pokemon-stats {
    display: flex;
    justify-content: center;
    gap: 1rem;
    font-size: 0.9rem;
    font-weight: bold;
}

.pokemon-type {
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.tipo-agua {
    background-color: var(--tipo-agua);
    color: white;
}

.tipo-fuego {
    background-color: var(--tipo-fuego);
    color: white;
}

.tipo-tierra {
    background-color: var(--tipo-tierra);
    color: black;
}

.tipo-aire {
    background-color: var(--tipo-aire);
    color: white;
}

.tipo-normal {
    background-color: var(--tipo-normal);
    color: black;
}

.tipo-electrico {
    background-color: var(--tipo-electrico);
    color: black;
}

.tipo-planta {
    background-color: var(--tipo-planta);
    color: white;
}

.tipo-hielo {
    background-color: var(--tipo-hielo);
    color: black;
}

.tipo-lucha {
    background-color: var(--tipo-lucha);
    color: white;
}

.tipo-veneno {
    background-color: var(--tipo-veneno);
    color: white;
}

.tipo-psiquico {
    background-color: var(--tipo-psiquico);
    color: white;
}

.tipo-bicho {
    background-color: var(--tipo-bicho);
    color: white;
}

.tipo-fantasma {
    background-color: var(--tipo-fantasma);
    color: white;
}

.tipo-dragon {
    background-color: var(--tipo-dragon);
    color: white;
}

.tipo-siniestro {
    background-color: var(--tipo-siniestro);
    color: white;
}

.tipo-acero {
    background-color: var(--tipo-acero);
    color: black;
}

/* Selector de Pokémon (mismo estilo que trainer-selector) */
.pokemon-selector {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1rem 1.5rem;
    border-radius: 15px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.pokemon-selector label {
    display: block;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    margin-bottom: 1rem;
    color: #ccc;
    text-align: center;
}

.select-wrapper select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.loading-spinner {
    text-align: center;
    font-size: 0.75rem;
    color: var(--primary-color);
    padding: 0.4rem 0 0;
    animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { opacity: 0.4; }
    to   { opacity: 1; }
}

/* Botón luchar deshabilitado */
.btn-luchar:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Botón Luchar */
.center-action {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
}

.btn-luchar {
    position: relative;
    background: linear-gradient(135deg, var(--red-pokemon), #990000);
    border: 4px solid white;
    border-radius: 50%;
    width: 150px;
    height: 150px;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.6), inset 0 0 20px rgba(0, 0, 0, 0.5);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Decoración Poke-ball del botón */
.btn-luchar::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 6px;
    background: white;
    transform: translateY(-50%);
}

.btn-luchar::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 45px;
    height: 45px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.btn-text {
    position: absolute;
    z-index: 2;
    color: white;
    font-family: 'Press Start 2P', cursive;
    font-size: 1.1rem;
    text-shadow: 2px 2px 0 #000;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s;
}

.btn-luchar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 50px rgba(255, 0, 0, 0.8), inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.btn-luchar:active {
    transform: scale(0.95);
}


/* Panel de Resultados Modal */
.panel-resultados {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    /* Oscurece el fondo */
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.panel-resultados.mostrar {
    opacity: 1;
    pointer-events: all;
}

.glass-panel {
    background: rgba(30, 30, 40, 0.85);
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    padding: 3rem;
    max-width: 600px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 204, 0, 0.3);
    transform: translateY(50px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.panel-resultados.mostrar .glass-panel {
    transform: translateY(0);
}

#resultados-content h3 {
    color: var(--primary-color);
    font-family: 'Press Start 2P', cursive;
    font-size: 1rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

#resultados-content p {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.win-text {
    color: #4ade80;
    font-weight: bold;
}

.tie-text {
    color: #facc15;
    font-style: italic;
}

.winner {
    font-family: 'Press Start 2P', cursive;
    color: white;
    font-size: 1.2rem !important;
    margin-top: 2rem !important;
    text-shadow: 2px 2px 4px #000;
}

.btn-close {
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: var(--blue-pokemon);
    color: white;
    border: none;
    border-radius: 10px;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.btn-close:hover {
    background: #2a3c9a;
    transform: translateY(-3px);
}

/* Animaciones de Ataque al pulsar LUCHAR */
@keyframes attackRight {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(100px) scale(1.1);
        filter: brightness(1.5) drop-shadow(0 0 20px red);
    }

    100% {
        transform: translateX(0);
    }
}

@keyframes attackLeft {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(-100px) scale(1.1);
        filter: brightness(1.5) drop-shadow(0 0 20px red);
    }

    100% {
        transform: translateX(0);
    }
}

.attack-animation-1 {
    animation: attackRight 0.5s ease-in-out;
}

.attack-animation-2 {
    animation: attackLeft 0.5s ease-in-out;
}

/* Responsive */
@media (max-width: 900px) {
    .battlefield {
        flex-direction: column;
        gap: 2rem;
        padding: 0 5%;
        overflow-y: auto;
    }

    body {
        overflow: auto;
    }

    .stadium-container {
        height: auto;
        min-height: 100vh;
    }

    .btn-luchar {
        width: 100px;
        height: 100px;
        margin: 20px 0;
    }

    .btn-text {
        font-size: 0.8rem;
    }
}