/* Estilos de Tablero" - Modo Blanco Minimalista con Burbujas Circulares */

body.tv-mode {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
    background-color: #f8fafc;
    user-select: none;
}

/* ==========================================
   HEADER SUPERIOR
   ========================================== */
.tv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    margin-bottom: 14px;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.conalep-badge {
    background: var(--conalep-green);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: 1.5px;
    padding: 6px 16px;
    border-radius: 10px;
}

.brand-title h1 {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.1;
}

.brand-title p {
    font-size: 0.9rem;
    color: var(--conalep-green);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fee2e2;
    border: 1px solid #f87171;
    color: #b91c1c;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.8px;
}

.live-dot {
    width: 7px;
    height: 7px;
    background: #dc2626;
    border-radius: 50%;
}

/* RELOJ DIGITAL Y CLIMA */
.clock-section {
    text-align: right;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* WIDGET DE CLIMA EN VIVO */
.weather-widget {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid var(--border-medium);
    padding: 6px 14px;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    text-align: left;
    transition: all 0.2s ease;
}

.weather-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.weather-temp {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.weather-city {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    margin-top: 1px;
}

.clock-display {
    font-family: var(--font-heading);
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: 1px;
    line-height: 1;
}

.clock-colon {
    color: var(--conalep-green);
}

.date-display {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: capitalize;
    margin-top: 2px;
}

/* ==========================================
   BARRA DE MÉTRICAS / RESUMEN
   ========================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 14px;
}

.metric-card {
    padding: 10px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    box-shadow: var(--shadow-soft);
}

.metric-info h3 {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-info .metric-num {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    margin-top: 2px;
}

.metric-icon-box {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.metric-card.total .metric-icon-box { background: var(--conalep-green-bg); color: var(--conalep-green); }
.metric-card.alta .metric-icon-box { background: #fee2e2; color: #dc2626; }
.metric-card.media .metric-icon-box { background: #ffedd5; color: #ea580c; }
.metric-card.baja .metric-icon-box { background: #ecfdf5; color: #007a53; }
.metric-card.hoy .metric-icon-box { background: #fef9c3; color: #ca8a04; }

/* ==========================================
   ÁREA PRINCIPAL DE BURBUJAS (CANVAS BLANCO)
   ========================================== */
.main-arena-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    box-sizing: border-box;
    min-height: 0;
}

.arena-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.arena-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.view-toggle-btns {
    display: flex;
    gap: 8px;
}

.view-btn {
    background: #f8fafc;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.15s ease;
}

.view-btn.active, .view-btn:hover {
    background: var(--conalep-green);
    border-color: var(--conalep-green);
    color: #ffffff;
}

/* BARRA DE PAGINACIÓN Y SWITCH AUTO-ROTAR */
.tv-pagination-container {
    display: none;
    align-items: center;
    gap: 10px;
    background: #f1f5f9;
    border: 1px solid var(--border-medium);
    padding: 4px 12px;
    border-radius: 10px;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.tv-page-btn {
    background: #ffffff;
    border: 1px solid var(--border-medium);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    font-weight: 800;
    transition: all 0.15s ease;
}

.tv-page-btn:hover {
    background: var(--conalep-green);
    color: #ffffff;
    border-color: var(--conalep-green);
}

.tv-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-medium);
    background: #ffffff;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.tv-switch-btn.active {
    background: #e6f5ef;
    border-color: var(--conalep-green);
    color: var(--conalep-green);
}

.tv-switch-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    transition: all 0.2s ease;
}

.tv-switch-btn.active .tv-switch-dot {
    background: var(--conalep-green);
    box-shadow: 0 0 6px var(--conalep-green);
}

/* CONTENEDOR DE BURBUJAS */
.bubbles-canvas {
    flex: 1;
    position: relative;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
}

/* ==========================================
   ANIMACIONES FLUIDAS DE ENTRADA Y SALIDA
   ========================================== */
@keyframes bubblePopIn {
    0% {
        opacity: 0;
        transform: scale(0.25) translateY(24px);
    }
    70% {
        transform: scale(1.05) translateY(-3px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes bubblePopOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    100% {
        opacity: 0;
        transform: scale(0.2) translateY(-18px);
    }
}

@keyframes newActivityPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 122, 83, 0.5), var(--shadow-bubble);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(0, 122, 83, 0), var(--shadow-bubble);
    }
}

/* ==========================================
   BURBUJA CIRCULAR (REDONDA Y PERFECTA 1:1)
   ========================================== */
.activity-bubble {
    position: absolute;
    border-radius: 50% !important;
    aspect-ratio: 1 / 1 !important;
    overflow: hidden !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px 12px;
    box-sizing: border-box !important;
    box-shadow: var(--shadow-bubble);
    animation: bubblePopIn 0.45s cubic-bezier(0.34, 1.4, 0.64, 1) backwards;
    transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
    flex-shrink: 0 !important;
}

.activity-bubble.is-exiting {
    animation: bubblePopOut 0.28s cubic-bezier(0.4, 0, 0.2, 1) forwards !important;
}

.activity-bubble.is-new-event {
    animation: bubblePopIn 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) backwards, newActivityPulse 2.2s ease-in-out infinite;
}

.activity-bubble:hover {
    transform: scale(1.06);
    z-index: 100 !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.activity-bubble:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* CÍRCULO ROJO (ALTA IMPORTANCIA) */
.activity-bubble.ALTA {
    background: radial-gradient(circle at center, #ffffff 40%, #fee2e2 100%);
    border: 4px solid #dc2626;
}

.activity-bubble.ALTA .bubble-title {
    color: #991b1b;
}

.activity-bubble.ALTA .bubble-area-pill {
    background: #dc2626;
    color: #ffffff;
}

.activity-bubble.ALTA .bubble-date-pill {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #f87171;
}

/* CÍRCULO NARANJA (MEDIA IMPORTANCIA) */
.activity-bubble.MEDIA {
    background: radial-gradient(circle at center, #ffffff 40%, #ffedd5 100%);
    border: 4px solid #ea580c;
}

.activity-bubble.MEDIA .bubble-title {
    color: #9a3412;
}

.activity-bubble.MEDIA .bubble-area-pill {
    background: #ea580c;
    color: #ffffff;
}

.activity-bubble.MEDIA .bubble-date-pill {
    background: #ffedd5;
    color: #9a3412;
    border: 1px solid #fb923c;
}

/* CÍRCULO VERDE (BAJA IMPORTANCIA) */
.activity-bubble.BAJA {
    background: radial-gradient(circle at center, #ffffff 40%, #ecfdf5 100%);
    border: 3.5px solid #007A53;
}

.activity-bubble.BAJA .bubble-title {
    color: #00563b;
}

.activity-bubble.BAJA .bubble-area-pill {
    background: #007A53;
    color: #ffffff;
}

.activity-bubble.BAJA .bubble-date-pill {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

/* ELEMENTOS DENTRO DEL CÍRCULO (CON RESTRICCIONES ESTRICTAS PARA NO DESBORDAR EL 1:1) */
.bubble-area-pill {
    font-size: clamp(0.52rem, 0.70vw, 0.68rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 2px;
    max-width: 80% !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.bubble-title {
    font-family: var(--font-heading);
    font-weight: 800;
    line-height: 1.15;
    margin: 2px 0 4px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 0 4px;
    font-size: clamp(0.78rem, 1.4vw, 1.15rem);
    letter-spacing: -0.2px;
    max-width: 84% !important;
    min-width: 0 !important;
    width: 100% !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    box-sizing: border-box !important;
}

.bubble-date-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: clamp(0.56rem, 0.72vw, 0.70rem);
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap !important;
    max-width: 80% !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.bubble-date-pill.no-date {
    background: #f1f5f9 !important;
    color: #475569 !important;
    border: 1px dashed #cbd5e1 !important;
}

/* ==========================================
   OPTIMIZACIÓN ESPECIAL PARA PANTALLAS 720p
   (1280x720 / 1366x768 / TVs HD)
   ========================================== */
@media (max-height: 780px), (max-width: 1366px) {
    body.tv-mode {
        padding: 8px 12px;
    }

    .tv-header {
        padding: 6px 14px;
        margin-bottom: 8px;
        border-radius: 10px;
    }

    .conalep-logo-header {
        height: 32px;
    }

    .brand-title h1 {
        font-size: 1.15rem;
    }

    .brand-title p {
        font-size: 0.75rem;
    }

    .clock-display {
        font-size: 1.6rem;
    }

    .date-display {
        font-size: 0.78rem;
    }

    .metrics-grid {
        gap: 8px;
        margin-bottom: 8px;
    }

    .metric-card {
        padding: 6px 10px;
        border-radius: 8px;
    }

    .metric-info h3 {
        font-size: 0.68rem;
    }

    .metric-info .metric-num {
        font-size: 1.3rem;
    }

    .metric-icon-box {
        width: 32px;
        height: 32px;
    }

    .metric-icon-box svg {
        width: 16px;
        height: 16px;
    }

    .main-arena-container {
        padding: 10px 14px;
        border-radius: 12px;
    }

    .arena-controls {
        margin-bottom: 6px;
    }

    .arena-title {
        font-size: 0.95rem;
    }

    .view-btn {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .tv-footer {
        padding: 6px 12px;
        margin-top: 6px;
        font-size: 0.75rem;
    }

    .activity-bubble {
        padding: 10px;
    }

    /* Adaptabilidad de logros en 720p */
    .achievements-canvas {
        gap: 10px;
        padding: 8px 10px;
    }
    .achievement-bubble {
        padding: 10px 12px;
        min-height: 135px;
        border-radius: 10px;
    }
    .achievement-metric-badge {
        font-size: 0.74rem;
        padding: 2px 6px;
    }
    .achievement-category-tag {
        font-size: 0.62rem;
        padding: 2px 5px;
    }
    .achievement-title-text {
        font-size: 0.85rem;
        margin-bottom: 2px;
    }
    .achievement-desc-snippet {
        font-size: 0.72rem;
        margin-bottom: 6px;
    }

    body.focus-mode .main-arena-container {
        padding: 14px 18px;
    }
}

/* VISTA ALTERNATIVA EN CUADRÍCULA / TARJETAS (ACTIVIDADES) */
.cards-grid-view.tab-view.active,
.cards-grid-view {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)) !important;
    gap: 16px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 8px;
    box-sizing: border-box;
}

.grid-card {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto !important;
    border-radius: 14px !important;
    top: auto !important;
    left: auto !important;
    padding: 18px !important;
    align-items: flex-start !important;
    text-align: left !important;
}

/* ==========================================
   MODO ENFOQUE / PANTALLA COMPLETA TOTAL
   (Oculta encabezado y estadísticas superiores)
   ========================================== */
body.focus-mode {
    padding: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
}

body.focus-mode .tv-header,
body.focus-mode .metrics-grid,
body.focus-mode .tv-footer {
    display: none !important;
}

body.focus-mode .main-arena-container {
    height: 100vh !important;
    max-height: 100vh !important;
    width: 100vw !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 20px 28px !important;
    box-sizing: border-box !important;
    flex: 1;
}

.floating-focus-clock {
    display: none;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

body.focus-mode .floating-focus-clock {
    display: flex;
}

/* ==========================================
   FOOTER INFERIOR
   ========================================== */
.tv-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: #ffffff;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.sync-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.sync-spinner {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid var(--border-medium);
    border-top-color: var(--conalep-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* MODAL DE DETALLE / SPOTLIGHT CON ANIMACIÓN IN / OUT */
.tv-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                backdrop-filter 0.28s ease,
                visibility 0.28s ease;
}

.tv-modal-backdrop.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.tv-modal-card {
    width: 650px;
    max-width: 90vw;
    padding: 32px;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.05);
    position: relative;
    border: 2px solid var(--conalep-green);
    transform: scale(0.86) translateY(28px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.35, 0.64, 1),
                opacity 0.28s ease;
}

.tv-modal-backdrop.open .tv-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Animación de salida (OUT) */
.tv-modal-backdrop.is-closing {
    opacity: 0;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    pointer-events: none;
    transition: opacity 0.22s ease, backdrop-filter 0.22s ease;
}

.tv-modal-backdrop.is-closing .tv-modal-card {
    transform: scale(0.92) translateY(16px);
    opacity: 0;
    transition: transform 0.22s ease, opacity 0.2s ease;
}

.modal-top-close-btn {
    background: #f1f5f9;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.modal-top-close-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
    transform: scale(1.08);
}

.modal-top-close-btn:active {
    transform: scale(0.94);
}

/* ==========================================
   OPTIMIZACIÓN PARA PANTALLAS GRANDES Y 4K
   (1080p Full HD, 1440p 2K y 2160p 4K)
   ========================================== */
@media (min-width: 1800px) and (min-height: 900px) {
    .tv-header {
        padding: 16px 28px;
    }
    .brand-title h1 {
        font-size: 1.7rem;
    }
    .clock-display {
        font-size: 2.8rem;
    }
    .date-display {
        font-size: 1.1rem;
    }
    .metric-info .metric-num {
        font-size: 2.2rem;
    }
    .metric-icon-box {
        width: 48px;
        height: 48px;
    }
    .bubble-title {
        font-size: 1.35rem;
    }
}

@media (min-width: 2500px) and (min-height: 1400px) {
    body.tv-mode {
        padding: 32px 48px;
    }
    .conalep-logo-header {
        height: 75px;
    }
    .brand-title h1 {
        font-size: 2.4rem;
    }
    .brand-title p {
        font-size: 1.3rem;
    }
    .clock-display {
        font-size: 4rem;
    }
    .date-display {
        font-size: 1.6rem;
    }
    .metric-info h3 {
        font-size: 1.1rem;
    }
    .metric-info .metric-num {
        font-size: 3.2rem;
    }
    .metric-icon-box {
        width: 68px;
        height: 68px;
    }
    .metric-icon-box svg {
        width: 34px;
        height: 34px;
    }
    .bubble-title {
        font-size: 1.8rem;
    }
    .bubble-area-pill {
        font-size: 1rem;
        padding: 4px 14px;
    }
    .bubble-date-pill {
        font-size: 1.1rem;
        padding: 4px 14px;
    }
}

/* ==========================================
   BANNER DE AVISO FLASH EN VIVO (MANDO REMOTO)
   ========================================== */
.tv-flash-banner {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    width: 90%;
    max-width: 980px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 3px solid #ea580c;
    border-radius: 18px;
    padding: 16px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 30px rgba(234, 88, 12, 0.35);
    display: flex;
    align-items: center;
    gap: 18px;
    z-index: 3000;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.3s ease;
}

.tv-flash-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.tv-flash-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #ea580c;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: flashPulse 1.5s ease-in-out infinite;
}

@keyframes flashPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.6); }
    50% { transform: scale(1.08); box-shadow: 0 0 0 10px rgba(234, 88, 12, 0); }
}

.tv-flash-body {
    flex: 1;
}

.tv-flash-badge {
    display: inline-block;
    font-size: 0.76rem;
    font-weight: 800;
    color: #fb923c;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.tv-flash-text {
    font-family: var(--font-heading);
    font-size: clamp(1.1rem, 2.2vw, 1.5rem);
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
}

.tv-flash-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 0 0 15px 15px;
    overflow: hidden;
}

.tv-flash-progress-bar {
    height: 100%;
    width: 100%;
    background: #fb923c;
    animation: bannerCountdown 7s linear forwards;
}

@keyframes bannerCountdown {
    from { width: 100%; }
    to { width: 0%; }
}

/* ==========================================
   PESTAÑAS DE NAVEGACIÓN EN LA ARENA TV
   ========================================== */
.arena-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f5f9;
    padding: 4px 6px;
    border-radius: 12px;
    border: 1px solid var(--border-medium);
}

.arena-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 9px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.arena-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.7);
}

.arena-tab-btn.active {
    background: #ffffff;
    color: var(--conalep-green);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-counter {
    background: #e2e8f0;
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.arena-tab-btn.active .tab-counter {
    background: var(--conalep-green-bg);
    color: var(--conalep-green);
}

.tab-counter.gold {
    background: #fef3c7;
    color: #b45309;
}

.arena-tab-btn.active .tab-counter.gold {
    background: #f59e0b;
    color: #ffffff;
}

/* PESTAÑAS DE VISTA EN LA ARENA */
.tab-view:not(.active) {
    display: none !important;
}

.bubbles-canvas.tab-view.active {
    display: block !important;
}

/* ==========================================
   CANVAS Y BURBUJAS DE RESULTADOS EXPONENCIALES
   (4 COLUMNAS x 2 FILAS = 8 ELEMENTOS POR PÁGINA)
   ========================================== */
.achievements-canvas.tab-view.active {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px;
    padding: 14px 18px;
    height: 100%;
    max-height: 100%;
    box-sizing: border-box;
    width: 100%;
}

.achievement-bubble {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    box-sizing: border-box;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
    animation: achievementPopIn 0.5s cubic-bezier(0.34, 1.4, 0.64, 1) forwards;
    overflow: hidden;
}

.achievement-bubble::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 255, 255, 0) 70%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.achievement-bubble:hover {
    transform: translateY(-4px) scale(1.015);
}

.achievement-bubble:hover::before {
    opacity: 1;
}

.achievement-bubble:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Realces por nivel */
.achievement-bubble.oro {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #ffffff 60%, #fffbeb 100%);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.12), 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.achievement-bubble.oro:hover {
    box-shadow: 0 12px 30px rgba(245, 158, 11, 0.22), 0 0 16px rgba(245, 158, 11, 0.3);
}

.achievement-bubble.diamante {
    border-color: #06b6d4;
    background: linear-gradient(135deg, #ffffff 60%, #ecfeff 100%);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.12), 0 0 0 1px rgba(6, 182, 212, 0.2);
}

.achievement-bubble.diamante:hover {
    box-shadow: 0 12px 30px rgba(6, 182, 212, 0.22), 0 0 16px rgba(6, 182, 212, 0.3);
}

.achievement-bubble.esmeralda {
    border-color: #007A53;
    background: linear-gradient(135deg, #ffffff 60%, #ecfdf5 100%);
    box-shadow: 0 6px 20px rgba(0, 122, 83, 0.12), 0 0 0 1px rgba(0, 122, 83, 0.2);
}

.achievement-bubble.esmeralda:hover {
    box-shadow: 0 12px 30px rgba(0, 122, 83, 0.22), 0 0 16px rgba(0, 122, 83, 0.3);
}

/* Elementos internos del logro */
.achievement-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.achievement-metric-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 7px;
    letter-spacing: -0.1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.achievement-bubble.oro .achievement-metric-badge {
    background: #f59e0b;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.3);
}

.achievement-bubble.diamante .achievement-metric-badge {
    background: #06b6d4;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.3);
}

.achievement-bubble.esmeralda .achievement-metric-badge {
    background: #007A53;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 122, 83, 0.3);
}

.achievement-category-tag {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.achievement-title-text {
    font-family: var(--font-heading);
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.achievement-desc-snippet {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.achievement-footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
}

.achievement-area-badge {
    color: var(--conalep-green);
    display: flex;
    align-items: center;
    gap: 4px;
}

@keyframes achievementPopIn {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==========================================
   PANTALLA DE BLOQUEO / VINCULACIÓN TV (AUTH GUARD)
   ========================================== */
.tv-auth-guard {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: radial-gradient(circle at 50% 30%, #0f172a 0%, #020617 100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                visibility 0.4s ease,
                transform 0.4s ease;
    overflow-y: auto;
}

.tv-auth-guard.unlocked {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.04);
}

.tv-auth-card {
    background: #ffffff;
    border-radius: 28px;
    width: 100%;
    max-width: 860px;
    padding: 36px 42px;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 122, 83, 0.2);
    text-align: center;
    position: relative;
    box-sizing: border-box;
    animation: authCardPop 0.4s cubic-bezier(0.34, 1.35, 0.64, 1);
}

@keyframes authCardPop {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.tv-auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.tv-auth-logo {
    height: 46px;
    object-fit: contain;
}

.tv-auth-badge {
    background: #e6f5ef;
    color: var(--conalep-green);
    border: 1px solid rgba(0, 122, 83, 0.25);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.8px;
}

.tv-auth-icon-pulse {
    width: 72px;
    height: 72px;
    background: #e6f5ef;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px auto;
    color: var(--conalep-green);
    box-shadow: 0 0 0 8px rgba(0, 122, 83, 0.1);
    animation: pulseRing 2.4s infinite;
}

@keyframes pulseRing {
    0% { box-shadow: 0 0 0 0 rgba(0, 122, 83, 0.35); }
    70% { box-shadow: 0 0 0 16px rgba(0, 122, 83, 0); }
    100% { box-shadow: 0 0 0 0 rgba(0, 122, 83, 0); }
}

.tv-auth-title {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.tv-auth-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 28px auto;
    line-height: 1.5;
}

.tv-auth-methods-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    text-align: left;
}

@media (max-width: 768px) {
    .tv-auth-methods-grid {
        grid-template-columns: 1fr;
    }
}

.tv-auth-method-box {
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.method-tag {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--conalep-green);
    margin-bottom: 4px;
}

.method-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* Teclado PIN en Pantalla */
.tv-pin-dots-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.tv-pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #cbd5e1;
    background: transparent;
    transition: all 0.2s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.tv-pin-dot.filled {
    background: var(--conalep-green);
    border-color: var(--conalep-green);
    transform: scale(1.18);
    box-shadow: 0 0 10px rgba(0, 122, 83, 0.45);
}

.tv-pin-error-msg {
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
}

.tv-pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-width: 220px;
    margin: 0 auto;
}

.tv-pin-key {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    padding: 10px 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tv-pin-key:hover {
    background: #e6f5ef;
    border-color: var(--conalep-green);
    color: var(--conalep-green);
    transform: translateY(-1px);
}

.tv-pin-key:active {
    transform: scale(0.94);
}

.tv-pin-key.action {
    background: #f1f5f9;
    color: var(--text-secondary);
}

/* Método 2: Mando Remoto Inalámbrico & Código QR */
.qr-unlock-wrapper {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 18px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.qr-code-box {
    width: 110px;
    height: 110px;
    background: #ffffff;
    padding: 6px;
    border-radius: 12px;
    border: 2px solid var(--conalep-green);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 122, 83, 0.15);
}

.qr-code-box canvas,
.qr-code-box img {
    width: 100% !important;
    height: 100% !important;
    display: block;
    border-radius: 4px;
}

.qr-details {
    flex: 1;
    min-width: 0;
}

.qr-scan-hint {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--conalep-green);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.remote-url-highlight {
    font-family: monospace;
    font-size: 0.88rem;
    font-weight: 800;
    color: #0f172a;
    background: #f1f5f9;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    word-break: break-all;
    display: inline-block;
    margin-bottom: 4px;
}

.qr-subtext {
    font-size: 0.74rem;
    color: var(--text-muted);
    line-height: 1.35;
    margin: 0;
}

.tv-auth-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: auto;
}

.tv-auth-note svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--conalep-green);
}


