/* jodete.css - Estilos In-Game: Mesa, Cartas y Acciones */

:root { --bg-table: #1e6b36; --card-w: 70px; --card-h: 100px; }

/* --- MESA DE JUEGO --- */
#game-table { 
    display: none; 
    width: 100%; 
    height: 100%; 
    position: relative; 
    background-color: #050505; 
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    transition: background-image 1s ease-in-out;
    box-shadow: inset 0 0 30px rgba(0,0,0,0.8); 
    box-sizing: border-box; 
}

#game-table::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.1); 
    z-index: 0;
    pointer-events: none;
}

#game-table::after { 
    content: "JODETE"; 
    position: absolute; 
    top: 50px;
    left: 200px;
    transform: translate(-50%, -50%); 
    font-size: 80px; 
    color: rgba(255, 255, 255, 0.15); 
    font-weight: bold; 
    letter-spacing: 10px;
    pointer-events: none; 
    z-index: 1; 
}
@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}
/* --- ZONAS DE JUGADORES --- */
.player-zone { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: all 0.5s; z-index: 10; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.zone-bottom { bottom: 20px; left: 50%; transform: translateX(-50%); width: 65%; height: 160px; }
.zone-top { top: 20px; left: 50%; transform: translateX(-50%); width: 60%; height: 120px; flex-direction: column-reverse; }
.zone-left { left: 20px; top: 50%; transform: translateY(-50%) rotate(90deg); width: 400px; height: 120px; flex-direction: column-reverse; }
.zone-right { right: 20px; top: 50%; transform: translateY(-50%) rotate(-90deg); width: 400px; height: 120px; flex-direction: column-reverse; }

.p-name { font-size: 16px; color: #aaa; font-weight: bold; text-shadow: 1px 1px 2px black; margin: 5px; background: rgba(0,0,0,0.5); padding: 2px 8px; border-radius: 4px; }
.active-turn .p-name { color: #f1c40f; text-shadow: 0 0 10px #f1c40f; border: 1px solid #f1c40f; }
.hand-container { display: flex; /* justify-content: center; */ align-items: center; perspective: 1000px; min-width: 100px; min-height: 110px; }
.center-area { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; gap: 35px; align-items: center; z-index: 5; }

/* --- CARTAS --- */
.card { width: var(--card-w); height: var(--card-h); background: white; border-radius: 6px; box-shadow: -2px 2px 5px rgba(0,0,0,0.5); display: flex; flex-direction: column; justify-content: space-between; padding: 2px; box-sizing: border-box; position: relative; transition: transform 0.2s, margin 0.2s; cursor: pointer; margin-left: -40px; border: 1px solid #999; }
.hand-container .card:first-child { margin-left: 0; }
.card:hover { transform: translateY(-20px) scale(1.1); z-index: 100; margin-right: 10px; box-shadow: 0 0 15px rgba(255,255,255,0.5); }

#zone-0 .card, #discard-pile .card, #deck-pile { width: 95px; height: 140px; border-radius: 8px; margin-left: -50px; box-shadow: -3px 3px 8px rgba(0,0,0,0.6); }
#zone-0 .card .card-top, #zone-0 .card .card-bottom, #discard-pile .card .card-top, #discard-pile .card .card-bottom { font-size: 20px; padding: 3px; }
#zone-0 .card .card-center, #discard-pile .card .card-center { font-size: 50px; }
#zone-0 .card .card-center div, #discard-pile .card .card-center div { font-size: 0.7em !important; }
#zone-0 .card:hover { transform: translateY(-30px) scale(1.1); margin-right: 20px; z-index: 200; }
#zone-0 .card:first-child { margin-left: 0; }
#discard-pile .card { margin: 0; transform: rotate(5deg); cursor: default; }
#discard-pile{scale: 1.1;}
#deck-pile { 
    margin: 0 !important; 
    width: 95px; 
    height: 140px; 
    font-size: 18px; 
    border-width: 3px; 
    background: repeating-linear-gradient(45deg, #222, #222 10px, #111 10px, #111 20px); 
    border-radius: 6px; 
    border: 2px solid #156625;
    box-shadow: 0 0 20px rgb(47 151 37 / 50%); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    cursor: pointer; 
    color: #ddd; 
    font-weight: bold; 
    text-align: center; 
    scale: 1.1;
}

/* Clases de botón mazo */
.btn-blue { background-color: #3498db !important; border-color: #2980b9 !important; color: white; }
.btn-blue:hover { background-color: #3fb2ff !important; box-shadow: 0 0 10px #3498db; }
#deck-pile:active { transform: scale(0.95); }
#deck-pile:hover {border: 2px solid #1e8b33; box-shadow: 0 0 20px rgb(74 226 60 / 50%);}

.card.back { background: repeating-linear-gradient(45deg, #222, #222 10px, #111 10px, #111 20px); border: 2px solid #8a046f; box-shadow: 0 0 10px #49175e; cursor: default; display: flex; justify-content: center; align-items: center; }
.card.back::after { content: "J"; font-size: 40px; color: #333; font-weight: 900; }
.zone-top .card:hover, .zone-left .card:hover, .zone-right .card:hover { transform: none; margin: 0; margin-left: -40px; }
.card-top, .card-bottom { font-size: 14px; font-weight: 900; line-height: 1; padding: 2px; }
.card-bottom { transform: rotate(180deg); }
.card-center { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; font-size: 30px; line-height: 1; }

/* Palos y Joker */
.oro { color: #f1c40f; text-shadow: 1px 1px 0 #b7950b; }
.copa { color: #e74c3c; text-shadow: 1px 1px 0 #922b21; }
.espada { color: #3498db; text-shadow: 1px 1px 0 #21618c; }
.basto { color: #2ecc71; text-shadow: 1px 1px 0 #1e8449; }
.joker { 
    background: white !important; 
    border: 1px solid #8e44ad !important; /* Borde violeta para distinguirla */
    color: #000; /* Color base */
}

/* 2. Damos color y estilo a la J de las esquinas */
.joker .card-top, 
.joker .card-bottom { 
    color: #8e44ad; /* Color de la letra J (Violeta Cyberpunk) */
    font-size: 18px; 
    font-weight: 900;
}

/* 3. Estilo para tu logo en el centro */
.joker-logo {
    width: 80%;       /* Ajusta el tamaño de la imagen */
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); /* Sombra suave al logo */
}
@keyframes pulse-bar {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}
/* --- UI IN-GAME --- */
#info-box { font-family: 'Inter', sans-serif !important;position: absolute; top: 10px; right: 10px; text-align: right; background: rgba(0,0,0,0.4); padding: 10px; border-radius: 8px; border: 1px solid #444; font-size: 26px; z-index: 20; }
.suit-indicator { font-size: 34px; text-align: center;}
.suit-indicator.any { font-size: 14px; font-weight: bold; color: cyan; text-transform: uppercase; letter-spacing: 1px; }
.loader-bar { width: 300px; height: 10px; background: #333; border-radius: 5px; overflow: hidden; margin-top: 20px;}
.loader-fill { height: 100%; width: 0%; background: #3498db; transition: width 0.1s; }

/* --- NOTIFICACIONES Y ANIMACIONES --- */
.float-msg { 
    position: absolute; 
    background: rgba(0,0,0,0.9); 
    color: #ffeb3b; 
    padding: 8px 15px; 
    border-radius: 8px; 
    border: 2px solid #ffeb3b; 
    font-size: 16px; 
    font-weight: bold; 
    z-index: 6000; 
    animation: popUp 3s forwards; 
    pointer-events: none; 
    box-shadow: 0 0 15px black; 
    max-width: 150px;       
    white-space: normal;    
    text-align: center;     
    line-height: 1.2;
    
    /* --- NUEVO: Para que se mueva suavemente si lo empujamos --- */
    transition: top 0.3s ease-out; 
}

.big-message { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #ff3333; font-size: 50px; font-weight: 900; text-shadow: 4px 4px 0 black; white-space: nowrap; z-index: 5000; animation: bigPop 2.5s forwards; pointer-events: none; }
@keyframes popUp { 0% { opacity: 0; transform: translateY(10px) scale(0.8); } 10% { opacity: 1; transform: translateY(0) scale(1.1); } 80% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-40px); } }
@keyframes bigPop { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; } 80% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.5); opacity: 0; } }

.shake { animation: shake 0.4s; border-color: red !important; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.flying-card { position: fixed; z-index: 9999; pointer-events: none; transition: all 0.5s ease-in-out; }
.discard-mode .card:not(.back) { border-color: #e74c3c !important; box-shadow: 0 0 10px #e74c3c; cursor: alias; }
.defend-mode .card:not(.back) { border-color: #f1c40f !important; box-shadow: 0 0 10px #f1c40f; animation: pulse 1s infinite; }
@keyframes pulse { 50% { border-color: red; } }

/* Animación Destrucción Carta */
@keyframes destruct-card {
    0% { transform: scale(1) rotate(0deg); box-shadow: 0 0 10px red, inset 0 0 20px red; border-color: red; filter: brightness(0.8) sepia(1) hue-rotate(-50deg) saturate(5); }
    20% { transform: scale(1.1) rotate(5deg); }
    40% { transform: scale(1.1) rotate(-5deg); opacity: 1; }
    100% { transform: scale(0) rotate(20deg); opacity: 0; }
}
.destructing { animation: destruct-card 0.5s forwards ease-in !important; pointer-events: none; z-index: 9999 !important; }

/* --- ACCIONES DE JUEGO (BOTONES) --- */
.action-container { position: fixed; bottom: 20px; right: 20px; display: flex; gap: 15px; z-index: 3000; }
.act-btn { width: 60px; height: 60px; border-radius: 50%; font-size: 30px; display: none; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 0 15px black; border: 3px solid white; transition: transform 0.2s; }
.act-btn:hover { transform: scale(1.1); }
.btn-ann { background: transparent; color: white;  transform: scale(1.8); margin-bottom: 20px; margin-right: 20px;}
.btn-chal { background: transparent; color: gray; transform: scale(0.5); }
.action-btn::before { content: attr(data-tooltip); position: absolute; bottom: 85px; right: 0; background: rgba(0,0,0,0.8); color: white; padding: 5px 10px; border-radius: 5px; font-size: 14px; white-space: nowrap; opacity: 0; pointer-events: none; }
.action-btn:hover::before { opacity: 1; }

#modal-suit { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.1); backdrop-filter: blur(2px); z-index: 4000; display: none; justify-content: center; align-items: center; }
.suit-opts { display: flex; gap: 20px; }
.s-btn { font-size: 50px; cursor: pointer; transition: transform 0.2s; text-shadow: 0 5px 10px black; }
.s-btn:hover { transform: scale(1.2); }

/* --- BANCO DE IMÁGENES RANDOM (USADO EN MESA) --- */
.bg-scene-1 { background-image: url('image/image_a4adee.jpg'); }
.bg-scene-2 { background-image: url('image/cyberpunk-neon-with-sword-4k-8k.jpg'); }
.bg-scene-3 { background-image: url('image/7jyjaq73v2251.jpg'); }
.bg-scene-4 { background-image: url('image/premium_photo-1733259750830-4cc0bd8d3979.jpg'); }
.bg-scene-5 { background-image: url('image/wp13244517.jpg'); }
.bg-scene-6 { background-image: url('image/joker-colorful-anarchy-8x-7680x4320.jpg'); }
.bg-scene-7 { background-image: url('image/cyberpunk.jpg'); }
.btn-icon { width: 50px; height: auto; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5)); }

/* --- MEDIA QUERY: AJUSTES MÓVILES PARA JUEGO --- */
@media screen and (max-width: 900px) {

    /* Zoom Out General */
    #game-table {
        transform: scale(0.95);
        transform-origin: center center;
        width: 100%;
        height: 100%;
    }

    /* Contenedores laterales fijos */
    .zone-left, .zone-right {
        position: fixed !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 40px !important;
        height: 250px !important; 
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        z-index: 50;
        background: transparent !important;
        pointer-events: none; 
    }

    .zone-left { left: 4px !important; }
    .zone-right { right: 4px !important; }

    /* Etiquetas de Nombre */
    .zone-left .p-name, .zone-right .p-name {
        position: absolute !important;
        top: 50% !important; 
        writing-mode: vertical-rl;
        text-orientation: mixed;
        transform: translateY(-50%) rotate(180deg); 
        white-space: nowrap;
        font-size: 12px;
        padding: 8px 3px;
        z-index: 200;
        background: rgba(0,0,0,0.9);
        border: 1px solid #555;
        border-radius: 4px;
        box-shadow: 0 0 5px black;
    }

    .zone-left .p-name { left: 28px; }
    .zone-right .p-name { right: 28px; }

    .active-turn .p-name {
        color: #f1c40f !important;
        border: 2px solid #f1c40f !important;
        box-shadow: 0 0 15px #f1c40f, 0 0 25px rgba(241, 196, 15, 0.5) !important;
        background: #111 !important;
    }

    /* Ajuste de cartas laterales */
    .zone-left .hand-container, .zone-right .hand-container {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        margin: 0 !important; 
        padding: 0 !important;
    }

    .zone-left .card, .zone-right .card {
        width: 50px !important;
        height: 70px !important;
        margin: 0 !important;
        margin-bottom: -60px !important; 
        box-shadow: -2px 0 5px rgba(0,0,0,0.5);
        transition: transform 0.3s;
    }

    .zone-left .card { transform: translateX(-65%); border-right: 2px solid #999; }
    .zone-right .card { transform: translateX(65%); border-left: 2px solid #999; }

    /* Rival Arriba */
    .zone-top { top: 5px !important; width: 100% !important; height: 80px !important; }
    .zone-top .card { transform: scale(0.6); margin-right: -45px; }

    /* Mesa Central */
    .center-area { z-index: 10; transform: translate(-50%, -50%) scale(0.85); }

    /* Tu Mano */
    .zone-bottom {
        left: 0 !important;
        transform: none !important; 
        width: 100% !important;
        bottom: 0 !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        height: 170px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-end !important;
        align-items: flex-start !important;
        pointer-events: none; 
        z-index: 100;
    }

    .zone-bottom .hand-container {
        display: flex !important;
        justify-content: flex-start !important;
        width: 100% !important;
        padding-left: 20px !important; 
        pointer-events: auto; 
        margin-bottom: 5px;
    }

    .zone-bottom .p-name { margin-left: 20px !important; pointer-events: auto; }
    #info-box { font-size: 16px; top: 1px; }
}

.my-turn-glow {
    border: 2px solid #f1c40f !important; /* Aseguramos borde sólido */
    background: rgba(0, 0, 0, 0.6) !important; /* Fondo casi negro para contraste */
    
    /* TRUCO DE INTENSIDAD: 3 capas de sombra */
    /* 1. Brillo cercano sólido (#f1c40f) */
    /* 2. Brillo lejano difuso (rgba...) */
    /* 3. Brillo interno (inset) */
    box-shadow: 
        0 0 20px #f1c40f, 
        0 0 50px rgba(241, 196, 15, 0.8), 
        inset 0 0 20px rgba(241, 196, 15, 0.5) !important;
        
    z-index: 100 !important; /* Asegura que brille por encima de las cartas cercanas */
    animation: neon-pulse 0.8s infinite alternate !important;
}

@keyframes neon-pulse {
    from {
        /* Estado "Brillante" */
        box-shadow: 
            0 0 20px #f1c40f, 
            0 0 50px rgba(241, 196, 15, 0.6), 
            inset 0 0 20px rgba(241, 196, 15, 0.4);
        transform: scale(1);
    }
    to {
        /* Estado "RADIOACTIVO" */
        box-shadow: 
            0 0 30px #f1c40f,          /* Más expansión cercana */
            0 0 70px rgba(241, 196, 15, 1), /* Expansión lejana al 100% visible */
            0 0 100px #f1c40f,         /* Halo gigante extra */
            inset 0 0 40px rgba(241, 196, 15, 0.7); /* Interior muy iluminado */
        transform: scale(1.05); /* Pequeño "latido" de tamaño */
        border-color: #fff !important; /* El borde destella blanco en el pico */
    }
}


.card, .card * {
    font-family: 'Inter', sans-serif !important;
    font-weight: 700 !important; /* Bold 700 forzado */
    letter-spacing: -0.5px;
}

@media screen and (max-width: 900px) {
    
    .hand-scroll-active {
        display: flex !important;
        flex-wrap: nowrap !important;
        
        /* SCROLL HORIZONTAL */
        overflow-x: auto !important;
        overflow-y: hidden !important; 
        
        /* ALINEACIÓN: */
        justify-content: flex-start !important; 
        width: 100vw !important;
        
        /* CORRECCIÓN ALTURA (Subimos las cartas) */
        padding-top: 15px !important;    /* Reducido para que no se vayan muy abajo */
        padding-bottom: 20px !important; /* Espacio extra abajo para sombras/scroll */
        align-items: flex-start !important;
        
        /* Espacio lateral para poder scrollear hasta el final */
        padding-left: 20px !important;
        padding-right: 80px !important; 
        
        -webkit-overflow-scrolling: touch; 
        touch-action: pan-x pan-y; 
    }

    .hand-scroll-active .card {
        flex-shrink: 0 !important;
        position: relative !important;
        transform: none !important;
        
        /* CORRECCIÓN ESPACIADO (Solo 7px visibles) */
        /* Ancho carta (70px) - 63px = 7px visibles */
        margin-left: -63px !important; 
        
        z-index: 1;
        box-shadow: -2px 0 5px rgba(0,0,0,0.6) !important; /* Sombra más fuerte para distinguir el borde */
    }

    /* La primera carta no lleva margen negativo */
    .hand-scroll-active .card:first-child {
        margin-left: 0 !important;
    }
    
    /* AL TOCAR UNA CARTA: */
    /* Sube y empuja a las de al lado para poder verla bien */
    .hand-scroll-active .card:active, 
    .hand-scroll-active .card:focus {
        transform: translateY(-15px) !important; /* Sube */
        z-index: 1000 !important;
        margin-right: 40px !important; /* Empuja mucho a la derecha para ver el contenido */
        transition: all 0.1s;
        border-color: #fff !important; /* Borde blanco para destacar selección */
    }
}