:root {
    --bg-color: #0b1f14;
    --table-color: radial-gradient(circle at center, #1a4d33 0%, #0b1f14 100%);
    --card-width: 100px;
    --card-height: 155px;
    --gold: #f1c40f;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100vh;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-color);
    color: white;
    overflow: hidden;
}

.table {
    width: 100vw;
    height: 100vh;
    background: var(--table-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.8);
}

.card {
    width: var(--card-width);
    height: var(--card-height);
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    position: relative;
    user-select: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    border: 3px solid #eee;
    background-size: cover;
    background-position: center;
    background-color: #fff;
}

/* Dorso de la baraja española */
.card-deck, .card-facedown {
    background: linear-gradient(135deg, #b71234 25%, transparent 25%) -25px 0, 
                linear-gradient(225deg, #b71234 25%, transparent 25%) -25px 0, 
                linear-gradient(315deg, #b71234 25%, transparent 25%), 
                linear-gradient(45deg, #b71234 25%, transparent 25%);	
    background-size: 50px 50px;
    background-color: #8b0a24;
    border: 5px solid white;
}

/* Disposición del mazo a la derecha del centro */
.deck-area {
    position: absolute;
    top: 50%;
    right: 20%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.card-deck {
    z-index: 5; /* Mazo siempre arriba */
    position: relative;
    /* Efecto visual de Cartas Apiladas */
    box-shadow: 
        1px 1px 0 #fff, 
        2px 2px 0 #7f8c8d, 
        3px 3px 0 #fff, 
        4px 4px 0 #7f8c8d, 
        5px 5px 0 #fff, 
        6px 6px 0 #7f8c8d, 
        7px 7px 0 #fff, 
        8px 8px 0 #7f8c8d, 
        12px 12px 20px rgba(0,0,0,0.7) !important;
}

.card-muestra {
    z-index: 1; /* Muestra enterrada debajo del mazo */
    position: absolute;
    left: -55px;
    top: 15px;
    transform: rotate(-18deg); /* Rotación para que asome */
    box-shadow: -5px 5px 15px rgba(0,0,0,0.8);
}

/* Manos de jugadores */
.player-hand, .opponent-hand {
    display: flex;
    gap: 15px;
    padding: 30px;
}

.player-hand .card {
    cursor: pointer;
}

.player-hand .card:hover {
    transform: translateY(-20px) scale(1.05);
    box-shadow: 0 15px 30px rgba(0,0,0,0.6);
}

.pieza-glowing {
    border-color: var(--gold) !important;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.8) !important;
}

/* Panel de UI en Glassmorphism moderno */
.glass {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 250px;
}

.glass h2 {
    margin: 0 0 15px 0;
    color: var(--gold);
    font-size: 1.4rem;
    letter-spacing: 1px;
}

.glass p {
    margin: 8px 0;
    font-size: 1rem;
    color: #ddd;
}

.highlight {
    color: #fff;
    font-weight: bold;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #1abc9c, #16a085);
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    margin-top: 20px;
    transition: transform 0.2s, filter 0.2s;
    font-family: inherit;
    text-transform: uppercase;
}

.btn-primary:hover {
    transform: translateY(-3px);
    filter: brightness(1.2);
}

.btn-action {
    background: linear-gradient(135deg, #e67e22, #d35400);
    border: none;
    padding: 10px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s, filter 0.2s;
    font-size: 1rem;
}
.btn-action:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}
.btn-truco {
    background: linear-gradient(135deg, #8e44ad, #9b59b6);
}

/* Respaldo CSS si el SVG no carga limpio */
.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}
.card-value-top {
    position: absolute;
    top: 5px;
    left: 8px;
    font-size: 1.2rem;
    line-height: 1;
    color: #000;
}
.card-value-bot {
    position: absolute;
    bottom: 5px;
    right: 8px;
    font-size: 1.2rem;
    transform: rotate(180deg);
    line-height: 1;
    color: #000;
}
.card-suit {
    font-size: 3.5rem;
}

/* UI Registro de Bazas */
.baza-slot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
    background: transparent;
    transition: all 0.3s;
}
.baza-p { background: #1abc9c; border-color: #16a085; } /* Jugador gana */
.baza-o { background: #e74c3c; border-color: #c0392b; } /* Oponente gana */
.baza-e { background: #f1c40f; border-color: #f39c12; } /* Empate parada */

/* --- RESPONSIVIDAD PARA CELULARES --- */
@media (max-width: 768px) {
    :root {
        --card-width: 65px;
        --card-height: 100px;
    }
    
    .table {
        justify-content: center;
        padding-top: 40px;
        padding-bottom: 70px;
    }

    .player-hand, .opponent-hand {
        padding: 10px;
        gap: 5px;
        margin: 0;
        z-index: 5;
    }

    .deck-area {
        right: 0px; 
        transform: translateY(-50%) scale(0.7); 
    }

    .play-area {
        gap: 15px !important;
        transform: scale(0.85);
        margin: 15px 0;
    }
    
    .card-value-top, .card-value-bot {
        font-size: 0.9rem;
    }
    
    .card-suit {
        font-size: 2.2rem;
    }

    /* Paneles Glass Punteo */
    .glass {
        padding: 10px;
        min-width: unset;
    }
    
    /* El marcador global superior Centro */
    div[style*="top: 20px"] {
        top: 2px !important;
        padding: 5px 15px !important;
        gap: 15px !important;
        transform: translateX(-50%) scale(0.75) !important;
        z-index: 10;
    }

    /* Panel Tus Voces: Ocupa todo el pie de pantalla y fuerza Z-INDEX gigante y flex row */
    #actions-panel {
        top: auto !important;
        bottom: 0px !important;
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
        width: 100vw !important;
        max-width: none !important;
        box-sizing: border-box;
        border-radius: 0 !important;
        background: rgba(255,255,255,0.08) !important;
        z-index: 1000 !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: center !important;
        padding: 10px !important;
        position: fixed !important;
    }
    
    #actions-panel > p {
        display: none !important; /* Ocultar el título '🗣️ Tus Voces:' */
    }
    
    #actions-panel > div {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        gap: 8px !important;
        width: 100%;
    }

    .btn-action {
        padding: 8px 10px !important;
        font-size: 0.85rem !important;
        margin: 0 !important;
        flex: 1; /* Todos ocupan igual ancho */
    }

    /* Panel Puntos y Manos Inferior */
    .ui-panel:not(#actions-panel) {
        top: auto;
        bottom: 25% !important; /* Arriba del jugador */
        left: -5px;
        padding: 8px;
        transform: scale(0.65);
        transform-origin: left center;
        z-index: 2;
        pointer-events: none;
    }
    
    .ui-panel:not(#actions-panel) h2 {
        display: none;
    }
}
