/* ==========================================================
   CSS DEFINITIVO Y PULIDO: JUEGO DE OSTEOLOGÍA
   ========================================================== */

body.fullscreen-mode {
    margin: 0;
    padding: 0;
    background-color: #020617;
    color: #f8fafc;
    font-family: 'Segoe UI', system-ui, sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    box-sizing: border-box;
}

/* --- PANTALLA DE INICIO / OVERLAY --- */
#menu-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999 !important;
    padding: 20px;
    box-sizing: border-box;
}

#menu-overlay > div {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    padding: 35px;
    border-radius: 24px;
    border: 1px solid #334155;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

#menu-overlay h2 {
    color: #fff;
    margin-top: 0;
    font-size: 1.6rem;
}

#menu-overlay p {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 25px;
}

.btn-game-start {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 14px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
    transition: transform 0.1s ease;
}

.btn-game-start:active {
    transform: scale(0.98);
}


/* --- CONTENEDOR PRINCIPAL MÓVIL --- */
#game-container-full {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
    padding: 6px 10px;
    box-sizing: border-box;
    gap: 6px;
    justify-content: space-between;
    overflow: hidden;
}

/* Temporizador móvil (Horizontal) */
#timer-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid #334155;
    box-sizing: border-box;
    flex-shrink: 0;
}

#timer-text {
    font-weight: 700;
    font-size: 0.9rem;
    color: #38bdf8;
    min-width: 38px;
}

.timer-container {
    flex-grow: 1;
    height: 12px;
    background: #0f172a;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    border: 1px solid #475569;
}

#timer-bar {
    width: 100% !important;
    height: 100% !important;
    background: linear-gradient(to right, #22c55e, #4ade80);
    position: absolute;
    left: 0;
    top: 0;
    border-radius: 5px;
    transform-origin: left center;
    transition: transform 0.3s linear, background-color 0.3s ease;
}

/* Tablero móvil */
#asociacion-viewport {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    flex-grow: 1;
    overflow: hidden;
}

.columna-juego {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    overflow-y: auto;
    box-sizing: border-box;
}

.columna-juego h4 {
    color: #f8fafc;
    text-align: center;
    margin: 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.4);
    padding-bottom: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tarjeta-item {
    background: #0f172a;
    color: #f8fafc;
    border: 1px solid #334155;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    text-align: center;
    transition: background 0.15s ease, transform 0.1s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

.tarjeta-item:active {
    transform: scale(0.98);
}

.tarjeta-item.seleccionado {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    color: #0f172a !important;
    font-weight: 700;
    border-color: #fde68a;
}

.tarjeta-item.acertado {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    color: white !important;
    opacity: 0.45;
    pointer-events: none;
    border-color: #4ade80;
}

/* Panel inferior móvil */
.ui-panel-right {
    position: relative;
    width: 100%;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    box-sizing: border-box;
    flex-shrink: 0;
}

.panel-content-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.ui-panel-right .label {
    font-size: 0.65rem;
    color: #94a3b8;
    letter-spacing: 0.5px;
}

.ui-panel-right .value {
    font-size: 1.3rem;
    font-weight: bold;
    color: #38bdf8; /* Azul clásico de puntuación */
}

.target-name {
    font-size: 0.85rem;
    color: #facc15; /* Amarillo clásico para el hueso objetivo (ej. FRONTAL) */
    font-weight: 700;
    text-transform: uppercase;
}

.label-vidas, .progress-value {
    font-size: 0.8rem;
    color: #cbd5e1;
}

.panel-buttons-row {
    display: flex;
    gap: 8px;
}

.btn-reset {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transition: transform 0.1s ease;
}

.btn-reset:active {
    transform: scale(0.96);
}

.btn-blue {
    background: linear-gradient(135deg, #475569, #334155) !important; /* Gris clásico para salir */
    box-shadow: 0 4px 12px rgba(71, 85, 105, 0.3) !important;
}


/* ==========================================================
   ESTILOS PARA PC (MIN-WIDTH: 900px) - PANEL DERECHO ESTILO CLÁSICO
   ========================================================== */
@media (min-width: 900px) {
    body.fullscreen-mode {
        overflow: hidden;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    #menu-overlay {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(2, 6, 23, 0.9);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 9999 !important;
    }

    #game-container-full {
        flex-direction: row;
        width: 100vw;
        height: 100vh;
        max-width: 1350px;
        max-height: 850px;
        position: relative;
        padding: 0 220px 0 120px;
        box-sizing: border-box;
        align-items: center;
        justify-content: center;
        margin: auto;
    }

    #timer-wrapper {
        position: absolute;
        left: 40px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        height: 60vh;
        max-height: 450px;
        flex-direction: column;
        padding: 14px 12px;
        background: linear-gradient(145deg, #1e293b, #0f172a);
        border-radius: 18px;
        border: 1px solid #334155;
    }

    .timer-container {
        width: 18px;
        height: 100%;
        background: #0f172a;
        border-radius: 10px;
        border: 1px solid #475569;
    }

    #timer-bar {
        width: 100% !important;
        height: 100% !important;
        background: linear-gradient(to top, #22c55e, #4ade80);
        bottom: 0;
        top: auto;
        left: 0;
        border-radius: 0 0 8px 8px;
        transform-origin: center bottom;
        transition: transform 0.3s linear, background-color 0.3s ease;
    }

    #asociacion-viewport {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        width: 100%;
        max-width: 900px;
        height: 70vh;
        max-height: 600px;
    }

    .columna-juego {
        max-height: 100%;
        padding: 24px;
        gap: 12px;
    }

    .tarjeta-item {
        padding: 16px 20px;
        font-size: 0.95rem;
    }

    .tarjeta-item:hover {
        background: #334155;
        border-color: #3b82f6;
        transform: translateY(-2px);
        box-shadow: 0 6px 12px rgba(59, 130, 246, 0.25);
    }

    /* Panel derecho flotante adaptado al tamaño/colores clásicos con toque moderno */
    .ui-panel-right {
        position: absolute;
        right: 40px;
        top: 50%;
        transform: translateY(-50%);
        width: 210px;
        height: 60vh;
        max-height: 480px;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        text-align: center;
        padding: 26px 18px;
        box-sizing: border-box;
        background: linear-gradient(145deg, #1e293b, #0f172a);
        border: 2px solid #334155;
        border-radius: 20px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    }

    .panel-content-wrapper {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .ui-panel-right .label {
        font-size: 0.75rem;
        letter-spacing: 1.5px;
        color: #94a3b8;
        font-weight: 700;
        margin-bottom: 2px;
    }

    .ui-panel-right .value {
        font-size: 2.5rem;
        font-weight: 800;
        color: #38bdf8; /* Azul brillante clásico */
        margin: 0 0 10px 0;
    }

    .target-name {
        font-size: 1.15rem;
        color: #facc15; /* Amarillo clásico destacado para el hueso */
        font-weight: 800;
        text-transform: uppercase;
        margin: 6px 0;
        letter-spacing: 0.5px;
    }

    .label-vidas, .progress-value {
        font-size: 0.9rem;
        color: #cbd5e1;
        font-weight: 600;
    }

    .panel-buttons-row {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .btn-reset {
        width: 100%;
        padding: 12px 0;
        font-size: 0.9rem;
        border-radius: 10px;
        font-weight: 700;
        text-transform: uppercase;
    }

    .btn-blue {
        background: linear-gradient(135deg, #475569, #334155) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }
}


/* ==========================================================
   ALERTAS Y MODAL FINAL / BOTÓN COMPARTIR
   ========================================================== */
.timer-danger {
    background: linear-gradient(to top, #ef4444, #f87171) !important;
    background-image: linear-gradient(to right, #ef4444, #f87171) !important;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.7);
}

@keyframes parpadeoAlerta {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.blink-active {
    animation: parpadeoAlerta 0.6s infinite;
    color: #ef4444 !important;
}

.modal-final-custom {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

.final-screen-modern {
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 24px;
    padding: 30px;
    width: 100%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.final-icon-trophy {
    font-size: 3rem;
    margin-bottom: 10px;
}

.final-screen-modern h1 {
    color: #f8fafc;
    font-size: 1.5rem;
    margin: 0 0 5px 0;
}

.final-subtitle {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.results-grid-modern {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.res-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.res-label {
    font-size: 0.65rem;
    color: #94a3b8;
    font-weight: 700;
}

.res-number {
    font-size: 1.1rem;
    font-weight: bold;
    color: #38bdf8;
}

.total-display-modern {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 25px;
}

.total-title {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 5px;
}

.total-huge-number {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fbbf24;
}

.pts-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fbbf24;
}

.final-buttons-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-final-green, .btn-final-red, .btn-final-share {
    padding: 12px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease;
}

.btn-final-green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.btn-final-share {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
}

.btn-final-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-final-green:active, .btn-final-share:active, .btn-final-red:active {
    transform: scale(0.98);
}