/* ==========================================================
   CSS DEFINITIVO Y RESPONSIVE: MAPAS ANATÓMICOS (ESTILO COLUMNAS)
   ========================================================== */

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);
}


/* ==========================================================
   DISEÑO MÓVIL POR DEFECTO (MOBILE FIRST)
   ========================================================== */
#game-container-full {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
    padding: 10px;
    box-sizing: border-box;
    gap: 10px;
    justify-content: space-between;
    overflow: hidden;
}

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

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

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

#timer-wrapper .timer-container {
    width: 100%;
    height: 12px;
}

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

/* Viewport del mapa en móvil (Optimizado para maximizar el SVG) */
#svg-container, .game-viewport, #map-viewport {
    position: relative;
    width: 100%;
    flex-grow: 1;
    background: linear-gradient(145deg, #1e293b, #0f172a);
    border: 1px solid #334155;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
    padding: 4px; /* Reducido para ganar espacio en pantallas pequeñas */
    cursor: crosshair !important;
    pointer-events: auto !important;
}

#svg-container *, .game-viewport *, #map-viewport * {
    cursor: crosshair !important;
    pointer-events: auto !important;
}

#svg-container svg, 
.game-viewport svg, 
#map-viewport svg,
#svg-container img, 
#map-viewport img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain;
    pointer-events: auto !important;
    cursor: crosshair !important;
}

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

.panel-content-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

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

.ui-panel-right .value {
    font-size: 1.2rem;
    font-weight: bold;
    color: #38bdf8;
}

#objetivo, .target-name {
    font-size: 1rem;
    color: #facc15;
    font-weight: 800;
    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);
}

.btn-blue {
    background: linear-gradient(135deg, #475569, #334155) !important;
}


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

    #game-container-full {
        flex-direction: row;
        width: 100vw;
        height: 100vh;
        max-width: 1450px;
        max-height: 900px;
        padding: 40px; 
        box-sizing: border-box;
        align-items: center;
        justify-content: center;
        margin: auto;
        gap: 25px;
        position: relative;
    }

    /* Barra de tiempo vertical izquierda */
    #timer-wrapper {
        position: relative;
        left: auto;
        top: auto;
        transform: none;
        width: 65px;
        height: 85vh;
        max-height: 780px;
        flex-direction: column;
        padding: 15px 10px;
        background: linear-gradient(145deg, #1e293b, #0f172a);
        border-radius: 20px;
        border: 2px solid #334155;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
        z-index: 50;
        box-sizing: border-box;
        justify-content: space-between;
        align-items: center;
    }

    #timer-text {
        font-size: 0.85rem;
        writing-mode: horizontal-tb !important;
        transform: none !important;
        margin-bottom: 0;
        min-width: auto;
        text-align: center;
        font-weight: 700;
        color: #38bdf8;
    }

    #timer-wrapper .timer-container {
        width: 14px;
        height: 100%;
    }

    #timer-bar {
        left: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        background: linear-gradient(to top, #22c55e, #4ade80);
        border-radius: 0 0 5px 5px;
    }

    #svg-container, .game-viewport, #map-viewport {
        flex: 1;
        height: 85vh;
        max-height: 780px;
        border-radius: 20px;
        border: 2px solid #334155;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        cursor: crosshair !important;
        z-index: 5;
    }

    #svg-container svg, 
    .game-viewport svg, 
    #map-viewport svg,
    #svg-container img, 
    #map-viewport img {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        pointer-events: auto !important;
        cursor: crosshair !important;
    }

    /* Panel lateral derecho idéntico a columnas */
    .ui-panel-right {
        position: relative;
        width: 280px;
        height: 85vh;
        max-height: 780px;
        flex-direction: column;
        justify-content: space-between;
        align-items: center;
        text-align: center;
        padding: 30px 20px;
        border: 2px solid #334155;
        border-radius: 20px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
        flex-shrink: 0;
        z-index: 5;
        box-sizing: border-box;
    }

    .panel-content-wrapper {
        align-items: center;
        gap: 15px;
        width: 100%;
    }

    .ui-panel-right .label {
        font-size: 0.75rem;
        letter-spacing: 1.5px;
        font-weight: 700;
    }

    .ui-panel-right .value {
        font-size: 2.2rem;
        margin-bottom: 5px;
    }

    #objetivo, .target-name {
        font-size: 1.15rem;
        color: #facc15;
        font-weight: 800;
        letter-spacing: 0.5px;
        margin: 15px 0;
        line-height: 1.4;
    }

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

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


/* ==========================================================
   ESTILOS DE ALERTS Y PANTALLA FINAL MODERNA (ESTILO COLUMNAS)
   ========================================================== */
.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.88);
    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: 420px;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8);
}

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

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

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

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

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

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

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

.total-display-modern {
    background: rgba(251, 191, 36, 0.05);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 16px;
    padding: 12px;
    margin-bottom: 20px;
}

.total-title {
    display: block;
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.total-huge-number {
    font-size: 2.5rem;
    font-weight: 900;
    color: #fbbf24;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

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

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

.btn-final-green, .btn-final-red, .btn-final-share {
    width: 100%;
    padding: 12px 20px;
    border-radius: 14px;
    font-weight: bold;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.1s ease;
    color: white;
}

.btn-final-green {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-final-share {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.btn-final-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

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