/**
 * Adventure Lab - Estilos de la aplicación web (100% Mobile-First)
 * Geocaching Experience - Diseño para smartphone sobre el terreno y catálogo
 */

:root {
    --lab-verde: #02874d;
    --lab-verde-oscuro: #01683b;
    --lab-verde-claro: #e8f5ee;
    --lab-verde-acento: #10b981;
    --lab-rojo: #ef4444;
    --lab-rojo-oscuro: #b91c1c;
    --lab-gris-bloqueado: #94a3b8;
    --lab-oscuro: #0f172a;
    --lab-gris-oscuro: #1e293b;
    --lab-gris-medio: #64748b;
    --lab-gris-claro: #f1f5f9;
    --lab-borde: #e2e8f0;
    --lab-fondo: #f8fafc;
    --lab-blanco: #ffffff;
    --lab-azul: #0284c7;
    --lab-radio: 12px;
    --lab-radio-sm: 8px;
    --lab-sombra: 0 4px 16px rgba(0, 0, 0, 0.06);
    --lab-sombra-lg: 0 10px 28px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--lab-fondo);
    color: var(--lab-gris-oscuro);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* =========================================================================
   CATÁLOGO PÚBLICO (/lab/)
   ========================================================================= */
.lab-catalog-header {
    background-color: var(--lab-verde);
    padding: 10px 18px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.lab-catalog-header-content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.lab-catalog-logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.lab-catalog-logo-link:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.lab-catalog-logo {
    height: 42px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    display: block;
}

.lab-catalog-brand-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.2px;
}

@media (max-width: 640px) {
    .lab-catalog-header {
        padding: 8px 14px;
    }
    .lab-catalog-logo {
        height: 34px;
        max-width: 170px;
    }
    .lab-catalog-brand-right {
        font-size: 0.95rem;
        gap: 6px;
    }
}

@media (max-width: 400px) {
    .lab-catalog-logo {
        height: 30px;
        max-width: 140px;
    }
    .lab-catalog-brand-right {
        font-size: 0.88rem;
        gap: 5px;
    }
}

.lab-catalog-main {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 14px 12px;
    flex: 1;
}

@media (max-width: 640px) {
    .lab-catalog-main {
        padding: 10px 8px;
    }
}

/* Tarjeta informativa en la cabecera del catálogo */
.lab-catalog-intro-card {
    background: #ffffff;
    border: 1px solid var(--lab-borde);
    border-left: 4px solid var(--lab-verde);
    border-radius: var(--lab-radio);
    padding: 12px 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.lab-intro-icon {
    color: var(--lab-verde);
    font-size: 1.25rem;
    margin-top: 1px;
    flex-shrink: 0;
}

.lab-intro-body p {
    font-size: 0.88rem;
    color: #334155;
    line-height: 1.5;
    margin: 0;
}

.lab-intro-body strong {
    color: var(--lab-oscuro);
}

/* Filtros y Buscador */
.lab-filters-container {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
}

.lab-search-wrap {
    flex: 1;
    min-width: 180px;
    position: relative;
}

.lab-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--lab-gris-medio);
    font-size: 0.9rem;
}

.lab-search-input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border-radius: 10px;
    border: 1px solid var(--lab-borde);
    background: #ffffff;
    font-size: 0.92rem;
    outline: none;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.lab-search-input:focus {
    border-color: var(--lab-verde);
    box-shadow: 0 0 0 3px rgba(2, 135, 77, 0.15);
}

.lab-theme-select {
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--lab-borde);
    background: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    color: #334155;
    outline: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

/* Cuadrícula de Aventuras (Compacta, ocupa todo el ancho) */
.lab-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    width: 100%;
}

@media (max-width: 580px) {
    .lab-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

@media (max-width: 340px) {
    .lab-grid {
        grid-template-columns: 1fr;
    }
}

.lab-card {
    background: var(--lab-blanco);
    border-radius: var(--lab-radio);
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--lab-borde);
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.lab-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--lab-sombra);
}

.lab-card-cover-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #e2e8f0;
    overflow: hidden;
    display: block;
}

.lab-card-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lab-card-badge-etapas {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.82);
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 16px;
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    gap: 4px;
}

.lab-card-body {
    padding: 10px 12px 12px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

@media (max-width: 580px) {
    .lab-card-body {
        padding: 8px 10px 10px 10px;
    }
}

.lab-card-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    line-height: 1.35;
    height: 2.7em; /* Reserva exactamente 2 líneas de texto en todas las tarjetas */
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
}

@media (max-width: 580px) {
    .lab-card-title {
        font-size: 0.88rem;
        line-height: 1.35;
        height: 2.7em;
        margin-bottom: 8px;
    }
}

.lab-card-title a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.lab-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.lab-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: var(--lab-gris-claro);
    color: var(--lab-gris-oscuro);
}

.lab-card-modo-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    margin-top: auto; /* Anclado justo encima del botón */
    margin-bottom: 10px;
    align-self: flex-start;
    white-space: nowrap;
}

@media (max-width: 580px) {
    .lab-card-modo-badge {
        font-size: 0.68rem;
        padding: 2px 6px;
        margin-bottom: 8px;
    }
}

.lab-card-modo-badge.modo-secuencial {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.lab-card-modo-badge.modo-no-secuencial {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.lab-card-modo-badge.modo-bifurcacion {
    background: #faf5ff;
    color: #7e22ce;
    border: 1px solid #e9d5ff;
}

.lab-btn-play {
    width: 100%;
    background-color: var(--lab-verde);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.88rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.lab-btn-play:hover {
    background-color: var(--lab-verde-oscuro);
}

.lab-catalog-footer {
    background-color: #836040;
    color: #ffffff;
    text-align: center;
    padding: 16px 20px;
    font-size: 0.92rem;
    letter-spacing: 0.2px;
    margin-top: auto;
    width: 100%;
}

.lab-catalog-footer .footer-brand-link,
.lab-catalog-footer a {
    color: #ffffff;
    font-weight: 700;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.lab-catalog-footer .footer-brand-link:hover,
.lab-catalog-footer a:hover {
    opacity: 0.85;
}

/* =========================================================================
   PANTALLA DE JUEGO (/lab/{slug})
   ========================================================================= */
.lab-header {
    background-color: var(--lab-verde);
    color: var(--lab-blanco);
    height: 54px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.lab-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.lab-header-back-btn {
    background: rgba(255, 255, 255, 0.18);
    color: var(--lab-blanco);
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.lab-header-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.3px;
    color: var(--lab-blanco);
    white-space: nowrap;
    z-index: 1;
    pointer-events: none;
}

.lab-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    z-index: 2;
}

.lab-header-journal-btn {
    background: rgba(255, 255, 255, 0.18);
    color: var(--lab-blanco);
    border: none;
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lab-header-journal-badge {
    background: #fbbf24;
    color: #0f172a;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Contenedor de Pantallas */
.lab-app-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    min-height: calc(100vh - 54px);
    display: flex;
    flex-direction: column;
}

.lab-screen {
    display: none;
    width: 100%;
    padding: 16px;
    flex: 1;
}

.lab-screen.active {
    display: flex;
    flex-direction: column;
}

/* =========================================================================
   PANTALLA 1: PORTADA
   ========================================================================= */
.lab-cover-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--lab-radio);
    overflow: hidden;
    background: #e2e8f0;
    box-shadow: var(--lab-sombra);
    margin-bottom: 16px;
    border: 1px solid var(--lab-borde);
}

.lab-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lab-adventure-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    line-height: 1.25;
    margin-bottom: 12px;
}

.lab-summary-box {
    background: #ffffff;
    border-radius: var(--lab-radio);
    border: 1px solid var(--lab-borde);
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lab-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.lab-summary-progress-text {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--lab-gris-oscuro);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lab-summary-journal-link {
    background: #f8fafc;
    border: 1px solid var(--lab-borde);
    color: var(--lab-verde);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.lab-progress-bar-track {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
}

.lab-progress-bar-fill {
    height: 100%;
    background: var(--lab-verde);
    width: 0%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.lab-tags-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.lab-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 6px;
    background: var(--lab-gris-claro);
    color: var(--lab-gris-oscuro);
}

.lab-pill-seq {
    background: #e0f2fe;
    color: #0369a1;
}

.lab-pill-free {
    background: #ffedd5;
    color: #9a3412;
}

.lab-pill-branch {
    background: #f3e8ff;
    color: #6b21a8;
}

.lab-desc-box {
    font-size: 0.92rem;
    color: #334155;
    line-height: 1.55;
    margin-bottom: 16px;
    white-space: pre-line;
}

.lab-overview-map {
    width: 100%;
    height: 280px;
    border-radius: var(--lab-radio);
    border: 1px solid var(--lab-borde);
    box-shadow: var(--lab-sombra);
    margin-bottom: 16px;
    overflow: hidden;
    position: relative;
    background: #e2e8f0;
}

.lab-btn-start {
    width: 100%;
    background-color: var(--lab-verde);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(2, 135, 77, 0.35);
}

.lab-btn-start.resume {
    background-color: #0369a1;
    box-shadow: 0 4px 14px rgba(3, 105, 161, 0.35);
}

/* =========================================================================
   PANTALLA 2: MAPA DE JUEGO (Totalmente adaptado a pantalla completa y responsive)
   ========================================================================= */
body.lab-screen-mapa-active {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
}

body.lab-screen-mapa-active .lab-app-container {
    height: calc(100vh - 54px) !important;
    height: calc(100dvh - 54px) !important;
    max-height: calc(100vh - 54px) !important;
    max-height: calc(100dvh - 54px) !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

#pantalla_mapa {
    padding: 0;
    margin: 0;
    display: none;
    width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    flex: 1 1 0px;
    overflow: hidden;
    position: relative;
    flex-direction: column;
}

#pantalla_mapa.active {
    display: flex;
}

.lab-gamemap-topbar {
    height: 46px;
    flex: 0 0 46px;
    padding: 0 12px;
    background: #ffffff;
    border-bottom: 1px solid var(--lab-borde);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    z-index: 100;
}

.lab-btn-nav-back {
    background: #ffffff;
    border: 1px solid var(--lab-borde);
    color: var(--lab-gris-oscuro);
    border-radius: var(--lab-radio-sm);
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.lab-gps-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
}

.lab-gps-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--lab-verde-acento);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: gpsPulseAnim 1.8s infinite;
}

.lab-gps-pulse-dot.error {
    background: var(--lab-rojo);
    animation: none;
}

@keyframes gpsPulseAnim {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.lab-gamemap-container {
    width: 100%;
    flex: 1 1 0px;
    min-height: 120px;
    position: relative;
    background: #e2e8f0;
    overflow: hidden;
}

#lab_live_map,
#lab_live_map.leaflet-container {
    width: 100% !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: #e2e8f0;
    z-index: 1;
}

.lab-btn-recenter-gps {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ffffff;
    border: 1px solid var(--lab-borde);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #2563eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 999;
    cursor: pointer;
}

/* Cajón inferior con la etapa seleccionada */
.lab-drawer-stage-card {
    flex: 0 0 auto;
    background: #ffffff;
    border-top: 2px solid var(--lab-borde);
    padding: 10px 14px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    z-index: 990;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lab-drawer-stage-info {
    display: flex;
    gap: 12px;
    align-items: center;
    cursor: pointer;
}

.lab-drawer-stage-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e2e8f0;
    border: 1px solid var(--lab-borde);
}

.lab-drawer-stage-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lab-drawer-stage-title {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    line-height: 1.25;
    margin-bottom: 2px;
}

.lab-drawer-stage-dist {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--lab-gris-medio);
    display: flex;
    align-items: center;
    gap: 4px;
}

.lab-drawer-stage-dist.in-range {
    color: var(--lab-verde);
}

.lab-btn-drawer-action {
    width: 100%;
    background: var(--lab-verde);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.lab-btn-drawer-action.disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

/* =========================================================================
   PANTALLAS 3, 4, 5, 6
   ========================================================================= */
.lab-screen-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}

.lab-screen-topbar-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    text-align: right;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lab-stage-detail-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--lab-radio);
    overflow: hidden;
    background: #e2e8f0;
    box-shadow: var(--lab-sombra);
    margin-bottom: 16px;
    border: 1px solid var(--lab-borde);
}

.lab-stage-detail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lab-stage-detail-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    line-height: 1.25;
    margin-bottom: 12px;
}

.lab-proximity-alert {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.88rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lab-proximity-alert.in-range {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.lab-proximity-alert.out-range {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.lab-proximity-alert.sin-limite {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.lab-stage-detail-desc {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.6;
    margin-bottom: 24px;
    white-space: pre-line;
}

.lab-btn-action-answer {
    width: 100%;
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 1.05rem;
    font-weight: 800;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.lab-btn-action-answer.active {
    background: var(--lab-verde);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(2, 135, 77, 0.35);
}

.lab-btn-action-answer.disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
}

.lab-btn-action-answer.completed {
    background: #10b981;
    color: #ffffff;
}

.lab-question-card {
    background: #ffffff;
    border-radius: var(--lab-radio);
    border: 1px solid var(--lab-borde);
    padding: 20px;
    box-shadow: var(--lab-sombra);
    margin-bottom: 20px;
}

.lab-question-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--lab-verde);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.lab-question-text {
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    line-height: 1.45;
}

.lab-answer-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 2px solid #cbd5e1;
    background: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    outline: none;
}

.lab-answer-input:focus {
    border-color: var(--lab-verde);
    box-shadow: 0 0 0 3px rgba(2, 135, 77, 0.2);
}

.lab-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.lab-opt-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}

.lab-opt-card.selected {
    border-color: var(--lab-verde);
    background: #e8f5ee;
    color: #065f46;
}

.lab-opt-letter {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-weight: 800;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lab-opt-card.selected .lab-opt-letter {
    background: var(--lab-verde);
    color: #ffffff;
}

.lab-btn-submit {
    width: 100%;
    background: var(--lab-verde);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 15px 20px;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(2, 135, 77, 0.35);
}

.lab-feedback-alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-top: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    display: none;
}

.lab-feedback-alert.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    display: block;
}

.lab-completion-card {
    background: #ffffff;
    border-radius: var(--lab-radio);
    border: 1px solid var(--lab-borde);
    padding: 20px;
    box-shadow: var(--lab-sombra);
    text-align: center;
    margin-bottom: 20px;
}

.lab-completion-badge {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: #dcfce7;
    color: #15803d;
    font-size: 1.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.lab-completion-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    margin-bottom: 14px;
}

.lab-completion-img-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    background: #e2e8f0;
    margin-bottom: 16px;
    border: 1px solid var(--lab-borde);
}

.lab-completion-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lab-completion-msg {
    font-size: 0.95rem;
    color: #334155;
    line-height: 1.6;
    text-align: left;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
    white-space: pre-line;
}

.lab-completion-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lab-btn-secondary {
    width: 100%;
    background: #ffffff;
    color: var(--lab-gris-oscuro);
    border: 1px solid var(--lab-borde);
    border-radius: 12px;
    padding: 13px 18px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Diario */
.lab-journal-entry {
    background: #ffffff;
    border: 1px solid var(--lab-borde);
    border-radius: var(--lab-radio);
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.lab-journal-cover-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #e2e8f0;
    overflow: hidden;
}

.lab-journal-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lab-journal-body {
    padding: 16px;
}

.lab-journal-tag {
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--lab-verde);
    text-transform: uppercase;
}

.lab-journal-date {
    font-size: 0.74rem;
    color: var(--lab-gris-medio);
}

.lab-journal-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    margin: 4px 0 8px 0;
}

.lab-journal-text {
    font-size: 0.92rem;
    color: #334155;
    line-height: 1.55;
    white-space: pre-line;
}

/* Modal Overlay */
.lab-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.lab-modal-card {
    background: #ffffff;
    border-radius: var(--lab-radio);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--lab-sombra-lg);
    overflow: hidden;
}

.lab-modal-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--lab-borde);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

/* =========================================================================
   MARCADORES PERSONALIZADOS LEAFLET (Pines con número + Ubicación de usuario)
   ========================================================================= */
.lab-custom-pin-wrap {
    background: transparent;
    border: none;
    cursor: pointer;
}

.lab-pin-container {
    position: relative;
    width: 34px;
    height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.15s ease;
}

.lab-pin-container:hover {
    transform: scale(1.1);
}

.lab-pin-container.selected {
    transform: scale(1.18);
    z-index: 1000 !important;
}

.lab-pin-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: #ffffff;
    font-weight: 800;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
    position: relative;
    z-index: 2;
    transition: box-shadow 0.15s ease;
}

.lab-pin-container.selected .lab-pin-circle {
    box-shadow: 0 0 0 3.5px #fbbf24, 0 4px 12px rgba(0, 0, 0, 0.35);
}

.lab-pin-circle.rojo {
    background-color: var(--lab-rojo);
    box-shadow: 0 3px 10px rgba(239, 68, 68, 0.4);
}

.lab-pin-circle.verde {
    background-color: var(--lab-verde-acento);
    box-shadow: 0 3px 10px rgba(16, 185, 129, 0.4);
}

.lab-pin-circle.gris {
    background-color: var(--lab-gris-bloqueado);
    box-shadow: 0 3px 8px rgba(148, 163, 184, 0.3);
    opacity: 0.82;
}

.lab-pin-arrow {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    margin-top: -3px;
    z-index: 1;
}

.lab-pin-arrow.rojo {
    border-top: 10px solid var(--lab-rojo);
}

.lab-pin-arrow.verde {
    border-top: 10px solid var(--lab-verde-acento);
}

.lab-pin-arrow.gris {
    border-top: 10px solid var(--lab-gris-bloqueado);
}

/* Icono animado de la ubicación del usuario en el mapa */
.lab-user-gps-wrap {
    position: relative;
    width: 32px;
    height: 32px;
}

.lab-user-pulse-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.28);
    animation: userGpsPulseAnim 2s infinite ease-out;
    pointer-events: none;
}

.lab-user-location-dot {
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #2563eb;
    border: 2.5px solid #ffffff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 11px;
    z-index: 2;
}

@keyframes userGpsPulseAnim {
    0% { transform: scale(0.6); opacity: 0.95; }
    70% { transform: scale(1.6); opacity: 0; }
    100% { transform: scale(0.6); opacity: 0.95; }
}

/* =========================================================================
   ADAPTACIÓN ESCRITORIO (>= 768px): CÓDIGO QR PARA JUGAR EN SMARTPHONE
   ========================================================================= */
.lab-desktop-qr-box {
    display: none;
    background: #f8fafc;
    border: 1px solid var(--lab-borde);
    border-radius: var(--lab-radio);
    padding: 24px 20px;
    text-align: center;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
}

.lab-desktop-qr-header {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    margin-bottom: 20px;
    background: #ffffff;
    border: 1px solid var(--lab-borde);
    padding: 12px 16px;
    border-radius: 10px;
}

.lab-desktop-qr-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #e8f5ee;
    color: var(--lab-verde);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.lab-desktop-qr-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--lab-oscuro);
    margin: 0 0 2px 0;
}

.lab-desktop-qr-subtitle {
    font-size: 0.82rem;
    color: var(--lab-gris-medio);
    margin: 0;
    line-height: 1.35;
}

.lab-desktop-qr-code-wrap {
    display: inline-block;
    padding: 14px;
    background: #ffffff;
    border-radius: 14px;
    border: 1px solid var(--lab-borde);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
    margin: 0 auto 16px auto;
}

.lab-desktop-qr-target {
    width: 170px;
    height: 170px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lab-desktop-qr-target svg,
.lab-desktop-qr-target img {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.lab-desktop-qr-instructions {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--lab-gris-oscuro);
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

@media (min-width: 768px) {
    /* En pantalla de ordenador: mostrar el recuadro QR */
    .lab-desktop-qr-box {
        display: block;
    }

    /* Ocultar mapa de resumen, botón comenzar, progreso y diario */
    #lab_overview_map {
        display: none !important;
    }

    #box_boton_comenzar {
        display: none !important;
    }

    .lab-summary-header {
        display: none !important;
    }

    .lab-progress-bar-track {
        display: none !important;
    }

    #header_journal_btn {
        display: none !important;
    }

    .lab-summary-box {
        gap: 0;
        padding: 12px 16px;
    }
}

/* =========================================================================
   VÍDEO RESPONSIVE DE ETAPA (16:9)
   ========================================================================= */
.lab-stage-video-wrap {
    margin: 14px 0 16px 0;
    width: 100%;
}

.lab-video-responsive {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* Relación 16:9 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #0f172a;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.lab-video-responsive iframe,
.lab-video-responsive video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 12px;
}



